@deepfuture/dui-cdn 1.4.1 → 1.4.2

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/dui.js +31 -18
  2. package/dui.min.js +156 -171
  3. package/package.json +1 -1
package/dui.js CHANGED
@@ -14892,19 +14892,9 @@ __publicField(DuiSidebarPrimitive, "styles", [base, styles90]);
14892
14892
  var styles91 = i5`
14893
14893
  :host {
14894
14894
  display: inline-block;
14895
+ cursor: pointer;
14895
14896
  }
14896
14897
  `;
14897
- var panelLeftSvg = b4`<svg
14898
- viewBox="0 0 24 24"
14899
- fill="none"
14900
- stroke="currentColor"
14901
- stroke-width="2"
14902
- stroke-linecap="round"
14903
- stroke-linejoin="round"
14904
- >
14905
- <rect width="18" height="18" x="3" y="3" rx="2" />
14906
- <path d="M9 3v18" />
14907
- </svg>`;
14908
14898
  var DuiSidebarTriggerPrimitive = class extends i8 {
14909
14899
  static tagName = "dui-sidebar-trigger";
14910
14900
  static styles = [base, styles91];
@@ -14912,17 +14902,40 @@ var DuiSidebarTriggerPrimitive = class extends i8 {
14912
14902
  context: sidebarContext,
14913
14903
  subscribe: true
14914
14904
  });
14905
+ connectedCallback() {
14906
+ super.connectedCallback();
14907
+ if (!this.hasAttribute("role")) {
14908
+ this.setAttribute("role", "button");
14909
+ }
14910
+ if (!this.hasAttribute("tabindex")) {
14911
+ this.setAttribute("tabindex", "0");
14912
+ }
14913
+ this.addEventListener("click", this.#onClick);
14914
+ this.addEventListener("keydown", this.#onKeyDown);
14915
+ }
14916
+ disconnectedCallback() {
14917
+ super.disconnectedCallback();
14918
+ this.removeEventListener("click", this.#onClick);
14919
+ this.removeEventListener("keydown", this.#onKeyDown);
14920
+ }
14915
14921
  #onClick = () => {
14916
14922
  this.#ctx.value?.toggleSidebar();
14917
14923
  };
14924
+ #onKeyDown = (e13) => {
14925
+ if (e13.key === "Enter" || e13.key === " ") {
14926
+ e13.preventDefault();
14927
+ this.#ctx.value?.toggleSidebar();
14928
+ }
14929
+ };
14930
+ willUpdate() {
14931
+ const ctx = this.#ctx.value;
14932
+ if (ctx) {
14933
+ const expanded = ctx.isMobile ? ctx.openMobile : ctx.open;
14934
+ this.setAttribute("aria-expanded", String(expanded));
14935
+ }
14936
+ }
14918
14937
  render() {
14919
- return b4`
14920
- <dui-button appearance="ghost" size="sm" @click=${this.#onClick}>
14921
- <slot>
14922
- <dui-icon>${panelLeftSvg}</dui-icon>
14923
- </slot>
14924
- </dui-button>
14925
- `;
14938
+ return b4`<slot></slot>`;
14926
14939
  }
14927
14940
  };
14928
14941