@lukso/web-components 1.72.0 → 1.74.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 (84) 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.d.ts +2 -2
  5. package/dist/components/lukso-button/index.d.ts.map +1 -1
  6. package/dist/components/lukso-button/index.js +1 -1
  7. package/dist/components/lukso-card/index.cjs +3 -3
  8. package/dist/components/lukso-card/index.js +3 -3
  9. package/dist/components/lukso-checkbox/index.cjs +1 -1
  10. package/dist/components/lukso-checkbox/index.js +1 -1
  11. package/dist/components/lukso-footer/index.cjs +1 -1
  12. package/dist/components/lukso-footer/index.js +1 -1
  13. package/dist/components/lukso-icon/icons/database.d.ts +3 -0
  14. package/dist/components/lukso-icon/icons/database.d.ts.map +1 -0
  15. package/dist/components/lukso-icon/icons/empty-outline.d.ts +3 -0
  16. package/dist/components/lukso-icon/icons/empty-outline.d.ts.map +1 -0
  17. package/dist/components/lukso-icon/index.cjs +61 -3
  18. package/dist/components/lukso-icon/index.d.ts.map +1 -1
  19. package/dist/components/lukso-icon/index.js +61 -3
  20. package/dist/components/lukso-image/index.cjs +2 -2
  21. package/dist/components/lukso-image/index.js +2 -2
  22. package/dist/components/lukso-input/index.cjs +170 -43
  23. package/dist/components/lukso-input/index.d.ts +11 -6
  24. package/dist/components/lukso-input/index.d.ts.map +1 -1
  25. package/dist/components/lukso-input/index.js +170 -43
  26. package/dist/components/lukso-input/lukso-input.stories.d.ts +5 -1
  27. package/dist/components/lukso-input/lukso-input.stories.d.ts.map +1 -1
  28. package/dist/components/lukso-modal/index.cjs +1 -1
  29. package/dist/components/lukso-modal/index.js +1 -1
  30. package/dist/components/lukso-navbar/index.cjs +3 -3
  31. package/dist/components/lukso-navbar/index.js +3 -3
  32. package/dist/components/lukso-profile/index.cjs +2 -2
  33. package/dist/components/lukso-profile/index.js +2 -2
  34. package/dist/components/lukso-progress/index.cjs +2 -2
  35. package/dist/components/lukso-progress/index.js +2 -2
  36. package/dist/components/lukso-sanitize/index.cjs +1 -1
  37. package/dist/components/lukso-sanitize/index.js +1 -1
  38. package/dist/components/lukso-search/index.cjs +105 -139
  39. package/dist/components/lukso-search/index.d.ts +6 -12
  40. package/dist/components/lukso-search/index.d.ts.map +1 -1
  41. package/dist/components/lukso-search/index.js +101 -135
  42. package/dist/components/lukso-search/lukso-search.stories.d.ts +2 -0
  43. package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
  44. package/dist/components/lukso-select/index.cjs +234 -45
  45. package/dist/components/lukso-select/index.d.ts +18 -5
  46. package/dist/components/lukso-select/index.d.ts.map +1 -1
  47. package/dist/components/lukso-select/index.js +234 -45
  48. package/dist/components/lukso-select/lukso-select.stories.d.ts +12 -0
  49. package/dist/components/lukso-select/lukso-select.stories.d.ts.map +1 -1
  50. package/dist/components/lukso-share/index.cjs +1 -1
  51. package/dist/components/lukso-share/index.js +1 -1
  52. package/dist/components/lukso-switch/index.cjs +2 -2
  53. package/dist/components/lukso-switch/index.js +2 -2
  54. package/dist/components/lukso-tag/index.cjs +2 -2
  55. package/dist/components/lukso-tag/index.js +2 -2
  56. package/dist/components/lukso-terms/index.cjs +2 -2
  57. package/dist/components/lukso-terms/index.js +2 -2
  58. package/dist/components/lukso-test/index.cjs +1 -1
  59. package/dist/components/lukso-test/index.js +1 -1
  60. package/dist/components/lukso-tooltip/index.cjs +2 -2
  61. package/dist/components/lukso-tooltip/index.js +2 -2
  62. package/dist/components/lukso-username/index.cjs +2 -2
  63. package/dist/components/lukso-username/index.js +2 -2
  64. package/dist/components/lukso-wizard/index.cjs +1 -1
  65. package/dist/components/lukso-wizard/index.js +1 -1
  66. package/dist/index-09db75ee.js +39 -0
  67. package/dist/index-9b930f6a.cjs +46 -0
  68. package/dist/{index-59f199b0.cjs → index-a1e4b7d4.cjs} +1 -1
  69. package/dist/{index-8c727f4c.js → index-dfdfb6fe.js} +1 -1
  70. package/dist/index.cjs +3 -3
  71. package/dist/index.js +3 -3
  72. package/dist/shared/tailwind-element/index.cjs +1 -1
  73. package/dist/shared/tailwind-element/index.js +1 -1
  74. package/dist/shared/types.d.ts +1 -0
  75. package/dist/shared/types.d.ts.map +1 -1
  76. package/dist/{style-map-c66282ea.js → style-map-3669b30c.js} +1 -1
  77. package/dist/{style-map-6337084a.cjs → style-map-ebf3a8d2.cjs} +1 -1
  78. package/dist/styles/main.css +3 -0
  79. package/dist/styles/main.css.map +1 -1
  80. package/package.json +3 -2
  81. package/tools/sass/typography.scss +4 -0
  82. package/tools/styles/main.css +3 -0
  83. package/dist/index-25503efb.cjs +0 -46
  84. package/dist/index-bf6e0a1d.js +0 -39
