@lukso/web-components 1.153.0 → 1.154.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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const e=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
7
+
8
+ export { e };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @license
5
+ * Copyright 2017 Google LLC
6
+ * SPDX-License-Identifier: BSD-3-Clause
7
+ */
8
+ const e=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
9
+
10
+ exports.e = e;
@@ -6,6 +6,7 @@ const components_luksoProfile_index = require('../../index-U4Y7KwZv.cjs');
6
6
  const shared_tailwindElement_index = require('../../index-DkfODalz.cjs');
7
7
  const property = require('../../property-BXmHod5d.cjs');
8
8
  const state = require('../../state-CW2YmM3f.cjs');
9
+ const base = require('../../base-NFGX42U4.cjs');
9
10
  const styleMap = require('../../style-map-c2S85yDu.cjs');
10
11
  const index = require('../../index-CaJky2qL.cjs');
11
12
  require('../../tailwind-config.cjs');
@@ -14,18 +15,11 @@ const isAddress = require('../../isAddress-B3b91Jxf.cjs');
14
15
  const index$1 = require('../../index-m3XGqZFz.cjs');
15
16
  require('../lukso-image/index.cjs');
16
17
 
17
- /**
18
- * @license
19
- * Copyright 2017 Google LLC
20
- * SPDX-License-Identifier: BSD-3-Clause
21
- */
22
- const e=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
23
-
24
18
  /**
25
19
  * @license
26
20
  * Copyright 2021 Google LLC
27
21
  * SPDX-License-Identifier: BSD-3-Clause
28
- */function o(o){return (e$1,n)=>{const{slot:r,selector:s}=o??{},c="slot"+(r?`[name=${r}]`:":not([name])");return e(e$1,n,{get(){const t=this.renderRoot?.querySelector(c),e=t?.assignedElements(o)??[];return void 0===s?e:e.filter((t=>t.matches(s)))}})}}
22
+ */function o(o){return (e,n)=>{const{slot:r,selector:s}=o??{},c="slot"+(r?`[name=${r}]`:":not([name])");return base.e(e,n,{get(){const t=this.renderRoot?.querySelector(c),e=t?.assignedElements(o)??[];return void 0===s?e:e.filter((t=>t.matches(s)))}})}}
29
23
 
30
24
  const backgroundGradient = (address) => {
31
25
  let gradientStart = "#24354210";
@@ -2,6 +2,7 @@ import { m as makeBlockie } from '../../index-CvWyP3CS.js';
2
2
  import { T as TailwindStyledElement, x, E } from '../../index-C9vH8YlV.js';
3
3
  import { n, t } from '../../property-B4XYi6Sk.js';
4
4
  import { r } from '../../state-CkvZ4IP8.js';
5
+ import { e } from '../../base-Cl6v8-BZ.js';
5
6
  import { o as o$1 } from '../../style-map-D1R4wi4h.js';
6
7
  import { c as ce } from '../../index-B9iart53.js';
7
8
  import '../../tailwind-config.js';
@@ -10,13 +11,6 @@ import { i as isAddress } from '../../isAddress-Dq9UN07g.js';
10
11
  import { c as customStyleMap } from '../../index-gJTlTDGh.js';
11
12
  import '../lukso-image/index.js';
12
13
 
13
- /**
14
- * @license
15
- * Copyright 2017 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */
18
- const e=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
19
-
20
14
  /**
21
15
  * @license
22
16
  * Copyright 2021 Google LLC
@@ -5,11 +5,18 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
  const shared_tailwindElement_index = require('../../index-DkfODalz.cjs');
6
6
  const property = require('../../property-BXmHod5d.cjs');
7
7
  const state = require('../../state-CW2YmM3f.cjs');
8
+ const base = require('../../base-NFGX42U4.cjs');
8
9
  const index = require('../../index-CaJky2qL.cjs');
9
10
  require('../../tailwind-config.cjs');
10
11
  const cn = require('../../cn-CNdKneQ1.cjs');
11
12
  require('../lukso-icon/index.cjs');
12
13
 
14
+ /**
15
+ * @license
16
+ * Copyright 2017 Google LLC
17
+ * SPDX-License-Identifier: BSD-3-Clause
18
+ */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return base.e(n,s,{get(){return o(this)}})}}
19
+
13
20
  var __defProp = Object.defineProperty;
