@neovici/cosmoz-autocomplete 13.5.1 → 13.6.0-beta.1

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.
@@ -3,15 +3,16 @@ import '@neovici/cosmoz-input';
3
3
  import { ItemRenderer } from '../listbox/item-renderer';
4
4
  import { ChipRenderer } from './selection';
5
5
  import './skeleton-span';
6
- import style from './styles.css';
6
+ import style from './style.css';
7
7
  import { Props as Base, RProps } from './use-autocomplete';
8
8
  export interface Props<I> extends Base<I> {
9
+ mode?: 'select';
10
+ variant?: 'default' | 'cell' | 'inline';
9
11
  invalid?: boolean;
10
12
  errorMessage?: string;
13
+ hint?: string;
11
14
  label?: string;
12
15
  placeholder?: string;
13
- noLabelFloat?: boolean;
14
- alwaysFloatLabel?: boolean;
15
16
  showSingle?: boolean;
16
17
  itemHeight?: number | 'auto';
17
18
  itemLimit?: number;
@@ -24,5 +25,5 @@ export interface Props<I> extends Base<I> {
24
25
  type AProps<I> = Omit<Props<I>, keyof RProps<I>> & RProps<I> & {
25
26
  onInputRef?: (el?: Element) => void;
26
27
  };
27
- declare const autocomplete: <I>(props: AProps<I>) => import("lit-html").TemplateResult<1>, Autocomplete: <I>(props: Props<I>) => import("lit-html").TemplateResult<1>, observedAttributes: readonly ["disabled", "invalid", "no-label-float", "always-float-label", "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"];
28
+ 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", "hint", "error-message", "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"];
28
29
  export { Autocomplete, autocomplete, observedAttributes, style };
@@ -1,15 +1,17 @@
1
1
  import '@neovici/cosmoz-dropdown/cosmoz-dropdown-next';
2
+ import { chevronDownIcon } from '@neovici/cosmoz-icons/untitled';
2
3
  import '@neovici/cosmoz-input';
3
4
  import { t } from 'i18next';
4
5
  import { html } from 'lit-html';
5
6
  import { guard } from 'lit-html/directives/guard.js';
7
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
6
8
  import { live } from 'lit-html/directives/live.js';
7
9
  import { until } from 'lit-html/directives/until.js';
8
10
  import { when } from 'lit-html/directives/when.js';
9
11
  import { listbox } from '../listbox';
10
12
  import { selection } from './selection';
11
13
  import './skeleton-span';
12
- import style from './styles.css';
14
+ import style from './style.css';
13
15
  import { useAutocomplete } from './use-autocomplete';
14
16
  import { useOverflow } from './use-overflow';
15
17
  const inputParts = ['input', 'control', 'label', 'line', 'error', 'wrap']
@@ -23,7 +25,7 @@ const shouldShowDropdown = ({ opened, isSingle, showSingle, hasResultsOrQuery, }
23
25
  return hasResultsOrQuery;
24
26
  };
25
27
  const autocomplete = (props) => {
26
- const { opened, invalid, errorMessage, label, placeholder, disabled, noLabelFloat, alwaysFloatLabel, textual, text, onText, onToggle, onDeselect, value, limit, min, showSingle, items, source$, loading, chipRenderer, } = props, isOne = limit === 1, isSingle = isOne && value?.[0] != null;
28
+ const { variant, opened, invalid, errorMessage, hint, label, placeholder, disabled, textual, text, onText, onToggle, onDeselect, value, limit, min, showSingle, items, source$, loading, chipRenderer, mode, } = props, isOne = limit === 1, isSingle = isOne && value?.[0] != null;
27
29
  const hasResultsOrQuery = loading || items.length > 0 || (text != null && text.length > 0);
28
30
  return html `<cosmoz-dropdown-next
29
31
  open-on-focus
@@ -38,8 +40,8 @@ const autocomplete = (props) => {
38
40
  part="input"
39
41
  .label=${label}
40
42
  .placeholder=${isSingle ? undefined : placeholder}
41
- ?no-label-float=${noLabelFloat}
42
- ?always-float-label=${value?.length > 0 || alwaysFloatLabel}
43
+ hint=${ifDefined(hint)}
44
+ variant=${ifDefined(variant)}
43
45
  ?readonly=${isSingle}
44
46
  ?disabled=${disabled}
45
47
  ?invalid=${guard([source$, invalid], () => until(source$.then(() => invalid, () => true), invalid))}
@@ -52,7 +54,13 @@ const autocomplete = (props) => {
52
54
  ?data-single=${isSingle}
53
55
  >
54
56
  <slot name="prefix" slot="prefix"></slot>
55
- <slot name="suffix" slot="suffix"></slot>
57
+ <slot name="suffix" slot="suffix">
58
+ ${when(mode === 'select', () => chevronDownIcon({
59
+ styles: 'margin-right: calc(var(--cz-spacing) * 2);color: var(--cz-color-text-secondary);',
60
+ width: '16',
61
+ height: '16',
62
+ }))}
63
+ </slot>
56
64
  ${selection({
57
65
  value,
58
66
  min,
@@ -74,7 +82,7 @@ const autocomplete = (props) => {
74
82
  items,
75
83
  multi: !isOne,
76
84
  }, when(loading, () => html `<cosmoz-autocomplete-skeleton-span></cosmoz-autocomplete-skeleton-span>`, () => when(text != null && text.length > 0 && items.length === 0, () => html `<slot name="no-result">
77
- <p class="no-result">${t('No results found')}</p>
85
+ <span class="no-result">${t('No results found')}</span>
78
86
  </slot>`))))}
79
87
  </cosmoz-dropdown-next>`;
80
88
  }, Autocomplete = (props) => {
@@ -85,10 +93,11 @@ const autocomplete = (props) => {
85
93
  useOverflow(thru);
86
94
  return autocomplete(thru);
87
95
  }, observedAttributes = [
96
+ 'variant',
88
97
  'disabled',
89
98
  'invalid',
90
- 'no-label-float',
91
- 'always-float-label',
99
+ 'hint',
100
+ 'error-message',
92
101
  'text-property',
93
102
  'value-property',
94
103
  'limit',
@@ -103,5 +112,6 @@ const autocomplete = (props) => {
103
112
  'item-limit',
104
113
  'wrap',
105
114
  'lazy-open',
115
+ 'mode',
106
116
  ];
107
117
  export { Autocomplete, autocomplete, observedAttributes, style };
@@ -1,8 +1,8 @@
1
+ import '@neovici/cosmoz-tag';
1
2
  interface Props {
2
3
  onClear?: false | (() => void);
3
4
  disabled?: boolean;
4
5
  }
5
- export declare const Chip: ({ onClear, disabled }: Props) => import("lit-html").TemplateResult<1>;
6
6
  export interface ChipProps<I> extends Props {
7
7
  item: I | null;
8
8
  slot?: string;
@@ -10,5 +10,5 @@ export interface ChipProps<I> extends Props {
10
10
  content: unknown;
11
11
  hidden?: boolean;
12
12
  }
13
- export declare const chip: <I>({ content, onClear, disabled, hidden, className, slot, }: ChipProps<I>) => import("lit-html").TemplateResult<1>;
13
+ export declare const chip: <I>({ content, onClear, disabled, className, hidden, slot, }: ChipProps<I>) => import("lit-html").TemplateResult<1>;
14
14
  export {};
@@ -1,61 +1,14 @@
1
- import { sheet } from '@neovici/cosmoz-utils';
2
- import { component, html } from '@pionjs/pion';
1
+ import '@neovici/cosmoz-tag';
2
+ import { html } from '@pionjs/pion';
3
3
  import { ifDefined } from 'lit-html/directives/if-defined.js';
4
- import { when } from 'lit-html/directives/when.js';
5
- import styles from './chip.css';
6
- const clear = html `
7
- <svg
8
- width="9"
9
- height="8"
10
- viewBox="0 0 9 8"
11
- fill="none"
12
- xmlns="http://www.w3.org/2000/svg"
13
- >
14
- <line
15
- x1="7.53033"
16
- y1="0.994808"
17
- x2="1.16637"
18
- y2="7.35877"
19
- stroke-width="1.5"
20
- />
21
- <line
22
- x1="7.46967"
23
- y1="7.35882"
24
- x2="1.10571"
25
- y2="0.99486"
26
- stroke-width="1.5"
27
- />
28
- </svg>
29
- `;
30
- export const Chip = ({ onClear, disabled }) => html `
31
- <div
32
- class="content"
33
- part="content chip-text"
34
- @mousedown=${(ev) => ev.preventDefault()}
35
- >
36
- <slot></slot>
37
- </div>
38
- ${when(onClear && !disabled, () => html `<span
39
- class="clear"
40
- part="clear chip-clear"
41
- @mousedown=${(ev) => ev.preventDefault()}
42
- @click=${onClear}
43
- >
44
- ${clear}
45
- </span>`)}
46
- `;
47
- customElements.define('cosmoz-autocomplete-chip', component(Chip, {
48
- observedAttributes: ['disabled'],
49
- styleSheets: [sheet(styles)],
50
- }));
51
- export const chip = ({ content, onClear, disabled, hidden, className = 'chip', slot, }) => html `<cosmoz-autocomplete-chip
4
+ export const chip = ({ content, onClear, disabled, className = 'chip', hidden, slot, }) => html `<cosmoz-tag
52
5
  class=${ifDefined(className)}
53
6
  slot=${ifDefined(slot)}
54
- part="chip"
55
7
  exportparts="chip-text, chip-clear"
56
8
  ?disabled=${disabled}
57
9
  ?hidden=${hidden}
58
- .onClear=${onClear}
10
+ ?removable=${!!onClear && !disabled}
11
+ @remove=${onClear}
59
12
  title=${ifDefined(typeof content === 'string' ? content : undefined)}
60
- >${content}</cosmoz-autocomplete-chip
13
+ >${content}</cosmoz-tag
61
14
  >`;
@@ -2,7 +2,8 @@ import { sheet } from '@neovici/cosmoz-utils';
2
2
  import { component, useCallback, useEffect, useProperty } from '@pionjs/pion';
3
3
  import { Autocomplete, observedAttributes, style } from './autocomplete';
4
4
  const Standalone = (host) => {
5
- const { onChange, onText, ...props } = host;
5
+ const { onChange, onText, mode, ...props } = host;
6
+ const isSelect = mode === 'select';
6
7
  const [value, setValue] = useProperty('value');
7
8
  useEffect(() => {
8
9
  if (host.onChange == null)
@@ -12,6 +13,12 @@ const Standalone = (host) => {
12
13
  }, []);
13
14
  return Autocomplete({
14
15
  ...props,
16
+ ...(isSelect && {
17
+ limit: 1,
18
+ min: 1,
19
+ showSingle: true,
20
+ }),
21
+ mode,
15
22
  value,
16
23
  onChange: useCallback((value, ...args) => {
17
24
  setValue(value);
@@ -0,0 +1,91 @@
1
+ import { tagged as css } from '@neovici/cosmoz-utils';
2
+ export default css `
3
+ :host {
4
+ display: block;
5
+ position: relative;
6
+ min-width: calc(var(--cz-spacing) * 9);
7
+ }
8
+
9
+ :host([mode='select']) {
10
+ --cosmoz-badge-border-color: transparent;
11
+ --cosmoz-badge-bg-color: transparent;
12
+ }
13
+
14
+ cosmoz-dropdown-next {
15
+ display: block;
16
+ }
17
+
18
+ :host(:not([variant='inline'])) cosmoz-listbox {
19
+ margin-top: var(--cz-spacing);
20
+ }
21
+
22
+ :host([error-message]) cosmoz-listbox,
23
+ :host([hint]) cosmoz-listbox {
24
+ margin-top: calc((var(--cz-spacing) * -5));
25
+ }
26
+
27
+ cosmoz-tag {
28
+ align-items: center;
29
+ margin-left: calc(var(--cz-spacing) * 2);
30
+ }
31
+
32
+ cosmoz-input::part(control) {
33
+ display: flex;
34
+ min-width: calc(var(--cz-spacing) * 9);
35
+ }
36
+
37
+ cosmoz-input[variant='inline']:has(cosmoz-tag[removable])::part(label),
38
+ cosmoz-input[variant='inline'][disabled]:has(cosmoz-tag)::part(label) {
39
+ transform: translate(var(--cz-spacing), -75%) scale(0.85);
40
+ }
41
+
42
+ cosmoz-input::part(input) {
43
+ flex: 1 calc(var(--cz-spacing) * 6);
44
+ min-width: 0;
45
+ }
46
+
47
+ cosmoz-input:not([data-one])::part(input):focus {
48
+ flex: 4 0.00001 calc(var(--cz-spacing) * 12.5);
49
+ min-width: calc(var(--cz-spacing) * 5);
50
+ }
51
+
52
+ .badge {
53
+ min-width: initial;
54
+ flex: none;
55
+ text-align: center;
56
+ padding: 0 var(--cz-spacing);
57
+ }
58
+
59
+ [data-single]::part(input) {
60
+ flex: 0;
61
+ }
62
+
63
+ [data-one] .badge {
64
+ display: none;
65
+ }
66
+
67
+ [hidden] {
68
+ display: none;
69
+ }
70
+
71
+ :host([wrap]) cosmoz-input::part(control) {
72
+ flex-wrap: wrap;
73
+ padding-right: calc(var(--cz-spacing) * 2);
74
+ }
75
+
76
+ :host([wrap]) cosmoz-tag {
77
+ padding-block: calc(var(--cz-spacing) * 1.5);
78
+ }
79
+
80
+ slot {
81
+ display: contents !important;
82
+ }
83
+
84
+ .no-result {
85
+ font-size: var(--cz-text-sm);
86
+ line-height: var(--cz-text-sm-line-height);
87
+ font-weight: var(--cz-font-weight-regular);
88
+ padding: 0 calc(var(--cz-spacing) * 3);
89
+ color: var(--cz-color-text-secondary);
90
+ }
91
+ `;
@@ -5,6 +5,8 @@ import { raf } from './util';
5
5
  const overflow = (host) => {
6
6
  const chips = host.shadowRoot.querySelectorAll('.chip');
7
7
  const badge = host.shadowRoot.querySelector('.badge');
8
+ if (!badge)
9
+ return;
8
10
  badge.hidden = true;
9
11
  for (const chip of chips) {
10
12
  chip.hidden = false;
@@ -1 +1,2 @@
1
+ import '@neovici/cosmoz-tag';
1
2
  import '../autocomplete';
@@ -1,5 +1,5 @@
1
+ import '@neovici/cosmoz-tag';
1
2
  import { component, html, useCallback, useMemo, useProperty, } from '@pionjs/pion';
2
- import { nothing } from 'lit-html';
3
3
  import { ifDefined } from 'lit-html/directives/if-defined.js';
4
4
  import '../autocomplete';
5
5
  import { Autocomplete, observedAttributes, style, } from '../autocomplete/autocomplete';
@@ -7,7 +7,7 @@ import excludingStyle from './style.css';
7
7
  import { useExcludingSelection } from './use-excluding-selection';
8
8
  import { unwrap } from './utils';
9
9
  const isItemExcluded = (value, item) => value?.some((v) => v.item === item && v.excluded);
10
- const excludedState = (value, item) => (item && isItemExcluded(value, item) ? 'excluded' : nothing);
10
+ const excludedState = (value, item) => (item && isItemExcluded(value, item) ? 'error' : 'gray');
11
11
  const mkItemRenderer = (value) => (item, i, { highlight, select, textual, isSelected }) => {
12
12
  const rendered = textual(item);
13
13
  return html `<div
@@ -24,19 +24,19 @@ const mkItemRenderer = (value) => (item, i, { highlight, select, textual, isSele
24
24
  </div>
25
25
  <div class="sizer" virtualizer-sizer>${rendered}</div>`;
26
26
  };
27
- const mkChipRenderer = (value, onClear) => ({ item, content, disabled, hidden, className = 'chip', slot, }) => html `<cosmoz-autocomplete-chip
27
+ const mkChipRenderer = (value, onClear) => ({ item, content, disabled, hidden, className = 'chip', slot, }) => html `<cosmoz-tag
28
28
  class=${ifDefined(className)}
29
29
  slot=${ifDefined(slot)}
30
- part="chip"
31
30
  exportparts="chip-text, chip-clear"
32
- data-state=${excludedState(value, item)}
31
+ color=${excludedState(value, item)}
33
32
  ?disabled=${disabled}
34
33
  ?hidden=${hidden}
35
- .onClear=${() => onClear(item)}
34
+ ?removable=${!!item}
35
+ @remove=${() => onClear(item)}
36
36
  title=${ifDefined(typeof content === 'string' ? content : undefined)}
37
37
  >
38
38
  ${content}
39
- </cosmoz-autocomplete-chip>`;
39
+ </cosmoz-tag>`;
40
40
  const AutocompleteExcluding = (props) => {
41
41
  const { value, setValue, setExcludingValue } = useExcludingSelection('value');
42
42
  const [text, setText] = useProperty('text');
@@ -5,39 +5,14 @@ const clearSVG =
5
5
  "d='M2.5 2.5L8.5 8.5M8.5 2.5L2.5 8.5' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E";
6
6
  /* eslint-enable quotes */
7
7
  const excludingStyle = css `
8
- .chip[data-state='excluded'] {
9
- background: var(--cosmoz-autocomplete-excluded-bg-color, rgb(244, 67, 54));
10
- }
11
-
12
- cosmoz-autocomplete-chip[data-state='excluded']::part(content) {
13
- color: var(--cosmoz-autocomplete-excluded-chip-color, #fff);
14
- }
15
-
16
- cosmoz-autocomplete-chip[data-state='excluded']::part(clear) {
17
- background-color: var(
18
- --cosmoz-autocomplete-excluded-chip-clear-bg-color,
19
- #fff
20
- );
21
- stroke: var(
22
- --cosmoz-autocomplete-excluded-chip-clear-stroke,
23
- var(--cosmoz-autocomplete-excluded-bg-color, rgb(244, 67, 54))
24
- );
25
- }
26
-
27
- cosmoz-listbox::part(excluded)::before {
28
- border-color: var(
29
- --cosmoz-autocomplete-excluded-bg-color,
30
- rgb(244, 67, 54)
31
- );
8
+ cosmoz-listbox::part(error)::before {
9
+ border-color: var(--cz-color-border-error);
32
10
  /* prettier-ignore */
33
- background: url("${clearSVG}") var(--cosmoz-autocomplete-excluded-bg-color, rgb(244, 67, 54)) no-repeat 50%;
11
+ background: url("${clearSVG}") var(--cz-color-border-error) no-repeat 50%;
34
12
  }
35
13
 
36
- cosmoz-listbox::part(excluded):hover {
37
- background: var(
38
- --cosmoz-listbox-excluded-active-color,
39
- rgba(244, 67, 54, 0.1)
40
- );
14
+ cosmoz-listbox::part(error):hover {
15
+ background: var(--cz-color-bg-error);
41
16
  }
42
17
  `;
43
18
  export default excludingStyle;
@@ -8,38 +8,45 @@ const checkSVG =
8
8
  const style = css `
9
9
  :host {
10
10
  display: block;
11
- font-family: var(--paper-font-subhead_-_font-family, inherit);
12
- background: var(
13
- --cosmoz-autocomplete-listbox-bg,
14
- rgba(255, 255, 255, 0.75)
15
- );
11
+ font-family: var(--cz-font-body);
12
+ background: var(--cz-color-bg-primary);
16
13
  backdrop-filter: blur(16px) saturate(180%);
17
14
  -webkit-backdrop-filter: blur(16px) saturate(180%);
18
- border-radius: 6px;
19
- box-shadow:
20
- 0 4px 24px 0 rgba(0, 0, 0, 0.18),
21
- 0 1.5px 6px 0 rgba(0, 0, 0, 0.1);
22
- border: 1px solid rgba(200, 200, 200, 0.25);
15
+ border-radius: var(--cz-radius-md);
16
+ box-shadow: 0 0 0 1px var(--cz-color-border-primary);
23
17
  text-transform: var(--cosmoz-autocomplete-listbox-text-transform, initial);
24
18
  overflow: hidden;
19
+ padding-block: var(--cz-spacing);
25
20
  }
26
21
  .items {
27
22
  position: relative;
28
23
  overflow-y: auto;
24
+ scrollbar-width: thin;
29
25
  contain: layout paint !important;
26
+ padding-inline: calc(var(--cz-spacing) * 1.5);
27
+ }
28
+ :host(:focus-within) {
29
+ outline: none;
30
+ box-shadow: var(--cz-focus-ring);
31
+ }
32
+ .items:focus-visible {
33
+ outline: none;
30
34
  }
31
35
  .item {
32
- font-size: var(--cosmoz-autocomplete-listbox-font-size, 13px);
33
- font-weight: var(--cosmoz-autocomplete-listbox-font-weight, 400);
34
- padding: 0 22px;
36
+ font-size: var(--cz-text-sm);
37
+ line-height: var(--cz-text-sm-line-height);
38
+ font-weight: var(--cz-font-weight-regular);
35
39
  box-sizing: border-box;
36
- width: 100%;
40
+ border-radius: var(--cz-radius-sm);
41
+ width: calc(100% - var(--cz-spacing) * 3);
37
42
  cursor: pointer;
38
43
  text-overflow: ellipsis;
39
44
  white-space: nowrap;
40
- transition: background 0.2s;
41
- color: var(--cosmoz-listbox-color, #101010);
45
+ transition: background 0.25s;
46
+ color: var(--cz-color-text-primary);
42
47
  overflow: hidden;
48
+ padding-inline: calc(var(--cz-spacing) * 2);
49
+ margin-block: 1px;
43
50
  }
44
51
 
45
52
  .sizer {
@@ -50,39 +57,34 @@ const style = css `
50
57
  z-index: -1;
51
58
  height: 0;
52
59
  width: auto;
53
- padding: 0 20px;
60
+ padding: 0 calc(var(--cz-spacing) * 5);
54
61
  overflow: hidden;
55
62
  max-width: inherit;
56
- font-size: 14px;
63
+ font-size: var(--cz-text-sm);
64
+ line-height: var(--cz-text-sm-line-height);
57
65
  }
58
66
 
59
67
  :host(:not([multi])) .item[aria-selected] {
60
- background: var(--cosmoz-listbox-single-selection-color, #dadada);
61
- }
62
-
63
- :host([multi]) .item {
64
- padding-left: 0;
68
+ background: rgb(
69
+ from var(--cz-color-bg-brand-solid) r g b / calc(alpha * 0.25)
70
+ );
65
71
  }
66
72
 
67
73
  :host([multi]) .item::before {
68
74
  content: '';
69
75
  font-size: 0;
70
- padding: 7.5px;
71
- margin: 0 8px;
72
- background: #fff;
73
- border: 1px solid #d6d6d5;
74
- border-radius: 4px;
76
+ padding: calc(var(--cz-spacing) * 2);
77
+ margin-right: calc(var(--cz-spacing) * 2);
78
+ background: var(--cz-color-bg-tertiary);
79
+ border: 1px solid var(--cz-color-bg-quaternary);
80
+ border-radius: var(--cz-radius-xs);
75
81
  vertical-align: top;
76
82
  }
77
83
 
78
84
  :host([multi]) .item[aria-selected]::before {
79
- border-color: #5881f6;
85
+ border-color: var(--cz-color-bg-brand-solid);
80
86
  /* prettier-ignore */
81
- background: url("${checkSVG}") #5881f6 no-repeat 50%;
82
- }
83
-
84
- :host([multi]) .sizer {
85
- padding-left: 33px;
87
+ background: url("${checkSVG}") var(--cz-color-bg-brand-solid) no-repeat 50%;
86
88
  }
87
89
 
88
90
  [virtualizer-sizer]:not(.sizer) {
@@ -97,11 +99,12 @@ export const styles = ({ index, itemHeight, auto, }) => css `
97
99
  height: ${itemHeight}px;
98
100
  }
99
101
  `)}
100
-
101
102
  .item[data-index='${index || '0'}'] {
102
- background: var(
103
- --cosmoz-listbox-active-color,
104
- var(--cosmoz-selection-color, rgba(58, 145, 226, 0.1))
103
+ background: rgb(
104
+ from var(--cz-color-bg-brand-solid) r g b / calc(alpha * 0.15)
105
105
  );
106
106
  }
107
+ .item[data-index='${index || '0'}'][part~='error'] {
108
+ background: var(--cz-color-bg-error);
109
+ }
107
110
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-autocomplete",
3
- "version": "13.5.1",
3
+ "version": "13.6.0-beta.1",
4
4
  "type": "module",
5
5
  "description": "A autocomplete input web component",
6
6
  "keywords": [
@@ -48,7 +48,6 @@
48
48
  "@semantic-release/npm",
49
49
  "@semantic-release/git"
50
50
  ],
51
- "branch": "master",
52
51
  "preset": "conventionalcommits"
53
52
  },
54
53
  "publishConfig": {
@@ -79,8 +78,11 @@
79
78
  },
80
79
  "dependencies": {
81
80
  "@lit-labs/virtualizer": "^2.0.0",
82
- "@neovici/cosmoz-dropdown": "^7.5.0",
83
- "@neovici/cosmoz-input": "^5.6.0",
81
+ "@neovici/cosmoz-dropdown": "^7.6.0",
82
+ "@neovici/cosmoz-icons": "^1.6.0",
83
+ "@neovici/cosmoz-input": "^6.0.0-beta.1",
84
+ "@neovici/cosmoz-tag": "^1.3.0",
85
+ "@neovici/cosmoz-tokens": "^3.4.0",
84
86
  "@neovici/cosmoz-utils": "^6.20.0",
85
87
  "@pionjs/pion": "^2.7.1",
86
88
  "i18next": "^23.16.8",
@@ -93,6 +95,7 @@
93
95
  "@playwright/test": "^1.43.1",
94
96
  "@semantic-release/changelog": "^6.0.0",
95
97
  "@semantic-release/git": "^10.0.0",
98
+ "@storybook/addon-a11y": "^10.3.4",
96
99
  "@storybook/addon-docs": "^10.0.0",
97
100
  "@storybook/addon-vitest": "^10.0.0",
98
101
  "@storybook/web-components-vite": "^10.0.0",
@@ -1,57 +0,0 @@
1
- import { tagged as css } from '@neovici/cosmoz-utils';
2
- export default css `
3
- :host {
4
- border-radius: var(--cosmoz-autocomplete-chip-border-radius, 500px);
5
- background: var(--cosmoz-autocomplete-chip-bg-color, #cbcfdb);
6
- margin-bottom: 2px;
7
- display: flex;
8
- align-items: center;
9
- flex: 0.0001 1 fit-content;
10
- max-width: 18ch;
11
- min-width: 40px;
12
- padding-inline: 8px;
13
- gap: 4px;
14
- cursor: pointer;
15
- transform: translateY(var(--cosmoz-autocomplete-chip-translate-y, 0));
16
- }
17
-
18
- .content {
19
- color: var(--cosmoz-autocomplete-chip-color, #424242);
20
- font-family: var(
21
- --cosmoz-autocomplete-chip-text-font-family,
22
- 'Inter',
23
- sans-serif
24
- );
25
- font-size: var(--cosmoz-autocomplete-chip-text-font-size, 12px);
26
- font-weight: var(--cosmoz-autocomplete-chip-text-font-weight, 400);
27
- line-height: var(--cosmoz-autocomplete-chip-text-line-height, 22px);
28
- overflow: hidden;
29
- text-overflow: ellipsis;
30
- white-space: nowrap;
31
- flex: auto;
32
- min-width: 16px;
33
- }
34
-
35
- .clear {
36
- background-color: var(--cosmoz-autocomplete-chip-clear-bg-color, #81899b);
37
- border-radius: 50%;
38
- cursor: pointer;
39
- width: 16px;
40
- height: 16px;
41
- margin-right: -4px;
42
- stroke: var(
43
- --cosmoz-autocomplete-chip-clear-stroke,
44
- var(--cosmoz-autocomplete-chip-bg-color, #cbcfdb)
45
- );
46
- display: var(--cosmoz-autocomplete-chip-clear-display, block);
47
- flex: none;
48
- }
49
-
50
- .clear:hover {
51
- filter: brightness(90%);
52
- }
53
- .clear svg {
54
- display: block;
55
- transform: translate(3.5px, 3.5px);
56
- }
57
- `;
@@ -1,2 +0,0 @@
1
- declare const _default: string;
2
- export default _default;
@@ -1,66 +0,0 @@
1
- import { tagged as css } from '@neovici/cosmoz-utils';
2
- export default css `
3
- :host {
4
- display: block;
5
- position: relative;
6
- min-width: 35px;
7
- }
8
-
9
- cosmoz-dropdown-next {
10
- display: block;
11
- }
12
-
13
- cosmoz-input::part(control) {
14
- display: flex;
15
- gap: 4px;
16
- min-width: 35px;
17
- }
18
- cosmoz-input::part(input) {
19
- flex: 1 24px;
20
- min-width: 0;
21
- }
22
- cosmoz-input:not([data-one])::part(input):focus {
23
- flex: 4 0.00001 50px;
24
- min-width: 20px;
25
- }
26
- .badge {
27
- min-width: initial;
28
- flex: none;
29
- text-align: center;
30
- padding: 0 4px;
31
- }
32
-
33
- [data-single]::part(input) {
34
- flex: 0;
35
- }
36
- [data-one] .chip {
37
- max-width: initial;
38
- flex: 1;
39
- }
40
-
41
- [data-one] .badge {
42
- display: none;
43
- }
44
-
45
- [hidden] {
46
- display: none;
47
- }
48
-
49
- :host([wrap]) cosmoz-input::part(control) {
50
- flex-wrap: wrap;
51
- }
52
- :host([wrap]) .chip {
53
- max-width: 100%;
54
- }
55
-
56
- slot {
57
- display: contents !important;
58
- }
59
-
60
- .no-result {
61
- font-size: var(--cosmoz-autocomplete-listbox-font-size, 13px);
62
- font-weight: var(--cosmoz-autocomplete-listbox-font-weight, 400);
63
- padding: 0 22px;
64
- color: var(--cosmoz-listbox-color, #101010);
65
- }
66
- `;