@@ -1,16 +1,19 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-bf6e0a1d.js';
1
+ import { T as TailwindStyledElement, x, A } from '../../index-09db75ee.js';
2
2
  import { n, e } from '../../query-assigned-elements-1c8c9e90.js';
3
3
  import { t } from '../../state-b9ca4e74.js';
4
- import { c as customClassMap } from '../../index-5e194caf.js';
4
+ import { c as ce } from '../../index-ca8e900d.js';
5
5
  import '../lukso-icon/index.js';
6
6
  import '../lukso-profile/index.js';
7
7
  import '../lukso-username/index.js';
8
- import '../../directive-2bb7789e.js';
9
- import '../../style-map-c66282ea.js';
10
- import '../../index-ca8e900d.js';
8
+ import '../lukso-input/index.js';
11
9
  import '../../bundle-mjs-fbc6e2a8.js';
10
+ import '../../style-map-3669b30c.js';
11
+ import '../../directive-2bb7789e.js';
12
12
  import '../lukso-image/index.js';
13
- import '../../index-8c727f4c.js';
13
+ import '../../index-5e194caf.js';
14
+ import '../../index-dfdfb6fe.js';
15
+ import '../../tailwind-config.js';
16
+ import '../../cn-b54dcc61.js';
14
17
 
15
18
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
16
19
 
@@ -47,15 +50,54 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
47
50
  this.isSearching = false;
48
51
  this.noResultsText = "";
49
52
  this.showNoResults = false;
53
+ this.hideLoading = false;
50
54
  this.selected = void 0;
51
- this.hasFocus = false;
52
- this.hasHighlight = false;
55
+ this.size = "medium";
53
56
  this.isDebouncing = false;
54
57
  this.resultsParsed = [];
55
58
  this.searchTerm = "";
