@lukso/web-components 1.53.2 → 1.55.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 (91) hide show
  1. package/dist/components/index.cjs +4 -3
  2. package/dist/components/index.js +4 -3
  3. package/dist/components/lukso-button/index.cjs +4 -2567
  4. package/dist/components/lukso-button/index.js +2 -2565
  5. package/dist/components/lukso-card/index.cjs +3 -3
  6. package/dist/components/lukso-card/index.js +3 -3
  7. package/dist/components/lukso-checkbox/index.cjs +1 -1
  8. package/dist/components/lukso-checkbox/index.js +1 -1
  9. package/dist/components/lukso-footer/index.cjs +1 -1
  10. package/dist/components/lukso-footer/index.js +1 -1
  11. package/dist/components/lukso-icon/icons/code-outline.d.ts +3 -0
  12. package/dist/components/lukso-icon/icons/code-outline.d.ts.map +1 -0
  13. package/dist/components/lukso-icon/icons/edit-doc.d.ts +3 -0
  14. package/dist/components/lukso-icon/icons/edit-doc.d.ts.map +1 -0
  15. package/dist/components/lukso-icon/icons/extension-outline.d.ts +3 -0
  16. package/dist/components/lukso-icon/icons/extension-outline.d.ts.map +1 -0
  17. package/dist/components/lukso-icon/icons/face-id.d.ts +3 -0
  18. package/dist/components/lukso-icon/icons/face-id.d.ts.map +1 -0
  19. package/dist/components/lukso-icon/icons/flag-outline.d.ts +3 -0
  20. package/dist/components/lukso-icon/icons/flag-outline.d.ts.map +1 -0
  21. package/dist/components/lukso-icon/icons/hand-right-outline.d.ts +3 -0
  22. package/dist/components/lukso-icon/icons/hand-right-outline.d.ts.map +1 -0
  23. package/dist/components/lukso-icon/icons/lukso-logo.d.ts +3 -0
  24. package/dist/components/lukso-icon/icons/lukso-logo.d.ts.map +1 -0
  25. package/dist/components/lukso-icon/icons/profile-file.d.ts +3 -0
  26. package/dist/components/lukso-icon/icons/profile-file.d.ts.map +1 -0
  27. package/dist/components/lukso-icon/icons/qr-code-scan.d.ts +3 -0
  28. package/dist/components/lukso-icon/icons/qr-code-scan.d.ts.map +1 -0
  29. package/dist/components/lukso-icon/icons/qr-code.d.ts.map +1 -1
  30. package/dist/components/lukso-icon/icons/save-outline.d.ts +3 -0
  31. package/dist/components/lukso-icon/icons/save-outline.d.ts.map +1 -0
  32. package/dist/components/lukso-icon/icons/scan.d.ts +3 -0
  33. package/dist/components/lukso-icon/icons/scan.d.ts.map +1 -0
  34. package/dist/components/lukso-icon/icons/token-id.d.ts +3 -0
  35. package/dist/components/lukso-icon/icons/token-id.d.ts.map +1 -0
  36. package/dist/components/lukso-icon/icons/transfer-send.d.ts +3 -0
  37. package/dist/components/lukso-icon/icons/transfer-send.d.ts.map +1 -0
  38. package/dist/components/lukso-icon/index.cjs +545 -4
  39. package/dist/components/lukso-icon/index.d.ts.map +1 -1
  40. package/dist/components/lukso-icon/index.js +545 -4
  41. package/dist/components/lukso-input/index.cjs +1 -1
  42. package/dist/components/lukso-input/index.js +1 -1
  43. package/dist/components/lukso-modal/index.cjs +1 -1
  44. package/dist/components/lukso-modal/index.js +1 -1
  45. package/dist/components/lukso-navbar/index.cjs +2 -2
  46. package/dist/components/lukso-navbar/index.js +2 -2
  47. package/dist/components/lukso-profile/index.cjs +2 -2
  48. package/dist/components/lukso-profile/index.js +2 -2
  49. package/dist/components/lukso-progress/index.cjs +2 -2
  50. package/dist/components/lukso-progress/index.js +2 -2
  51. package/dist/components/lukso-sanitize/index.cjs +1 -1
  52. package/dist/components/lukso-sanitize/index.js +1 -1
  53. package/dist/components/lukso-search/index.cjs +3 -3
  54. package/dist/components/lukso-search/index.js +3 -3
  55. package/dist/components/lukso-select/index.cjs +127 -41
  56. package/dist/components/lukso-select/index.d.ts +16 -2
  57. package/dist/components/lukso-select/index.d.ts.map +1 -1
  58. package/dist/components/lukso-select/index.js +126 -40
  59. package/dist/components/lukso-select/lukso-select.stories.d.ts +2 -0
  60. package/dist/components/lukso-select/lukso-select.stories.d.ts.map +1 -1
  61. package/dist/components/lukso-share/index.cjs +1 -1
  62. package/dist/components/lukso-share/index.js +1 -1
  63. package/dist/components/lukso-switch/index.cjs +2 -2
  64. package/dist/components/lukso-switch/index.js +2 -2
  65. package/dist/components/lukso-tag/index.cjs +2 -2
  66. package/dist/components/lukso-tag/index.js +2 -2
  67. package/dist/components/lukso-terms/index.cjs +2 -2
  68. package/dist/components/lukso-terms/index.js +2 -2
  69. package/dist/components/lukso-test/index.cjs +1 -1
  70. package/dist/components/lukso-test/index.js +1 -1
  71. package/dist/components/lukso-tooltip/index.cjs +1 -1
  72. package/dist/components/lukso-tooltip/index.js +1 -1
  73. package/dist/components/lukso-username/index.cjs +2 -2
  74. package/dist/components/lukso-username/index.js +2 -2
  75. package/dist/components/lukso-wizard/index.cjs +1 -1
  76. package/dist/components/lukso-wizard/index.js +1 -1
  77. package/dist/{index-97f126f3.cjs → index-21cb1f33.cjs} +1 -1
  78. package/dist/index-3373dd2c.js +39 -0
  79. package/dist/index-534893a1.cjs +46 -0
  80. package/dist/{index-9c2f800a.js → index-b02bfbc3.js} +1 -1
  81. package/dist/index-c55a1069.js +2565 -0
  82. package/dist/index-e8741080.cjs +2567 -0
  83. package/dist/index.cjs +4 -3
  84. package/dist/index.js +4 -3
  85. package/dist/shared/tailwind-element/index.cjs +1 -1
  86. package/dist/shared/tailwind-element/index.js +1 -1
  87. package/dist/{style-map-d0fa91c8.js → style-map-04ec407e.js} +1 -1
  88. package/dist/{style-map-a31b1d87.cjs → style-map-beffabf7.cjs} +1 -1
  89. package/package.json +1 -1
  90. package/dist/index-122da399.js +0 -39
  91. package/dist/index-f25fc3ea.cjs +0 -46
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-f25fc3ea.cjs');
5
+ const shared_tailwindElement_index = require('../../index-534893a1.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
- const styleMap = require('../../style-map-a31b1d87.cjs');
7
+ const styleMap = require('../../style-map-beffabf7.cjs');
8
8
  require('../../tailwind-config.cjs');
9
9
  const cn = require('../../cn-4ec0bd94.cjs');
10
10
  require('../../directive-8278ab14.cjs');
@@ -1,6 +1,6 @@
1
- import { a as TailwindElement, x } from '../../index-122da399.js';
1
+ import { a as TailwindElement, x } from '../../index-3373dd2c.js';
2
2
  import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
- import { o } from '../../style-map-d0fa91c8.js';
3
+ import { o } from '../../style-map-04ec407e.js';
4
4
  import '../../tailwind-config.js';
5
5
  import { c as cn } from '../../cn-616567d4.js';
6
6
  import '../../directive-2bb7789e.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-f25fc3ea.cjs');
