@likable-hair/svelte 0.0.45 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/buttons/Button.svelte +7 -3
- package/buttons/Button.svelte.d.ts +3 -0
- package/common/Menu.svelte +14 -3
- package/common/Menu.svelte.d.ts +6 -0
- package/dates/TimePickerTextField.svelte +90 -0
- package/dates/TimePickerTextField.svelte.d.ts +26 -0
- package/forms/Autocomplete.svelte +219 -0
- package/forms/Autocomplete.svelte.d.ts +69 -0
- package/forms/Textarea.svelte +63 -0
- package/forms/Textarea.svelte.d.ts +39 -0
- package/forms/Textfield.svelte +16 -4
- package/forms/Textfield.svelte.d.ts +7 -1
- package/forms/VerticalSwitch.svelte +123 -0
- package/forms/VerticalSwitch.svelte.d.ts +30 -0
- package/forms/VerticalTextSwitch.svelte +65 -0
- package/forms/VerticalTextSwitch.svelte.d.ts +28 -0
- package/media/Avatar.svelte +2 -1
- package/media/Avatar.svelte.d.ts +1 -0
- package/media/DescriptiveAvatar.svelte +2 -1
- package/media/DescriptiveAvatar.svelte.d.ts +1 -0
- package/navigation/Chip.svelte +37 -40
- package/navigation/Chip.svelte.d.ts +0 -1
- package/package.json +6 -1
package/buttons/Button.svelte
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<script >export let type = 'default', active = false, loading = false, icon = undefined, iconSize = 15, clazz = '', maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = undefined, height = undefined, textAlign = "center", cursor = "pointer", padding = "5px", fontSize = undefined, color = undefined, display = undefined, justifyContent = undefined, alignItems = undefined, backgroundColor = undefined, hoverBackgroundColor = '#88888847', activeBackgroundColor = hoverBackgroundColor, borderRadius = undefined, border = undefined, boxShadow = undefined;
|
|
1
|
+
<script >export let type = 'default', active = false, loading = false, icon = undefined, iconSize = 15, clazz = '', maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = undefined, height = undefined, textAlign = "center", cursor = "pointer", padding = "5px", fontSize = undefined, color = undefined, display = undefined, justifyContent = undefined, alignItems = undefined, backgroundColor = undefined, hoverBackgroundColor = '#88888847', activeBackgroundColor = hoverBackgroundColor, borderRadius = undefined, border = undefined, boxShadow = undefined, loaderHeight = undefined, loaderWidth = undefined, disabled = false;
|
|
2
2
|
export { clazz as class };
|
|
3
3
|
import { createEventDispatcher } from 'svelte';
|
|
4
4
|
const dispatch = createEventDispatcher();
|
|
5
5
|
function handleClick(event) {
|
|
6
|
+
if (disabled)
|
|
7
|
+
return;
|
|
6
8
|
dispatch('click', {
|
|
7
9
|
nativeEvent: event
|
|
8
10
|
});
|
|
@@ -45,6 +47,8 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
|
|
|
45
47
|
{#if loading}
|
|
46
48
|
<CircularLoader
|
|
47
49
|
color={color}
|
|
50
|
+
height={loaderHeight}
|
|
51
|
+
width={loaderWidth}
|
|
48
52
|
></CircularLoader>
|
|
49
53
|
{:else}
|
|
50
54
|
{#if !!icon}
|
|
@@ -118,8 +122,8 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
|
|
|
118
122
|
.no-select {
|
|
119
123
|
-webkit-touch-callout: none; /* iOS Safari */
|
|
120
124
|
-webkit-user-select: none; /* Safari */
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
126
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
123
127
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
124
128
|
user-select: none; /* Non-prefixed version, currently
|
|
125
129
|
supported by Chrome, Edge, Opera and Firefox */
|
package/common/Menu.svelte
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script >import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import { fly } from 'svelte/transition';
|
|
3
|
-
export let open = false, top = undefined, left = undefined, width, height, activator = undefined, anchor = 'bottom', closeOnClickOutside = false, inAnimation = fly, inAnimationConfig = {
|
|
3
|
+
export let open = false, top = undefined, left = undefined, width, height, maxHeight = undefined, overflow = "auto", refreshPosition = false, boxShadow = undefined, borderRadius = undefined, activator = undefined, anchor = 'bottom', closeOnClickOutside = false, inAnimation = fly, inAnimationConfig = {
|
|
4
4
|
duration: 100,
|
|
5
5
|
y: 10
|
|
6
6
|
}, outAnimation = fly, outAnimationConfig = {
|
|
7
7
|
duration: 100,
|
|
8
8
|
y: 10
|
|
9
|
-
};
|
|
10
|
-
let zIndex = 50,
|
|
9
|
+
}, menuElement = undefined;
|
|
10
|
+
let zIndex = 50, currentUid = uuidv4();
|
|
11
11
|
function calculateMenuPosition(params) {
|
|
12
12
|
if (!!params.menuElement) {
|
|
13
13
|
if (!!params.activator) {
|
|
@@ -58,6 +58,13 @@ $: if (open) {
|
|
|
58
58
|
if (!!maxZIndex)
|
|
59
59
|
zIndex = maxZIndex + 2;
|
|
60
60
|
}
|
|
61
|
+
$: if (!!width) {
|
|
62
|
+
calculateMenuPosition({ activator, menuElement });
|
|
63
|
+
}
|
|
64
|
+
$: if (refreshPosition) {
|
|
65
|
+
calculateMenuPosition({ activator, menuElement });
|
|
66
|
+
refreshPosition = false;
|
|
67
|
+
}
|
|
61
68
|
$: if (closeOnClickOutside && !!menuElement) {
|
|
62
69
|
window.addEventListener('click', (event) => {
|
|
63
70
|
open = false;
|
|
@@ -81,9 +88,13 @@ $: if (closeOnClickOutside && !!menuElement) {
|
|
|
81
88
|
style:z-index={zIndex}
|
|
82
89
|
style:position="absolute"
|
|
83
90
|
style:top={top + "px"}
|
|
91
|
+
style:box-shadow={boxShadow}
|
|
92
|
+
style:border-radius={borderRadius}
|
|
84
93
|
style:left={left + "px"}
|
|
85
94
|
style:height={height}
|
|
95
|
+
style:max-height={maxHeight}
|
|
86
96
|
style:width={width}
|
|
97
|
+
style:overflow={overflow}
|
|
87
98
|
in:inAnimation={inAnimationConfig}
|
|
88
99
|
out:outAnimation={outAnimationConfig}
|
|
89
100
|
>
|
package/common/Menu.svelte.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ declare const __propDef: {
|
|
|
7
7
|
left?: number;
|
|
8
8
|
width: string;
|
|
9
9
|
height: string;
|
|
10
|
+
maxHeight?: string;
|
|
11
|
+
overflow?: string;
|
|
12
|
+
refreshPosition?: boolean;
|
|
13
|
+
boxShadow?: string;
|
|
14
|
+
borderRadius?: string;
|
|
10
15
|
activator?: HTMLElement;
|
|
11
16
|
anchor?: 'bottom' | 'bottom-center';
|
|
12
17
|
closeOnClickOutside?: boolean;
|
|
@@ -14,6 +19,7 @@ declare const __propDef: {
|
|
|
14
19
|
inAnimationConfig?: SlideParams | FlyParams | FadeParams;
|
|
15
20
|
outAnimation?: (node: Element, params?: SlideParams | FlyParams | FadeParams) => TransitionConfig;
|
|
16
21
|
outAnimationConfig?: SlideParams | FlyParams | FadeParams;
|
|
22
|
+
menuElement?: HTMLElement;
|
|
17
23
|
};
|
|
18
24
|
events: {
|
|
19
25
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script >import Textfield from "../forms/Textfield.svelte";
|
|
2
|
+
import VerticalTextSwitch from "../forms/VerticalTextSwitch.svelte";
|
|
3
|
+
import "./DatePicker.svelte";
|
|
4
|
+
export let hourFormat = "24", dayPeriod = "am", time = undefined, text = "", fieldSeparator = ":", placeholder = "Insert time...", focusedBoxShadow = "#C0D6FF 0px 2px 10px", borderColor = "", borderWeight = "1px", fontSize = "16px", width = "100%";
|
|
5
|
+
let minutes = undefined, hours = undefined, switchValue = false;
|
|
6
|
+
function checkHour(hour) {
|
|
7
|
+
if (hourFormat == "12")
|
|
8
|
+
return hour > 0 && hour <= 12;
|
|
9
|
+
else
|
|
10
|
+
return hour >= 0 && hour < 24;
|
|
11
|
+
}
|
|
12
|
+
function checkMinute(minute) {
|
|
13
|
+
return minute >= 0 && minute < 60;
|
|
14
|
+
}
|
|
15
|
+
$: dayPeriod = switchValue ? "pm" : "am";
|
|
16
|
+
$: {
|
|
17
|
+
let fields = text.split(fieldSeparator);
|
|
18
|
+
hours = +fields[0];
|
|
19
|
+
minutes = +fields[1];
|
|
20
|
+
if (fields[1]?.length != 2) {
|
|
21
|
+
time = undefined;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (!isNaN(hours) && !isNaN(minutes) && checkHour(hours) && checkMinute(minutes) && fields.length == 2) {
|
|
25
|
+
if (hourFormat == '12') {
|
|
26
|
+
if (dayPeriod == 'am' && hours == 12)
|
|
27
|
+
hours = 0;
|
|
28
|
+
else if (dayPeriod == 'pm' && hours != 12)
|
|
29
|
+
hours += 12;
|
|
30
|
+
}
|
|
31
|
+
time = new Date();
|
|
32
|
+
time.setHours(hours, minutes, 0);
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
time = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let fontSizeNumeric = parseInt(fontSize, 10);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div class="container"
|
|
42
|
+
style:width
|
|
43
|
+
>
|
|
44
|
+
<div class="text-field" style:width="100%">
|
|
45
|
+
<Textfield
|
|
46
|
+
{placeholder}
|
|
47
|
+
variant="boxed"
|
|
48
|
+
{borderColor}
|
|
49
|
+
{borderWeight}
|
|
50
|
+
{focusedBoxShadow}
|
|
51
|
+
{fontSize}
|
|
52
|
+
width="100%"
|
|
53
|
+
bind:value={text}
|
|
54
|
+
paddingLeft="10px"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
{#if hourFormat == "12"}
|
|
58
|
+
<div class="period-selector" style:height="{fontSizeNumeric+16}px">
|
|
59
|
+
<VerticalTextSwitch
|
|
60
|
+
bind:value={switchValue}
|
|
61
|
+
width="{fontSizeNumeric+16}px"
|
|
62
|
+
hoverBackgroundColor="rgba(0,0,0,0.05)"
|
|
63
|
+
>
|
|
64
|
+
<span slot="trueOption"
|
|
65
|
+
style:font-size={fontSize}
|
|
66
|
+
>
|
|
67
|
+
PM
|
|
68
|
+
</span>
|
|
69
|
+
<span slot="falseOption"
|
|
70
|
+
style:font-size={fontSize}
|
|
71
|
+
>
|
|
72
|
+
AM
|
|
73
|
+
</span>
|
|
74
|
+
</VerticalTextSwitch>
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<style>
|
|
80
|
+
.container {
|
|
81
|
+
display: flex;
|
|
82
|
+
}
|
|
83
|
+
.period-selector {
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
align-items: center;
|
|
87
|
+
align-self: flex-start;
|
|
88
|
+
margin-left: 20px;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
hourFormat?: "12" | "24";
|
|
5
|
+
dayPeriod?: "am" | "pm";
|
|
6
|
+
time?: Date;
|
|
7
|
+
text?: string;
|
|
8
|
+
fieldSeparator?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
focusedBoxShadow?: string;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
borderWeight?: string;
|
|
13
|
+
fontSize?: string;
|
|
14
|
+
width?: string;
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {};
|
|
20
|
+
};
|
|
21
|
+
export declare type TimePickerTextFieldProps = typeof __propDef.props;
|
|
22
|
+
export declare type TimePickerTextFieldEvents = typeof __propDef.events;
|
|
23
|
+
export declare type TimePickerTextFieldSlots = typeof __propDef.slots;
|
|
24
|
+
export default class TimePickerTextField extends SvelteComponentTyped<TimePickerTextFieldProps, TimePickerTextFieldEvents, TimePickerTextFieldSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<script context="module" ></script>
|
|
2
|
+
|
|
3
|
+
<script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", maxWidth = undefined,
|
|
4
|
+
// textfield
|
|
5
|
+
textFieldLabel = "", textFieldPlaceholder = "", textFieldColor = null, textFieldVariant = 'boxed', textFieldMaxWidth = "min(100px, 90%)", textFieldMinWidth = undefined, textFieldHeight = "auto", textFieldTextColor = "black", textFieldBorderWeight = "2px", textFieldBorderRadius = "5px", textFieldBorderColor = null, textFieldFocusBorderColor = null, textFieldFocusedBoxShadow = undefined, textFieldBackgroundColor = null, textFieldPadding = undefined, textFieldPaddingLeft = undefined, textFieldPaddingRight = undefined, textFieldPaddingBottom = undefined, textFieldPaddingTop = undefined, textFieldFontSize = undefined,
|
|
6
|
+
// menu
|
|
7
|
+
menuBackgroundColor = "#FFF", menuBoxShadow = "rgba(149, 157, 165, 0.2) 0px 8px 24px", menuBorderRadius = "5px", focusItemBackgroundColor = "#EEEEEE", selectedItemBackgroundColor = "#D0D0D0", border = '1px solid black', borderRadius = '5px', chipColor = "#D0D0D0", chipTextColor = "black", chipHeight = "30px";
|
|
8
|
+
function select(item) {
|
|
9
|
+
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
10
|
+
if (!alreadyPresent) {
|
|
11
|
+
if (multiple)
|
|
12
|
+
values = [...values, item];
|
|
13
|
+
else
|
|
14
|
+
values = [item];
|
|
15
|
+
refreshMenuWidth();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function unselect(item) {
|
|
19
|
+
values = values.filter((i) => i.value != item.value);
|
|
20
|
+
refreshMenuWidth();
|
|
21
|
+
}
|
|
22
|
+
function toggle(item) {
|
|
23
|
+
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
24
|
+
console.log(item, alreadyPresent);
|
|
25
|
+
if (alreadyPresent)
|
|
26
|
+
unselect(item);
|
|
27
|
+
else
|
|
28
|
+
select(item);
|
|
29
|
+
}
|
|
30
|
+
let menuWidth = undefined, menuHeight = "auto", menuOpened = false, refreshPosition = false;
|
|
31
|
+
function openMenu() {
|
|
32
|
+
refreshMenuWidth();
|
|
33
|
+
menuOpened = true;
|
|
34
|
+
}
|
|
35
|
+
function closeMenu() {
|
|
36
|
+
menuOpened = false;
|
|
37
|
+
}
|
|
38
|
+
function refreshMenuWidth() {
|
|
39
|
+
menuWidth = activator.offsetWidth + 'px';
|
|
40
|
+
refreshPosition = true;
|
|
41
|
+
}
|
|
42
|
+
let activator, focusedIndex = undefined;
|
|
43
|
+
function handleTextFieldFocus() {
|
|
44
|
+
focusedIndex = undefined;
|
|
45
|
+
openMenu();
|
|
46
|
+
}
|
|
47
|
+
function handleTextFieldBlur() {
|
|
48
|
+
// closeMenu()
|
|
49
|
+
}
|
|
50
|
+
let menuElement;
|
|
51
|
+
function handleWindowKeyDown(event) {
|
|
52
|
+
if (event.key == 'ArrowDown' && (focusedIndex < filteredItems.length - 1 || focusedIndex === undefined)) {
|
|
53
|
+
if (focusedIndex === undefined)
|
|
54
|
+
focusedIndex = 0;
|
|
55
|
+
else
|
|
56
|
+
focusedIndex += 1;
|
|
57
|
+
}
|
|
58
|
+
else if (event.key == 'ArrowUp' && (focusedIndex > 0 || focusedIndex === undefined)) {
|
|
59
|
+
if (focusedIndex === undefined)
|
|
60
|
+
focusedIndex = filteredItems.length - 1;
|
|
61
|
+
else
|
|
62
|
+
focusedIndex -= 1;
|
|
63
|
+
}
|
|
64
|
+
else if (event.key == 'Enter' && focusedIndex != undefined) {
|
|
65
|
+
toggle(filteredItems[focusedIndex]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let input;
|
|
69
|
+
function handleContainerClick() {
|
|
70
|
+
if (!menuOpened)
|
|
71
|
+
input.focus();
|
|
72
|
+
}
|
|
73
|
+
let searchText, filteredItems = items;
|
|
74
|
+
$: if (!!searchText) {
|
|
75
|
+
focusedIndex = undefined;
|
|
76
|
+
filteredItems = items.filter((it) => {
|
|
77
|
+
if (!!searchFunction)
|
|
78
|
+
return searchFunction(it, searchText);
|
|
79
|
+
else
|
|
80
|
+
return it.label.toLowerCase().includes(searchText.toLowerCase());
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
filteredItems = items;
|
|
85
|
+
}
|
|
86
|
+
import Textfield from "./Textfield.svelte";
|
|
87
|
+
import Chip from '../navigation/Chip.svelte';
|
|
88
|
+
import Menu from '../common/Menu.svelte';
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<svelte:window></svelte:window>
|
|
92
|
+
|
|
93
|
+
<div
|
|
94
|
+
bind:this={activator}
|
|
95
|
+
style:width={width}
|
|
96
|
+
style:max-width={maxWidth}
|
|
97
|
+
style:opacity={disabled ? '50%' : '100%'}
|
|
98
|
+
on:click={handleContainerClick}
|
|
99
|
+
>
|
|
100
|
+
<slot name="selection-container">
|
|
101
|
+
<div
|
|
102
|
+
class="selection-container"
|
|
103
|
+
style:border={border}
|
|
104
|
+
style:border-radius={borderRadius}
|
|
105
|
+
>
|
|
106
|
+
{#each values as selection}
|
|
107
|
+
<slot name="selection" selection={selection}>
|
|
108
|
+
<div
|
|
109
|
+
style:height={chipHeight}
|
|
110
|
+
>
|
|
111
|
+
<Chip
|
|
112
|
+
color={chipColor}
|
|
113
|
+
textColor={chipTextColor}
|
|
114
|
+
close={true}
|
|
115
|
+
label={true}
|
|
116
|
+
on:close={() => unselect(selection)}
|
|
117
|
+
>{selection.label}</Chip>
|
|
118
|
+
</div>
|
|
119
|
+
</slot>
|
|
120
|
+
{/each}
|
|
121
|
+
|
|
122
|
+
<Textfield
|
|
123
|
+
label={textFieldLabel}
|
|
124
|
+
placeholder={textFieldPlaceholder}
|
|
125
|
+
color={textFieldColor}
|
|
126
|
+
bind:value={searchText}
|
|
127
|
+
variant={textFieldVariant}
|
|
128
|
+
maxWidth={textFieldMaxWidth}
|
|
129
|
+
minWidth={textFieldMinWidth}
|
|
130
|
+
textColor={textFieldTextColor}
|
|
131
|
+
borderWeight={textFieldBorderWeight}
|
|
132
|
+
borderRadius={textFieldBorderRadius}
|
|
133
|
+
borderColor={textFieldBorderColor}
|
|
134
|
+
focusBorderColor={textFieldFocusBorderColor}
|
|
135
|
+
focusedBoxShadow={textFieldFocusedBoxShadow}
|
|
136
|
+
backgroundColor={textFieldBackgroundColor}
|
|
137
|
+
padding={textFieldPadding}
|
|
138
|
+
paddingLeft={textFieldPaddingLeft}
|
|
139
|
+
paddingRight={textFieldPaddingRight}
|
|
140
|
+
paddingBottom={textFieldPaddingBottom}
|
|
141
|
+
paddingTop={textFieldPaddingTop}
|
|
142
|
+
fontSize={textFieldFontSize}
|
|
143
|
+
height={textFieldHeight}
|
|
144
|
+
disabled={disabled}
|
|
145
|
+
on:focus={handleTextFieldFocus}
|
|
146
|
+
on:blur={handleTextFieldBlur}
|
|
147
|
+
on:keydown={handleWindowKeyDown}
|
|
148
|
+
bind:inputElement={input}
|
|
149
|
+
></Textfield>
|
|
150
|
+
</div>
|
|
151
|
+
</slot>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<slot name="menu">
|
|
155
|
+
<Menu
|
|
156
|
+
activator={activator}
|
|
157
|
+
width={menuWidth}
|
|
158
|
+
height={menuHeight}
|
|
159
|
+
maxHeight="300px"
|
|
160
|
+
boxShadow={menuBoxShadow}
|
|
161
|
+
borderRadius={menuBorderRadius}
|
|
162
|
+
bind:open={menuOpened}
|
|
163
|
+
anchor="bottom-center"
|
|
164
|
+
closeOnClickOutside
|
|
165
|
+
bind:refreshPosition={refreshPosition}
|
|
166
|
+
bind:menuElement={menuElement}
|
|
167
|
+
>
|
|
168
|
+
<div
|
|
169
|
+
style:background-color={menuBackgroundColor}
|
|
170
|
+
>
|
|
171
|
+
{#each filteredItems as item, index}
|
|
172
|
+
<slot
|
|
173
|
+
name="item"
|
|
174
|
+
item={item}
|
|
175
|
+
index={index}
|
|
176
|
+
selected={values.findIndex((i) => {
|
|
177
|
+
return i.value == item.value
|
|
178
|
+
}) != -1}
|
|
179
|
+
>
|
|
180
|
+
<div
|
|
181
|
+
style:--autocomplete-selected-item-background-color={selectedItemBackgroundColor}
|
|
182
|
+
style:--autocomplete-focus-item-background-color={focusItemBackgroundColor}
|
|
183
|
+
class:selection-item={true}
|
|
184
|
+
class:focused={index == focusedIndex}
|
|
185
|
+
class:selected={values.findIndex((i) => {
|
|
186
|
+
return i.value == item.value
|
|
187
|
+
}) != -1}
|
|
188
|
+
on:click={(event) => toggle(item)}
|
|
189
|
+
>{item.label}</div>
|
|
190
|
+
</slot>
|
|
191
|
+
{/each}
|
|
192
|
+
</div>
|
|
193
|
+
</Menu>
|
|
194
|
+
</slot>
|
|
195
|
+
|
|
196
|
+
<style>
|
|
197
|
+
.selection-container {
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
gap: 5px;
|
|
201
|
+
padding: 5px
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.selection-item {
|
|
205
|
+
padding: 10px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.selection-item.selected {
|
|
209
|
+
background-color: var(--autocomplete-selected-item-background-color);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.selection-item.focused {
|
|
213
|
+
background-color: var(--autocomplete-focus-item-background-color);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.selection-item:hover {
|
|
217
|
+
background-color: var(--autocomplete-focus-item-background-color);
|
|
218
|
+
}
|
|
219
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
export declare type Item = {
|
|
3
|
+
value: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
data?: any;
|
|
6
|
+
};
|
|
7
|
+
import type { VariantOptions } from './Textfield.svelte';
|
|
8
|
+
declare const __propDef: {
|
|
9
|
+
props: {
|
|
10
|
+
values?: Item[];
|
|
11
|
+
items: Item[];
|
|
12
|
+
searchFunction?: (item: Item, searchText: string) => boolean;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
width?: string;
|
|
16
|
+
maxWidth?: string;
|
|
17
|
+
textFieldLabel?: string;
|
|
18
|
+
textFieldPlaceholder?: string;
|
|
19
|
+
textFieldColor?: string;
|
|
20
|
+
textFieldVariant?: VariantOptions;
|
|
21
|
+
textFieldMaxWidth?: string;
|
|
22
|
+
textFieldMinWidth?: string;
|
|
23
|
+
textFieldHeight?: string;
|
|
24
|
+
textFieldTextColor?: string;
|
|
25
|
+
textFieldBorderWeight?: string;
|
|
26
|
+
textFieldBorderRadius?: string;
|
|
27
|
+
textFieldBorderColor?: string;
|
|
28
|
+
textFieldFocusBorderColor?: string;
|
|
29
|
+
textFieldFocusedBoxShadow?: string;
|
|
30
|
+
textFieldBackgroundColor?: string;
|
|
31
|
+
textFieldPadding?: string;
|
|
32
|
+
textFieldPaddingLeft?: string;
|
|
33
|
+
textFieldPaddingRight?: string;
|
|
34
|
+
textFieldPaddingBottom?: string;
|
|
35
|
+
textFieldPaddingTop?: string;
|
|
36
|
+
textFieldFontSize?: string;
|
|
37
|
+
menuBackgroundColor?: string;
|
|
38
|
+
menuBoxShadow?: string;
|
|
39
|
+
menuBorderRadius?: string;
|
|
40
|
+
focusItemBackgroundColor?: string;
|
|
41
|
+
selectedItemBackgroundColor?: string;
|
|
42
|
+
border?: string;
|
|
43
|
+
borderRadius?: string;
|
|
44
|
+
chipColor?: string;
|
|
45
|
+
chipTextColor?: string;
|
|
46
|
+
chipHeight?: string;
|
|
47
|
+
};
|
|
48
|
+
events: {
|
|
49
|
+
[evt: string]: CustomEvent<any>;
|
|
50
|
+
};
|
|
51
|
+
slots: {
|
|
52
|
+
'selection-container': {};
|
|
53
|
+
selection: {
|
|
54
|
+
selection: Item;
|
|
55
|
+
};
|
|
56
|
+
menu: {};
|
|
57
|
+
item: {
|
|
58
|
+
item: Item;
|
|
59
|
+
index: any;
|
|
60
|
+
selected: boolean;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare type AutocompleteProps = typeof __propDef.props;
|
|
65
|
+
export declare type AutocompleteEvents = typeof __propDef.events;
|
|
66
|
+
export declare type AutocompleteSlots = typeof __propDef.slots;
|
|
67
|
+
export default class Autocomplete extends SvelteComponentTyped<AutocompleteProps, AutocompleteEvents, AutocompleteSlots> {
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script >import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
export let label = null, placeholder = "placeholder", textAreaId = uuidv4(), fontFamily = "inherit", value = "", resizable = true, disabled = false, readOnly = false, maxLength = undefined, textColor = "black", border = "none", borderRadius = "5px", focusedBoxShadow = undefined, backgroundColor = null, padding = undefined, paddingLeft = undefined, paddingRight = undefined, paddingBottom = undefined, paddingTop = undefined, fontSize = undefined, labelFontSize = undefined, labelColor = undefined, width = "100%", height = "100%";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
class="container"
|
|
7
|
+
>
|
|
8
|
+
{#if label}
|
|
9
|
+
<label
|
|
10
|
+
for={textAreaId}
|
|
11
|
+
style:font-size={labelFontSize}
|
|
12
|
+
style:color={labelColor}
|
|
13
|
+
>
|
|
14
|
+
{label}
|
|
15
|
+
</label>
|
|
16
|
+
{/if}
|
|
17
|
+
<textarea
|
|
18
|
+
style:width={width}
|
|
19
|
+
style:height={height}
|
|
20
|
+
style:font-family={fontFamily}
|
|
21
|
+
style:resize={resizable?"both":"none"}
|
|
22
|
+
style:font-size={fontSize}
|
|
23
|
+
style:border-radius={borderRadius}
|
|
24
|
+
style:background-color={backgroundColor}
|
|
25
|
+
style:color={textColor}
|
|
26
|
+
style:padding={padding}
|
|
27
|
+
style:padding-left={paddingLeft}
|
|
28
|
+
style:padding-right={paddingRight}
|
|
29
|
+
style:padding-bottom={paddingBottom}
|
|
30
|
+
style:padding-top={paddingTop}
|
|
31
|
+
style:border={border}
|
|
32
|
+
style:--textarea-focus-box-shadow={focusedBoxShadow}
|
|
33
|
+
bind:value={value}
|
|
34
|
+
id={textAreaId}
|
|
35
|
+
placeholder={placeholder}
|
|
36
|
+
maxlength={maxLength}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
readonly={readOnly}
|
|
39
|
+
></textarea>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<style>
|
|
44
|
+
textarea {
|
|
45
|
+
display: block;
|
|
46
|
+
transition: all 0.3s;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
label {
|
|
50
|
+
display: block;
|
|
51
|
+
margin-bottom: 10px;
|
|
52
|
+
margin-left: 10px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
textarea:focus{
|
|
56
|
+
outline: none;
|
|
57
|
+
-webkit-box-shadow: var(--textarea-focus-box-shadow);
|
|
58
|
+
-moz-box-shadow: var(--textarea-focus-box-shadow);
|
|
59
|
+
-o-box-shadow: var(--textarea-focus-box-shadow);
|
|
60
|
+
box-shadow: var(--textarea-focus-box-shadow);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
textAreaId?: string;
|
|
7
|
+
fontFamily?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
resizable?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
textColor?: string;
|
|
14
|
+
border?: string;
|
|
15
|
+
borderRadius?: string;
|
|
16
|
+
focusedBoxShadow?: string;
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
padding?: string;
|
|
19
|
+
paddingLeft?: string;
|
|
20
|
+
paddingRight?: string;
|
|
21
|
+
paddingBottom?: string;
|
|
22
|
+
paddingTop?: string;
|
|
23
|
+
fontSize?: string;
|
|
24
|
+
labelFontSize?: string;
|
|
25
|
+
labelColor?: string;
|
|
26
|
+
width?: string;
|
|
27
|
+
height?: string;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
};
|
|
32
|
+
slots: {};
|
|
33
|
+
};
|
|
34
|
+
export declare type TextareaProps = typeof __propDef.props;
|
|
35
|
+
export declare type TextareaEvents = typeof __propDef.events;
|
|
36
|
+
export declare type TextareaSlots = typeof __propDef.slots;
|
|
37
|
+
export default class Textarea extends SvelteComponentTyped<TextareaProps, TextareaEvents, TextareaSlots> {
|
|
38
|
+
}
|
|
39
|
+
export {};
|
package/forms/Textfield.svelte
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script >export let label = "", placeholder = "", color = null, value = "", disabled = false, variant = 'outlined', width = "100%", height = "50px", maxWidth = undefined, minWidth = undefined, textColor = "black", borderWeight = "2px", borderRadius = "5px", borderColor = null, focusBorderColor = null, focusedBoxShadow = undefined, backgroundColor = null, padding = undefined, paddingLeft = undefined, paddingRight = undefined, paddingBottom = undefined, paddingTop = undefined, fontSize = undefined, type = 'text', inputElement = undefined;
|
|
2
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
5
|
import { onMount } from 'svelte';
|
|
4
6
|
let inputId = uuidv4(), focused = false, legendWidth = 0, labelElement = undefined;
|
|
@@ -20,7 +22,6 @@ $: if (!!labelElement) {
|
|
|
20
22
|
|
|
21
23
|
<style>
|
|
22
24
|
.input-container {
|
|
23
|
-
height: 50px;
|
|
24
25
|
position: relative;
|
|
25
26
|
--textfield-final-color: var(--textfield-theme-color, --textfield-border-color, rgb(88, 88, 88));
|
|
26
27
|
--textfield-final-border-color: var(--textfield-border-color, var(--textfield-final-color))
|
|
@@ -111,6 +112,9 @@ $: if (!!labelElement) {
|
|
|
111
112
|
|
|
112
113
|
<div
|
|
113
114
|
style:width={width}
|
|
115
|
+
style:min-width={minWidth}
|
|
116
|
+
style:max-width={maxWidth}
|
|
117
|
+
style:height={height}
|
|
114
118
|
style:--textfield-theme-color={color}
|
|
115
119
|
style:--textfield-border-color={borderColor}
|
|
116
120
|
style:--textfield-border-weight={borderWeight}
|
|
@@ -161,6 +165,7 @@ $: if (!!labelElement) {
|
|
|
161
165
|
class="input-outlined"
|
|
162
166
|
type="password"
|
|
163
167
|
placeholder={placeholder}
|
|
168
|
+
disabled={disabled}
|
|
164
169
|
bind:value={value}
|
|
165
170
|
on:change
|
|
166
171
|
on:input
|
|
@@ -171,6 +176,7 @@ $: if (!!labelElement) {
|
|
|
171
176
|
on:keydown
|
|
172
177
|
on:keypress
|
|
173
178
|
on:keyup
|
|
179
|
+
bind:this={inputElement}
|
|
174
180
|
/>
|
|
175
181
|
{:else if type == 'text'}
|
|
176
182
|
<input
|
|
@@ -181,6 +187,7 @@ $: if (!!labelElement) {
|
|
|
181
187
|
class="input-outlined"
|
|
182
188
|
type="text"
|
|
183
189
|
placeholder={placeholder}
|
|
190
|
+
disabled={disabled}
|
|
184
191
|
bind:value={value}
|
|
185
192
|
on:change
|
|
186
193
|
on:input
|
|
@@ -191,6 +198,7 @@ $: if (!!labelElement) {
|
|
|
191
198
|
on:keydown
|
|
192
199
|
on:keypress
|
|
193
200
|
on:keyup
|
|
201
|
+
bind:this={inputElement}
|
|
194
202
|
/>
|
|
195
203
|
{/if}
|
|
196
204
|
<div>
|
|
@@ -213,6 +221,7 @@ $: if (!!labelElement) {
|
|
|
213
221
|
class="input-boxed"
|
|
214
222
|
type="password"
|
|
215
223
|
placeholder={placeholder || label}
|
|
224
|
+
disabled={disabled}
|
|
216
225
|
bind:value={value}
|
|
217
226
|
on:change
|
|
218
227
|
on:input
|
|
@@ -221,8 +230,9 @@ $: if (!!labelElement) {
|
|
|
221
230
|
on:blur={handleBlur}
|
|
222
231
|
on:blur
|
|
223
232
|
on:keydown
|
|
224
|
-
|
|
225
|
-
|
|
233
|
+
on:keypress
|
|
234
|
+
on:keyup
|
|
235
|
+
bind:this={inputElement}
|
|
226
236
|
/>
|
|
227
237
|
{:else if type == 'text'}
|
|
228
238
|
<input
|
|
@@ -233,6 +243,7 @@ $: if (!!labelElement) {
|
|
|
233
243
|
class="input-boxed"
|
|
234
244
|
type="text"
|
|
235
245
|
placeholder={placeholder || label}
|
|
246
|
+
disabled={disabled}
|
|
236
247
|
bind:value={value}
|
|
237
248
|
on:change
|
|
238
249
|
on:input
|
|
@@ -243,6 +254,7 @@ $: if (!!labelElement) {
|
|
|
243
254
|
on:keydown
|
|
244
255
|
on:keypress
|
|
245
256
|
on:keyup
|
|
257
|
+
bind:this={inputElement}
|
|
246
258
|
/>
|
|
247
259
|
{/if}
|
|
248
260
|
<div>
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
export declare type VariantOptions = 'outlined' | 'boxed';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
label?: string;
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
color?: string;
|
|
7
8
|
value?: string;
|
|
8
|
-
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
variant?: VariantOptions;
|
|
9
11
|
width?: string;
|
|
12
|
+
height?: string;
|
|
13
|
+
maxWidth?: string;
|
|
14
|
+
minWidth?: string;
|
|
10
15
|
textColor?: string;
|
|
11
16
|
borderWeight?: string;
|
|
12
17
|
borderRadius?: string;
|
|
@@ -21,6 +26,7 @@ declare const __propDef: {
|
|
|
21
26
|
paddingTop?: string;
|
|
22
27
|
fontSize?: string;
|
|
23
28
|
type?: 'text' | 'password';
|
|
29
|
+
inputElement?: HTMLElement;
|
|
24
30
|
};
|
|
25
31
|
events: {
|
|
26
32
|
change: Event;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script >export let value = false, height = "60px", width = "30px", rounded = false, backgroundColor = "#90CAF9", selectedOptionColor = backgroundColor, sliderColor = "white", optionColor = sliderColor, fontSize = "11px", animationDuration = "0.1s";
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<div
|
|
5
|
+
class="container"
|
|
6
|
+
style:--vertical-switch-height={height}
|
|
7
|
+
style:--vertical-switch-width={width}
|
|
8
|
+
style:--vertical-switch-container-border-radius={rounded ? "500px" : "4px"}
|
|
9
|
+
style:--vertical-switch-slider-border-radius={rounded ? "100%" : "4px"}
|
|
10
|
+
style:--vertical-switch-background-color={backgroundColor}
|
|
11
|
+
style:--vertical-switch-selected-option-color={selectedOptionColor}
|
|
12
|
+
style:--vertical-switch-slider-color={sliderColor}
|
|
13
|
+
style:--vertical-switch-option-color={optionColor}
|
|
14
|
+
style:--vertical-switch-font-size={fontSize}
|
|
15
|
+
style:--vertical-switch-animation-duration={animationDuration}
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="inner-container"
|
|
19
|
+
on:click={()=>value = !value}
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
class={value?"first-option selected":"first-option"}
|
|
23
|
+
>
|
|
24
|
+
<slot name="trueOption">
|
|
25
|
+
1
|
|
26
|
+
</slot>
|
|
27
|
+
</div>
|
|
28
|
+
<div
|
|
29
|
+
class={value?"second-option":"second-option selected"}
|
|
30
|
+
>
|
|
31
|
+
<slot name="falseOption">
|
|
32
|
+
0
|
|
33
|
+
</slot>
|
|
34
|
+
</div>
|
|
35
|
+
<input
|
|
36
|
+
bind:checked={value}
|
|
37
|
+
type="checkbox"
|
|
38
|
+
on:change
|
|
39
|
+
/>
|
|
40
|
+
<span
|
|
41
|
+
class={value?"slider top":"slider bottom"}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<style>
|
|
47
|
+
.container {
|
|
48
|
+
position: relative;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
width: var(--vertical-switch-width);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
input {
|
|
54
|
+
position: absolute;
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.inner-container {
|
|
59
|
+
position: absolute;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: var(--vertical-switch-height);
|
|
62
|
+
background-color: var(--vertical-switch-background-color);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
text-align: center;
|
|
65
|
+
border-radius: var(--vertical-switch-container-border-radius)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.first-option {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: calc(var(--vertical-switch-width));
|
|
71
|
+
position: absolute;
|
|
72
|
+
overflow-x: hidden;
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
align-items: center;
|
|
76
|
+
top: 0;
|
|
77
|
+
color: var(--vertical-switch-option-color);
|
|
78
|
+
font-size: var(--vertical-switch-font-size);
|
|
79
|
+
user-select: none;
|
|
80
|
+
transition: var(--vertical-switch-animation-duration);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.second-option {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: calc(var(--vertical-switch-width));
|
|
86
|
+
position: absolute;
|
|
87
|
+
overflow-x: hidden;
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
align-items: center;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
color: var(--vertical-switch-option-color);
|
|
93
|
+
font-size: var(--vertical-switch-font-size);
|
|
94
|
+
user-select: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.selected {
|
|
98
|
+
color: var(--vertical-switch-selected-option-color);
|
|
99
|
+
z-index: 5;
|
|
100
|
+
font-weight: bold;
|
|
101
|
+
transition: var(--vertical-switch-animation-duration);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.slider {
|
|
105
|
+
position: absolute;
|
|
106
|
+
--vertical-switch-slider-diameter: calc(var(--vertical-switch-width) - 4px);
|
|
107
|
+
width: var(--vertical-switch-slider-diameter);
|
|
108
|
+
height: var(--vertical-switch-slider-diameter);
|
|
109
|
+
border-radius: var(--vertical-switch-slider-border-radius);
|
|
110
|
+
background-color: var(--vertical-switch-slider-color);
|
|
111
|
+
left: 2px;
|
|
112
|
+
transition: var(--vertical-switch-animation-duration);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.top {
|
|
116
|
+
top: 2px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.bottom {
|
|
120
|
+
top: calc(var(--vertical-switch-height) - var(--vertical-switch-slider-diameter) - 2px)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: boolean;
|
|
5
|
+
height?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
rounded?: boolean;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
selectedOptionColor?: string;
|
|
10
|
+
sliderColor?: string;
|
|
11
|
+
optionColor?: string;
|
|
12
|
+
fontSize?: string;
|
|
13
|
+
animationDuration?: string;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
change: Event;
|
|
17
|
+
} & {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
};
|
|
20
|
+
slots: {
|
|
21
|
+
trueOption: {};
|
|
22
|
+
falseOption: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare type VerticalSwitchProps = typeof __propDef.props;
|
|
26
|
+
export declare type VerticalSwitchEvents = typeof __propDef.events;
|
|
27
|
+
export declare type VerticalSwitchSlots = typeof __propDef.slots;
|
|
28
|
+
export default class VerticalSwitch extends SvelteComponentTyped<VerticalSwitchProps, VerticalSwitchEvents, VerticalSwitchSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script >import { fly } from 'svelte/transition';
|
|
2
|
+
export let value = false, height = "100%", width = "100%", backgroundColor = undefined, firstColor = undefined, secondColor = firstColor, fontSize = "12px", hoverBackgroundColor = undefined, hoverBoxShadow = undefined, animationDuration = 200;
|
|
3
|
+
let optionHeight = undefined;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="container"
|
|
8
|
+
style:width
|
|
9
|
+
style:height
|
|
10
|
+
style:--vertical-text-switch-height={height}
|
|
11
|
+
style:--vertical-text-switch-hover-background-color={hoverBackgroundColor}
|
|
12
|
+
style:--vertical-text-switch-hover-box-shadow={hoverBoxShadow}
|
|
13
|
+
bind:clientHeight={optionHeight}
|
|
14
|
+
on:click={()=>value = !value}
|
|
15
|
+
style:background-color={backgroundColor}
|
|
16
|
+
style:padding="5px"
|
|
17
|
+
>
|
|
18
|
+
{#if value}
|
|
19
|
+
<div
|
|
20
|
+
in:fly="{{ y: optionHeight/2, duration: animationDuration/2, delay: animationDuration/2}}"
|
|
21
|
+
out:fly="{{ y: -optionHeight/2, duration: animationDuration/2}}"
|
|
22
|
+
class="option"
|
|
23
|
+
style:color={firstColor}
|
|
24
|
+
style:font-size={fontSize}
|
|
25
|
+
>
|
|
26
|
+
<slot name="trueOption"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
{:else}
|
|
29
|
+
<div
|
|
30
|
+
in:fly="{{ y: optionHeight/2, duration: animationDuration/2, delay: animationDuration/2}}"
|
|
31
|
+
out:fly="{{ y: -optionHeight/2, duration: animationDuration/2}}"
|
|
32
|
+
class="option"
|
|
33
|
+
style:color={secondColor}
|
|
34
|
+
style:font-size={fontSize}
|
|
35
|
+
>
|
|
36
|
+
<slot name="falseOption"></slot>
|
|
37
|
+
</div>
|
|
38
|
+
{/if}
|
|
39
|
+
<input type="checkbox" bind:value />
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
.container {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
border-radius: 5px;
|
|
46
|
+
overflow-y: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.container:hover {
|
|
50
|
+
background-color: var(--vertical-text-switch-hover-background-color);
|
|
51
|
+
box-shadow: var(--vertical-text-switch-hover-box-shadow);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.option {
|
|
55
|
+
height: var(--vertical-text-switch-height);
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
user-select: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: boolean;
|
|
5
|
+
height?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
firstColor?: string;
|
|
9
|
+
secondColor?: string;
|
|
10
|
+
fontSize?: string;
|
|
11
|
+
hoverBackgroundColor?: string;
|
|
12
|
+
hoverBoxShadow?: string;
|
|
13
|
+
animationDuration?: number;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {
|
|
19
|
+
trueOption: {};
|
|
20
|
+
falseOption: {};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare type VerticalTextSwitchProps = typeof __propDef.props;
|
|
24
|
+
export declare type VerticalTextSwitchEvents = typeof __propDef.events;
|
|
25
|
+
export declare type VerticalTextSwitchSlots = typeof __propDef.slots;
|
|
26
|
+
export default class VerticalTextSwitch extends SvelteComponentTyped<VerticalTextSwitchProps, VerticalTextSwitchEvents, VerticalTextSwitchSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/media/Avatar.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script >export let src, alt = "", width = "40px", maxWidth = undefined, minWidth = undefined, height = "40px", maxHeight = undefined, minHeight = undefined, lazyLoaded = false, borderRadius = "50%";
|
|
1
|
+
<script >export let src, alt = "", width = "40px", maxWidth = undefined, minWidth = undefined, height = "40px", maxHeight = undefined, minHeight = undefined, lazyLoaded = false, referrerpolicy = "no-referrer", borderRadius = "50%";
|
|
2
2
|
import Image from './Image.svelte';
|
|
3
3
|
</script>
|
|
4
4
|
|
|
@@ -27,5 +27,6 @@ import Image from './Image.svelte';
|
|
|
27
27
|
style:min-height={minHeight}
|
|
28
28
|
style:border-radius={borderRadius}
|
|
29
29
|
style:object-fit="cover"
|
|
30
|
+
referrerpolicy={referrerpolicy}
|
|
30
31
|
/>
|
|
31
32
|
{/if}
|
package/media/Avatar.svelte.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script >export let src, title = undefined, description = undefined, direction = 'row', reverse = false, avatarSpacing = '10px', width = undefined, maxWidth = undefined, minWidth = undefined, height = undefined, maxHeight = undefined, minHeight = undefined, lazyLoaded = false, borderRadius = "50%";
|
|
1
|
+
<script >export let src, title = undefined, description = undefined, direction = 'row', reverse = false, avatarSpacing = '10px', width = undefined, maxWidth = undefined, minWidth = undefined, height = undefined, maxHeight = undefined, minHeight = undefined, lazyLoaded = false, borderRadius = "50%", referrerpolicy = "no-referrer";
|
|
2
2
|
let textAlignment;
|
|
3
3
|
$: if (direction == 'column') {
|
|
4
4
|
textAlignment = 'center';
|
|
@@ -53,6 +53,7 @@ import Avatar from "./Avatar.svelte";
|
|
|
53
53
|
minHeight={minHeight}
|
|
54
54
|
borderRadius={borderRadius}
|
|
55
55
|
lazyLoaded={lazyLoaded}
|
|
56
|
+
referrerpolicy={referrerpolicy}
|
|
56
57
|
></Avatar>
|
|
57
58
|
</div>
|
|
58
59
|
<div
|
package/navigation/Chip.svelte
CHANGED
|
@@ -1,56 +1,53 @@
|
|
|
1
1
|
<script >import Icon from '../media/Icon.svelte';
|
|
2
2
|
import Button from '../buttons/Button.svelte';
|
|
3
3
|
import { createEventDispatcher } from 'svelte';
|
|
4
|
-
export let
|
|
4
|
+
export let close = false, closeIcon = "mdi-close-circle", color = "blue", textColor = "white", disabled = false, filter = false, filterIcon = "mdi-check", label = false, outlined = false, size = 12;
|
|
5
5
|
const dispatch = createEventDispatcher();
|
|
6
6
|
function handleChipClick() {
|
|
7
7
|
dispatch('click');
|
|
8
8
|
}
|
|
9
9
|
function handleCloseClick() {
|
|
10
|
-
active = false;
|
|
11
10
|
dispatch('close');
|
|
12
11
|
}
|
|
13
12
|
</script>
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
<div
|
|
15
|
+
class="chip"
|
|
16
|
+
style:border-radius={label?"5px":"100px"}
|
|
17
|
+
style:background-color="{color}"
|
|
18
|
+
style:color={outlined?color:textColor}
|
|
19
|
+
class:label={label}
|
|
20
|
+
class:outlined={outlined}
|
|
21
|
+
class:disabled={disabled}
|
|
22
|
+
on:click={handleChipClick}
|
|
23
|
+
>
|
|
24
|
+
{#if filter}
|
|
25
|
+
<div class="icon-before">
|
|
26
|
+
<Icon
|
|
27
|
+
name={filterIcon}
|
|
28
|
+
size={size}
|
|
29
|
+
></Icon>
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
<div class="text"
|
|
33
|
+
style:font-size="{size}pt"
|
|
34
|
+
style:line-height="{size}pt"
|
|
25
35
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<div class="icon-after">
|
|
42
|
-
<Button
|
|
43
|
-
icon={closeIcon}
|
|
44
|
-
iconSize={size}
|
|
45
|
-
type='icon'
|
|
46
|
-
hoverBackgroundColor="none"
|
|
47
|
-
on:click={handleCloseClick}
|
|
48
|
-
>
|
|
49
|
-
</Button>
|
|
50
|
-
</div>
|
|
51
|
-
{/if}
|
|
52
|
-
</div>
|
|
53
|
-
{/if}
|
|
36
|
+
<slot></slot>
|
|
37
|
+
</div>
|
|
38
|
+
{#if close}
|
|
39
|
+
<div class="icon-after">
|
|
40
|
+
<Button
|
|
41
|
+
icon={closeIcon}
|
|
42
|
+
iconSize={size}
|
|
43
|
+
type='icon'
|
|
44
|
+
hoverBackgroundColor="none"
|
|
45
|
+
on:click={handleCloseClick}
|
|
46
|
+
>
|
|
47
|
+
</Button>
|
|
48
|
+
</div>
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
54
51
|
|
|
55
52
|
<style>
|
|
56
53
|
.chip {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likable-hair/svelte",
|
|
3
3
|
"description": "A Svelte component for likablehair",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.49",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@sveltejs/adapter-auto": "next",
|
|
7
7
|
"@sveltejs/kit": "next",
|
|
@@ -77,14 +77,19 @@
|
|
|
77
77
|
"./dates/Calendar.svelte": "./dates/Calendar.svelte",
|
|
78
78
|
"./dates/DatePicker.svelte": "./dates/DatePicker.svelte",
|
|
79
79
|
"./dates/MonthSelector.svelte": "./dates/MonthSelector.svelte",
|
|
80
|
+
"./dates/TimePickerTextField.svelte": "./dates/TimePickerTextField.svelte",
|
|
80
81
|
"./dates/YearSelector.svelte": "./dates/YearSelector.svelte",
|
|
81
82
|
"./dates/utils": "./dates/utils.js",
|
|
82
83
|
"./dialogs/Dialog.svelte": "./dialogs/Dialog.svelte",
|
|
84
|
+
"./forms/Autocomplete.svelte": "./forms/Autocomplete.svelte",
|
|
83
85
|
"./forms/Checkbox.svelte": "./forms/Checkbox.svelte",
|
|
84
86
|
"./forms/FileInput.svelte": "./forms/FileInput.svelte",
|
|
85
87
|
"./forms/FileInputList.svelte": "./forms/FileInputList.svelte",
|
|
86
88
|
"./forms/Switch.svelte": "./forms/Switch.svelte",
|
|
89
|
+
"./forms/Textarea.svelte": "./forms/Textarea.svelte",
|
|
87
90
|
"./forms/Textfield.svelte": "./forms/Textfield.svelte",
|
|
91
|
+
"./forms/VerticalSwitch.svelte": "./forms/VerticalSwitch.svelte",
|
|
92
|
+
"./forms/VerticalTextSwitch.svelte": "./forms/VerticalTextSwitch.svelte",
|
|
88
93
|
".": "./index.js",
|
|
89
94
|
"./loaders/CircularLoader.svelte": "./loaders/CircularLoader.svelte",
|
|
90
95
|
"./loaders/Skeleton.svelte": "./loaders/Skeleton.svelte",
|