56
- this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-10
57
- border-solid h-[48px] placeholder:text-neutral-70
58
- outline-none transition transition-all duration-150 appearance-none rounded-12`;
59
+ this.inputStyles = ce({
60
+ slots: {
61
+ dropdownWrapper: "bg-neutral-100 border border-neutral-90 shadow-1xl z-50 flex absolute w-full flex-col gap-1 overflow-y-auto max-h-64",
62
+ loading: "bg-neutral-95 w-full animate-pulse animation-delay-none"
63
+ },
64
+ variants: {
65
+ size: {
66
+ small: {
67
+ dropdownWrapper: "rounded-8 p-2 mt-1",
68
+ loading: "h-7 rounded-4"
69
+ },
70
+ medium: {
71
+ dropdownWrapper: "rounded-12 p-3 mt-2",
72
+ loading: "h-10 rounded-8"
73
+ }
74
+ }
75
+ }
76
+ });
77
+ this.resultStyles = ce({
78
+ slots: {
79
+ resultString: "text-neutral-20 cursor-pointer hover:bg-neutral-98",
80
+ resultProfile: "cursor-pointer hover:bg-neutral-98 flex gap-2 items-center"
81
+ },
82
+ variants: {
83
+ selected: {
84
+ true: {
85
+ resultString: "bg-neutral-98",
86
+ resultProfile: "bg-neutral-98"
87
+ }
88
+ },
89
+ size: {
90
+ small: {
91
+ resultString: "paragraph-inter-12-regular rounded-4 py-1 px-2",
92
+ resultProfile: "rounded-4 py-1 px-2"
93
+ },
94
+ medium: {
95
+ resultString: "paragraph-inter-14-regular rounded-8 p-2",
96
+ resultProfile: "rounded-8 p-2"
97
+ }
98
+ }
99
+ }
100
+ });
59
101
  }
60
102
  connectedCallback() {
61
103
  super.connectedCallback();
@@ -84,62 +126,6 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
84
126
  }
85
127
  }
86
128
  }
87
- inputTemplate() {
88
- return x`
89
- <input
90
- name=${this.name}
91
- type="text"
92
- .value=${this.value}
93
- placeholder=${this.placeholder}
94
- ?autofocus=${this.autofocus}
95
- autocomplete=${this.autocomplete}
96
- id=${this.id || this.name}
97
- data-testid=${this.name ? `input-${this.name}` : "input"}
98
- data-component="lukso-search"
99
- ?readonly=${this.isReadonly ? true : void 0}
100
- ?disabled=${this.isDisabled ? true : void 0}
101
- class=${customClassMap({
102
- [this.defaultInputStyles]: true,
103
- [this.error === "" ? "border-neutral-90" : "border-red-85"]: !this.hasHighlight,
104
- [this.error === "" ? "border-neutral-35" : "border-red-65"]: this.hasHighlight,
105
- ["w-full"]: this.isFullWidth,
106
- ["w-[350px]"]: !this.isFullWidth,
107
- ["cursor-not-allowed text-neutral-60"]: this.isDisabled,
108
- ["text-neutral-20"]: !this.isDisabled,
109
- ["cursor-not-allowed"]: this.isReadonly,
110
- [this.customClass]: !!this.customClass,
111
- [this.borderless ? "border-0" : "border"]: true
112
- })}
113
- @focus=${this.handleFocus}
114
- @input=${this.handleSearch}
115
- @blur=${this.handleBlur}
116
- @click=${this.handleInputClick}
117
- @mouseenter=${this.handleMouseOver}
118
- @mouseleave=${this.handleMouseOut}
119
- />
120
- `;
121
- }
122
- labelTemplate() {
123
- return x`
124
- <label
125
- for=${this.name}
126
- class="heading-inter-14-bold text-neutral-20 pb-2 block"
127
- >${this.label}</label
128
- >
129
- `;
130
- }
131
- descriptionTemplate() {
132
- return x`
133
- <div class="paragraph-inter-12-regular text-neutral-20 pb-2">
134
- ${this.description ?? A}
135
- </div>
136
- `;
137
- }
138
- errorTemplate() {
139
- return x`<div class="paragraph-inter-12-regular text-red-65 pt-2">
140
- ${this.error}
141
- </div>`;
142
- }
143
129
  resultsTemplate() {
144
130
  const resultTemplates = [];
145
131
  this.resultsParsed = JSON.parse(this.results);
@@ -163,66 +149,58 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
163
149
  )}`;
164
150
  }
