@codbex/harmonia 1.2.1 → 1.3.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.
@@ -2210,10 +2210,10 @@ function accordion_default(Alpine) {
2210
2210
  }) : { single: false };
2211
2211
  el.setAttribute("data-slot", "accordion");
2212
2212
  });
2213
- Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
2213
+ Alpine.directive("h-accordion-item", (el, { original, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
2214
2214
  const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
2215
2215
  if (!accordion) {
2216
- throw new Error(`${original2} must be inside an accordion`);
2216
+ throw new Error(`${original} must be inside an accordion`);
2217
2217
  }
2218
2218
  el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
2219
2219
  el.setAttribute("data-slot", "accordion-item");
@@ -2241,14 +2241,14 @@ function accordion_default(Alpine) {
2241
2241
  setAttributes();
2242
2242
  effect(setAttributes);
2243
2243
  });
2244
- Alpine.directive("h-accordion-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
2244
+ Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
2245
2245
  if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
2246
- throw new Error(`${original2} must be a header element`);
2246
+ throw new Error(`${original} must be a header element`);
2247
2247
  }
2248
2248
  const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
2249
2249
  const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordionItem"));
2250
2250
  if (!accordionItem || !accordion) {
2251
- throw new Error(`${original2} must have an accordion and accordion item parent elements`);
2251
+ throw new Error(`${original} must have an accordion and accordion item parent elements`);
2252
2252
  }
2253
2253
  el.classList.add(
2254
2254
  "flex",
@@ -2433,10 +2433,10 @@ function avatar_default(Alpine) {
2433
2433
  el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
2434
2434
  }
2435
2435
  });
2436
- Alpine.directive("h-avatar-image", (el, { original: original2 }, { cleanup }) => {
2436
+ Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
2437
2437
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
2438
2438
  if (!avatar) {
2439
- throw new Error(`${original2} must be inside an avatar element`);
2439
+ throw new Error(`${original} must be inside an avatar element`);
2440
2440
  }
2441
2441
  el.classList.add("aspect-square", "size-full");
2442
2442
  el.setAttribute("data-slot", "avatar-image");
@@ -2467,10 +2467,10 @@ function avatar_default(Alpine) {
2467
2467
  observer.disconnect();
2468
2468
  });
2469
2469
  });
