@neovici/cosmoz-autocomplete 10.10.1 → 10.11.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.
- package/dist/autocomplete/index.js +1 -1
- package/dist/autocomplete/use-autocomplete.js +8 -8
- package/dist/autocomplete/use-keys.js +1 -1
- package/dist/autocomplete/use-overflow.js +1 -1
- package/dist/excluding/index.js +1 -1
- package/dist/listbox/index.js +1 -1
- package/dist/listbox/use-keyboard.js +1 -1
- package/dist/listbox/use-listbox.d.ts +1 -1
- package/dist/listbox/use-listbox.js +2 -2
- package/dist/listbox/use-render-item.js +1 -1
- package/dist/listbox/util.js +1 -1
- package/package.json +16 -13
|
@@ -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 {
|
|
2
|
-
import {
|
|
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) => {
|
package/dist/excluding/index.js
CHANGED
|
@@ -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 }) => {
|
package/dist/listbox/index.js
CHANGED
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { useMemo } from '@pionjs/pion';
|
|
2
|
-
import {
|
|
2
|
+
import { useItemHeight } from './use-item-height';
|
|
3
3
|
import { useItems } from './use-items';
|
|
4
4
|
import { useRenderItem } from './use-render-item';
|
|
5
|
-
import {
|
|
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);
|
package/dist/listbox/util.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-autocomplete",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.11.0",
|
|
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/
|
|
10
|
+
"homepage": "https://github.com/Neovici/cosmoz-autocomplete#readme",
|
|
10
11
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/Neovici/cosmoz-autocomplete/issues"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/
|
|
16
|
+
"url": "git+https://github.com/Neovici/cosmoz-autocomplete.git"
|
|
16
17
|
},
|
|
17
18
|
"license": "Apache-2.0",
|
|
18
19
|
"author": "",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"scripts": {
|
|
24
25
|
"lint": "tsc && eslint --cache .",
|
|
25
26
|
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"check:duplicates": "check-duplicate-components",
|
|
26
28
|
"start": "npm run storybook:start",
|
|
27
29
|
"test": "wtr --coverage",
|
|
28
30
|
"test:watch": "wtr --watch",
|
|
@@ -80,25 +82,26 @@
|
|
|
80
82
|
"lit-html": "^2.0.0 || ^3.0.0"
|
|
81
83
|
},
|
|
82
84
|
"devDependencies": {
|
|
83
|
-
"@commitlint/cli": "^
|
|
84
|
-
"@commitlint/config-conventional": "^
|
|
85
|
-
"@neovici/cfg": "^
|
|
85
|
+
"@commitlint/cli": "^20.0.0",
|
|
86
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
87
|
+
"@neovici/cfg": "^2.8.0",
|
|
86
88
|
"@open-wc/testing": "^4.0.0",
|
|
87
89
|
"@playwright/test": "^1.43.1",
|
|
88
90
|
"@semantic-release/changelog": "^6.0.0",
|
|
89
91
|
"@semantic-release/git": "^10.0.0",
|
|
90
|
-
"@storybook/web-components-vite": "^
|
|
91
|
-
"@types/mocha": "^10.0.
|
|
92
|
-
"@types/node": "
|
|
92
|
+
"@storybook/web-components-vite": "^10.0.0",
|
|
93
|
+
"@types/mocha": "^10.0.0",
|
|
94
|
+
"@types/node": "24.0.0",
|
|
93
95
|
"esbuild": "^0.24.0",
|
|
96
|
+
"eslint": "^9.0.0",
|
|
94
97
|
"http-server": "^14.1.1",
|
|
95
98
|
"husky": "^9.0.0",
|
|
96
|
-
"
|
|
99
|
+
"lint-staged": "^16.2.7",
|
|
97
100
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
98
101
|
"rollup-plugin-terser": "^7.0.2",
|
|
99
|
-
"semantic-release": "^
|
|
102
|
+
"semantic-release": "^25.0.0",
|
|
100
103
|
"sinon": "^19.0.0",
|
|
101
|
-
"storybook": "^
|
|
104
|
+
"storybook": "^10.0.0"
|
|
102
105
|
},
|
|
103
106
|
"overrides": {
|
|
104
107
|
"conventional-changelog-conventionalcommits": ">= 8.0.0"
|