@codbex/harmonia 0.9.0 → 0.9.1

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.
@@ -21174,7 +21174,7 @@ function calendar_default(Alpine) {
21174
21174
  el.classList.add("border", "rounded-control", "gap-2", "p-2");
21175
21175
  el.setAttribute("tabindex", "-1");
21176
21176
  if (datepicker) {
21177
- el.classList.add("fixed", "bg-popover", "text-popover-foreground", "data-[state=open]:flex", "data-[state=open]:flex-col", "data-[state=closed]:hidden", "z-50", "shadow-md");
21177
+ el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=open]:flex", "data-[state=open]:flex-col", "data-[state=closed]:hidden", "z-50", "shadow-md");
21178
21178
  el.setAttribute("role", "dialog");
21179
21179
  el.setAttribute("aria-modal", "true");
21180
21180
  el.setAttribute("data-slot", "date-picker-calendar");
@@ -21604,7 +21604,6 @@ function calendar_default(Alpine) {
21604
21604
  function updatePosition() {
21605
21605
  computePosition2(datepicker, el, {
21606
21606
  placement: el.getAttribute("data-align") || "bottom-start",
21607
- strategy: "fixed",
21608
21607
  middleware: [offset2(4), flip2(), shift2({ padding: 4 })]
21609
21608
  }).then(({ x, y }) => {
21610
21609
  Object.assign(el.style, {
@@ -21830,7 +21829,19 @@ function datepicker_default(Alpine) {
21830
21829
  "dark:has-[input:invalid]:ring-negative/40"
21831
21830
  );
21832
21831
  el.setAttribute("data-slot", "date-picker");
21833
- el._h_datepicker.input.classList.add("bg-transparent", "outline-none", "flex-1", "border-0", "focus-visible:ring-0", "disabled:pointer-events-none", "disabled:cursor-not-allowed", "disabled:opacity-50", "md:text-sm", "text-base");
21832
+ el._h_datepicker.input.classList.add(
21833
+ "bg-transparent",
21834
+ "outline-none",
21835
+ "flex-1",
21836
+ "h-full",
21837
+ "border-0",
21838
+ "focus-visible:ring-0",
21839
+ "disabled:pointer-events-none",
21840
+ "disabled:cursor-not-allowed",
21841
+ "disabled:opacity-50",
21842
+ "md:text-sm",
21843
+ "text-base"
21844
+ );
21834
21845
  el._h_datepicker.input.setAttribute("aria-autocomplete", "none");
21835
21846
  el._h_datepicker.input.setAttribute("type", "text");
21836
21847
  });
@@ -25030,6 +25041,15 @@ var getSelectedTime = (rawTime, convertTo12) => {
25030
25041
  }
25031
25042
  return { hour, minute, second, period };
25032
25043
  };
25044
+ function scrollIntoCenter(container, element, behavior = "instant") {
25045
+ const containerRect = container.getBoundingClientRect();
25046
+ const elementRect = element.getBoundingClientRect();
25047
+ const offset3 = elementRect.top - containerRect.top - container.clientHeight / 2 + element.clientHeight / 2;
25048
+ container.scrollBy({
25049
+ top: offset3,
25050
+ behavior
25051
+ });
25052
+ }
25033
25053
  function timepicker_default(Alpine) {
25034
25054
  Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
25035
25055
  el._h_timepicker = Alpine2.reactive({
@@ -25236,7 +25256,7 @@ function timepicker_default(Alpine) {
25236
25256
  "outline-none",
25237
25257
  "border",
25238
25258
  "rounded-control",
25239
- "fixed",
25259
+ "absolute",
25240
25260
  "bg-popover",
25241
25261
  "text-popover-foreground",
25242
25262
  "data-[state=open]:flex",
@@ -25648,21 +25668,26 @@ function timepicker_default(Alpine) {
25648
25668
  };
25649
25669
  el.addEventListener("click", onClick2);
25650
25670
  let autoUpdateCleanup;
25671
+ let focusFirstItem = true;
25651
25672
  function updatePosition() {
25652
25673
  computePosition2(timepicker, el, {
25653
25674
  placement: el.getAttribute("data-align") || "bottom-start",
25654
- strategy: "fixed",
25655
25675
  middleware: [offset2(4), flip2(), shift2({ padding: 4 })]
25656
25676
  }).then(({ x, y }) => {
25657
- if (selectedHour) {
25658
- selectedHour.focus();
25659
- } else {
25660
- hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
25661
- }
25662
25677
  Object.assign(el.style, {
25663
25678
  left: `${x}px`,
25664
25679
  top: `${y}px`
25665
25680
  });
25681
+ if (focusFirstItem) {
25682
+ focusFirstItem = false;
25683
+ Alpine2.nextTick(() => {
25684
+ if (selectedHour) {
25685
+ selectedHour.focus();
25686
+ } else {
25687
+ hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
25688
+ }
25689
+ });
25690
+ }
25666
25691
  });
25667
25692
  }
25668
25693
  effect(() => {
@@ -25670,11 +25695,12 @@ function timepicker_default(Alpine) {
25670
25695
  if (timepicker._h_timepicker.expanded) {
25671
25696
  render();
25672
25697
  autoUpdateCleanup = autoUpdate(timepicker, el, updatePosition);
25673
- if (selectedHour) selectedHour.scrollIntoView({ block: "center" });
25674
- if (selectedMinute) selectedMinute.scrollIntoView({ block: "center" });
25675
- if (selectedSecond && timepicker._h_timepicker.seconds) selectedSecond.scrollIntoView({ block: "center" });
25698
+ if (selectedHour) scrollIntoCenter(selectedHour.parentElement, selectedHour);
25699
+ if (selectedMinute) scrollIntoCenter(selectedMinute.parentElement, selectedMinute);
25700
+ if (selectedSecond && timepicker._h_timepicker.seconds) scrollIntoCenter(selectedSecond.parentElement, selectedSecond);
25676
25701
  } else {
25677
25702
  if (autoUpdateCleanup) autoUpdateCleanup();
25703
+ focusFirstItem = true;
25678
25704
  Object.assign(el.style, {
25679
25705
  left: "0px",
25680
25706
  top: "0px"
@@ -26065,7 +26091,7 @@ function tree_default(Alpine) {
26065
26091
  }
26066
26092
 
26067
26093
  // package.json
26068
- var version = "0.9.0";
26094
+ var version = "0.9.1";
26069
26095
 
26070
26096
  // src/utils/breakpoint-listener.js
26071
26097
  function getBreakpointListener(handler, breakpoint = 768) {