@codbex/harmonia 0.9.1 → 1.1.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.
@@ -19586,24 +19586,20 @@ var setButtonClasses = (el) => {
19586
19586
  "invalid:!border-negative"
19587
19587
  );
19588
19588
  };
19589
- var getButtonSize = (size3, inGroup = false) => {
19589
+ var getButtonSize = (size3, isAddon = false) => {
19590
19590
  switch (size3) {
19591
- case "xs":
19592
- return inGroup ? ["h-6", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2.5"];
19593
19591
  case "sm":
19594
- return inGroup ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5"];
19595
- case "lg":
19596
- return ["h-10", "px-6", "has-[>svg]:px-4"];
19597
- case "icon-xs":
19598
- return inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"];
19592
+ return isAddon ? ["h-6", "[[data-slot=input-group][data-size=sm]_&]:h-5", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2", "has-[>[data-slot=spinner]]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2", "has-[>[data-slot=spinner]]:px-2"];
19593
+ case "md":
19594
+ return isAddon ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5", "has-[>[data-slot=spinner]]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5", "has-[>[data-slot=spinner]]:px-2.5"];
19599
19595
  case "icon-sm":
19600
- return inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
19596
+ return isAddon ? ["size-6", "[[data-slot=input-group][data-size=sm]_&]:size-5", "p-0", "has-[>svg]:p-0", "has-[>[data-slot=spinner]]:p-0"] : ["size-6.5"];
19597
+ case "icon-md":
19598
+ return isAddon ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
19601
19599
  case "icon":
19602
19600
  return ["size-9"];
19603
- case "icon-lg":
19604
- return ["size-10"];
19605
19601
  default:
19606
- return ["h-9", "px-4", "py-2", "has-[>svg]:px-3"];
19602
+ return ["h-9", "px-4", "py-2", "has-[>svg]:px-3", "has-[>[data-slot=spinner]]:px-3"];
19607
19603
  }
19608
19604
  };
19609
19605
  function button_default(Alpine) {
@@ -19612,7 +19608,7 @@ function button_default(Alpine) {
19612
19608
  if (!el.hasAttribute("data-slot")) {
19613
19609
  el.setAttribute("data-slot", "button");
19614
19610
  }
19615
- const inGroup = modifiers.includes("group");
19611
+ const isAddon = modifiers.includes("addon");
19616
19612
  let lastSize;
19617
19613
  function setVariant(variant) {
19618
19614
  for (const [_, value] of Object.entries(buttonVariants)) {
@@ -19620,34 +19616,34 @@ function button_default(Alpine) {
19620
19616
  }
19621
19617
  if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
19622
19618
  }
19623
- function setSize(size3 = "default") {
19624
- el.classList.remove(...getButtonSize(lastSize, inGroup));
19625
- el.classList.add(...getButtonSize(size3, inGroup));
19619
+ function setSize2(size3 = "default") {
19620
+ el.classList.remove(...getButtonSize(lastSize, isAddon));
19621
+ el.classList.add(...getButtonSize(size3, isAddon));
19626
19622
  if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
19627
19623
  console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
19628
19624
  }
19629
19625
  lastSize = size3;
19630
19626
  }
19631
19627
  setVariant(el.getAttribute("data-variant") ?? "default");
19632
- if (inGroup) {
19628
+ if (isAddon) {
19633
19629
  el.classList.remove("shadow-button", "inline-flex");
19634
19630
  el.classList.add("shadow-none", "flex");
19635
- setSize(el.getAttribute("data-size") ?? "xs");
19631
+ setSize2(el.getAttribute("data-size") ?? "sm");
19636
19632
  } else {
19637
19633
  if (el.hasAttribute("data-size")) {
19638
- setSize(el.getAttribute("data-size"));
19634
+ setSize2(el.getAttribute("data-size"));
19639
19635
  } else {
19640
19636
  if (["date-picker-trigger", "time-picker-trigger"].includes(el.getAttribute("data-slot"))) {
19641
- setSize("icon-xs");
19637
+ setSize2("icon-sm");
19642
19638
  } else {
19643
- setSize();
19639
+ setSize2();
19644
19640
  }
19645
19641
  }
19646
19642
  }
19647
19643
  const observer = new MutationObserver((mutations) => {
19648
19644
  mutations.forEach((mutation) => {
19649
19645
  if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
19650
- else setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
19646
+ else setSize2(el.getAttribute("data-size") ?? (isAddon ? "sm" : "default"));
19651
19647
  });
19652
19648
  });
19653
19649
  observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
@@ -21299,7 +21295,7 @@ function calendar_default(Alpine) {
21299
21295
  previousYearBtn.setAttribute("type", "button");
21300
21296
  previousYearBtn.appendChild(
21301
21297
  (0, import_lucide2.createElement)(import_lucide2.ChevronsLeft, {
21302
- class: ["opacity-50 size-4 shrink-0 pointer-events-none"],
21298
+ class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
21303
21299
  width: "16",
21304
21300
  height: "16",
21305
21301
  "aria-hidden": true,
@@ -21317,7 +21313,7 @@ function calendar_default(Alpine) {
21317
21313
  previousMonthBtn.setAttribute("type", "button");
21318
21314
  previousMonthBtn.appendChild(
21319
21315
  (0, import_lucide2.createElement)(import_lucide2.ChevronLeft, {
21320
- class: ["opacity-50 size-4 shrink-0 pointer-events-none"],
21316
+ class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
21321
21317
  width: "16",
21322
21318
  height: "16",
21323
21319
  "aria-hidden": true,
@@ -21340,7 +21336,7 @@ function calendar_default(Alpine) {
21340
21336
  nextMonthBtn.setAttribute("type", "button");
21341
21337
  nextMonthBtn.appendChild(
21342
21338
  (0, import_lucide2.createElement)(import_lucide2.ChevronRight, {
21343
- class: ["opacity-50 size-4 shrink-0 pointer-events-none"],
21339
+ class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
21344
21340
  width: "16",
21345
21341
  height: "16",
21346
21342
  "aria-hidden": true,
@@ -21358,7 +21354,7 @@ function calendar_default(Alpine) {
21358
21354
  nextYearBtn.setAttribute("type", "button");
21359
21355
  nextYearBtn.appendChild(
21360
21356
  (0, import_lucide2.createElement)(import_lucide2.ChevronsRight, {
21361
- class: ["opacity-50 size-4 shrink-0 pointer-events-none"],
21357
+ class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
21362
21358
  width: "16",
21363
21359
  height: "16",
21364
21360
  "aria-hidden": true,
@@ -21783,8 +21779,29 @@ function collapsible_default(Alpine) {
21783
21779
 
21784
21780
  // src/components/datepicker.js
21785
21781
  var import_lucide3 = __toESM(require_lucide(), 1);
21782
+
21783
+ // src/common/input-size.js
21784
+ function setSize(el, size3) {
21785
+ if (size3 === "sm") {
21786
+ el.classList.add("h-6.5");
21787
+ el.classList.remove("h-9");
21788
+ } else {
21789
+ el.classList.add("h-9");
21790
+ el.classList.remove("h-6.5");
21791
+ }
21792
+ }
21793
+ function sizeObserver(el) {
21794
+ const observer = new MutationObserver(() => {
21795
+ setSize(el, el.getAttribute("data-size"));
21796
+ });
21797
+ setSize(el, el.getAttribute("data-size"));
21798
+ observer.observe(el, { attributes: true, attributeFilter: ["data-size"] });
21799
+ return observer;
21800
+ }
21801
+
21802
+ // src/components/datepicker.js
21786
21803
  function datepicker_default(Alpine) {
21787
- Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2 }) => {
21804
+ Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2, cleanup }) => {
21788
21805
  el._h_datepicker = Alpine2.reactive({
21789
21806
  id: void 0,
21790
21807
  controls: `hdpc${v4_default()}`,
@@ -21813,10 +21830,7 @@ function datepicker_default(Alpine) {
21813
21830
  "transition-[color,box-shadow]",
21814
21831
  "duration-200",
21815
21832
  "outline-none",
21816
- "h-9",
21817
21833
  "pl-3",
21818
- "pr-1",
21819
- "gap-2",
21820
21834
  "min-w-0",
21821
21835
  "has-[input:focus-visible]:border-ring",
21822
21836
  "has-[input:focus-visible]:ring-ring/50",
@@ -21832,18 +21846,26 @@ function datepicker_default(Alpine) {
21832
21846
  el._h_datepicker.input.classList.add(
21833
21847
  "bg-transparent",
21834
21848
  "outline-none",
21835
- "flex-1",
21836
- "h-full",
21837
- "border-0",
21849
+ "size-full",
21850
+ "pr-1",
21851
+ "border-r",
21852
+ "border-input",
21853
+ "aria-invalid:border-negative",
21854
+ "invalid:border-negative",
21838
21855
  "focus-visible:ring-0",
21839
21856
  "disabled:pointer-events-none",
21840
21857
  "disabled:cursor-not-allowed",
21841
21858
  "disabled:opacity-50",
21842
21859
  "md:text-sm",
21843
- "text-base"
21860
+ "text-base",
21861
+ "truncate"
21844
21862
  );
21845
21863
  el._h_datepicker.input.setAttribute("aria-autocomplete", "none");
21846
21864
  el._h_datepicker.input.setAttribute("type", "text");
21865
+ const observer = sizeObserver(el);
21866
+ cleanup(() => {
21867
+ observer.disconnect();
21868
+ });
21847
21869
  });
21848
21870
  Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
21849
21871
  if (el.tagName !== "BUTTON") {
@@ -21856,6 +21878,28 @@ function datepicker_default(Alpine) {
21856
21878
  if (!datepicker) {
21857
21879
  throw new Error(`${original} must be inside an date-picker element`);
21858
21880
  }
21881
+ el.classList.add(
21882
+ "cursor-pointer",
21883
+ "inline-flex",
21884
+ "items-center",
21885
+ "justify-center",
21886
+ "rounded-r-control",
21887
+ "h-full",
21888
+ "aspect-square",
21889
+ "bg-transparent",
21890
+ "hover:bg-secondary",
21891
+ "active:bg-secondary-active",
21892
+ "outline-none",
21893
+ "focus-visible:border-ring",
21894
+ "focus-visible:ring-ring/50",
21895
+ "focus-visible:ring-[calc(var(--spacing)*0.75)]",
21896
+ "[input[aria-invalid=true]~&]:ring-negative/20",
21897
+ "[input[aria-invalid=true]~&]:border-negative",
21898
+ "dark:[input[aria-invalid=true]~&]:ring-negative/40",
21899
+ "[input:invalid~&]:ring-negative/20",
21900
+ "[input:invalid~&]:border-negative",
21901
+ "dark:[input:invalid~&]:ring-negative/40"
21902
+ );
21859
21903
  el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
21860
21904
  el.setAttribute("aria-expanded", "false");
21861
21905
  el.setAttribute("aria-haspopup", "dialog");
@@ -21863,7 +21907,7 @@ function datepicker_default(Alpine) {
21863
21907
  el.setAttribute("data-slot", "date-picker-trigger");
21864
21908
  el.appendChild(
21865
21909
  (0, import_lucide3.createElement)(import_lucide3.Calendar, {
21866
- class: ["opacity-50 size-4 transition-transform duration-200"],
21910
+ class: ["opacity-70 text-foreground size-4"],
21867
21911
  width: "16",
21868
21912
  height: "16",
21869
21913
  "aria-hidden": true,
@@ -21893,7 +21937,7 @@ function datepicker_default(Alpine) {
21893
21937
  el.removeEventListener("click", handler);
21894
21938
  top.removeEventListener("click", close);
21895
21939
  });
21896
- }).before("h-button");
21940
+ });
21897
21941
  }
21898
21942
 
21899
21943
  // src/components/dialog.js
@@ -21950,8 +21994,8 @@ function dialog_default(Alpine) {
21950
21994
  "flex-col",
21951
21995
  "w-full",
21952
21996
  "max-w-[calc(100%-2rem)]",
21953
- "translate-x-[-50%]",
21954
- "translate-y-[-50%]",
21997
+ "-translate-x-1/2",
21998
+ "-translate-y-1/2",
21955
21999
  "gap-4",
21956
22000
  "rounded-lg",
21957
22001
  "border",
@@ -22030,7 +22074,7 @@ function fieldset_default(Alpine) {
22030
22074
  el.setAttribute("data-slot", "field-group");
22031
22075
  });
22032
22076
  Alpine.directive("h-field", (el) => {
22033
- el.classList.add("group/field", "w-full", "gap-3", "data-[invalid=true]:text-negative");
22077
+ el.classList.add("group/field", "w-full", "gap-3", "has-[input:invalid]:text-negative", "has-[textarea:invalid]:text-negative", "has-[[aria-invalid=true]]:text-negative");
22034
22078
  switch (el.getAttribute("data-orientation")) {
22035
22079
  case "horizontal":
22036
22080
  el.classList.add("hbox", "items-center", "[&>[data-slot=field-label]]:flex-auto", "has-[>[data-slot=field-content]]:items-start", "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px");
@@ -22077,9 +22121,32 @@ function fieldset_default(Alpine) {
22077
22121
  "[&>a]:underline-offset-4"
22078
22122
  );
22079
22123
  el.setAttribute("data-slot", "field-description");
22124
+ if (el.getAttribute("data-hide-on-error") === "true") {
22125
+ el.classList.add(
22126
+ "[[data-slot=field]_input:invalid~&]:hidden",
22127
+ "[[data-slot=field]_textarea:invalid~&]:hidden",
22128
+ "[[data-slot=field]_[aria-invalid=true]~&]:hidden",
22129
+ "group-has-[input:invalid]/field:hidden",
22130
+ "group-has-[textarea:invalid)]/field:hidden",
22131
+ "group-has-[[aria-invalid=true]]/field:hidden"
22132
+ );
22133
+ }
22080
22134
  });
22081
22135
  Alpine.directive("h-field-error", (el) => {
22082
- el.classList.add("text-negative", "text-sm", "font-normal");
22136
+ el.classList.add(
22137
+ "hidden",
22138
+ "[[data-slot=field]_input:invalid~&]:block",
22139
+ "[[data-slot=field]_textarea:invalid~&]:block",
22140
+ "[[data-slot=field]_[aria-invalid=true]~&]:block",
22141
+ "group-has-[input:invalid]/field:block",
22142
+ "group-has-[textarea:invalid)]/field:block",
22143
+ "group-has-[[aria-invalid=true]]/field:block",
22144
+ "text-negative",
22145
+ "text-sm",
22146
+ "leading-normal",
22147
+ "font-normal",
22148
+ "group-has-[[data-orientation=horizontal]]/field:text-balance"
22149
+ );
22083
22150
  el.setAttribute("data-slot", "field-error");
22084
22151
  });
22085
22152
  }
@@ -22146,18 +22213,14 @@ function info_page_default(Alpine) {
22146
22213
 
22147
22214
  // src/components/input.js
22148
22215
  function input_default(Alpine) {
22149
- Alpine.directive("h-input", (el, { modifiers }) => {
22216
+ Alpine.directive("h-input", (el, { modifiers }, { cleanup }) => {
22150
22217
  el.classList.add(
22151
22218
  "file:text-foreground",
22152
22219
  "placeholder:text-muted-foreground",
22153
22220
  "selection:bg-primary",
22154
22221
  "selection:text-primary-foreground",
22155
- "bg-input-inner",
22156
22222
  "border-input",
22157
- "w-full",
22158
22223
  "min-w-0",
22159
- "rounded-control",
22160
- "border",
22161
22224
  "[&:not([type='color'])]:px-3",
22162
22225
  "[&:not([type='color'])]:py-1",
22163
22226
  "[&[type='color']]:overflow-hidden",
@@ -22166,7 +22229,6 @@ function input_default(Alpine) {
22166
22229
  "[&::-webkit-color-swatch-wrapper]:rounded-0",
22167
22230
  "[&::-webkit-color-swatch-wrapper]:p-0",
22168
22231
  "text-base",
22169
- "shadow-input",
22170
22232
  "transition-[color,box-shadow]",
22171
22233
  "outline-none",
22172
22234
  "file:inline-flex",
@@ -22181,7 +22243,6 @@ function input_default(Alpine) {
22181
22243
  "md:text-sm",
22182
22244
  "focus-visible:border-ring",
22183
22245
  "focus-visible:ring-ring/50",
22184
- "focus-visible:ring-[calc(var(--spacing)*0.75)]",
22185
22246
  "aria-invalid:ring-negative/20",
22186
22247
  "dark:aria-invalid:ring-negative/40",
22187
22248
  "aria-invalid:border-negative",
@@ -22190,15 +22251,18 @@ function input_default(Alpine) {
22190
22251
  "invalid:!border-negative"
22191
22252
  );
22192
22253
  if (modifiers.includes("group")) {
22193
- el.classList.remove("rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
22194
- el.classList.add("flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
22254
+ el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
22195
22255
  el.setAttribute("data-slot", "input-group-control");
22196
- } else el.setAttribute("data-slot", "input");
22197
- if (el.getAttribute("data-size") === "sm") el.classList.add("h-8");
22198
- else if (el.getAttribute("data-size") === "xs") el.classList.add("h-6.5");
22199
- else el.classList.add("h-9");
22256
+ } else {
22257
+ el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
22258
+ el.setAttribute("data-slot", "input");
22259
+ const observer = sizeObserver(el);
22260
+ cleanup(() => {
22261
+ observer.disconnect();
22262
+ });
22263
+ }
22200
22264
  });
22201
- Alpine.directive("h-input-group", (el) => {
22265
+ Alpine.directive("h-input-group", (el, _, { cleanup }) => {
22202
22266
  el.classList.add(
22203
22267
  "group/input-group",
22204
22268
  "border-input",
@@ -22212,7 +22276,6 @@ function input_default(Alpine) {
22212
22276
  "shadow-input",
22213
22277
  "transition-[color,box-shadow]",
22214
22278
  "outline-none",
22215
- "h-9",
22216
22279
  "min-w-0",
22217
22280
  "has-[>textarea]:h-auto",
22218
22281
  "has-[>[data-align=inline-start]]:[&>input]:pl-2",
@@ -22232,6 +22295,10 @@ function input_default(Alpine) {
22232
22295
  );
22233
22296
  el.setAttribute("role", "group");
22234
22297
  el.setAttribute("data-slot", "input-group");
22298
+ const observer = sizeObserver(el);
22299
+ cleanup(() => {
22300
+ observer.disconnect();
22301
+ });
22235
22302
  });
22236
22303
  Alpine.directive("h-input-group-addon", (el, _, { cleanup }) => {
22237
22304
  el.classList.add(
@@ -22242,7 +22309,6 @@ function input_default(Alpine) {
22242
22309
  "items-center",
22243
22310
  "justify-center",
22244
22311
  "gap-2",
22245
- "py-1.5",
22246
22312
  "text-sm",
22247
22313
  "font-medium",
22248
22314
  "select-none",
@@ -22254,8 +22320,24 @@ function input_default(Alpine) {
22254
22320
  el.setAttribute("role", "group");
22255
22321
  el.setAttribute("data-slot", "input-group-addon");
22256
22322
  const variants = {
22257
- "inline-start": ["order-first", "pl-3", "has-[>button]:ml-[-0.45rem]", "has-[>[data-slot=tag]]:ml-[-0.35rem]"],
22258
- "inline-end": ["order-last", "pr-3", "has-[>button]:mr-[-0.45rem]", "has-[>[data-slot=tag]]:mr-[-0.35rem]"],
22323
+ "inline-start": [
22324
+ "order-first",
22325
+ "pl-3",
22326
+ "[[data-slot=input-group][data-size=sm]_&]:pl-1.25",
22327
+ "has-[>button]:pl-1.25",
22328
+ "[[data-slot=input-group][data-size=sm]_&]:has-[>button]:pl-0.5",
22329
+ "has-[>[data-slot|=tag]]:pl-1.5",
22330
+ "[[data-slot=input-group][data-size=sm]_&]:has-[>[data-slot|=tag]]:pl-0.5"
22331
+ ],
22332
+ "inline-end": [
22333
+ "order-last",
22334
+ "pr-3",
22335
+ "[[data-slot=input-group][data-size=sm]_&]:pr-1.25",
22336
+ "has-[>button]:pr-1.25",
22337
+ "[[data-slot=input-group][data-size=sm]_&]:has-[>button]:pr-0.5",
22338
+ "has-[>[data-slot|=tag]]:pr-1.5",
22339
+ "[[data-slot=input-group][data-size=sm]_&]:has-[>[data-slot|=tag]]:pr-0.5"
22340
+ ],
22259
22341
  "block-start": ["order-first", "w-full", "justify-start", "px-3", "pt-3", "[.border-b]:pb-3", "group-has-[>input]/input-group:pt-2.5"],
22260
22342
  "block-end": ["order-last", "w-full", "justify-start", "px-3", "pb-3", "[.border-t]:pt-3", "group-has-[>input]/input-group:pb-2.5"]
22261
22343
  };
@@ -22280,6 +22362,145 @@ function input_default(Alpine) {
22280
22362
  el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
22281
22363
  el.setAttribute("data-slot", "label");
22282
22364
  });
22365
+ Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
22366
+ el.classList.add(
22367
+ "group/input-number",
22368
+ "border-input",
22369
+ "bg-input-inner",
22370
+ "relative",
22371
+ "flex",
22372
+ "w-full",
22373
+ "items-center",
22374
+ "rounded-control",
22375
+ "border",
22376
+ "shadow-input",
22377
+ "transition-[color,box-shadow]",
22378
+ "outline-none",
22379
+ "min-w-0",
22380
+ "has-[[data-slot=input-number-control]:focus-visible]:border-ring",
22381
+ "has-[[data-slot=input-number-control]:focus-visible]:ring-ring/50",
22382
+ "has-[[data-slot=input-number-control]:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
22383
+ "has-[[data-slot][aria-invalid=true]]:ring-negative/20",
22384
+ "has-[[data-slot][aria-invalid=true]]:border-negative",
22385
+ "dark:has-[[data-slot][aria-invalid=true]]:ring-negative/40"
22386
+ );
22387
+ el.setAttribute("role", "group");
22388
+ el.setAttribute("data-slot", "input-number");
22389
+ const input = el.querySelector("input");
22390
+ if (!input || input.getAttribute("type") !== "number") {
22391
+ throw new Error(`${original} must contain an input of type 'number'`);
22392
+ }
22393
+ if (!input.hasAttribute("type")) input.setAttribute("type", "number");
22394
+ if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
22395
+ if (!input.hasAttribute("aria-roledescription")) {
22396
+ input.setAttribute("aria-roledescription", "Number field");
22397
+ }
22398
+ if (!input.hasAttribute("id")) {
22399
+ input.setAttribute("id", `in${v4_default()}`);
22400
+ }
22401
+ input.setAttribute("tabindex", "0");
22402
+ input.setAttribute("autocomplete", "off");
22403
+ input.setAttribute("autocorrect", "off");
22404
+ input.setAttribute("spellcheck", "off");
22405
+ input.setAttribute("data-slot", "input-number-control");
22406
+ input.classList.add("rounded-l-control", "size-full", "px-3", "py-1", "outline-none");
22407
+ const stepDown = document.createElement("button");
22408
+ stepDown.setAttribute("type", "button");
22409
+ stepDown.setAttribute("tabIndex", "-1");
22410
+ stepDown.setAttribute("aria-label", "Decrease");
22411
+ stepDown.setAttribute("aria-controls", input.getAttribute("id"));
22412
+ stepDown.setAttribute("data-slot", "step-up-trigger");
22413
+ stepDown.classList.add(
22414
+ "cursor-pointer",
22415
+ "border-l",
22416
+ "border-input",
22417
+ "[input[aria-invalid=true]~&]:border-negative",
22418
+ "[input:invalid~&]:border-negative",
22419
+ "h-full",
22420
+ "aspect-square",
22421
+ "bg-transparent",
22422
+ "hover:bg-secondary",
22423
+ "active:bg-secondary-active",
22424
+ "outline-none",
22425
+ "relative",
22426
+ "before:block",
22427
+ "before:opacity-70",
22428
+ "before:rounded-full",
22429
+ "before:h-0.5",
22430
+ "before:min-h-px",
22431
+ "before:w-3",
22432
+ "before:mx-auto",
22433
+ "before:bg-foreground",
22434
+ "before:hover:bg-secondary-foreground"
22435
+ );
22436
+ el.appendChild(stepDown);
22437
+ const onStepDown = () => {
22438
+ input.stepDown();
22439
+ input.dispatchEvent(new Event("input", { bubbles: true }));
22440
+ input.dispatchEvent(new Event("change", { bubbles: true }));
22441
+ };
22442
+ stepDown.addEventListener("click", onStepDown);
22443
+ const stepUp = document.createElement("button");
22444
+ stepUp.setAttribute("type", "button");
22445
+ stepUp.setAttribute("tabIndex", "-1");
22446
+ stepUp.setAttribute("aria-label", "Increase");
22447
+ stepUp.setAttribute("aria-controls", input.getAttribute("id"));
22448
+ stepUp.setAttribute("data-slot", "step-up-trigger");
22449
+ stepUp.classList.add(
22450
+ "cursor-pointer",
22451
+ "border-l",
22452
+ "border-input",
22453
+ "[input[aria-invalid=true]~&]:border-negative",
22454
+ "[input:invalid~&]:border-negative",
22455
+ "rounded-r-control",
22456
+ "h-full",
22457
+ "aspect-square",
22458
+ "bg-transparent",
22459
+ "hover:bg-secondary",
22460
+ "active:bg-secondary-active",
22461
+ "outline-none",
22462
+ "relative",
22463
+ "before:block",
22464
+ "before:opacity-70",
22465
+ "before:absolute",
22466
+ "before:rounded-full",
22467
+ "before:h-0.5",
22468
+ "before:min-h-px",
22469
+ "before:w-3",
22470
+ "before:top-1/2",
22471
+ "before:left-1/2",
22472
+ "before:-translate-x-1/2",
22473
+ "before:-translate-y-1/2",
22474
+ "before:bg-foreground",
22475
+ "before:hover:bg-secondary-foreground",
22476
+ "after:block",
22477
+ "after:opacity-70",
22478
+ "after:absolute",
22479
+ "after:rounded-full",
22480
+ "after:h-3",
22481
+ "after:min-w-px",
22482
+ "after:w-0.5",
22483
+ "after:top-1/2",
22484
+ "after:left-1/2",
22485
+ "after:-translate-x-1/2",
22486
+ "after:-translate-y-1/2",
22487
+ "after:bg-foreground",
22488
+ "after:hover:bg-secondary-foreground"
22489
+ );
22490
+ el.appendChild(stepUp);
22491
+ const onStepUp = () => {
22492
+ input.stepUp();
22493
+ input.dispatchEvent(new Event("input", { bubbles: true }));
22494
+ input.dispatchEvent(new Event("change", { bubbles: true }));
22495
+ };
22496
+ stepUp.addEventListener("click", onStepUp);
22497
+ const observer = sizeObserver(el);
22498
+ cleanup(() => {
22499
+ observer.disconnect();
22500
+ stepDown.removeEventListener("click", onStepDown);
22501
+ stepUp.removeEventListener("click", onStepUp);
22502
+ });
22503
+ });
22283
22504
  }
22284
22505
 
22285
22506
  // src/components/label.js
@@ -23415,30 +23636,10 @@ function select_default(Alpine) {
23415
23636
  "duration-200",
23416
23637
  "outline-none",
23417
23638
  "has-[input:disabled]:pointer-events-none",
23418
- "has-[input:disabled]:opacity-50",
23419
- "[&_svg]:pointer-events-none",
23420
- "[&_svg]:shrink-0",
23421
- "[&_svg]:size-4",
23422
- "[&_svg]:opacity-50"
23639
+ "has-[input:disabled]:opacity-50"
23423
23640
  );
23424
23641
  el.setAttribute("data-slot", "select");
23425
- const setSize = (size3) => {
23426
- if (size3 === "sm") {
23427
- el.classList.add("h-8");
23428
- el.classList.remove("h-9", "h-6.5");
23429
- } else if (size3 === "xs") {
23430
- el.classList.add("h-6.5");
23431
- el.classList.remove("h-9", "h-8");
23432
- } else {
23433
- el.classList.add("h-9");
23434
- el.classList.remove("h-8", "h-6.5");
23435
- }
23436
- };
23437
- setSize(el.getAttribute("data-size"));
23438
- const observer = new MutationObserver(() => {
23439
- setSize(el.getAttribute("data-size"));
23440
- });
23441
- observer.observe(el, { attributes: true, attributeFilter: ["data-size"] });
23642
+ const observer = sizeObserver(el);
23442
23643
  cleanup(() => {
23443
23644
  observer.disconnect();
23444
23645
  });
@@ -23673,7 +23874,7 @@ function select_default(Alpine) {
23673
23874
  fakeTrigger.addEventListener("keydown", onPress);
23674
23875
  fakeTrigger.addEventListener("click", onClick2);
23675
23876
  const chevronDown = (0, import_lucide4.createElement)(import_lucide4.ChevronDown, {
23676
- class: ["opacity-50 size-4 transition-transform duration-200"],
23877
+ class: ["opacity-70 text-foreground size-4 shrink-0 pointer-events-none transition-transform duration-200"],
23677
23878
  width: "16",
23678
23879
  height: "16",
23679
23880
  "aria-hidden": true,
@@ -24180,13 +24381,13 @@ function sidebar_default(Alpine) {
24180
24381
  sm: ["h-7", "text-xs"],
24181
24382
  lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
24182
24383
  };
24183
- function setSize(size3) {
24384
+ function setSize2(size3) {
24184
24385
  if (sizes.hasOwnProperty(size3)) {
24185
24386
  el.classList.add(...sizes[size3]);
24186
24387
  }
24187
24388
  }
24188
24389
  if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
24189
- setSize(el.getAttribute("data-size"));
24390
+ setSize2(el.getAttribute("data-size"));
24190
24391
  });
24191
24392
  Alpine.directive("h-sidebar-menu-action", (el, { modifiers }) => {
24192
24393
  el.classList.add(
@@ -24318,13 +24519,13 @@ function sidebar_default(Alpine) {
24318
24519
  sm: ["text-xs"],
24319
24520
  md: ["text-sm"]
24320
24521
  };
24321
- function setSize(size3) {
24522
+ function setSize2(size3) {
24322
24523
  if (sizes.hasOwnProperty(size3)) {
24323
24524
  el.classList.add(...sizes[size3]);
24324
24525
  }
24325
24526
  }
24326
24527
  if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "md");
24327
- setSize(el.getAttribute("data-size"));
24528
+ setSize2(el.getAttribute("data-size"));
24328
24529
  });
24329
24530
  Alpine.directive("h-sidebar-footer", (el) => {
24330
24531
  el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
@@ -24340,10 +24541,10 @@ function skeleton_default(Alpine) {
24340
24541
  if (modifiers.includes("control")) {
24341
24542
  el.classList.add("rounded-control");
24342
24543
  switch (el.getAttribute("data-size")) {
24343
- case "xs":
24544
+ case "sm":
24344
24545
  el.classList.add("h-6.5");
24345
24546
  break;
24346
- case "sm":
24547
+ case "md":
24347
24548
  el.classList.add("h-8");
24348
24549
  break;
24349
24550
  default:
@@ -24362,7 +24563,20 @@ function skeleton_default(Alpine) {
24362
24563
  // src/components/spinner.js
24363
24564
  function spinner_default(Alpine) {
24364
24565
  Alpine.directive("h-spinner", (el) => {
24365
- el.classList.add("size-4", "border-2", "border-x-primary", "border-b-primary", "border-t-transparent", "rounded-full", "animate-spin");
24566
+ el.classList.add(
24567
+ "size-4",
24568
+ "border-2",
24569
+ "border-primary",
24570
+ "[[data-slot=button]_&]:border-secondary-foreground",
24571
+ "[[data-slot=button][data-variant=primary]_&]:border-primary-foreground",
24572
+ "[[data-slot=button][data-variant=positive]_&]:border-positive-foreground",
24573
+ "[[data-slot=button][data-variant=negative]_&]:border-negative-foreground",
24574
+ "[[data-slot=button][data-variant=warning]_&]:border-warning-foreground",
24575
+ "[[data-slot=button][data-variant=information]_&]:border-information-foreground",
24576
+ "!border-t-transparent",
24577
+ "rounded-full",
24578
+ "animate-spin"
24579
+ );
24366
24580
  el.setAttribute("role", "status");
24367
24581
  el.setAttribute("data-slot", "spinner");
24368
24582
  if (!el.hasAttribute("aria-label")) el.setAttribute("aria-label", "Loading");
@@ -24921,6 +25135,10 @@ function tile_default(Alpine) {
24921
25135
  "group/tile",
24922
25136
  "flex",
24923
25137
  "items-center",
25138
+ "py-3",
25139
+ "px-4",
25140
+ "has-data-[slot=tile-header]:py-4",
25141
+ "gap-2.5",
24924
25142
  "text-sm",
24925
25143
  "rounded-lg",
24926
25144
  "transition-colors",
@@ -24935,14 +25153,6 @@ function tile_default(Alpine) {
24935
25153
  "focus-visible:ring-[calc(var(--spacing)*0.75)]"
24936
25154
  );
24937
25155
  el.setAttribute("data-slot", "tile");
24938
- const sizes = {
24939
- default: ["p-4", "gap-4"],
24940
- sm: ["py-3", "px-4", "gap-2.5"]
24941
- };
24942
- function setSize(size3) {
24943
- el.classList.add(...sizes[size3]);
24944
- el.setAttribute("data-size", size3);
24945
- }
24946
25156
  switch (el.getAttribute("data-variant")) {
24947
25157
  case "outline":
24948
25158
  el.classList.add("border", "border-border");
@@ -24956,9 +25166,6 @@ function tile_default(Alpine) {
24956
25166
  default:
24957
25167
  el.classList.add("border", "bg-transparent", "border-transparent");
24958
25168
  }
24959
- if (el.getAttribute("data-size") === "sm") {
24960
- setSize("sm");
24961
- } else setSize("sm");
24962
25169
  });
24963
25170
  Alpine.directive("h-tile-header", (el) => {
24964
25171
  el.classList.add("flex", "basis-full", "items-center", "justify-between", "gap-2");
@@ -25085,12 +25292,12 @@ function timepicker_default(Alpine) {
25085
25292
  "has-[input:focus-visible]:border-ring",
25086
25293
  "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
25087
25294
  "has-[input:focus-visible]:ring-ring/50",
25088
- "dark:has-[aria-invalid=true]:ring-negative/40",
25089
- "dark:has-[input:invalid]:ring-negative/40",
25090
- "has-[aria-invalid=true]:border-negative",
25091
- "has-[aria-invalid=true]:ring-negative/20",
25092
- "has-[input:invalid]:border-negative",
25295
+ "has-[input[aria-invalid=true]]:ring-negative/20",
25296
+ "has-[input[aria-invalid=true]]:border-negative",
25297
+ "dark:has-[input[aria-invalid=true]]:ring-negative/40",
25093
25298
  "has-[input:invalid]:ring-negative/20",
25299
+ "has-[input:invalid]:border-negative",
25300
+ "dark:has-[input:invalid]:ring-negative/40",
25094
25301
  "hover:bg-secondary-hover",
25095
25302
  "active:bg-secondary-active",
25096
25303
  "flex",
@@ -25098,12 +25305,12 @@ function timepicker_default(Alpine) {
25098
25305
  "items-center",
25099
25306
  "justify-between",
25100
25307
  "gap-2",
25101
- "h-9",
25102
25308
  "rounded-control",
25103
25309
  "border",
25104
25310
  "bg-input-inner",
25105
25311
  "pl-3",
25106
25312
  "pr-2",
25313
+ "data-[size=sm]:pr-1",
25107
25314
  "text-sm",
25108
25315
  "whitespace-nowrap",
25109
25316
  "shadow-input",
@@ -25111,17 +25318,13 @@ function timepicker_default(Alpine) {
25111
25318
  "duration-200",
25112
25319
  "outline-none",
25113
25320
  "has-[input:disabled]:pointer-events-none",
25114
- "has-[input:disabled]:opacity-50",
25115
- "[&_svg]:pointer-events-none",
25116
- "[&_svg]:shrink-0",
25117
- "[&_svg]:size-4",
25118
- "[&_svg]:opacity-50"
25321
+ "has-[input:disabled]:opacity-50"
25119
25322
  );
25120
25323
  el.setAttribute("data-slot", "time-picker");
25121
25324
  el.setAttribute("tabindex", "-1");
25122
25325
  el.appendChild(
25123
25326
  (0, import_lucide5.createElement)(import_lucide5.Clock, {
25124
- class: ["opacity-50 size-4 transition-transform duration-200"],
25327
+ class: ["opacity-70 text-foreground size-4 shrink-0 pointer-events-none"],
25125
25328
  width: "16",
25126
25329
  height: "16",
25127
25330
  "aria-hidden": true,
@@ -25160,13 +25363,15 @@ function timepicker_default(Alpine) {
25160
25363
  };
25161
25364
  el.addEventListener("click", handler);
25162
25365
  el.addEventListener("keydown", handler);
25366
+ const observer = sizeObserver(el);
25163
25367
  cleanup(() => {
25368
+ observer.disconnect();
25164
25369
  el.removeEventListener("click", handler);
25165
25370
  el.removeEventListener("keydown", handler);
25166
25371
  top.removeEventListener("click", el._h_timepicker.close);
25167
25372
  });
25168
25373
  });
25169
- Alpine.directive("h-time-picker-input", (el, { original }, { effect, Alpine: Alpine2 }) => {
25374
+ Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
25170
25375
  if (el.tagName !== "INPUT") {
25171
25376
  throw new Error(`${original} must be a readonly input of type "text"`);
25172
25377
  }
@@ -25200,8 +25405,7 @@ function timepicker_default(Alpine) {
25200
25405
  timepicker._h_timepicker.id = `htp${v4_default()}`;
25201
25406
  el.setAttribute("id", timepicker._h_timepicker.id);
25202
25407
  }
25203
- el.classList.add("cursor-pointer", "bg-transparent", "text-transparent", "text-shadow-[0_0_0_var(--foreground)]", "outline-none", "flex-1", "h-full", "border-0", "md:text-sm", "text-base");
25204
- el.readOnly = true;
25408
+ el.classList.add("cursor-pointer", "bg-transparent", "text-transparent", "text-shadow-[0_0_0_var(--foreground)]", "placeholder:text-muted-foreground", "outline-none", "size-full", "border-0", "md:text-sm", "text-base", "truncate");
25205
25409
  el.setAttribute("aria-autocomplete", "none");
25206
25410
  el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
25207
25411
  el.setAttribute("aria-expanded", "false");
@@ -25244,11 +25448,20 @@ function timepicker_default(Alpine) {
25244
25448
  placeholder = timepicker._h_timepicker.is12Hour ? "--:-- --" : "--:--";
25245
25449
  }
25246
25450
  el.setAttribute("placeholder", placeholder);
25451
+ const preventInput = (event) => {
25452
+ event.preventDefault();
25453
+ };
25454
+ el.addEventListener("beforeinput", preventInput);
25455
+ el.addEventListener("paste", preventInput);
25247
25456
  effect(() => {
25248
25457
  el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
25249
25458
  el.setAttribute("aria-expanded", timepicker._h_timepicker.expanded);
25250
25459
  });
25251
- }).before("h-button");
25460
+ cleanup(() => {
25461
+ el.removeEventListener("keydown", preventInput);
25462
+ el.removeEventListener("paste", preventInput);
25463
+ });
25464
+ });
25252
25465
  Alpine.directive("h-time-picker-popup", (el, _, { effect, cleanup, Alpine: Alpine2 }) => {
25253
25466
  const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
25254
25467
  el.classList.add(
@@ -25265,6 +25478,7 @@ function timepicker_default(Alpine) {
25265
25478
  "z-50",
25266
25479
  "shadow-md"
25267
25480
  );
25481
+ el.setAttribute("id", timepicker._h_timepicker.controls);
25268
25482
  el.setAttribute("tabindex", "-1");
25269
25483
  el.setAttribute("role", "dialog");
25270
25484
  el.setAttribute("aria-modal", "true");
@@ -25461,7 +25675,7 @@ function timepicker_default(Alpine) {
25461
25675
  }
25462
25676
  }
25463
25677
  const timeContainer = document.createElement("div");
25464
- timeContainer.classList.add("hbox", "max-h-[18rem]", "[&>ul]:border-r", "[&>ul:last-of-type]:border-r-0");
25678
+ timeContainer.classList.add("hbox", "max-h-[14rem]", "[&>ul]:border-r", "[&>ul:last-of-type]:border-r-0");
25465
25679
  if (el.firstChild) el.classList.add("border-b");
25466
25680
  timeContainer.setAttribute("role", "group");
25467
25681
  timeContainer.addEventListener("click", setTime);
@@ -25548,6 +25762,7 @@ function timepicker_default(Alpine) {
25548
25762
  footer.classList.add("hbox", "justify-between", "gap-1", "border-t", "p-2");
25549
25763
  footer.setAttribute("tabindex", "-1");
25550
25764
  const nowButton = document.createElement("button");
25765
+ nowButton.setAttribute("type", "button");
25551
25766
  nowButton.setAttribute(Alpine2.prefixed("h-button"), "");
25552
25767
  nowButton.setAttribute("data-size", "sm");
25553
25768
  nowButton.setAttribute("data-action", "time");
@@ -25555,6 +25770,7 @@ function timepicker_default(Alpine) {
25555
25770
  nowButton.addEventListener("click", getCurrentTime);
25556
25771
  footer.appendChild(nowButton);
25557
25772
  const okButton = document.createElement("button");
25773
+ okButton.setAttribute("type", "button");
25558
25774
  okButton.setAttribute(Alpine2.prefixed("h-button"), "");
25559
25775
  okButton.setAttribute("data-variant", "primary");
25560
25776
  okButton.setAttribute("data-size", "sm");
@@ -26091,7 +26307,7 @@ function tree_default(Alpine) {
26091
26307
  }
26092
26308
 
26093
26309
  // package.json
26094
- var version = "0.9.1";
26310
+ var version = "1.1.0";
26095
26311
 
26096
26312
  // src/utils/breakpoint-listener.js
26097
26313
  function getBreakpointListener(handler, breakpoint = 768) {