@lukso/web-components 1.140.0 → 1.141.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.
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/lukso-search/index.cjs +11 -645
- package/dist/components/lukso-search/index.d.ts +4 -1
- package/dist/components/lukso-search/index.d.ts.map +1 -1
- package/dist/components/lukso-search/index.js +7 -650
- package/dist/index-9fZwHYlC.js +680 -0
- package/dist/index-BV3Zii44.cjs +683 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ const components_luksoProgress_index = require('./lukso-progress/index.cjs');
|
|
|
20
20
|
const components_luksoRadio_index = require('./lukso-radio/index.cjs');
|
|
21
21
|
const components_luksoRadioGroup_index = require('./lukso-radio-group/index.cjs');
|
|
22
22
|
const components_luksoSanitize_index = require('./lukso-sanitize/index.cjs');
|
|
23
|
-
const components_luksoSearch_index = require('
|
|
23
|
+
const components_luksoSearch_index = require('../index-BV3Zii44.cjs');
|
|
24
24
|
const components_luksoSelect_index = require('./lukso-select/index.cjs');
|
|
25
25
|
const components_luksoShare_index = require('./lukso-share/index.cjs');
|
|
26
26
|
const components_luksoSwitch_index = require('./lukso-switch/index.cjs');
|
package/dist/components/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { LuksoProgress } from './lukso-progress/index.js';
|
|
|
16
16
|
export { LuksoRadio } from './lukso-radio/index.js';
|
|
17
17
|
export { LuksoRadioGroup } from './lukso-radio-group/index.js';
|
|
18
18
|
export { LuksoSanitize } from './lukso-sanitize/index.js';
|
|
19
|
-
export { LuksoSearch } from '
|
|
19
|
+
export { L as LuksoSearch } from '../index-9fZwHYlC.js';
|
|
20
20
|
export { LuksoSelect } from './lukso-select/index.js';
|
|
21
21
|
export { LuksoShare } from './lukso-share/index.js';
|
|
22
22
|
export { LuksoSwitch } from './lukso-switch/index.js';
|
|
@@ -2,658 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
require('../../index-DwjA8HMW.cjs');
|
|
6
|
+
require('../../index--Y2FvB_K.cjs');
|
|
7
|
+
require('../../property-TRLHk6Mn.cjs');
|
|
8
|
+
require('../../state-B2DTtxFU.cjs');
|
|
9
|
+
require('../../index-CaJky2qL.cjs');
|
|
10
10
|
require('../lukso-dropdown/index.cjs');
|
|
11
11
|
require('../lukso-dropdown-option/index.cjs');
|
|
12
12
|
require('../lukso-icon/index.cjs');
|
|
13
13
|
require('../lukso-input/index.cjs');
|
|
14
14
|
require('../lukso-tag/index.cjs');
|
|
15
|
-
|
|
15
|
+
require('../../index-DKZtrJ1S.cjs');
|
|
16
16
|
require('../../tailwind-config.cjs');
|
|
17
17
|
require('../../cn-CNdKneQ1.cjs');
|
|
18
|
+
const components_luksoSearch_index = require('../../index-BV3Zii44.cjs');
|
|
18
19
|
|
|
19
|
-
const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
|
|
20
20
|
|
|
21
|
-
var STANDARDS = /* @__PURE__ */ ((STANDARDS2) => {
|
|
22
|
-
STANDARDS2["EOA"] = "EOA";
|
|
23
|
-
STANDARDS2["LSP3"] = "LSP0ERC725Account";
|
|
24
|
-
STANDARDS2["LSP7"] = "LSP7DigitalAsset";
|
|
25
|
-
STANDARDS2["LSP8"] = "LSP8IdentifiableDigitalAsset";
|
|
26
|
-
STANDARDS2["UNKNOWN"] = "UnknownContract";
|
|
27
|
-
return STANDARDS2;
|
|
28
|
-
})(STANDARDS || {});
|
|
29
|
-
var SEARCH_RESULT_TYPES = /* @__PURE__ */ ((SEARCH_RESULT_TYPES2) => {
|
|
30
|
-
SEARCH_RESULT_TYPES2["STRING"] = "string";
|
|
31
|
-
SEARCH_RESULT_TYPES2["PROFILE"] = "profile";
|
|
32
|
-
SEARCH_RESULT_TYPES2["ASSET"] = "asset";
|
|
33
|
-
SEARCH_RESULT_TYPES2["APP"] = "app";
|
|
34
|
-
SEARCH_RESULT_TYPES2["UNIVERSAL_NAME"] = "universal-name";
|
|
35
|
-
return SEARCH_RESULT_TYPES2;
|
|
36
|
-
})(SEARCH_RESULT_TYPES || {});
|
|
37
21
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
43
|
-
if (decorator = decorators[i])
|
|
44
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
45
|
-
if (kind && result) __defProp(target, key, result);
|
|
46
|
-
return result;
|
|
47
|
-
};
|
|
48
|
-
exports.LuksoSearch = class LuksoSearch extends shared_tailwindElement_index.TailwindStyledElement(style) {
|
|
49
|
-
constructor() {
|
|
50
|
-
super(...arguments);
|
|
51
|
-
this.value = "";
|
|
52
|
-
this.name = "";
|
|
53
|
-
this.placeholder = "";
|
|
54
|
-
this.label = "";
|
|
55
|
-
this.groupLabels = JSON.stringify({
|
|
56
|
-
[SEARCH_RESULT_TYPES.UNIVERSAL_NAME]: "Universal Names",
|
|
57
|
-
[SEARCH_RESULT_TYPES.PROFILE]: "Profiles",
|
|
58
|
-
[SEARCH_RESULT_TYPES.ASSET]: "Assets",
|
|
59
|
-
[SEARCH_RESULT_TYPES.APP]: "Apps",
|
|
60
|
-
[SEARCH_RESULT_TYPES.STRING]: "Other"
|
|
61
|
-
});
|
|
62
|
-
this.availableText = "Available";
|
|
63
|
-
this.unavailableText = "Registered";
|
|
64
|
-
this.autocomplete = "off";
|
|
65
|
-
this.id = "";
|
|
66
|
-
this.description = "";
|
|
67
|
-
this.error = "";
|
|
68
|
-
this.customClass = "";
|
|
69
|
-
this.isFullWidth = false;
|
|
70
|
-
this.isReadonly = false;
|
|
71
|
-
this.isDisabled = false;
|
|
72
|
-
this.autofocus = false;
|
|
73
|
-
this.borderless = false;
|
|
74
|
-
this.results = "";
|
|
75
|
-
this.rightIcon = "search";
|
|
76
|
-
this.debounce = 700;
|
|
77
|
-
this.isSearching = false;
|
|
78
|
-
this.noResultsText = "";
|
|
79
|
-
this.showNoResults = false;
|
|
80
|
-
this.hideLoading = false;
|
|
81
|
-
this.hasReset = false;
|
|
82
|
-
this.keepValueOnEscapeHit = false;
|
|
83
|
-
this.selected = void 0;
|
|
84
|
-
this.size = "large";
|
|
85
|
-
this.maxHeight = void 0;
|
|
86
|
-
this.isDebouncing = false;
|
|
87
|
-
this.resultsParsed = [];
|
|
88
|
-
this.styles = index.ce({
|
|
89
|
-
slots: {
|
|
90
|
-
loading: "bg-neutral-95 w-full animate-pulse animation-delay-none"
|
|
91
|
-
},
|
|
92
|
-
variants: {
|
|
93
|
-
size: {
|
|
94
|
-
small: {
|
|
95
|
-
loading: "h-7 rounded-4"
|
|
96
|
-
},
|
|
97
|
-
medium: {
|
|
98
|
-
loading: "h-10 rounded-8"
|
|
99
|
-
},
|
|
100
|
-
large: {
|
|
101
|
-
loading: "h-10 rounded-8"
|
|
102
|
-
},
|
|
103
|
-
"x-large": {
|
|
104
|
-
loading: "h-12 rounded-8"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
connectedCallback() {
|
|
111
|
-
super.connectedCallback();
|
|
112
|
-
window.addEventListener("click", this.handleOutsideDropdownClick.bind(this));
|
|
113
|
-
window.addEventListener("keydown", this.handleDropdownKeydown.bind(this));
|
|
114
|
-
}
|
|
115
|
-
disconnectedCallback() {
|
|
116
|
-
super.disconnectedCallback();
|
|
117
|
-
window.removeEventListener("click", this.handleOutsideDropdownClick);
|
|
118
|
-
window.removeEventListener("keydown", this.handleDropdownKeydown);
|
|
119
|
-
}
|
|
120
|
-
willUpdate(changedProperties) {
|
|
121
|
-
if (changedProperties.has("selected")) {
|
|
122
|
-
const selectedOption = this.shadowRoot?.querySelector(
|
|
123
|
-
`[data-index="${changedProperties.get("selected")}"`
|
|
124
|
-
);
|
|
125
|
-
if (selectedOption) {
|
|
126
|
-
if ("scrollIntoViewIfNeeded" in selectedOption && typeof selectedOption.scrollIntoViewIfNeeded === "function") {
|
|
127
|
-
selectedOption.scrollIntoViewIfNeeded();
|
|
128
|
-
} else {
|
|
129
|
-
selectedOption.scrollIntoView({
|
|
130
|
-
behavior: "smooth",
|
|
131
|
-
block: "center"
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
sizeDropdown() {
|
|
138
|
-
const dropdownSize = this.size === "large" || this.size === "x-large" ? "medium" : this.size;
|
|
139
|
-
return dropdownSize;
|
|
140
|
-
}
|
|
141
|
-
resultsTemplate() {
|
|
142
|
-
const resultTemplates = [];
|
|
143
|
-
this.resultsParsed = JSON.parse(this.results);
|
|
144
|
-
const groupLabelsParsed = JSON.parse(this.groupLabels);
|
|
145
|
-
const types = this.resultsParsed.map((r) => r.type);
|
|
146
|
-
const isMixedTypes = new Set(types).size > 1;
|
|
147
|
-
for (const result of Object.entries(this.resultsParsed)) {
|
|
148
|
-
const index = Number(result[0]);
|
|
149
|
-
if (isMixedTypes) {
|
|
150
|
-
const currentType = result[1].type;
|
|
151
|
-
const prevType = index > 0 ? this.resultsParsed[index - 1].type : null;
|
|
152
|
-
if (index === 0 || currentType !== prevType) {
|
|
153
|
-
let headerText = "";
|
|
154
|
-
switch (currentType) {
|
|
155
|
-
case SEARCH_RESULT_TYPES.UNIVERSAL_NAME:
|
|
156
|
-
headerText = groupLabelsParsed[SEARCH_RESULT_TYPES.UNIVERSAL_NAME];
|
|
157
|
-
break;
|
|
158
|
-
case SEARCH_RESULT_TYPES.PROFILE:
|
|
159
|
-
headerText = groupLabelsParsed[SEARCH_RESULT_TYPES.PROFILE];
|
|
160
|
-
break;
|
|
161
|
-
case SEARCH_RESULT_TYPES.ASSET:
|
|
162
|
-
headerText = groupLabelsParsed[SEARCH_RESULT_TYPES.ASSET];
|
|
163
|
-
break;
|
|
164
|
-
case SEARCH_RESULT_TYPES.APP:
|
|
165
|
-
headerText = groupLabelsParsed[SEARCH_RESULT_TYPES.APP];
|
|
166
|
-
break;
|
|
167
|
-
default:
|
|
168
|
-
headerText = groupLabelsParsed[SEARCH_RESULT_TYPES.STRING];
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
resultTemplates.push(
|
|
172
|
-
shared_tailwindElement_index.x`<div
|
|
173
|
-
class="py-1 my-1 text-neutral-35 paragraph-inter-12-medium tracking-wider border-b border-b-neutral-95"
|
|
174
|
-
>
|
|
175
|
-
${headerText}
|
|
176
|
-
</div>`
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
switch (result[1].type) {
|
|
181
|
-
// UniversalName result
|
|
182
|
-
case SEARCH_RESULT_TYPES.UNIVERSAL_NAME:
|
|
183
|
-
resultTemplates.push(
|
|
184
|
-
this.resultUniversalNameTemplate(result[1], index)
|
|
185
|
-
);
|
|
186
|
-
break;
|
|
187
|
-
// Profile result
|
|
188
|
-
case SEARCH_RESULT_TYPES.PROFILE:
|
|
189
|
-
resultTemplates.push(this.resultProfileTemplate(result[1], index));
|
|
190
|
-
break;
|
|
191
|
-
// Asset result
|
|
192
|
-
case SEARCH_RESULT_TYPES.ASSET:
|
|
193
|
-
resultTemplates.push(this.resultAssetTemplate(result[1], index));
|
|
194
|
-
break;
|
|
195
|
-
// App result
|
|
196
|
-
case SEARCH_RESULT_TYPES.APP:
|
|
197
|
-
resultTemplates.push(this.resultAppTemplate(result[1], index));
|
|
198
|
-
break;
|
|
199
|
-
// Default string result
|
|
200
|
-
default:
|
|
201
|
-
resultTemplates.push(this.resultStringTemplate(result[1], index));
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return shared_tailwindElement_index.x`<lukso-dropdown
|
|
206
|
-
size=${this.sizeDropdown()}
|
|
207
|
-
is-open
|
|
208
|
-
is-open-on-outside-click
|
|
209
|
-
is-full-width
|
|
210
|
-
max-height=${this.maxHeight || shared_tailwindElement_index.E}
|
|
211
|
-
>${resultTemplates}</lukso-dropdown
|
|
212
|
-
>`;
|
|
213
|
-
}
|
|
214
|
-
noResultsTemplate() {
|
|
215
|
-
return shared_tailwindElement_index.x`<lukso-dropdown
|
|
216
|
-
size=${this.sizeDropdown()}
|
|
217
|
-
is-open
|
|
218
|
-
is-open-on-outside-click
|
|
219
|
-
is-full-width
|
|
220
|
-
>${shared_tailwindElement_index.x`<div class="paragraph-inter-14-semi-bold text-neutral-20 pl-1">
|
|
221
|
-
${this.noResultsText}
|
|
222
|
-
</div>`}</lukso-dropdown
|
|
223
|
-
>`;
|
|
224
|
-
}
|
|
225
|
-
loadingTemplate() {
|
|
226
|
-
const { loading } = this.styles({
|
|
227
|
-
size: this.size
|
|
228
|
-
});
|
|
229
|
-
if (this.showNoResults) {
|
|
230
|
-
return shared_tailwindElement_index.x`<lukso-dropdown
|
|
231
|
-
size=${this.sizeDropdown()}
|
|
232
|
-
is-open
|
|
233
|
-
is-open-on-outside-click
|
|
234
|
-
is-full-width
|
|
235
|
-
>${shared_tailwindElement_index.x`
|
|
236
|
-
<div role="status" class="flex flex-col gap-1">
|
|
237
|
-
<div class=${loading()}></div>
|
|
238
|
-
</div>
|
|
239
|
-
`}</lukso-dropdown
|
|
240
|
-
>`;
|
|
241
|
-
}
|
|
242
|
-
if (this.resultsParsed.length === 0 || this.resultsParsed.length > 5) {
|
|
243
|
-
return shared_tailwindElement_index.x`<lukso-dropdown
|
|
244
|
-
size=${this.sizeDropdown()}
|
|
245
|
-
is-open
|
|
246
|
-
is-open-on-outside-click
|
|
247
|
-
is-full-width
|
|
248
|
-
>${shared_tailwindElement_index.x`
|
|
249
|
-
<div role="status" class="flex flex-col gap-1">
|
|
250
|
-
${[...Array(5)].map(() => shared_tailwindElement_index.x`<div class=${loading()}></div>`)}
|
|
251
|
-
</div>
|
|
252
|
-
`}</lukso-dropdown
|
|
253
|
-
>`;
|
|
254
|
-
}
|
|
255
|
-
return shared_tailwindElement_index.x`<lukso-dropdown
|
|
256
|
-
size=${this.sizeDropdown()}
|
|
257
|
-
is-open
|
|
258
|
-
is-open-on-outside-click
|
|
259
|
-
is-full-width
|
|
260
|
-
>${shared_tailwindElement_index.x`
|
|
261
|
-
<div role="status" class="flex flex-col gap-1">
|
|
262
|
-
${this.resultsParsed.map(() => shared_tailwindElement_index.x`<div class=${loading()}></div>`)}
|
|
263
|
-
</div>
|
|
264
|
-
`}</lukso-dropdown
|
|
265
|
-
>`;
|
|
266
|
-
}
|
|
267
|
-
resultStringTemplate(result, index) {
|
|
268
|
-
const dropdownSize = this.size === "large" || this.size === "x-large" ? "medium" : this.size;
|
|
269
|
-
return shared_tailwindElement_index.x`<lukso-dropdown-option
|
|
270
|
-
data-id="${result.id}"
|
|
271
|
-
data-index="${index + 1}"
|
|
272
|
-
?is-selected=${this.selected === index + 1}
|
|
273
|
-
size=${dropdownSize}
|
|
274
|
-
@click=${() => this.handleSelect(result)}
|
|
275
|
-
>
|
|
276
|
-
${result.value}
|
|
277
|
-
</lukso-dropdown-option>`;
|
|
278
|
-
}
|
|
279
|
-
resultUniversalNameTemplate(result, index) {
|
|
280
|
-
const tag = shared_tailwindElement_index.x`<lukso-tag
|
|
281
|
-
is-rounded
|
|
282
|
-
background-color="${result.status ? "green-95" : "neutral-95"}"
|
|
283
|
-
text-color="${result.status ? "green-45" : "neutral-60"}"
|
|
284
|
-
>${!!result.status ? this.availableText : this.unavailableText}</lukso-tag
|
|
285
|
-
>`;
|
|
286
|
-
return shared_tailwindElement_index.x`<lukso-dropdown-option
|
|
287
|
-
data-id="${result.id}"
|
|
288
|
-
data-index="${index + 1}"
|
|
289
|
-
?is-selected=${this.selected === index + 1}
|
|
290
|
-
size=${this.sizeDropdown()}
|
|
291
|
-
@click=${() => this.handleSelect(result)}
|
|
292
|
-
>
|
|
293
|
-
<div class="flex flex-row items-center justify-between w-full">
|
|
294
|
-
<div class="paragraph-inter-14-semi-bold">${result.value}</div>
|
|
295
|
-
${tag}
|
|
296
|
-
</div>
|
|
297
|
-
</lukso-dropdown-option>`;
|
|
298
|
-
}
|
|
299
|
-
resultProfileTemplate(result, index) {
|
|
300
|
-
const eoaProfilePicture = shared_tailwindElement_index.x`<lukso-profile
|
|
301
|
-
profile-address="${result.address}"
|
|
302
|
-
profile-url="${result.address ? components_luksoProfile_index.makeBlockie(result.address) : ""}"
|
|
303
|
-
size="x-small"
|
|
304
|
-
></lukso-profile>`;
|
|
305
|
-
const lsp3ProfilePicture = shared_tailwindElement_index.x`<lukso-profile
|
|
306
|
-
profile-address="${result.address}"
|
|
307
|
-
profile-url="${result.image}"
|
|
308
|
-
size="x-small"
|
|
309
|
-
has-identicon
|
|
310
|
-
></lukso-profile>`;
|
|
311
|
-
const standard = result.standard || STANDARDS.LSP3;
|
|
312
|
-
const profilePicture = standard !== STANDARDS.LSP3 ? eoaProfilePicture : lsp3ProfilePicture;
|
|
313
|
-
const upProfileUsername = shared_tailwindElement_index.x`<lukso-username
|
|
314
|
-
name="${result.name?.toLowerCase() || "anonymous-profile"}"
|
|
315
|
-
address="${result.address}"
|
|
316
|
-
name-color="neutral-20"
|
|
317
|
-
max-width="300"
|
|
318
|
-
size="medium"
|
|
319
|
-
?hide-prefix="${!result.name}"
|
|
320
|
-
class="ml-1"
|
|
321
|
-
></lukso-username> `;
|
|
322
|
-
const eoaUsername = shared_tailwindElement_index.x`<lukso-username
|
|
323
|
-
name="${components_luksoUsername_index.sliceAddress(result.address, 8)}"
|
|
324
|
-
address="__EOA"
|
|
325
|
-
name-color="neutral-20"
|
|
326
|
-
max-width="300"
|
|
327
|
-
size="medium"
|
|
328
|
-
hide-prefix
|
|
329
|
-
class="ml-1"
|
|
330
|
-
></lukso-username>`;
|
|
331
|
-
const scUsername = shared_tailwindElement_index.x`<lukso-username
|
|
332
|
-
name=""
|
|
333
|
-
address="${components_luksoUsername_index.sliceAddress(result.address, 8)}"
|
|
334
|
-
name-color="neutral-20"
|
|
335
|
-
max-width="300"
|
|
336
|
-
size="medium"
|
|
337
|
-
hide-prefix
|
|
338
|
-
class="ml-1"
|
|
339
|
-
></lukso-username>`;
|
|
340
|
-
let profileName = scUsername;
|
|
341
|
-
if (standard === STANDARDS.EOA) {
|
|
342
|
-
profileName = eoaUsername;
|
|
343
|
-
} else if (standard === STANDARDS.LSP3) {
|
|
344
|
-
profileName = upProfileUsername;
|
|
345
|
-
}
|
|
346
|
-
return shared_tailwindElement_index.x`<lukso-dropdown-option
|
|
347
|
-
data-id="${result.address}"
|
|
348
|
-
data-index="${index + 1}"
|
|
349
|
-
?is-selected=${this.selected === index + 1}
|
|
350
|
-
size=${this.sizeDropdown()}
|
|
351
|
-
@click=${() => this.handleSelect(result)}
|
|
352
|
-
>
|
|
353
|
-
${profilePicture} ${profileName}
|
|
354
|
-
</lukso-dropdown-option>`;
|
|
355
|
-
}
|
|
356
|
-
resultAssetTemplate(result, index) {
|
|
357
|
-
return shared_tailwindElement_index.x`<lukso-dropdown-option
|
|
358
|
-
data-id="${result.address}"
|
|
359
|
-
data-index="${index + 1}"
|
|
360
|
-
?is-selected=${this.selected === index + 1}
|
|
361
|
-
size=${this.sizeDropdown()}
|
|
362
|
-
@click=${() => this.handleSelect(result)}
|
|
363
|
-
>
|
|
364
|
-
<lukso-profile
|
|
365
|
-
profile-address="${result.address}"
|
|
366
|
-
profile-url="${result.image}"
|
|
367
|
-
placeholder="/assets/images/token-default.svg"
|
|
368
|
-
size="x-small"
|
|
369
|
-
></lukso-profile>
|
|
370
|
-
<span class="paragraph-inter-14-semi-bold"
|
|
371
|
-
>${result.name}
|
|
372
|
-
<span class="text-neutral-60 paragraph-inter-14-regular"
|
|
373
|
-
>${result.symbol}</span
|
|
374
|
-
></span
|
|
375
|
-
>
|
|
376
|
-
</lukso-dropdown-option>`;
|
|
377
|
-
}
|
|
378
|
-
resultAppTemplate(result, index) {
|
|
379
|
-
return shared_tailwindElement_index.x`<lukso-dropdown-option
|
|
380
|
-
data-id="${result.address}"
|
|
381
|
-
data-index="${index + 1}"
|
|
382
|
-
?is-selected=${this.selected === index + 1}
|
|
383
|
-
size=${this.sizeDropdown()}
|
|
384
|
-
@click=${() => this.handleSelect(result)}
|
|
385
|
-
>
|
|
386
|
-
<lukso-profile
|
|
387
|
-
profile-address="${result.address}"
|
|
388
|
-
profile-url="${result.image}"
|
|
389
|
-
size="x-small"
|
|
390
|
-
></lukso-profile>
|
|
391
|
-
<span class="paragraph-inter-14-semi-bold">${result.name} </span>
|
|
392
|
-
</lukso-dropdown-option>`;
|
|
393
|
-
}
|
|
394
|
-
async handleOutsideDropdownClick(event) {
|
|
395
|
-
const element = event.target;
|
|
396
|
-
if (element?.dataset?.component === "lukso-search") {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
this.results = "";
|
|
400
|
-
}
|
|
401
|
-
async handleDropdownKeydown(event) {
|
|
402
|
-
if (event.key === "ArrowUp" && this.selected && this.selected > 1 && this.resultsParsed?.length) {
|
|
403
|
-
event.preventDefault();
|
|
404
|
-
this.selected = this.selected - 1;
|
|
405
|
-
}
|
|
406
|
-
if (event.key === "ArrowDown" && this.resultsParsed?.length) {
|
|
407
|
-
event.preventDefault();
|
|
408
|
-
if (!this.selected) {
|
|
409
|
-
this.selected = 1;
|
|
410
|
-
} else if (this.selected < this.resultsParsed.length) {
|
|
411
|
-
this.selected = this.selected + 1;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (event.key === "Enter" && this.resultsParsed?.length) {
|
|
415
|
-
if (this.selected) {
|
|
416
|
-
const selectedResult = this.resultsParsed[this.selected - 1];
|
|
417
|
-
await this.handleSelect(selectedResult);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
if (event.key === "Escape") {
|
|
421
|
-
this.results = "";
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
async handleSelect(result) {
|
|
425
|
-
await this.updateComplete;
|
|
426
|
-
const selectEvent = new CustomEvent("on-select", {
|
|
427
|
-
detail: {
|
|
428
|
-
value: result
|
|
429
|
-
},
|
|
430
|
-
bubbles: false,
|
|
431
|
-
composed: true
|
|
432
|
-
});
|
|
433
|
-
this.dispatchEvent(selectEvent);
|
|
434
|
-
}
|
|
435
|
-
async handleBlur(event) {
|
|
436
|
-
event.stopPropagation();
|
|
437
|
-
await this.updateComplete;
|
|
438
|
-
const target = event.target;
|
|
439
|
-
const blurEvent = new CustomEvent("on-blur", {
|
|
440
|
-
detail: {
|
|
441
|
-
value: target.value,
|
|
442
|
-
event
|
|
443
|
-
},
|
|
444
|
-
bubbles: false,
|
|
445
|
-
composed: true
|
|
446
|
-
});
|
|
447
|
-
this.dispatchEvent(blurEvent);
|
|
448
|
-
}
|
|
449
|
-
async handleInputClick(event) {
|
|
450
|
-
event.stopPropagation();
|
|
451
|
-
await this.updateComplete;
|
|
452
|
-
const target = event.target;
|
|
453
|
-
const clickEvent = new CustomEvent("on-input-click", {
|
|
454
|
-
detail: {
|
|
455
|
-
value: target.value,
|
|
456
|
-
event
|
|
457
|
-
},
|
|
458
|
-
bubbles: false,
|
|
459
|
-
composed: true
|
|
460
|
-
});
|
|
461
|
-
this.dispatchEvent(clickEvent);
|
|
462
|
-
}
|
|
463
|
-
async handleKeyUp(event) {
|
|
464
|
-
event.stopPropagation();
|
|
465
|
-
await this.updateComplete;
|
|
466
|
-
const value = event?.detail?.value;
|
|
467
|
-
if (!this.keepValueOnEscapeHit && event?.detail?.event?.key === "Escape") {
|
|
468
|
-
this.value = "";
|
|
469
|
-
event.detail.value = "";
|
|
470
|
-
this.handleSearch(event);
|
|
471
|
-
}
|
|
472
|
-
const keyEvent = new CustomEvent("on-key-up", {
|
|
473
|
-
detail: {
|
|
474
|
-
value,
|
|
475
|
-
event
|
|
476
|
-
},
|
|
477
|
-
bubbles: true,
|
|
478
|
-
composed: true
|
|
479
|
-
});
|
|
480
|
-
this.dispatchEvent(keyEvent);
|
|
481
|
-
}
|
|
482
|
-
async handleReset(event) {
|
|
483
|
-
if (!this.hasReset) {
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
await this.updateComplete;
|
|
487
|
-
this.value = "";
|
|
488
|
-
const target = event.target;
|
|
489
|
-
const clickEvent = new CustomEvent("on-reset", {
|
|
490
|
-
detail: {
|
|
491
|
-
value: target.value,
|
|
492
|
-
event
|
|
493
|
-
},
|
|
494
|
-
bubbles: false,
|
|
495
|
-
composed: true
|
|
496
|
-
});
|
|
497
|
-
this.dispatchEvent(clickEvent);
|
|
498
|
-
}
|
|
499
|
-
async searchDebounce(searchTerm) {
|
|
500
|
-
await this.updateComplete;
|
|
501
|
-
this.value = searchTerm;
|
|
502
|
-
this.debounceTimer = setTimeout(() => {
|
|
503
|
-
const changeEvent = new CustomEvent("on-search", {
|
|
504
|
-
detail: {
|
|
505
|
-
value: searchTerm
|
|
506
|
-
},
|
|
507
|
-
bubbles: false,
|
|
508
|
-
composed: true
|
|
509
|
-
});
|
|
510
|
-
this.dispatchEvent(changeEvent);
|
|
511
|
-
this.isDebouncing = false;
|
|
512
|
-
}, this.debounce);
|
|
513
|
-
}
|
|
514
|
-
handleSearch(event) {
|
|
515
|
-
if (this.isDebouncing) {
|
|
516
|
-
clearTimeout(this.debounceTimer);
|
|
517
|
-
}
|
|
518
|
-
this.isDebouncing = true;
|
|
519
|
-
const target = event.target;
|
|
520
|
-
this.searchDebounce(target.value);
|
|
521
|
-
}
|
|
522
|
-
render() {
|
|
523
|
-
return shared_tailwindElement_index.x`
|
|
524
|
-
<div class="relative w-full">
|
|
525
|
-
<lukso-input
|
|
526
|
-
name=${this.name}
|
|
527
|
-
type="text"
|
|
528
|
-
.value=${this.value}
|
|
529
|
-
placeholder=${this.placeholder}
|
|
530
|
-
autocomplete=${this.autocomplete}
|
|
531
|
-
label=${this.label}
|
|
532
|
-
description=${this.description}
|
|
533
|
-
error=${this.error}
|
|
534
|
-
custom-class=${this.customClass}
|
|
535
|
-
id=${this.id}
|
|
536
|
-
size=${this.size}
|
|
537
|
-
data-component="lukso-search"
|
|
538
|
-
right-icon="${this.hasReset && this.value ? "close-sm" : this.rightIcon}"
|
|
539
|
-
?is-right-icon-clickable=${this.hasReset && this.value}
|
|
540
|
-
?autofocus=${this.autofocus}
|
|
541
|
-
?is-readonly=${this.isReadonly}
|
|
542
|
-
?is-disabled=${this.isDisabled}
|
|
543
|
-
?is-full-width=${this.isFullWidth}
|
|
544
|
-
keep-focus-on-escape
|
|
545
|
-
@on-input=${this.handleSearch}
|
|
546
|
-
@on-blur=${this.handleBlur}
|
|
547
|
-
@on-input-click=${this.handleInputClick}
|
|
548
|
-
@on-right-icon-click=${this.handleReset}
|
|
549
|
-
@on-key-up=${this.handleKeyUp}
|
|
550
|
-
></lukso-input>
|
|
551
|
-
<!-- results dropdown -->
|
|
552
|
-
${this.results && !(this.isSearching || this.isDebouncing) ? this.resultsTemplate() : shared_tailwindElement_index.E}
|
|
553
|
-
<!-- no results dropdown -->
|
|
554
|
-
${this.showNoResults && !(this.isSearching || this.isDebouncing) ? this.noResultsTemplate() : shared_tailwindElement_index.E}
|
|
555
|
-
<!-- loading dropdown -->
|
|
556
|
-
${!this.hideLoading && this.value && (this.isSearching || this.isDebouncing) ? this.loadingTemplate() : shared_tailwindElement_index.E}
|
|
557
|
-
</div>
|
|
558
|
-
`;
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
__decorateClass([
|
|
562
|
-
property.n({ type: String })
|
|
563
|
-
], exports.LuksoSearch.prototype, "value", 2);
|
|
564
|
-
__decorateClass([
|
|
565
|
-
property.n({ type: String })
|
|
566
|
-
], exports.LuksoSearch.prototype, "name", 2);
|
|
567
|
-
__decorateClass([
|
|
568
|
-
property.n({ type: String })
|
|
569
|
-
], exports.LuksoSearch.prototype, "placeholder", 2);
|
|
570
|
-
__decorateClass([
|
|
571
|
-
property.n({ type: String })
|
|
572
|
-
], exports.LuksoSearch.prototype, "label", 2);
|
|
573
|
-
__decorateClass([
|
|
574
|
-
property.n({ type: String, attribute: "group-labels" })
|
|
575
|
-
], exports.LuksoSearch.prototype, "groupLabels", 2);
|
|
576
|
-
__decorateClass([
|
|
577
|
-
property.n({ type: String, attribute: "available-text" })
|
|
578
|
-
], exports.LuksoSearch.prototype, "availableText", 2);
|
|
579
|
-
__decorateClass([
|
|
580
|
-
property.n({ type: String, attribute: "unavailable-text" })
|
|
581
|
-
], exports.LuksoSearch.prototype, "unavailableText", 2);
|
|
582
|
-
__decorateClass([
|
|
583
|
-
property.n({ type: String })
|
|
584
|
-
], exports.LuksoSearch.prototype, "autocomplete", 2);
|
|
585
|
-
__decorateClass([
|
|
586
|
-
property.n({ type: String })
|
|
587
|
-
], exports.LuksoSearch.prototype, "id", 2);
|
|
588
|
-
__decorateClass([
|
|
589
|
-
property.n({ type: String })
|
|
590
|
-
], exports.LuksoSearch.prototype, "description", 2);
|
|
591
|
-
__decorateClass([
|
|
592
|
-
property.n({ type: String })
|
|
593
|
-
], exports.LuksoSearch.prototype, "error", 2);
|
|
594
|
-
__decorateClass([
|
|
595
|
-
property.n({ type: String, attribute: "custom-class" })
|
|
596
|
-
], exports.LuksoSearch.prototype, "customClass", 2);
|
|
597
|
-
__decorateClass([
|
|
598
|
-
property.n({ type: Boolean, attribute: "is-full-width" })
|
|
599
|
-
], exports.LuksoSearch.prototype, "isFullWidth", 2);
|
|
600
|
-
__decorateClass([
|
|
601
|
-
property.n({ type: Boolean, attribute: "is-readonly" })
|
|
602
|
-
], exports.LuksoSearch.prototype, "isReadonly", 2);
|
|
603
|
-
__decorateClass([
|
|
604
|
-
property.n({ type: Boolean, attribute: "is-disabled" })
|
|
605
|
-
], exports.LuksoSearch.prototype, "isDisabled", 2);
|
|
606
|
-
__decorateClass([
|
|
607
|
-
property.n({ type: Boolean })
|
|
608
|
-
], exports.LuksoSearch.prototype, "autofocus", 2);
|
|
609
|
-
__decorateClass([
|
|
610
|
-
property.n({ type: Boolean })
|
|
611
|
-
], exports.LuksoSearch.prototype, "borderless", 2);
|
|
612
|
-
__decorateClass([
|
|
613
|
-
property.n({ type: String })
|
|
614
|
-
], exports.LuksoSearch.prototype, "results", 2);
|
|
615
|
-
__decorateClass([
|
|
616
|
-
property.n({ type: String, attribute: "right-icon" })
|
|
617
|
-
], exports.LuksoSearch.prototype, "rightIcon", 2);
|
|
618
|
-
__decorateClass([
|
|
619
|
-
property.n({ type: Number })
|
|
620
|
-
], exports.LuksoSearch.prototype, "debounce", 2);
|
|
621
|
-
__decorateClass([
|
|
622
|
-
property.n({ type: Boolean, attribute: "is-searching" })
|
|
623
|
-
], exports.LuksoSearch.prototype, "isSearching", 2);
|
|
624
|
-
__decorateClass([
|
|
625
|
-
property.n({ type: String, attribute: "no-results-text" })
|
|
626
|
-
], exports.LuksoSearch.prototype, "noResultsText", 2);
|
|
627
|
-
__decorateClass([
|
|
628
|
-
property.n({ type: Boolean, attribute: "show-no-results" })
|
|
629
|
-
], exports.LuksoSearch.prototype, "showNoResults", 2);
|
|
630
|
-
__decorateClass([
|
|
631
|
-
property.n({ type: Boolean, attribute: "hide-loading" })
|
|
632
|
-
], exports.LuksoSearch.prototype, "hideLoading", 2);
|
|
633
|
-
__decorateClass([
|
|
634
|
-
property.n({ type: Boolean, attribute: "has-reset" })
|
|
635
|
-
], exports.LuksoSearch.prototype, "hasReset", 2);
|
|
636
|
-
__decorateClass([
|
|
637
|
-
property.n({ type: Boolean, attribute: "keep-value-on-escape-hit" })
|
|
638
|
-
], exports.LuksoSearch.prototype, "keepValueOnEscapeHit", 2);
|
|
639
|
-
__decorateClass([
|
|
640
|
-
property.n({ type: Number })
|
|
641
|
-
], exports.LuksoSearch.prototype, "selected", 2);
|
|
642
|
-
__decorateClass([
|
|
643
|
-
property.n({ type: String })
|
|
644
|
-
], exports.LuksoSearch.prototype, "size", 2);
|
|
645
|
-
__decorateClass([
|
|
646
|
-
property.n({ type: Number, attribute: "max-height" })
|
|
647
|
-
], exports.LuksoSearch.prototype, "maxHeight", 2);
|
|
648
|
-
__decorateClass([
|
|
649
|
-
state.r()
|
|
650
|
-
], exports.LuksoSearch.prototype, "isDebouncing", 2);
|
|
651
|
-
__decorateClass([
|
|
652
|
-
state.r()
|
|
653
|
-
], exports.LuksoSearch.prototype, "debounceTimer", 2);
|
|
654
|
-
__decorateClass([
|
|
655
|
-
state.r()
|
|
656
|
-
], exports.LuksoSearch.prototype, "resultsParsed", 2);
|
|
657
|
-
exports.LuksoSearch = __decorateClass([
|
|
658
|
-
property.t("lukso-search")
|
|
659
|
-
], exports.LuksoSearch);
|
|
22
|
+
Object.defineProperty(exports, "LuksoSearch", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: () => components_luksoSearch_index.LuksoSearch
|
|
25
|
+
});
|