2470
- Alpine.directive("h-avatar-fallback", (el, { original: original2 }, { effect }) => {
2470
+ Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
2471
2471
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
2472
2472
  if (!avatar) {
2473
- throw new Error(`${original2} must be inside an avatar element`);
2473
+ throw new Error(`${original} must be inside an avatar element`);
2474
2474
  }
2475
2475
  el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
2476
2476
  el.setAttribute("data-slot", "avatar-fallback");
@@ -2679,7 +2679,7 @@ var getButtonSize = (size3, isAddon = false) => {
2679
2679
  }
2680
2680
  };
2681
2681
  function button_default(Alpine) {
2682
- Alpine.directive("h-button", (el, { original: original2, modifiers }, { cleanup }) => {
2682
+ Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
2683
2683
  setButtonClasses(el);
2684
2684
  if (!el.hasAttribute("data-slot")) {
2685
2685
  el.setAttribute("data-slot", "button");
@@ -2696,7 +2696,7 @@ function button_default(Alpine) {
2696
2696
  el.classList.remove(...getButtonSize(lastSize, isAddon));
2697
2697
  el.classList.add(...getButtonSize(size3, isAddon));
2698
2698
  if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
2699
- console.error(`${original2}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
2699
+ console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
2700
2700
  }
2701
2701
  lastSize = size3;
2702
2702
  }
@@ -4245,7 +4245,7 @@ var computePosition2 = (reference, floating, options) => {
4245
4245
 
4246
4246
  // src/components/calendar.js
4247
4247
  function calendar_default(Alpine) {
4248
- Alpine.directive("h-calendar", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4248
+ Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4249
4249
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
4250
4250
  el.classList.add("border", "rounded-control", "gap-2", "p-2");
4251
4251
  el.setAttribute("tabindex", "-1");
@@ -4289,7 +4289,7 @@ function calendar_default(Alpine) {
4289
4289
  const onInputChange = () => {
4290
4290
  const newValue = new Date(datepicker._h_datepicker.input.value);
4291
4291
  if (isNaN(newValue)) {
4292
- console.error(`${original2}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
4292
+ console.error(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
4293
4293
  datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
4294
4294
  return;
4295
4295
  } else if (selected.getTime() !== newValue.getTime()) {
@@ -4306,7 +4306,7 @@ function calendar_default(Alpine) {
4306
4306
  if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
4307
4307
  selected = new Date(el._x_model.get());
4308
4308
  if (isNaN(selected)) {
4309
- console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
4309
+ console.error(`${original}: input value is not a valid date - ${el._x_model.get()}`);
4310
4310
  if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
4311
4311
  else el.setAttribute("data-invalid", "true");
4312
4312
  } else if (datepicker) {
@@ -4815,10 +4815,10 @@ function collapsible_default(Alpine) {
4815
4815
  });
4816
4816
  }
4817
4817
  });
4818
- Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
4818
+ Alpine.directive("h-collapsible-trigger", (el, { original, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
4819
4819
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
4820
4820
  if (!collapsible) {
4821
- throw new Error(`${original2} must be inside a collapsible element`);
4821
+ throw new Error(`${original} must be inside a collapsible element`);
4822
4822
  }
4823
4823
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
4824
4824
  if (modifiers.includes("chevron")) {
@@ -4837,10 +4837,10 @@ function collapsible_default(Alpine) {
4837
4837
  el.removeEventListener("click", handler);
4838
4838
  });
4839
4839
  });
4840
- Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
4840
+ Alpine.directive("h-collapsible-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
4841
4841
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
4842
4842
  if (!collapsible) {
4843
- throw new Error(`${original2} must be inside an h-collapsible element`);
4843
+ throw new Error(`${original} must be inside an h-collapsible element`);
4844
4844
  }
4845
4845
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
4846
4846
  el.classList.add("data-[state=closed]:!hidden");
@@ -4871,7 +4871,7 @@ function sizeObserver(el) {
4871
4871
 
4872
4872
  // src/components/datepicker.js
4873
4873
  function datepicker_default(Alpine) {
4874
- Alpine.directive("h-date-picker", (el, { original: original2, modifiers }, { Alpine: Alpine2, cleanup }) => {
4874
+ Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
4875
4875
  const state = Alpine2.reactive({
4876
4876
  expanded: false
4877
4877
  });
@@ -4884,7 +4884,7 @@ function datepicker_default(Alpine) {
4884
4884
  };
4885
4885
  el._h_datepicker.input = el.querySelector("input");
4886
4886
  if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
4887
- throw new Error(`${original2} must contain an input`);
4887
+ throw new Error(`${original} must contain an input`);
4888
4888
  } else if (el._h_datepicker.input.hasAttribute("id")) {
4889
4889
  el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
4890
4890
  } else {
@@ -4961,16 +4961,16 @@ function datepicker_default(Alpine) {
4961
4961
  observer.disconnect();
4962
4962
  });
4963
4963
  });
4964
- Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
4964
+ Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
4965
4965
  if (el.tagName !== "BUTTON") {
4966
- throw new Error(`${original2} must be a button`);
4966
+ throw new Error(`${original} must be a button`);
4967
4967
  }
4968
4968
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
4969
- throw new Error(`${original2}: must have an "aria-label" or "aria-labelledby" attribute`);
4969
+ throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
4970
4970
  }
4971
4971
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
4972
4972
  if (!datepicker) {
4973
- throw new Error(`${original2} must be inside an date-picker element`);
4973
+ throw new Error(`${original} must be inside an date-picker element`);
4974
4974
  }
4975
4975
  el.classList.add("cursor-pointer", "inline-flex", "items-center", "justify-center", "h-full", "aspect-square", "bg-transparent", "hover:bg-secondary", "active:bg-secondary-active", "outline-none");
4976
4976
  if (datepicker._h_datepicker.inTable) {
@@ -5250,13 +5250,13 @@ function fieldset_default(Alpine) {
5250
5250
 
5251
5251
  // src/components/icon.js
5252
5252
  function icon_default(Alpine) {
5253
- Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
5253
+ Alpine.directive("h-icon", (el, { original, modifiers }) => {
5254
5254
  if (el.tagName.toLowerCase() !== "svg") {
5255
- throw new Error(`${original2} works only on svg elements`);
5255
+ throw new Error(`${original} works only on svg elements`);
5256
5256
  } else if (!el.hasAttribute("role")) {
5257
- throw new Error(`${original2} must have a role`);
5257
+ throw new Error(`${original} must have a role`);
5258
5258
  } else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
5259
- throw new Error(`${original2}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
5259
+ throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
5260
5260
  }
5261
5261
  el.classList.add("fill-current");
5262
5262
  el.setAttribute("data-slot", "icon");
@@ -5473,7 +5473,7 @@ function input_default(Alpine) {
5473
5473
  el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
5474
5474
  el.setAttribute("data-slot", "label");
5475
5475
  });
5476
- Alpine.directive("h-input-number", (el, { original: original2 }, { cleanup }) => {
5476
+ Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
5477
5477
  el.classList.add(
5478
5478
  "overflow-hidden",
5479
5479
  "group/input-number",
@@ -5506,7 +5506,7 @@ function input_default(Alpine) {
5506
5506
  el.setAttribute("data-slot", "input-number");
5507
5507
  const input = el.querySelector("input");
5508
5508
  if (!input || input.getAttribute("type") !== "number") {
5509
- throw new Error(`${original2} must contain an input of type 'number'`);
5509
+ throw new Error(`${original} must contain an input of type 'number'`);
5510
5510
  }
5511
5511
  if (!input.hasAttribute("type")) input.setAttribute("type", "number");
5512
5512
  if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
@@ -5752,13 +5752,13 @@ function list_default(Alpine) {
5752
5752
  el.setAttribute("data-slot", "list");
5753
5753
  el.setAttribute("role", "group");
5754
5754
  });
5755
- Alpine.directive("h-list-header", (el, { original: original2 }, { Alpine: Alpine2 }) => {
5755
+ Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
5756
5756
  el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
5757
5757
  el.setAttribute("role", "presentation");
5758
5758
  el.setAttribute("data-slot", "list-header");
5759
5759
  const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
5760
5760
  if (!list) {
5761
- throw new Error(`${original2} must be placed inside a list element`);
5761
+ throw new Error(`${original} must be placed inside a list element`);
5762
5762
  }
5763
5763
  if (!el.hasAttribute("id")) {
5764
5764
  const id = `lbh${v4_default()}`;
@@ -5810,9 +5810,9 @@ function menu_default(Alpine) {
5810
5810
  };
5811
5811
  el.setAttribute("data-state", "closed");
5812
5812
  });
5813
- Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
5813
+ Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
5814
5814
  if (el.tagName !== "UL") {
5815
- throw new Error(`${original2} must be an ul element`);
5815
+ throw new Error(`${original} must be an ul element`);
5816
5816
  }
5817
5817
  el.classList.add("hidden", "fixed", "bg-popover", "text-popover-foreground", "font-normal", "z-50", "min-w-[8rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "p-1", "shadow-md", "border", "outline-none");
5818
5818
  el.setAttribute("role", "menu");
@@ -5820,7 +5820,7 @@ function menu_default(Alpine) {
5820
5820
  el.setAttribute("tabindex", "-1");
5821
5821
  el.setAttribute("data-slot", "menu");
5822
5822
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
5823
- throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
5823
+ throw new Error(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
5824
5824
  }
5825
5825
  const isSubmenu = modifiers.includes("sub");
5826
5826
  const menuTrigger = (() => {
@@ -5832,7 +5832,7 @@ function menu_default(Alpine) {
5832
5832
  return sibling;
5833
5833
  })();
5834
5834
  if (!isSubmenu && !menuTrigger) {
5835
- throw new Error(`${original2} menu must be placed after a menu trigger element`);
5835
+ throw new Error(`${original} menu must be placed after a menu trigger element`);
5836
5836
  }
5837
5837
  let menuSubItem;
5838
5838
  if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
@@ -6051,9 +6051,9 @@ function menu_default(Alpine) {
6051
6051
  el.removeEventListener("keydown", onKeyDown);
6052
6052
  });
6053
6053
  });
6054
- Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6054
+ Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6055
6055
  if (el.tagName !== "LI") {
6056
- throw new Error(`${original2} must be a li element`);
6056
+ throw new Error(`${original} must be a li element`);
6057
6057
  }
6058
6058
  el.classList.add(
6059
6059
  "focus:bg-secondary-hover",
@@ -6107,7 +6107,7 @@ function menu_default(Alpine) {
6107
6107
  el.removeEventListener("mouseleave", focusOut);
6108
6108
  });
6109
6109
  });
6110
- Alpine.directive("h-menu-sub", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6110
+ Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6111
6111
  el.classList.add(
6112
6112
  "focus:bg-secondary-hover",
6113
6113
  "hover:bg-secondary-hover",
@@ -6139,7 +6139,7 @@ function menu_default(Alpine) {
6139
6139
  const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
6140
6140
  el.appendChild(chevronRight);
6141
6141
  const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
6142
- if (!parentMenu) throw new Error(`${original2} must have a parent`);
6142
+ if (!parentMenu) throw new Error(`${original} must have a parent`);
6143
6143
  el._menu_sub = {
6144
6144
  open: void 0,
6145
6145
  close: void 0,
@@ -6233,9 +6233,9 @@ function menu_default(Alpine) {
6233
6233
  el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
6234
6234
  el.setAttribute("data-slot", "menu-label");
6235
6235
  });
6236
- Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6236
+ Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6237
6237
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
6238
- throw new Error(`${original2} must be a li or div element`);
6238
+ throw new Error(`${original} must be a li or div element`);
6239
6239
  }
6240
6240
  el.classList.add(
6241
6241
  "focus:bg-secondary-hover",
@@ -6301,9 +6301,9 @@ function menu_default(Alpine) {
6301
6301
  el.removeEventListener("mouseleave", focusOut);
6302
6302
  });
6303
6303
  });
6304
- Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
6304
+ Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
6305
6305
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
6306
- throw new Error(`${original2} must be a li or div element`);
6306
+ throw new Error(`${original} must be a li or div element`);
6307
6307
  }
6308
6308
  el.classList.add(
6309
6309
  "focus:bg-secondary-hover",
@@ -6507,6 +6507,7 @@ function popover_default(Alpine) {
6507
6507
  const close = () => {
6508
6508
  el._popover.expanded = false;
6509
6509
  el.addEventListener("click", handler);
6510
+ setAttributes();
6510
6511
  };
6511
6512
  const handler = () => {
6512
6513
  el._popover.expanded = !el._popover.expanded;
@@ -6531,7 +6532,7 @@ function popover_default(Alpine) {
6531
6532
  });
6532
6533
  }
6533
6534
  });
6534
- Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
6535
+ Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
6535
6536
  const popover = (() => {
6536
6537
  let sibling = el.previousElementSibling;
6537
6538
  while (sibling && !sibling.hasOwnProperty("_popover")) {
@@ -6540,7 +6541,7 @@ function popover_default(Alpine) {
6540
6541
  return sibling;
6541
6542
  })();
6542
6543
  if (!popover) {
6543
- throw new Error(`${original2} must be placed after a popover element`);
6544
+ throw new Error(`${original} must be placed after a popover element`);
6544
6545
  }
6545
6546
  el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-md", "border", "shadow-md", "outline-hidden", "overflow-scroll");
6546
6547
  el.setAttribute("data-slot", "popover");
@@ -6742,13 +6743,13 @@ function select_default(Alpine) {
6742
6743
  });
6743
6744
  }
6744
6745
  });
6745
- Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
6746
+ Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
6746
6747
  if (el.tagName !== "INPUT") {
6747
- throw new Error(`${original2} must be a readonly input of type "text"`);
6748
+ throw new Error(`${original} must be a readonly input of type "text"`);
6748
6749
  }
6749
6750
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6750
6751
  if (!select) {
6751
- throw new Error(`${original2} must be inside a select element`);
6752
+ throw new Error(`${original} must be inside a select element`);
6752
6753
  } else if (el.hasOwnProperty("_x_model")) {
6753
6754
  select._h_select.multiple = Array.isArray(el._x_model.get());
6754
6755
  select._h_model.set = (value) => {
@@ -7001,10 +7002,10 @@ function select_default(Alpine) {
7001
7002
  observer.disconnect();
7002
7003
  });
7003
7004
  });
7004
- Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
7005
+ Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
7005
7006
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7006
7007
  if (!select) {
7007
- throw new Error(`${original2} must be inside a select element`);
7008
+ throw new Error(`${original} must be inside a select element`);
7008
7009
  }
7009
7010
  el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "shadow-md");
7010
7011
  el.setAttribute("data-slot", "select-content");
@@ -7015,7 +7016,7 @@ function select_default(Alpine) {
7015
7016
  el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
7016
7017
  const control = select.querySelector(`#${select._h_select.id}`);
7017
7018
  if (!control) {
7018
- throw new Error(`${original2}: trigger not found`);
7019
+ throw new Error(`${original}: trigger not found`);
7019
7020
  }
7020
7021
  let autoUpdateCleanup;
7021
7022
  function updatePosition() {
@@ -7057,10 +7058,10 @@ function select_default(Alpine) {
7057
7058
  }
7058
7059
  });
7059
7060
  });
7060
- Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7061
+ Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7061
7062
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7062
7063
  if (!select) {
7063
- throw new Error(`${original2} must be inside an h-select element`);
7064
+ throw new Error(`${original} must be inside an h-select element`);
7064
7065
  } else {
7065
7066
  select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
7066
7067
  }
@@ -7132,10 +7133,10 @@ function select_default(Alpine) {
7132
7133
  selectGroup._h_selectGroup.labelledby = id;
7133
7134
  }
7134
7135
  });
7135
- Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
7136
+ Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
7136
7137
  const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7137
7138
  if (!select) {
7138
- throw new Error(`${original2} must be inside an h-select element`);
7139
+ throw new Error(`${original} must be inside an h-select element`);
7139
7140
  }
7140
7141
  el.classList.add(
7141
7142
  "focus:bg-primary",
@@ -7366,13 +7367,35 @@ function sidebar_default(Alpine) {
7366
7367
  el.classList.add("vbox", "min-h-0", "flex-1", "gap-2", "overflow-auto", "group-data-[collapsed=true]/sidebar:overflow-hidden");
7367
7368
  el.setAttribute("data-slot", "sidebar-content");
7368
7369
  });
7369
- Alpine.directive("h-sidebar-group", (el) => {
7370
+ Alpine.directive("h-sidebar-group", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7370
7371
  el.classList.add("relative", "vbox", "w-full", "min-w-0", "p-2");
7371
7372
  el.setAttribute("data-slot", "sidebar-group");
7373
+ el._h_sidebar_group = {
7374
+ collapsable: modifiers.includes("collapsed"),
7375
+ controlId: void 0,
7376
+ controls: void 0,
7377
+ state: Alpine2.reactive({
7378
+ collapsed: evaluate2(expression || "false")
7379
+ })
7380
+ };
7381
+ if (expression) {
7382
+ el._h_sidebar_group.state = Alpine2.reactive({
7383
+ collapsed: evaluate2(expression || "false")
7384
+ });
7385
+ const getCollapsed = evaluateLater(expression);
7386
+ effect(() => {
7387
+ getCollapsed((collapsed) => {
7388
+ el._h_sidebar_group.state.collapsed = collapsed;
7389
+ });
7390
+ });
7391
+ }
7372
7392
  });
7373
- Alpine.directive("h-sidebar-group-label", (el, { modifiers }) => {
7393
+ Alpine.directive("h-sidebar-group-label", (el, { original }, { cleanup }) => {
7394
+ const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7395
+ if (!group) {
7396
+ throw new Error(`${original} must be placed inside a sidebar group`);
7397
+ }
7374
7398
  el.classList.add(
7375
- "text-sidebar-foreground/70",
7376
7399
  "ring-sidebar-ring",
7377
7400
  "flex",
7378
7401
  "h-8",
@@ -7380,7 +7403,6 @@ function sidebar_default(Alpine) {
7380
7403
  "items-center",
7381
7404
  "rounded-md",
7382
7405
  "px-2",
7383
- "text-xs",
7384
7406
  "font-medium",
7385
7407
  "outline-hidden",
7386
7408
  "transition-[margin,opacity]",
@@ -7391,8 +7413,39 @@ function sidebar_default(Alpine) {
7391
7413
  "[&>svg]:shrink-0",
7392
7414
  "group-data-[collapsed=true]/sidebar:!hidden"
7393
7415
  );
7394
- if (modifiers.includes("action")) el.classList.add("hover:bg-secondary-hover", "active:bg-secondary-active");
7395
7416
  el.setAttribute("data-slot", "sidebar-group-label");
7417
+ if (group._h_sidebar_group.collapsable) {
7418
+ el.classList.add("text-sidebar-foreground", "text-sm", "hover:bg-secondary-hover", "active:bg-secondary-active");
7419
+ if (el.hasAttribute("id")) {
7420
+ group._h_sidebar_group.controlId = el.getAttribute("id");
7421
+ } else {
7422
+ group._h_sidebar_group.controlId = `sgl${v4_default()}`;
7423
+ el.setAttribute("id", group._h_sidebar_group.controlId);
7424
+ }
7425
+ group._h_sidebar_group.controls = `sgc${v4_default()}`;
7426
+ el.setAttribute("aria-controls", group._h_sidebar_group.controls);
7427
+ el.setAttribute("aria-expanded", !group._h_sidebar_group.state.collapsed);
7428
+ const handler = () => {
7429
+ group._h_sidebar_group.state.collapsed = !group._h_sidebar_group.state.collapsed;
7430
+ el.setAttribute("aria-expanded", !group._h_sidebar_group.state.collapsed);
7431
+ };
7432
+ el.appendChild(
7433
+ createSvg({
7434
+ icon: ChevronRight,
7435
+ classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
7436
+ attrs: {
7437
+ "aria-hidden": true,
7438
+ role: "presentation"
7439
+ }
7440
+ })
7441
+ );
7442
+ el.addEventListener("click", handler);
7443
+ cleanup(() => {
7444
+ el.removeEventListener("click", handler);
7445
+ });
7446
+ } else {
7447
+ el.classList.add("text-sidebar-foreground/70", "text-xs");
7448
+ }
7396
7449
  });
7397
7450
  Alpine.directive("h-sidebar-group-action", (el) => {
7398
7451
  el.classList.add(
@@ -7427,41 +7480,85 @@ function sidebar_default(Alpine) {
7427
7480
  }
7428
7481
  el.setAttribute("data-slot", "sidebar-group-action");
7429
7482
  });
7430
- Alpine.directive("h-sidebar-group-content", (el) => {
7431
- el.classList.add("w-full", "text-sm");
7483
+ Alpine.directive("h-sidebar-group-content", (el, { original }, { effect }) => {
7484
+ const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7485
+ if (!group) {
7486
+ throw new Error(`${original} must be placed inside a sidebar group`);
7487
+ }
7488
+ el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
7432
7489
  el.setAttribute("data-slot", "sidebar-group-content");
7490
+ if (group._h_sidebar_group.collapsable) {
7491
+ el.setAttribute("id", group._h_sidebar_group.controls);
7492
+ el.setAttribute("aria-labelledby", group._h_sidebar_group.controlId);
7493
+ el.setAttribute("data-collapsed", group._h_sidebar_group.state.collapsed);
7494
+ effect(() => {
7495
+ el.setAttribute("data-collapsed", group._h_sidebar_group.state.collapsed);
7496
+ });
7497
+ }
7433
7498
  });
7434
- Alpine.directive("h-sidebar-menu", (el) => {
7499
+ Alpine.directive("h-sidebar-menu", (el, { original }) => {
7500
+ if (el.tagName !== "UL") {
7501
+ throw new Error(`${original} must be an ul element`);
7502
+ }
7435
7503
  el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
7436
7504
  el.setAttribute("data-slot", "sidebar-menu");
7437
7505
  });
7438
- Alpine.directive("h-sidebar-menu-item", (el, { original: original2 }) => {
7439
- if (el.tagName !== "BUTTON") {
7440
- throw new Error(`${original2} must be a button`);
7506
+ Alpine.directive("h-sidebar-menu-item", (el, { original, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7507
+ if (el.tagName !== "LI") {
7508
+ throw new Error(`${original} must be a li element`);
7509
+ }
7510
+ el._h_sidebar_menu_item = {
7511
+ isSub: false,
7512
+ collapsable: modifiers.includes("collapsed"),
7513
+ controlId: void 0,
7514
+ controls: void 0,
7515
+ state: Alpine2.reactive({
7516
+ collapsed: evaluate2(expression || "false")
7517
+ })
7518
+ };
7519
+ let parent = el.parentElement;
7520
+ while (parent) {
7521
+ if (parent.getAttribute("data-slot") === "sidebar-menu-sub") {
7522
+ el._h_sidebar_menu_item.isSub = true;
7523
+ break;
7524
+ } else if (parent.getAttribute("data-slot") === "sidebar") {
7525
+ break;
7526
+ }
7527
+ parent = parent.parentElement;
7528
+ }
7529
+ if (!el._h_sidebar_menu_item.isSub) {
7530
+ el.classList.add("group/menu-item", "relative");
7531
+ } else {
7532
+ el.classList.add("relative");
7441
7533
  }
7442
- el.classList.add("group/menu-item", "relative");
7443
- el.setAttribute("type", "button");
7444
7534
  el.setAttribute("data-slot", "sidebar-menu-item");
7535
+ if (expression) {
7536
+ const getCollapsed = evaluateLater(expression);
7537
+ effect(() => {
7538
+ getCollapsed((collapsed) => {
7539
+ el._h_sidebar_menu_item.state.collapsed = collapsed;
7540
+ });
7541
+ });
7542
+ }
7445
7543
  });
7446
- Alpine.directive("h-sidebar-menu-button", (el) => {
7447
- if (el.tagName !== "BUTTON") {
7448
- throw new Error(`${original} must be a button`);
7544
+ Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
7545
+ if (el.tagName !== "BUTTON" && el.tagName !== "A") {
7546
+ throw new Error(`${original} must be a button or a link`);
7547
+ } else if (el.tagName === "BUTTON") {
7548
+ el.setAttribute("type", "button");
7449
7549
  }
7550
+ const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
7450
7551
  el.classList.add(
7451
- "peer/menu-button",
7452
7552
  "flex",
7453
7553
  "w-full",
7454
7554
  "items-center",
7455
7555
  "gap-2",
7456
7556
  "overflow-hidden",
7457
7557
  "rounded-md",
7458
- "p-2",
7459
- "text-left",
7460
- "text-sm",
7461
7558
  "align-middle",
7559
+ "[&>span]:align-middle",
7462
7560
  "outline-hidden",
7463
7561
  "ring-sidebar-ring",
7464
- "transition-[width,height,padding]",
7465
7562
  "hover:bg-sidebar-secondary",
7466
7563
  "hover:text-sidebar-secondary-foreground",
7467
7564
  "focus-visible:ring-2",
@@ -7469,25 +7566,14 @@ function sidebar_default(Alpine) {
7469
7566
  "active:text-sidebar-primary-foreground",
7470
7567
  "disabled:pointer-events-none",
7471
7568
  "disabled:opacity-50",
7472
- "group-has-data-[sidebar=menu-action]/menu-item:pr-8",
7473
7569
  "aria-disabled:pointer-events-none",
7474
7570
  "aria-disabled:opacity-50",
7475
7571
  "data-[active=true]:bg-sidebar-primary",
7476
- "data-[active=true]:font-medium",
7477
7572
  "data-[active=true]:text-sidebar-primary-foreground",
7478
- "data-[state=open]:hover:bg-sidebar-secondary",
7479
- "data-[state=open]:hover:text-sidebar-secondary-foreground",
7480
- "group-data-[collapsed=true]/sidebar:!size-8",
7481
- "group-data-[collapsed=true]/sidebar:!p-2",
7482
- "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden",
7483
7573
  "[&>span]:truncate",
7484
- "[&>span]:align-middle",
7485
7574
  "[&>svg]:size-4",
7486
- "[&>svg]:shrink-0",
7487
- "[&>svg:not(:first-child):last-child]:ml-auto"
7575
+ "[&>svg]:shrink-0"
7488
7576
  );
7489
- el.setAttribute("type", "button");
7490
- if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
7491
7577
  const sizes = {
7492
7578
  default: ["h-8", "text-sm"],
7493
7579
  sm: ["h-7", "text-xs"],
@@ -7498,22 +7584,77 @@ function sidebar_default(Alpine) {
7498
7584
  el.classList.add(...sizes[size3]);
7499
7585
  }
7500
7586
  }
7501
- if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
7502
- setSize2(el.getAttribute("data-size"));
7587
+ setSize2(el.getAttribute("data-size") || "default");
7588
+ if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
7589
+ if (menuItem && menuItem._h_sidebar_menu_item.isSub) {
7590
+ el.classList.add("text-sidebar-foreground", "h-7", "min-w-0", "-translate-x-px", "px-2", "[&>svg:not(:first-child):last-child]:ml-auto", "group-data-[collapsed=true]/sidebar:hidden");
7591
+ if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-sub-button");
7592
+ } else {
7593
+ el.classList.add(
7594
+ "peer/menu-button",
7595
+ "p-2",
7596
+ "text-left",
7597
+ "text-sm",
7598
+ "duration-200",
7599
+ "transition-[width,height,padding]",
7600
+ "group-has-data-[sidebar=menu-action]/menu-item:pr-8",
7601
+ "data-[active=true]:font-medium",
7602
+ "data-[state=open]:hover:bg-sidebar-secondary",
7603
+ "data-[state=open]:hover:text-sidebar-secondary-foreground",
7604
+ "group-data-[collapsed=true]/sidebar:!size-8",
7605
+ "group-data-[collapsed=true]/sidebar:!p-2",
7606
+ "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden"
7607
+ );
7608
+ }
7609
+ if (menuItem && menuItem._h_sidebar_menu_item.collapsable) {
7610
+ if (el.hasAttribute("id")) {
7611
+ menuItem._h_sidebar_menu_item.controlId = el.getAttribute("id");
7612
+ } else {
7613
+ menuItem._h_sidebar_menu_item.controlId = `sgl${v4_default()}`;
7614
+ el.setAttribute("id", menuItem._h_sidebar_menu_item.controlId);
7615
+ }
7616
+ menuItem._h_sidebar_menu_item.controls = `sgc${v4_default()}`;
7617
+ el.setAttribute("aria-controls", menuItem._h_sidebar_menu_item.controls);
7618
+ el.setAttribute("aria-expanded", !menuItem._h_sidebar_menu_item.state.collapsed);
7619
+ const handler = () => {
7620
+ menuItem._h_sidebar_menu_item.state.collapsed = !menuItem._h_sidebar_menu_item.state.collapsed;
7621
+ el.setAttribute("aria-expanded", !menuItem._h_sidebar_menu_item.state.collapsed);
7622
+ };
7623
+ el.appendChild(
7624
+ createSvg({
7625
+ icon: ChevronRight,
7626
+ classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
7627
+ attrs: {
7628
+ "aria-hidden": true,
7629
+ role: "presentation"
7630
+ }
7631
+ })
7632
+ );
7633
+ el.addEventListener("click", handler);
7634
+ cleanup(() => {
7635
+ el.removeEventListener("click", handler);
7636
+ });
7637
+ } else {
7638
+ el.classList.add("[&>svg:not(:first-child):last-child]:ml-auto");
7639
+ }
7503
7640
  });
7504
7641
  Alpine.directive("h-sidebar-menu-action", (el, { modifiers }) => {
7505
7642
  el.classList.add(
7506
7643
  "text-sidebar-foreground",
7507
7644
  "ring-sidebar-ring",
7508
7645
  "hover:bg-sidebar-secondary",
7646
+ "active:bg-sidebar-secondary/70",
7509
7647
  "hover:text-sidebar-secondary-foreground",
7510
7648
  "peer-hover/menu-button:text-sidebar-secondary-foreground",
7649
+ "peer-active/menu-button:text-sidebar-primary-foreground",
7650
+ "peer-data-[active=true]/menu-button:text-sidebar-primary-foreground",
7511
7651
  "absolute",
7512
- "top-1.5",
7513
- "right-1.5",
7652
+ "top-0.5",
7653
+ "right-0.5",
7654
+ "bottom-0.5",
7514
7655
  "flex",
7515
7656
  "aspect-square",
7516
- "w-5",
7657
+ "h-auto",
7517
7658
  "items-center",
7518
7659
  "justify-center",
7519
7660
  "rounded-md",
@@ -7526,13 +7667,10 @@ function sidebar_default(Alpine) {
7526
7667
  "after:absolute",
7527
7668
  "after:-inset-2",
7528
7669
  "md:after:hidden",
7529
- "peer-data-[size=sm]/menu-button:top-1",
7530
- "peer-data-[size=default]/menu-button:top-1.5",
7531
- "peer-data-[size=lg]/menu-button:top-2.5",
7532
7670
  "group-data-[collapsed=true]/sidebar:hidden"
7533
7671
  );
7534
7672
  if (modifiers.includes("autohide")) {
7535
- el.classList.add("peer-data-[active=true]/menu-button:text-sidebar-secondary-foreground", "group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
7673
+ el.classList.add("group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
7536
7674
  }
7537
7675
  if (el.tagName !== "BUTTON") {
7538
7676
  el.setAttribute("role", "button");
@@ -7541,30 +7679,11 @@ function sidebar_default(Alpine) {
7541
7679
  }
7542
7680
  el.setAttribute("data-slot", "sidebar-menu-action");
7543
7681
  });
7544
- Alpine.directive("h-sidebar-menu-badge", (el) => {
7545
- el.classList.add(
7546
- "text-sidebar-foreground",
7547
- "pointer-events-none",
7548
- "absolute",
7549
- "right-1.5",
7550
- "flex",
7551
- "h-5",
7552
- "min-w-5",
7553
- "items-center",
7554
- "justify-center",
7555
- "rounded-md",
7556
- "px-1",
7557
- "text-xs",
7558
- "font-medium",
7559
- "tabular-nums",
7560
- "select-none",
7561
- "peer-hover/menu-button:text-sidebar-secondary-foreground",
7562
- "peer-data-[active=true]/menu-button:text-sidebar-primary-foreground",
7563
- "peer-data-[size=sm]/menu-button:top-1",
7564
- "peer-data-[size=default]/menu-button:top-1.5",
7565
- "peer-data-[size=lg]/menu-button:top-2.5",
7566
- "group-data-[collapsed=true]/sidebar:hidden"
7567
- );
7682
+ Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
7683
+ if (el.tagName !== "SPAN") {
7684
+ throw new Error(`${original} must be a span element`);
7685
+ }
7686
+ el.classList.add("flex-1", "pointer-events-none", "flex", "h-full", "min-w-min", "items-center", "justify-end", "text-xs", "font-medium", "tabular-nums", "select-none", "group-data-[collapsed=true]/sidebar:hidden");
7568
7687
  el.setAttribute("data-slot", "sidebar-menu-badge");
7569
7688
  });
7570
7689
  Alpine.directive("h-sidebar-menu-skeleton", (el, { modifiers }) => {
@@ -7585,68 +7704,27 @@ function sidebar_default(Alpine) {
7585
7704
  el.setAttribute("data-slot", "sidebar-separator");
7586
7705
  el.setAttribute("role", "none");
7587
7706
  });
7588
- Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
7589
- el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
7590
- if (!modifiers.includes("flat")) {
7591
- el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
7707
+ Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
7708
+ if (el.tagName !== "UL") {
7709
+ throw new Error(`${original} must be an ul element`);
7592
7710
  }
7593
- el.setAttribute("data-slot", "sidebar-menu-sub");
7594
- });
7595
- Alpine.directive("h-sidebar-menu-sub-item", (el) => {
7596
- el.classList.add("group/menu-sub-item", "relative");
7597
- el.setAttribute("data-slot", "sidebar-menu-sub-item");
7598
- });
7599
- Alpine.directive("h-sidebar-menu-sub-button", (el) => {
7600
- if (el.tagName !== "BUTTON") {
7601
- throw new Error(`${original} must be a button`);
7711
+ const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
7712
+ if (!menuItem) {
7713
+ throw new Error(`${original} must be placed inside a sidebar menu item`);
7602
7714
  }
7603
- el.classList.add(
7604
- "text-sidebar-foreground",
7605
- "ring-sidebar-ring",
7606
- "hover:bg-sidebar-secondary",
7607
- "hover:text-sidebar-secondary-foreground",
7608
- "active:bg-primary-secondary",
7609
- "active:text-sidebar-primary-foreground",
7610
- "[&>svg]:text-sidebar-secondary-foreground",
7611
- "flex",
7612
- "h-7",
7613
- "w-full",
7614
- "min-w-0",
7615
- "-translate-x-px",
7616
- "items-center",
7617
- "gap-2",
7618
- "overflow-hidden",
7619
- "rounded-md",
7620
- "px-2",
7621
- "align-middle",
7622
- "outline-hidden",
7623
- "focus-visible:ring-2",
7624
- "disabled:pointer-events-none",
7625
- "disabled:opacity-50",
7626
- "aria-disabled:pointer-events-none",
7627
- "aria-disabled:opacity-50",
7628
- "[&>span]:truncate",
7629
- "[&>span]:align-middle",
7630
- "[&>svg]:size-4",
7631
- "[&>svg]:shrink-0",
7632
- "[&>svg:not(:first-child):last-child]:ml-auto",
7633
- "data-[active=true]:bg-sidebar-primary",
7634
- "data-[active=true]:text-sidebar-primary-foreground",
7635
- "group-data-[collapsed=true]/sidebar:hidden"
7636
- );
7637
- el.setAttribute("type", "button");
7638
- el.setAttribute("data-slot", "sidebar-menu-sub-button");
7639
- const sizes = {
7640
- sm: ["text-xs"],
7641
- md: ["text-sm"]
7642
- };
7643
- function setSize2(size3) {
7644
- if (sizes.hasOwnProperty(size3)) {
7645
- el.classList.add(...sizes[size3]);
7646
- }
7715
+ el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "pl-2.5", "py-0.5", "ml-3.5", "data-[collapsed=true]:!hidden", "group-data-[collapsed=true]/sidebar:!hidden");
7716
+ if (el.getAttribute("data-line") !== "false") {
7717
+ el.classList.add("border-sidebar-border", "border-l");
7718
+ }
7719
+ el.setAttribute("data-slot", "sidebar-menu-sub");
7720
+ if (menuItem._h_sidebar_menu_item.collapsable) {
7721
+ el.setAttribute("id", menuItem._h_sidebar_menu_item.controls);
7722
+ el.setAttribute("aria-labelledby", menuItem._h_sidebar_menu_item.controlId);
7723
+ el.setAttribute("data-collapsed", menuItem._h_sidebar_menu_item.state.collapsed);
7724
+ effect(() => {
7725
+ el.setAttribute("data-collapsed", menuItem._h_sidebar_menu_item.state.collapsed);
7726
+ });
7647
7727
  }
7648
- if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "md");
7649
- setSize2(el.getAttribute("data-size"));
7650
7728
  });
7651
7729
  Alpine.directive("h-sidebar-footer", (el) => {
7652
7730
  el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
@@ -7897,10 +7975,10 @@ function split_default(Alpine) {
7897
7975
  observer.disconnect();
7898
7976
  });
7899
7977
  });
7900
- Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7978
+ Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7901
7979
  const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
7902
7980
  if (!split) {
7903
- throw new Error(`${original2} must be inside an split element`);
7981
+ throw new Error(`${original} must be inside an split element`);
7904
7982
  }
7905
7983
  el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
7906
7984
  el.setAttribute("tabindex", "-1");
@@ -8420,7 +8498,7 @@ function tabs_default(Alpine) {
8420
8498
  el.setAttribute("role", "tablist");
8421
8499
  el.setAttribute("data-slot", "tab-list");
8422
8500
  });
8423
- Alpine.directive("h-tab", (el, { original: original2 }) => {
8501
+ Alpine.directive("h-tab", (el, { original }) => {
8424
8502
  el.classList.add(
8425
8503
  "cursor-pointer",
8426
8504
  "focus-visible:border-ring",
@@ -8467,8 +8545,8 @@ function tabs_default(Alpine) {
8467
8545
  );
8468
8546
  el.setAttribute("role", "tab");
8469
8547
  el.setAttribute("data-slot", "tab");
8470
- if (!el.hasAttribute("id")) throw new Error(`${original2}: Tabs must have an id`);
8471
- if (!el.hasAttribute("aria-controls")) throw new Error(`${original2}: aria-controls must be set to the tab-content id.`);
8548
+ if (!el.hasAttribute("id")) throw new Error(`${original}: Tabs must have an id`);
8549
+ if (!el.hasAttribute("aria-controls")) throw new Error(`${original}: aria-controls must be set to the tab-content id.`);
8472
8550
  });
8473
8551
  Alpine.directive("h-tab-action", (el) => {
8474
8552
  el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
@@ -8502,13 +8580,13 @@ function tabs_default(Alpine) {
8502
8580
  el.setAttribute("role", "button");
8503
8581
  el.setAttribute("data-slot", "tab-list-action");
8504
8582
  });
8505
- Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
8583
+ Alpine.directive("h-tabs-content", (el, { original }) => {
8506
8584
  el.classList.add("flex-1", "outline-none");
8507
8585
  el.setAttribute("role", "tabpanel");
8508
8586
  el.setAttribute("tabindex", "0");
8509
8587
  el.setAttribute("data-slot", "tabs-content");
8510
- if (!el.hasAttribute("id")) throw new Error(`${original2}: Tab content must have an id`);
8511
- if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original2}: aria-labelledby must be set to the tab id.`);
8588
+ if (!el.hasAttribute("id")) throw new Error(`${original}: Tab content must have an id`);
8589
+ if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original}: aria-labelledby must be set to the tab id.`);
8512
8590
  });
8513
8591
  }
8514
8592
 
@@ -8901,13 +8979,13 @@ function timepicker_default(Alpine) {
8901
8979
  top.removeEventListener("click", el._h_timepicker.close);
8902
8980
  });
8903
8981
  });
8904
- Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
8982
+ Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
8905
8983
  if (el.tagName !== "INPUT") {
8906
- throw new Error(`${original2} must be a readonly input of type "text"`);
8984
+ throw new Error(`${original} must be a readonly input of type "text"`);
8907
8985
  }
8908
8986
  const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
8909
8987
  if (!timepicker) {
8910
- throw new Error(`${original2} must be inside a time-picker element`);
8988
+ throw new Error(`${original} must be inside a time-picker element`);
8911
8989
  }
8912
8990
  timepicker._h_timepicker.focusInput = () => {
8913
8991
  el.focus();
@@ -9556,7 +9634,7 @@ function tooltip_default(Alpine) {
9556
9634
  el.removeEventListener("pointerleave", handler);
9557
9635
  });
9558
9636
  });
9559
- Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
9637
+ Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
9560
9638
  const tooltip = (() => {
9561
9639
  let sibling = el.previousElementSibling;
9562
9640
  while (sibling && !sibling.hasOwnProperty("_tooltip")) {
@@ -9565,7 +9643,7 @@ function tooltip_default(Alpine) {
9565
9643
  return sibling;
9566
9644
  })();
9567
9645
  if (!tooltip) {
9568
- throw new Error(`${original2} must be placed after a tooltip trigger element`);
9646
+ throw new Error(`${original} must be placed after a tooltip trigger element`);
9569
9647
  }
9570
9648
  el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
9571
9649
  el.setAttribute("data-slot", "tooltip");
@@ -9771,9 +9849,9 @@ function tree_default(Alpine) {
9771
9849
  });
9772
9850
  }
9773
9851
  });
9774
- Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
9852
+ Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
9775
9853
  const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
9776
- if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
9854
+ if (!treeItem) throw new Error(`${original} must be inside a tree item`);
9777
9855
  el.classList.add(
9778
9856
  "flex",
9779
9857
  "w-full",
@@ -9836,7 +9914,7 @@ function tree_default(Alpine) {
9836
9914
  }
9837
9915
 
9838
9916
  // package.json
9839
- var version = "1.2.1";
9917
+ var version = "1.3.0";
9840
9918
 
9841
9919
  // src/utils/breakpoint-listener.js
9842
9920
  function getBreakpointListener(handler, breakpoint = 768) {
@@ -9943,7 +10021,7 @@ function focus_default(Alpine) {
9943
10021
 
9944
10022
  // src/utils/template.js
9945
10023
  function template_default(Alpine) {
9946
- Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
10024
+ Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
9947
10025
  if (el.hasAttribute(Alpine2.prefixed("data"))) {
9948
10026
  const template = evaluate2(expression);
9949
10027
  const clone = template.content.cloneNode(true).firstElementChild;
@@ -9957,7 +10035,7 @@ function template_default(Alpine) {
9957
10035
  clone.remove();
9958
10036
  });
9959
10037
  } else {
9960
- console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
10038
+ console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
9961
10039
  }
9962
10040
  });
9963
10041
  }