@neovici/cosmoz-autocomplete 14.0.1 → 14.1.0
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.
|
@@ -13,6 +13,7 @@ export interface Props<I> extends Base<I> {
|
|
|
13
13
|
hint?: string;
|
|
14
14
|
label?: string;
|
|
15
15
|
placeholder?: string;
|
|
16
|
+
compact?: boolean;
|
|
16
17
|
required?: boolean;
|
|
17
18
|
showSingle?: boolean;
|
|
18
19
|
itemHeight?: number | 'auto';
|
|
@@ -26,5 +27,5 @@ export interface Props<I> extends Base<I> {
|
|
|
26
27
|
type AProps<I> = Omit<Props<I>, keyof RProps<I>> & RProps<I> & {
|
|
27
28
|
onInputRef?: (el?: Element) => void;
|
|
28
29
|
};
|
|
29
|
-
declare const autocomplete: <I>(props: AProps<I>) => import("lit-html").TemplateResult<1>, Autocomplete: <I>(props: Props<I>) => import("lit-html").TemplateResult<1>, observedAttributes: readonly ["variant", "disabled", "invalid", "required", "hint", "text-property", "value-property", "limit", "min", "show-single", "preserve-order", "keep-opened", "keep-query", "default-index", "external-search", "item-height", "item-limit", "wrap", "lazy-open", "mode"];
|
|
30
|
+
declare const autocomplete: <I>(props: AProps<I>) => import("lit-html").TemplateResult<1>, Autocomplete: <I>(props: Props<I>) => import("lit-html").TemplateResult<1>, observedAttributes: readonly ["variant", "disabled", "invalid", "required", "compact", "hint", "text-property", "value-property", "limit", "min", "show-single", "preserve-order", "keep-opened", "keep-query", "default-index", "external-search", "item-height", "item-limit", "wrap", "lazy-open", "mode"];
|
|
30
31
|
export { Autocomplete, autocomplete, observedAttributes, style };
|
|
@@ -25,7 +25,7 @@ const shouldShowDropdown = ({ opened, isSingle, showSingle, hasResultsOrQuery, }
|
|
|
25
25
|
return hasResultsOrQuery;
|
|
26
26
|
};
|
|
27
27
|
const autocomplete = (props) => {
|
|
28
|
-
const { variant, opened, invalid, errorMessage, hint, label, placeholder, required, disabled, textual, text, onText, onToggle, onDeselect, value, limit, min, showSingle, items, source$, loading, chipRenderer, mode, } = props, isOne = limit === 1, isSingle = isOne && value?.[0] != null;
|
|
28
|
+
const { variant, opened, invalid, errorMessage, hint, label, placeholder, compact, required, disabled, textual, text, onText, onToggle, onDeselect, value, limit, min, showSingle, items, source$, loading, chipRenderer, mode, } = props, isOne = limit === 1, isSingle = isOne && value?.[0] != null;
|
|
29
29
|
const hasResultsOrQuery = loading || items.length > 0 || (text != null && text.length > 0);
|
|
30
30
|
return html `<cosmoz-dropdown-next
|
|
31
31
|
open-on-focus
|
|
@@ -42,6 +42,7 @@ const autocomplete = (props) => {
|
|
|
42
42
|
.placeholder=${isSingle ? undefined : placeholder}
|
|
43
43
|
hint=${ifDefined(hint)}
|
|
44
44
|
variant=${ifDefined(variant)}
|
|
45
|
+
?compact=${compact}
|
|
45
46
|
?readonly=${isSingle}
|
|
46
47
|
?disabled=${disabled}
|
|
47
48
|
?required=${required}
|
|
@@ -98,6 +99,7 @@ const autocomplete = (props) => {
|
|
|
98
99
|
'disabled',
|
|
99
100
|
'invalid',
|
|
100
101
|
'required',
|
|
102
|
+
'compact',
|
|
101
103
|
'hint',
|
|
102
104
|
'text-property',
|
|
103
105
|
'value-property',
|
|
@@ -50,6 +50,10 @@ export default css `
|
|
|
50
50
|
min-width: 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
cosmoz-input[data-one] cosmoz-tag {
|
|
54
|
+
max-width: calc(100% - 16px);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
cosmoz-input:not([data-one])::part(input):focus {
|
|
54
58
|
flex: 4 0.00001 calc(var(--cz-spacing) * 12.5);
|
|
55
59
|
min-width: calc(var(--cz-spacing) * 5);
|