14
21
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
22
  var __decorateClass = (decorators, target, key, kind) => {
@@ -33,9 +40,16 @@ exports.LuksoCollapse = class LuksoCollapse extends shared_tailwindElement_index
33
40
  this.isDisabled = false;
34
41
  this.icon = "";
35
42
  this.maxHeight = "0px";
43
+ this.observedHeight = 0;
44
+ this.onTransitionEnd = (e) => {
45
+ if (e.propertyName !== "max-height") return;
46
+ this.dispatchEvent(
47
+ new CustomEvent(this.isOpen ? "after-enter" : "after-leave")
48
+ );
49
+ };
36
50
  this.collapseStyles = index.ce({
37
51
  slots: {
38
- base: "hover:border-neutral-35 ransition transition-all duration-150",
52
+ base: "hover:border-neutral-35 transition transition-all duration-150",
39
53
  header: "flex items-center justify-between cursor-pointer ml-3 py-2",
40
54
  label: "text-neutral-45 paragraph-inter-14-semi-bold",
41
55
  secondary: "text-neutral-45 paragraph-inter-14-semi-bold",
@@ -63,27 +77,35 @@ exports.LuksoCollapse = class LuksoCollapse extends shared_tailwindElement_index
63
77
  });
64
78
  }
65
79
  firstUpdated() {
66
- if (this.isOpen) {
67
- this.updateHeight();
80
+ if ("ResizeObserver" in window) {
81
+ this.resizeObserver = new ResizeObserver(() => this.syncHeight());
82
+ this.resizeObserver.observe(this.contentElement);
68
83
  }
84
+ this.syncHeight(true);
85
+ }
86
+ disconnectedCallback() {
87
+ this.resizeObserver?.disconnect();
88
+ super.disconnectedCallback();
69
89
  }
70
90
  updated(changed) {
71
91
  if (changed.has("isOpen")) {
72
- this.updateHeight();
92
+ this.syncHeight();
73
93
  }
74
94
  }
75
- updateHeight() {
76
- const content = this.renderRoot.querySelector(
77
- ".collapse-content"
78
- );
95
+ syncHeight(immediate = false) {
96
+ const content = this.contentElement;
79
97
  if (!content) return;
98
+ const height = content.scrollHeight;
99
+ this.observedHeight = height;
80
100
  if (this.isOpen) {
81
- this.maxHeight = `${content.scrollHeight}px`;
101
+ if (immediate) {
102
+ this.maxHeight = `${height}px`;
103
+ } else {
104
+ if (this.maxHeight !== `${height}px`) this.maxHeight = `${height}px`;
105
+ }
82
106
  } else {
83
- this.maxHeight = `${content.scrollHeight}px`;
84
- requestAnimationFrame(() => {
85
- this.maxHeight = "0px";
86
- });
107
+ this.maxHeight = `${height}px`;
108
+ requestAnimationFrame(() => this.maxHeight = "0px");
87
109
  }
88
110
  }
89
111
  toggle() {
@@ -117,8 +139,14 @@ exports.LuksoCollapse = class LuksoCollapse extends shared_tailwindElement_index
117
139
  </div>
118
140
 
119
141
  <!-- Content -->
120
- <div class=${content()} style="max-height:${this.maxHeight};">
121
- <div class="collapse-content"><slot></slot></div>
142
+ <div
143
+ class=${content()}
144
+ style="max-height:${this.maxHeight};"
145
+ @transitionend=${this.onTransitionEnd}
146
+ >
147
+ <div class="collapse-content">
148
+ <slot @slotchange=${() => this.syncHeight()}></slot>
149
+ </div>
122
150
  </div>
123
151
  </div>
124
152
  `;
@@ -145,6 +173,12 @@ __decorateClass([
145
173
  __decorateClass([
146
174
  state.r()
147
175
  ], exports.LuksoCollapse.prototype, "maxHeight", 2);
176
+ __decorateClass([
177
+ state.r()
178
+ ], exports.LuksoCollapse.prototype, "observedHeight", 2);
179
+ __decorateClass([
180
+ e(".collapse-content")
181
+ ], exports.LuksoCollapse.prototype, "contentElement", 2);
148
182
  exports.LuksoCollapse = __decorateClass([
149
183
  property.t("lukso-collapse")
150
184
  ], exports.LuksoCollapse);
@@ -10,9 +10,14 @@ export declare class LuksoCollapse extends TailwindElement {
10
10
  isDisabled: boolean;
11
11
  icon: string;
12
12
  private maxHeight;
13
+ private observedHeight;
14
+ private contentElement;
15
+ private resizeObserver?;
13
16
  firstUpdated(): void;
17
+ disconnectedCallback(): void;
14
18
  updated(changed: Map<string, unknown>): void;
15
- private updateHeight;
19
+ private syncHeight;
20
+ private onTransitionEnd;
16
21
  private toggle;
17
22
  private collapseStyles;
18
23
  render(): import('lit-html').TemplateResult<1>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-collapse/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,yBAAyB,CAAA;AAEhC,qBACa,aAAc,SAAQ,eAAe;IAEhD,KAAK,SAAK;IAGV,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAG9C;IAGD,MAAM,UAAQ;IAGd,WAAW,SAAK;IAGhB,UAAU,UAAQ;IAGlB,IAAI,SAAK;IAEA,OAAO,CAAC,SAAS,CAAQ;IAElC,YAAY;IAMZ,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAMrC,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,cAAc,CA2BpB;IAEF,MAAM;CAuCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAA;KAChC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-collapse/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,yBAAyB,CAAA;AAEhC,qBACa,aAAc,SAAQ,eAAe;IAEhD,KAAK,SAAK;IAGV,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAG9C;IAGD,MAAM,UAAQ;IAGd,WAAW,SAAK;IAGhB,UAAU,UAAQ;IAGlB,IAAI,SAAK;IAEA,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,cAAc,CAAI;IAEP,OAAO,CAAC,cAAc,CAAc;IAChE,OAAO,CAAC,cAAc,CAAC,CAAgB;IAEvC,YAAY;IAQZ,oBAAoB,IAAI,IAAI;IAK5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAMrC,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,cAAc,CA2BpB;IAEF,MAAM;CA6CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAA;KAChC;CACF"}
@@ -1,11 +1,18 @@
1
1
  import { a as TailwindElement, x } from '../../index-C9vH8YlV.js';
2
2
  import { n, t } from '../../property-B4XYi6Sk.js';
3
3
  import { r } from '../../state-CkvZ4IP8.js';
4
+ import { e as e$1 } from '../../base-Cl6v8-BZ.js';
4
5
  import { c as ce } from '../../index-B9iart53.js';
5
6
  import '../../tailwind-config.js';
6
7
  import { c as cn } from '../../cn-Cu9aP49j.js';
7
8
  import '../lukso-icon/index.js';
8
9
 
10
+ /**
11
+ * @license
12
+ * Copyright 2017 Google LLC
13
+ * SPDX-License-Identifier: BSD-3-Clause
14
+ */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
15
+
9
16
  var __defProp = Object.defineProperty;
10
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
18
  var __decorateClass = (decorators, target, key, kind) => {
@@ -29,9 +36,16 @@ let LuksoCollapse = class extends TailwindElement {
29
36
  this.isDisabled = false;
30
37
  this.icon = "";
31
38
  this.maxHeight = "0px";
39
+ this.observedHeight = 0;
40
+ this.onTransitionEnd = (e) => {
41
+ if (e.propertyName !== "max-height") return;
42
+ this.dispatchEvent(
43
+ new CustomEvent(this.isOpen ? "after-enter" : "after-leave")
44
+ );
45
+ };
32
46
  this.collapseStyles = ce({
33
47
  slots: {
34
- base: "hover:border-neutral-35 ransition transition-all duration-150",
48
+ base: "hover:border-neutral-35 transition transition-all duration-150",
35
49
  header: "flex items-center justify-between cursor-pointer ml-3 py-2",
36
50
  label: "text-neutral-45 paragraph-inter-14-semi-bold",
37
51
  secondary: "text-neutral-45 paragraph-inter-14-semi-bold",
@@ -59,27 +73,35 @@ let LuksoCollapse = class extends TailwindElement {
59
73
  });
60
74
  }
61
75
  firstUpdated() {
62
- if (this.isOpen) {
63
- this.updateHeight();
76
+ if ("ResizeObserver" in window) {
77
+ this.resizeObserver = new ResizeObserver(() => this.syncHeight());
78
+ this.resizeObserver.observe(this.contentElement);
64
79
  }
80
+ this.syncHeight(true);
81
+ }
82
+ disconnectedCallback() {
83
+ this.resizeObserver?.disconnect();
84
+ super.disconnectedCallback();
65
85
  }
66
86
  updated(changed) {
67
87
  if (changed.has("isOpen")) {
68
- this.updateHeight();
88
+ this.syncHeight();
69
89
  }
70
90
  }
71
- updateHeight() {
72
- const content = this.renderRoot.querySelector(
73
- ".collapse-content"
74
- );
91
+ syncHeight(immediate = false) {
92
+ const content = this.contentElement;
75
93
  if (!content) return;
94
+ const height = content.scrollHeight;
95
+ this.observedHeight = height;
76
96
  if (this.isOpen) {
77
- this.maxHeight = `${content.scrollHeight}px`;
97
+ if (immediate) {
98
+ this.maxHeight = `${height}px`;
99
+ } else {
100
+ if (this.maxHeight !== `${height}px`) this.maxHeight = `${height}px`;
101
+ }
78
102
  } else {
79
- this.maxHeight = `${content.scrollHeight}px`;
80
- requestAnimationFrame(() => {
81
- this.maxHeight = "0px";
82
- });
103
+ this.maxHeight = `${height}px`;
104
+ requestAnimationFrame(() => this.maxHeight = "0px");
83
105
  }
84
106
  }
85
107
  toggle() {
@@ -113,8 +135,14 @@ let LuksoCollapse = class extends TailwindElement {
113
135
  </div>
114
136
 
115
137
  <!-- Content -->
116
- <div class=${content()} style="max-height:${this.maxHeight};">
117
- <div class="collapse-content"><slot></slot></div>
138
+ <div
139
+ class=${content()}
140
+ style="max-height:${this.maxHeight};"
141
+ @transitionend=${this.onTransitionEnd}
142
+ >
143
+ <div class="collapse-content">
144
+ <slot @slotchange=${() => this.syncHeight()}></slot>
145
+ </div>
118
146
  </div>
119
147
  </div>
120
148
  `;
@@ -141,6 +169,12 @@ __decorateClass([
141
169
  __decorateClass([
142
170
  r()
143
171
  ], LuksoCollapse.prototype, "maxHeight", 2);
172
+ __decorateClass([
173
+ r()
174
+ ], LuksoCollapse.prototype, "observedHeight", 2);
175
+ __decorateClass([
176
+ e(".collapse-content")
177
+ ], LuksoCollapse.prototype, "contentElement", 2);
144
178
  LuksoCollapse = __decorateClass([
145
179
  t("lukso-collapse")
146
180
  ], LuksoCollapse);
@@ -1,10 +1,17 @@
1
1
  import { Meta } from '@storybook/web-components-vite';
2
+ /** Documentation and examples of `lukso-collapse` component. */
2
3
  declare const meta: Meta;
3
4
  export default meta;
4
- export declare const DefaultClosed: any;
5
- export declare const DefaultOpen: any;
6
- export declare const DefaultDisabled: any;
7
- export declare const WithCustomClass: any;
8
- export declare const WithLongContent: any;
9
- export declare const WithSelector: any;
5
+ /** Example of `lukso-collapse` */
6
+ export declare const LuksoCollapse: any;
7
+ /** Example of lukso-collapse `open` by default */
8
+ export declare const CollapseOpen: any;
9
+ /** Example of lukso-collapse `disabled` */
10
+ export declare const CollapseDisabled: any;
11
+ /** Example of lukso-collapse with a `custom CSS class` */
12
+ export declare const CollapseWithCustomClass: any;
13
+ /** Example of lukso-collapse with `longer content` */
14
+ export declare const CollapseWithLongContent: any;
15
+ /** Example of lukso-collapse with a `selector` as content */
16
+ export declare const CollapseWithSelector: any;
10
17
  //# sourceMappingURL=lukso-collapse.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-collapse.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-collapse/lukso-collapse.stories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAA;AAC1D,OAAO,SAAS,CAAA;AAChB,OAAO,uBAAuB,CAAA;AAE9B,QAAA,MAAM,IAAI,EAAE,IAuFX,CAAA;AAED,eAAe,IAAI,CAAA;AA4BnB,eAAO,MAAM,aAAa,KAAoB,CAAA;AAS9C,eAAO,MAAM,WAAW,KAAoB,CAAA;AAQ5C,eAAO,MAAM,eAAe,KAAoB,CAAA;AAUhD,eAAO,MAAM,eAAe,KAAoB,CAAA;AAOhD,eAAO,MAAM,eAAe,KAAoB,CAAA;AAqBhD,eAAO,MAAM,YAAY,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-collapse.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-collapse/lukso-collapse.stories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAA;AAC1D,OAAO,SAAS,CAAA;AAChB,OAAO,uBAAuB,CAAA;AAE9B,iEAAiE;AACjE,QAAA,MAAM,IAAI,EAAE,IA+FX,CAAA;AAED,eAAe,IAAI,CAAA;AA4BnB,kCAAkC;AAClC,eAAO,MAAM,aAAa,KAAoB,CAAA;AAS9C,kDAAkD;AAClD,eAAO,MAAM,YAAY,KAAoB,CAAA;AAa7C,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,KAAoB,CAAA;AAUjD,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB,KAAoB,CAAA;AAYxD,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,KAAoB,CAAA;AAqBxD,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,KAAoB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/web-components",
3
- "version": "1.153.0",
3
+ "version": "1.154.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",