@likable-hair/svelte 4.0.34 → 4.0.35
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.
|
@@ -48,6 +48,7 @@ declare class __sveltets_Render<Data> {
|
|
|
48
48
|
menuAnchor?: ComponentProps<typeof Menu>["anchor"];
|
|
49
49
|
menuStayInViewport?: ComponentProps<typeof Menu>["stayInViewport"];
|
|
50
50
|
menuFlipOnOverflow?: ComponentProps<typeof Menu>["flipOnOverflow"];
|
|
51
|
+
adaptInputWidth?: boolean;
|
|
51
52
|
class?: {
|
|
52
53
|
activator?: string;
|
|
53
54
|
menu?: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<script lang="ts" generics="Data">import "../../../css/main.css";
|
|
5
5
|
import "./Autocomplete.css";
|
|
6
6
|
import { scrollInMenu } from "../common/scroller";
|
|
7
|
-
let { values = $bindable(), items = [], searchFunction = undefined, multiple = false, disabled = false, mandatory = false, placeholder = "", width = "auto", height = "auto", maxWidth = undefined, minWidth = "200px", openingId = $bindable("autocomplete-menu"), searchText = $bindable(), maxVisibleChips = undefined, menuOpened = $bindable(false), closeOnSelect = !multiple, emptySearchTextOnMenuClose = true, menuBoxShadow = "rgb(var(--global-color-background-300), .5) 0px 2px 4px", menuBorderRadius = "5px", mobileDrawer = false, menuWidth = undefined, menuAnchor = 'bottom-center', class: clazz = {}, menuStayInViewport, menuFlipOnOverflow = true, selectionContainerSnippet, selectionSnippet, chipLabelSnippet, exceedCounterSnippet, menuSnippet, itemLabelSnippet, itemSnippet, onchange, onfocus, onblur, onkeydown, onclose, } = $props();
|
|
7
|
+
let { values = $bindable(), items = [], searchFunction = undefined, multiple = false, disabled = false, mandatory = false, placeholder = "", width = "auto", height = "auto", maxWidth = undefined, minWidth = "200px", openingId = $bindable("autocomplete-menu"), searchText = $bindable(), maxVisibleChips = undefined, menuOpened = $bindable(false), closeOnSelect = !multiple, emptySearchTextOnMenuClose = true, menuBoxShadow = "rgb(var(--global-color-background-300), .5) 0px 2px 4px", menuBorderRadius = "5px", mobileDrawer = false, menuWidth = undefined, menuAnchor = 'bottom-center', class: clazz = {}, menuStayInViewport, menuFlipOnOverflow = true, adaptInputWidth = true, selectionContainerSnippet, selectionSnippet, chipLabelSnippet, exceedCounterSnippet, menuSnippet, itemLabelSnippet, itemSnippet, onchange, onfocus, onblur, onkeydown, onclose, } = $props();
|
|
8
8
|
let notVisibleChipNumber = $derived(Math.max(((values || []).length || 0) - (maxVisibleChips || 0), 0));
|
|
9
9
|
function select(item) {
|
|
10
10
|
if (disabled)
|
|
@@ -182,7 +182,7 @@ $effect(() => {
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
$effect(() => {
|
|
185
|
-
if (!!input) {
|
|
185
|
+
if (!!input && adaptInputWidth) {
|
|
186
186
|
if ((values || []).length !== 0) {
|
|
187
187
|
input.style.width =
|
|
188
188
|
Math.max(searchText?.length || placeholder?.length, 1) + "ch";
|
|
@@ -483,6 +483,10 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
|
|
|
483
483
|
--autocomplete-input-margin-left,
|
|
484
484
|
var(--autocomplete-default-input-margin-left)
|
|
485
485
|
);
|
|
486
|
+
width: var(
|
|
487
|
+
--autocomplete-input-width,
|
|
488
|
+
var(--autocomplete-default-input-width)
|
|
489
|
+
);
|
|
486
490
|
outline: none;
|
|
487
491
|
border: none;
|
|
488
492
|
color: inherit;
|
|
@@ -35,6 +35,7 @@ declare class __sveltets_Render<Data> {
|
|
|
35
35
|
menuAnchor?: ComponentProps<typeof Menu>["anchor"];
|
|
36
36
|
menuStayInViewport?: ComponentProps<typeof Menu>["stayInViewport"];
|
|
37
37
|
menuFlipOnOverflow?: ComponentProps<typeof Menu>["flipOnOverflow"];
|
|
38
|
+
adaptInputWidth?: boolean;
|
|
38
39
|
class?: {
|
|
39
40
|
activator?: string;
|
|
40
41
|
menu?: string;
|