@lukso/web-components 1.41.0 → 1.43.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 (87) hide show
  1. package/dist/components/index.cjs +7 -6
  2. package/dist/components/index.js +7 -6
  3. package/dist/components/lukso-button/index.cjs +21 -20
  4. package/dist/components/lukso-button/index.js +5 -4
  5. package/dist/components/lukso-card/index.cjs +48 -54
  6. package/dist/components/lukso-card/index.d.ts.map +1 -1
  7. package/dist/components/lukso-card/index.js +38 -44
  8. package/dist/components/lukso-checkbox/index.cjs +16 -15
  9. package/dist/components/lukso-checkbox/index.js +5 -4
  10. package/dist/components/lukso-footer/index.cjs +39 -27
  11. package/dist/components/lukso-footer/index.d.ts +2 -0
  12. package/dist/components/lukso-footer/index.d.ts.map +1 -1
  13. package/dist/components/lukso-footer/index.js +39 -27
  14. package/dist/components/lukso-footer/lukso-footer.stories.d.ts +2 -0
  15. package/dist/components/lukso-footer/lukso-footer.stories.d.ts.map +1 -1
  16. package/dist/components/lukso-icon/index.cjs +9 -8
  17. package/dist/components/lukso-icon/index.js +4 -3
  18. package/dist/components/lukso-input/index.cjs +26 -25
  19. package/dist/components/lukso-input/index.js +5 -4
  20. package/dist/components/lukso-modal/index.cjs +7 -6
  21. package/dist/components/lukso-modal/index.js +4 -3
  22. package/dist/components/lukso-navbar/index.cjs +15 -14
  23. package/dist/components/lukso-navbar/index.js +6 -5
  24. package/dist/components/lukso-profile/index.cjs +10 -9
  25. package/dist/components/lukso-profile/index.js +5 -4
  26. package/dist/components/lukso-progress/index.cjs +10 -9
  27. package/dist/components/lukso-progress/index.js +5 -4
  28. package/dist/components/lukso-sanitize/index.cjs +7 -6
  29. package/dist/components/lukso-sanitize/index.js +3 -2
  30. package/dist/components/lukso-search/index.cjs +105 -55
  31. package/dist/components/lukso-search/index.d.ts +17 -12
  32. package/dist/components/lukso-search/index.d.ts.map +1 -1
  33. package/dist/components/lukso-search/index.js +85 -35
  34. package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
  35. package/dist/components/lukso-share/index.cjs +24 -15
  36. package/dist/components/lukso-share/index.d.ts +8 -2
  37. package/dist/components/lukso-share/index.d.ts.map +1 -1
  38. package/dist/components/lukso-share/index.js +23 -14
  39. package/dist/components/lukso-share/lukso-share.stories.d.ts +5 -1
  40. package/dist/components/lukso-share/lukso-share.stories.d.ts.map +1 -1
  41. package/dist/components/lukso-switch/index.cjs +9 -8
  42. package/dist/components/lukso-switch/index.js +5 -4
  43. package/dist/components/lukso-tag/index.cjs +10 -9
  44. package/dist/components/lukso-tag/index.js +5 -4
  45. package/dist/components/lukso-terms/index.cjs +9 -7
  46. package/dist/components/lukso-terms/index.d.ts.map +1 -1
  47. package/dist/components/lukso-terms/index.js +7 -5
  48. package/dist/components/lukso-test/index.cjs +10 -9
  49. package/dist/components/lukso-test/index.js +4 -3
  50. package/dist/components/lukso-username/index.cjs +16 -15
  51. package/dist/components/lukso-username/index.js +5 -4
  52. package/dist/components/lukso-wizard/index.cjs +10 -9
  53. package/dist/components/lukso-wizard/index.js +5 -4
  54. package/dist/directive-2bb7789e.js +8 -0
  55. package/dist/directive-8278ab14.cjs +12 -0
  56. package/dist/{directive-helpers-1affe406.js → directive-helpers-422da386.js} +1 -1
  57. package/dist/{directive-helpers-e70702eb.cjs → directive-helpers-b2851157.cjs} +1 -1
  58. package/dist/index-5b6b1166.js +59 -0
  59. package/dist/{index-714323c9.js → index-5e194caf.js} +1 -1
  60. package/dist/index-7ef6f8a1.cjs +67 -0
  61. package/dist/{index-7dc05ee5.cjs → index-e9668573.cjs} +2 -2
  62. package/dist/index.cjs +7 -6
  63. package/dist/index.js +7 -6
  64. package/dist/query-assigned-elements-5200f974.cjs +24 -0
  65. package/dist/query-assigned-elements-e36df787.js +21 -0
  66. package/dist/shared/tailwind-element/index.cjs +1 -1
  67. package/dist/shared/tailwind-element/index.js +1 -1
  68. package/dist/{state-7fde94d1.js → state-02a92ffa.js} +1 -1
  69. package/dist/state-51b50a6b.cjs +11 -0
  70. package/dist/{style-map-5173bb70.js → style-map-6cdbbb8b.js} +2 -2
  71. package/dist/style-map-c00f9dd9.cjs +12 -0
  72. package/package.json +1 -1
  73. package/tailwind.config.cjs +1 -0
  74. package/tools/assets/images/social-discord.svg +4 -1
  75. package/tools/assets/images/social-github.svg +11 -1
  76. package/tools/assets/images/social-instagram.svg +6 -1
  77. package/tools/assets/images/social-linkedin.svg +4 -1
  78. package/tools/assets/images/social-medium.svg +6 -1
  79. package/tools/assets/images/social-reddit.svg +11 -1
  80. package/tools/assets/images/social-telegram.svg +4 -1
  81. package/tools/assets/images/social-twitter.svg +4 -1
  82. package/dist/directive-9ec64c08.js +0 -28
  83. package/dist/directive-db00f5fb.cjs +0 -34
  84. package/dist/index-9dfdafd2.js +0 -59
  85. package/dist/index-e765f94b.cjs +0 -67
  86. package/dist/state-a62a7d5d.cjs +0 -11
  87. package/dist/style-map-3a049df9.cjs +0 -12
