@florid-kit/components 0.3.20 → 0.3.21

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 (3) hide show
  1. package/index.js +2 -2
  2. package/index.mjs +2 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -656,7 +656,7 @@
656
656
  text-decoration: underline;
657
657
  cursor: pointer;
658
658
  }
659
- `;Y([l({type:Number})],U.prototype,"rating",2);Y([l({type:String})],U.prototype,"reviewCount",2);Y([l({type:String})],U.prototype,"href",2);U=Y([T("o-rating")],U);var Ee=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,y=(o,t,e,s)=>{for(var n=s>1?void 0:s?Ce(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&Ee(t,e,n),n};let b=class extends ${constructor(){super(...arguments),this.open=!1,this.showHeader=!0,this.showFooter=!1,this.headerTitle="",this.closeButtonLabel="Close the modal",this.firstButtonLabel="First Button",this.firstButtonVariant="primary",this.secondaryButtonLabel="Second Button",this.secondaryButtonVariant="primary",this.previousFocusedElement=null,this.handleKeyDown=o=>{this.open&&(o.key==="Escape"?this.closePanel():o.key==="Tab"&&this.trapFocus(o))}}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}trapFocus(o){const t=this.getFocusableElements();if(t.length===0)return;const e=t[0],s=t[t.length-1];o.shiftKey&&document.activeElement===e?(o.preventDefault(),s.focus()):!o.shiftKey&&document.activeElement===s&&(o.preventDefault(),e.focus())}getFocusableElements(){const o=this.renderRoot.querySelector(".panel");return o?Array.from(o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(t=>!t.hasAttribute("disabled")):[]}openPanel(){this.previousFocusedElement=document.activeElement,this.open=!0,this.updateComplete.then(()=>{const o=this.getFocusableElements()[0];o==null||o.focus()})}closePanel(){var o;this.open=!1,(o=this.previousFocusedElement)==null||o.focus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}handleFirstClick(){typeof this.onFirstButtonClick=="function"&&this.onFirstButtonClick(),this.closePanel()}handleSecondaryClick(){typeof this.onSecondaryButtonClick=="function"&&this.onSecondaryButtonClick(),this.closePanel()}render(){return d`
659
+ `;Y([l({type:Number})],U.prototype,"rating",2);Y([l({type:String})],U.prototype,"reviewCount",2);Y([l({type:String})],U.prototype,"href",2);U=Y([T("o-rating")],U);var Ee=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,y=(o,t,e,s)=>{for(var n=s>1?void 0:s?Ce(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&Ee(t,e,n),n};let b=class extends ${constructor(){super(...arguments),this.open=!1,this.showHeader=!0,this.showFooter=!1,this.headerTitle="",this.closeButtonLabel="Close the modal",this.firstButtonLabel="Close",this.firstButtonVariant="primary",this.secondaryButtonLabel="",this.secondaryButtonVariant="secondary",this.previousFocusedElement=null,this.handleKeyDown=o=>{this.open&&(o.key==="Escape"?this.closePanel():o.key==="Tab"&&this.trapFocus(o))}}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}trapFocus(o){const t=this.getFocusableElements();if(t.length===0)return;const e=t[0],s=t[t.length-1];o.shiftKey&&document.activeElement===e?(o.preventDefault(),s.focus()):!o.shiftKey&&document.activeElement===s&&(o.preventDefault(),e.focus())}getFocusableElements(){const o=this.renderRoot.querySelector(".panel");return o?Array.from(o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(t=>!t.hasAttribute("disabled")):[]}openPanel(){this.previousFocusedElement=document.activeElement,this.open=!0,this.updateComplete.then(()=>{const o=this.getFocusableElements()[0];o==null||o.focus()})}closePanel(){var o;this.open=!1,(o=this.previousFocusedElement)==null||o.focus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}handleFirstClick(){typeof this.onFirstButtonClick=="function"&&this.onFirstButtonClick(),this.closePanel()}handleSecondaryClick(){typeof this.onSecondaryButtonClick=="function"&&this.onSecondaryButtonClick(),this.closePanel()}render(){return d`
660
660
  <div class="overlay" @click=${this.closePanel}></div>
661
661
  <div
662
662
  class="panel"
@@ -676,7 +676,7 @@
676
676
  <slot></slot>
677
677
  </div>
678
678
 
679
- ${this.showFooter&&this.firstButtonVariant&&this.firstButtonLabel||this.secondaryButtonVariant&&this.secondaryButtonLabel?d`
679
+ ${this.showFooter?d`
680
680
  <div class="footer">
681
681
  ${this.firstButtonVariant&&this.firstButtonLabel?d`
682
682
  <o-button
package/index.mjs CHANGED
@@ -1578,7 +1578,7 @@ var Ee = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, y = (o, t,
1578
1578
  };
1579
1579
  let b = class extends $ {
1580
1580
  constructor() {
1581
- super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.headerTitle = "", this.closeButtonLabel = "Close the modal", this.firstButtonLabel = "First Button", this.firstButtonVariant = "primary", this.secondaryButtonLabel = "Second Button", this.secondaryButtonVariant = "primary", this.previousFocusedElement = null, this.handleKeyDown = (o) => {
1581
+ super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.headerTitle = "", this.closeButtonLabel = "Close the modal", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.secondaryButtonLabel = "", this.secondaryButtonVariant = "secondary", this.previousFocusedElement = null, this.handleKeyDown = (o) => {
1582
1582
  this.open && (o.key === "Escape" ? this.closePanel() : o.key === "Tab" && this.trapFocus(o));
1583
1583
  };
1584
1584
  }
@@ -1641,7 +1641,7 @@ let b = class extends $ {
1641
1641
  <slot></slot>
1642
1642
  </div>
1643
1643
 
1644
- ${this.showFooter && this.firstButtonVariant && this.firstButtonLabel || this.secondaryButtonVariant && this.secondaryButtonLabel ? d`
1644
+ ${this.showFooter ? d`
1645
1645
  <div class="footer">
1646
1646
  ${this.firstButtonVariant && this.firstButtonLabel ? d`
1647
1647
  <o-button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florid-kit/components",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",