@neovici/cosmoz-autocomplete 3.0.0 → 3.0.3

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/cosmoz-listbox.js CHANGED
@@ -59,9 +59,10 @@ const Listbox = host => {
59
59
  z-index: -1;
60
60
  height: 0;
61
61
  width: auto;
62
- padding: 0 16px;
62
+ padding: 0 20px;
63
63
  overflow: hidden;
64
64
  max-width: inherit;
65
+ font-size: 14px;
65
66
  }
66
67
  .items > :first-child { line-height: 1;}
67
68
  ${ host.styles || '' }
@@ -21,6 +21,10 @@ export const listboxStyle = css`
21
21
  border-color: #5881f6;
22
22
  background: url("${ svg }") #5881f6 no-repeat 50%;
23
23
  }
24
+
25
+ .sizer {
26
+ padding-left: 33px;
27
+ }
24
28
  `;
25
29
 
26
30
  export default css`
@@ -37,7 +41,11 @@ export default css`
37
41
  display: flex;
38
42
  flex-direction: row;
39
43
  align-items: center;
40
-
44
+ flex: 0.00001 1 min-content;
45
+ max-width: 285px;
46
+ max-width: 28ch;
47
+ }
48
+ .chip[data-one] {
41
49
  position: absolute;
42
50
  left: 0;
43
51
  top: 1px;
@@ -46,6 +54,7 @@ export default css`
46
54
  margin: 0;
47
55
  z-index: 2;
48
56
  pointer-events: auto;
57
+ max-width: initial;
49
58
  }
50
59
  .chip-text {
51
60
  color: var(--cosmoz-autocomplete-chip-color, #424242);
@@ -11,8 +11,8 @@ import style, { listboxStyle } from './autocomplete.css';
11
11
 
12
12
  const
13
13
  blank = () => nothing,
14
- renderChip = (text, onClear, disabled) => html`
15
- <div class="chip" part="chip" slot="suffix" title=${ text }>
14
+ renderChip = (text, onClear, disabled, isOne) => html`
15
+ <div class="chip" part="chip" slot="suffix" title=${ text } ?data-one=${isOne}>
16
16
  <span class="chip-text" part="chip-text">${ text }</span>
17
17
  ${ !disabled && html`
18
18
  <span class="chip-clear" part="chip-clear" @click=${ onClear }>
@@ -25,9 +25,9 @@ const
25
25
  `,
26
26
  renderBadge = len => len > 0 ? html`<div class="badge" slot="suffix" part="badge">${ len }</div>` : nothing,
27
27
  renderSelection = (value, isOne, onDeselect, textual, disabled) => {
28
- if (isOne) {
28
+ if (isOne || value.length === 1) {
29
29
  const val = value[0];
30
- return val ? renderChip(textual(val), () => onDeselect(val), disabled) : nothing;
30
+ return val ? renderChip(textual(val), () => onDeselect(val), disabled, isOne) : nothing;
31
31
  }
32
32
  return renderBadge(value.length);
33
33
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-autocomplete",
3
- "version": "3.0.0",
3
+ "version": "3.0.3",
4
4
  "description": "A autocomplete input web component",
5
5
  "keywords": [
6
6
  "lit-html",