@@ -2,14 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
- const directive = require('../../directive-db00f5fb.cjs');
7
- const state = require('../../state-a62a7d5d.cjs');
8
- const index = require('../../index-7dc05ee5.cjs');
5
+ const shared_tailwindElement_index = require('../../index-7ef6f8a1.cjs');
6
+ const queryAssignedElements = require('../../query-assigned-elements-5200f974.cjs');
7
+ const state = require('../../state-51b50a6b.cjs');
8
+ const index = require('../../index-e9668573.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-3a049df9.cjs');
12
+ require('../../directive-8278ab14.cjs');
13
+ require('../../style-map-c00f9dd9.cjs');
13
14
 
14
15
  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
16
 
@@ -29,7 +30,6 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
29
30
  super(...arguments);
30
31
  this.value = "";
31
32
  this.name = "";
32
- this.type = "text";
33
33
  this.placeholder = "";
34
34
  this.label = "";
35
35
  this.autocomplete = "off";
@@ -50,6 +50,8 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
50
50
  this.hasFocus = false;
51
51
  this.hasHighlight = false;
52
52
  this.isDebouncing = false;
53
+ this.resultsParsed = [];
54
+ this.searchTerm = "";
53
55
  this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-10
54
56
  border-solid h-[48px] placeholder:text-neutral-70
55
57
  outline-none transition transition-all duration-150 appearance-none rounded-12`;
@@ -58,7 +60,7 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
58
60
  return shared_tailwindElement_index.x`
59
61
  <input
60
62
  name=${this.name}
61
- type=${this.type}
63
+ type="text"
62
64
  .value=${this.value}
63
65
  placeholder=${this.placeholder}
64
66
  ?autofocus=${this.autofocus}
@@ -110,32 +112,61 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
110
112
  }
