@likable-hair/svelte 3.1.17 → 3.1.19

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.
@@ -27,6 +27,7 @@ declare const __propDef: {
27
27
  width?: string | undefined;
28
28
  height?: string | undefined;
29
29
  maxWidth?: string | undefined;
30
+ minWidth?: string | undefined;
30
31
  openingId?: string | undefined;
31
32
  searchText?: string | undefined;
32
33
  maxVisibleChips?: number | undefined;
@@ -5,7 +5,7 @@ import "./Autocomplete.css";
5
5
  import { scrollInMenu } from "../common/scroller";
6
6
  let clazz = {};
7
7
  export { clazz as class };
8
- export let values = [], items, searchFunction = void 0, multiple = false, disabled = false, mandatory = false, placeholder = "", width = "auto", height = "auto", maxWidth = void 0, openingId = "autocomplete-menu", searchText = void 0, maxVisibleChips = void 0, menuOpened = false, closeOnSelect = !multiple, emptySearchTextOnMenuClose = true, menuBoxShadow = "rgb(var(--global-color-background-300), .5) 0px 2px 4px", menuBorderRadius = "5px", mobileDrawer = false, menuWidth = void 0;
8
+ export let values = [], items, searchFunction = void 0, multiple = false, disabled = false, mandatory = false, placeholder = "", width = "auto", height = "auto", maxWidth = void 0, minWidth = "200px", openingId = "autocomplete-menu", searchText = void 0, maxVisibleChips = void 0, menuOpened = false, closeOnSelect = !multiple, emptySearchTextOnMenuClose = true, menuBoxShadow = "rgb(var(--global-color-background-300), .5) 0px 2px 4px", menuBorderRadius = "5px", mobileDrawer = false, menuWidth = void 0;
9
9
  let dispatch = createEventDispatcher();
10
10
  function select(item) {
11
11
  if (disabled)
@@ -147,6 +147,14 @@ $:
147
147
  searchText = void 0;
148
148
  }, 10);
149
149
  }
150
+ $:
151
+ if (!!input) {
152
+ if (!disabled && values.length != 0) {
153
+ input.style.width = Math.max(searchText?.length || 0, 1) + "ch";
154
+ } else {
155
+ input.style.width = "auto";
156
+ }
157
+ }
150
158
  import Chip from "../navigation/Chip.svelte";
151
159
  import Menu from "../common/Menu.svelte";
152
160
  import { createEventDispatcher } from "svelte";
@@ -160,6 +168,7 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
160
168
  bind:this={activator}
161
169
  style:width
162
170
  style:max-width={maxWidth}
171
+ style:min-width={minWidth}
163
172
  style:height
164
173
  style:opacity={disabled ? "50%" : "100%"}
165
174
  on:click={handleContainerClick}
@@ -195,13 +204,14 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
195
204
  </slot>
196
205
  {/if}
197
206
 
198
- <SimpleTextField
199
- --simple-textfield-max-width="min(200px, 90%)"
200
- --simple-textfield-height="auto"
201
- --simple-textfield-padding="0px"
202
- --simple-textfield-default-background-color="rgb(1, 1, 1, 0)"
203
- --simple-textfield-default-margin-bottom="0px"
204
- --simple-textfield-default-margin-left="10px"
207
+ <input
208
+ style:--simple-textfield-max-width="min(200px, 90%)"
209
+ style:--simple-textfield-height="auto"
210
+ style:--simple-textfield-padding="0px"
211
+ style:--simple-textfield-default-background-color="rgb(1, 1, 1, 0)"
212
+ style:--simple-textfield-default-margin-bottom="0px"
213
+ style:--simple-textfield-default-margin-left="10px"
214
+ class="autocomplete-input"
205
215
  bind:value={searchText}
206
216
  on:focus={handleTextFieldFocus}
207
217
  on:focus
@@ -211,9 +221,8 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
211
221
  on:keydown
212
222
  {disabled}
213
223
  placeholder={placeholder}
214
- bind:input={input}
215
- class={clazz.simpleTextfield}
216
- ></SimpleTextField>
224
+ bind:this={input}
225
+ />
217
226
  </div>
218
227
  </slot>
219
228
  </div>
@@ -414,4 +423,12 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
414
423
  opacity: 50%;
415
424
  cursor: pointer;
416
425
  }
426
+
427
+ .autocomplete-input {
428
+ background-color: rgb(1, 1, 1, 0);
429
+ /* margin-left: 10px; */
430
+ outline: none;
431
+ border: none;
432
+ color: inherit;
433
+ }
417
434
  </style>
@@ -25,6 +25,7 @@ declare const __propDef: {
25
25
  width?: string | undefined;
26
26
  height?: string | undefined;
27
27
  maxWidth?: string | undefined;
28
+ minWidth?: string | undefined;
28
29
  openingId?: string | undefined;
29
30
  searchText?: string | undefined;
30
31
  maxVisibleChips?: number | undefined;
@@ -205,6 +205,7 @@ export let value = void 0, type = "text", placeholder = void 0, disabled = false
205
205
  --simple-textfield-height,
206
206
  var(--simple-textfield-default-height)
207
207
  );
208
+ width: fit-content;
208
209
  background-color: var(
209
210
  --simple-textfield-background-color,
210
211
  var(--simple-textfield-default-background-color)
@@ -11,20 +11,22 @@ export let headers = [], items = [], sortedBy = void 0, sortDirection = "asc";
11
11
  export let calculateRowStyles = void 0;
12
12
  export let calculateRowClasses = void 0;
13
13
  function handleHeaderClick(header) {
14
- if (!!sortedBy && header.value == sortedBy) {
15
- if (sortDirection == "asc")
16
- sortDirection = "desc";
17
- else if (sortDirection == "desc") {
18
- sortedBy = void 0;
14
+ if (header.sortable) {
15
+ if (!!sortedBy && header.value == sortedBy) {
16
+ if (sortDirection == "asc")
17
+ sortDirection = "desc";
18
+ else if (sortDirection == "desc") {
19
+ sortedBy = void 0;
20
+ }
21
+ } else {
22
+ sortedBy = header.value;
23
+ sortDirection = "asc";
19
24
  }
20
- } else {
21
- sortedBy = header.value;
22
- sortDirection = "asc";
25
+ dispatch("sort", {
26
+ sortedBy,
27
+ sortDirection
28
+ });
23
29
  }
24
- dispatch("sort", {
25
- sortedBy,
26
- sortDirection
27
- });
28
30
  }
29
31
  function handleRowClick(item) {
30
32
  dispatch("rowClick", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair and others",
4
- "version": "3.1.17",
4
+ "version": "3.1.19",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",