@conectate/ct-button
Advanced tools
Comparing version 3.12.1 to 3.12.4
import "@conectate/ct-icon"; | ||
import { icon } from "@conectate/ct-icon/icon-list"; | ||
import { LitElement, TemplateResult } from "lit"; | ||
import { LitElement, PropertyValueMap, TemplateResult } from "lit"; | ||
type leftRight = "left" | "right"; | ||
@@ -21,2 +21,3 @@ type topBottom = "top" | "bottom"; | ||
rotate: boolean; | ||
open: boolean; | ||
/** Location from opened */ | ||
@@ -35,3 +36,3 @@ from?: topBottom | leftRight | `${topBottom}-${leftRight}`; | ||
close(): void; | ||
setAriaExpanded(value: boolean): (e: FocusEvent) => void; | ||
protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void; | ||
extra(): void; | ||
@@ -38,0 +39,0 @@ } |
@@ -22,2 +22,3 @@ import { __decorate } from "tslib"; | ||
this.rotate = false; | ||
this.open = false; | ||
/** Location from opened */ | ||
@@ -129,10 +130,13 @@ this.from = "bottom-left"; | ||
firstUpdated() { | ||
this.addEventListener("focus", this.setAriaExpanded(true)); | ||
this.addEventListener("click", this.setAriaExpanded(true)); | ||
this.addEventListener("blur", this.setAriaExpanded(false)); | ||
this.addEventListener("focusin", () => { | ||
this.open = true; | ||
}); | ||
this.addEventListener("focusout", () => { | ||
this.open = false; | ||
}); | ||
this.addEventListener("keyup", (e) => { | ||
if (e.code === "Escape") | ||
e.target?.blur(); | ||
this.open = false; | ||
}); | ||
if (!this.keep) { | ||
/* if (!this.keep) { | ||
this.addEventListener("click", ev => { | ||
@@ -145,7 +149,7 @@ ev.stopPropagation(); | ||
setTimeout(() => { | ||
e.target?.blur(); | ||
(e.target as this)?.blur(); | ||
this.blur(); | ||
}, 100); | ||
}); | ||
} | ||
} */ | ||
switch (this.from) { | ||
@@ -190,3 +194,3 @@ case "top": { | ||
} | ||
this.extra(); | ||
// this.extra(); | ||
} | ||
@@ -196,6 +200,13 @@ close() { | ||
} | ||
setAriaExpanded(value) { | ||
return (e) => { | ||
this.setAttribute("aria-expanded", `${value}`); | ||
}; | ||
updated(_changedProperties) { | ||
if (_changedProperties.has("open") && _changedProperties.get("open") != undefined) { | ||
if (this.open) { | ||
this.setAttribute("aria-expanded", "true"); | ||
} | ||
else { | ||
this.setAttribute("aria-expanded", "false"); | ||
this.popup.blur(); | ||
this.blur(); | ||
} | ||
} | ||
} | ||
@@ -228,2 +239,5 @@ extra() { | ||
__decorate([ | ||
property({ type: Boolean, reflect: true }) | ||
], CtButtonMenu.prototype, "open", void 0); | ||
__decorate([ | ||
property({ type: String }) | ||
@@ -230,0 +244,0 @@ ], CtButtonMenu.prototype, "from", void 0); |
{ | ||
"name": "@conectate/ct-button", | ||
"version": "3.12.1", | ||
"version": "3.12.4", | ||
"description": "HTML Button made with Web Components and Lit", | ||
@@ -48,3 +48,3 @@ "main": "ct-button.js", | ||
}, | ||
"gitHead": "253f2b158bcb209f7399053597b3b708df06d388" | ||
"gitHead": "82a2a19a6f3eeb0ed4c8df7a5cd30afae29fcc88" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31535
761