@likable-hair/svelte 0.0.64 → 0.0.65
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/forms/Autocomplete.svelte +12 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
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
6
|
// menu
|
|
7
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
|
+
let dispatch = createEventDispatcher();
|
|
8
9
|
function select(item) {
|
|
9
10
|
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
10
11
|
if (!alreadyPresent) {
|
|
@@ -13,11 +14,21 @@ function select(item) {
|
|
|
13
14
|
else
|
|
14
15
|
values = [item];
|
|
15
16
|
refreshMenuWidth();
|
|
17
|
+
dispatch('change', {
|
|
18
|
+
unselect: undefined,
|
|
19
|
+
select: item,
|
|
20
|
+
selection: values
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
function unselect(item) {
|
|
19
25
|
values = values.filter((i) => i.value != item.value);
|
|
20
26
|
refreshMenuWidth();
|
|
27
|
+
dispatch('change', {
|
|
28
|
+
unselect: item,
|
|
29
|
+
select: undefined,
|
|
30
|
+
selection: values
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
function toggle(item) {
|
|
23
34
|
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
@@ -90,6 +101,7 @@ else {
|
|
|
90
101
|
import Textfield from "./Textfield.svelte";
|
|
91
102
|
import Chip from '../navigation/Chip.svelte';
|
|
92
103
|
import Menu from '../common/Menu.svelte';
|
|
104
|
+
import { createEventDispatcher } from 'svelte';
|
|
93
105
|
</script>
|
|
94
106
|
|
|
95
107
|
<svelte:window></svelte:window>
|