@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.
- package/dist/components/index.cjs +3 -3
- package/dist/components/index.js +3 -3
- package/dist/components/lukso-button/index.cjs +1 -1
- package/dist/components/lukso-button/index.d.ts +2 -2
- package/dist/components/lukso-button/index.d.ts.map +1 -1
- package/dist/components/lukso-button/index.js +1 -1
- package/dist/components/lukso-card/index.cjs +3 -3
- package/dist/components/lukso-card/index.js +3 -3
- package/dist/components/lukso-checkbox/index.cjs +1 -1
- package/dist/components/lukso-checkbox/index.js +1 -1
- package/dist/components/lukso-footer/index.cjs +1 -1
- package/dist/components/lukso-footer/index.js +1 -1
- package/dist/components/lukso-icon/icons/database.d.ts +3 -0
- package/dist/components/lukso-icon/icons/database.d.ts.map +1 -0
- package/dist/components/lukso-icon/icons/empty-outline.d.ts +3 -0
- package/dist/components/lukso-icon/icons/empty-outline.d.ts.map +1 -0
- package/dist/components/lukso-icon/index.cjs +61 -3
- package/dist/components/lukso-icon/index.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.js +61 -3
- package/dist/components/lukso-image/index.cjs +2 -2
- package/dist/components/lukso-image/index.js +2 -2
- package/dist/components/lukso-input/index.cjs +170 -43
- package/dist/components/lukso-input/index.d.ts +11 -6
- package/dist/components/lukso-input/index.d.ts.map +1 -1
- package/dist/components/lukso-input/index.js +170 -43
- package/dist/components/lukso-input/lukso-input.stories.d.ts +5 -1
- package/dist/components/lukso-input/lukso-input.stories.d.ts.map +1 -1
- package/dist/components/lukso-modal/index.cjs +1 -1
- package/dist/components/lukso-modal/index.js +1 -1
- package/dist/components/lukso-navbar/index.cjs +3 -3
- package/dist/components/lukso-navbar/index.js +3 -3
- package/dist/components/lukso-profile/index.cjs +2 -2
- package/dist/components/lukso-profile/index.js +2 -2
- package/dist/components/lukso-progress/index.cjs +2 -2
- package/dist/components/lukso-progress/index.js +2 -2
- package/dist/components/lukso-sanitize/index.cjs +1 -1
- package/dist/components/lukso-sanitize/index.js +1 -1
- package/dist/components/lukso-search/index.cjs +105 -139
- package/dist/components/lukso-search/index.d.ts +6 -12
- package/dist/components/lukso-search/index.d.ts.map +1 -1
- package/dist/components/lukso-search/index.js +101 -135
- package/dist/components/lukso-search/lukso-search.stories.d.ts +2 -0
- package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
- package/dist/components/lukso-select/index.cjs +234 -45
- package/dist/components/lukso-select/index.d.ts +18 -5
- package/dist/components/lukso-select/index.d.ts.map +1 -1
- package/dist/components/lukso-select/index.js +234 -45
- package/dist/components/lukso-select/lukso-select.stories.d.ts +12 -0
- package/dist/components/lukso-select/lukso-select.stories.d.ts.map +1 -1
- package/dist/components/lukso-share/index.cjs +1 -1
- package/dist/components/lukso-share/index.js +1 -1
- package/dist/components/lukso-switch/index.cjs +2 -2
- package/dist/components/lukso-switch/index.js +2 -2
- package/dist/components/lukso-tag/index.cjs +2 -2
- package/dist/components/lukso-tag/index.js +2 -2
- package/dist/components/lukso-terms/index.cjs +2 -2
- package/dist/components/lukso-terms/index.js +2 -2
- package/dist/components/lukso-test/index.cjs +1 -1
- package/dist/components/lukso-test/index.js +1 -1
- package/dist/components/lukso-tooltip/index.cjs +2 -2
- package/dist/components/lukso-tooltip/index.js +2 -2
- package/dist/components/lukso-username/index.cjs +2 -2
- package/dist/components/lukso-username/index.js +2 -2
- package/dist/components/lukso-wizard/index.cjs +1 -1
- package/dist/components/lukso-wizard/index.js +1 -1
- package/dist/index-09db75ee.js +39 -0
- package/dist/index-9b930f6a.cjs +46 -0
- package/dist/{index-59f199b0.cjs → index-a1e4b7d4.cjs} +1 -1
- package/dist/{index-8c727f4c.js → index-dfdfb6fe.js} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/shared/tailwind-element/index.cjs +1 -1
- package/dist/shared/tailwind-element/index.js +1 -1
- package/dist/shared/types.d.ts +1 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/{style-map-c66282ea.js → style-map-3669b30c.js} +1 -1
- package/dist/{style-map-6337084a.cjs → style-map-ebf3a8d2.cjs} +1 -1
- package/dist/styles/main.css +3 -0
- package/dist/styles/main.css.map +1 -1
- package/package.json +3 -2
- package/tools/sass/typography.scss +4 -0
- package/tools/styles/main.css +3 -0
- package/dist/index-25503efb.cjs +0 -46
- package/dist/index-bf6e0a1d.js +0 -39
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const shared_tailwindElement_index = require('../../index-
|
|
5
|
+
const shared_tailwindElement_index = require('../../index-9b930f6a.cjs');
|
|
6
6
|
const queryAssignedElements = require('../../query-assigned-elements-d5e45650.cjs');
|
|
7
7
|
const state = require('../../state-d9fb972b.cjs');
|
|
8
8
|
const index = require('../../index-1d3f4a5a.cjs');
|
|
@@ -10,11 +10,73 @@ require('../lukso-icon/index.cjs');
|
|
|
10
10
|
require('../lukso-profile/index.cjs');
|
|
11
11
|
require('../lukso-username/index.cjs');
|
|
12
12
|
require('../../bundle-mjs-d58a83c6.cjs');
|
|
13
|
-
require('../../style-map-
|
|
13
|
+
require('../../style-map-ebf3a8d2.cjs');
|
|
14
14
|
require('../../directive-8278ab14.cjs');
|
|
15
15
|
require('../lukso-image/index.cjs');
|
|
16
16
|
require('../../index-e9668573.cjs');
|
|
17
|
-
require('../../index-
|
|
17
|
+
require('../../index-a1e4b7d4.cjs');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
21
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
22
|
+
*/
|
|
23
|
+
var byteToHex = [];
|
|
24
|
+
for (var i = 0; i < 256; ++i) {
|
|
25
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
26
|
+
}
|
|
27
|
+
function unsafeStringify(arr, offset = 0) {
|
|
28
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
29
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
30
|
+
//
|
|
31
|
+
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
|
32
|
+
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
|
33
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
37
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
38
|
+
// generators (like Math.random()).
|
|
39
|
+
|
|
40
|
+
var getRandomValues;
|
|
41
|
+
var rnds8 = new Uint8Array(16);
|
|
42
|
+
function rng() {
|
|
43
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
44
|
+
if (!getRandomValues) {
|
|
45
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
46
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
47
|
+
if (!getRandomValues) {
|
|
48
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return getRandomValues(rnds8);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
55
|
+
const native = {
|
|
56
|
+
randomUUID
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function v4(options, buf, offset) {
|
|
60
|
+
if (native.randomUUID && !buf && !options) {
|
|
61
|
+
return native.randomUUID();
|
|
62
|
+
}
|
|
63
|
+
options = options || {};
|
|
64
|
+
var rnds = options.random || (options.rng || rng)();
|
|
65
|
+
|
|
66
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
67
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
68
|
+
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
69
|
+
|
|
70
|
+
// Copy bytes to buffer, if provided
|
|
71
|
+
if (buf) {
|
|
72
|
+
offset = offset || 0;
|
|
73
|
+
for (var i = 0; i < 16; ++i) {
|
|
74
|
+
buf[offset + i] = rnds[i];
|
|
75
|
+
}
|
|
76
|
+
return buf;
|
|
77
|
+
}
|
|
78
|
+
return unsafeStringify(rnds);
|
|
79
|
+
}
|
|
18
80
|
|
|
19
81
|
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
82
|
|
|
@@ -31,7 +93,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
31
93
|
};
|
|
32
94
|
exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.TailwindStyledElement(style) {
|
|
33
95
|
constructor() {
|
|
34
|
-
super(
|
|
96
|
+
super();
|
|
35
97
|
this.value = "";
|
|
36
98
|
this.placeholder = "";
|
|
37
99
|
this.label = "";
|
|
@@ -47,61 +109,119 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
47
109
|
this.isOpen = false;
|
|
48
110
|
this.openTop = false;
|
|
49
111
|
this.isLargeIcon = false;
|
|
112
|
+
this.isRight = false;
|
|
113
|
+
this.size = "medium";
|
|
114
|
+
this.showSelectionCounter = false;
|
|
50
115
|
this.optionsParsed = [];
|
|
51
116
|
this.valueParsed = void 0;
|
|
52
117
|
this.inputStyles = index.ce({
|
|
53
|
-
base: `bg-neutral-100
|
|
54
|
-
border border-solid
|
|
55
|
-
outline-none transition transition-all duration-150 appearance-none
|
|
118
|
+
base: `bg-neutral-100
|
|
119
|
+
border border-solid placeholder:text-neutral-70 select-none whitespace-nowrap
|
|
120
|
+
outline-none transition transition-all duration-150 appearance-none
|
|
56
121
|
text-neutral-20 cursor-pointer border-neutral-90 group-hover:border-neutral-35
|
|
57
122
|
flex items-center`,
|
|
58
123
|
variants: {
|
|
59
124
|
isFullWidth: {
|
|
60
|
-
true:
|
|
125
|
+
true: "w-full"
|
|
61
126
|
},
|
|
62
127
|
isDisabled: {
|
|
63
|
-
true:
|
|
128
|
+
true: "cursor-not-allowed text-neutral-60 group-hover:border-neutral-90"
|
|
64
129
|
},
|
|
65
130
|
hasError: {
|
|
66
|
-
true:
|
|
131
|
+
true: "border-red-85 group-hover:border-red-65"
|
|
67
132
|
},
|
|
68
133
|
borderless: {
|
|
69
|
-
true:
|
|
134
|
+
true: "border-0"
|
|
135
|
+
},
|
|
136
|
+
size: {
|
|
137
|
+
small: "h-[28px] px-3 py-2 pr-8 paragraph-inter-12-regular rounded-8",
|
|
138
|
+
medium: "h-[48px] px-4 py-3 pr-11 paragraph-inter-14-regular rounded-12"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
this.counterStyles = index.ce({
|
|
143
|
+
base: "border border-neutral-20",
|
|
144
|
+
variants: {
|
|
145
|
+
isDisabled: {
|
|
146
|
+
true: "opacity-60 cursor-not-allowed"
|
|
147
|
+
},
|
|
148
|
+
size: {
|
|
149
|
+
small: "paragraph-inter-10-semi-bold rounded-4 py-[1px] px-[5px] ml-1.5",
|
|
150
|
+
medium: "paragraph-inter-14-semi-bold rounded-8 py-[2px] px-[10px] ml-3"
|
|
70
151
|
}
|
|
71
152
|
}
|
|
72
153
|
});
|
|
73
154
|
this.dropdownWrapperStyles = index.ce({
|
|
74
|
-
base: `bg-neutral-100 border w-
|
|
75
|
-
flex absolute flex-col gap-1 overflow-y-auto max-h-64
|
|
155
|
+
base: `bg-neutral-100 border w-auto border-neutral-90 shadow-1xl z-50
|
|
156
|
+
flex absolute flex-col gap-1 overflow-y-auto max-h-64 `,
|
|
76
157
|
variants: {
|
|
77
158
|
openTop: {
|
|
78
|
-
true:
|
|
159
|
+
true: "bottom-[48px] mb-2 mt-0"
|
|
160
|
+
},
|
|
161
|
+
size: {
|
|
162
|
+
small: "rounded-8 p-2 mt-1 max-w-[200px] min-w-[120px]",
|
|
163
|
+
medium: "rounded-12 p-3 mt-2 max-w-[300px] min-w-[200px]"
|
|
164
|
+
},
|
|
165
|
+
isRight: {
|
|
166
|
+
true: "right-0"
|
|
79
167
|
}
|
|
80
168
|
}
|
|
81
169
|
});
|
|
82
170
|
this.optionsStyles = index.ce({
|
|
83
|
-
base: `
|
|
84
|
-
whitespace-nowrap hover:bg-neutral-98 flex items-center`,
|
|
171
|
+
base: `text-neutral-20 cursor-pointer
|
|
172
|
+
whitespace-nowrap hover:bg-neutral-98 flex items-center truncate`,
|
|
85
173
|
variants: {
|
|
86
174
|
isSelected: {
|
|
87
|
-
true:
|
|
175
|
+
true: "bg-neutral-95 hover:bg-neutral-95"
|
|
88
176
|
},
|
|
89
177
|
isActive: {
|
|
90
|
-
true:
|
|
178
|
+
true: "bg-neutral-98"
|
|
179
|
+
},
|
|
180
|
+
isGroup: {
|
|
181
|
+
true: ""
|
|
182
|
+
},
|
|
183
|
+
size: {
|
|
184
|
+
small: "paragraph-inter-12-regular rounded-4 py-1 px-2 min-h-[28px]",
|
|
185
|
+
medium: "paragraph-inter-14-regular rounded-8 p-2 min-h-[38px]"
|
|
186
|
+
},
|
|
187
|
+
isDisabled: {
|
|
188
|
+
true: "opacity-60 cursor-not-allowed"
|
|
189
|
+
},
|
|
190
|
+
isReadonly: {
|
|
191
|
+
true: "cursor-not-allowed"
|
|
91
192
|
}
|
|
92
|
-
}
|
|
193
|
+
},
|
|
194
|
+
compoundVariants: [
|
|
195
|
+
{
|
|
196
|
+
isGroup: true,
|
|
197
|
+
size: "small",
|
|
198
|
+
class: "pl-3"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
isGroup: true,
|
|
202
|
+
size: "medium",
|
|
203
|
+
class: "pl-4"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
93
206
|
});
|
|
94
207
|
this.iconStyles = index.ce({
|
|
95
|
-
base:
|
|
208
|
+
base: "absolute right-0 transition cursor-pointer",
|
|
96
209
|
variants: {
|
|
97
210
|
isDisabled: {
|
|
98
|
-
true:
|
|
211
|
+
true: "opacity-60 cursor-not-allowed"
|
|
99
212
|
},
|
|
100
213
|
isOpen: {
|
|
101
|
-
true:
|
|
214
|
+
true: "rotate-180"
|
|
215
|
+
},
|
|
216
|
+
size: {
|
|
217
|
+
small: "mr-2",
|
|
218
|
+
medium: "mr-3"
|
|
102
219
|
}
|
|
103
220
|
}
|
|
104
221
|
});
|
|
222
|
+
if (!this.id) {
|
|
223
|
+
this.id = v4();
|
|
224
|
+
}
|
|
105
225
|
}
|
|
106
226
|
connectedCallback() {
|
|
107
227
|
super.connectedCallback();
|
|
@@ -138,7 +258,8 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
138
258
|
}
|
|
139
259
|
if (changedProperties.has("value") && !!this.value) {
|
|
140
260
|
try {
|
|
141
|
-
|
|
261
|
+
const value = JSON.parse(this.value);
|
|
262
|
+
this.valueParsed = Array.isArray(value) ? value : [value];
|
|
142
263
|
} catch (error) {
|
|
143
264
|
console.warn("Could not parse value", error);
|
|
144
265
|
}
|
|
@@ -149,7 +270,8 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
149
270
|
isFullWidth: this.isFullWidth,
|
|
150
271
|
isDisabled: this.isDisabled,
|
|
151
272
|
hasError: !!this.error,
|
|
152
|
-
borderless: this.borderless
|
|
273
|
+
borderless: this.borderless,
|
|
274
|
+
size: this.size
|
|
153
275
|
});
|
|
154
276
|
return shared_tailwindElement_index.x`
|
|
155
277
|
<div
|
|
@@ -159,10 +281,19 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
159
281
|
@blur=${this.handleBlur}
|
|
160
282
|
@click=${this.handleClick}
|
|
161
283
|
>
|
|
162
|
-
${this.
|
|
284
|
+
${this.placeholder ? this.placeholder : shared_tailwindElement_index.A}
|
|
285
|
+
${!this.placeholder && this.valueParsed?.length ? this.selectedValueTemplate() : shared_tailwindElement_index.A}
|
|
286
|
+
${this.showSelectionCounter && this.valueParsed?.length ? this.selectedOptionsCounterTemplate() : shared_tailwindElement_index.A}
|
|
163
287
|
</div>
|
|
164
288
|
`;
|
|
165
289
|
}
|
|
290
|
+
selectedOptionsCounterTemplate() {
|
|
291
|
+
const counterStyles = this.counterStyles({
|
|
292
|
+
isDisabled: this.isDisabled,
|
|
293
|
+
size: this.size
|
|
294
|
+
});
|
|
295
|
+
return shared_tailwindElement_index.x`<div class=${counterStyles}>${this.valueParsed?.length}</div>`;
|
|
296
|
+
}
|
|
166
297
|
labelTemplate() {
|
|
167
298
|
return shared_tailwindElement_index.x`
|
|
168
299
|
<div class="heading-inter-14-bold text-neutral-20 pb-2 block">
|
|
@@ -186,7 +317,9 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
186
317
|
const optionTemplates = [];
|
|
187
318
|
for (const option of Object.entries(this.optionsParsed)) {
|
|
188
319
|
const index = Number(option[0]);
|
|
189
|
-
if ("
|
|
320
|
+
if ("values" in option[1]) {
|
|
321
|
+
optionTemplates.push(this.optionGroupedStringTemplate(option[1], index));
|
|
322
|
+
} else if ("value" in option[1]) {
|
|
190
323
|
optionTemplates.push(this.optionStringTemplate(option[1], index));
|
|
191
324
|
} else if ("address" in option[1]) {
|
|
192
325
|
optionTemplates.push(this.optionProfileTemplate(option[1], index));
|
|
@@ -198,14 +331,33 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
198
331
|
}
|
|
199
332
|
dropdownWrapperTemplate(innerTemplate) {
|
|
200
333
|
const dropdownWrapperStyles = this.dropdownWrapperStyles({
|
|
201
|
-
openTop: this.openTop
|
|
334
|
+
openTop: this.openTop,
|
|
335
|
+
size: this.size,
|
|
336
|
+
isRight: this.isRight
|
|
202
337
|
});
|
|
203
338
|
return shared_tailwindElement_index.x`<div class="${dropdownWrapperStyles}">${innerTemplate}</div>`;
|
|
204
339
|
}
|
|
340
|
+
optionGroupedStringTemplate(option, index) {
|
|
341
|
+
return shared_tailwindElement_index.x`<div
|
|
342
|
+
class="paragraph-inter-10-bold-uppercase text-neutral-20 p-1"
|
|
343
|
+
>
|
|
344
|
+
${option.group}
|
|
345
|
+
</div>
|
|
346
|
+
${option.values.map((value, valueIndex) => {
|
|
347
|
+
return this.optionStringTemplate(
|
|
348
|
+
{ id: `${option.id}-${valueIndex}`, group: option.group, value },
|
|
349
|
+
index
|
|
350
|
+
);
|
|
351
|
+
})}`;
|
|
352
|
+
}
|
|
205
353
|
optionStringTemplate(option, index) {
|
|
206
354
|
const optionsStyles = this.optionsStyles({
|
|
207
|
-
isSelected: this.valueParsed?.id === option.id,
|
|
208
|
-
isActive: this.selected === index + 1 && this.valueParsed?.id
|
|
355
|
+
isSelected: !!this.valueParsed?.find((value) => value.id === option.id),
|
|
356
|
+
isActive: this.selected === index + 1 && !this.valueParsed?.find((value) => value.id === option.id),
|
|
357
|
+
size: this.size,
|
|
358
|
+
isGroup: !!option.group,
|
|
359
|
+
isDisabled: this.isDisabled,
|
|
360
|
+
isReadonly: this.isReadonly
|
|
209
361
|
});
|
|
210
362
|
return shared_tailwindElement_index.x`<div
|
|
211
363
|
data-id="${option.id}"
|
|
@@ -218,8 +370,11 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
218
370
|
}
|
|
219
371
|
optionProfileTemplate(option, index) {
|
|
220
372
|
const optionsStyles = this.optionsStyles({
|
|
221
|
-
isSelected: this.valueParsed?.id === option.id,
|
|
222
|
-
isActive: this.selected === index + 1 && this.valueParsed?.id
|
|
373
|
+
isSelected: !!this.valueParsed?.find((value) => value.id === option.id),
|
|
374
|
+
isActive: this.selected === index + 1 && !this.valueParsed?.find((value) => value.id === option.id),
|
|
375
|
+
size: this.size,
|
|
376
|
+
isDisabled: this.isDisabled,
|
|
377
|
+
isReadonly: this.isReadonly
|
|
223
378
|
});
|
|
224
379
|
return shared_tailwindElement_index.x`<div
|
|
225
380
|
data-id="${option.id}"
|
|
@@ -247,27 +402,51 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
247
402
|
name-color="neutral-20"
|
|
248
403
|
max-width="150"
|
|
249
404
|
slice-by="4"
|
|
250
|
-
size
|
|
405
|
+
size=${this.size}
|
|
251
406
|
></lukso-username>`;
|
|
252
407
|
}
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
408
|
+
selectedValueTemplate() {
|
|
409
|
+
const firstOption = this.optionsParsed[0];
|
|
410
|
+
if ("value" in firstOption) {
|
|
411
|
+
const foundValues = this.optionsParsed.filter(
|
|
412
|
+
(option) => !!this.valueParsed?.find((value) => value.id === option.id)
|
|
413
|
+
);
|
|
414
|
+
return foundValues.map((value) => this.optionStringValue(value)).join(", ");
|
|
415
|
+
}
|
|
416
|
+
if ("values" in firstOption) {
|
|
417
|
+
const foundValues = [];
|
|
418
|
+
for (const option of this.optionsParsed) {
|
|
419
|
+
for (const [index, value] of option.values.entries()) {
|
|
420
|
+
for (const parsedValue of this.valueParsed) {
|
|
421
|
+
if (parsedValue.id === `${option.id}-${index}`) {
|
|
422
|
+
foundValues.push({
|
|
423
|
+
id: `${option.id}-${index}`,
|
|
424
|
+
value
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
264
429
|
}
|
|
430
|
+
return foundValues.map((value) => this.optionStringValue(value)).join(", ");
|
|
265
431
|
}
|
|
432
|
+
if ("address" in firstOption) {
|
|
433
|
+
const foundValues = this.optionsParsed.filter(
|
|
434
|
+
(option) => !!this.valueParsed?.find((value) => value.id === option.id)
|
|
435
|
+
);
|
|
436
|
+
const optionProfileValues = [];
|
|
437
|
+
for (const value of foundValues) {
|
|
438
|
+
optionProfileValues.push(
|
|
439
|
+
this.optionProfileValue(value)
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
return optionProfileValues;
|
|
443
|
+
}
|
|
444
|
+
console.error("Unknown value type", this.valueParsed);
|
|
266
445
|
return "";
|
|
267
446
|
}
|
|
268
447
|
handleOutsideDropdownClick(event) {
|
|
269
448
|
const element = event.target;
|
|
270
|
-
if (element.tagName === "LUKSO-SELECT") {
|
|
449
|
+
if (element.tagName === "LUKSO-SELECT" && this.id === element.id) {
|
|
271
450
|
return;
|
|
272
451
|
}
|
|
273
452
|
this.isOpen = false;
|
|
@@ -332,7 +511,8 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
|
|
|
332
511
|
render() {
|
|
333
512
|
const iconStyles = this.iconStyles({
|
|
334
513
|
isDisabled: this.isDisabled,
|
|
335
|
-
isOpen: this.isOpen
|
|
514
|
+
isOpen: this.isOpen,
|
|
515
|
+
size: this.size
|
|
336
516
|
});
|
|
337
517
|
return shared_tailwindElement_index.x`
|
|
338
518
|
<div class="relative w-[inherit]">
|
|
@@ -400,6 +580,15 @@ __decorateClass([
|
|
|
400
580
|
__decorateClass([
|
|
401
581
|
queryAssignedElements.n({ type: Boolean, attribute: "is-large-icon" })
|
|
402
582
|
], exports.LuksoSelect.prototype, "isLargeIcon", 2);
|
|
583
|
+
__decorateClass([
|
|
584
|
+
queryAssignedElements.n({ type: Boolean, attribute: "is-right" })
|
|
585
|
+
], exports.LuksoSelect.prototype, "isRight", 2);
|
|
586
|
+
__decorateClass([
|
|
587
|
+
queryAssignedElements.n({ type: String })
|
|
588
|
+
], exports.LuksoSelect.prototype, "size", 2);
|
|
589
|
+
__decorateClass([
|
|
590
|
+
queryAssignedElements.n({ type: Boolean, attribute: "show-selection-counter" })
|
|
591
|
+
], exports.LuksoSelect.prototype, "showSelectionCounter", 2);
|
|
403
592
|
__decorateClass([
|
|
404
593
|
state.t()
|
|
405
594
|
], exports.LuksoSelect.prototype, "optionsParsed", 2);
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
|
-
import { Address } from '../../shared/types';
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import type { Address, InputSize } from '../../shared/types';
|
|
3
3
|
export type SelectStringOption = {
|
|
4
4
|
id?: string;
|
|
5
|
+
group?: string;
|
|
5
6
|
value: string;
|
|
6
7
|
};
|
|
7
8
|
export type SelectProfileOption = {
|
|
8
|
-
id
|
|
9
|
+
id?: string;
|
|
9
10
|
address: Address;
|
|
10
11
|
image?: string;
|
|
11
12
|
name?: string;
|
|
12
13
|
};
|
|
13
|
-
export type
|
|
14
|
+
export type SelectGroupedStringOption = {
|
|
15
|
+
id?: string;
|
|
16
|
+
group: string;
|
|
17
|
+
values: string[];
|
|
18
|
+
};
|
|
19
|
+
export type SelectOption = SelectStringOption | SelectProfileOption | SelectGroupedStringOption;
|
|
14
20
|
declare const LuksoSelect_base: typeof import("lit").LitElement;
|
|
15
21
|
export declare class LuksoSelect extends LuksoSelect_base {
|
|
16
22
|
value: string;
|
|
@@ -28,9 +34,14 @@ export declare class LuksoSelect extends LuksoSelect_base {
|
|
|
28
34
|
isOpen: boolean;
|
|
29
35
|
openTop: boolean;
|
|
30
36
|
isLargeIcon: boolean;
|
|
37
|
+
isRight: boolean;
|
|
38
|
+
size: InputSize;
|
|
39
|
+
showSelectionCounter: boolean;
|
|
31
40
|
private optionsParsed;
|
|
32
41
|
private valueParsed;
|
|
42
|
+
constructor();
|
|
33
43
|
private inputStyles;
|
|
44
|
+
private counterStyles;
|
|
34
45
|
private dropdownWrapperStyles;
|
|
35
46
|
private optionsStyles;
|
|
36
47
|
private iconStyles;
|
|
@@ -38,16 +49,18 @@ export declare class LuksoSelect extends LuksoSelect_base {
|
|
|
38
49
|
disconnectedCallback(): void;
|
|
39
50
|
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
40
51
|
inputTemplate(): TemplateResult<1>;
|
|
52
|
+
selectedOptionsCounterTemplate(): TemplateResult<1>;
|
|
41
53
|
labelTemplate(): TemplateResult<1>;
|
|
42
54
|
descriptionTemplate(): TemplateResult<1>;
|
|
43
55
|
errorTemplate(): TemplateResult<1>;
|
|
44
56
|
optionsTemplate(): TemplateResult<1>;
|
|
45
57
|
dropdownWrapperTemplate(innerTemplate: TemplateResult<1> | TemplateResult<1>[]): TemplateResult<1>;
|
|
58
|
+
optionGroupedStringTemplate(option: SelectGroupedStringOption, index: number): TemplateResult<1>;
|
|
46
59
|
optionStringTemplate(option: SelectStringOption, index: number): TemplateResult<1>;
|
|
47
60
|
optionProfileTemplate(option: SelectProfileOption, index: number): TemplateResult<1>;
|
|
48
61
|
private optionStringValue;
|
|
49
62
|
private optionProfileValue;
|
|
50
|
-
private
|
|
63
|
+
private selectedValueTemplate;
|
|
51
64
|
private handleOutsideDropdownClick;
|
|
52
65
|
private handleDropdownKeydown;
|
|
53
66
|
private handleSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,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