165
151
  loadingTemplate() {
152
+ const { loading } = this.inputStyles({
153
+ size: this.size
154
+ });
166
155
  if (this.showNoResults) {
167
156
  return x`${this.dropdownWrapperTemplate(x`
168
157
  <div role="status" class="flex flex-col gap-1">
169
- <div
170
- class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
171
- ></div>
158
+ <div class=${loading()}></div>
172
159
  </div>
173
160
  `)}`;
174
161
  }
175
162
  if (this.resultsParsed.length === 0 || this.resultsParsed.length > 5) {
176
163
  return x`${this.dropdownWrapperTemplate(x`
177
164
  <div role="status" class="flex flex-col gap-1">
178
- ${[...Array(5)].map(
179
- () => x`<div
180
- class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
181
- ></div>`
182
- )}
165
+ ${[...Array(5)].map(() => x`<div class=${loading()}></div>`)}
183
166
  </div>
184
167
  `)}`;
185
168
  }
186
169
  return x`${this.dropdownWrapperTemplate(x`
187
170
  <div role="status" class="flex flex-col gap-1">
188
- ${this.resultsParsed.map(
189
- () => x`<div
190
- class="h-10 bg-neutral-95 w-full rounded-8 animate-pulse animation-delay-none"
191
- ></div>`
192
- )}
171
+ ${this.resultsParsed.map(() => x`<div class=${loading()}></div>`)}
193
172
  </div>
194
173
  `)}`;
195
174
  }
196
175
  dropdownWrapperTemplate(innerTemplate) {
197
- return x`<div
198
- 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"
199
- >
200
- ${innerTemplate}
201
- </div>`;
176
+ const { dropdownWrapper } = this.inputStyles({
177
+ size: this.size
178
+ });
179
+ return x`<div class=${dropdownWrapper()}>${innerTemplate}</div>`;
202
180
  }
203
181
  resultStringTemplate(result, index) {
182
+ const { resultString } = this.resultStyles({
183
+ selected: this.selected === index + 1,
184
+ size: this.size
185
+ });
204
186
  return x`<div
205
187
  data-id="${result.id}"
206
188
  data-index="${index + 1}"
207
- class="paragraph-inter-14-regular text-neutral-20 cursor-pointer hover:bg-neutral-98 rounded-8 p-2 ${customClassMap(
208
- {
209
- ["bg-neutral-98"]: this.selected === index + 1
210
- }
211
- )}"
189
+ class=${resultString()}
212
190
  @click=${() => this.handleSelect(result)}
213
191
  >
214
192
  ${result.value}
215
193
  </div>`;
216
194
  }
217
195
  resultProfileTemplate(result, index) {
196
+ const { resultProfile } = this.resultStyles({
197
+ selected: this.selected === index + 1,
198
+ size: this.size
199
+ });
218
200
  return x`<div
219
201
  data-id="${result.address}"
220
202
  data-index="${index + 1}"
221
- class="cursor-pointer hover:bg-neutral-98 rounded-8 p-2 flex gap-2 items-center ${customClassMap(
222
- {
223
- ["bg-neutral-98"]: this.selected === index + 1
224
- }
225
- )}"
203
+ class=${resultProfile()}
226
204
  @click=${() => this.handleSelect(result)}
227
205
  >
228
206
  <lukso-profile
@@ -281,16 +259,8 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
281
259
  });
282
260
  this.dispatchEvent(selectEvent);
283
261
  }
284
- handleFocus() {
285
- if (!this.isReadonly && !this.isDisabled) {
286
- this.hasFocus = true;
287
- this.hasHighlight = true;
288
- }
289
- }
290
262
  async handleBlur(event) {
291
263
  await this.updateComplete;
292
- this.hasFocus = false;
293
- this.hasHighlight = false;
294
264
  const target = event.target;
295
265
  const blurEvent = new CustomEvent("on-blur", {
296
266
  detail: {
@@ -313,7 +283,6 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
313
283
  bubbles: false,
314
284
  composed: true
315
285
  });
316
- this.handleSearch(event);
317
286
  this.dispatchEvent(clickEvent);
318
287
  }
319
288
  async searchDebounce(searchTerm) {
@@ -339,40 +308,37 @@ let LuksoSearch = class extends TailwindStyledElement(style) {
339
308
  const target = event.target;
340
309
  this.searchDebounce(target.value);
341
310
  }
342
- handleMouseOver() {
343
- if (!this.isReadonly && !this.isDisabled) {
344
- this.hasHighlight = true;
345
- }
346
- }
347
- handleMouseOut() {
348
- if (!this.hasFocus) {
349
- this.hasHighlight = false;
350
- }
351
- }
352
311
  render() {
353
312
  return x`
354
313
  <div class="relative w-full">
355
- ${this.label ? this.labelTemplate() : A}
356
- ${this.description ? this.descriptionTemplate() : A}
357
- <div class="flex relative items-center">
358
- ${this.inputTemplate()}
359
- <lukso-icon
360
- name="search"
361
- class="absolute right-0 mr-3 ${customClassMap({
362
- ["opacity-60 cursor-not-allowed"]: this.isDisabled,
363
- ["cursor-not-allowed"]: this.isReadonly
364
- })}"
365
- @mouseenter=${this.handleMouseOver}
366
- ></lukso-icon>
367
- </div>
314
+ <lukso-input
315
+ name=${this.name}
316
+ type="text"
317
+ value=${this.value}
318
+ placeholder=${this.placeholder}
319
+ autocomplete=${this.autocomplete}
320
+ label=${this.label}
321
+ description=${this.description}
322
+ error=${this.error}
323
+ custom-class=${this.customClass}
324
+ id=${this.id}
325
+ size=${this.size}
326
+ data-component="lukso-search"
327
+ right-icon="search"
328
+ ?autofocus=${this.autofocus}
329
+ ?readonly=${this.isReadonly}
330
+ ?disabled=${this.isDisabled}
331
+ ?is-full-width=${this.isFullWidth}
332
+ @on-input=${this.handleSearch}
333
+ @on-blur=${this.handleBlur}
334
+ @on-input-click=${this.handleInputClick}
335
+ ></lukso-input>
368
336
  <!-- results dropdown -->
