@neovici/cosmoz-autocomplete 10.0.0 → 10.0.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.
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
- cosmoz-autocomplete
2
- ==================
1
+ # cosmoz-autocomplete
3
2
 
4
3
  [![Build Status](https://github.com/Neovici/cosmoz-autocomplete/workflows/Github%20CI/badge.svg)](https://github.com/Neovici/cosmoz-autocomplete/actions?workflow=Github+CI)
5
4
  [![Depfu](https://badges.depfu.com/badges/c887733c2e1b6c70285860279a80fa03/overview.svg)](https://depfu.com/github/Neovici/cosmoz-autocomplete?project_id=9639)
@@ -16,13 +15,14 @@ cosmoz-autocomplete
16
15
  ### Installing
17
16
 
18
17
  Using npm:
18
+
19
19
  ```bash
20
20
  npm install --save @neovici/cosmoz-autocomplete
21
21
  ```
22
22
 
23
23
  ### Usage
24
24
 
25
- ``` javascript
25
+ ```javascript
26
26
  import { html } from 'lit-html';
27
- html`<cosmoz-autocomplete .source=${["A", "B","C", "D"]} />`;
27
+ html`<cosmoz-autocomplete .source=${['A', 'B', 'C', 'D']} />`;
28
28
  ```
@@ -1,11 +1,23 @@
1
1
  import { useCallback } from '@pionjs/pion';
2
+ /**
3
+ * @see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
4
+ * @see https://medium.com/nerd-for-tech/basics-of-javascript-string-normalize-method-f3241174c2d0
5
+ * @see https://www.codu.co/articles/remove-accents-from-a-javascript-string-skgp1inb
6
+ *
7
+ * @param {string} str string from which to remove accents
8
+ * @returns {string} string w/o accents
9
+ */
10
+ const removeAccents = (str) => {
11
+ return str.normalize('NFD').replace(/[\u0300-\u036f]/gu, '');
12
+ };
2
13
  export const search = (source, query, textual) => {
3
14
  if (!query)
4
15
  return source;
5
- const qry = query.toLowerCase();
16
+ const normalizedQuery = removeAccents(query.toLowerCase());
6
17
  const matches = [];
7
18
  for (const item of source) {
8
- const index = textual(item).toLowerCase().indexOf(qry);
19
+ const normalizedText = removeAccents(textual(item).toLowerCase());
20
+ const index = normalizedText.indexOf(normalizedQuery);
9
21
  if (index < 0) {
10
22
  continue;
11
23
  }
package/package.json CHANGED
@@ -1,109 +1,111 @@
1
1
  {
2
- "name": "@neovici/cosmoz-autocomplete",
3
- "version": "10.0.0",
4
- "description": "A autocomplete input web component",
5
- "keywords": [
6
- "lit-html",
7
- "web-components"
8
- ],
9
- "homepage": "https://github.com/neovici/cosmoz-autocomplete#readme",
10
- "bugs": {
11
- "url": "https://github.com/neovici/cosmoz-autocomplete/issues"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/neovici/cosmoz-autocomplete.git"
16
- },
17
- "license": "Apache-2.0",
18
- "author": "",
19
- "main": "cosmoz-autocomplete.js",
20
- "directories": {
21
- "test": "test"
22
- },
23
- "scripts": {
24
- "lint": "tsc && eslint --cache .",
25
- "build": "tsc -p tsconfig.build.json",
26
- "start": "npm run storybook:start",
27
- "test": "wtr --coverage",
28
- "test:watch": "wtr --watch",
29
- "e2e": "playwright test",
30
- "prepare": "husky",
31
- "storybook:start": "storybook dev -p 8000",
32
- "storybook:build": "storybook build",
33
- "storybook:deploy": "storybook-to-ghpages",
34
- "storybook:preview": "npm run storybook:build && http-server ./storybook-static/ --silent"
35
- },
36
- "release": {
37
- "plugins": [
38
- "@semantic-release/commit-analyzer",
39
- "@semantic-release/release-notes-generator",
40
- "@semantic-release/changelog",
41
- "@semantic-release/github",
42
- "@semantic-release/npm",
43
- "@semantic-release/git"
44
- ],
45
- "branch": "master",
46
- "preset": "conventionalcommits"
47
- },
48
- "publishConfig": {
49
- "access": "public"
50
- },
51
- "files": [
52
- "dist/"
53
- ],
54
- "commitlint": {
55
- "extends": [
56
- "@commitlint/config-conventional"
57
- ],
58
- "rules": {
59
- "body-max-line-length": [
60
- 1,
61
- "always",
62
- 100
63
- ]
64
- }
65
- },
66
- "exports": {
67
- ".": "./dist/index.js",
68
- "./autocomplete": "./dist/autocomplete/index.js",
69
- "./listbox": "./dist/listbox/index.js",
70
- "./item-renderer": "./dist/listbox/item-renderer.js"
71
- },
72
- "dependencies": {
73
- "@lit-labs/virtualizer": "^2.0.0",
74
- "@neovici/cosmoz-dropdown": "^5.0.0",
75
- "@neovici/cosmoz-input": "^5.0.2",
76
- "@neovici/cosmoz-utils": "^6.0.0",
77
- "@pionjs/pion": "^2.7.1",
78
- "lit-html": "^2.0.0 || ^3.0.0"
79
- },
80
- "devDependencies": {
81
- "@commitlint/cli": "^19.0.0",
82
- "@commitlint/config-conventional": "^19.0.0",
83
- "@neovici/cfg": "^1.34.0",
84
- "@open-wc/testing": "^4.0.0",
85
- "@playwright/test": "^1.43.1",
86
- "@semantic-release/changelog": "^6.0.0",
87
- "@semantic-release/git": "^10.0.0",
88
- "@storybook/addon-essentials": "^7.0.0",
89
- "@storybook/addon-links": "^7.0.0",
90
- "@storybook/builder-vite": "7.6.17",
91
- "@storybook/storybook-deployer": "^2.8.5",
92
- "@storybook/web-components": "7.6.17",
93
- "@types/mocha": "^10.0.6",
94
- "@types/node": "^22.10.2",
95
- "@web/storybook-builder": "^0.1.9",
96
- "@web/storybook-framework-web-components": "^0.1.1",
97
- "esbuild": "^0.24.0",
98
- "http-server": "^14.1.1",
99
- "husky": "^9.0.0",
100
- "rollup-plugin-esbuild": "^6.1.1",
101
- "rollup-plugin-terser": "^7.0.2",
102
- "semantic-release": "^24.0.0",
103
- "sinon": "^19.0.0",
104
- "storybook": "^7.6.17"
105
- },
106
- "overrides": {
107
- "conventional-changelog-conventionalcommits": ">= 8.0.0"
108
- }
2
+ "name": "@neovici/cosmoz-autocomplete",
3
+ "version": "10.0.1",
4
+ "description": "A autocomplete input web component",
5
+ "keywords": [
6
+ "lit-html",
7
+ "web-components"
8
+ ],
9
+ "homepage": "https://github.com/neovici/cosmoz-autocomplete#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/neovici/cosmoz-autocomplete/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/neovici/cosmoz-autocomplete.git"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "author": "",
19
+ "main": "cosmoz-autocomplete.js",
20
+ "directories": {
21
+ "test": "test"
22
+ },
23
+ "scripts": {
24
+ "lint": "tsc && eslint --cache .",
25
+ "build": "tsc -p tsconfig.build.json",
26
+ "start": "npm run storybook:start",
27
+ "test": "wtr --coverage",
28
+ "test:watch": "wtr --watch",
29
+ "e2e": "playwright test",
30
+ "prepare": "husky",
31
+ "prettier": "prettier --write \"**/*.{js,ts,json,css,md}\"",
32
+ "prettier:check": "prettier --check \"**/*.{js,ts,json,css,md}\"",
33
+ "storybook:start": "storybook dev -p 8000",
34
+ "storybook:build": "storybook build",
35
+ "storybook:deploy": "storybook-to-ghpages",
36
+ "storybook:preview": "npm run storybook:build && http-server ./storybook-static/ --silent"
37
+ },
38
+ "release": {
39
+ "plugins": [
40
+ "@semantic-release/commit-analyzer",
41
+ "@semantic-release/release-notes-generator",
42
+ "@semantic-release/changelog",
43
+ "@semantic-release/github",
44
+ "@semantic-release/npm",
45
+ "@semantic-release/git"
46
+ ],
47
+ "branch": "master",
48
+ "preset": "conventionalcommits"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "files": [
54
+ "dist/"
55
+ ],
56
+ "commitlint": {
57
+ "extends": [
58
+ "@commitlint/config-conventional"
59
+ ],
60
+ "rules": {
61
+ "body-max-line-length": [
62
+ 1,
63
+ "always",
64
+ 100
65
+ ]
66
+ }
67
+ },
68
+ "exports": {
69
+ ".": "./dist/index.js",
70
+ "./autocomplete": "./dist/autocomplete/index.js",
71
+ "./listbox": "./dist/listbox/index.js",
72
+ "./item-renderer": "./dist/listbox/item-renderer.js"
73
+ },
74
+ "dependencies": {
75
+ "@lit-labs/virtualizer": "^2.0.0",
76
+ "@neovici/cosmoz-dropdown": "^5.0.0",
77
+ "@neovici/cosmoz-input": "^5.0.2",
78
+ "@neovici/cosmoz-utils": "^6.0.0",
79
+ "@pionjs/pion": "^2.7.1",
80
+ "lit-html": "^2.0.0 || ^3.0.0"
81
+ },
82
+ "devDependencies": {
83
+ "@commitlint/cli": "^19.0.0",
84
+ "@commitlint/config-conventional": "^19.0.0",
85
+ "@neovici/cfg": "^1.34.0",
86
+ "@open-wc/testing": "^4.0.0",
87
+ "@playwright/test": "^1.43.1",
88
+ "@semantic-release/changelog": "^6.0.0",
89
+ "@semantic-release/git": "^10.0.0",
90
+ "@storybook/addon-essentials": "^7.0.0",
91
+ "@storybook/addon-links": "^7.0.0",
92
+ "@storybook/builder-vite": "7.6.17",
93
+ "@storybook/storybook-deployer": "^2.8.5",
94
+ "@storybook/web-components": "7.6.17",
95
+ "@types/mocha": "^10.0.6",
96
+ "@types/node": "^22.10.2",
97
+ "@web/storybook-builder": "^0.1.9",
98
+ "@web/storybook-framework-web-components": "^0.1.1",
99
+ "esbuild": "^0.24.0",
100
+ "http-server": "^14.1.1",
101
+ "husky": "^9.0.0",
102
+ "rollup-plugin-esbuild": "^6.1.1",
103
+ "rollup-plugin-terser": "^7.0.2",
104
+ "semantic-release": "^24.0.0",
105
+ "sinon": "^19.0.0",
106
+ "storybook": "^7.6.17"
107
+ },
108
+ "overrides": {
109
+ "conventional-changelog-conventionalcommits": ">= 8.0.0"
110
+ }
109
111
  }