@neovici/cosmoz-autocomplete 10.7.2 → 10.8.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.
@@ -1,12 +1,20 @@
1
- import { component, useCallback } from '@pionjs/pion';
1
+ import { component, useCallback, useEffect, useProperty } from '@pionjs/pion';
2
2
  import { Autocomplete, observedAttributes, style } from './autocomplete';
3
3
  import { sheet } from '@neovici/cosmoz-utils';
4
4
  const Standalone = (host) => {
5
5
  const { onChange, onText, ...props } = host;
6
+ const [value, setValue] = useProperty('value');
7
+ useEffect(() => {
8
+ if (host.onChange == null)
9
+ return;
10
+ // eslint-disable-next-line no-console
11
+ console.warn('onChange is deprecated; use value-changed and lift instead');
12
+ }, []);
6
13
  return Autocomplete({
7
14
  ...props,
15
+ value,
8
16
  onChange: useCallback((value, ...args) => {
9
- host.value = value;
17
+ setValue(value);
10
18
  onChange?.(value, ...args);
11
19
  }, [onChange]),
12
20
  onText: useCallback((text) => {
@@ -3,7 +3,7 @@ type Source<I> = (opts: {
3
3
  active?: boolean;
4
4
  }) => PromiseLike<I[]>;
5
5
  interface Base<I> {
6
- value: I | I[];
6
+ value?: I | I[];
7
7
  limit?: number;
8
8
  min?: number;
9
9
  keepOpened?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-autocomplete",
3
- "version": "10.7.2",
3
+ "version": "10.8.0",
4
4
  "description": "A autocomplete input web component",
5
5
  "keywords": [
6
6
  "lit-html",