369
337
  ${this.results && !(this.isSearching || this.isDebouncing) ? this.resultsTemplate() : A}
370
338
  <!-- no results dropdown -->
371
339
  ${this.showNoResults && !(this.isSearching || this.isDebouncing) ? this.noResultsTemplate() : A}
372
340
  <!-- loading dropdown -->
373
- ${this.value && (this.isSearching || this.isDebouncing) ? this.loadingTemplate() : A}
374
- <!-- error -->
375
- ${this.error ? this.errorTemplate() : A}
341
+ ${!this.hideLoading && this.value && (this.isSearching || this.isDebouncing) ? this.loadingTemplate() : A}
376
342
  </div>
377
343
  `;
378
344
  }
@@ -434,15 +400,15 @@ __decorateClass([
434
400
  __decorateClass([
435
401
  n({ type: Boolean, attribute: "show-no-results" })
436
402
  ], LuksoSearch.prototype, "showNoResults", 2);
403
+ __decorateClass([
404
+ n({ type: Boolean, attribute: "hide-loading" })
405
+ ], LuksoSearch.prototype, "hideLoading", 2);
437
406
  __decorateClass([
438
407
  n({ type: Number })
439
408
  ], LuksoSearch.prototype, "selected", 2);
440
409
  __decorateClass([
441
- t()
442
- ], LuksoSearch.prototype, "hasFocus", 2);
443
- __decorateClass([
444
- t()
445
- ], LuksoSearch.prototype, "hasHighlight", 2);
410
+ n({ type: String })
411
+ ], LuksoSearch.prototype, "size", 2);
446
412
  __decorateClass([
447
413
  t()
448
414
  ], LuksoSearch.prototype, "isDebouncing", 2);
@@ -12,4 +12,6 @@ export declare const SearchingState: any;
12
12
  export declare const NoResults: any;
13
13
  /** Example of selected option. */
14
14
  export declare const SelectedOption: any;
15
+ /** Example of small search. */
16
+ export declare const Small: any;
15
17
  //# sourceMappingURL=lukso-search.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-search.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/lukso-search.stories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,SAAS,CAAA;AAEhB,mHAAmH;AACnH,QAAA,MAAM,IAAI,EAAE,IA6OX,CAAA;AAED,eAAe,IAAI,CAAA;AA8EnB,+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;AAQ1C,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-search.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-search/lukso-search.stories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,SAAS,CAAA;AAEhB,mHAAmH;AACnH,QAAA,MAAM,IAAI,EAAE,IA4QX,CAAA;AAED,eAAe,IAAI,CAAA;AAoFnB,+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;AAQ1C,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAoB,CAAA;AAM/C,gCAAgC;AAChC,eAAO,MAAM,KAAK,KAAoB,CAAA"}