@digital-realty/ix-search-bar 2.3.7 → 2.4.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.
@@ -1 +1,34 @@
1
- import{__decorate}from"tslib";import{css,LitElement,html}from"lit";import{property}from"lit/decorators.js";import"@digital-realty/ix-textbox";let IxSearchBarStyle=css`:host{display:flex;justify-content:space-between;align-items:center;border:1px solid #d3d3d3;border-width:1px 0;padding:1rem 0;flex-wrap:wrap;margin-bottom:1.5rem}html{color:#333}ix-textbox{color:#333;flex:1 0 min(280px,100%)}.items-count{flex:1000 0 7em;text-align:right;padding:.5em 0}`;class IxSearchBar extends LitElement{constructor(){super(...arguments),this.value="",this.items=[],this.searchFields=[],this.foundItems=[]}static get styles(){return[IxSearchBarStyle]}connectedCallback(){super.connectedCallback(),this.resetResults()}resetResults(){this.foundItems=this.items}get itemsCount(){return Array.isArray(this.foundItems)&&this.foundItems.length?this.foundItems.length:0}get itemsLabel(){return 1===this.itemsCount?"item":"items"}_dispatchEvent(t){t=new CustomEvent("onResultsFound",{detail:{items:t},composed:!0});this.dispatchEvent(t)}filterItems(t){if(""===(this.value=t))this.resetResults(),this._dispatchEvent(this.items);else{var e,s=[];for(e of this.items)for(var r of this.searchFields)if(r in e&&e[r].toLocaleLowerCase().includes(this.value.toLocaleLowerCase())){s.push(e);break}this.foundItems=s,this._dispatchEvent(s)}}render(){return html`<ix-textbox type="search" @textChange="${t=>this.filterItems(t.detail.value)}"></ix-textbox><div class="items-count">${this.itemsCount} ${this.itemsLabel}</div>`}}__decorate([property({type:String})],IxSearchBar.prototype,"value",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"items",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"searchFields",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"foundItems",void 0),window.customElements.define("ix-search-bar",IxSearchBar);
1
+ import{__decorate as t}from"tslib";import{css as e,LitElement as s,html as i}from"lit";import{property as o}from"lit/decorators.js";import"@digital-realty/ix-textbox";const r=e`
2
+ :host {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ align-items: center;
6
+ border: 1px solid lightgrey;
7
+ border-width: 1px 0;
8
+ padding: 1rem 0;
9
+ flex-wrap: wrap;
10
+ margin-bottom: 1.5rem;
11
+ }
12
+
13
+ html {
14
+ color: #333;
15
+ }
16
+
17
+ ix-textbox {
18
+ color: #333;
19
+ flex: 1 0 min(280px, 100%);
20
+ }
21
+
22
+ .items-count {
23
+ flex: 1000 0 7em;
24
+ text-align: right;
25
+ padding: 0.5em 0;
26
+ }
27
+ `;class n extends s{constructor(){super(...arguments),this.value="",this.items=[],this.searchFields=[],this.foundItems=[]}static get styles(){return[r]}connectedCallback(){super.connectedCallback(),this.resetResults()}resetResults(){this.foundItems=this.items}get itemsCount(){return Array.isArray(this.foundItems)&&this.foundItems.length?this.foundItems.length:0}get itemsLabel(){return 1===this.itemsCount?"item":"items"}_dispatchEvent(t){const e=new CustomEvent("onResultsFound",{detail:{items:t},composed:!0});this.dispatchEvent(e)}filterItems(t){if(this.value=t,""===t)return this.resetResults(),void this._dispatchEvent(this.items);const e=[];for(const t of this.items)for(const s of this.searchFields)if(s in t&&t[s].toLocaleLowerCase().includes(this.value.toLocaleLowerCase())){e.push(t);break}this.foundItems=e,this._dispatchEvent(e)}render(){return i`
28
+ <ix-textbox
29
+ type="search"
30
+ @textChange="${t=>this.filterItems(t.detail.value)}"
31
+ ></ix-textbox>
32
+
33
+ <div class="items-count">${this.itemsCount} ${this.itemsLabel}</div>
34
+ `}}t([o({type:String})],n.prototype,"value",void 0),t([o({type:Array})],n.prototype,"items",void 0),t([o({type:Array})],n.prototype,"searchFields",void 0),t([o({type:Array})],n.prototype,"foundItems",void 0),window.customElements.define("ix-search-bar",n);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-search-bar following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "2.3.7",
6
+ "version": "2.4.1",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -21,37 +21,34 @@
21
21
  "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
22
22
  "build": "tsc && npm run analyze -- --exclude dist && rollup -c",
23
23
  "prepublish": "tsc && npm run analyze -- --exclude dist",
24
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
+ "lint": "eslint --ext .ts,.html . && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
+ "format": "eslint --ext .ts,.html . --fix && prettier \"**/*.ts\" --write --ignore-path .gitignore",
26
26
  "test": "tsc && wtr --coverage",
27
27
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
28
28
  },
29
29
  "dependencies": {
30
- "@digital-realty/ix-textbox": "^2.3.8",
30
+ "@digital-realty/ix-textbox": "^2.4.1",
31
31
  "@lit/react": "^1.0.2",
32
32
  "lit": "^3.2.1",
33
33
  "react": "^18.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@custom-elements-manifest/analyzer": "^0.4.17",
37
- "@open-wc/building-rollup": "^3.0.2",
38
- "@open-wc/eslint-config": "^9.2.1",
39
37
  "@open-wc/testing": "^3.1.6",
38
+ "@rollup/plugin-terser": "^1.0.0",
40
39
  "@types/react": "^18.2.22",
41
- "@typescript-eslint/eslint-plugin": "^5.48.0",
42
- "@typescript-eslint/parser": "^5.48.0",
40
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
41
+ "@typescript-eslint/parser": "^8.58.2",
43
42
  "@web/dev-server": "^0.4.6",
44
43
  "@web/test-runner": "^0.20.2",
45
- "concurrently": "^9.1.0",
46
- "eslint": "^8.31.0",
44
+ "concurrently": "^9.2.1",
45
+ "eslint": "^9.39.4",
47
46
  "eslint-config-prettier": "^8.3.0",
48
47
  "husky": "^4.3.8",
49
48
  "lint-staged": "^10.5.4",
50
49
  "prettier": "^2.4.1",
51
50
  "rollup": "^4.29.1",
52
- "rollup-plugin-minify-html-literals": "^1.2.6",
53
51
  "rollup-plugin-summary": "^2.0.0",
54
- "rollup-plugin-uglify": "^6.0.4",
55
52
  "tslib": "^2.3.1",
56
53
  "typescript": "^4.5.2"
57
54
  },
@@ -59,11 +56,6 @@
59
56
  "eslintConfig": {
60
57
  "parser": "@typescript-eslint/parser",
61
58
  "root": true,
62
- "extends": [
63
- "@open-wc/eslint-config",
64
- "eslint-config-prettier",
65
- "plugin:json/recommended"
66
- ],
67
59
  "plugins": [
68
60
  "@typescript-eslint"
69
61
  ],
@@ -105,5 +97,5 @@
105
97
  "README.md",
106
98
  "LICENSE"
107
99
  ],
108
- "gitHead": "4cd8803f4c5f3b3833ae6ebb5791f73a057863f8"
100
+ "gitHead": "da06737d6707fd3d4ef898ba0fa632e7b3ed8019"
109
101
  }