@likable-hair/svelte 3.0.54 → 3.0.56
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/buttons/ActivableButton.svelte +49 -0
- package/dist/components/composed/buttons/ActivableButton.svelte.d.ts +34 -0
- package/dist/components/composed/common/MenuOrDrawer.svelte +3 -1
- package/dist/components/composed/common/MenuOrDrawer.svelte.d.ts +2 -0
- package/dist/components/composed/common/MenuOrDrawerOptions.svelte +3 -1
- package/dist/components/composed/common/MenuOrDrawerOptions.svelte.d.ts +3 -0
- package/dist/components/{simple/dates → composed/forms}/DatePickerTextField.svelte +54 -35
- package/dist/components/{simple/dates → composed/forms}/DatePickerTextField.svelte.d.ts +16 -1
- package/dist/components/composed/forms/Dropdown.svelte +27 -3
- package/dist/components/composed/forms/Dropdown.svelte.d.ts +8 -0
- package/dist/components/composed/forms/IconsDropdown.svelte +73 -0
- package/dist/components/composed/forms/IconsDropdown.svelte.d.ts +23 -0
- package/dist/components/composed/search/FilterEditor.svelte +1 -1
- package/dist/components/composed/search/MobileFilterEditor.svelte +1 -1
- package/dist/components/layouts/UnstableDividedSideBarLayout.svelte +2 -2
- package/dist/components/simple/buttons/Button.svelte +33 -2
- package/dist/components/simple/dates/DatePicker.svelte +1 -1
- package/dist/components/simple/dates/TimePicker.css +10 -0
- package/dist/components/simple/dates/TimePicker.svelte +170 -0
- package/dist/components/simple/dates/TimePicker.svelte.d.ts +24 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script>import Button from "../../simple/buttons/Button.svelte";
|
|
2
|
+
export let active = false, buttonProps = {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<Button
|
|
6
|
+
on:click={() => active = !active}
|
|
7
|
+
on:click
|
|
8
|
+
{...buttonProps}
|
|
9
|
+
buttonType="text"
|
|
10
|
+
--button-default-text-background-color={active ?
|
|
11
|
+
"var(--activable-button-active-background-color, rgb(var(--global-color-primary-500)))" :
|
|
12
|
+
"var(--activable-button-deactive-background-color, none)"
|
|
13
|
+
}
|
|
14
|
+
--button-default-text-color={active ?
|
|
15
|
+
"var(--activable-button-active-color, rgb(var(--global-color-grey-50)))" :
|
|
16
|
+
"var(--activable-button-deactive-color, rgb(var(--global-color-contrast-900)))"
|
|
17
|
+
}
|
|
18
|
+
--button-default-text-hover-background-color={active ?
|
|
19
|
+
"var(--activable-button-hover-active-background-color, rgb(var(--global-color-primary-500)))" :
|
|
20
|
+
"var(--activable-button-hover-deactive-background-color, rgb(var(--global-color-background-200)))"
|
|
21
|
+
}
|
|
22
|
+
--button-default-text-hover-color={active ?
|
|
23
|
+
"var(--activable-button-hover-active-color, rgb(var(--global-color-grey-50)))" :
|
|
24
|
+
undefined
|
|
25
|
+
}
|
|
26
|
+
--button-default-text-active-background-color={active ?
|
|
27
|
+
"var(--activable-button-active-active-background-color, rgb(var(--global-color-primary-500)))" :
|
|
28
|
+
"var(--activable-button-active-deactive-background-color, rgb(var(--global-color-background-200)))"
|
|
29
|
+
}
|
|
30
|
+
--button-default-text-active-color={active ?
|
|
31
|
+
"var(--activable-button-active-active-color, rgb(var(--global-color-grey-50)))" :
|
|
32
|
+
undefined
|
|
33
|
+
}
|
|
34
|
+
--button-default-text-focus-background-color={active ?
|
|
35
|
+
"var(--activable-button-focus-active-background-color, rgb(var(--global-color-primary-500)))" :
|
|
36
|
+
"var(--activable-button-focus-deactive-background-color, rgb(var(--global-color-background-200)))"
|
|
37
|
+
}
|
|
38
|
+
--button-default-text-focus-color={active ?
|
|
39
|
+
"var(--activable-button-focus-active-color, rgb(var(--global-color-grey-50)))" :
|
|
40
|
+
undefined
|
|
41
|
+
}
|
|
42
|
+
--button-default-disabled-background-color="none"
|
|
43
|
+
--button-default-disabled-color="rgb(var(--global-color-contrast-900), .5)"
|
|
44
|
+
>
|
|
45
|
+
<slot />
|
|
46
|
+
<svelte:fragment slot="append">
|
|
47
|
+
<slot name="append" />
|
|
48
|
+
</svelte:fragment>
|
|
49
|
+
</Button>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
active?: boolean | undefined;
|
|
5
|
+
buttonProps?: {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
class?: string | undefined;
|
|
8
|
+
buttonType?: "default" | "text" | "icon" | undefined;
|
|
9
|
+
type?: "submit" | "button" | undefined;
|
|
10
|
+
loading?: boolean | undefined;
|
|
11
|
+
icon?: string | undefined;
|
|
12
|
+
tabindex?: number | null | undefined;
|
|
13
|
+
disabled?: boolean | undefined;
|
|
14
|
+
buttonElement?: HTMLElement | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
};
|
|
17
|
+
events: {
|
|
18
|
+
click: CustomEvent<{
|
|
19
|
+
nativeEvent: MouseEvent;
|
|
20
|
+
}>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {};
|
|
26
|
+
append: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ActivableButtonProps = typeof __propDef.props;
|
|
30
|
+
export type ActivableButtonEvents = typeof __propDef.events;
|
|
31
|
+
export type ActivableButtonSlots = typeof __propDef.slots;
|
|
32
|
+
export default class ActivableButton extends SvelteComponentTyped<ActivableButtonProps, ActivableButtonEvents, ActivableButtonSlots> {
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Drawer from "../../simple/navigation/Drawer.svelte";
|
|
3
3
|
import Menu from "../../simple/common/Menu.svelte";
|
|
4
4
|
import MediaQuery from "../../simple/common/MediaQuery.svelte";
|
|
5
|
-
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _width = void 0, _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
5
|
+
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", stayInViewport = true, flipOnOverflow = false, _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _width = void 0, _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<MediaQuery let:mAndDown>
|
|
@@ -27,6 +27,8 @@ export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bot
|
|
|
27
27
|
_borderRadius={_borderRadius}
|
|
28
28
|
_width={_width || ""}
|
|
29
29
|
anchor={menuAnchor}
|
|
30
|
+
bind:stayInViewport={stayInViewport}
|
|
31
|
+
bind:flipOnOverflow={flipOnOverflow}
|
|
30
32
|
>
|
|
31
33
|
<slot isDrawer={false} isMenu={true}></slot>
|
|
32
34
|
</Menu>
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
activator: HTMLElement;
|
|
10
10
|
drawerPosition?: ComponentProps<Drawer>['position'];
|
|
11
11
|
menuAnchor?: ComponentProps<Menu>['anchor'];
|
|
12
|
+
stayInViewport?: ComponentProps<Menu>['stayInViewport'];
|
|
13
|
+
flipOnOverflow?: ComponentProps<Menu>['flipOnOverflow'];
|
|
12
14
|
_boxShadow?: string | undefined;
|
|
13
15
|
_height?: string | undefined;
|
|
14
16
|
_width?: string | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script>import "../../../css/main.css";
|
|
4
4
|
import MenuOrDrawer from "./MenuOrDrawer.svelte";
|
|
5
5
|
import SelectableVerticalList from "../../simple/lists/SelectableVerticalList.svelte";
|
|
6
|
-
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", elements = [], _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
6
|
+
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", elements = [], stayInViewport = true, flipOnOverflow = false, _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
7
7
|
let selected;
|
|
8
8
|
let focused;
|
|
9
9
|
$:
|
|
@@ -19,6 +19,8 @@ $:
|
|
|
19
19
|
bind:activator
|
|
20
20
|
bind:drawerPosition
|
|
21
21
|
bind:menuAnchor
|
|
22
|
+
bind:stayInViewport
|
|
23
|
+
bind:flipOnOverflow
|
|
22
24
|
{_boxShadow}
|
|
23
25
|
{_height}
|
|
24
26
|
{_maxHeight}
|
|
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
export type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
3
3
|
import '../../../css/main.css';
|
|
4
4
|
import type { ComponentProps } from 'svelte';
|
|
5
|
+
import MenuOrDrawer from "./MenuOrDrawer.svelte";
|
|
5
6
|
import type Drawer from '../../simple/navigation/Drawer.svelte';
|
|
6
7
|
import type Menu from '../../simple/common/Menu.svelte';
|
|
7
8
|
import SelectableVerticalList from '../../simple/lists/SelectableVerticalList.svelte';
|
|
@@ -12,6 +13,8 @@ declare const __propDef: {
|
|
|
12
13
|
drawerPosition?: ComponentProps<Drawer>['position'];
|
|
13
14
|
menuAnchor?: ComponentProps<Menu>['anchor'];
|
|
14
15
|
elements?: ComponentProps<SelectableVerticalList>['elements'];
|
|
16
|
+
stayInViewport?: ComponentProps<MenuOrDrawer>['stayInViewport'];
|
|
17
|
+
flipOnOverflow?: ComponentProps<MenuOrDrawer>['flipOnOverflow'];
|
|
15
18
|
_boxShadow?: string | undefined;
|
|
16
19
|
_height?: string | undefined;
|
|
17
20
|
_maxHeight?: string | undefined;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script>import IMask, { InputMask } from "imask";
|
|
2
|
-
import SimpleTextField from "
|
|
3
|
-
import DatePicker from "
|
|
4
|
-
import Menu from "
|
|
5
|
-
import Icon from "
|
|
2
|
+
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
3
|
+
import DatePicker from "../../simple/dates/DatePicker.svelte";
|
|
4
|
+
import Menu from "../../simple/common/Menu.svelte";
|
|
5
|
+
import Icon from "../../simple/media/Icon.svelte";
|
|
6
6
|
import { onMount } from "svelte";
|
|
7
7
|
import { DateTime } from "luxon";
|
|
8
8
|
import { createEventDispatcher } from "svelte";
|
|
9
|
-
import MediaQuery from "
|
|
10
|
-
import Dialog from "
|
|
9
|
+
import MediaQuery from "../../simple/common/MediaQuery.svelte";
|
|
10
|
+
import Dialog from "../../simple/dialogs/Dialog.svelte";
|
|
11
|
+
let clazz = {};
|
|
12
|
+
export { clazz as class };
|
|
11
13
|
let dispatch = createEventDispatcher();
|
|
12
14
|
export let menuOpened = false, openingId = "date-picker-text-field", pattern = "dd/MM/yyyy", selectedMonth = void 0, selectedYear = void 0, visibleMonth = void 0, visibleYear = void 0, selectedDate = void 0, placeholder = void 0, mobileDialog = true;
|
|
13
15
|
let activator, refreshPosition = false, menuElement, inputElement, mask = {
|
|
@@ -66,7 +68,7 @@ onMount(() => {
|
|
|
66
68
|
function handleInputChange(event) {
|
|
67
69
|
setTimeout(() => {
|
|
68
70
|
const typedValue = mask.value;
|
|
69
|
-
if (
|
|
71
|
+
if (typedValue !== void 0 && typedValue !== null) {
|
|
70
72
|
const dayOfMonthIndex = pattern.indexOf("dd");
|
|
71
73
|
const dayOfMonth = typedValue.substring(dayOfMonthIndex, dayOfMonthIndex + 2);
|
|
72
74
|
const monthIndex = pattern.indexOf("MM");
|
|
@@ -120,36 +122,47 @@ $:
|
|
|
120
122
|
<MediaQuery let:mAndDown>
|
|
121
123
|
<div
|
|
122
124
|
bind:this={activator}
|
|
125
|
+
class="date-picker-activator {clazz.activator || ''}"
|
|
123
126
|
>
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
<slot
|
|
128
|
+
name="activator"
|
|
129
|
+
{mask}
|
|
130
|
+
{handleTextFieldFocus}
|
|
131
|
+
{handleInputChange}
|
|
132
|
+
{inputElement}
|
|
133
|
+
{placeholder}
|
|
130
134
|
>
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
135
|
+
<SimpleTextField
|
|
136
|
+
bind:value={mask.value}
|
|
137
|
+
on:focus={() => handleTextFieldFocus(mAndDown)}
|
|
138
|
+
on:keydown={handleInputChange}
|
|
139
|
+
bind:input={inputElement}
|
|
140
|
+
bind:placeholder
|
|
141
|
+
class={clazz.textfield}
|
|
142
|
+
>
|
|
143
|
+
<svelte:fragment slot="prepend-inner" let:prependInnerIcon let:iconSize>
|
|
144
|
+
<slot name="prepend-inner" {prependInnerIcon} {iconSize}>
|
|
145
|
+
<Icon
|
|
146
|
+
name="mdi-calendar"
|
|
147
|
+
click
|
|
148
|
+
on:click={() => menuOpened = !menuOpened}
|
|
149
|
+
></Icon>
|
|
150
|
+
</slot>
|
|
151
|
+
</svelte:fragment>
|
|
152
|
+
<svelte:fragment slot="append-inner" let:appendInnerIcon let:iconSize>
|
|
153
|
+
<slot name="append-inner" {appendInnerIcon} {iconSize}>
|
|
154
|
+
</slot>
|
|
155
|
+
</svelte:fragment>
|
|
156
|
+
<svelte:fragment slot="prepend" let:prependIcon let:iconSize>
|
|
157
|
+
<slot name="append-inner" {prependIcon} {iconSize}>
|
|
158
|
+
</slot>
|
|
159
|
+
</svelte:fragment>
|
|
160
|
+
<svelte:fragment slot="append" let:appendIcon let:iconSize>
|
|
161
|
+
<slot name="append-inner" {appendIcon} {iconSize}>
|
|
162
|
+
</slot>
|
|
163
|
+
</svelte:fragment>
|
|
164
|
+
</SimpleTextField>
|
|
165
|
+
</slot>
|
|
153
166
|
</div>
|
|
154
167
|
|
|
155
168
|
{#if mAndDown && mobileDialog}
|
|
@@ -204,3 +217,9 @@ $:
|
|
|
204
217
|
{/if}
|
|
205
218
|
</MediaQuery>
|
|
206
219
|
|
|
220
|
+
<style>
|
|
221
|
+
.date-picker-activator {
|
|
222
|
+
width: fit-content;
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
225
|
+
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import
|
|
2
|
+
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
3
|
+
import { type ComponentProps } from 'svelte';
|
|
4
|
+
import type { DateStat } from '../../simple/dates/utils';
|
|
3
5
|
declare const __propDef: {
|
|
4
6
|
props: {
|
|
7
|
+
class?: {
|
|
8
|
+
activator?: string | undefined;
|
|
9
|
+
textfield?: ComponentProps<SimpleTextField>['class'];
|
|
10
|
+
} | undefined;
|
|
5
11
|
menuOpened?: boolean | undefined;
|
|
6
12
|
openingId?: string | undefined;
|
|
7
13
|
pattern?: string | undefined;
|
|
@@ -21,6 +27,15 @@ declare const __propDef: {
|
|
|
21
27
|
[evt: string]: CustomEvent<any>;
|
|
22
28
|
};
|
|
23
29
|
slots: {
|
|
30
|
+
activator: {
|
|
31
|
+
mask: {
|
|
32
|
+
value: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
handleTextFieldFocus: (mobile: boolean) => void;
|
|
35
|
+
handleInputChange: (event: any) => void;
|
|
36
|
+
inputElement: HTMLElement;
|
|
37
|
+
placeholder: string | undefined;
|
|
38
|
+
};
|
|
24
39
|
'prepend-inner': {
|
|
25
40
|
prependInnerIcon: string | undefined;
|
|
26
41
|
iconSize: string;
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import
|
|
3
|
+
<script>import { cloneDeep } from "lodash";
|
|
4
|
+
import Autocomplete from "../../../components/simple/forms/Autocomplete.svelte";
|
|
4
5
|
import Button from "../../simple/buttons/Button.svelte";
|
|
5
6
|
import Icon from "../../simple/media/Icon.svelte";
|
|
6
|
-
|
|
7
|
+
import { createEventDispatcher } from "svelte";
|
|
8
|
+
let dispatch = createEventDispatcher();
|
|
9
|
+
export let items = [], values = [], multiple = false, lang = "en", searchText = void 0, maxVisibleChips = void 0, placeholder = lang == "en" ? "Select" : "Seleziona", clearable = true, mandatory = true, icon = void 0, menuOpened = false, openingId = void 0, width = void 0;
|
|
7
10
|
$:
|
|
8
11
|
generatedLabel = values.length == 1 ? values[0].label : `${values.length} Selezionati`;
|
|
9
12
|
function handleCloseClick(event) {
|
|
10
13
|
event.preventDefault();
|
|
11
14
|
event.stopPropagation();
|
|
15
|
+
let valuesBefore = cloneDeep(values);
|
|
12
16
|
values = [];
|
|
17
|
+
dispatch("change", {
|
|
18
|
+
unselect: valuesBefore[0],
|
|
19
|
+
select: void 0,
|
|
20
|
+
selection: []
|
|
21
|
+
});
|
|
13
22
|
}
|
|
14
23
|
</script>
|
|
15
24
|
|
|
@@ -24,6 +33,7 @@ function handleCloseClick(event) {
|
|
|
24
33
|
on:change
|
|
25
34
|
bind:menuOpened
|
|
26
35
|
bind:openingId
|
|
36
|
+
bind:width
|
|
27
37
|
>
|
|
28
38
|
<svelte:fragment slot="selection-container" let:openMenu let:handleKeyDown>
|
|
29
39
|
<Button
|
|
@@ -41,7 +51,16 @@ function handleCloseClick(event) {
|
|
|
41
51
|
}
|
|
42
52
|
}}
|
|
43
53
|
>
|
|
44
|
-
<slot
|
|
54
|
+
<slot
|
|
55
|
+
name="label"
|
|
56
|
+
{values}
|
|
57
|
+
{items}
|
|
58
|
+
{searchText}
|
|
59
|
+
{generatedLabel}
|
|
60
|
+
{placeholder}
|
|
61
|
+
{clearable}
|
|
62
|
+
{handleCloseClick}
|
|
63
|
+
>
|
|
45
64
|
<div class="label">
|
|
46
65
|
{#if !!icon}
|
|
47
66
|
<Icon name={icon}></Icon>
|
|
@@ -67,6 +86,11 @@ function handleCloseClick(event) {
|
|
|
67
86
|
</slot>
|
|
68
87
|
</Button>
|
|
69
88
|
</svelte:fragment>
|
|
89
|
+
<svelte:fragment slot="item-label" let:item >
|
|
90
|
+
<slot name="item-label" {item}>
|
|
91
|
+
{item.label}
|
|
92
|
+
</slot>
|
|
93
|
+
</svelte:fragment>
|
|
70
94
|
</Autocomplete>
|
|
71
95
|
|
|
72
96
|
<style>
|
|
@@ -15,6 +15,7 @@ declare const __propDef: {
|
|
|
15
15
|
icon?: string | undefined;
|
|
16
16
|
menuOpened?: boolean | undefined;
|
|
17
17
|
openingId?: string | undefined;
|
|
18
|
+
width?: string | undefined;
|
|
18
19
|
};
|
|
19
20
|
events: {
|
|
20
21
|
change: CustomEvent<any>;
|
|
@@ -26,6 +27,13 @@ declare const __propDef: {
|
|
|
26
27
|
values: Item[];
|
|
27
28
|
items: Item[];
|
|
28
29
|
searchText: string | undefined;
|
|
30
|
+
generatedLabel: string | number | undefined;
|
|
31
|
+
placeholder: string;
|
|
32
|
+
clearable: boolean;
|
|
33
|
+
handleCloseClick: (event: MouseEvent) => void;
|
|
34
|
+
};
|
|
35
|
+
'item-label': {
|
|
36
|
+
item: Item;
|
|
29
37
|
};
|
|
30
38
|
};
|
|
31
39
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import Dropdown, {} from "./Dropdown.svelte";
|
|
4
|
+
import Icon from "../../simple/media/Icon.svelte";
|
|
5
|
+
export let items = [], values = [], clearable = false;
|
|
6
|
+
let dropdownValues = [];
|
|
7
|
+
$:
|
|
8
|
+
dropdownValues = values.map((e) => ({
|
|
9
|
+
value: e.value,
|
|
10
|
+
data: {
|
|
11
|
+
icon: e.icon,
|
|
12
|
+
data: e.data
|
|
13
|
+
}
|
|
14
|
+
}));
|
|
15
|
+
$:
|
|
16
|
+
dropDownItems = items.map((e) => ({
|
|
17
|
+
value: e.value,
|
|
18
|
+
data: {
|
|
19
|
+
icon: e.icon,
|
|
20
|
+
data: e.data
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
function handleChange(event) {
|
|
24
|
+
values = event.detail.selection.map((e) => ({
|
|
25
|
+
value: e.value,
|
|
26
|
+
icon: e.data.icon,
|
|
27
|
+
data: e.data
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<Dropdown
|
|
33
|
+
items={dropDownItems}
|
|
34
|
+
clearable={clearable}
|
|
35
|
+
placeholder=""
|
|
36
|
+
bind:values={dropdownValues}
|
|
37
|
+
on:change={handleChange}
|
|
38
|
+
width="60px"
|
|
39
|
+
>
|
|
40
|
+
<svelte:fragment slot="label" let:generatedLabel let:values let:placeholder let:clearable let:handleCloseClick>
|
|
41
|
+
{#if values.length == 0}
|
|
42
|
+
{placeholder}
|
|
43
|
+
{:else if values.length == 1}
|
|
44
|
+
<Icon name={values[0].data.icon}></Icon>
|
|
45
|
+
{:else}
|
|
46
|
+
{generatedLabel}
|
|
47
|
+
{/if}
|
|
48
|
+
{#if clearable && values.length > 0}
|
|
49
|
+
<Icon
|
|
50
|
+
name="mdi-close"
|
|
51
|
+
click
|
|
52
|
+
on:click={handleCloseClick}
|
|
53
|
+
></Icon>
|
|
54
|
+
{:else}
|
|
55
|
+
<Icon name="mdi-chevron-down"></Icon>
|
|
56
|
+
{/if}
|
|
57
|
+
</svelte:fragment>
|
|
58
|
+
<svelte:fragment slot="item-label" let:item>
|
|
59
|
+
<div class="label-container">
|
|
60
|
+
<Icon
|
|
61
|
+
name={item.data.icon}
|
|
62
|
+
--icon-size="20px"
|
|
63
|
+
></Icon>
|
|
64
|
+
</div>
|
|
65
|
+
</svelte:fragment>
|
|
66
|
+
</Dropdown>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.label-container {
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
export type IconItem = {
|
|
3
|
+
value: string | number;
|
|
4
|
+
icon: string;
|
|
5
|
+
data?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const __propDef: {
|
|
8
|
+
props: {
|
|
9
|
+
items?: IconItem[] | undefined;
|
|
10
|
+
values?: IconItem[] | undefined;
|
|
11
|
+
clearable?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type IconsDropdownProps = typeof __propDef.props;
|
|
19
|
+
export type IconsDropdownEvents = typeof __propDef.events;
|
|
20
|
+
export type IconsDropdownSlots = typeof __propDef.slots;
|
|
21
|
+
export default class IconsDropdown extends SvelteComponentTyped<IconsDropdownProps, IconsDropdownEvents, IconsDropdownSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import Dropdown, {} from "../forms/Dropdown.svelte";
|
|
2
2
|
import { GenericModes, SelectModes, StringModes } from "../../../utils/filters/filters";
|
|
3
3
|
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
4
|
-
import DatePickerTextField from "
|
|
4
|
+
import DatePickerTextField from "../forms/DatePickerTextField.svelte";
|
|
5
5
|
import Button from "../../simple/buttons/Button.svelte";
|
|
6
6
|
import { createEventDispatcher } from "svelte";
|
|
7
7
|
import Validator from "../../../utils/filters/validator";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { GenericModes, SelectModes, StringModes } from "../../../utils/filters/filters";
|
|
2
2
|
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
3
|
-
import DatePickerTextField from "
|
|
3
|
+
import DatePickerTextField from "../forms/DatePickerTextField.svelte";
|
|
4
4
|
import Button from "../../simple/buttons/Button.svelte";
|
|
5
5
|
import { createEventDispatcher } from "svelte";
|
|
6
6
|
import Validator from "../../../utils/filters/validator";
|
|
@@ -62,7 +62,7 @@ let sidebarExpanded = false;
|
|
|
62
62
|
on:keypress={() => {if(expandOn == 'click' && !mAndDown) sidebarExpanded = true}}
|
|
63
63
|
use:clickOutside
|
|
64
64
|
on:clickoutside={() => {if(expandOn == 'click') sidebarExpanded = false}}
|
|
65
|
-
class="side-bar {clazz.header}"
|
|
65
|
+
class="side-bar {clazz.header || ''}"
|
|
66
66
|
>
|
|
67
67
|
<div class="side-bar-content">
|
|
68
68
|
<slot name="sidebar" hamburgerVisible={mAndDown} {sidebarExpanded}>
|
|
@@ -140,7 +140,7 @@ let sidebarExpanded = false;
|
|
|
140
140
|
var(--unstable-divided-side-bar-layout-default-side-bar-padding)
|
|
141
141
|
);
|
|
142
142
|
z-index: 10;
|
|
143
|
-
overflow:
|
|
143
|
+
overflow: clip;
|
|
144
144
|
transition: all .2s cubic-bezier(.4,0,.2,1);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -232,18 +232,49 @@ import CircularLoader from "../loaders/CircularLoader.svelte";
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
.button-text
|
|
235
|
+
.button-text.disabled {
|
|
236
|
+
cursor: not-allowed;
|
|
237
|
+
background-color: var(
|
|
238
|
+
--button-disabled-background-color,
|
|
239
|
+
var(--button-default-disabled-background-color)
|
|
240
|
+
);
|
|
241
|
+
color: var(
|
|
242
|
+
--button-disabled-color,
|
|
243
|
+
var(--button-default-disabled-color)
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.button-text:hover:not(.disabled) {
|
|
236
248
|
background-color: var(
|
|
237
249
|
--button-hover-background-color,
|
|
238
250
|
var(--button-default-text-hover-background-color)
|
|
239
251
|
);
|
|
252
|
+
color: var(
|
|
253
|
+
--button-hover-color,
|
|
254
|
+
var(--button-default-text-hover-color)
|
|
255
|
+
);
|
|
240
256
|
}
|
|
241
257
|
|
|
242
|
-
.button-text:active {
|
|
258
|
+
.button-text:active:not(.disabled) {
|
|
243
259
|
background-color: var(
|
|
244
260
|
--button-active-background-color,
|
|
245
261
|
var(--button-default-text-active-background-color)
|
|
246
262
|
);
|
|
263
|
+
color: var(
|
|
264
|
+
--button-active-color,
|
|
265
|
+
var(--button-default-text-active-color)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.button-text:focus:not(.disabled) {
|
|
270
|
+
background-color: var(
|
|
271
|
+
--button-focus-background-color,
|
|
272
|
+
var(--button-default-text-focus-background-color)
|
|
273
|
+
);
|
|
274
|
+
color: var(
|
|
275
|
+
--button-focus-color,
|
|
276
|
+
var(--button-default-text-focus-color)
|
|
277
|
+
);
|
|
247
278
|
}
|
|
248
279
|
|
|
249
280
|
.button-icon {
|
|
@@ -8,7 +8,7 @@ import Button from "../buttons/Button.svelte";
|
|
|
8
8
|
import { createEventDispatcher } from "svelte";
|
|
9
9
|
let clazz = {};
|
|
10
10
|
export { clazz as class };
|
|
11
|
-
export let selectedYear = (/* @__PURE__ */ new Date()).getFullYear(), selectedMonth = (/* @__PURE__ */ new Date()).getMonth(), selectedDate =
|
|
11
|
+
export let selectedYear = (/* @__PURE__ */ new Date()).getFullYear(), selectedMonth = (/* @__PURE__ */ new Date()).getMonth(), selectedDate = void 0, visibleMonth = selectedMonth, visibleYear = selectedYear, view = "day", locale = "it", selectableYears = [...Array(150).keys()].map(
|
|
12
12
|
(i) => i + ((/* @__PURE__ */ new Date()).getFullYear() - 75)
|
|
13
13
|
);
|
|
14
14
|
let dispatch = createEventDispatcher();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--time-picker-default-primary-color: rgb(var(--global-color-primary-600));
|
|
3
|
+
--time-picker-default-height: 400px;
|
|
4
|
+
--time-picker-default-width: 100%;
|
|
5
|
+
--time-picker-default-header-background-color: rgb(var(--global-color-primary-600));
|
|
6
|
+
--time-picker-default-header-color: rgb(var(--global-color-grey-50));
|
|
7
|
+
--time-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
|
+
--time-picker-default-overflow: hidden;
|
|
10
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<script>import "../../../css/main.css";
|
|
2
|
+
import "./TimePicker.css";
|
|
3
|
+
import { DateTime } from "luxon";
|
|
4
|
+
import { createEventDispatcher } from "svelte";
|
|
5
|
+
import Icon from "../media/Icon.svelte";
|
|
6
|
+
let clazz = {};
|
|
7
|
+
export { clazz as class };
|
|
8
|
+
export let selectedTime = void 0, locale = "it-IT";
|
|
9
|
+
let hours = "00";
|
|
10
|
+
let dispatch = createEventDispatcher();
|
|
11
|
+
let buildUpHours = hours;
|
|
12
|
+
function handleHoursInput(e) {
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
let inserted = e.key;
|
|
15
|
+
if (inserted == "Backspace") {
|
|
16
|
+
if (Number(buildUpHours) < 10) {
|
|
17
|
+
buildUpHours = "00";
|
|
18
|
+
} else {
|
|
19
|
+
buildUpHours = "0" + (buildUpHours.at(0) || "0");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(inserted)) {
|
|
23
|
+
if (Number(buildUpHours) < 10) {
|
|
24
|
+
buildUpHours = `${Number(buildUpHours)}${inserted}`;
|
|
25
|
+
} else {
|
|
26
|
+
buildUpHours = `${buildUpHours.at(1)}${inserted}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
hours = buildUpHours;
|
|
30
|
+
}, 10);
|
|
31
|
+
}
|
|
32
|
+
$:
|
|
33
|
+
hours = buildUpHours;
|
|
34
|
+
$:
|
|
35
|
+
console.log(hours);
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class="container {clazz.container || ''}"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
class="header {clazz.header || ''}"
|
|
43
|
+
>
|
|
44
|
+
<h2>
|
|
45
|
+
{#if !!selectedTime}
|
|
46
|
+
{DateTime.fromJSDate(selectedTime).setLocale(locale).toLocaleString(DateTime.TIME_24_SIMPLE)}
|
|
47
|
+
{/if}
|
|
48
|
+
</h2>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="body">
|
|
51
|
+
<div class="time-switch">
|
|
52
|
+
<button
|
|
53
|
+
class="icon-button"
|
|
54
|
+
>
|
|
55
|
+
<Icon
|
|
56
|
+
name="mdi-chevron-up"
|
|
57
|
+
--icon-size="20pt"
|
|
58
|
+
></Icon>
|
|
59
|
+
</button>
|
|
60
|
+
<input
|
|
61
|
+
type="text"
|
|
62
|
+
class="transparent-input"
|
|
63
|
+
bind:value={hours}
|
|
64
|
+
on:keydown={handleHoursInput}
|
|
65
|
+
/>
|
|
66
|
+
<button
|
|
67
|
+
class="icon-button"
|
|
68
|
+
>
|
|
69
|
+
<Icon
|
|
70
|
+
name="mdi-chevron-down"
|
|
71
|
+
--icon-size="20pt"
|
|
72
|
+
></Icon>
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
<div>:</div>
|
|
76
|
+
<input type="text" class="transparent-input" maxlength="2" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.container {
|
|
82
|
+
border-radius: 5px;
|
|
83
|
+
height: var(
|
|
84
|
+
--time-picker-height,
|
|
85
|
+
var(--time-picker-default-height)
|
|
86
|
+
);
|
|
87
|
+
width: var(
|
|
88
|
+
--time-picker-width,
|
|
89
|
+
var(--time-picker-default-width)
|
|
90
|
+
);
|
|
91
|
+
box-shadow: var(
|
|
92
|
+
--time-picker-box-shadow,
|
|
93
|
+
var(--time-picker-default-box-shadow)
|
|
94
|
+
);
|
|
95
|
+
overflow: var(
|
|
96
|
+
--time-picker-overflow,
|
|
97
|
+
var(--time-picker-default-overflow)
|
|
98
|
+
);
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.header {
|
|
104
|
+
border-radius: 5px 5px 0 0;
|
|
105
|
+
background-color: var(
|
|
106
|
+
--time-picker-header-background-color,
|
|
107
|
+
var(--time-picker-default-header-background-color)
|
|
108
|
+
);
|
|
109
|
+
height: calc(var(--time-picker-height, var(--time-picker-default-height)) / 4);
|
|
110
|
+
color: var(
|
|
111
|
+
--time-picker-header-color,
|
|
112
|
+
var(--time-picker-default-header-color)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.header > h2 {
|
|
117
|
+
margin-left: 15px;
|
|
118
|
+
margin-top: 5px;
|
|
119
|
+
transition: 0.1s;
|
|
120
|
+
opacity: 0.8;
|
|
121
|
+
}
|
|
122
|
+
.header > h2:hover {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.body {
|
|
128
|
+
flex-grow: 1;
|
|
129
|
+
display: flex;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: 8px
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.transparent-input {
|
|
136
|
+
border: 2px solid rgb(var(--global-color-contrast-200));
|
|
137
|
+
border-radius: 5px;
|
|
138
|
+
width: 36px;
|
|
139
|
+
text-align: center;
|
|
140
|
+
outline: none;
|
|
141
|
+
background-color: transparent;
|
|
142
|
+
padding: 4px 8px;
|
|
143
|
+
color: rgb(var(--global-color-contrast-900));
|
|
144
|
+
transition: all .1s cubic-bezier(0.075, 0.82, 0.165, 1);
|
|
145
|
+
font-size: 24pt;
|
|
146
|
+
caret-color: transparent;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.transparent-input:hover, .transparent-input:focus {
|
|
150
|
+
border-color: rgb(var(--global-color-primary-500));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.time-switch {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
align-items: center;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.icon-button {
|
|
161
|
+
background: none;
|
|
162
|
+
border: none;
|
|
163
|
+
padding: 0;
|
|
164
|
+
margin: 0;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
outline: none;
|
|
167
|
+
color: inherit;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import '../../../css/main.css';
|
|
3
|
+
import './TimePicker.css';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
class?: {
|
|
7
|
+
container?: string | undefined;
|
|
8
|
+
header?: string | undefined;
|
|
9
|
+
selectorRow?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
selectedTime?: Date | null | undefined;
|
|
12
|
+
locale?: "it-IT" | "en-EN" | undefined;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type TimePickerProps = typeof __propDef.props;
|
|
20
|
+
export type TimePickerEvents = typeof __propDef.events;
|
|
21
|
+
export type TimePickerSlots = typeof __propDef.slots;
|
|
22
|
+
export default class TimePicker extends SvelteComponentTyped<TimePickerProps, TimePickerEvents, TimePickerSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { default as Calendar } from './components/simple/dates/Calendar.svelte';
|
|
|
9
9
|
export { default as DatePicker } from './components/simple/dates/DatePicker.svelte';
|
|
10
10
|
export { default as MonthSelector } from './components/simple/dates/MonthSelector.svelte';
|
|
11
11
|
export { default as TimePickerTextField } from './components/simple/dates/TimePickerTextField.svelte';
|
|
12
|
-
export { default as DatePickerTextField } from './components/
|
|
12
|
+
export { default as DatePickerTextField } from './components/composed/forms/DatePickerTextField.svelte';
|
|
13
13
|
export { default as YearSelector } from './components/simple/dates/YearSelector.svelte';
|
|
14
14
|
export { default as Dialog } from './components/simple/dialogs/Dialog.svelte';
|
|
15
15
|
export { default as Autocomplete } from './components/simple/forms/Autocomplete.svelte';
|
|
@@ -47,6 +47,8 @@ export { default as TabSwitcher } from './components/simple/navigation/TabSwitch
|
|
|
47
47
|
export { default as ProgressBar } from './components/simple/progress/ProgressBar.svelte';
|
|
48
48
|
export { default as ProductCard } from './components/composed/shop/ProductCard.svelte';
|
|
49
49
|
export { default as ProductsGrid } from './components/composed/shop/ProductsGrid.svelte';
|
|
50
|
+
export { default as ActivableButton } from './components/composed/buttons/ActivableButton.svelte';
|
|
51
|
+
export { default as IconsDropdown } from './components/composed/forms/IconsDropdown.svelte';
|
|
50
52
|
export { default as PaginatedTable } from './components/composed/list/PaginatedTable.svelte';
|
|
51
53
|
export { default as Filters } from './components/composed/search/Filters.svelte';
|
|
52
54
|
export { default as GlobalSearchTextField } from './components/composed/search/GlobalSearchTextField.svelte';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { default as Calendar } from './components/simple/dates/Calendar.svelte';
|
|
|
9
9
|
export { default as DatePicker } from './components/simple/dates/DatePicker.svelte';
|
|
10
10
|
export { default as MonthSelector } from './components/simple/dates/MonthSelector.svelte';
|
|
11
11
|
export { default as TimePickerTextField } from './components/simple/dates/TimePickerTextField.svelte';
|
|
12
|
-
export { default as DatePickerTextField } from './components/
|
|
12
|
+
export { default as DatePickerTextField } from './components/composed/forms/DatePickerTextField.svelte';
|
|
13
13
|
export { default as YearSelector } from './components/simple/dates/YearSelector.svelte';
|
|
14
14
|
export { default as Dialog } from './components/simple/dialogs/Dialog.svelte';
|
|
15
15
|
export { default as Autocomplete } from './components/simple/forms/Autocomplete.svelte';
|
|
@@ -47,6 +47,8 @@ export { default as TabSwitcher } from './components/simple/navigation/TabSwitch
|
|
|
47
47
|
export { default as ProgressBar } from './components/simple/progress/ProgressBar.svelte';
|
|
48
48
|
export { default as ProductCard } from './components/composed/shop/ProductCard.svelte';
|
|
49
49
|
export { default as ProductsGrid } from './components/composed/shop/ProductsGrid.svelte';
|
|
50
|
+
export { default as ActivableButton } from './components/composed/buttons/ActivableButton.svelte';
|
|
51
|
+
export { default as IconsDropdown } from './components/composed/forms/IconsDropdown.svelte';
|
|
50
52
|
export { default as PaginatedTable } from './components/composed/list/PaginatedTable.svelte';
|
|
51
53
|
export { default as Filters } from './components/composed/search/Filters.svelte';
|
|
52
54
|
export { default as GlobalSearchTextField } from './components/composed/search/GlobalSearchTextField.svelte';
|