@lukso/web-components 1.40.0 → 1.41.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.
Files changed (56) hide show
  1. package/dist/components/index.cjs +3 -3
  2. package/dist/components/index.js +3 -3
  3. package/dist/components/lukso-button/index.cjs +1 -1
  4. package/dist/components/lukso-button/index.js +1 -1
  5. package/dist/components/lukso-card/index.cjs +2 -2
  6. package/dist/components/lukso-card/index.js +2 -2
  7. package/dist/components/lukso-checkbox/index.cjs +1 -1
  8. package/dist/components/lukso-checkbox/index.js +1 -1
  9. package/dist/components/lukso-footer/index.cjs +1 -1
  10. package/dist/components/lukso-footer/index.js +1 -1
  11. package/dist/components/lukso-icon/index.cjs +2 -2
  12. package/dist/components/lukso-icon/index.js +2 -2
  13. package/dist/components/lukso-input/index.cjs +1 -1
  14. package/dist/components/lukso-input/index.js +1 -1
  15. package/dist/components/lukso-modal/index.cjs +1 -1
  16. package/dist/components/lukso-modal/index.js +1 -1
  17. package/dist/components/lukso-navbar/index.cjs +2 -2
  18. package/dist/components/lukso-navbar/index.js +2 -2
  19. package/dist/components/lukso-profile/index.cjs +2 -2
  20. package/dist/components/lukso-profile/index.js +2 -2
  21. package/dist/components/lukso-progress/index.cjs +2 -2
  22. package/dist/components/lukso-progress/index.js +2 -2
  23. package/dist/components/lukso-sanitize/index.cjs +1 -1
  24. package/dist/components/lukso-sanitize/index.js +1 -1
  25. package/dist/components/lukso-search/index.cjs +49 -26
  26. package/dist/components/lukso-search/index.d.ts +6 -2
  27. package/dist/components/lukso-search/index.d.ts.map +1 -1
  28. package/dist/components/lukso-search/index.js +49 -26
  29. package/dist/components/lukso-search/lukso-search.stories.d.ts +6 -2
  30. package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
  31. package/dist/components/lukso-share/index.cjs +1 -1
  32. package/dist/components/lukso-share/index.js +1 -1
  33. package/dist/components/lukso-switch/index.cjs +2 -2
  34. package/dist/components/lukso-switch/index.js +2 -2
  35. package/dist/components/lukso-tag/index.cjs +2 -2
  36. package/dist/components/lukso-tag/index.js +2 -2
  37. package/dist/components/lukso-terms/index.cjs +2 -2
  38. package/dist/components/lukso-terms/index.js +2 -2
  39. package/dist/components/lukso-test/index.cjs +2 -2
  40. package/dist/components/lukso-test/index.js +2 -2
  41. package/dist/components/lukso-username/index.cjs +2 -2
  42. package/dist/components/lukso-username/index.js +2 -2
  43. package/dist/components/lukso-wizard/index.cjs +2 -2
  44. package/dist/components/lukso-wizard/index.js +2 -2
  45. package/dist/{directive-helpers-294cf70c.js → directive-helpers-1affe406.js} +1 -1
  46. package/dist/{directive-helpers-38cb10eb.cjs → directive-helpers-e70702eb.cjs} +1 -1
  47. package/dist/{index-211c8050.js → index-9dfdafd2.js} +1 -1
  48. package/dist/{index-b3762a1f.cjs → index-e765f94b.cjs} +1 -1
  49. package/dist/index.cjs +3 -3
  50. package/dist/index.js +3 -3
  51. package/dist/shared/tailwind-element/index.cjs +1 -1
  52. package/dist/shared/tailwind-element/index.js +1 -1
  53. package/dist/{style-map-cc5b37cd.cjs → style-map-3a049df9.cjs} +1 -1
  54. package/dist/{style-map-1398bfd6.js → style-map-5173bb70.js} +1 -1
  55. package/package.json +1 -1
  56. package/tools/sass/component.scss +4 -0
@@ -21,12 +21,12 @@ const components_luksoTerms_index = require('./lukso-terms/index.cjs');
21
21
  const components_luksoTest_index = require('./lukso-test/index.cjs');
22
22
  const components_luksoUsername_index = require('./lukso-username/index.cjs');
