@fluid-topics/ft-collapsible 1.0.44 → 1.0.45

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.
@@ -1,4 +1,3 @@
1
- import { PropertyValues } from "lit";
2
1
  import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
2
  import { FtCollapsibleProperties } from "./ft-collapsible.properties";
4
3
  import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
@@ -32,7 +31,7 @@ export declare class FtCollapsible extends FtLitElement implements FtCollapsible
32
31
  private onCustomToggleSlotChange;
33
32
  private hasCustomToggle;
34
33
  private animationEndSafeguard;
34
+ private toggleOpenAnimation;
35
35
  private toggleOpen;
36
- protected update(changedProperties: PropertyValues): void;
37
36
  private onContentClick;
38
37
  }
@@ -37,28 +37,28 @@ class FtCollapsible extends FtLitElement {
37
37
  };
38
38
  return html `
39
39
  <ft-button
40
- part="toggle"
41
- .tooltipPosition=${this.tooltipPosition}
42
- .iconVariant=${this.iconVariant}
43
- .icon=${this.open ? this.openIcon : this.closedIcon}
44
- .label=${(this.open ? this.openLabel : this.closedLabel) || this.label}
45
- ?primary=${this.primary}
46
- ?secondary=${this.secondary}
47
- ?disabled=${this.disabled}
48
- ?dense=${this.dense}
49
- ?round=${this.round}
50
- ?trailingIcon=${this.trailingIcon}
51
- @click=${this.toggleOpen}
52
- class="${this.hasCustomToggle() ? "ft-collapsible--hidden" : ""}"
53
- aria-controls="ft-collapsible-content"
54
- aria-expanded="${this.open}"
40
+ part="toggle"
41
+ .tooltipPosition=${this.tooltipPosition}
42
+ .iconVariant=${this.iconVariant}
43
+ .icon=${this.open ? this.openIcon : this.closedIcon}
44
+ .label=${(this.open ? this.openLabel : this.closedLabel) || this.label}
45
+ ?primary=${this.primary}
46
+ ?secondary=${this.secondary}
47
+ ?disabled=${this.disabled}
48
+ ?dense=${this.dense}
49
+ ?round=${this.round}
50
+ ?trailingIcon=${this.trailingIcon}
51
+ @click=${this.toggleOpenAnimation}
52
+ class="${this.hasCustomToggle() ? "ft-collapsible--hidden" : ""}"
53
+ aria-controls="ft-collapsible-content"
54
+ aria-expanded="${this.open}"
55
55
  >
56
56
  ${(this.open ? this.openText : this.closedText) || this.text}
57
57
  </ft-button>
58
58
  <slot name="toggle"
59
59
  part="toggle"
60
60
  class="${this.hasCustomToggle() ? "" : "ft-collapsible--hidden"}"
61
- @click=${this.toggleOpen}
61
+ @click=${this.toggleOpenAnimation}
62
62
  @slotchange=${this.onCustomToggleSlotChange}></slot>
63
63
  <slot id="ft-collapsible-content"
64
64
  class="${classMap(contentClasses)}"
@@ -73,20 +73,18 @@ class FtCollapsible extends FtLitElement {
73
73
  var _a, _b;
74
74
  return ((_b = (_a = this.toggleSlot) === null || _a === void 0 ? void 0 : _a.assignedNodes().length) !== null && _b !== void 0 ? _b : 0) !== 0;
75
75
  }
76
- toggleOpen() {
76
+ toggleOpenAnimation() {
77
77
  this.animationInProgress = true;
78
- setTimeout(() => this.open = !this.open, 5);
78
+ setTimeout(() => this.toggleOpen(), 5);
79
79
  this.animationEndSafeguard.run(() => this.animationInProgress = false);
80
80
  }
81
- update(changedProperties) {
82
- super.update(changedProperties);
83
- if (changedProperties.has("open")) {
84
- this.dispatchEvent(new CustomEvent("change", { detail: { open: this.open } }));
85
- }
81
+ toggleOpen() {
82
+ this.open = !this.open;
83
+ this.dispatchEvent(new CustomEvent("change", { detail: { open: this.open } }));
86
84
  }
87
85
  onContentClick(e) {
88
86
  if (eventPathContainsMatchingElement(e, this.closeCollapsibleMatchers, this)) {
89
- this.toggleOpen();
87
+ this.toggleOpenAnimation();
90
88
  }
91
89
  }
92
90
  }
@@ -578,31 +578,31 @@ const tt=Symbol.for(""),it=t=>{if((null==t?void 0:t.r)===tt)return null==t?void
578
578
  }
579
579
  `;var te=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class ie extends i.FtLitElement{constructor(){super(...arguments),this.open=!1,this.animated=!1,this.closeCollapsibleMatchers=[],this.primary=!1,this.secondary=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.tooltipPosition="right",this.openIcon="THIN_ARROW",this.closedIcon="THIN_ARROW_RIGHT",this.trailingIcon=!1,this.animationInProgress=!1,this.animationEndSafeguard=new i.Debouncer(800)}render(){const t={"ft-collapsible--content":!0,"ft-collapsible--hidden":!this.open,"ft-collapsible--animated":this.animated,"ft-collapsible--animation-in-progress":this.animated&&this.animationInProgress};return e.html`
580
580
  <ft-button
581
- part="toggle"
582
- .tooltipPosition=${this.tooltipPosition}
583
- .iconVariant=${this.iconVariant}
584
- .icon=${this.open?this.openIcon:this.closedIcon}
585
- .label=${(this.open?this.openLabel:this.closedLabel)||this.label}
586
- ?primary=${this.primary}
587
- ?secondary=${this.secondary}
588
- ?disabled=${this.disabled}
589
- ?dense=${this.dense}
590
- ?round=${this.round}
591
- ?trailingIcon=${this.trailingIcon}
592
- @click=${this.toggleOpen}
593
- class="${this.hasCustomToggle()?"ft-collapsible--hidden":""}"
594
- aria-controls="ft-collapsible-content"
595
- aria-expanded="${this.open}"
581
+ part="toggle"
582
+ .tooltipPosition=${this.tooltipPosition}
583
+ .iconVariant=${this.iconVariant}
584
+ .icon=${this.open?this.openIcon:this.closedIcon}
585
+ .label=${(this.open?this.openLabel:this.closedLabel)||this.label}
586
+ ?primary=${this.primary}
587
+ ?secondary=${this.secondary}
588
+ ?disabled=${this.disabled}
589
+ ?dense=${this.dense}
590
+ ?round=${this.round}
591
+ ?trailingIcon=${this.trailingIcon}
592
+ @click=${this.toggleOpenAnimation}
593
+ class="${this.hasCustomToggle()?"ft-collapsible--hidden":""}"
594
+ aria-controls="ft-collapsible-content"
595
+ aria-expanded="${this.open}"
596
596
  >
597
597
  ${(this.open?this.openText:this.closedText)||this.text}
598
598
  </ft-button>
599
599
  <slot name="toggle"
600
600
  part="toggle"
601
601
  class="${this.hasCustomToggle()?"":"ft-collapsible--hidden"}"
602
- @click=${this.toggleOpen}
602
+ @click=${this.toggleOpenAnimation}
603
603
  @slotchange=${this.onCustomToggleSlotChange}></slot>
604
604
  <slot id="ft-collapsible-content"
605
605
  class="${s.classMap(t)}"
606
606
  @click=${this.onContentClick}
607
607
  @transitionend=${()=>this.animationInProgress=!1}></slot>
608
- `}onCustomToggleSlotChange(){this.requestUpdate()}hasCustomToggle(){var t,i;return 0!==(null!==(i=null===(t=this.toggleSlot)||void 0===t?void 0:t.assignedNodes().length)&&void 0!==i?i:0)}toggleOpen(){this.animationInProgress=!0,setTimeout((()=>this.open=!this.open),5),this.animationEndSafeguard.run((()=>this.animationInProgress=!1))}update(t){super.update(t),t.has("open")&&this.dispatchEvent(new CustomEvent("change",{detail:{open:this.open}}))}onContentClick(t){i.eventPathContainsMatchingElement(t,this.closeCollapsibleMatchers,this)&&this.toggleOpen()}}ie.elementDefinitions={"ft-button":Ji},ie.styles=Qi,te([o.property({type:Boolean,reflect:!0})],ie.prototype,"open",void 0),te([o.property({type:Boolean})],ie.prototype,"animated",void 0),te([i.jsonProperty([])],ie.prototype,"closeCollapsibleMatchers",void 0),te([o.property()],ie.prototype,"label",void 0),te([o.property()],ie.prototype,"openLabel",void 0),te([o.property()],ie.prototype,"closedLabel",void 0),te([o.property()],ie.prototype,"text",void 0),te([o.property()],ie.prototype,"openText",void 0),te([o.property()],ie.prototype,"closedText",void 0),te([o.property({type:Boolean})],ie.prototype,"primary",void 0),te([o.property({type:Boolean})],ie.prototype,"secondary",void 0),te([o.property({type:Boolean})],ie.prototype,"disabled",void 0),te([o.property({type:Boolean})],ie.prototype,"dense",void 0),te([o.property({type:Boolean})],ie.prototype,"round",void 0),te([o.property()],ie.prototype,"tooltipPosition",void 0),te([o.property()],ie.prototype,"iconVariant",void 0),te([o.property()],ie.prototype,"openIcon",void 0),te([o.property()],ie.prototype,"closedIcon",void 0),te([o.property({type:Boolean})],ie.prototype,"trailingIcon",void 0),te([o.query('slot[name="toggle"]')],ie.prototype,"toggleSlot",void 0),te([o.query(".content")],ie.prototype,"content",void 0),te([o.state()],ie.prototype,"animationInProgress",void 0),i.customElement("ft-collapsible")(ie),t.FtCollapsible=ie,t.styles=Qi}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
608
+ `}onCustomToggleSlotChange(){this.requestUpdate()}hasCustomToggle(){var t,i;return 0!==(null!==(i=null===(t=this.toggleSlot)||void 0===t?void 0:t.assignedNodes().length)&&void 0!==i?i:0)}toggleOpenAnimation(){this.animationInProgress=!0,setTimeout((()=>this.toggleOpen()),5),this.animationEndSafeguard.run((()=>this.animationInProgress=!1))}toggleOpen(){this.open=!this.open,this.dispatchEvent(new CustomEvent("change",{detail:{open:this.open}}))}onContentClick(t){i.eventPathContainsMatchingElement(t,this.closeCollapsibleMatchers,this)&&this.toggleOpenAnimation()}}ie.elementDefinitions={"ft-button":Ji},ie.styles=Qi,te([o.property({type:Boolean,reflect:!0})],ie.prototype,"open",void 0),te([o.property({type:Boolean})],ie.prototype,"animated",void 0),te([i.jsonProperty([])],ie.prototype,"closeCollapsibleMatchers",void 0),te([o.property()],ie.prototype,"label",void 0),te([o.property()],ie.prototype,"openLabel",void 0),te([o.property()],ie.prototype,"closedLabel",void 0),te([o.property()],ie.prototype,"text",void 0),te([o.property()],ie.prototype,"openText",void 0),te([o.property()],ie.prototype,"closedText",void 0),te([o.property({type:Boolean})],ie.prototype,"primary",void 0),te([o.property({type:Boolean})],ie.prototype,"secondary",void 0),te([o.property({type:Boolean})],ie.prototype,"disabled",void 0),te([o.property({type:Boolean})],ie.prototype,"dense",void 0),te([o.property({type:Boolean})],ie.prototype,"round",void 0),te([o.property()],ie.prototype,"tooltipPosition",void 0),te([o.property()],ie.prototype,"iconVariant",void 0),te([o.property()],ie.prototype,"openIcon",void 0),te([o.property()],ie.prototype,"closedIcon",void 0),te([o.property({type:Boolean})],ie.prototype,"trailingIcon",void 0),te([o.query('slot[name="toggle"]')],ie.prototype,"toggleSlot",void 0),te([o.query(".content")],ie.prototype,"content",void 0),te([o.state()],ie.prototype,"animationInProgress",void 0),i.customElement("ft-collapsible")(ie),t.FtCollapsible=ie,t.styles=Qi}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
@@ -695,31 +695,31 @@ class Mi extends Tt{constructor(t){if(super(t),this.et=Y,t.type!==zt)throw Error
695
695
  }
696
696
  `;var Gi=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(e,i,r):n(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class Yi extends Nt{constructor(){super(...arguments),this.open=!1,this.animated=!1,this.closeCollapsibleMatchers=[],this.primary=!1,this.secondary=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.tooltipPosition="right",this.openIcon="THIN_ARROW",this.closedIcon="THIN_ARROW_RIGHT",this.trailingIcon=!1,this.animationInProgress=!1,this.animationEndSafeguard=new e(800)}render(){const t={"ft-collapsible--content":!0,"ft-collapsible--hidden":!this.open,"ft-collapsible--animated":this.animated,"ft-collapsible--animation-in-progress":this.animated&&this.animationInProgress};return X`
697
697
  <ft-button
698
- part="toggle"
699
- .tooltipPosition=${this.tooltipPosition}
700
- .iconVariant=${this.iconVariant}
701
- .icon=${this.open?this.openIcon:this.closedIcon}
702
- .label=${(this.open?this.openLabel:this.closedLabel)||this.label}
703
- ?primary=${this.primary}
704
- ?secondary=${this.secondary}
705
- ?disabled=${this.disabled}
706
- ?dense=${this.dense}
707
- ?round=${this.round}
708
- ?trailingIcon=${this.trailingIcon}
709
- @click=${this.toggleOpen}
710
- class="${this.hasCustomToggle()?"ft-collapsible--hidden":""}"
711
- aria-controls="ft-collapsible-content"
712
- aria-expanded="${this.open}"
698
+ part="toggle"
699
+ .tooltipPosition=${this.tooltipPosition}
700
+ .iconVariant=${this.iconVariant}
701
+ .icon=${this.open?this.openIcon:this.closedIcon}
702
+ .label=${(this.open?this.openLabel:this.closedLabel)||this.label}
703
+ ?primary=${this.primary}
704
+ ?secondary=${this.secondary}
705
+ ?disabled=${this.disabled}
706
+ ?dense=${this.dense}
707
+ ?round=${this.round}
708
+ ?trailingIcon=${this.trailingIcon}
709
+ @click=${this.toggleOpenAnimation}
710
+ class="${this.hasCustomToggle()?"ft-collapsible--hidden":""}"
711
+ aria-controls="ft-collapsible-content"
712
+ aria-expanded="${this.open}"
713
713
  >
714
714
  ${(this.open?this.openText:this.closedText)||this.text}
715
715
  </ft-button>
716
716
  <slot name="toggle"
717
717
  part="toggle"
718
718
  class="${this.hasCustomToggle()?"":"ft-collapsible--hidden"}"
719
- @click=${this.toggleOpen}
719
+ @click=${this.toggleOpenAnimation}
720
720
  @slotchange=${this.onCustomToggleSlotChange}></slot>
721
721
  <slot id="ft-collapsible-content"
722
722
  class="${At(t)}"
723
723
  @click=${this.onContentClick}
724
724
  @transitionend=${()=>this.animationInProgress=!1}></slot>
725
- `}onCustomToggleSlotChange(){this.requestUpdate()}hasCustomToggle(){var t,e;return 0!==(null!==(e=null===(t=this.toggleSlot)||void 0===t?void 0:t.assignedNodes().length)&&void 0!==e?e:0)}toggleOpen(){this.animationInProgress=!0,setTimeout((()=>this.open=!this.open),5),this.animationEndSafeguard.run((()=>this.animationInProgress=!1))}update(t){super.update(t),t.has("open")&&this.dispatchEvent(new CustomEvent("change",{detail:{open:this.open}}))}onContentClick(t){(function(t,e,i){if(e.length>0){const o=t.composedPath();for(let t of o){if(t===i)return!1;if(t.matches&&e.some((e=>t.matches(e))))return!0}}return!1})(t,this.closeCollapsibleMatchers,this)&&this.toggleOpen()}}Yi.elementDefinitions={"ft-button":qi},Yi.styles=Xi,Gi([o({type:Boolean,reflect:!0})],Yi.prototype,"open",void 0),Gi([o({type:Boolean})],Yi.prototype,"animated",void 0),Gi([c([])],Yi.prototype,"closeCollapsibleMatchers",void 0),Gi([o()],Yi.prototype,"label",void 0),Gi([o()],Yi.prototype,"openLabel",void 0),Gi([o()],Yi.prototype,"closedLabel",void 0),Gi([o()],Yi.prototype,"text",void 0),Gi([o()],Yi.prototype,"openText",void 0),Gi([o()],Yi.prototype,"closedText",void 0),Gi([o({type:Boolean})],Yi.prototype,"primary",void 0),Gi([o({type:Boolean})],Yi.prototype,"secondary",void 0),Gi([o({type:Boolean})],Yi.prototype,"disabled",void 0),Gi([o({type:Boolean})],Yi.prototype,"dense",void 0),Gi([o({type:Boolean})],Yi.prototype,"round",void 0),Gi([o()],Yi.prototype,"tooltipPosition",void 0),Gi([o()],Yi.prototype,"iconVariant",void 0),Gi([o()],Yi.prototype,"openIcon",void 0),Gi([o()],Yi.prototype,"closedIcon",void 0),Gi([o({type:Boolean})],Yi.prototype,"trailingIcon",void 0),Gi([r('slot[name="toggle"]')],Yi.prototype,"toggleSlot",void 0),Gi([r(".content")],Yi.prototype,"content",void 0),Gi([n()],Yi.prototype,"animationInProgress",void 0),p("ft-collapsible")(Yi),t.FtCollapsible=Yi,t.styles=Xi}({});
725
+ `}onCustomToggleSlotChange(){this.requestUpdate()}hasCustomToggle(){var t,e;return 0!==(null!==(e=null===(t=this.toggleSlot)||void 0===t?void 0:t.assignedNodes().length)&&void 0!==e?e:0)}toggleOpenAnimation(){this.animationInProgress=!0,setTimeout((()=>this.toggleOpen()),5),this.animationEndSafeguard.run((()=>this.animationInProgress=!1))}toggleOpen(){this.open=!this.open,this.dispatchEvent(new CustomEvent("change",{detail:{open:this.open}}))}onContentClick(t){(function(t,e,i){if(e.length>0){const o=t.composedPath();for(let t of o){if(t===i)return!1;if(t.matches&&e.some((e=>t.matches(e))))return!0}}return!1})(t,this.closeCollapsibleMatchers,this)&&this.toggleOpenAnimation()}}Yi.elementDefinitions={"ft-button":qi},Yi.styles=Xi,Gi([o({type:Boolean,reflect:!0})],Yi.prototype,"open",void 0),Gi([o({type:Boolean})],Yi.prototype,"animated",void 0),Gi([c([])],Yi.prototype,"closeCollapsibleMatchers",void 0),Gi([o()],Yi.prototype,"label",void 0),Gi([o()],Yi.prototype,"openLabel",void 0),Gi([o()],Yi.prototype,"closedLabel",void 0),Gi([o()],Yi.prototype,"text",void 0),Gi([o()],Yi.prototype,"openText",void 0),Gi([o()],Yi.prototype,"closedText",void 0),Gi([o({type:Boolean})],Yi.prototype,"primary",void 0),Gi([o({type:Boolean})],Yi.prototype,"secondary",void 0),Gi([o({type:Boolean})],Yi.prototype,"disabled",void 0),Gi([o({type:Boolean})],Yi.prototype,"dense",void 0),Gi([o({type:Boolean})],Yi.prototype,"round",void 0),Gi([o()],Yi.prototype,"tooltipPosition",void 0),Gi([o()],Yi.prototype,"iconVariant",void 0),Gi([o()],Yi.prototype,"openIcon",void 0),Gi([o()],Yi.prototype,"closedIcon",void 0),Gi([o({type:Boolean})],Yi.prototype,"trailingIcon",void 0),Gi([r('slot[name="toggle"]')],Yi.prototype,"toggleSlot",void 0),Gi([r(".content")],Yi.prototype,"content",void 0),Gi([n()],Yi.prototype,"animationInProgress",void 0),p("ft-collapsible")(Yi),t.FtCollapsible=Yi,t.styles=Xi}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-collapsible",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Collapsible web component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,9 +19,9 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-button": "1.0.44",
23
- "@fluid-topics/ft-wc-utils": "1.0.44",
22
+ "@fluid-topics/ft-button": "1.0.45",
23
+ "@fluid-topics/ft-wc-utils": "1.0.45",
24
24
  "lit": "2.7.2"
25
25
  },
26
- "gitHead": "75d2f2a8af71b60482dd8c302e9ea92fb12e45c6"
26
+ "gitHead": "65789e7f65d22cc6e08cb431f8d24a036309321e"
27
27
  }