@neovici/cosmoz-autocomplete 3.0.1 → 3.0.2

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.
@@ -41,7 +41,11 @@ export default css`
41
41
  display: flex;
42
42
  flex-direction: row;
43
43
  align-items: center;
44
-
44
+ flex: 0.00001 1 min-content;
45
+ max-width: 285px;
46
+ max-width: 28ch;
47
+ }
48
+ .chip[data-one] {
45
49
  position: absolute;
46
50
  left: 0;
47
51
  top: 1px;
@@ -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.1",
3
+ "version": "3.0.2",
4
4
  "description": "A autocomplete input web component",
5
5
  "keywords": [
6
6
  "lit-html",