111
113
  resultsTemplate() {
112
114
  const resultTemplates = [];
113
- if (this.results === "" && !this.showNoResults || this.showNoResults && !this.noResultsText) {
114
- return shared_tailwindElement_index.x``;
115
+ this.resultsParsed = JSON.parse(this.results);
116
+ for (const result of Object.entries(this.resultsParsed)) {
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
+ }
115
124
  }
125
+ return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(resultTemplates)}`;
126
+ }
127
+ noResultsTemplate() {
128
+ return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(
129
+ shared_tailwindElement_index.x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
130
+ ${this.noResultsText}
131
+ </div>`
132
+ )}`;
133
+ }
134
+ loadingTemplate() {
116
135
  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
- }
128
- }
136
+ return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(shared_tailwindElement_index.x`
137
+ <div role="status" class="flex flex-col gap-1">
138
+ <div
139
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
140
+ ></div>
141
+ </div>
142
+ `)}`;
143
+ }
144
+ if (this.resultsParsed.length === 0 || this.resultsParsed.length > 5) {
145
+ return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(shared_tailwindElement_index.x`
146
+ <div role="status" class="flex flex-col gap-1">
147
+ ${[...Array(5)].map(
148
+ () => shared_tailwindElement_index.x`<div
149
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
150
+ ></div>`
151
+ )}
152
+ </div>
153
+ `)}`;
129
154
  }
155
+ return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(shared_tailwindElement_index.x`
156
+ <div role="status" class="flex flex-col gap-1">
157
+ ${this.resultsParsed.map(
158
+ () => shared_tailwindElement_index.x`<div
159
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
160
+ ></div>`
161
+ )}
162
+ </div>
163
+ `)}`;
164
+ }
165
+ dropdownWrapperTemplate(innerTemplate) {
130
166
  return shared_tailwindElement_index.x`<div
131
167
  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"
132
168
  >
133
- ${resultTemplates}
134
- </div>`;
135
- }
136
- resultEmptyTemplate() {
137
- return shared_tailwindElement_index.x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
138
- ${this.noResultsText}
169
+ ${innerTemplate}
139
170
  </div>`;
140
171
  }
141
172
  resultStringTemplate(result) {
@@ -184,11 +215,22 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
184
215
  this.hasHighlight = true;
185
216
  }
186
217
  }
187
- handleBlur() {
218
+ handleBlur(event) {
188
219
  this.hasFocus = false;
189
220
  this.hasHighlight = false;
221
+ const target = event.target;
222
+ const blurEvent = new CustomEvent("on-blur", {
223
+ detail: {
224
+ value: target.value,
225
+ event
226
+ },
227
+ bubbles: false,
228
+ composed: true
229
+ });
230
+ this.dispatchEvent(blurEvent);
190
231
  }
191
232
  searchDebounce(searchTerm) {
233
+ this.value = searchTerm;
192
234
  this.debounceTimer = setTimeout(() => {
193
235
  const changeEvent = new CustomEvent("on-search", {
194
236
  detail: {
@@ -227,80 +269,82 @@ exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.Tai
227
269
  <div class="flex relative items-center">
228
270
  ${this.inputTemplate()}
229
271
  <lukso-icon
230
- name="${this.isSearching || this.isDebouncing ? "spinner" : "search"}"
272
+ name="search"
231
273
  class="absolute right-0 mr-3 ${index.customClassMap({
232
274
  ["opacity-60 cursor-not-allowed"]: this.isDisabled,
233
- ["cursor-not-allowed"]: this.isReadonly,
234
- ["animate-spin"]: this.isSearching || this.isDebouncing
275
+ ["cursor-not-allowed"]: this.isReadonly
235
276
  })}"
236
277
  @mouseenter=${this.handleMouseOver}
237
278
  ></lukso-icon>
238
279
  </div>
239
- ${this.results || this.showNoResults && this.hasFocus ? this.resultsTemplate() : shared_tailwindElement_index.A}
280
+ <!-- results dropdown -->
281
+ ${this.results && !(this.isSearching || this.isDebouncing) ? this.resultsTemplate() : shared_tailwindElement_index.A}
282
+ <!-- no results dropdown -->
283
+ ${this.showNoResults && !(this.isSearching || this.isDebouncing) ? this.noResultsTemplate() : shared_tailwindElement_index.A}
284
+ <!-- loading dropdown -->
285
+ ${this.value && (this.isSearching || this.isDebouncing) ? this.loadingTemplate() : shared_tailwindElement_index.A}
286
+ <!-- error -->
240
287
  ${this.error ? this.errorTemplate() : shared_tailwindElement_index.A}
241
288
  </div>
242
289
  `;
243
290
  }
244
291
  };
245
292
  __decorateClass([
246
- directive.e({ type: String })
293
+ queryAssignedElements.e({ type: String })
247
294
  ], exports.LuksoSearch.prototype, "value", 2);
248
295
  __decorateClass([
249
- directive.e({ type: String })
296
+ queryAssignedElements.e({ type: String })
250
297
  ], exports.LuksoSearch.prototype, "name", 2);
