@neovici/cosmoz-autocomplete 8.4.0 → 8.6.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/autocomplete.d.ts +3 -1
- package/dist/autocomplete/autocomplete.js +1 -2
- package/dist/autocomplete/index.js +2 -2
- package/dist/autocomplete/util.d.ts +1 -1
- package/dist/listbox/index.d.ts +2 -2
- package/dist/listbox/index.js +22 -1
- package/dist/listbox/style.css.js +9 -1
- package/package.json +24 -13
|
@@ -11,9 +11,11 @@ export interface Props<I> extends Base<I> {
|
|
|
11
11
|
showSingle?: boolean;
|
|
12
12
|
itemHeight?: number;
|
|
13
13
|
itemLimit?: number;
|
|
14
|
+
wrap?: boolean;
|
|
15
|
+
defaultIndex?: number;
|
|
14
16
|
}
|
|
15
17
|
type AProps<I> = Omit<Props<I>, keyof RProps<I>> & RProps<I> & {
|
|
16
18
|
onInputRef?: (el?: Element) => void;
|
|
17
19
|
};
|
|
18
|
-
declare const autocomplete: <I>(props: AProps<I>) => import("lit-html").TemplateResult<1>, Autocomplete: <I>(props: Props<I>) => import("lit-html").TemplateResult<1>, observedAttributes:
|
|
20
|
+
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", "hide-empty", "default-index", "item-height", "item-limit", "wrap"];
|
|
19
21
|
export { autocomplete, Autocomplete, observedAttributes, style };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { component, useCallback } from '@pionjs/pion';
|
|
2
|
-
import { Autocomplete, observedAttributes
|
|
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;
|
|
@@ -15,6 +15,6 @@ const Standalone = (host) => {
|
|
|
15
15
|
}, [onText]),
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const styleSheets = [sheet(style)];
|
|
19
19
|
customElements.define('cosmoz-autocomplete-ui', component(Autocomplete, { observedAttributes, styleSheets }));
|
|
20
20
|
customElements.define('cosmoz-autocomplete', component(Standalone, { observedAttributes, styleSheets }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const search: <I>(source: I[], query: string, textual: (i: I) => string) => I[];
|
|
2
|
-
export declare const normalize: <I>(source:
|
|
2
|
+
export declare const normalize: <I>(source: I[] | false | null) => I[];
|
|
3
3
|
export declare const notify: <T>(host: EventTarget, name: string, detail: T) => boolean;
|
|
4
4
|
export declare const useNotify: <V>(host: EventTarget, fn: ((v: V) => void) | undefined, name: string) => (val: V) => void;
|
|
5
5
|
export declare const EMPTY: never[], EMPTY$: Promise<never[]>;
|
package/dist/listbox/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Props } from './use-listbox';
|
|
2
2
|
export declare const listbox: <I>({ multi, ...thru }: Props<I> & {
|
|
3
3
|
multi?: boolean | undefined;
|
|
4
|
-
}) => import("lit-html/directive").DirectiveResult<{
|
|
5
|
-
new (_partInfo: import("lit-html/directive").PartInfo): {
|
|
4
|
+
}) => import("lit-html/directive.js").DirectiveResult<{
|
|
5
|
+
new (_partInfo: import("lit-html/directive.js").PartInfo): {
|
|
6
6
|
_op?: import("lit-html").ChildPart | undefined;
|
|
7
7
|
_outlet?: HTMLElement | undefined;
|
|
8
8
|
_content?: unknown;
|
package/dist/listbox/index.js
CHANGED
|
@@ -33,9 +33,30 @@ const Listbox = (props) => {
|
|
|
33
33
|
})}
|
|
34
34
|
</div>`;
|
|
35
35
|
};
|
|
36
|
+
const supportsPopover = () => {
|
|
37
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
38
|
+
return HTMLElement.prototype.hasOwnProperty('popover');
|
|
39
|
+
};
|
|
40
|
+
const showPopover = (popover) => {
|
|
41
|
+
const popoverElement = popover;
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
popoverElement?.showPopover();
|
|
44
|
+
});
|
|
45
|
+
};
|
|
36
46
|
customElements.define('cosmoz-listbox', component(Listbox, { styleSheets: [sheet(style)] }));
|
|
37
|
-
export const listbox = ({ multi, ...thru }) =>
|
|
47
|
+
export const listbox = ({ multi, ...thru }) => {
|
|
48
|
+
if (supportsPopover()) {
|
|
49
|
+
return html `<cosmoz-listbox
|
|
50
|
+
${ref(showPopover)}
|
|
51
|
+
popover="manual"
|
|
52
|
+
part="listbox"
|
|
53
|
+
?multi=${multi}
|
|
54
|
+
...=${spreadProps(props(properties)(thru))}
|
|
55
|
+
></cosmoz-listbox>`;
|
|
56
|
+
}
|
|
57
|
+
return portal(html `<cosmoz-listbox
|
|
38
58
|
part="listbox"
|
|
39
59
|
?multi=${multi}
|
|
40
60
|
...=${spreadProps(props(properties)(thru))}
|
|
41
61
|
></cosmoz-listbox>`);
|
|
62
|
+
};
|
|
@@ -11,9 +11,17 @@ const style = css `
|
|
|
11
11
|
font-family: var(--paper-font-subhead_-_font-family, initial);
|
|
12
12
|
background: #fff;
|
|
13
13
|
min-width: 72px;
|
|
14
|
-
box-shadow:
|
|
14
|
+
box-shadow:
|
|
15
|
+
0 3px 4px 0 rgba(0, 0, 0, 0.14),
|
|
16
|
+
0 1px 8px 0 rgba(0, 0, 0, 0.12),
|
|
15
17
|
0 3px 3px -2px rgba(0, 0, 0, 0.4);
|
|
16
18
|
}
|
|
19
|
+
:host(:popover-open) {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
display: block;
|
|
22
|
+
margin: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
}
|
|
17
25
|
.items {
|
|
18
26
|
position: relative;
|
|
19
27
|
overflow-y: auto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-autocomplete",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"description": "A autocomplete input web component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit-html",
|
|
@@ -23,12 +23,14 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"lint": "tsc && eslint --cache .",
|
|
25
25
|
"build": "tsc -p tsconfig.build.json",
|
|
26
|
-
"start": "
|
|
26
|
+
"start": "npm run storybook:start",
|
|
27
27
|
"test": "wtr --coverage",
|
|
28
28
|
"test:watch": "wtr --watch",
|
|
29
|
-
"prepare": "husky
|
|
30
|
-
"storybook:
|
|
31
|
-
"storybook:
|
|
29
|
+
"prepare": "husky",
|
|
30
|
+
"storybook:start": "storybook dev -p 8000",
|
|
31
|
+
"storybook:build": "storybook build",
|
|
32
|
+
"storybook:deploy": "storybook-to-ghpages",
|
|
33
|
+
"storybook:preview": "npm run storybook:build && http-server -d ./storybook-static/"
|
|
32
34
|
},
|
|
33
35
|
"release": {
|
|
34
36
|
"plugins": [
|
|
@@ -68,26 +70,35 @@
|
|
|
68
70
|
},
|
|
69
71
|
"dependencies": {
|
|
70
72
|
"@lit-labs/virtualizer": "^2.0.0",
|
|
71
|
-
"@neovici/cosmoz-dropdown": "^4.
|
|
72
|
-
"@neovici/cosmoz-input": "^4.3.
|
|
73
|
+
"@neovici/cosmoz-dropdown": "^4.4.0",
|
|
74
|
+
"@neovici/cosmoz-input": "^4.3.3",
|
|
73
75
|
"@neovici/cosmoz-utils": "^6.0.0",
|
|
74
76
|
"@pionjs/pion": "^2.0.0",
|
|
75
77
|
"lit-html": "^2.0.0 || ^3.0.0"
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
|
-
"@commitlint/cli": "^
|
|
79
|
-
"@commitlint/config-conventional": "^
|
|
80
|
+
"@commitlint/cli": "^19.0.0",
|
|
81
|
+
"@commitlint/config-conventional": "^19.0.0",
|
|
80
82
|
"@neovici/cfg": "^1.34.0",
|
|
81
83
|
"@open-wc/testing": "^4.0.0",
|
|
82
84
|
"@semantic-release/changelog": "^6.0.0",
|
|
83
85
|
"@semantic-release/git": "^10.0.0",
|
|
86
|
+
"@storybook/addon-essentials": "^7.0.0",
|
|
87
|
+
"@storybook/addon-links": "^7.0.0",
|
|
88
|
+
"@storybook/builder-vite": "7.6.17",
|
|
84
89
|
"@storybook/storybook-deployer": "^2.8.5",
|
|
85
|
-
"@
|
|
86
|
-
"@
|
|
87
|
-
"
|
|
90
|
+
"@storybook/web-components": "7.6.17",
|
|
91
|
+
"@types/mocha": "^10.0.6",
|
|
92
|
+
"@web/storybook-builder": "^0.1.9",
|
|
93
|
+
"@web/storybook-framework-web-components": "^0.1.1",
|
|
94
|
+
"esbuild": "^0.20.2",
|
|
95
|
+
"http-server": "^14.1.1",
|
|
96
|
+
"husky": "^9.0.0",
|
|
97
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
88
98
|
"rollup-plugin-terser": "^7.0.2",
|
|
89
|
-
"semantic-release": "^
|
|
99
|
+
"semantic-release": "^23.0.0",
|
|
90
100
|
"sinon": "^17.0.0",
|
|
101
|
+
"storybook": "^7.6.17",
|
|
91
102
|
"typescript": "^5.0.0"
|
|
92
103
|
}
|
|
93
104
|
}
|