@likable-hair/svelte 2.0.4 → 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 +45 -21
- package/dist/components/simple/common/Menu.svelte.d.ts +8 -8
- 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/dist/components/simple/dialogs/Dialog.svelte +7 -6
- package/dist/components/simple/dialogs/Dialog.svelte.d.ts +5 -5
- package/dist/components/simple/forms/SimpleTextField.svelte +149 -0
- package/dist/components/simple/forms/SimpleTextField.svelte.d.ts +69 -0
- package/dist/components/simple/forms/Textfield.svelte +1 -0
- package/dist/components/simple/notifiers/AlertBanner.svelte +92 -0
- package/dist/components/simple/notifiers/AlertBanner.svelte.d.ts +44 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
fly
|
|
4
4
|
} from "svelte/transition";
|
|
5
|
-
export let
|
|
5
|
+
export let _top = void 0, _left = void 0, _width = "auto", _height = "auto", _maxHeight = void 0, _overflow = "auto", _boxShadow = void 0, _borderRadius = void 0;
|
|
6
|
+
export let open = false, refreshPosition = false, activator = void 0, anchor = "bottom", closeOnClickOutside = false, inAnimation = fly, inAnimationConfig = {
|
|
6
7
|
duration: 100,
|
|
7
8
|
y: 10
|
|
8
9
|
}, outAnimation = fly, outAnimationConfig = {
|
|
@@ -16,28 +17,37 @@ function calculateMenuPosition(params) {
|
|
|
16
17
|
if (anchor == "bottom") {
|
|
17
18
|
let { left: activatorLeft, top: activatorTop } = params.activator.getBoundingClientRect();
|
|
18
19
|
let activatorHeight = params.activator.offsetHeight;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
_top = activatorTop + window.scrollY + activatorHeight;
|
|
21
|
+
_left = activatorLeft + window.scrollX;
|
|
21
22
|
} else if (anchor == "bottom-center") {
|
|
22
23
|
let { left: activatorLeft, top: activatorTop } = params.activator.getBoundingClientRect();
|
|
23
24
|
let activatorHeight = params.activator.offsetHeight;
|
|
24
25
|
let activatorWidth = params.activator.offsetWidth;
|
|
25
26
|
let menuWidth = params.menuElement.offsetWidth;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
_top = activatorTop + window.scrollY + activatorHeight;
|
|
28
|
+
_left = activatorLeft + window.scrollX;
|
|
28
29
|
if (menuWidth > activatorWidth) {
|
|
29
|
-
|
|
30
|
+
_left = _left - (menuWidth - activatorWidth) / 2;
|
|
30
31
|
} else {
|
|
31
|
-
|
|
32
|
+
_left = _left + (activatorWidth - menuWidth) / 2;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
if (window.innerWidth + window.scrollX < (
|
|
36
|
-
|
|
36
|
+
if (window.innerWidth + window.scrollX < (_left || 0) + (menuElement?.offsetWidth || 0)) {
|
|
37
|
+
_left = Math.max(
|
|
37
38
|
window.innerWidth + window.scrollX - (menuElement?.offsetWidth || 0),
|
|
38
39
|
0
|
|
39
40
|
);
|
|
40
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
|
+
}
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
$:
|
|
@@ -64,7 +74,7 @@ $:
|
|
|
64
74
|
zIndex = maxZIndex + 2;
|
|
65
75
|
}
|
|
66
76
|
$:
|
|
67
|
-
if (!!
|
|
77
|
+
if (!!_width && !!activator && !!menuElement) {
|
|
68
78
|
calculateMenuPosition({ activator, menuElement });
|
|
69
79
|
}
|
|
70
80
|
$:
|
|
@@ -74,27 +84,41 @@ $:
|
|
|
74
84
|
}
|
|
75
85
|
$:
|
|
76
86
|
if (closeOnClickOutside && !!menuElement) {
|
|
77
|
-
window.addEventListener("
|
|
87
|
+
window.addEventListener("mousedown", () => {
|
|
78
88
|
open = false;
|
|
79
89
|
});
|
|
80
90
|
window.addEventListener("touchstart", () => {
|
|
81
91
|
open = false;
|
|
82
92
|
});
|
|
83
93
|
if (activator) {
|
|
84
|
-
activator.addEventListener("
|
|
94
|
+
activator.addEventListener("mousedown", (event) => {
|
|
85
95
|
event.stopPropagation();
|
|
86
96
|
});
|
|
87
97
|
activator.addEventListener("touchstart", (event) => {
|
|
88
98
|
event.stopPropagation();
|
|
89
99
|
});
|
|
90
100
|
}
|
|
91
|
-
menuElement.addEventListener("
|
|
101
|
+
menuElement.addEventListener("mousedown", (event) => {
|
|
92
102
|
event.stopPropagation();
|
|
93
103
|
});
|
|
94
104
|
menuElement.addEventListener("touchstart", (event) => {
|
|
95
105
|
event.stopPropagation();
|
|
96
106
|
});
|
|
97
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
|
+
}
|
|
98
122
|
</script>
|
|
99
123
|
|
|
100
124
|
{#if open}
|
|
@@ -104,14 +128,14 @@ $:
|
|
|
104
128
|
data-uid={currentUid}
|
|
105
129
|
style:z-index={zIndex}
|
|
106
130
|
style:position="absolute"
|
|
107
|
-
style:top={
|
|
108
|
-
style:box-shadow={
|
|
109
|
-
style:border-radius={
|
|
110
|
-
style:left={
|
|
111
|
-
style:height
|
|
112
|
-
style:max-height={
|
|
113
|
-
style:width
|
|
114
|
-
style:overflow
|
|
131
|
+
style:top={_top + "px"}
|
|
132
|
+
style:box-shadow={_boxShadow}
|
|
133
|
+
style:border-radius={_borderRadius}
|
|
134
|
+
style:left={_left + "px"}
|
|
135
|
+
style:height={_height}
|
|
136
|
+
style:max-height={_maxHeight}
|
|
137
|
+
style:width={_width}
|
|
138
|
+
style:overflow={_overflow}
|
|
115
139
|
in:inAnimation={inAnimationConfig}
|
|
116
140
|
out:outAnimation={outAnimationConfig}
|
|
117
141
|
>
|
|
@@ -2,16 +2,16 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import { type FadeParams, type FlyParams, type SlideParams, type TransitionConfig } from "svelte/transition";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
+
_top?: number | undefined;
|
|
6
|
+
_left?: number | undefined;
|
|
7
|
+
_width?: string | undefined;
|
|
8
|
+
_height?: string | undefined;
|
|
9
|
+
_maxHeight?: string | undefined;
|
|
10
|
+
_overflow?: string | undefined;
|
|
11
|
+
_boxShadow?: string | undefined;
|
|
12
|
+
_borderRadius?: string | undefined;
|
|
5
13
|
open?: boolean | undefined;
|
|
6
|
-
top?: number | undefined;
|
|
7
|
-
left?: number | undefined;
|
|
8
|
-
width: string;
|
|
9
|
-
height: string;
|
|
10
|
-
maxHeight?: string | undefined;
|
|
11
|
-
overflow?: string | undefined;
|
|
12
14
|
refreshPosition?: boolean | undefined;
|
|
13
|
-
boxShadow?: string | undefined;
|
|
14
|
-
borderRadius?: string | undefined;
|
|
15
15
|
activator?: HTMLElement | undefined;
|
|
16
16
|
anchor?: "bottom" | "bottom-center" | undefined;
|
|
17
17
|
closeOnClickOutside?: boolean | undefined;
|
|
@@ -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(() => {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { BROWSER } from "esm-env";
|
|
3
3
|
import { beforeUpdate, onMount } from "svelte";
|
|
4
4
|
import Keyboarder, {} from "../../../utils/keyboarder";
|
|
5
|
-
export let open = false,
|
|
5
|
+
export let open = false, transition = "fly-up";
|
|
6
|
+
export let _overlayOpacity = "30%", _overlayColor = "#282828", _overlayBackdropFilter = void 0, _transitionTimingFunction = "cubic-bezier(0.075, 0.82, 0.165, 1)", _transitionDuration = "0.5s";
|
|
6
7
|
let zIndex = 50, localOpen = open, dialogElement, teleportedUid = void 0, hasBeenOpened = false;
|
|
7
8
|
onMount(() => {
|
|
8
9
|
if (!teleportedUid) {
|
|
@@ -61,14 +62,14 @@ function handleOverlayClick() {
|
|
|
61
62
|
>
|
|
62
63
|
<div
|
|
63
64
|
data-dialog={localOpen}
|
|
64
|
-
style:--dialog-overlay-opacity={
|
|
65
|
-
style:--dialog-transition-timing-function={
|
|
66
|
-
style:--dialog-transition-duration={
|
|
65
|
+
style:--dialog-overlay-opacity={_overlayOpacity}
|
|
66
|
+
style:--dialog-transition-timing-function={_transitionTimingFunction}
|
|
67
|
+
style:--dialog-transition-duration={_transitionDuration}
|
|
67
68
|
style:--dialog-z-index={zIndex}
|
|
68
69
|
style:display="flex"
|
|
69
70
|
style:align-items="center"
|
|
70
71
|
style:justify-content="space-between"
|
|
71
|
-
style:backdrop-filter={localOpen ?
|
|
72
|
+
style:backdrop-filter={localOpen ? _overlayBackdropFilter : 'none'}
|
|
72
73
|
class="overlay-container"
|
|
73
74
|
class:overlay-container-active={localOpen}
|
|
74
75
|
class:overlay-container-deactive={!localOpen}
|
|
@@ -76,7 +77,7 @@ function handleOverlayClick() {
|
|
|
76
77
|
bind:this={dialogElement}
|
|
77
78
|
>
|
|
78
79
|
<div
|
|
79
|
-
style:background-color={
|
|
80
|
+
style:background-color={_overlayColor}
|
|
80
81
|
class="overlay"
|
|
81
82
|
class:overlay-active={localOpen}
|
|
82
83
|
class:hidden-behind={!localOpen && !hasBeenOpened}
|
|
@@ -2,12 +2,12 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
open?: boolean | undefined;
|
|
5
|
-
overlayOpacity?: string | undefined;
|
|
6
|
-
overlayColor?: string | undefined;
|
|
7
|
-
overlayBackdropFilter?: string | undefined;
|
|
8
5
|
transition?: "fly-down" | "fly-up" | "fly-horizontal" | "scale" | "fade" | undefined;
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
_overlayOpacity?: string | undefined;
|
|
7
|
+
_overlayColor?: string | undefined;
|
|
8
|
+
_overlayBackdropFilter?: string | undefined;
|
|
9
|
+
_transitionTimingFunction?: string | undefined;
|
|
10
|
+
_transitionDuration?: string | undefined;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
13
13
|
click: MouseEvent;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script>import Icon from "../media/Icon.svelte";
|
|
2
|
+
export let _padding = null, _width = null, _height = null, _backgroundColor = null, _borderRadius = null, _boxShadow = null, _focusBackgroundColor = null, _focusBoxShadow = null, _transition = null, _fontSize = null, _fontWeight = null, _outerGap = null, _innerGap = null, _hintFontSize = null, _hintColor = null, _hintMarginLeft = null, _marginBottom = null;
|
|
3
|
+
export let value = void 0, type = "text", placeholder = void 0, disabled = false, readonly = false, appendIcon = void 0, appendInnerIcon = void 0, prependIcon = void 0, prependInnerIcon = void 0, iconSize = 12, hint = void 0;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="textfield-container"
|
|
8
|
+
style:--simple-textfield-padding={_padding}
|
|
9
|
+
style:--simple-textfield-height={_height}
|
|
10
|
+
style:--simple-textfield-width={_width}
|
|
11
|
+
style:--simple-textfield-background-color={_backgroundColor}
|
|
12
|
+
style:--simple-textfield-border-radius={_borderRadius}
|
|
13
|
+
style:--simple-textfield-box-shadow={_boxShadow}
|
|
14
|
+
style:--simple-textfield-focus-background-color={_focusBackgroundColor}
|
|
15
|
+
style:--simple-textfield-focus-box-shadow={_focusBoxShadow}
|
|
16
|
+
style:--simple-textfield-transition={_transition}
|
|
17
|
+
style:--simple-textfield-font-size={_fontSize}
|
|
18
|
+
style:--simple-textfield-font-weight={_fontWeight}
|
|
19
|
+
style:--simple-textfield-outer-gap={_outerGap}
|
|
20
|
+
style:--simple-textfield-inner-gap={_innerGap}
|
|
21
|
+
style:--simple-textfield-hint-font-size={_hintFontSize}
|
|
22
|
+
style:--simple-textfield-hint-color={_hintColor}
|
|
23
|
+
style:--simple-textfield-hint-margin-left={_hintMarginLeft}
|
|
24
|
+
style:--simple-textfield-margin-bottom={_marginBottom}
|
|
25
|
+
>
|
|
26
|
+
<div class="row">
|
|
27
|
+
<slot name="prepend" {prependIcon} {iconSize}>
|
|
28
|
+
{#if !!prependIcon}
|
|
29
|
+
<Icon name={prependIcon} size={iconSize}></Icon>
|
|
30
|
+
{/if}
|
|
31
|
+
</slot>
|
|
32
|
+
<div class="textfield">
|
|
33
|
+
<slot name="prepend-inner" {prependInnerIcon} {iconSize}>
|
|
34
|
+
{#if !!prependInnerIcon}
|
|
35
|
+
<Icon name={prependInnerIcon} size={iconSize}></Icon>
|
|
36
|
+
{/if}
|
|
37
|
+
</slot>
|
|
38
|
+
{#if type == "text"}
|
|
39
|
+
<input
|
|
40
|
+
bind:value={value}
|
|
41
|
+
placeholder={placeholder}
|
|
42
|
+
type="text"
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
readonly={readonly}
|
|
45
|
+
on:change
|
|
46
|
+
on:input
|
|
47
|
+
on:focus
|
|
48
|
+
on:blur
|
|
49
|
+
on:keydown
|
|
50
|
+
on:keypress
|
|
51
|
+
on:keyup
|
|
52
|
+
/>
|
|
53
|
+
{:else if type == "password"}
|
|
54
|
+
<input
|
|
55
|
+
bind:value={value}
|
|
56
|
+
placeholder={placeholder}
|
|
57
|
+
type="password"
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
readonly={readonly}
|
|
60
|
+
on:change
|
|
61
|
+
on:input
|
|
62
|
+
on:focus
|
|
63
|
+
on:blur
|
|
64
|
+
on:keydown
|
|
65
|
+
on:keypress
|
|
66
|
+
on:keyup
|
|
67
|
+
/>
|
|
68
|
+
{:else if type == "number"}
|
|
69
|
+
<input
|
|
70
|
+
bind:value={value}
|
|
71
|
+
placeholder={placeholder}
|
|
72
|
+
type="number"
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
readonly={readonly}
|
|
75
|
+
on:change
|
|
76
|
+
on:input
|
|
77
|
+
on:focus
|
|
78
|
+
on:blur
|
|
79
|
+
on:keydown
|
|
80
|
+
on:keypress
|
|
81
|
+
on:keyup
|
|
82
|
+
/>
|
|
83
|
+
{/if}
|
|
84
|
+
<slot name="append-inner" {appendInnerIcon} {iconSize}>
|
|
85
|
+
{#if !!appendInnerIcon}
|
|
86
|
+
<Icon name={appendInnerIcon} size={iconSize}></Icon>
|
|
87
|
+
{/if}
|
|
88
|
+
</slot>
|
|
89
|
+
</div>
|
|
90
|
+
<slot name="append" {appendIcon} {iconSize}>
|
|
91
|
+
{#if !!appendIcon}
|
|
92
|
+
<Icon name={appendIcon} size={iconSize}></Icon>
|
|
93
|
+
{/if}
|
|
94
|
+
</slot>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="row">
|
|
97
|
+
<slot name="hint">
|
|
98
|
+
{#if !!hint}
|
|
99
|
+
<span class="hint">{hint}</span>
|
|
100
|
+
{/if}
|
|
101
|
+
</slot>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<style>
|
|
106
|
+
.row {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: var(--simple-textfield-outer-gap, 8px);
|
|
110
|
+
margin-bottom: var(--simple-textfield-margin-bottom, 5px);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.row:last-of-type {
|
|
114
|
+
margin-bottom: 0px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.hint {
|
|
118
|
+
margin-left: var(--simple-textfield-hint-margin-left, 20px);
|
|
119
|
+
font-size: var(--simple-textfield-hint-font-size, 0.75rem);
|
|
120
|
+
color: var(--simple-textfield-hint-color, grey);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.textfield {
|
|
124
|
+
padding: var(--simple-textfield-padding, 0.65rem 1rem 0.65rem 1rem);
|
|
125
|
+
width: var(--simple-textfield-width, 280px);
|
|
126
|
+
height: var(--simple-textfield-height);
|
|
127
|
+
background-color: var(--simple-textfield-background-color, rgb(244 244 245/1));
|
|
128
|
+
border: none;
|
|
129
|
+
border-radius: var(--simple-textfield-border-radius, 9999px);
|
|
130
|
+
box-shadow: var(--simple-textfield-box-shadow, none);
|
|
131
|
+
transition: var(--simple-textfield-transition, 0.2s);
|
|
132
|
+
gap: var(--simple-textfield-inner-gap, 8px);
|
|
133
|
+
display: flex;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.textfield:focus-within {
|
|
137
|
+
background-color: var(--simple-textfield-focus-background-color, var(--simple-textfield-background-color, rgb(244 244 245/1)));
|
|
138
|
+
box-shadow: var(--simple-textfield-focus-box-shadow, rgba(100, 100, 111, 0.4) 0px 4px 25px 0px);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
input {
|
|
142
|
+
outline: none;
|
|
143
|
+
width: 100%;
|
|
144
|
+
background-color: transparent;
|
|
145
|
+
font-size: var(--simple-textfield-font-size, .9rem);
|
|
146
|
+
font-weight: var(--simple-textfield-font-weight, normal);
|
|
147
|
+
border: none
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
_padding?: string | null | undefined;
|
|
5
|
+
_width?: string | null | undefined;
|
|
6
|
+
_height?: string | null | undefined;
|
|
7
|
+
_backgroundColor?: string | null | undefined;
|
|
8
|
+
_borderRadius?: string | null | undefined;
|
|
9
|
+
_boxShadow?: string | null | undefined;
|
|
10
|
+
_focusBackgroundColor?: string | null | undefined;
|
|
11
|
+
_focusBoxShadow?: string | null | undefined;
|
|
12
|
+
_transition?: string | null | undefined;
|
|
13
|
+
_fontSize?: string | null | undefined;
|
|
14
|
+
_fontWeight?: string | null | undefined;
|
|
15
|
+
_outerGap?: string | null | undefined;
|
|
16
|
+
_innerGap?: string | null | undefined;
|
|
17
|
+
_hintFontSize?: string | null | undefined;
|
|
18
|
+
_hintColor?: string | null | undefined;
|
|
19
|
+
_hintMarginLeft?: string | null | undefined;
|
|
20
|
+
_marginBottom?: string | null | undefined;
|
|
21
|
+
value?: string | number | undefined;
|
|
22
|
+
type?: "number" | "text" | "password" | undefined;
|
|
23
|
+
placeholder?: string | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
readonly?: boolean | undefined;
|
|
26
|
+
appendIcon?: string | undefined;
|
|
27
|
+
appendInnerIcon?: string | undefined;
|
|
28
|
+
prependIcon?: string | undefined;
|
|
29
|
+
prependInnerIcon?: string | undefined;
|
|
30
|
+
iconSize?: number | undefined;
|
|
31
|
+
hint?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
events: {
|
|
34
|
+
change: Event;
|
|
35
|
+
input: Event;
|
|
36
|
+
focus: FocusEvent;
|
|
37
|
+
blur: FocusEvent;
|
|
38
|
+
keydown: KeyboardEvent;
|
|
39
|
+
keypress: KeyboardEvent;
|
|
40
|
+
keyup: KeyboardEvent;
|
|
41
|
+
} & {
|
|
42
|
+
[evt: string]: CustomEvent<any>;
|
|
43
|
+
};
|
|
44
|
+
slots: {
|
|
45
|
+
prepend: {
|
|
46
|
+
prependIcon: string | undefined;
|
|
47
|
+
iconSize: number;
|
|
48
|
+
};
|
|
49
|
+
'prepend-inner': {
|
|
50
|
+
prependInnerIcon: string | undefined;
|
|
51
|
+
iconSize: number;
|
|
52
|
+
};
|
|
53
|
+
'append-inner': {
|
|
54
|
+
appendInnerIcon: string | undefined;
|
|
55
|
+
iconSize: number;
|
|
56
|
+
};
|
|
57
|
+
append: {
|
|
58
|
+
appendIcon: string | undefined;
|
|
59
|
+
iconSize: number;
|
|
60
|
+
};
|
|
61
|
+
hint: {};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type SimpleTextFieldProps = typeof __propDef.props;
|
|
65
|
+
export type SimpleTextFieldEvents = typeof __propDef.events;
|
|
66
|
+
export type SimpleTextFieldSlots = typeof __propDef.slots;
|
|
67
|
+
export default class SimpleTextField extends SvelteComponentTyped<SimpleTextFieldProps, SimpleTextFieldEvents, SimpleTextFieldSlots> {
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { createId } from "@paralleldrive/cuid2";
|
|
|
5
5
|
import { onMount } from "svelte";
|
|
6
6
|
let inputId = createId(), focused = false, legendWidth = 0, labelElement = void 0;
|
|
7
7
|
onMount(() => {
|
|
8
|
+
console.warn("TextField component is going to be depracated. Please use SimpleTextField instead.");
|
|
8
9
|
if (labelElement) {
|
|
9
10
|
legendWidth = labelElement.offsetWidth * 0.8 + 8;
|
|
10
11
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
export let _cursor = "pointer", _bannerColor = "grey", _borderRadius = null, _paddingLeft = null, _paddingRight = null, _paddingTop = null, _paddingBottom = null, _borderWidth = null, _width = null;
|
|
3
|
+
export let title = void 0, description = void 0, disabled = false;
|
|
4
|
+
let dispatch = createEventDispatcher();
|
|
5
|
+
function handleClickEvent(e) {
|
|
6
|
+
if (!disabled)
|
|
7
|
+
dispatch("click", e);
|
|
8
|
+
}
|
|
9
|
+
function handleKeypressEvent(e) {
|
|
10
|
+
if (!disabled)
|
|
11
|
+
dispatch("keypress", e);
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
style:--alert-banner-color={_bannerColor}
|
|
17
|
+
style:--alert-banner-border-radius={_borderRadius}
|
|
18
|
+
style:--alert-banner-padding-left={_paddingLeft}
|
|
19
|
+
style:--alert-banner-padding-right={_paddingRight}
|
|
20
|
+
style:--alert-banner-padding-top={_paddingTop}
|
|
21
|
+
style:--alert-banner-padding-bottom={_paddingBottom}
|
|
22
|
+
style:--alert-banner-border-width={_borderWidth}
|
|
23
|
+
style:width={_width}
|
|
24
|
+
class="alert-banner-container"
|
|
25
|
+
style:cursor={_cursor}
|
|
26
|
+
on:keypress={handleKeypressEvent}
|
|
27
|
+
on:click={handleClickEvent}
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="border-colored"
|
|
31
|
+
></div>
|
|
32
|
+
<div class="body">
|
|
33
|
+
<div class="content">
|
|
34
|
+
<slot name="content" title={title} description={description}>
|
|
35
|
+
{#if !!title}
|
|
36
|
+
<slot name="title" title={title}>
|
|
37
|
+
<div class="title">{title}</div>
|
|
38
|
+
</slot>
|
|
39
|
+
{/if}
|
|
40
|
+
{#if !!description}
|
|
41
|
+
<slot name="description" description={description}>
|
|
42
|
+
<div class="description">{description}</div>
|
|
43
|
+
</slot>
|
|
44
|
+
{/if}
|
|
45
|
+
</slot>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="append">
|
|
48
|
+
<slot name="append" disabled={disabled}></slot>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
.alert-banner-container {
|
|
55
|
+
position: relative;
|
|
56
|
+
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important;
|
|
57
|
+
border-radius: var(--alert-banner-border-radius, 5px);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.border-colored {
|
|
61
|
+
background-color: var(--alert-banner-color);
|
|
62
|
+
position: absolute;
|
|
63
|
+
width: var(--alert-banner-border-width, .7rem);
|
|
64
|
+
top: 0px;
|
|
65
|
+
bottom: 0px;
|
|
66
|
+
border-radius: var(--alert-banner-border-radius, 5px) 0px 0px var(--alert-banner-border-radius, 5px);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.body {
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.content {
|
|
76
|
+
padding-left: var(--alert-banner-padding-left, .5rem);
|
|
77
|
+
padding-top: var(--alert-banner-padding-top, .3rem);
|
|
78
|
+
padding-bottom: var(--alert-banner-padding-bottom, .3rem);
|
|
79
|
+
padding-right: var(--alert-banner-padding-bottom, .3rem);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.title {
|
|
83
|
+
font-weight: 700;
|
|
84
|
+
font-size: 1.2rem;
|
|
85
|
+
padding-left: 10px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.description {
|
|
89
|
+
padding-left: 10px;
|
|
90
|
+
white-space: pre-wrap;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
_cursor?: string | undefined;
|
|
5
|
+
_bannerColor?: string | null | undefined;
|
|
6
|
+
_borderRadius?: string | null | undefined;
|
|
7
|
+
_paddingLeft?: string | null | undefined;
|
|
8
|
+
_paddingRight?: string | null | undefined;
|
|
9
|
+
_paddingTop?: string | null | undefined;
|
|
10
|
+
_paddingBottom?: string | null | undefined;
|
|
11
|
+
_borderWidth?: string | null | undefined;
|
|
12
|
+
_width?: string | null | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
};
|
|
17
|
+
events: {
|
|
18
|
+
click: CustomEvent<MouseEvent>;
|
|
19
|
+
keypress: CustomEvent<KeyboardEvent>;
|
|
20
|
+
} & {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
content: {
|
|
25
|
+
title: string | undefined;
|
|
26
|
+
description: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
title: {
|
|
29
|
+
title: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
description: {
|
|
32
|
+
description: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
append: {
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type AlertBannerProps = typeof __propDef.props;
|
|
40
|
+
export type AlertBannerEvents = typeof __propDef.events;
|
|
41
|
+
export type AlertBannerSlots = typeof __propDef.slots;
|
|
42
|
+
export default class AlertBanner extends SvelteComponentTyped<AlertBannerProps, AlertBannerEvents, AlertBannerSlots> {
|
|
43
|
+
}
|
|
44
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { default as FileInputList } from './components/simple/forms/FileInputLis
|
|
|
19
19
|
export { default as Switch } from './components/simple/forms/Switch.svelte';
|
|
20
20
|
export { default as Textarea } from './components/simple/forms/Textarea.svelte';
|
|
21
21
|
export { default as Textfield } from './components/simple/forms/Textfield.svelte';
|
|
22
|
+
export { default as SimpleTextField } from './components/simple/forms/SimpleTextField.svelte';
|
|
22
23
|
export { default as VerticalSwitch } from './components/simple/forms/VerticalSwitch.svelte';
|
|
23
24
|
export { default as VerticalTextSwitch } from './components/simple/forms/VerticalTextSwitch.svelte';
|
|
24
25
|
export { default as CircularLoader } from './components/simple/loaders/CircularLoader.svelte';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as FileInputList } from './components/simple/forms/FileInputLis
|
|
|
19
19
|
export { default as Switch } from './components/simple/forms/Switch.svelte';
|
|
20
20
|
export { default as Textarea } from './components/simple/forms/Textarea.svelte';
|
|
21
21
|
export { default as Textfield } from './components/simple/forms/Textfield.svelte';
|
|
22
|
+
export { default as SimpleTextField } from './components/simple/forms/SimpleTextField.svelte';
|
|
22
23
|
export { default as VerticalSwitch } from './components/simple/forms/VerticalSwitch.svelte';
|
|
23
24
|
export { default as VerticalTextSwitch } from './components/simple/forms/VerticalTextSwitch.svelte';
|
|
24
25
|
export { default as CircularLoader } from './components/simple/loaders/CircularLoader.svelte';
|
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",
|