251
298
  __decorateClass([
252
- directive.e({ type: String })
253
- ], exports.LuksoSearch.prototype, "type", 2);
254
- __decorateClass([
255
- directive.e({ type: String })
299
+ queryAssignedElements.e({ type: String })
256
300
  ], exports.LuksoSearch.prototype, "placeholder", 2);
257
301
  __decorateClass([
258
- directive.e({ type: String })
302
+ queryAssignedElements.e({ type: String })
259
303
  ], exports.LuksoSearch.prototype, "label", 2);
260
304
  __decorateClass([
261
- directive.e({ type: String })
305
+ queryAssignedElements.e({ type: String })
262
306
  ], exports.LuksoSearch.prototype, "autocomplete", 2);
263
307
  __decorateClass([
264
- directive.e({ type: String })
308
+ queryAssignedElements.e({ type: String })
265
309
  ], exports.LuksoSearch.prototype, "id", 2);
266
310
  __decorateClass([
267
- directive.e({ type: String })
311
+ queryAssignedElements.e({ type: String })
268
312
  ], exports.LuksoSearch.prototype, "description", 2);
269
313
  __decorateClass([
270
- directive.e({ type: String })
314
+ queryAssignedElements.e({ type: String })
271
315
  ], exports.LuksoSearch.prototype, "error", 2);
272
316
  __decorateClass([
273
- directive.e({ type: String, attribute: "custom-class" })
317
+ queryAssignedElements.e({ type: String, attribute: "custom-class" })
274
318
  ], exports.LuksoSearch.prototype, "customClass", 2);
275
319
  __decorateClass([
276
- directive.e({ type: Boolean, attribute: "is-full-width" })
320
+ queryAssignedElements.e({ type: Boolean, attribute: "is-full-width" })
277
321
  ], exports.LuksoSearch.prototype, "isFullWidth", 2);
278
322
  __decorateClass([
279
- directive.e({ type: Boolean, attribute: "is-readonly" })
323
+ queryAssignedElements.e({ type: Boolean, attribute: "is-readonly" })
280
324
  ], exports.LuksoSearch.prototype, "isReadonly", 2);
281
325
  __decorateClass([
282
- directive.e({ type: Boolean, attribute: "is-disabled" })
326
+ queryAssignedElements.e({ type: Boolean, attribute: "is-disabled" })
283
327
  ], exports.LuksoSearch.prototype, "isDisabled", 2);
284
328
  __decorateClass([
285
- directive.e({ type: Boolean })
329
+ queryAssignedElements.e({ type: Boolean })
286
330
  ], exports.LuksoSearch.prototype, "autofocus", 2);
287
331
  __decorateClass([
288
- directive.e({ type: Boolean })
332
+ queryAssignedElements.e({ type: Boolean })
289
333
  ], exports.LuksoSearch.prototype, "borderless", 2);
290
334
  __decorateClass([
291
- directive.e({ type: String })
335
+ queryAssignedElements.e({ type: String })
292
336
  ], exports.LuksoSearch.prototype, "results", 2);
293
337
  __decorateClass([
294
- directive.e({ type: Number })
338
+ queryAssignedElements.e({ type: Number })
295
339
  ], exports.LuksoSearch.prototype, "debounce", 2);
296
340
  __decorateClass([
297
- directive.e({ type: Boolean, attribute: "is-searching" })
341
+ queryAssignedElements.e({ type: Boolean, attribute: "is-searching" })
298
342
  ], exports.LuksoSearch.prototype, "isSearching", 2);
299
343
  __decorateClass([
300
- directive.e({ type: String, attribute: "no-results-text" })
344
+ queryAssignedElements.e({ type: String, attribute: "no-results-text" })
301
345
  ], exports.LuksoSearch.prototype, "noResultsText", 2);
302
346
  __decorateClass([
303
- directive.e({ type: Boolean, attribute: "show-no-results" })
347
+ queryAssignedElements.e({ type: Boolean, attribute: "show-no-results" })
304
348
  ], exports.LuksoSearch.prototype, "showNoResults", 2);
