lucos_search_component 0.0.4 → 0.0.5

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.
@@ -3,7 +3,7 @@
3
3
  <title>Hello World Search Component</title>
4
4
  </head>
5
5
  <body>
6
- <lucos-search api-key="${KEY_LUCOS_ARACHNE}"></lucos-search>
6
+ <label for="search-field">Search For:</label><select is="lucos-search" api-key="${KEY_LUCOS_ARACHNE}" id="search-field"></select>
7
7
  <script src="./built.js"></script>
8
8
  </body>
9
9
  </html>
package/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import TomSelect from 'tom-select';
2
2
  import tomSelectStylesheet from 'tom-select/dist/css/tom-select.default.css';
3
3
 
4
- class LucosSearchComponent extends HTMLElement {
4
+ class LucosSearchComponent extends HTMLSelectElement {
5
5
  static get observedAttributes() {
6
6
  return ['api-key'];
7
7
  }
8
8
  constructor() {
9
9
  super();
10
10
  const component = this;
11
- const shadow = component.attachShadow({mode: 'open'});
12
11
 
13
12
  const mainStyle = document.createElement('style');
14
13
  mainStyle.textContent = `
@@ -59,16 +58,14 @@ class LucosSearchComponent extends HTMLElement {
59
58
  padding: 2px 6px;
60
59
  }
61
60
  `;
62
- shadow.appendChild(mainStyle);
61
+ component.appendChild(mainStyle);
63
62
 
64
63
  const tomStyle = document.createElement('style');
65
64
  tomStyle.textContent = tomSelectStylesheet[0][1];
66
- shadow.appendChild(tomStyle);
65
+ component.appendChild(tomStyle);
67
66
 
68
- const select = document.createElement("select");
69
- select.setAttribute("multiple", "multiple");
70
- shadow.appendChild(select);
71
- const tomSelect = new TomSelect(select, {
67
+ component.setAttribute("multiple", "multiple");
68
+ new TomSelect(component, {
72
69
  valueField: 'id',
73
70
  labelField: 'pref_label',
74
71
  searchField: [],
@@ -113,4 +110,4 @@ class LucosSearchComponent extends HTMLElement {
113
110
  });
114
111
  }
115
112
  }
116
- customElements.define('lucos-search', LucosSearchComponent);
113
+ customElements.define('lucos-search', LucosSearchComponent, { extends: "select" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucos_search_component",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Web Component for searching lucOS data",
5
5
  "type": "module",
6
6
  "main": "index.js",