datex-ui 1.2.2 → 1.2.5

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.
package/dist/index.esm.js CHANGED
@@ -64,10 +64,10 @@ function f(l, t) {
64
64
  function w(l) {
65
65
  return new Date(l.getFullYear(), l.getMonth(), 1);
66
66
  }
67
- function B(l) {
67
+ function I(l) {
68
68
  return new Date(l.getFullYear(), l.getMonth() + 1, 0);
69
69
  }
70
- function I(l, t = 1) {
70
+ function B(l, t = 1) {
71
71
  const a = (l.getDay() - t + 7) % 7, i = new Date(l);
72
72
  return i.setDate(l.getDate() - a), i;
73
73
  }
@@ -432,7 +432,12 @@ class H {
432
432
  color: ${t.textColor} !important;
433
433
  line-height: 1em !important;
434
434
  width: 278px !important;
435
- z-index: 999999 !important;
435
+ z-index: 999999; /* Removed !important to allow JavaScript override */
436
+ margin-top: 7px;
437
+ }
438
+
439
+ .datex-picker.drop-up {
440
+ margin-top: 0 !important;
436
441
  }
437
442
 
438
443
  /* Base arrow styles - creates the dropdown arrow */
@@ -854,7 +859,7 @@ class H {
854
859
  min-height: 20px !important;
855
860
  min-width: 50px !important;
856
861
  position: relative !important;
857
- z-index: 1000000 !important;
862
+ z-index: 1000000; /* Removed !important to allow JavaScript override */
858
863
  transform: none !important;
859
864
  isolation: auto !important;
860
865
  }
@@ -946,7 +951,7 @@ class H {
946
951
  box-sizing: border-box !important;
947
952
  transform: none !important;
948
953
  overflow-x: hidden !important;
949
- z-index: 999999 !important;
954
+ z-index: 999999; /* Removed !important to allow JavaScript override */
950
955
  /* Fix for overlay issues */
951
956
  isolation: isolate !important;
952
957
  contain: layout style !important;
@@ -1191,7 +1196,7 @@ class H {
1191
1196
  .datex-picker select,
1192
1197
  .datex-picker.mobile-view select {
1193
1198
  position: relative !important;
1194
- z-index: 1000 !important;
1199
+ z-index: 1000; /* Removed !important to allow JavaScript override */
1195
1200
  background: ${t.backgroundColor} !important;
1196
1201
  border: 1px solid ${t.borderColor} !important;
1197
1202
  border-radius: 4px !important;
@@ -1530,6 +1535,10 @@ class E {
1530
1535
  */
1531
1536
  updateZIndex() {
1532
1537
  if (!this.container) return;
1538
+ if (this.options.zIndex !== "auto") {
1539
+ this.container.style.zIndex = this.options.zIndex.toString(), this.updateInternalElementsZIndex(this.options.zIndex);
1540
+ return;
1541
+ }
1533
1542
  const t = this.getHighestZIndex(), e = parseInt(this.container.style.zIndex || "0");
1534
1543
  if (t >= e) {
1535
1544
  const a = t + 1;
@@ -1548,15 +1557,20 @@ class E {
1548
1557
  }
1549
1558
  positionForMobile() {
1550
1559
  this.container.style.position = "fixed", this.container.style.bottom = "0", this.container.style.left = "0", this.container.style.right = "0", this.container.style.top = "auto", this.container.style.width = "100%", this.container.style.maxWidth = "100vw", this.container.style.minWidth = "100vw", this.container.style.borderRadius = "12px 12px 0 0", this.container.style.zIndex = "999999", this.container.style.margin = "0", this.container.style.padding = "0", this.container.style.boxSizing = "border-box", this.container.style.transform = "none", this.container.style.maxHeight = "85vh", this.container.style.isolation = "isolate", this.container.style.contain = "layout style", this.container.style.pointerEvents = "auto", this.container.style.touchAction = "manipulation", this.container.classList.add("drop-up", "mobile-view"), this.container.classList.remove("opensleft", "opensright", "openscenter"), this.showMobileHeader();
1551
- const t = this.getHighestZIndex(), e = 999999, a = t >= e ? t + 1 : e;
1552
- this.container.style.zIndex = a.toString(), this.updateInternalElementsZIndex(a);
1560
+ let t;
1561
+ if (this.options.zIndex !== "auto")
1562
+ t = this.options.zIndex;
1563
+ else {
1564
+ const e = this.getHighestZIndex(), a = 999999;
1565
+ t = e >= a ? e + 1 : a;
1566
+ }
1567
+ this.container.style.zIndex = t.toString(), this.updateInternalElementsZIndex(t);
1553
1568
  }
1554
1569
  getHighestZIndex() {
1555
- const t = document.querySelectorAll("*");
1556
- let e = 0;
1557
- for (let a = 0; a < t.length; a++) {
1558
- const i = parseInt(window.getComputedStyle(t[a]).zIndex);
1559
- !isNaN(i) && i > e && (e = i);
1570
+ let t = this.element, e = 0;
1571
+ for (; t && t instanceof HTMLElement && t !== document.body; ) {
1572
+ const a = window.getComputedStyle(t), i = parseInt(a.zIndex);
1573
+ !isNaN(i) && i > e && (e = i), t = t.parentElement;
1560
1574
  }
1561
1575
  return e;
1562
1576
  }
@@ -1579,13 +1593,13 @@ class E {
1579
1593
  let a, i = this.options.drops;
1580
1594
  switch (i) {
1581
1595
  case "auto":
1582
- a = t.bottom + 5, a + e >= window.innerHeight && (a = t.top - e - 5, i = "up");
1596
+ a = t.bottom, a + e >= window.innerHeight && (a = t.top - e - 7, i = "up");
1583
1597
  break;
1584
1598
  case "up":
1585
- a = t.top - e - 5;
1599
+ a = t.top - e - 7;
1586
1600
  break;
1587
1601
  default:
1588
- a = t.bottom + 5;
1602
+ a = t.bottom;
1589
1603
  break;
1590
1604
  }
1591
1605
  return { top: Math.max(9, a), drops: i };
@@ -1610,8 +1624,14 @@ class E {
1610
1624
  }
1611
1625
  applyFinalPosition(t, e) {
1612
1626
  this.container.style.top = `${t}px`, this.container.style.left = `${e}px`, this.container.style.right = "auto";
1613
- const a = this.getHighestZIndex(), i = 99999, o = a >= i ? a + 1 : i;
1614
- this.container.style.zIndex = o.toString(), this.updateInternalElementsZIndex(o);
1627
+ let a;
1628
+ if (this.options.zIndex !== "auto")
1629
+ a = this.options.zIndex;
1630
+ else {
1631
+ const i = this.getHighestZIndex(), o = 99999;
1632
+ a = i >= o ? i + 1 : o;
1633
+ }
1634
+ this.container.style.zIndex = a.toString(), this.updateInternalElementsZIndex(a);
1615
1635
  }
1616
1636
  updateInternalElementsZIndex(t) {
1617
1637
  this.container.querySelectorAll("select").forEach((i) => {
@@ -1638,7 +1658,7 @@ class L {
1638
1658
  this.options = t, this.locale = e;
1639
1659
  }
1640
1660
  buildCalendarMatrix(t) {
1641
- const e = w(t), a = I(e, this.locale.firstDay), i = [];
1661
+ const e = w(t), a = B(e, this.locale.firstDay), i = [];
1642
1662
  let o = [];
1643
1663
  const n = new Date(a);
1644
1664
  for (let r = 0; r < 42; r++) {
@@ -1796,10 +1816,10 @@ class L {
1796
1816
  return !this.options.minDate || y(w(t), this.options.minDate);
1797
1817
  }
1798
1818
  canNavigateNext(t) {
1799
- return !this.options.maxDate || x(B(t), this.options.maxDate);
1819
+ return !this.options.maxDate || x(I(t), this.options.maxDate);
1800
1820
  }
1801
1821
  }
1802
- class A {
1822
+ class F {
1803
1823
  constructor(t = {}) {
1804
1824
  this.validation = t;
1805
1825
  }
@@ -1892,7 +1912,7 @@ class A {
1892
1912
  return ((e = this.validation.holidays) == null ? void 0 : e.some((a) => this.isSameDate(a, t))) || !1;
1893
1913
  }
1894
1914
  }
1895
- class F {
1915
+ class A {
1896
1916
  constructor(t, e = {}) {
1897
1917
  this.currentFocusedDate = null, this.isActive = !1, this.container = t, this.options = {
1898
1918
  enabled: !1,
@@ -2135,7 +2155,7 @@ const P = {
2135
2155
  ],
2136
2156
  firstDay: 1
2137
2157
  };
2138
- class N {
2158
+ class R {
2139
2159
  constructor(t, e = {}, a) {
2140
2160
  this.element = this.resolveElement(t), this.options = this.mergeWithDefaults(e), this.locale = this.options.locale, this.callback = a || (() => {
2141
2161
  }), this.eventService = new T(), this.initializeState(), this.initializeServices(), this.addDropdownArrow(), this.createContainer(), this.setupEventListeners(), this.updateElement(), this.calculateChosenLabel();
@@ -2178,7 +2198,8 @@ class N {
2178
2198
  cancelButtonClasses: t.cancelButtonClasses || "datex-btn-danger",
2179
2199
  theme: t.theme || M,
2180
2200
  validation: t.validation || {},
2181
- events: t.events || {}
2201
+ events: t.events || {},
2202
+ zIndex: t.zIndex ?? "auto"
2182
2203
  };
2183
2204
  return a.timePicker && a.autoApply && (a.autoApply = !1), a;
2184
2205
  }
@@ -2249,7 +2270,7 @@ class N {
2249
2270
  this.element,
2250
2271
  this.container,
2251
2272
  this.options
2252
- ), this.validationService = new A(this.options.validation), this.keyboardService = new F(this.container, {
2273
+ ), this.validationService = new F(this.options.validation), this.keyboardService = new A(this.container, {
2253
2274
  enabled: !1
2254
2275
  // Deshabilitado por defecto para evitar conflictos
2255
2276
  }), this.keyboardService.setHandlers({
@@ -2884,7 +2905,7 @@ class N {
2884
2905
  export {
2885
2906
  z as BOOTSTRAP_THEME,
2886
2907
  M as DEFAULT_THEME,
2887
- N as Datex,
2908
+ R as Datex,
2888
2909
  Y as MATERIAL_THEME,
2889
2910
  P as SPANISH_LOCALE,
2890
2911
  O as SPANISH_LOCALE_WITH_TIME,
@@ -71,6 +71,7 @@ export interface DatexOptions {
71
71
  theme?: DatexTheme;
72
72
  validation?: DatexValidation;
73
73
  events?: DatexEvents;
74
+ zIndex?: number | "auto";
74
75
  }
75
76
  export type DatexCallback = (startDate: Date, endDate: Date, label?: string) => void;
76
77
  export interface CalendarState {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "datex-ui",
3
3
  "access": "public",
4
- "version": "1.2.2",
4
+ "version": "1.2.5",
5
5
  "type": "module",
6
6
  "description": "A modern, lightweight, and customizable date range picker for TypeScript/JavaScript applications",
7
7
  "main": "dist/index.esm.js",