5
+ const shared_tailwindElement_index = require('../../index-534893a1.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
7
  const directive = require('../../directive-8278ab14.cjs');
8
8
 
@@ -1,4 +1,4 @@
1
- import { A, b as T, a as TailwindElement, x } from '../../index-122da399.js';
1
+ import { A, b as T, a as TailwindElement, x } from '../../index-3373dd2c.js';
2
2
  import { n, e as e$2 } from '../../query-assigned-elements-5d94572f.js';
3
3
  import { i, t, e as e$1 } from '../../directive-2bb7789e.js';
4
4
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-f25fc3ea.cjs');
5
+ const shared_tailwindElement_index = require('../../index-534893a1.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
7
  const state = require('../../state-f73a8b4f.cjs');
8
8
  const index = require('../../index-e9668573.cjs');
@@ -10,8 +10,8 @@ require('../lukso-icon/index.cjs');
10
10
  require('../lukso-profile/index.cjs');
11
11
  require('../lukso-username/index.cjs');
12
12
  require('../../directive-8278ab14.cjs');
13
- require('../../style-map-a31b1d87.cjs');
14
- require('../../index-97f126f3.cjs');
13
+ require('../../style-map-beffabf7.cjs');
14
+ require('../../index-21cb1f33.cjs');
15
15
 
16
16
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
17
17
 
@@ -1,4 +1,4 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-122da399.js';
1
+ import { T as TailwindStyledElement, x, A } from '../../index-3373dd2c.js';
2
2
  import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
3
  import { t } from '../../state-0a779257.js';
4
4
  import { c as customClassMap } from '../../index-5e194caf.js';
@@ -6,8 +6,8 @@ import '../lukso-icon/index.js';
6
6
  import '../lukso-profile/index.js';
7
7
  import '../lukso-username/index.js';
8
8
  import '../../directive-2bb7789e.js';
9
- import '../../style-map-d0fa91c8.js';
10
- import '../../index-9c2f800a.js';
9
+ import '../../style-map-04ec407e.js';
10
+ import '../../index-b02bfbc3.js';
11
11
 
12
12
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
13
13
 
@@ -2,16 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-f25fc3ea.cjs');
5
+ const shared_tailwindElement_index = require('../../index-534893a1.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
7
  const state = require('../../state-f73a8b4f.cjs');
8
- const index = require('../../index-e9668573.cjs');
8
+ const index = require('../../index-e8741080.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-beffabf7.cjs');
12
13
  require('../../directive-8278ab14.cjs');
13
- require('../../style-map-a31b1d87.cjs');
14
- require('../../index-97f126f3.cjs');
14
+ require('../../index-e9668573.cjs');
15
+ require('../../index-21cb1f33.cjs');
15
16
 
16
17
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
17
18
 
@@ -43,11 +44,62 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
43
44
  this.selected = void 0;
44
45
  this.isOpen = false;
45
46
  this.openTop = false;
47
+ this.isLargeIcon = false;
46
48
  this.optionsParsed = [];
47
49
  this.valueParsed = void 0;
48
- this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-11
49
- border-solid h-[48px] placeholder:text-neutral-70 select-none whitespace-nowrap
50
- outline-none transition transition-all duration-150 appearance-none rounded-12`;
50
+ this.inputStyles = index.se({
51
+ base: `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-11
52
+ border border-solid h-[48px] placeholder:text-neutral-70 select-none whitespace-nowrap
53
+ outline-none transition transition-all duration-150 appearance-none rounded-12
54
+ text-neutral-20 cursor-pointer border-neutral-90 group-hover:border-neutral-35
55
+ flex items-center`,
56
+ variants: {
57
+ isFullWidth: {
58
+ true: `w-full`
59
+ },
60
+ isDisabled: {
61
+ true: `cursor-not-allowed text-neutral-60 group-hover:border-neutral-90`
62
+ },
63
+ hasError: {
64
+ true: `border-red-85 group-hover:border-red-65`
65
+ },
66
+ borderless: {
67
+ true: `border-0`
68
+ }
69
+ }
70
+ });
71
+ this.dropdownWrapperStyles = index.se({
72
+ base: `bg-neutral-100 border w-full border-neutral-90 shadow-1xl rounded-12 p-3 z-50
73
+ flex absolute flex-col gap-1 overflow-y-auto max-h-64 mt-2`,
74
+ variants: {
75
+ openTop: {
76
+ true: `bottom-[48px] mb-2 mt-0`
77
+ }
78
+ }
79
+ });
80
+ this.optionsStyles = index.se({
81
+ base: `paragraph-inter-14-regular text-neutral-20 cursor-pointer rounded-8 p-2
82
+ whitespace-nowrap hover:bg-neutral-98 flex items-center`,
83
+ variants: {
84
+ isSelected: {
85
+ true: `bg-neutral-95 hover:bg-neutral-95`
86
+ },
87
+ isActive: {
88
+ true: `bg-neutral-98`
89
+ }
90
+ }
91
+ });
92
+ this.iconStyles = index.se({
93
+ base: `absolute right-0 mr-3 transition cursor-pointer`,
94
+ variants: {
95
+ isDisabled: {
96
+ true: `opacity-60 cursor-not-allowed`
97
+ },
98
+ isOpen: {
99
+ true: `rotate-180`
100
+ }
101
+ }
102
+ });
51
103
  }
52
104
  connectedCallback() {
53
105
  super.connectedCallback();
@@ -91,19 +143,17 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
91
143
  }
92
144
  }
93
145
  inputTemplate() {
146
+ const inputStyles = this.inputStyles({
147
+ isFullWidth: this.isFullWidth,
148
+ isDisabled: this.isDisabled,
149
+ hasError: !!this.error,
150
+ borderless: this.borderless
151
+ });
94
152
  return shared_tailwindElement_index.x`
95
153
  <div
96
154
  id=${this.id}
97
155
  data-testid=${this.id ? `select-${this.id}` : "select"}
98
- class=${index.customClassMap({
99
- [this.defaultInputStyles]: true,
100
- ["border-neutral-90 group-hover:border-neutral-35"]: !!!this.error && !this.isDisabled,
101
- ["border-red-85 group-hover:border-red-65"]: !!this.error,
102
- ["w-full"]: this.isFullWidth,
103
- ["cursor-not-allowed text-neutral-60"]: this.isDisabled,
104
- ["text-neutral-20 cursor-pointer"]: !this.isDisabled,
105
- [this.borderless ? "border-0" : "border"]: true
106
- })}
156
+ class=${inputStyles}
107
157
  @blur=${this.handleBlur}
108
158
  @click=${this.handleClick}
109
159
  >
@@ -136,6 +186,8 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
136
186
  const index = Number(option[0]);
137
187
  if ("value" in option[1]) {
138
188
  optionTemplates.push(this.optionStringTemplate(option[1], index));
189
+ } else if ("address" in option[1]) {
190
+ optionTemplates.push(this.optionProfileTemplate(option[1], index));
139
191
  } else {
140
192
  console.error("Unknown option type", option);
141
193
  }
@@ -143,40 +195,71 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
143
195
  return shared_tailwindElement_index.x`${this.dropdownWrapperTemplate(optionTemplates)}`;
144
196
  }
145
197
  dropdownWrapperTemplate(innerTemplate) {
198
+ const dropdownWrapperStyles = this.dropdownWrapperStyles({
199
+ openTop: this.openTop
200
+ });
201
+ return shared_tailwindElement_index.x`<div class="${dropdownWrapperStyles}">${innerTemplate}</div>`;
202
+ }
203
+ optionStringTemplate(option, index) {
204
+ const optionsStyles = this.optionsStyles({
205
+ isSelected: this.valueParsed?.id === option.id,
206
+ isActive: this.selected === index + 1 && this.valueParsed?.id !== option.id
207
+ });
146
208
  return shared_tailwindElement_index.x`<div
147
- class="bg-neutral-100 border w-full border-neutral-90 shadow-1xl rounded-12 p-3 z-50 flex absolute flex-col gap-1 overflow-y-auto max-h-64 ${index.customClassMap(
148
- {
149
- ["bottom-[48px] mb-2"]: this.openTop,
150
- ["mt-2"]: !this.openTop
151
- }
152
- )}
153
- )}"
209
+ data-id="${option.id}"
210
+ data-index="${index + 1}"
211
+ class="${optionsStyles}"
212
+ @click=${() => this.handleSelect(option)}
154
213
  >
155
- ${innerTemplate}
214
+ ${this.optionStringValue(option)}
156
215
  </div>`;
157
216
  }
158
- optionStringTemplate(option, index$1) {
217
+ optionProfileTemplate(option, index) {
218
+ const optionsStyles = this.optionsStyles({
219
+ isSelected: this.valueParsed?.id === option.id,
220
+ isActive: this.selected === index + 1 && this.valueParsed?.id !== option.id
221
+ });
159
222
  return shared_tailwindElement_index.x`<div
160
223
  data-id="${option.id}"
161
- data-index="${index$1 + 1}"
162
- class="paragraph-inter-14-regular text-neutral-20 cursor-pointer rounded-8 p-2 whitespace-nowrap ${index.customClassMap(
163
- {
164
- ["bg-neutral-95 hover:bg-neutral-95"]: this.valueParsed?.id === option.id,
165
- ["bg-neutral-98"]: this.selected === index$1 + 1 && this.valueParsed?.id !== option.id,
166
- ["hover:bg-neutral-98"]: this.valueParsed?.id !== option.id
167
- }
168
- )}"
224
+ data-index="${index + 1}"
225
+ class="${optionsStyles}"
169
226
  @click=${() => this.handleSelect(option)}
170
227
  >
171
- ${option.value}
228
+ ${this.optionProfileValue(option)}
172
229
  </div>`;
173
230
  }
231
+ optionStringValue(option) {
232
+ return option.value;
233
+ }
234
+ optionProfileValue(option) {
235
+ return shared_tailwindElement_index.x`<lukso-profile
236
+ profile-address="${option.address}"
237
+ profile-url="${option.image}"
238
+ size="x-small"
239
+ has-identicon
240
+ class="mr-2"
241
+ ></lukso-profile>
242
+ <lukso-username
243
+ name="${option.name?.toLowerCase()}"
244
+ address="${option.address}"
245
+ name-color="neutral-20"
246
+ max-width="150"
247
+ slice-by="4"
248
+ size="medium"
249
+ ></lukso-username>`;
250
+ }
174
251
  selectedValue() {
175
252
  const foundValue = this.optionsParsed.find(
176
253
  (option) => option.id === this.valueParsed?.id
177
254
  );
178
255
  if (foundValue) {
179
- return foundValue.value;
256
+ if ("value" in foundValue) {
257
+ return this.optionStringValue(foundValue);
258
+ } else if ("address" in foundValue) {
259
+ return this.optionProfileValue(foundValue);
260
+ } else {
261
+ console.error("Unknown value type", foundValue);
262
+ }
180
263
  }
181
264
  return "";
182
265
  }
@@ -242,6 +325,10 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
242
325
  this.isOpen = !this.isOpen;
243
326
  }
244
327
  render() {
328
+ const iconStyles = this.iconStyles({
329
+ isDisabled: this.isDisabled,
330
+ isOpen: this.isOpen
331
+ });
245
332
  return shared_tailwindElement_index.x`
246
333
  <div class="relative w-[inherit]">
247
334
  ${this.label ? this.labelTemplate() : shared_tailwindElement_index.A}
@@ -249,12 +336,8 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
249
336
  <div class="group">
250
337
  <div class="flex relative items-center">
251
338
  ${this.inputTemplate()}<lukso-icon
252
- name=${this.isFullWidth ? "arrow-down-lg" : "arrow-down-sm"}
253
- class="absolute right-0 mr-3 transition ${index.customClassMap({
254
- ["opacity-60 cursor-not-allowed"]: this.isDisabled,
255
- ["cursor-pointer"]: !this.isDisabled,
256
- ["rotate-180"]: this.isOpen
257
- })}"
339
+ name=${this.isLargeIcon ? "arrow-down-lg" : "arrow-down-sm"}
340
+ class="${iconStyles}"
258
341
  @click=${this.handleClick}
259
342
  ></lukso-icon>
260
343
  </div>
@@ -309,6 +392,9 @@ __decorateClass([
309
392
  __decorateClass([
310
393
  queryAssignedElements.n({ type: Boolean, attribute: "open-top" })
311
394
  ], exports.LuksoSelect.prototype, "openTop", 2);
395
+ __decorateClass([
396
+ queryAssignedElements.n({ type: Boolean, attribute: "is-large-icon" })
397
+ ], exports.LuksoSelect.prototype, "isLargeIcon", 2);
312
398
  __decorateClass([
313
399
  state.t()
314
400
  ], exports.LuksoSelect.prototype, "optionsParsed", 2);
@@ -1,9 +1,16 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
+ import { Address } from '../../shared/types';
2
3
  export type SelectStringOption = {
3
4
  id?: string;
4
5
  value: string;
5
6
  };
6
- export type SelectOption = SelectStringOption;
7
+ export type SelectProfileOption = {
8
+ id: string;
9
+ address: Address;
10
+ image?: string;
11
+ name?: string;
12
+ };
13
+ export type SelectOption = SelectStringOption | SelectProfileOption;
7
14
  declare const LuksoSelect_base: typeof import("lit").LitElement;
8
15
  export declare class LuksoSelect extends LuksoSelect_base {
9
16
  value: string;
@@ -20,9 +27,13 @@ export declare class LuksoSelect extends LuksoSelect_base {
20
27
  selected: any;
21
28
  isOpen: boolean;
22
29
  openTop: boolean;
30
+ isLargeIcon: boolean;
23
31
  private optionsParsed;
24
32
  private valueParsed;
25
- private defaultInputStyles;
33
+ private inputStyles;
34
+ private dropdownWrapperStyles;
35
+ private optionsStyles;
36
+ private iconStyles;
26
37
  connectedCallback(): void;
27
38
  disconnectedCallback(): void;
28
39
  willUpdate(changedProperties: PropertyValues<this>): void;
@@ -33,6 +44,9 @@ export declare class LuksoSelect extends LuksoSelect_base {
33
44
  optionsTemplate(): TemplateResult<1>;
34
45
  dropdownWrapperTemplate(innerTemplate: TemplateResult<1> | TemplateResult<1>[]): TemplateResult<1>;
35
46
  optionStringTemplate(option: SelectStringOption, index: number): TemplateResult<1>;
47
+ optionProfileTemplate(option: SelectProfileOption, index: number): TemplateResult<1>;
48
+ private optionStringValue;
49
+ private optionProfileValue;
36
50
  private selectedValue;
37
51
  private handleOutsideDropdownClick;
38
52
  private handleDropdownKeydown;
@@ -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;AAMnE,OAAO,yBAAyB,CAAA;AAChC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AAEpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAA;;AAE7C,qBACa,WAAY,SAAQ,gBAA4B;IAE3D,KAAK,SAAK;IAGV,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,EAAE,SAAK;IAGP,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,WAAW,UAAQ;IAGnB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,OAAO,SAAK;IAGZ,QAAQ,MAAY;IAGpB,MAAM,EAAE,OAAO,CAAQ;IAGvB,OAAO,EAAE,OAAO,CAAQ;IAGxB,OAAO,CAAC,aAAa,CAAqB;IAG1C,OAAO,CAAC,WAAW,CAAsC;IAEzD,OAAO,CAAC,kBAAkB,CAEuD;IAEjF,iBAAiB;IAKjB,oBAAoB;IAMpB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;IAwClD,aAAa;IAuBb,aAAa;IAQb,mBAAmB;IAQnB,aAAa;IAMb,eAAe;IAgBf,uBAAuB,CACrB,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE;IAexD,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM;IAmB9D,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,0BAA0B;YAUpB,qBAAqB;YAiCrB,YAAY;YAiBZ,UAAU;IAcxB,OAAO,CAAC,WAAW;IAQnB,MAAM;CA2BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAA;AAMnE,OAAO,yBAAyB,CAAA;AAChC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;;AAEnE,qBACa,WAAY,SAAQ,gBAA4B;IAE3D,KAAK,SAAK;IAGV,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,EAAE,SAAK;IAGP,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,WAAW,UAAQ;IAGnB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,OAAO,SAAK;IAGZ,QAAQ,MAAY;IAGpB,MAAM,EAAE,OAAO,CAAQ;IAGvB,OAAO,EAAE,OAAO,CAAQ;IAGxB,WAAW,EAAE,OAAO,CAAQ;IAG5B,OAAO,CAAC,aAAa,CAAqB;IAG1C,OAAO,CAAC,WAAW,CAAsC;IAEzD,OAAO,CAAC,WAAW,CAoBjB;IAEF,OAAO,CAAC,qBAAqB,CAQ3B;IAEF,OAAO,CAAC,aAAa,CAWnB;IAEF,OAAO,CAAC,UAAU,CAUhB;IAEF,iBAAiB;IAKjB,oBAAoB;IAMpB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;IAwClD,aAAa;IAqBb,aAAa;IAQb,mBAAmB;IAQnB,aAAa;IAMb,eAAe;IAkBf,uBAAuB,CACrB,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE;IASxD,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM;IAiB9D,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM;IAiBhE,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,0BAA0B;YAUpB,qBAAqB;YAiCrB,YAAY;YAiBZ,UAAU;IAcxB,OAAO,CAAC,WAAW;IAQnB,MAAM;CA4BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
@@ -1,13 +1,14 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-122da399.js';
1
+ import { T as TailwindStyledElement, x, A } from '../../index-3373dd2c.js';
2
2
  import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
3
  import { t } from '../../state-0a779257.js';
4
- import { c as customClassMap } from '../../index-5e194caf.js';
4
+ import { s as se } from '../../index-c55a1069.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-04ec407e.js';
8
9
  import '../../directive-2bb7789e.js';
9
- import '../../style-map-d0fa91c8.js';
10
- import '../../index-9c2f800a.js';
10
+ import '../../index-5e194caf.js';
11
+ import '../../index-b02bfbc3.js';
11
12
 
12
13
  const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
13
14
 
@@ -39,11 +40,62 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
39
40
  this.selected = void 0;
40
41
  this.isOpen = false;
41
42
  this.openTop = false;
43
+ this.isLargeIcon = false;
42
44
  this.optionsParsed = [];
43
45
  this.valueParsed = void 0;
44
- this.defaultInputStyles = `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-11
45
- border-solid h-[48px] placeholder:text-neutral-70 select-none whitespace-nowrap
46
- outline-none transition transition-all duration-150 appearance-none rounded-12`;
46
+ this.inputStyles = se({
47
+ base: `bg-neutral-100 paragraph-inter-14-regular px-4 py-3 pr-11
48
+ border border-solid h-[48px] placeholder:text-neutral-70 select-none whitespace-nowrap
49
+ outline-none transition transition-all duration-150 appearance-none rounded-12
50
+ text-neutral-20 cursor-pointer border-neutral-90 group-hover:border-neutral-35
51
+ flex items-center`,
52
+ variants: {
53
+ isFullWidth: {
54
+ true: `w-full`
55
+ },
56
+ isDisabled: {
57
+ true: `cursor-not-allowed text-neutral-60 group-hover:border-neutral-90`
58
+ },
59
+ hasError: {
60
+ true: `border-red-85 group-hover:border-red-65`
61
+ },
62
+ borderless: {
63
+ true: `border-0`
64
+ }
65
+ }
66
+ });
67
+ this.dropdownWrapperStyles = se({
68
+ base: `bg-neutral-100 border w-full border-neutral-90 shadow-1xl rounded-12 p-3 z-50
69
+ flex absolute flex-col gap-1 overflow-y-auto max-h-64 mt-2`,
70
+ variants: {
71
+ openTop: {
72
+ true: `bottom-[48px] mb-2 mt-0`
73
+ }
74
+ }
75
+ });
76
+ this.optionsStyles = se({
77
+ base: `paragraph-inter-14-regular text-neutral-20 cursor-pointer rounded-8 p-2
78
+ whitespace-nowrap hover:bg-neutral-98 flex items-center`,
79
+ variants: {
80
+ isSelected: {
81
+ true: `bg-neutral-95 hover:bg-neutral-95`
82
+ },
83
+ isActive: {
84
+ true: `bg-neutral-98`
85
+ }
86
+ }
87
+ });
88
+ this.iconStyles = se({
89
+ base: `absolute right-0 mr-3 transition cursor-pointer`,
90
+ variants: {
91
+ isDisabled: {
92
+ true: `opacity-60 cursor-not-allowed`
93
+ },
94
+ isOpen: {
95
+ true: `rotate-180`
96
+ }
97
+ }
98
+ });
47
99
  }
48
100
  connectedCallback() {
49
101
  super.connectedCallback();
@@ -87,19 +139,17 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
87
139
  }
88
140
  }
89
141
  inputTemplate() {
142
+ const inputStyles = this.inputStyles({
143
+ isFullWidth: this.isFullWidth,
144
+ isDisabled: this.isDisabled,
145
+ hasError: !!this.error,
146
+ borderless: this.borderless
147
+ });
90
148
  return x`
91
149
  <div
92
150
  id=${this.id}
93
151
  data-testid=${this.id ? `select-${this.id}` : "select"}
94
- class=${customClassMap({
95
- [this.defaultInputStyles]: true,
96
- ["border-neutral-90 group-hover:border-neutral-35"]: !!!this.error && !this.isDisabled,
97
- ["border-red-85 group-hover:border-red-65"]: !!this.error,
98
- ["w-full"]: this.isFullWidth,
99
- ["cursor-not-allowed text-neutral-60"]: this.isDisabled,
100
- ["text-neutral-20 cursor-pointer"]: !this.isDisabled,
101
- [this.borderless ? "border-0" : "border"]: true
102
- })}
152
+ class=${inputStyles}
103
153
  @blur=${this.handleBlur}
104
154
  @click=${this.handleClick}
105
155
  >
@@ -132,6 +182,8 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
132
182
  const index = Number(option[0]);
133
183
  if ("value" in option[1]) {
134
184
  optionTemplates.push(this.optionStringTemplate(option[1], index));
185
+ } else if ("address" in option[1]) {
186
+ optionTemplates.push(this.optionProfileTemplate(option[1], index));
135
187
  } else {
136
188
  console.error("Unknown option type", option);
137
189
  }
@@ -139,40 +191,71 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
139
191
  return x`${this.dropdownWrapperTemplate(optionTemplates)}`;
140
192
  }
141
193
  dropdownWrapperTemplate(innerTemplate) {
194
+ const dropdownWrapperStyles = this.dropdownWrapperStyles({
195
+ openTop: this.openTop
196
+ });
197
+ return x`<div class="${dropdownWrapperStyles}">${innerTemplate}</div>`;
198
+ }
199
+ optionStringTemplate(option, index) {
200
+ const optionsStyles = this.optionsStyles({
201
+ isSelected: this.valueParsed?.id === option.id,
202
+ isActive: this.selected === index + 1 && this.valueParsed?.id !== option.id
203
+ });
142
204
  return x`<div
143
- class="bg-neutral-100 border w-full border-neutral-90 shadow-1xl rounded-12 p-3 z-50 flex absolute flex-col gap-1 overflow-y-auto max-h-64 ${customClassMap(
144
- {
145
- ["bottom-[48px] mb-2"]: this.openTop,
146
- ["mt-2"]: !this.openTop
147
- }
148
- )}
149
- )}"
205
+ data-id="${option.id}"
206
+ data-index="${index + 1}"
207
+ class="${optionsStyles}"
208
+ @click=${() => this.handleSelect(option)}
150
209
  >
151
- ${innerTemplate}
210
+ ${this.optionStringValue(option)}
152
211
  </div>`;
153
212
  }
154
- optionStringTemplate(option, index) {
213
+ optionProfileTemplate(option, index) {
214
+ const optionsStyles = this.optionsStyles({
215
+ isSelected: this.valueParsed?.id === option.id,
216
+ isActive: this.selected === index + 1 && this.valueParsed?.id !== option.id
217
+ });
155
218
  return x`<div
156
219
  data-id="${option.id}"
157
220
  data-index="${index + 1}"
158
- class="paragraph-inter-14-regular text-neutral-20 cursor-pointer rounded-8 p-2 whitespace-nowrap ${customClassMap(
159
- {
160
- ["bg-neutral-95 hover:bg-neutral-95"]: this.valueParsed?.id === option.id,
161
- ["bg-neutral-98"]: this.selected === index + 1 && this.valueParsed?.id !== option.id,
162
- ["hover:bg-neutral-98"]: this.valueParsed?.id !== option.id
163
- }
164
- )}"
221
+ class="${optionsStyles}"
165
222
  @click=${() => this.handleSelect(option)}
166
223
  >
167
- ${option.value}
224
+ ${this.optionProfileValue(option)}
168
225
  </div>`;
169
226
  }
227
+ optionStringValue(option) {
228
+ return option.value;
229
+ }
230
+ optionProfileValue(option) {
231
+ return x`<lukso-profile
232
+ profile-address="${option.address}"
233
+ profile-url="${option.image}"
234
+ size="x-small"
235
+ has-identicon
236
+ class="mr-2"
237
+ ></lukso-profile>
238
+ <lukso-username
239
+ name="${option.name?.toLowerCase()}"
240
+ address="${option.address}"
241
+ name-color="neutral-20"
242
+ max-width="150"
243
+ slice-by="4"
244
+ size="medium"
245
+ ></lukso-username>`;
246
+ }
170
247
  selectedValue() {
171
248
  const foundValue = this.optionsParsed.find(
172
249
  (option) => option.id === this.valueParsed?.id
173
250
  );
174
251
  if (foundValue) {
175
- return foundValue.value;
252
+ if ("value" in foundValue) {
253
+ return this.optionStringValue(foundValue);
254
+ } else if ("address" in foundValue) {
255
+ return this.optionProfileValue(foundValue);
256
+ } else {
257
+ console.error("Unknown value type", foundValue);
258
+ }
176
259
  }
177
260
  return "";
178
261
  }
@@ -238,6 +321,10 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
238
321
  this.isOpen = !this.isOpen;
239
322
  }
240
323
  render() {
324
+ const iconStyles = this.iconStyles({
325
+ isDisabled: this.isDisabled,
326
+ isOpen: this.isOpen
327
+ });
241
328
  return x`
242
329
  <div class="relative w-[inherit]">
243
330
  ${this.label ? this.labelTemplate() : A}
@@ -245,12 +332,8 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
245
332
  <div class="group">
246
333
  <div class="flex relative items-center">
247
334
  ${this.inputTemplate()}<lukso-icon
248
- name=${this.isFullWidth ? "arrow-down-lg" : "arrow-down-sm"}
249
- class="absolute right-0 mr-3 transition ${customClassMap({
250
- ["opacity-60 cursor-not-allowed"]: this.isDisabled,
251
- ["cursor-pointer"]: !this.isDisabled,
252
- ["rotate-180"]: this.isOpen
253
- })}"
335
+ name=${this.isLargeIcon ? "arrow-down-lg" : "arrow-down-sm"}
336
+ class="${iconStyles}"
254
337
  @click=${this.handleClick}
255
338
  ></lukso-icon>
256
339
  </div>
@@ -305,6 +388,9 @@ __decorateClass([
305
388
  __decorateClass([
306
389
  n({ type: Boolean, attribute: "open-top" })
307
390
  ], LuksoSelect.prototype, "openTop", 2);
391
+ __decorateClass([
392
+ n({ type: Boolean, attribute: "is-large-icon" })
393
+ ], LuksoSelect.prototype, "isLargeIcon", 2);
308
394
  __decorateClass([
309
395
  t()
310
396
  ], LuksoSelect.prototype, "optionsParsed", 2);
@@ -6,4 +6,6 @@ export default meta;
6
6
  export declare const DefaultSelect: any;
7
7
  /** Example of select that open top. */
8
8
  export declare const OpenTop: any;
9
+ /** Example of select with `profile` values. */
10
+ export declare const ProfileSelect: any;
9
11
  //# sourceMappingURL=lukso-select.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-select.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/lukso-select.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAGhD,OAAO,SAAS,CAAA;AAEhB,+DAA+D;AAC/D,QAAA,MAAM,IAAI,EAAE,IAiLX,CAAA;AAED,eAAe,IAAI,CAAA;AAgDnB,+CAA+C;AAC/C,eAAO,MAAM,aAAa,KAAoB,CAAA;AAK9C,wCAAwC;AACxC,eAAO,MAAM,OAAO,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-select.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/lukso-select.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAGhD,OAAO,SAAS,CAAA;AAEhB,+DAA+D;AAC/D,QAAA,MAAM,IAAI,EAAE,IAiMX,CAAA;AAED,eAAe,IAAI,CAAA;AAkDnB,+CAA+C;AAC/C,eAAO,MAAM,aAAa,KAAoB,CAAA;AAK9C,wCAAwC;AACxC,eAAO,MAAM,OAAO,KAAoB,CAAA;AAMxC,gDAAgD;AAChD,eAAO,MAAM,aAAa,KAAoB,CAAA"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-f25fc3ea.cjs');
5
+ const shared_tailwindElement_index = require('../../index-534893a1.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
7
 
8
8
  const style = ":host {\n display: inline-flex\n}";
@@ -1,4 +1,4 @@
1
- import { T as TailwindStyledElement, x } from '../../index-122da399.js';
1
+ import { T as TailwindStyledElement, x } from '../../index-3373dd2c.js';
2
2
  import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
3
 
4
4
  const style = ":host {\n display: inline-flex\n}";