@likable-hair/svelte 3.0.81 → 3.0.83

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.
@@ -2,22 +2,20 @@
2
2
 
3
3
  <script>import lodash from "lodash";
4
4
  import Autocomplete from "../../../components/simple/forms/Autocomplete.svelte";
5
- import Button from "../../simple/buttons/Button.svelte";
6
5
  import Icon from "../../simple/media/Icon.svelte";
7
6
  import { createEventDispatcher } from "svelte";
8
7
  import Avatar from "../../simple/media/Avatar.svelte";
9
8
  import ToolTip from "../common/ToolTip.svelte";
10
9
  let dispatch = createEventDispatcher();
11
- export let items = [], values = [], multiple = true, lang = "en", searchText = void 0, maxVisibleChips = void 0, placeholder = lang == "en" ? "Select" : "Seleziona", clearable = true, mandatory = true, menuOpened = false, openingId = void 0, width = void 0;
12
- function handleCloseClick(event) {
13
- event.preventDefault();
14
- event.stopPropagation();
15
- let valuesBefore = lodash.cloneDeep(values);
16
- values = [];
10
+ export let items = [], values = [], multiple = true, menuOpened = false, openingId = void 0, width = void 0;
11
+ function handleCloseClick(params) {
12
+ let unselected = lodash.cloneDeep(values[params.index]);
13
+ values.splice(params.index, 1);
14
+ values = [...values];
17
15
  dispatch("change", {
18
- unselect: valuesBefore[0],
16
+ unselect: unselected,
19
17
  select: void 0,
20
- selection: []
18
+ selection: values
21
19
  });
22
20
  }
23
21
  $:
@@ -39,10 +37,7 @@ let tooltipsActivator = [];
39
37
  <Autocomplete
40
38
  bind:items={autocompleteItems}
41
39
  bind:values
42
- bind:searchText
43
40
  bind:multiple
44
- bind:maxVisibleChips
45
- bind:mandatory
46
41
  searchFunction={() => true}
47
42
  on:change
48
43
  bind:menuOpened
@@ -65,10 +60,7 @@ let tooltipsActivator = [];
65
60
  <slot
66
61
  name="label"
67
62
  {values}
68
- {items}
69
- {searchText}
70
- {placeholder}
71
- {clearable}
63
+ {items}
72
64
  {handleCloseClick}
73
65
  >
74
66
  {#if values.length > 0}
@@ -88,8 +80,7 @@ let tooltipsActivator = [];
88
80
  ></Avatar>
89
81
  <button
90
82
  on:click|stopPropagation={() => {
91
- values.splice(i, 1)
92
- values = [...values]
83
+ handleCloseClick({ index: i })
93
84
  }}
94
85
  class="unstyled-button remove-button"
95
86
  >
@@ -102,10 +93,7 @@ let tooltipsActivator = [];
102
93
  <slot
103
94
  name="no-values"
104
95
  {values}
105
- {items}
106
- {searchText}
107
- {placeholder}
108
- {clearable}
96
+ {items}
109
97
  {handleCloseClick}
110
98
  >
111
99
  <Icon name="mdi-account-plus"></Icon>
@@ -13,12 +13,6 @@ declare const __propDef: {
13
13
  items?: AvatarItem[] | undefined;
14
14
  values?: AvatarItem[] | undefined;
15
15
  multiple?: boolean | undefined;
16
- lang?: "it" | "en" | undefined;
17
- searchText?: string | undefined;
18
- maxVisibleChips?: number | undefined;
19
- placeholder?: string | undefined;
20
- clearable?: boolean | undefined;
21
- mandatory?: boolean | undefined;
22
16
  menuOpened?: boolean | undefined;
23
17
  openingId?: string | undefined;
24
18
  width?: string | undefined;
@@ -32,18 +26,16 @@ declare const __propDef: {
32
26
  label: {
33
27
  values: AvatarItem[];
34
28
  items: AvatarItem[];
35
- searchText: string | undefined;
36
- placeholder: string;
37
- clearable: boolean;
38
- handleCloseClick: (event: MouseEvent) => void;
29
+ handleCloseClick: (params: {
30
+ index: number;
31
+ }) => void;
39
32
  };
40
33
  'no-values': {
41
34
  values: AvatarItem[];
42
35
  items: AvatarItem[];
43
- searchText: string | undefined;
44
- placeholder: string;
45
- clearable: boolean;
46
- handleCloseClick: (event: MouseEvent) => void;
36
+ handleCloseClick: (params: {
37
+ index: number;
38
+ }) => void;
47
39
  };
48
40
  'item-label': {
49
41
  item: import("../../../components/simple/forms/Autocomplete.svelte").Item;
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": "3.0.81",
4
+ "version": "3.0.83",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",