23
23
  const components_luksoWizard_index = require('./lukso-wizard/index.cjs');
24
- const shared_tailwindElement_index = require('../index-b3762a1f.cjs');
24
+ const shared_tailwindElement_index = require('../index-e765f94b.cjs');
25
25
  require('../directive-db00f5fb.cjs');
26
26
  require('../state-a62a7d5d.cjs');
27
27
  require('../index-7dc05ee5.cjs');
28
- require('../style-map-cc5b37cd.cjs');
29
- require('../directive-helpers-38cb10eb.cjs');
28
+ require('../style-map-3a049df9.cjs');
29
+ require('../directive-helpers-e70702eb.cjs');
30
30
 
31
31
 
32
32
 
@@ -17,9 +17,9 @@ export { LuksoTerms } from './lukso-terms/index.js';
17
17
  export { LuksoTest } from './lukso-test/index.js';
18
18
  export { LuksoUsername } from './lukso-username/index.js';
19
19
  export { LuksoWizard } from './lukso-wizard/index.js';
20
- export { a as TailwindElement, T as TailwindStyledElement } from '../index-211c8050.js';
20
+ export { a as TailwindElement, T as TailwindStyledElement } from '../index-9dfdafd2.js';
21
21
  import '../directive-9ec64c08.js';
22
22
  import '../state-7fde94d1.js';
23
23
  import '../index-714323c9.js';
