@neovici/cosmoz-autocomplete 10.10.0 → 10.10.4

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.
@@ -30,7 +30,6 @@ export default css `
30
30
  white-space: nowrap;
31
31
  flex: auto;
32
32
  min-width: 16px;
33
- text-align: center;
34
33
  }
35
34
 
36
35
  .clear {
@@ -1,6 +1,6 @@
1
+ import { sheet } from '@neovici/cosmoz-utils';
1
2
  import { component, useCallback, useEffect, useProperty } from '@pionjs/pion';
2
3
  import { Autocomplete, observedAttributes, style } from './autocomplete';
3
- import { sheet } from '@neovici/cosmoz-utils';
4
4
  const Standalone = (host) => {
5
5
  const { onChange, onText, ...props } = host;
6
6
  const [value, setValue] = useProperty('value');
@@ -1,12 +1,12 @@
1
- import { useCallback, useMemo, useEffect, useState } from '@pionjs/pion';
2
- import { without, array } from '@neovici/cosmoz-utils/array';
3
- import { prop, strProp } from '@neovici/cosmoz-utils/object';
1
+ import { useFocus } from '@neovici/cosmoz-dropdown/use-focus';
2
+ import { array, without } from '@neovici/cosmoz-utils/array';
4
3
  import { useHost } from '@neovici/cosmoz-utils/hooks/use-host';
5
4
  import { useMeta } from '@neovici/cosmoz-utils/hooks/use-meta';
6
- import { useFocus } from '@neovici/cosmoz-dropdown/use-focus';
7
- import { useKeys } from './use-keys';
8
- import { search, normalize, notify, useNotify, EMPTY } from './util';
9
5
  import { usePromise } from '@neovici/cosmoz-utils/hooks/use-promise';
6
+ import { prop, strProp } from '@neovici/cosmoz-utils/object';
7
+ import { useCallback, useEffect, useMemo, useState } from '@pionjs/pion';
8
+ import { useKeys } from './use-keys';
9
+ import { EMPTY, normalize, notify, search, useNotify } from './util';
10
10
  export const useAutocomplete = ({ value: _value, text, onChange: _onChange, onText: _onText, onSelect, limit, min, source, textProperty, textual: _textual, valueProperty, keepOpened, keepQuery, preserveOrder, defaultIndex, externalSearch, ...thru }) => {
11
11
  const textual = useMemo(() => (_textual ?? strProp)(textProperty), [_textual, textProperty]), { active, focused, onFocus, setClosed } = useFocus(thru), empty = !text, query = useMemo(() => text?.trim(), [text]), host = useHost(), onText = useNotify(host, _onText, 'text'), onChange = useCallback((val) => {
12
12
  _onChange?.(val, () => setClosed(true));
@@ -22,9 +22,9 @@ export const useAutocomplete = ({ value: _value, text, onChange: _onChange, onTe
22
22
  onText,
23
23
  });
24
24
  useEffect(() => {
25
- if (!focused)
25
+ if (!focused && !keepQuery)
26
26
  onText('');
27
- }, [focused]);
27
+ }, [focused, keepQuery]);
28
28
  const meta = useMeta({
29
29
  onText,
30
30
  onChange,
@@ -1,6 +1,6 @@
1
- import { useEffect } from '@pionjs/pion';
2
1
  import { array } from '@neovici/cosmoz-utils/array';
3
2
  import { useMeta } from '@neovici/cosmoz-utils/hooks/use-meta';
3
+ import { useEffect } from '@pionjs/pion';
4
4
  export const useKeys = ({ focused, empty, ...rest }) => {
5
5
  const enabled = focused && empty && rest.limit !== 1, meta = useMeta(rest);
6
6
  useEffect(() => {
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect, useState, useMemo } from '@pionjs/pion';
2
1
  import { useHost } from '@neovici/cosmoz-utils/hooks/use-host';
2
+ import { useLayoutEffect, useMemo, useState } from '@pionjs/pion';
3
3
  import { raf } from './util';
4
4
  // eslint-disable-next-line max-statements
5
5
  const overflow = (host) => {
@@ -3,9 +3,9 @@ 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';
6
+ import excludingStyle from './style.css';
6
7
  import { useExcludingSelection } from './use-excluding-selection';
7
8
  import { unwrap } from './utils';
8
- import excludingStyle from './style.css';
9
9
  const isItemExcluded = (value, item) => value?.some((v) => v.item === item && v.excluded);
10
10
  const excludedState = (value, item) => (item && isItemExcluded(value, item) ? 'excluded' : nothing);
11
11
  const mkItemRenderer = (value) => (item, i, { highlight, select, textual, isSelected }) => {
@@ -2,6 +2,7 @@ import { virtualize, virtualizerRef, } from '@lit-labs/virtualizer/virtualize.js
2
2
  import { connectable } from '@neovici/cosmoz-dropdown/connectable';
3
3
  import { sheet } from '@neovici/cosmoz-utils';
4
4
  import { spreadProps } from '@neovici/cosmoz-utils/directives/spread-props';
5
+ import { noop } from '@neovici/cosmoz-utils/function';
5
6
  import { useStyleSheet } from '@neovici/cosmoz-utils/hooks/use-stylesheet';
6
7
  import { props } from '@neovici/cosmoz-utils/object';
7
8
  import { component, html, useEffect, useRef } from '@pionjs/pion';
@@ -9,7 +10,6 @@ import { ref } from 'lit-html/directives/ref.js';
9
10
  import { styleMap } from 'lit-html/directives/style-map.js';
10
11
  import style, { styles } from './style.css';
11
12
  import { properties, useListbox } from './use-listbox';
12
- import { noop } from '@neovici/cosmoz-utils/function';
13
13
  const ignore = noop;
14
14
  const Listbox = (host) => {
15
15
  const listRef = useRef(undefined);
@@ -1,5 +1,5 @@
1
- import { useEffect } from '@pionjs/pion';
2
1
  import { useMeta } from '@neovici/cosmoz-utils/hooks/use-meta';
2
+ import { useEffect } from '@pionjs/pion';
3
3
  export const useKeyboard = (handlers) => {
4
4
  const listeners = useMeta(handlers);
5
5
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { useRenderItem, ItemRenderer } from './use-render-item';
1
+ import { ItemRenderer, useRenderItem } from './use-render-item';
2
2
  export declare const properties: string[];
3
3
  export interface Props<I> {
4
4
  value: I | I[];
@@ -1,8 +1,8 @@
1
1
  import { useMemo } from '@pionjs/pion';
2
- import { byValue } from './util';
2
+ import { useItemHeight } from './use-item-height';
3
3
  import { useItems } from './use-items';
4
4
  import { useRenderItem } from './use-render-item';
5
- import { useItemHeight } from './use-item-height';
5
+ import { byValue } from './util';
6
6
  export const properties = [
7
7
  'query',
8
8
  'items',
@@ -1,5 +1,5 @@
1
- import { useCallback } from '@pionjs/pion';
2
1
  import { useMeta } from '@neovici/cosmoz-utils/hooks/use-meta';
2
+ import { useCallback } from '@pionjs/pion';
3
3
  import { itemRenderer as mkItemRenderer, } from './item-renderer';
4
4
  export const useRenderItem = ({ itemRenderer = mkItemRenderer(), ...meta }) => {
5
5
  const info = useMeta(meta);
@@ -1,5 +1,5 @@
1
- import { html } from 'lit-html';
2
1
  import { array } from '@neovici/cosmoz-utils/array';
2
+ import { html } from 'lit-html';
3
3
  export const byValue = (value, valueProperty) => {
4
4
  if (!valueProperty) {
5
5
  return (item) => array(value).includes(item);
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-autocomplete",
3
- "version": "10.10.0",
3
+ "version": "10.10.4",
4
+ "type": "module",
4
5
  "description": "A autocomplete input web component",
5
6
  "keywords": [
6
7
  "lit-html",
7
8
  "web-components"
8
9
  ],
9
- "homepage": "https://github.com/neovici/cosmoz-autocomplete#readme",
10
+ "homepage": "https://github.com/Neovici/cosmoz-autocomplete#readme",
10
11
  "bugs": {
11
- "url": "https://github.com/neovici/cosmoz-autocomplete/issues"
12
+ "url": "https://github.com/Neovici/cosmoz-autocomplete/issues"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
15
- "url": "git+https://github.com/neovici/cosmoz-autocomplete.git"
16
+ "url": "git+https://github.com/Neovici/cosmoz-autocomplete.git"
16
17
  },
17
18
  "license": "Apache-2.0",
18
19
  "author": "",
@@ -80,25 +81,25 @@
80
81
  "lit-html": "^2.0.0 || ^3.0.0"
81
82
  },
82
83
  "devDependencies": {
83
- "@commitlint/cli": "^19.0.0",
84
- "@commitlint/config-conventional": "^19.0.0",
85
- "@neovici/cfg": "^1.34.0",
84
+ "@commitlint/cli": "^20.0.0",
85
+ "@commitlint/config-conventional": "^20.0.0",
86
+ "@neovici/cfg": "^2.0.0",
86
87
  "@open-wc/testing": "^4.0.0",
87
88
  "@playwright/test": "^1.43.1",
88
89
  "@semantic-release/changelog": "^6.0.0",
89
90
  "@semantic-release/git": "^10.0.0",
90
- "@storybook/web-components-vite": "^9.1.4",
91
- "@types/mocha": "^10.0.6",
92
- "@types/node": "^22.10.2",
91
+ "@storybook/web-components-vite": "^10.0.0",
92
+ "@types/mocha": "^10.0.0",
93
+ "@types/node": "24.0.0",
93
94
  "esbuild": "^0.24.0",
95
+ "eslint": "^9.0.0",
94
96
  "http-server": "^14.1.1",
95
97
  "husky": "^9.0.0",
96
- "prettier": "^3.6.2",
97
98
  "rollup-plugin-esbuild": "^6.1.1",
98
99
  "rollup-plugin-terser": "^7.0.2",
99
- "semantic-release": "^24.0.0",
100
+ "semantic-release": "^25.0.0",
100
101
  "sinon": "^19.0.0",
101
- "storybook": "^9.1.4"
102
+ "storybook": "^10.0.0"
102
103
  },
103
104
  "overrides": {
104
105
  "conventional-changelog-conventionalcommits": ">= 8.0.0"