@likable-hair/svelte 2.0.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composed/search/GlobalSearchTextField.css +11 -0
- package/dist/components/composed/search/GlobalSearchTextField.svelte +52 -30
- package/dist/components/composed/search/GlobalSearchTextField.svelte.d.ts +6 -9
- package/dist/components/composed/search/SearchBar.css +10 -0
- package/dist/components/composed/search/SearchBar.svelte +43 -20
- package/dist/components/composed/search/SearchBar.svelte.d.ts +6 -9
- package/dist/components/composed/search/SearchResults.css +5 -0
- package/dist/components/composed/search/SearchResults.svelte +45 -23
- package/dist/components/composed/search/SearchResults.svelte.d.ts +7 -8
- package/dist/components/layouts/CollapsibleSideBarLayout.css +5 -0
- package/dist/components/layouts/CollapsibleSideBarLayout.svelte +6 -7
- package/dist/components/layouts/NewCollapsibleSideBarLayout.svelte +155 -0
- package/dist/components/layouts/NewCollapsibleSideBarLayout.svelte.d.ts +38 -0
- package/dist/components/layouts/StableDividedSideBarLayout.css +16 -0
- package/dist/components/layouts/StableDividedSideBarLayout.svelte +81 -31
- package/dist/components/layouts/StableDividedSideBarLayout.svelte.d.ts +7 -10
- package/dist/components/simple/buttons/Button.css +18 -0
- package/dist/components/simple/buttons/Button.svelte +150 -50
- package/dist/components/simple/buttons/Button.svelte.d.ts +5 -25
- package/dist/components/simple/buttons/LinkButton.css +13 -0
- package/dist/components/simple/buttons/LinkButton.svelte +48 -25
- package/dist/components/simple/buttons/LinkButton.svelte.d.ts +2 -11
- package/dist/components/simple/common/CollapsibleDivider.css +14 -0
- package/dist/components/simple/common/CollapsibleDivider.svelte +81 -25
- package/dist/components/simple/common/CollapsibleDivider.svelte.d.ts +1 -11
- package/dist/components/simple/common/Menu.svelte +32 -2
- package/dist/components/simple/common/Menu.svelte.d.ts +1 -0
- package/dist/components/simple/dates/Calendar.css +10 -0
- package/dist/components/simple/dates/Calendar.svelte +52 -17
- package/dist/components/simple/dates/Calendar.svelte.d.ts +7 -10
- package/dist/components/simple/dates/DatePicker.css +9 -0
- package/dist/components/simple/dates/DatePicker.svelte +74 -55
- package/dist/components/simple/dates/DatePicker.svelte.d.ts +15 -11
- package/dist/components/simple/dates/DatePickerTextField.svelte +148 -0
- package/dist/components/simple/dates/DatePickerTextField.svelte.d.ts +28 -0
- package/dist/components/simple/dates/MonthSelector.css +4 -0
- package/dist/components/simple/dates/MonthSelector.svelte +20 -9
- package/dist/components/simple/dates/MonthSelector.svelte.d.ts +5 -4
- package/dist/components/simple/dates/YearSelector.css +4 -0
- package/dist/components/simple/dates/YearSelector.svelte +23 -10
- package/dist/components/simple/dates/YearSelector.svelte.d.ts +3 -2
- package/dist/components/simple/forms/Autocomplete.css +12 -0
- package/dist/components/simple/forms/Autocomplete.svelte +101 -50
- package/dist/components/simple/forms/Autocomplete.svelte.d.ts +7 -29
- package/dist/components/simple/forms/SimpleTextField.css +17 -0
- package/dist/components/simple/forms/SimpleTextField.svelte +110 -44
- package/dist/components/simple/forms/SimpleTextField.svelte.d.ts +13 -22
- package/dist/components/simple/lists/SelectableMenuList.css +7 -0
- package/dist/components/simple/lists/SelectableMenuList.svelte +107 -0
- package/dist/components/simple/lists/SelectableMenuList.svelte.d.ts +38 -0
- package/dist/components/simple/lists/SelectableVerticalList.svelte +1 -1
- package/dist/components/simple/lists/SidebarMenuList.css +7 -0
- package/dist/components/simple/lists/SidebarMenuList.svelte +43 -15
- package/dist/components/simple/lists/SidebarMenuList.svelte.d.ts +1 -0
- package/dist/components/simple/loaders/CircularLoader.css +5 -0
- package/dist/components/simple/loaders/CircularLoader.svelte +20 -4
- package/dist/components/simple/loaders/CircularLoader.svelte.d.ts +2 -3
- package/dist/components/simple/media/Icon.svelte +18 -7
- package/dist/components/simple/media/Icon.svelte.d.ts +0 -2
- package/dist/components/simple/navigation/Chip.css +14 -0
- package/dist/components/simple/navigation/Chip.svelte +74 -15
- package/dist/components/simple/navigation/Chip.svelte.d.ts +2 -3
- package/dist/components/simple/navigation/Drawer.css +9 -0
- package/dist/components/simple/navigation/Drawer.svelte +81 -74
- package/dist/components/simple/navigation/Drawer.svelte.d.ts +1 -8
- package/dist/components/simple/navigation/HeaderMenu.css +3 -0
- package/dist/components/simple/navigation/HeaderMenu.svelte +39 -63
- package/dist/components/simple/navigation/HeaderMenu.svelte.d.ts +5 -9
- package/dist/components/simple/notifiers/AlertBanner.css +9 -0
- package/dist/components/simple/notifiers/AlertBanner.svelte +21 -22
- package/dist/components/simple/notifiers/AlertBanner.svelte.d.ts +6 -9
- package/dist/components/simple/timeline/SimpleTimeLine.svelte.d.ts +1 -1
- package/dist/components/simple/typography/Code.svelte.d.ts +1 -1
- package/dist/css/main.css +261 -0
- package/dist/stores/theme.d.ts +30 -0
- package/dist/stores/theme.js +85 -0
- package/package.json +6 -3
- package/dist/components/simple/buttons/DefaultButton.svelte +0 -93
- package/dist/components/simple/buttons/DefaultButton.svelte.d.ts +0 -50
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import "./LinkButton.css";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
2
3
|
import Icon from "../media/Icon.svelte";
|
|
3
|
-
|
|
4
|
+
let clazz = "";
|
|
5
|
+
export { clazz as class };
|
|
4
6
|
export let disabled = false, href, prependIcon = void 0, appendIcon = void 0, iconSize = void 0, target = void 0;
|
|
5
7
|
const dispatch = createEventDispatcher();
|
|
6
8
|
function handleClick(event) {
|
|
@@ -25,18 +27,7 @@ function handleKeyPress(event) {
|
|
|
25
27
|
href={href}
|
|
26
28
|
target={target}
|
|
27
29
|
rel={target == '_blank' ? 'noreferrer' : undefined}
|
|
28
|
-
|
|
29
|
-
style:--link-button-width={_width}
|
|
30
|
-
style:--link-button-height={_height}
|
|
31
|
-
style:--link-button-font-size={_fontSize}
|
|
32
|
-
style:--link-button-font-weight={_fontWeight}
|
|
33
|
-
style:--link-button-line-height={_lineHeight}
|
|
34
|
-
style:--link-button-padding={_padding}
|
|
35
|
-
style:--link-button-background-color={_backgroundColor}
|
|
36
|
-
style:--link-button-border-radius={_borderRadius}
|
|
37
|
-
style:--link-button-gap={_gap}
|
|
38
|
-
style:--link-button-hover-background-color={_hoverBackgroundColor}
|
|
39
|
-
class="link"
|
|
30
|
+
class="link {clazz}"
|
|
40
31
|
>
|
|
41
32
|
<slot name="prepend" {prependIcon} {iconSize}>
|
|
42
33
|
{#if !!prependIcon}
|
|
@@ -53,16 +44,45 @@ function handleKeyPress(event) {
|
|
|
53
44
|
|
|
54
45
|
<style>
|
|
55
46
|
.link {
|
|
56
|
-
color: var(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
color: var(
|
|
48
|
+
--link-button-color,
|
|
49
|
+
var(--link-button-default-color)
|
|
50
|
+
);
|
|
51
|
+
font-size: var(
|
|
52
|
+
--link-button-font-size,
|
|
53
|
+
var(--link-button-default-font-size)
|
|
54
|
+
);
|
|
55
|
+
line-height: var(
|
|
56
|
+
--link-button-line-height,
|
|
57
|
+
var(--link-button-default-line-height)
|
|
58
|
+
);
|
|
59
|
+
padding: var(
|
|
60
|
+
--link-button-padding,
|
|
61
|
+
var(--link-button-default-padding)
|
|
62
|
+
);
|
|
63
|
+
background-color: var(
|
|
64
|
+
--link-button-background-color,
|
|
65
|
+
var(--link-button-default-background-color)
|
|
66
|
+
);
|
|
67
|
+
border-radius: var(
|
|
68
|
+
--link-button-border-radius,
|
|
69
|
+
var(--link-button-default-border-radius)
|
|
70
|
+
);
|
|
71
|
+
width: var(--link-button-width,
|
|
72
|
+
var(--link-button-default-width)
|
|
73
|
+
);
|
|
74
|
+
height: var(
|
|
75
|
+
--link-button-height,
|
|
76
|
+
var(--link-button-default-height)
|
|
77
|
+
);
|
|
78
|
+
gap: var(
|
|
79
|
+
--link-button-gap,
|
|
80
|
+
var(--link-button-default-gap)
|
|
81
|
+
);
|
|
82
|
+
font-weight: var(
|
|
83
|
+
--link-button-font-weight,
|
|
84
|
+
var(--link-button-default-font-weight)
|
|
85
|
+
);
|
|
66
86
|
display: flex;
|
|
67
87
|
justify-content: center;
|
|
68
88
|
align-content: center;
|
|
@@ -73,6 +93,9 @@ function handleKeyPress(event) {
|
|
|
73
93
|
}
|
|
74
94
|
|
|
75
95
|
.link:hover {
|
|
76
|
-
background-color: var(
|
|
96
|
+
background-color: var(
|
|
97
|
+
--link-button-hover-background-color,
|
|
98
|
+
var(--link-button-default-hover-background-color)
|
|
99
|
+
);
|
|
77
100
|
}
|
|
78
101
|
</style>
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import './LinkButton.css';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
|
-
|
|
5
|
-
_fontSize?: string | null | undefined;
|
|
6
|
-
_lineHeight?: string | null | undefined;
|
|
7
|
-
_padding?: string | null | undefined;
|
|
8
|
-
_backgroundColor?: string | null | undefined;
|
|
9
|
-
_hoverBackgroundColor?: string | null | undefined;
|
|
10
|
-
_borderRadius?: string | null | undefined;
|
|
11
|
-
_width?: string | null | undefined;
|
|
12
|
-
_height?: string | null | undefined;
|
|
13
|
-
_gap?: string | null | undefined;
|
|
14
|
-
_fontWeight?: string | null | undefined;
|
|
5
|
+
class?: string | undefined;
|
|
15
6
|
disabled?: boolean | undefined;
|
|
16
7
|
href: string;
|
|
17
8
|
prependIcon?: string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--collapsible-divider-default-margin-right: .0rem;
|
|
3
|
+
--collapsible-divider-default-margin-left: .5rem;
|
|
4
|
+
--collapsible-divider-default-margin-top: .5rem;
|
|
5
|
+
--collapsible-divider-default-margin-bottom: .5rem;
|
|
6
|
+
--collapsible-divider-default-background-color: rgb(var(--global-color-contrast-500), .5);
|
|
7
|
+
--collapsible-divider-default-line-border-radius: .5rem;
|
|
8
|
+
--collapsible-divider-default-line-height: .1rem;
|
|
9
|
+
--collapsible-divider-default-button-border-radius: 9999px;
|
|
10
|
+
--collapsible-divider-default-button-border: .1rem solid;
|
|
11
|
+
--collapsible-divider-default-button-border-color: rgb(var(--global-color-contrast-500), .5);
|
|
12
|
+
--collapsible-divider-default-button-height: 25px;
|
|
13
|
+
--collapsible-divider-default-button-width: 25px;
|
|
14
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import "./CollapsibleDivider.css";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
2
3
|
import Icon from "../media/Icon.svelte";
|
|
3
4
|
let dispatch = createEventDispatcher();
|
|
4
|
-
export let collapsed = false, openedIconName = "mdi-chevron-left", collapsedIconName = "mdi-chevron-right",
|
|
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;
|
|
5
|
+
export let collapsed = false, openedIconName = "mdi-chevron-left", collapsedIconName = "mdi-chevron-right", disabled = false;
|
|
7
6
|
function handleCollapseClick() {
|
|
8
7
|
if (!disabled) {
|
|
9
8
|
collapsed = !collapsed;
|
|
@@ -13,36 +12,93 @@ function handleCollapseClick() {
|
|
|
13
12
|
</script>
|
|
14
13
|
|
|
15
14
|
<div
|
|
16
|
-
|
|
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"
|
|
15
|
+
class="container"
|
|
22
16
|
>
|
|
23
17
|
<div
|
|
24
|
-
|
|
25
|
-
style:border-radius={_radius}
|
|
26
|
-
style:height={_height}
|
|
27
|
-
style:flex-grow={1}
|
|
18
|
+
class="divider"
|
|
28
19
|
/>
|
|
29
20
|
<div
|
|
30
|
-
|
|
31
|
-
|
|
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}
|
|
21
|
+
class="button"
|
|
22
|
+
class:disabled={disabled}
|
|
40
23
|
on:click="{handleCollapseClick}"
|
|
41
24
|
on:click
|
|
42
25
|
on:keydown
|
|
43
26
|
on:keyup
|
|
44
27
|
on:keypress
|
|
45
28
|
>
|
|
46
|
-
<Icon
|
|
29
|
+
<Icon
|
|
30
|
+
name={collapsed ? collapsedIconName : openedIconName}
|
|
31
|
+
--icon-default-color="var(--collapsible-divider-button-border-color, var(--collapsible-divider-default-button-border-color))"
|
|
32
|
+
></Icon>
|
|
47
33
|
</div>
|
|
48
34
|
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.container {
|
|
38
|
+
display: flex;
|
|
39
|
+
margin-right: var(
|
|
40
|
+
--collapsible-divider-margin-right,
|
|
41
|
+
var(--collapsible-divider-default-margin-right)
|
|
42
|
+
);
|
|
43
|
+
margin-left: var(
|
|
44
|
+
--collapsible-divider-margin-left,
|
|
45
|
+
var(--collapsible-divider-default-margin-left)
|
|
46
|
+
);
|
|
47
|
+
margin-top: var(
|
|
48
|
+
--collapsible-divider-margin-top,
|
|
49
|
+
var(--collapsible-divider-default-margin-top)
|
|
50
|
+
);
|
|
51
|
+
margin-bottom: var(
|
|
52
|
+
--collapsible-divider-margin-bottom,
|
|
53
|
+
var(--collapsible-divider-default-margin-bottom)
|
|
54
|
+
);
|
|
55
|
+
align-items: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.divider {
|
|
59
|
+
flex-grow: 1;
|
|
60
|
+
background-color: var(
|
|
61
|
+
--collapsible-divider-background-color,
|
|
62
|
+
var(--collapsible-divider-default-background-color)
|
|
63
|
+
);
|
|
64
|
+
border-radius: var(
|
|
65
|
+
--collapsible-divider-line-border-radius,
|
|
66
|
+
var(--collapsible-divider-default-line-border-radius)
|
|
67
|
+
);
|
|
68
|
+
height: var(
|
|
69
|
+
--collapsible-divider-line-height,
|
|
70
|
+
var(--collapsible-divider-default-line-height)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.button {
|
|
75
|
+
display: flex;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
border-radius: var(
|
|
79
|
+
--collapsible-divider-button-border-radius,
|
|
80
|
+
var(--collapsible-divider-default-button-border-radius)
|
|
81
|
+
);
|
|
82
|
+
border: var(
|
|
83
|
+
--collapsible-divider-button-border,
|
|
84
|
+
var(--collapsible-divider-default-button-border)
|
|
85
|
+
);
|
|
86
|
+
border-color: var(
|
|
87
|
+
--collapsible-divider-button-border-color,
|
|
88
|
+
var(--collapsible-divider-default-button-border-color)
|
|
89
|
+
);
|
|
90
|
+
width: var(
|
|
91
|
+
--collapsible-divider-button-width,
|
|
92
|
+
var(--collapsible-divider-default-button-width)
|
|
93
|
+
);
|
|
94
|
+
height: var(
|
|
95
|
+
--collapsible-divider-button-height,
|
|
96
|
+
var(--collapsible-divider-default-button-height)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.button.disabled {
|
|
101
|
+
opacity: .5;
|
|
102
|
+
cursor: not-allowed;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import './CollapsibleDivider.css';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
collapsed?: boolean | undefined;
|
|
5
6
|
openedIconName?: string | undefined;
|
|
6
7
|
collapsedIconName?: string | undefined;
|
|
7
|
-
iconSize?: number | undefined;
|
|
8
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
9
|
};
|
|
20
10
|
events: {
|
|
21
11
|
click: MouseEvent;
|
|
@@ -9,8 +9,8 @@ export let open = false, refreshPosition = false, activator = void 0, anchor = "
|
|
|
9
9
|
}, outAnimation = fly, outAnimationConfig = {
|
|
10
10
|
duration: 100,
|
|
11
11
|
y: 10
|
|
12
|
-
}, menuElement = void 0;
|
|
13
|
-
let zIndex = 50, currentUid = createId();
|
|
12
|
+
}, menuElement = void 0, openingId = void 0;
|
|
13
|
+
let zIndex = 50, currentUid = createId(), closeController;
|
|
14
14
|
function calculateMenuPosition(params) {
|
|
15
15
|
if (params.menuElement) {
|
|
16
16
|
if (params.activator) {
|
|
@@ -52,6 +52,19 @@ function calculateMenuPosition(params) {
|
|
|
52
52
|
}
|
|
53
53
|
$:
|
|
54
54
|
if (open) {
|
|
55
|
+
if (!!openingId) {
|
|
56
|
+
const controllers = document.querySelectorAll(`[data-operation="close"][data-opening-id="${openingId}"]`);
|
|
57
|
+
for (let k = 0; k < controllers.length; k += 1) {
|
|
58
|
+
if (controllers[k] !== closeController) {
|
|
59
|
+
const clickEvent = new MouseEvent("click", {
|
|
60
|
+
bubbles: true,
|
|
61
|
+
cancelable: true,
|
|
62
|
+
view: window
|
|
63
|
+
});
|
|
64
|
+
controllers[k].dispatchEvent(clickEvent);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
55
68
|
let otherMenus = document.querySelectorAll("[data-menu=true]");
|
|
56
69
|
let otherDialogs = document.querySelectorAll("[data-dialog=true]");
|
|
57
70
|
let maxZIndex = void 0;
|
|
@@ -119,8 +132,19 @@ function getPositionedAncestor(elem) {
|
|
|
119
132
|
return elem;
|
|
120
133
|
return getPositionedAncestor(elem.parentElement);
|
|
121
134
|
}
|
|
135
|
+
function handleCloseControllerClick() {
|
|
136
|
+
open = false;
|
|
137
|
+
}
|
|
122
138
|
</script>
|
|
123
139
|
|
|
140
|
+
<div
|
|
141
|
+
class="controller"
|
|
142
|
+
data-operation="close"
|
|
143
|
+
data-opening-id={openingId}
|
|
144
|
+
on:click={handleCloseControllerClick}
|
|
145
|
+
on:keypress={handleCloseControllerClick}
|
|
146
|
+
bind:this={closeController}
|
|
147
|
+
></div>
|
|
124
148
|
{#if open}
|
|
125
149
|
<div
|
|
126
150
|
bind:this={menuElement}
|
|
@@ -142,3 +166,9 @@ function getPositionedAncestor(elem) {
|
|
|
142
166
|
<slot />
|
|
143
167
|
</div>
|
|
144
168
|
{/if}
|
|
169
|
+
|
|
170
|
+
<style>
|
|
171
|
+
.controller {
|
|
172
|
+
visibility: hidden;
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -20,6 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
outAnimation?: ((node: Element, params?: SlideParams | FlyParams | FadeParams) => TransitionConfig) | undefined;
|
|
21
21
|
outAnimationConfig?: SlideParams | FlyParams | FadeParams | undefined;
|
|
22
22
|
menuElement?: HTMLElement | undefined;
|
|
23
|
+
openingId?: string | undefined;
|
|
23
24
|
};
|
|
24
25
|
events: {
|
|
25
26
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--calendar-default-height: 100%;
|
|
3
|
+
--calendar-default-width: 100%;
|
|
4
|
+
--calendar-default-day-width: 30px;
|
|
5
|
+
--calendar-default-day-height: 30px;
|
|
6
|
+
--calendar-default-day-hover-background-color: rgb(var(--global-color-primary-600), .3);
|
|
7
|
+
--calendar-default-selected-day-background-color: rgb(var(--global-color-primary-600));
|
|
8
|
+
--calendar-default-selected-day-color: rgb(var(--global-color-grey-50));
|
|
9
|
+
--calendar-default-grid-gap: 1px;
|
|
10
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import "./Calendar.css";
|
|
2
|
+
import { fly } from "svelte/transition";
|
|
2
3
|
import { getDateRowsStats, getDaysNames } from "./utils";
|
|
3
|
-
|
|
4
|
+
let clazz = {};
|
|
5
|
+
export { clazz as class };
|
|
6
|
+
export let selectedDate = void 0, visibleMonth = (/* @__PURE__ */ new Date()).getMonth(), visibleYear = (/* @__PURE__ */ new Date()).getFullYear(), locale = "it", showExtraMonthDays = true, showHeader = true, animationDuration = 200;
|
|
4
7
|
import { createEventDispatcher } from "svelte";
|
|
5
8
|
const dispatch = createEventDispatcher();
|
|
6
9
|
function handleDayClick(dateStat, extraMonth) {
|
|
@@ -23,18 +26,17 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
23
26
|
}
|
|
24
27
|
</script>
|
|
25
28
|
|
|
26
|
-
<div
|
|
29
|
+
<div class="container {clazz.container || ''}">
|
|
27
30
|
{#key visibleMonth}
|
|
28
31
|
<div
|
|
29
32
|
in:fly={{ delay: animationDuration, duration: animationDuration, y: 30 }}
|
|
30
33
|
out:fly|local={{ duration: animationDuration, y: -30 }}
|
|
31
|
-
style:gap={gridGap}
|
|
32
34
|
class="grid-layout"
|
|
33
35
|
>
|
|
34
36
|
{#if showHeader}
|
|
35
37
|
{#each getDaysNames(locale).map((name) => name[0]) as weekHeader, index}
|
|
36
38
|
<slot name="weekHeader" header={weekHeader} {index}>
|
|
37
|
-
<div class="week-header-slot">{weekHeader}</div>
|
|
39
|
+
<div class="week-header-slot {clazz.weekHeader || ''}">{weekHeader}</div>
|
|
38
40
|
</slot>
|
|
39
41
|
{/each}
|
|
40
42
|
{/if}
|
|
@@ -49,14 +51,7 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
49
51
|
{#if (!showExtraMonthDays && day.month == visibleMonth) || showExtraMonthDays}
|
|
50
52
|
<div
|
|
51
53
|
style:border-radius="50%"
|
|
52
|
-
|
|
53
|
-
style:height={dayHeight}
|
|
54
|
-
style:width={dayWidth}
|
|
55
|
-
style:cursor={extraMonth ? "default" : "pointer"}
|
|
56
|
-
style:--calendar-hover-color={extraMonth ? "" : dayHoverColor}
|
|
57
|
-
style:--calendar-selected-color={daySelectedColor}
|
|
58
|
-
style:--calendar-selected-text-color={selectedTextColor}
|
|
59
|
-
class="day-slot"
|
|
54
|
+
class="day-slot {clazz.day || ''}"
|
|
60
55
|
class:extra-month={extraMonth}
|
|
61
56
|
class:selected
|
|
62
57
|
class:not-selected={!selected}
|
|
@@ -75,10 +70,25 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
75
70
|
</div>
|
|
76
71
|
|
|
77
72
|
<style>
|
|
73
|
+
.container {
|
|
74
|
+
height: var(
|
|
75
|
+
--calendar-height,
|
|
76
|
+
var(--calendar-default-height)
|
|
77
|
+
);
|
|
78
|
+
width: var(
|
|
79
|
+
--calendar-width,
|
|
80
|
+
var(--calendar-default-width)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
.grid-layout {
|
|
79
85
|
display: grid;
|
|
80
86
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
|
|
81
87
|
height: 100%;
|
|
88
|
+
gap: var(
|
|
89
|
+
--calendar-grid-gap,
|
|
90
|
+
var(--calendar-default-grid-gap)
|
|
91
|
+
);
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
.day-slot {
|
|
@@ -88,6 +98,22 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
88
98
|
justify-self: center;
|
|
89
99
|
align-self: center;
|
|
90
100
|
transition: background-color 0.1s ease-in;
|
|
101
|
+
height: var(
|
|
102
|
+
--calendar-day-height,
|
|
103
|
+
var(--calendar-default-day-height)
|
|
104
|
+
);
|
|
105
|
+
width: var(
|
|
106
|
+
--calendar-day-width,
|
|
107
|
+
var(--calendar-default-day-width)
|
|
108
|
+
);
|
|
109
|
+
background-color: var(
|
|
110
|
+
--calendar-day-background-color,
|
|
111
|
+
var(--calendar-default-day-background-color)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.day-slot:not(.extra-month) {
|
|
116
|
+
cursor: pointer;
|
|
91
117
|
}
|
|
92
118
|
|
|
93
119
|
.extra-month {
|
|
@@ -95,12 +121,21 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
95
121
|
}
|
|
96
122
|
|
|
97
123
|
.selected {
|
|
98
|
-
background-color: var(
|
|
99
|
-
|
|
124
|
+
background-color: var(
|
|
125
|
+
--calendar-selected-day-background-color,
|
|
126
|
+
var(--calendar-default-selected-day-background-color)
|
|
127
|
+
);
|
|
128
|
+
color: var(
|
|
129
|
+
--calendar-selected-day-color,
|
|
130
|
+
var(--calendar-default-selected-day-color)
|
|
131
|
+
);
|
|
100
132
|
}
|
|
101
133
|
|
|
102
|
-
.day-slot.not-selected:hover {
|
|
103
|
-
background-color: var(
|
|
134
|
+
.day-slot.not-selected:hover:not(.extra-month) {
|
|
135
|
+
background-color: var(
|
|
136
|
+
--calendar-day-hover-background-color,
|
|
137
|
+
var(--calendar-default-day-hover-background-color)
|
|
138
|
+
);
|
|
104
139
|
}
|
|
105
140
|
|
|
106
141
|
.week-header-slot {
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import './Calendar.css';
|
|
2
3
|
import type { DateStat, Locale } from "./utils";
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
|
-
|
|
6
|
+
class?: {
|
|
7
|
+
container?: string | undefined;
|
|
8
|
+
weekHeader?: string | undefined;
|
|
9
|
+
day?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
selectedDate?: Date | undefined | null;
|
|
6
12
|
visibleMonth?: number | undefined;
|
|
7
13
|
visibleYear?: number | undefined;
|
|
8
14
|
locale?: Locale | undefined;
|
|
9
15
|
showExtraMonthDays?: boolean | undefined;
|
|
10
16
|
showHeader?: boolean | undefined;
|
|
11
|
-
height?: string | undefined;
|
|
12
|
-
width?: string | undefined;
|
|
13
|
-
dayWidth?: string | undefined;
|
|
14
|
-
dayHeight?: string | undefined;
|
|
15
|
-
dayHoverColor?: string | undefined;
|
|
16
|
-
daySelectedColor?: string | undefined;
|
|
17
|
-
selectedTextColor?: string | undefined;
|
|
18
|
-
gridGap?: string | undefined;
|
|
19
|
-
dayBackgroundColor?: string | undefined;
|
|
20
17
|
animationDuration?: number | undefined;
|
|
21
18
|
};
|
|
22
19
|
events: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--date-picker-default-primary-color: rgb(var(--global-color-primary-600));
|
|
3
|
+
--date-picker-default-height: 400px;
|
|
4
|
+
--date-picker-default-width: 100%;
|
|
5
|
+
--date-picker-default-header-background-color: rgb(var(--global-color-primary-600));
|
|
6
|
+
--date-picker-default-header-color: rgb(var(--global-color-grey-50));
|
|
7
|
+
--date-picker-default-box-shadow: 0 4px 6px -1px rgb(var(--global-color-contrast-300), .1),
|
|
8
|
+
0 2px 4px -2px rgb(var(--global-color-contrast-300), .1);
|
|
9
|
+
}
|