24
- import '../style-map-1398bfd6.js';
25
- import '../directive-helpers-294cf70c.js';
24
+ import '../style-map-5173bb70.js';
25
+ import '../directive-helpers-1affe406.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const state = require('../../state-a62a7d5d.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
@@ -1,4 +1,4 @@
1
- import { T as TailwindStyledElement, x } from '../../index-211c8050.js';
1
+ import { T as TailwindStyledElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { t } from '../../state-7fde94d1.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
- const styleMap = require('../../style-map-cc5b37cd.cjs');
7
+ const styleMap = require('../../style-map-3a049df9.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
9
9
  require('../lukso-profile/index.cjs');
10
10
 
@@ -1,6 +1,6 @@
1
- import { T as TailwindStyledElement, x } from '../../index-211c8050.js';
1
+ import { T as TailwindStyledElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
- import { o } from '../../style-map-1398bfd6.js';
3
+ import { o } from '../../style-map-5173bb70.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
5
5
  import '../lukso-profile/index.js';
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const state = require('../../state-a62a7d5d.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
@@ -1,4 +1,4 @@
1
- import { a as TailwindElement, x, A } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x, A } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { t } from '../../state-7fde94d1.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  require('../lukso-share/index.cjs');
8
8
  require('../../index-7dc05ee5.cjs');
@@ -1,4 +1,4 @@
1
- import { a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { a as e } from '../../directive-9ec64c08.js';
3
3
  import '../lukso-share/index.js';
4
4
  import '../../index-714323c9.js';
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
- const styleMap = require('../../style-map-cc5b37cd.cjs');
7
+ const styleMap = require('../../style-map-3a049df9.cjs');
8
8
 
9
9
  const style = ":host {\n display: inline-flex\n}";
10
10
 
@@ -1,6 +1,6 @@
1
- import { x, T as TailwindStyledElement } from '../../index-211c8050.js';
1
+ import { x, T as TailwindStyledElement } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
- import { o } from '../../style-map-1398bfd6.js';
3
+ import { o } from '../../style-map-5173bb70.js';
4
4
 
5
5
  const style = ":host {\n display: inline-flex\n}";
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const state = require('../../state-a62a7d5d.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
@@ -1,4 +1,4 @@
1
- import { a as TailwindElement, x, A } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x, A } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { t } from '../../state-7fde94d1.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const index = require('../../index-7dc05ee5.cjs');
8
8
 
@@ -1,4 +1,4 @@
1
- import { a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { c as customClassMap } from '../../index-714323c9.js';
4
4
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const state = require('../../state-a62a7d5d.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
9
9
  require('../lukso-icon/index.cjs');
10
10
  require('../lukso-tag/index.cjs');
11
- require('../../style-map-cc5b37cd.cjs');
11
+ require('../../style-map-3a049df9.cjs');
12
12
 
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,10 +1,10 @@
1
- import { a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { t } from '../../state-7fde94d1.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
5
5
  import '../lukso-icon/index.js';
6
6
  import '../lukso-tag/index.js';
7
- import '../../style-map-1398bfd6.js';
7
+ import '../../style-map-5173bb70.js';
8
8
 
9
9
  var __defProp = Object.defineProperty;
10
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
- const styleMap = require('../../style-map-cc5b37cd.cjs');
7
+ const styleMap = require('../../style-map-3a049df9.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
9
9
 
10
10
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -1,6 +1,6 @@
1
- import { a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
- import { o } from '../../style-map-1398bfd6.js';
3
+ import { o } from '../../style-map-5173bb70.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
- const styleMap = require('../../style-map-cc5b37cd.cjs');
7
+ const styleMap = require('../../style-map-3a049df9.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
9
9
 
10
10
  var __defProp = Object.defineProperty;
@@ -1,6 +1,6 @@
1
- import { a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
- import { o } from '../../style-map-1398bfd6.js';
3
+ import { o } from '../../style-map-5173bb70.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
5
5
 
6
6
  var __defProp = Object.defineProperty;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { c as A, b as T, a as TailwindElement, x } from '../../index-211c8050.js';
1
+ import { c as A, b as T, a as TailwindElement, x } from '../../index-9dfdafd2.js';
2
2
  import { i, t, b as e$1, e as e$2, a as e$3 } from '../../directive-9ec64c08.js';
3
3
 
4
4
  /**
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-b3762a1f.cjs');
5
+ const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
6
  const directive = require('../../directive-db00f5fb.cjs');
7
7
  const state = require('../../state-a62a7d5d.cjs');
8
8
  const index = require('../../index-7dc05ee5.cjs');
9
9
  require('../lukso-icon/index.cjs');
10
10
  require('../lukso-profile/index.cjs');
11
11
  require('../lukso-username/index.cjs');
12
- require('../../style-map-cc5b37cd.cjs');
12
+ require('../../style-map-3a049df9.cjs');
13
13
 
14
14
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
15
15
 
@@ -44,9 +44,12 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
44
44
  this.borderless = false;
45
45
  this.results = "";
46
46
  this.debounce = 700;
47
- this.hasHocus = false;
48
- this.hasHighlight = false;
49
47
  this.isSearching = false;
48
+ this.noResultsText = "";
49
+ this.showNoResults = false;
50
+ this.hasFocus = false;
51
+ this.hasHighlight = false;
52
+ this.isDebouncing = false;
50
53
  this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-10
51
54
  border-solid h-[48px] placeholder:text-neutral-70
52
55
  outline-none transition transition-all duration-150 appearance-none rounded-12`;
@@ -106,26 +109,35 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
106
109
  </div>`;
107
110
  }
108
111
  resultsTemplate() {
109
- if (this.results === "") {
112
+ const resultTemplates = [];
113
+ if (this.results === "" && !this.showNoResults || this.showNoResults && !this.noResultsText) {
110
114
  return shared_tailwindElement_index.x``;
111
115
  }
112
- const resultTemplates = [];
113
- const results = JSON.parse(this.results);
114
- for (const result of Object.entries(results)) {
115
- if ("value" in result[1]) {
116
- resultTemplates.push(this.resultStringTemplate(result[1]));
117
- } else if ("address" in result[1]) {
118
- resultTemplates.push(this.resultProfileTemplate(result[1]));
119
- } else {
120
- console.error("Unknown result type", result);
116
+ if (this.showNoResults) {
117
+ resultTemplates.push(this.resultEmptyTemplate());
118
+ } else {
119
+ const results = JSON.parse(this.results);
120
+ for (const result of Object.entries(results)) {
121
+ if ("value" in result[1]) {
122
+ resultTemplates.push(this.resultStringTemplate(result[1]));
123
+ } else if ("address" in result[1]) {
124
+ resultTemplates.push(this.resultProfileTemplate(result[1]));
125
+ } else {
126
+ console.error("Unknown result type", result);
127
+ }
121
128
  }
122
129
  }
123
130
  return shared_tailwindElement_index.x`<div
124
- class="bg-neutral-100 border border-neutral-90 shadow-1xl rounded-12 p-3 mt-2 z-50 flex absolute w-full flex-col gap-1 overflow-y-auto max-h-60 scroll"
131
+ class="bg-neutral-100 border border-neutral-90 shadow-1xl rounded-12 p-3 mt-2 z-50 flex absolute w-full flex-col gap-1 overflow-y-auto max-h-64"
125
132
  >
126
133
  ${resultTemplates}
127
134
  </div>`;
128
135
  }
136
+ resultEmptyTemplate() {
137
+ return shared_tailwindElement_index.x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
138
+ ${this.noResultsText}
139
+ </div>`;
140
+ }
129
141
  resultStringTemplate(result) {
130
142
  return shared_tailwindElement_index.x`<div
131
143
  data-id="${result.id}"
@@ -168,12 +180,12 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
168
180
  }
169
181
  handleFocus() {
170
182
  if (!this.isReadonly && !this.isDisabled) {
171
- this.hasHocus = true;
183
+ this.hasFocus = true;
172
184
  this.hasHighlight = true;
173
185
  }
174
186
  }
175
187
  handleBlur() {
176
- this.hasHocus = false;
188
+ this.hasFocus = false;
177
189
  this.hasHighlight = false;
178
190
  }
179
191
  searchDebounce(searchTerm) {
@@ -186,14 +198,14 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
186
198
  composed: true
187
199
  });
188
200
  this.dispatchEvent(changeEvent);
189
- this.isSearching = false;
201
+ this.isDebouncing = false;
190
202
  }, this.debounce);
191
203
  }
192
204
  handleSearch(event) {
193
- if (this.isSearching) {
205
+ if (this.isDebouncing) {
194
206
  clearTimeout(this.debounceTimer);
195
207
  }
196
- this.isSearching = true;
208
+ this.isDebouncing = true;
197
209
  const target = event.target;
198
210
  this.searchDebounce(target.value);
199
211
  }
@@ -203,7 +215,7 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
203
215
  }
204
216
  }
205
217
  handleMouseOut() {
206
- if (!this.hasHocus) {
218
+ if (!this.hasFocus) {
207
219
  this.hasHighlight = false;
208
220
  }
209
221
  }
@@ -215,15 +227,17 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
215
227
  <div class="flex relative items-center">
216
228
  ${this.inputTemplate()}
217
229
  <lukso-icon
218
- name="search"
230
+ name="${this.isSearching || this.isDebouncing ? "spinner" : "search"}"
219
231
  class="absolute right-0 mr-3 ${index.customClassMap({
220
232
  ["opacity-60 cursor-not-allowed"]: this.isDisabled,
221
- ["cursor-not-allowed"]: this.isReadonly
233
+ ["cursor-not-allowed"]: this.isReadonly,
234
+ ["animate-spin"]: this.isSearching || this.isDebouncing
222
235
  })}"
223
236
  @mouseenter=${this.handleMouseOver}
224
237
  ></lukso-icon>
225
238
  </div>
226
- ${this.resultsTemplate()} ${this.error ? this.errorTemplate() : shared_tailwindElement_index.A}
239
+ ${this.results || this.showNoResults && this.hasFocus ? this.resultsTemplate() : shared_tailwindElement_index.A}
240
+ ${this.error ? this.errorTemplate() : shared_tailwindElement_index.A}
227
241
  </div>
228
242
  `;
229
243
  }
@@ -279,15 +293,24 @@ __decorateClass([
279
293
  __decorateClass([
280
294
  directive.e({ type: Number })
281
295
  ], exports.LuksoSearch.prototype, "debounce", 2);
296
+ __decorateClass([
297
+ directive.e({ type: Boolean, attribute: "is-searching" })
298
+ ], exports.LuksoSearch.prototype, "isSearching", 2);
299
+ __decorateClass([
300
+ directive.e({ type: String, attribute: "no-results-text" })
301
+ ], exports.LuksoSearch.prototype, "noResultsText", 2);
302
+ __decorateClass([
303
+ directive.e({ type: Boolean, attribute: "show-no-results" })
304
+ ], exports.LuksoSearch.prototype, "showNoResults", 2);
282
305
  __decorateClass([
283
306
  state.t()
284
- ], exports.LuksoSearch.prototype, "hasHocus", 2);
307
+ ], exports.LuksoSearch.prototype, "hasFocus", 2);
285
308
  __decorateClass([
286
309
  state.t()
287
310
  ], exports.LuksoSearch.prototype, "hasHighlight", 2);
288
311
  __decorateClass([
289
312
  state.t()
290
- ], exports.LuksoSearch.prototype, "isSearching", 2);
313
+ ], exports.LuksoSearch.prototype, "isDebouncing", 2);
291
314
  __decorateClass([
292
315
  state.t()
293
316
  ], exports.LuksoSearch.prototype, "debounceTimer", 2);
@@ -27,9 +27,12 @@ export declare class LuksoSearch extends LuksoSearch_base {
27
27
  borderless: boolean;
28
28
  results: string;
29
29
  debounce: number;
30
- private hasHocus;
30
+ isSearching: boolean;
31
+ noResultsText: string;
32
+ showNoResults: boolean;
33
+ private hasFocus;
31
34
  private hasHighlight;
32
- private isSearching;
35
+ private isDebouncing;
33
36
  private debounceTimer;
34
37
  private defaultInputStyles;
35
38
  inputTemplate(): import("lit").TemplateResult<1>;
@@ -37,6 +40,7 @@ export declare class LuksoSearch extends LuksoSearch_base {
37
40
  descriptionTemplate(): import("lit").TemplateResult<1>;
38
41
  errorTemplate(): import("lit").TemplateResult<1>;
39
42
  resultsTemplate(): import("lit").TemplateResult<1>;
43
+ resultEmptyTemplate(): import("lit").TemplateResult<1>;
40
44
  resultStringTemplate(result: StringResult): import("lit").TemplateResult<1>;
41
45
  resultProfileTemplate(result: ProfileResult): import("lit").TemplateResult<1>;
42
46
  private handleSelect;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/index.ts"],"names":[],"mappings":"AAMA,OAAO,yBAAyB,CAAA;AAChC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;;AAED,qBACa,WAAY,SAAQ,gBAA4B;IAE3D,KAAK,SAAK;IAGV,IAAI,SAAK;IAGT,IAAI,SAAS;IAGb,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,YAAY,SAAQ;IAGpB,EAAE,SAAK;IAGP,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,WAAW,SAAK;IAGhB,WAAW,UAAQ;IAGnB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,SAAS,UAAQ;IAGjB,UAAU,UAAQ;IAGlB,OAAO,SAAK;IAGZ,QAAQ,SAAM;IAGd,OAAO,CAAC,QAAQ,CAAQ;IAGxB,OAAO,CAAC,YAAY,CAAQ;IAG5B,OAAO,CAAC,WAAW,CAAQ;IAG3B,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,kBAAkB,CAEuD;IAEjF,aAAa;IAoCb,aAAa;IAUb,mBAAmB;IAQnB,aAAa;IAMb,eAAe;IA2Bf,oBAAoB,CAAC,MAAM,EAAE,YAAY;IAUzC,qBAAqB,CAAC,MAAM,EAAE,aAAa;IAsB3C,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAMtB,MAAM;CAoBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/index.ts"],"names":[],"mappings":"AAMA,OAAO,yBAAyB,CAAA;AAChC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;;AAED,qBACa,WAAY,SAAQ,gBAA4B;IAE3D,KAAK,SAAK;IAGV,IAAI,SAAK;IAGT,IAAI,SAAS;IAGb,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,YAAY,SAAQ;IAGpB,EAAE,SAAK;IAGP,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,WAAW,SAAK;IAGhB,WAAW,UAAQ;IAGnB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,SAAS,UAAQ;IAGjB,UAAU,UAAQ;IAGlB,OAAO,SAAK;IAGZ,QAAQ,SAAM;IAGd,WAAW,UAAQ;IAGnB,aAAa,SAAK;IAGlB,aAAa,UAAQ;IAGrB,OAAO,CAAC,QAAQ,CAAQ;IAGxB,OAAO,CAAC,YAAY,CAAQ;IAG5B,OAAO,CAAC,YAAY,CAAQ;IAG5B,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,kBAAkB,CAEuD;IAEjF,aAAa;IAoCb,aAAa;IAUb,mBAAmB;IAQnB,aAAa;IAMb,eAAe;IAoCf,mBAAmB;IAMnB,oBAAoB,CAAC,MAAM,EAAE,YAAY;IAUzC,qBAAqB,CAAC,MAAM,EAAE,aAAa;IAsB3C,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAMtB,MAAM;CA0BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
@@ -1,11 +1,11 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-211c8050.js';
1
+ import { T as TailwindStyledElement, x, A } from '../../index-9dfdafd2.js';
2
2
  import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
3
  import { t } from '../../state-7fde94d1.js';
4
4
  import { c as customClassMap } from '../../index-714323c9.js';
5
5
  import '../lukso-icon/index.js';
6
6
  import '../lukso-profile/index.js';
7
7
  import '../lukso-username/index.js';
8
- import '../../style-map-1398bfd6.js';
8
+ import '../../style-map-5173bb70.js';
9
9
 
10
10
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
11
11
 
@@ -40,9 +40,12 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
40
40
  this.borderless = false;
41
41
  this.results = "";
42
42
  this.debounce = 700;
43
- this.hasHocus = false;
44
- this.hasHighlight = false;
45
43
  this.isSearching = false;
44
+ this.noResultsText = "";
45
+ this.showNoResults = false;
46
+ this.hasFocus = false;
47
+ this.hasHighlight = false;
48
+ this.isDebouncing = false;
46
49
  this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-10
47
50
  border-solid h-[48px] placeholder:text-neutral-70
48
51
  outline-none transition transition-all duration-150 appearance-none rounded-12`;
@@ -102,26 +105,35 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
102
105
  </div>`;
103
106
  }
104
107
  resultsTemplate() {
105
- if (this.results === "") {
108
+ const resultTemplates = [];
109
+ if (this.results === "" && !this.showNoResults || this.showNoResults && !this.noResultsText) {
106
110
  return x``;
107
111
  }
108
- const resultTemplates = [];
109
- const results = JSON.parse(this.results);
110
- for (const result of Object.entries(results)) {
111
- if ("value" in result[1]) {
112
- resultTemplates.push(this.resultStringTemplate(result[1]));
113
- } else if ("address" in result[1]) {
114
- resultTemplates.push(this.resultProfileTemplate(result[1]));
115
- } else {
116
- console.error("Unknown result type", result);
112
+ if (this.showNoResults) {
113
+ resultTemplates.push(this.resultEmptyTemplate());
114
+ } else {
115
+ const results = JSON.parse(this.results);
116
+ for (const result of Object.entries(results)) {
117
+ if ("value" in result[1]) {
118
+ resultTemplates.push(this.resultStringTemplate(result[1]));
119
+ } else if ("address" in result[1]) {
120
+ resultTemplates.push(this.resultProfileTemplate(result[1]));
121
+ } else {
122
+ console.error("Unknown result type", result);
123
+ }
117
124
  }
118
125
  }
119
126
  return x`<div
120
- class="bg-neutral-100 border border-neutral-90 shadow-1xl rounded-12 p-3 mt-2 z-50 flex absolute w-full flex-col gap-1 overflow-y-auto max-h-60 scroll"
127
+ class="bg-neutral-100 border border-neutral-90 shadow-1xl rounded-12 p-3 mt-2 z-50 flex absolute w-full flex-col gap-1 overflow-y-auto max-h-64"
121
128
  >
122
129
  ${resultTemplates}
123
130
  </div>`;
124
131
  }
132
+ resultEmptyTemplate() {
133
+ return x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
134
+ ${this.noResultsText}
135
+ </div>`;
136
+ }
125
137
  resultStringTemplate(result) {
126
138
  return x`<div
127
139
  data-id="${result.id}"
@@ -164,12 +176,12 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
164
176
  }
165
177
  handleFocus() {
166
178
  if (!this.isReadonly && !this.isDisabled) {
167
- this.hasHocus = true;
179
+ this.hasFocus = true;
168
180
  this.hasHighlight = true;
169
181
  }
170
182
  }
171
183
  handleBlur() {
172
- this.hasHocus = false;
184
+ this.hasFocus = false;
173
185
  this.hasHighlight = false;
174
186
  }
175
187
  searchDebounce(searchTerm) {
@@ -182,14 +194,14 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
182
194
  composed: true
183
195
  });
184
196
  this.dispatchEvent(changeEvent);
185
- this.isSearching = false;
197
+ this.isDebouncing = false;
186
198
  }, this.debounce);
187
199
  }
188
200
  handleSearch(event) {
189
- if (this.isSearching) {
201
+ if (this.isDebouncing) {
190
202
  clearTimeout(this.debounceTimer);
191
203
  }
192
- this.isSearching = true;
204
+ this.isDebouncing = true;
193
205
  const target = event.target;
194
206
  this.searchDebounce(target.value);
195
207
  }
@@ -199,7 +211,7 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
199
211
  }
200
212
  }
201
213
  handleMouseOut() {
202
- if (!this.hasHocus) {
214
+ if (!this.hasFocus) {
203
215
  this.hasHighlight = false;
204
216
  }
205
217
  }
@@ -211,15 +223,17 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
211
223
  <div class="flex relative items-center">
212
224
  ${this.inputTemplate()}
213
225
  <lukso-icon
214
- name="search"
226
+ name="${this.isSearching || this.isDebouncing ? "spinner" : "search"}"
215
227
  class="absolute right-0 mr-3 ${customClassMap({
216
228
  ["opacity-60 cursor-not-allowed"]: this.isDisabled,
217
- ["cursor-not-allowed"]: this.isReadonly
229
+ ["cursor-not-allowed"]: this.isReadonly,
230
+ ["animate-spin"]: this.isSearching || this.isDebouncing
218
231
  })}"
219
232
  @mouseenter=${this.handleMouseOver}
220
233
  ></lukso-icon>
221
234
  </div>
222
- ${this.resultsTemplate()} ${this.error ? this.errorTemplate() : A}
235
+ ${this.results || this.showNoResults && this.hasFocus ? this.resultsTemplate() : A}
236
+ ${this.error ? this.errorTemplate() : A}
223
237
  </div>
224
238
  `;
225
239
  }
@@ -275,15 +289,24 @@ __decorateClass([
275
289
  __decorateClass([
276
290
  e({ type: Number })
277
291
  ], LuksoSearch.prototype, "debounce", 2);
292
+ __decorateClass([
293
+ e({ type: Boolean, attribute: "is-searching" })
294
+ ], LuksoSearch.prototype, "isSearching", 2);
295
+ __decorateClass([
296
+ e({ type: String, attribute: "no-results-text" })
297
+ ], LuksoSearch.prototype, "noResultsText", 2);
298
+ __decorateClass([
299
+ e({ type: Boolean, attribute: "show-no-results" })
300
+ ], LuksoSearch.prototype, "showNoResults", 2);
278
301
  __decorateClass([
279
302
  t()
280
- ], LuksoSearch.prototype, "hasHocus", 2);
303
+ ], LuksoSearch.prototype, "hasFocus", 2);
281
304
  __decorateClass([
282
305
  t()
283
306
  ], LuksoSearch.prototype, "hasHighlight", 2);
284
307
  __decorateClass([
285
308
  t()
286
- ], LuksoSearch.prototype, "isSearching", 2);
309
+ ], LuksoSearch.prototype, "isDebouncing", 2);
287
310
  __decorateClass([
288
311
  t()
289
312
  ], LuksoSearch.prototype, "debounceTimer", 2);
@@ -2,8 +2,12 @@ import { Meta } from '@storybook/web-components';
2
2
  /** Documentation and examples of `lukso-search` component. Components share most of `lukso-input` attributes. */
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
- /** */
5
+ /** Example of search with `string` values. */
6
6
  export declare const DefaultSearch: any;
7
- /** */
7
+ /** Example of search with `profile` values. */
8
8
  export declare const ProfileSearch: any;
9
+ /** To indicate when search is processing results you can add `is-searching` attribute. */
10
+ export declare const SearchingState: any;
11
+ /** To show that search hes no results add `show-no-results` attribute. You can also customize no results text with `no-results-text` attribute. */
12
+ export declare const NoResults: any;
9
13
  //# sourceMappingURL=lukso-search.stories.d.ts.map