305
349
  __decorateClass([
306
350
  state.t()
@@ -314,6 +358,12 @@ __decorateClass([
314
358
  __decorateClass([
315
359
  state.t()
316
360
  ], exports.LuksoSearch.prototype, "debounceTimer", 2);
361
+ __decorateClass([
362
+ state.t()
363
+ ], exports.LuksoSearch.prototype, "resultsParsed", 2);
364
+ __decorateClass([
365
+ state.t()
366
+ ], exports.LuksoSearch.prototype, "searchTerm", 2);
317
367
  exports.LuksoSearch = __decorateClass([
318
- directive.e$1("lukso-search")
368
+ queryAssignedElements.e$1("lukso-search")
319
369
  ], exports.LuksoSearch);
@@ -1,18 +1,19 @@
1
+ import { TemplateResult } from 'lit';
1
2
  import { Address } from '../../shared/types';
2
- export type StringResult = {
3
+ export type SearchStringResult = {
3
4
  id?: string;
4
5
  value: string;
5
6
  };
6
- export type ProfileResult = {
7
+ export type SearchProfileResult = {
7
8
  address: Address;
8
9
  image?: string;
9
10
  name?: string;
10
11
  };
12
+ export type SearchResult = SearchStringResult | SearchProfileResult;
11
13
  declare const LuksoSearch_base: typeof import("lit").LitElement;
12
14
  export declare class LuksoSearch extends LuksoSearch_base {
13
15
  value: string;
14
16
  name: string;
15
- type: string;
16
17
  placeholder: string;
17
18
  label: string;
18
19
  autocomplete: string;
@@ -34,15 +35,19 @@ export declare class LuksoSearch extends LuksoSearch_base {
34
35
  private hasHighlight;
35
36
  private isDebouncing;
36
37
  private debounceTimer;
38
+ private resultsParsed;
39
+ private searchTerm;
37
40
  private defaultInputStyles;
38
- inputTemplate(): import("lit").TemplateResult<1>;
39
- labelTemplate(): import("lit").TemplateResult<1>;
40
- descriptionTemplate(): import("lit").TemplateResult<1>;
41
- errorTemplate(): import("lit").TemplateResult<1>;
42
- resultsTemplate(): import("lit").TemplateResult<1>;
43
- resultEmptyTemplate(): import("lit").TemplateResult<1>;
44
- resultStringTemplate(result: StringResult): import("lit").TemplateResult<1>;
45
- resultProfileTemplate(result: ProfileResult): import("lit").TemplateResult<1>;
41
+ inputTemplate(): TemplateResult<1>;
42
+ labelTemplate(): TemplateResult<1>;
43
+ descriptionTemplate(): TemplateResult<1>;
44
+ errorTemplate(): TemplateResult<1>;
45
+ resultsTemplate(): TemplateResult<1>;
46
+ noResultsTemplate(): TemplateResult<1>;
47
+ loadingTemplate(): TemplateResult<1>;
48
+ dropdownWrapperTemplate(innerTemplate: TemplateResult<1> | TemplateResult<1>[]): TemplateResult<1>;
49
+ resultStringTemplate(result: SearchStringResult): TemplateResult<1>;
50
+ resultProfileTemplate(result: SearchProfileResult): TemplateResult<1>;
46
51
  private handleSelect;
47
52
  private handleFocus;
48
53
  private handleBlur;
@@ -50,7 +55,7 @@ export declare class LuksoSearch extends LuksoSearch_base {
50
55
  private handleSearch;
51
56
  private handleMouseOver;
52
57
  private handleMouseOut;
53
- render(): import("lit").TemplateResult<1>;
58
+ render(): TemplateResult<1>;
54
59
  }
55
60
  declare global {
56
61
  interface HTMLElementTagNameMap {
@@ -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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W,CAAA;KAC5B;CACF"}
@@ -1,11 +1,12 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-9dfdafd2.js';
2
- import { e, a as e$1 } from '../../directive-9ec64c08.js';
3
- import { t } from '../../state-7fde94d1.js';
4
- import { c as customClassMap } from '../../index-714323c9.js';
1
+ import { T as TailwindStyledElement, x, A } from '../../index-5b6b1166.js';
2
+ import { e, a as e$1 } from '../../query-assigned-elements-e36df787.js';
3
+ import { t } from '../../state-02a92ffa.js';
4
+ import { c as customClassMap } from '../../index-5e194caf.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-5173bb70.js';
8
+ import '../../directive-2bb7789e.js';
9
+ import '../../style-map-6cdbbb8b.js';
9
10
 
10
11
  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
12
 
@@ -25,7 +26,6 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
25
26
  super(...arguments);
26
27
  this.value = "";
27
28
  this.name = "";
28
- this.type = "text";
29
29
  this.placeholder = "";
30
30
  this.label = "";
31
31
  this.autocomplete = "off";
@@ -46,6 +46,8 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
46
46
  this.hasFocus = false;
47
47
  this.hasHighlight = false;
48
48
  this.isDebouncing = false;
49
+ this.resultsParsed = [];
50
+ this.searchTerm = "";
49
51
  this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-10
50
52
  border-solid h-[48px] placeholder:text-neutral-70
51
53
  outline-none transition transition-all duration-150 appearance-none rounded-12`;
@@ -54,7 +56,7 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
54
56
  return x`
55
57
  <input
56
58
  name=${this.name}
57
- type=${this.type}
59
+ type="text"
58
60
  .value=${this.value}
59
61
  placeholder=${this.placeholder}
60
62
  ?autofocus=${this.autofocus}
@@ -106,32 +108,61 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
106
108
  }
107
109
  resultsTemplate() {
108
110
  const resultTemplates = [];
109
- if (this.results === "" && !this.showNoResults || this.showNoResults && !this.noResultsText) {
110
- return x``;
111
+ this.resultsParsed = JSON.parse(this.results);
112
+ for (const result of Object.entries(this.resultsParsed)) {
113
+ if ("value" in result[1]) {
114
+ resultTemplates.push(this.resultStringTemplate(result[1]));
115
+ } else if ("address" in result[1]) {
116
+ resultTemplates.push(this.resultProfileTemplate(result[1]));
117
+ } else {
118
+ console.error("Unknown result type", result);
119
+ }
111
120
  }
121
+ return x`${this.dropdownWrapperTemplate(resultTemplates)}`;
122
+ }
123
+ noResultsTemplate() {
124
+ return x`${this.dropdownWrapperTemplate(
125
+ x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
126
+ ${this.noResultsText}
127
+ </div>`
128
+ )}`;
129
+ }
130
+ loadingTemplate() {
112
131
  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
- }
124
- }
132
+ return x`${this.dropdownWrapperTemplate(x`
133
+ <div role="status" class="flex flex-col gap-1">
134
+ <div
135
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
136
+ ></div>
137
+ </div>
138
+ `)}`;
139
+ }
140
+ if (this.resultsParsed.length === 0 || this.resultsParsed.length > 5) {
141
+ return x`${this.dropdownWrapperTemplate(x`
142
+ <div role="status" class="flex flex-col gap-1">
143
+ ${[...Array(5)].map(
144
+ () => x`<div
145
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
146
+ ></div>`
147
+ )}
148
+ </div>
149
+ `)}`;
125
150
  }
151
+ return x`${this.dropdownWrapperTemplate(x`
152
+ <div role="status" class="flex flex-col gap-1">
153
+ ${this.resultsParsed.map(
154
+ () => x`<div
155
+ class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
156
+ ></div>`
157
+ )}
158
+ </div>
159
+ `)}`;
160
+ }
161
+ dropdownWrapperTemplate(innerTemplate) {
126
162
  return x`<div
127
163
  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"
128
164
  >
129
- ${resultTemplates}
130
- </div>`;
131
- }
132
- resultEmptyTemplate() {
133
- return x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
134
- ${this.noResultsText}
165
+ ${innerTemplate}
135
166
  </div>`;
136
167
  }
137
168
  resultStringTemplate(result) {
@@ -180,11 +211,22 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
180
211
  this.hasHighlight = true;
181
212
  }
182
213
  }
183
- handleBlur() {
214
+ handleBlur(event) {
184
215
  this.hasFocus = false;
185
216
  this.hasHighlight = false;
217
+ const target = event.target;
218
+ const blurEvent = new CustomEvent("on-blur", {
219
+ detail: {
220
+ value: target.value,
221
+ event
222
+ },
223
+ bubbles: false,
224
+ composed: true
225
+ });
226
+ this.dispatchEvent(blurEvent);
186
227
  }
187
228
  searchDebounce(searchTerm) {
229
+ this.value = searchTerm;
188
230
  this.debounceTimer = setTimeout(() => {
189
231
  const changeEvent = new CustomEvent("on-search", {
190
232
  detail: {
@@ -223,16 +265,21 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
223
265
  <div class="flex relative items-center">
224
266
  ${this.inputTemplate()}
225
267
  <lukso-icon
226
- name="${this.isSearching || this.isDebouncing ? "spinner" : "search"}"
268
+ name="search"
227
269
  class="absolute right-0 mr-3 ${customClassMap({
228
270
  ["opacity-60 cursor-not-allowed"]: this.isDisabled,
229
- ["cursor-not-allowed"]: this.isReadonly,
230
- ["animate-spin"]: this.isSearching || this.isDebouncing
271
+ ["cursor-not-allowed"]: this.isReadonly
231
272
  })}"
232
273
  @mouseenter=${this.handleMouseOver}
233
274
  ></lukso-icon>
234
275
  </div>
235
- ${this.results || this.showNoResults && this.hasFocus ? this.resultsTemplate() : A}
276
+ <!-- results dropdown -->
277
+ ${this.results && !(this.isSearching || this.isDebouncing) ? this.resultsTemplate() : A}
278
+ <!-- no results dropdown -->
279
+ ${this.showNoResults && !(this.isSearching || this.isDebouncing) ? this.noResultsTemplate() : A}
280
+ <!-- loading dropdown -->
281
+ ${this.value && (this.isSearching || this.isDebouncing) ? this.loadingTemplate() : A}
282
+ <!-- error -->
236
283
  ${this.error ? this.errorTemplate() : A}
237
284
  </div>
238
285
  `;
@@ -244,9 +291,6 @@ __decorateClass([
244
291
  __decorateClass([
245
292
  e({ type: String })
246
293
  ], LuksoSearch.prototype, "name", 2);
247
- __decorateClass([
248
- e({ type: String })
249
- ], LuksoSearch.prototype, "type", 2);
250
294
  __decorateClass([
251
295
  e({ type: String })
252
296
  ], LuksoSearch.prototype, "placeholder", 2);
@@ -310,6 +354,12 @@ __decorateClass([
310
354
  __decorateClass([
311
355
  t()
312
356
  ], LuksoSearch.prototype, "debounceTimer", 2);
357
+ __decorateClass([
358
+ t()
359
+ ], LuksoSearch.prototype, "resultsParsed", 2);
360
+ __decorateClass([
361
+ t()
362
+ ], LuksoSearch.prototype, "searchTerm", 2);
313
363
  LuksoSearch = __decorateClass([
314
364
  e$1("lukso-search")
315
365
  ], LuksoSearch);
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-search.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/lukso-search.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAGhD,OAAO,SAAS,CAAA;AAEhB,mHAAmH;AACnH,QAAA,MAAM,IAAI,EAAE,IA6NX,CAAA;AAED,eAAe,IAAI,CAAA;AAyEnB,+CAA+C;AAC/C,eAAO,MAAM,aAAa,KAAoB,CAAA;AAK9C,gDAAgD;AAChD,eAAO,MAAM,aAAa,KAAoB,CAAA;AAqB9C,0FAA0F;AAC1F,eAAO,MAAM,cAAc,KAAoB,CAAA;AAM/C,mJAAmJ;AACnJ,eAAO,MAAM,SAAS,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-search.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/lukso-search.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAGhD,OAAO,SAAS,CAAA;AAEhB,mHAAmH;AACnH,QAAA,MAAM,IAAI,EAAE,IAsOX,CAAA;AAED,eAAe,IAAI,CAAA;AA4EnB,+CAA+C;AAC/C,eAAO,MAAM,aAAa,KAAoB,CAAA;AAM9C,gDAAgD;AAChD,eAAO,MAAM,aAAa,KAAoB,CAAA;AAsB9C,0FAA0F;AAC1F,eAAO,MAAM,cAAc,KAAoB,CAAA;AAQ/C,mJAAmJ;AACnJ,eAAO,MAAM,SAAS,KAAoB,CAAA"}
@@ -2,9 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-e765f94b.cjs');
6
- const directive = require('../../directive-db00f5fb.cjs');
7
- const index = require('../../index-7dc05ee5.cjs');
5
+ const shared_tailwindElement_index = require('../../index-7ef6f8a1.cjs');
6
+ const queryAssignedElements = require('../../query-assigned-elements-5200f974.cjs');
8
7
 
9
8
  const style = ":host {\n display: inline-flex\n}";
10
9
 
@@ -22,7 +21,17 @@ var __decorateClass = (decorators, target, key, kind) => {
22
21
  exports.LuksoShare = class LuksoShare extends shared_tailwindElement_index.TailwindStyledElement(style) {
23
22
  constructor() {
24
23
  super(...arguments);
25
- this.customClass = "";
24
+ this.customStyle = "";
25
+ this.providers = [
26
+ "twitter",
27
+ "instagram",
28
+ "linkedin",
29
+ "telegram",
30
+ "discord",
31
+ "reddit",
32
+ "medium",
33
+ "github"
34
+ ];
26
35
  this.urls = {
27
36
  twitter: "https://twitter.com/lukso_io",
28
37
  instagram: "https://www.instagram.com/lukso",
@@ -38,29 +47,29 @@ exports.LuksoShare = class LuksoShare extends shared_tailwindElement_index.Tailw
38
47
  return shared_tailwindElement_index.x`<a
39
48
  href=${url}
40
49
  target="_blank"
41
- class="transition-all duration-300 rounded-full hover:opacity-80 hover:shadow-button-hover-primary"
50
+ class="transition-all duration-300 rounded-full opacity-50 hover:opacity-80 hover:shadow-button-hover-primary h-7 w-7"
42
51
  ><img src="/assets/images/social-${name}.svg" alt=""
43
52
  /></a>`;
44
53
  }
45
54
  render() {
46
55
  const linkTemplates = [];
47
- for (const i of Object.keys(this.urls)) {
48
- linkTemplates.push(this.linkTemplate(i, this.urls[i]));
56
+ for (const provider of this.providers) {
57
+ linkTemplates.push(this.linkTemplate(provider, this.urls[provider]));
49
58
  }
50
59
  return shared_tailwindElement_index.x`<div
51
- class="grid gap-4 grid-cols-[repeat(4,max-content)] sm:grid-cols-[repeat(8,max-content)] ${index.customClassMap(
52
- {
53
- [this.customClass]: !!this.customClass
54
- }
55
- )}"
60
+ class="grid gap-2 sm:gap-4"
61
+ style="grid-template-columns: repeat(${this.providers.length}, max-content); ${this.customStyle}"
56
62
  >
57
63
  ${linkTemplates}
58
64
  </div>`;
59
65
  }
60
66
  };
61
67
  __decorateClass([
62
- directive.e({ type: String, attribute: "custom-class" })
63
- ], exports.LuksoShare.prototype, "customClass", 2);
68
+ queryAssignedElements.e({ type: String, attribute: "custom-style" })
69
+ ], exports.LuksoShare.prototype, "customStyle", 2);
70
+ __decorateClass([
71
+ queryAssignedElements.e({ type: Array })
72
+ ], exports.LuksoShare.prototype, "providers", 2);
64
73
  exports.LuksoShare = __decorateClass([
65
- directive.e$1("lukso-share")
74
+ queryAssignedElements.e$1("lukso-share")
66
75
  ], exports.LuksoShare);
@@ -1,8 +1,14 @@
1
+ export type Provider = 'twitter' | 'instagram' | 'linkedin' | 'telegram' | 'discord' | 'reddit' | 'medium' | 'github';
2
+ export type Url = `https://${string}`;
3
+ export type ProviderLinks = {
4
+ [key in Provider]: Url;
5
+ };
1
6
  declare const LuksoShare_base: typeof import("lit").LitElement;
2
7
  export declare class LuksoShare extends LuksoShare_base {
3
- customClass: string;
8
+ customStyle: string;
9
+ providers: Provider[];
4
10
  private urls;
5
- linkTemplate(name: string, url: string): import("lit").TemplateResult<1>;
11
+ linkTemplate(name: Provider, url: Url): import("lit").TemplateResult<1>;
6
12
  render(): import("lit").TemplateResult<1>;
7
13
  }
8
14
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/index.ts"],"names":[],"mappings":";AAOA,qBACa,UAAW,SAAQ,eAA4B;IAE1D,WAAW,SAAK;IAEhB,OAAO,CAAC,IAAI,CASX;IAED,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAStC,MAAM;CAgBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAA;KAC1B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/index.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,MAAM,GAAG,GAAG,WAAW,MAAM,EAAE,CAAA;AAErC,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,QAAQ,GAAG,GAAG;CACvB,CAAA;;AAED,qBACa,UAAW,SAAQ,eAA4B;IAE1D,WAAW,SAAK;IAGhB,SAAS,EAAE,QAAQ,EAAE,CASpB;IAED,OAAO,CAAC,IAAI,CASX;IAED,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG;IASrC,MAAM;CAeP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAA;KAC1B;CACF"}