@editora/ui-core 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +95 -5
  2. package/dist/alert-dialog.cjs.js +18 -18
  3. package/dist/alert-dialog.esm.js +130 -117
  4. package/dist/app-header.cjs.js +22 -2
  5. package/dist/app-header.esm.js +22 -2
  6. package/dist/badge.cjs.js +5 -5
  7. package/dist/badge.esm.js +9 -8
  8. package/dist/color-picker.cjs.js +4 -4
  9. package/dist/color-picker.esm.js +40 -31
  10. package/dist/combobox.cjs.js +21 -21
  11. package/dist/combobox.esm.js +79 -40
  12. package/dist/command-palette.cjs.js +1 -1
  13. package/dist/command-palette.esm.js +2 -2
  14. package/dist/components/date-time-utils.d.ts +2 -1
  15. package/dist/components/date-time-utils.d.ts.map +1 -1
  16. package/dist/components/ui-alert-dialog.d.ts +2 -0
  17. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  18. package/dist/components/ui-app-header.d.ts.map +1 -1
  19. package/dist/components/ui-badge.d.ts.map +1 -1
  20. package/dist/components/ui-color-picker.d.ts.map +1 -1
  21. package/dist/components/ui-combobox.d.ts +4 -1
  22. package/dist/components/ui-combobox.d.ts.map +1 -1
  23. package/dist/components/ui-context-menu.d.ts +6 -0
  24. package/dist/components/ui-context-menu.d.ts.map +1 -1
  25. package/dist/components/ui-date-picker.d.ts +3 -0
  26. package/dist/components/ui-date-picker.d.ts.map +1 -1
  27. package/dist/components/ui-date-range-picker.d.ts +3 -0
  28. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  29. package/dist/components/ui-date-range-time-picker.d.ts +3 -0
  30. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  31. package/dist/components/ui-date-time-picker.d.ts +3 -0
  32. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  33. package/dist/components/ui-dialog.d.ts +3 -0
  34. package/dist/components/ui-dialog.d.ts.map +1 -1
  35. package/dist/components/ui-drawer.d.ts +14 -0
  36. package/dist/components/ui-drawer.d.ts.map +1 -1
  37. package/dist/components/ui-floating-toolbar.d.ts +3 -0
  38. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  39. package/dist/components/ui-gantt.d.ts +30 -1
  40. package/dist/components/ui-gantt.d.ts.map +1 -1
  41. package/dist/components/ui-hover-card.d.ts +3 -0
  42. package/dist/components/ui-hover-card.d.ts.map +1 -1
  43. package/dist/components/ui-menu.d.ts +1 -0
  44. package/dist/components/ui-menu.d.ts.map +1 -1
  45. package/dist/components/ui-menubar.d.ts +1 -0
  46. package/dist/components/ui-menubar.d.ts.map +1 -1
  47. package/dist/components/ui-positioner.d.ts.map +1 -1
  48. package/dist/components/ui-quick-actions.d.ts.map +1 -1
  49. package/dist/components/ui-radio.d.ts +47 -0
  50. package/dist/components/ui-radio.d.ts.map +1 -0
  51. package/dist/components/ui-select.d.ts +8 -0
  52. package/dist/components/ui-select.d.ts.map +1 -1
  53. package/dist/components/ui-selection-popup.d.ts.map +1 -1
  54. package/dist/components/ui-stepper.d.ts.map +1 -1
  55. package/dist/components/ui-time-picker.d.ts +3 -0
  56. package/dist/components/ui-time-picker.d.ts.map +1 -1
  57. package/dist/context-menu.cjs.js +12 -12
  58. package/dist/context-menu.esm.js +160 -133
  59. package/dist/date-field.cjs.js +1 -1
  60. package/dist/date-field.esm.js +3 -2
  61. package/dist/date-picker.cjs.js +13 -13
  62. package/dist/date-picker.esm.js +101 -67
  63. package/dist/date-range-picker.cjs.js +14 -14
  64. package/dist/date-range-picker.esm.js +99 -65
  65. package/dist/date-range-time-picker.cjs.js +13 -13
  66. package/dist/date-range-time-picker.esm.js +77 -45
  67. package/dist/date-time-picker.cjs.js +13 -13
  68. package/dist/date-time-picker.esm.js +133 -101
  69. package/dist/date-time-utils-66480de4.js +1 -0
  70. package/dist/date-time-utils-a2c7af25.mjs +307 -0
  71. package/dist/dialog.cjs.js +29 -20
  72. package/dist/dialog.esm.js +90 -70
  73. package/dist/drawer.cjs.js +16 -16
  74. package/dist/drawer.esm.js +216 -98
  75. package/dist/floating-toolbar.cjs.js +6 -16
  76. package/dist/floating-toolbar.esm.js +57 -40
  77. package/dist/gantt.cjs.js +656 -74
  78. package/dist/gantt.esm.js +1050 -100
  79. package/dist/hover-card.cjs.js +4 -4
  80. package/dist/hover-card.esm.js +62 -39
  81. package/dist/index.cjs.js +1 -1
  82. package/dist/index.d.ts +2 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.esm.js +300 -286
  85. package/dist/menu.cjs.js +2 -2
  86. package/dist/menu.esm.js +118 -110
  87. package/dist/menubar.cjs.js +5 -5
  88. package/dist/menubar.esm.js +83 -78
  89. package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
  90. package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
  91. package/dist/popover.cjs.js +1 -1
  92. package/dist/popover.esm.js +2 -2
  93. package/dist/portal-c69756c0.js +1 -0
  94. package/dist/portal-fe73e5cc.mjs +123 -0
  95. package/dist/portal.d.ts +29 -3
  96. package/dist/portal.d.ts.map +1 -1
  97. package/dist/positioner-33529bb8.js +1 -0
  98. package/dist/positioner-e9770c66.mjs +582 -0
  99. package/dist/positioner.cjs.js +2 -2
  100. package/dist/positioner.esm.js +36 -26
  101. package/dist/primitives/positioner.d.ts +199 -1
  102. package/dist/primitives/positioner.d.ts.map +1 -1
  103. package/dist/quick-actions.cjs.js +10 -4
  104. package/dist/quick-actions.esm.js +27 -21
  105. package/dist/radio.cjs.js +259 -0
  106. package/dist/radio.esm.js +455 -0
  107. package/dist/{runtime-4ac0107b.mjs → runtime-161f68a2.mjs} +24 -23
  108. package/dist/runtime-3f13807b.js +1 -0
  109. package/dist/runtime.cjs.js +1 -1
  110. package/dist/runtime.d.ts +2 -0
  111. package/dist/runtime.d.ts.map +1 -1
  112. package/dist/runtime.esm.js +39 -24
  113. package/dist/scroll-lock-31da444f.mjs +56 -0
  114. package/dist/scroll-lock-d7b0df21.js +1 -0
  115. package/dist/scroll-lock.d.ts.map +1 -1
  116. package/dist/select.cjs.js +14 -15
  117. package/dist/select.esm.js +117 -97
  118. package/dist/selection-popup.cjs.js +4 -7
  119. package/dist/selection-popup.esm.js +8 -11
  120. package/dist/split-button.cjs.js +1 -1
  121. package/dist/split-button.esm.js +2 -2
  122. package/dist/standalone/radio.d.ts +2 -0
  123. package/dist/standalone/radio.d.ts.map +1 -0
  124. package/dist/stepper.cjs.js +19 -50
  125. package/dist/stepper.esm.js +17 -48
  126. package/dist/time-field.cjs.js +1 -1
  127. package/dist/time-field.esm.js +3 -2
  128. package/dist/time-picker.cjs.js +15 -15
  129. package/dist/time-picker.esm.js +100 -68
  130. package/dist/tooltip.cjs.js +1 -1
  131. package/dist/tooltip.esm.js +2 -1
  132. package/package.json +1 -1
  133. package/dist/date-time-utils-5cf58cd0.js +0 -1
  134. package/dist/date-time-utils-bdceb7af.mjs +0 -273
  135. package/dist/portal-1cf392ca.mjs +0 -114
  136. package/dist/portal-d8d7fbca.js +0 -1
  137. package/dist/positioner-accc6e5f.js +0 -1
  138. package/dist/positioner-fbd61bf1.mjs +0 -132
  139. package/dist/runtime-5f282bc8.js +0 -1
  140. package/dist/scroll-lock-48793569.js +0 -1
  141. package/dist/scroll-lock-9de6d328.mjs +0 -53
@@ -1,20 +1,22 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { r as E } from "./calendar-2c11b824.mjs";
3
- import { r as k, i as m, s as w, o as b, t as S, v as f, l as C, c as B } from "./date-time-utils-bdceb7af.mjs";
4
- import "./scroll-lock-9de6d328.mjs";
5
- const O = `
2
+ import { c as E } from "./dismissable-layer-9c7e6b58.mjs";
3
+ import { r as k } from "./calendar-2c11b824.mjs";
4
+ import { r as w, e as S, i as m, s as C, q as b, t as B, w as v, l as O, c as I } from "./date-time-utils-a2c7af25.mjs";
5
+ import "./scroll-lock-31da444f.mjs";
6
+ import "./positioner-e9770c66.mjs";
7
+ const A = `
6
8
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
7
9
  <path d="M10 2.4a7.6 7.6 0 1 1 0 15.2A7.6 7.6 0 0 1 10 2.4Zm0 1.4a6.2 6.2 0 1 0 0 12.4 6.2 6.2 0 0 0 0-12.4Zm.7 2.4a.7.7 0 0 0-1.4 0v4.1c0 .2.1.4.2.5l2.6 2.5a.7.7 0 1 0 1-1l-2.4-2.3v-3.8Z" fill="currentColor"/>
8
10
  </svg>
9
- `, I = `
11
+ `, D = `
10
12
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
11
13
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
12
14
  </svg>
13
- `, A = `
15
+ `, $ = `
14
16
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
15
17
  <path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
16
18
  </svg>
17
- `, D = `
19
+ `, M = `
18
20
  :host {
19
21
  --ui-dp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
20
22
  --ui-dp-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 72%, transparent);
@@ -143,7 +145,7 @@ const O = `
143
145
  outline-color: Highlight;
144
146
  }
145
147
  }
146
- `, $ = `
148
+ `, z = `
147
149
  .overlay { position: fixed; z-index: var(--ui-dp-z, 1600); pointer-events: none; }
148
150
  .panel {
149
151
  pointer-events: auto;
@@ -254,12 +256,14 @@ function h(p) {
254
256
  return String(p).padStart(2, "0");
255
257
  }
256
258
  function _(p, t, e, i) {
257
- const n = h(p), s = h(t);
258
- return i ? `${n}:${s}:${h(e)}` : `${n}:${s}`;
259
+ const s = h(p), n = h(t);
260
+ return i ? `${s}:${n}:${h(e)}` : `${s}:${n}`;
259
261
  }
260
- class M extends x {
262
+ class L extends x {
261
263
  constructor() {
262
- super(...arguments), this._value = null, this._pending = null, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._fieldEl = null, this._labelEl = null, this._labelTextEl = null, this._requiredEl = null, this._inputEl = null, this._clearBtn = null, this._toggleBtn = null, this._hintEl = null, this._errorEl = null, this._hiddenInputEl = null, this._schedulePosition = k(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = () => this._schedulePosition.run();
264
+ super(...arguments), this._value = null, this._pending = null, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._dismissableLayer = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._fieldEl = null, this._labelEl = null, this._labelTextEl = null, this._requiredEl = null, this._inputEl = null, this._clearBtn = null, this._toggleBtn = null, this._hintEl = null, this._errorEl = null, this._hiddenInputEl = null, this._schedulePosition = w(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = (t) => {
265
+ S(t, [this._overlay]) || this._schedulePosition.run();
266
+ };
263
267
  }
264
268
  static get observedAttributes() {
265
269
  return [
@@ -311,7 +315,7 @@ class M extends x {
311
315
  return (this.getAttribute("mode") || "popover") === "inline";
312
316
  }
313
317
  _isMobileSheet() {
314
- return w(this.getAttribute("mode"));
318
+ return C(this.getAttribute("mode"));
315
319
  }
316
320
  _isDisabled() {
317
321
  return this.hasAttribute("disabled");
@@ -340,7 +344,7 @@ class M extends x {
340
344
  return !Number.isFinite(t) || t < 1 ? 1 : Math.min(60, Math.trunc(t));
341
345
  }
342
346
  _translations() {
343
- return E(
347
+ return k(
344
348
  this.getAttribute("locale"),
345
349
  this.getAttribute("translations")
346
350
  );
@@ -358,7 +362,7 @@ class M extends x {
358
362
  return this._normalizeCanonical(this.getAttribute("max"));
359
363
  }
360
364
  _formatDisplay(t) {
361
- return t ? this._is12h() ? S(t, this.getAttribute("locale") || "en-US") : t : "";
365
+ return t ? this._is12h() ? B(t, this.getAttribute("locale") || "en-US") : t : "";
362
366
  }
363
367
  _syncOpenAttribute(t) {
364
368
  this._syncing = !0;
@@ -391,8 +395,8 @@ class M extends x {
391
395
  if (!t)
392
396
  return null;
393
397
  const e = this._minTime(), i = this._maxTime();
394
- let n = t;
395
- return e && f(n, e) < 0 && (n = e), i && f(n, i) > 0 && (n = i), n;
398
+ let s = t;
399
+ return e && v(s, e) < 0 && (s = e), i && v(s, i) > 0 && (s = i), s;
396
400
  }
397
401
  _commit(t, e) {
398
402
  if (this._isDisabled() || this._isReadonly())
@@ -424,10 +428,31 @@ class M extends x {
424
428
  if (this._overlay || typeof document > "u")
425
429
  return;
426
430
  const t = document.createElement("div");
427
- t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.zIndex = "1100", t.style.pointerEvents = "none", t.addEventListener("click", this._onOverlayClickBound), t.addEventListener("change", this._onOverlayChangeBound), document.body.appendChild(t), this._overlay = t, document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound), window.addEventListener("resize", this._onWindowResizeBound), window.addEventListener("scroll", this._onWindowScrollBound, !0), this._isMobileSheet() && (this._releaseScrollLock = C());
431
+ t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.pointerEvents = "none", t.addEventListener("click", this._onOverlayClickBound), t.addEventListener("change", this._onOverlayChangeBound), document.body.appendChild(t), this._overlay = t, this._syncOverlayHostZIndex(), document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound), window.addEventListener("resize", this._onWindowResizeBound), window.addEventListener("scroll", this._onWindowScrollBound, { passive: !0, capture: !0 }), this._isMobileSheet() && (this._releaseScrollLock = O());
432
+ }
433
+ _syncOverlayHostZIndex() {
434
+ if (!this._overlay || typeof window > "u")
435
+ return;
436
+ const t = window.getComputedStyle(this).getPropertyValue("--ui-dp-z").trim();
437
+ this._overlay.style.zIndex = t || "1600";
428
438
  }
429
439
  _destroyOverlay() {
430
- this._overlay && (this._schedulePosition.cancel(), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound), window.removeEventListener("resize", this._onWindowResizeBound), window.removeEventListener("scroll", this._onWindowScrollBound, !0), this._overlay.removeEventListener("click", this._onOverlayClickBound), this._overlay.removeEventListener("change", this._onOverlayChangeBound), this._overlay.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
440
+ var t;
441
+ (t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, this._overlay && (this._schedulePosition.cancel(), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound), window.removeEventListener("resize", this._onWindowResizeBound), window.removeEventListener("scroll", this._onWindowScrollBound, !0), this._overlay.removeEventListener("click", this._onOverlayClickBound), this._overlay.removeEventListener("change", this._onOverlayChangeBound), this._overlay.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
442
+ }
443
+ _syncDismissableLayer() {
444
+ var e;
445
+ if ((e = this._dismissableLayer) == null || e.destroy(), this._dismissableLayer = null, !this._open || !this._overlay)
446
+ return;
447
+ const t = this._overlay.querySelector(".panel, .sheet");
448
+ t && (this._dismissableLayer = E({
449
+ node: t,
450
+ trigger: this._fieldEl,
451
+ closeOnEscape: !0,
452
+ closeOnPointerOutside: !0,
453
+ closeOnFocusOutside: !1,
454
+ onBeforeDismiss: (i) => i === "escape-key" ? (this._setOpen(!1, "escape"), !1) : (i === "outside-pointer" && this._setOpen(!1, "outside"), !1)
455
+ }));
431
456
  }
432
457
  _positionOverlay() {
433
458
  if (!this._overlay || !this._open || this._isMobileSheet())
@@ -435,8 +460,14 @@ class M extends x {
435
460
  const t = this._fieldEl, e = this._overlay.querySelector(".panel");
436
461
  if (!t || !e)
437
462
  return;
438
- const i = B(t.getBoundingClientRect(), e.getBoundingClientRect());
439
- e.style.position = "absolute", e.style.top = `${Math.round(i.top)}px`, e.style.left = `${Math.round(i.left)}px`;
463
+ const i = e.getAttribute("data-placement"), s = I(
464
+ t.getBoundingClientRect(),
465
+ e.getBoundingClientRect(),
466
+ 8,
467
+ 8,
468
+ i === "top" ? "top" : i === "bottom" ? "bottom" : null
469
+ );
470
+ e.style.position = "absolute", e.style.top = `${Math.round(s.top)}px`, e.style.left = `${Math.round(s.left)}px`, e.setAttribute("data-placement", s.placement);
440
471
  }
441
472
  _timeParts(t) {
442
473
  const e = b(t || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = e.hours >= 12 ? "pm" : "am";
@@ -448,25 +479,25 @@ class M extends x {
448
479
  };
449
480
  }
450
481
  _buildOverlayContent(t) {
451
- const e = this._translations(), i = this._timeParts(this._pending), n = this._is12h(), s = this._withSeconds(), o = n ? i.hours % 12 || 12 : i.hours, r = this._minuteStep(), l = this._secondStep(), a = Array.from({ length: n ? 12 : 24 }, (v, c) => {
452
- const u = n ? c + 1 : c;
453
- return `<option value="${u}" ${u === o ? "selected" : ""}>${h(u)}</option>`;
454
- }).join(""), d = Array.from({ length: Math.ceil(60 / r) }, (v, c) => {
455
- const u = Math.min(59, c * r);
482
+ const e = this._translations(), i = this._timeParts(this._pending), s = this._is12h(), n = this._withSeconds(), r = s ? i.hours % 12 || 12 : i.hours, o = this._minuteStep(), l = this._secondStep(), a = Array.from({ length: s ? 12 : 24 }, (f, c) => {
483
+ const u = s ? c + 1 : c;
484
+ return `<option value="${u}" ${u === r ? "selected" : ""}>${h(u)}</option>`;
485
+ }).join(""), d = Array.from({ length: Math.ceil(60 / o) }, (f, c) => {
486
+ const u = Math.min(59, c * o);
456
487
  return `<option value="${u}" ${u === i.minutes ? "selected" : ""}>${h(u)}</option>`;
457
- }).join(""), y = Array.from({ length: Math.ceil(60 / l) }, (v, c) => {
488
+ }).join(""), y = Array.from({ length: Math.ceil(60 / l) }, (f, c) => {
458
489
  const u = Math.min(59, c * l);
459
490
  return `<option value="${u}" ${u === i.seconds ? "selected" : ""}>${h(u)}</option>`;
460
491
  }).join(""), g = `
461
- <div class="pickers" data-seconds="${s ? "true" : "false"}" data-ampm="${n ? "true" : "false"}">
492
+ <div class="pickers" data-seconds="${n ? "true" : "false"}" data-ampm="${s ? "true" : "false"}">
462
493
  <div class="picker"><label>${e.hour}</label><select data-segment="hours">${a}</select></div>
463
494
  <div class="picker"><label>${e.minute}</label><select data-segment="minutes">${d}</select></div>
464
- ${s ? `<div class="picker"><label>${e.second}</label><select data-segment="seconds">${y}</select></div>` : ""}
465
- ${n ? `<div class="picker"><label>${e.meridiem}</label><select data-segment="meridiem"><option value="am" ${i.meridiem === "am" ? "selected" : ""}>${e.am}</option><option value="pm" ${i.meridiem === "pm" ? "selected" : ""}>${e.pm}</option></select></div>` : ""}
495
+ ${n ? `<div class="picker"><label>${e.second}</label><select data-segment="seconds">${y}</select></div>` : ""}
496
+ ${s ? `<div class="picker"><label>${e.meridiem}</label><select data-segment="meridiem"><option value="am" ${i.meridiem === "am" ? "selected" : ""}>${e.am}</option><option value="pm" ${i.meridiem === "pm" ? "selected" : ""}>${e.pm}</option></select></div>` : ""}
466
497
  </div>
467
498
  `;
468
499
  return `
469
- <style>${$}</style>
500
+ <style>${z}</style>
470
501
  ${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
471
502
  <section class="${t ? "sheet" : "panel"}" part="${t ? "sheet" : "popover"}">
472
503
  ${g}
@@ -496,29 +527,30 @@ class M extends x {
496
527
  this._overlayKey !== e && (this._overlayKey = e, this._overlay.innerHTML = t ? `<div class="sheet-wrap">${this._buildOverlayContent(!0)}</div>` : `<div class="overlay">${this._buildOverlayContent(!1)}</div>`);
497
528
  }
498
529
  _setClosestOptionValue(t, e) {
499
- const i = Array.from(t.options).map((o) => Number(o.value)).filter((o) => Number.isFinite(o));
530
+ const i = Array.from(t.options).map((r) => Number(r.value)).filter((r) => Number.isFinite(r));
500
531
  if (!i.length)
501
532
  return;
502
- let n = i[0], s = Math.abs(n - e);
503
- for (let o = 1; o < i.length; o += 1) {
504
- const r = i[o], l = Math.abs(r - e);
505
- l < s && (n = r, s = l);
533
+ let s = i[0], n = Math.abs(s - e);
534
+ for (let r = 1; r < i.length; r += 1) {
535
+ const o = i[r], l = Math.abs(o - e);
536
+ l < n && (s = o, n = l);
506
537
  }
507
- t.value = String(n);
538
+ t.value = String(s);
508
539
  }
509
540
  _syncOverlayState() {
510
541
  if (!this._overlay)
511
542
  return;
543
+ this._syncOverlayHostZIndex();
512
544
  const t = this._isMobileSheet();
513
- this._ensureOverlayContent(t);
514
- const e = this._timeParts(this._pending), i = this._overlay.querySelector('select[data-segment="hours"]'), n = this._overlay.querySelector('select[data-segment="minutes"]'), s = this._overlay.querySelector('select[data-segment="seconds"]'), o = this._overlay.querySelector('select[data-segment="meridiem"]'), r = this._isDisabled() || this._isReadonly();
545
+ this._ensureOverlayContent(t), this._syncDismissableLayer();
546
+ const e = this._timeParts(this._pending), i = this._overlay.querySelector('select[data-segment="hours"]'), s = this._overlay.querySelector('select[data-segment="minutes"]'), n = this._overlay.querySelector('select[data-segment="seconds"]'), r = this._overlay.querySelector('select[data-segment="meridiem"]'), o = this._isDisabled() || this._isReadonly();
515
547
  if (this._overlay.querySelectorAll(".action").forEach((a) => {
516
- a.disabled = r;
548
+ a.disabled = o;
517
549
  }), i) {
518
550
  const a = this._is12h() ? e.hours % 12 || 12 : e.hours;
519
- this._setClosestOptionValue(i, a), i.disabled = r;
551
+ this._setClosestOptionValue(i, a), i.disabled = o;
520
552
  }
521
- n && (this._setClosestOptionValue(n, e.minutes), n.disabled = r), s && (this._setClosestOptionValue(s, e.seconds), s.disabled = r), o && (o.value = e.meridiem, o.disabled = r), t || this._schedulePosition.run();
553
+ s && (this._setClosestOptionValue(s, e.minutes), s.disabled = o), n && (this._setClosestOptionValue(n, e.seconds), n.disabled = o), r && (r.value = e.meridiem, r.disabled = o), t || this._schedulePosition.run();
522
554
  }
523
555
  _renderOverlay() {
524
556
  this._syncOverlayState();
@@ -526,24 +558,24 @@ class M extends x {
526
558
  _applySegmentsFromOverlay() {
527
559
  if (!this._overlay)
528
560
  return;
529
- const t = this._overlay.querySelector('select[data-segment="hours"]'), e = this._overlay.querySelector('select[data-segment="minutes"]'), i = this._overlay.querySelector('select[data-segment="seconds"]'), n = this._overlay.querySelector('select[data-segment="meridiem"]');
561
+ const t = this._overlay.querySelector('select[data-segment="hours"]'), e = this._overlay.querySelector('select[data-segment="minutes"]'), i = this._overlay.querySelector('select[data-segment="seconds"]'), s = this._overlay.querySelector('select[data-segment="meridiem"]');
530
562
  if (!t || !e)
531
563
  return;
532
- let s = Number(t.value);
533
- const o = Number(e.value), r = i ? Number(i.value) : 0;
534
- if (this._is12h() && n) {
535
- const a = n.value === "pm" ? "pm" : "am";
536
- a === "pm" && s < 12 && (s += 12), a === "am" && s === 12 && (s = 0);
564
+ let n = Number(t.value);
565
+ const r = Number(e.value), o = i ? Number(i.value) : 0;
566
+ if (this._is12h() && s) {
567
+ const a = s.value === "pm" ? "pm" : "am";
568
+ a === "pm" && n < 12 && (n += 12), a === "am" && n === 12 && (n = 0);
537
569
  }
538
- const l = _(s, o, r, this._withSeconds());
570
+ const l = _(n, r, o, this._withSeconds());
539
571
  this._pending = this._clampToBounds(l), this._emitInput("picker");
540
572
  }
541
573
  _onRootClick(t) {
542
- var n;
574
+ var s;
543
575
  const e = t.target;
544
576
  if (!e)
545
577
  return;
546
- const i = (n = e.closest("[data-action]")) == null ? void 0 : n.getAttribute("data-action");
578
+ const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
547
579
  if (i) {
548
580
  if (i === "toggle") {
549
581
  this._restoreFocusEl = e, this._setOpen(!this._open, "toggle");
@@ -576,8 +608,8 @@ class M extends x {
576
608
  this._commit(i, "blur");
577
609
  }
578
610
  _stepBy(t) {
579
- const e = b(this._pending || this._value || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = this._minuteStep() * t, n = ((e.hours * 60 + e.minutes + i) % (24 * 60) + 24 * 60) % (24 * 60), s = Math.floor(n / 60), o = n % 60, r = _(s, o, e.seconds, this._withSeconds());
580
- this._pending = this._clampToBounds(r), this._emitInput("keyboard-step"), this._updateHostState();
611
+ const e = b(this._pending || this._value || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = this._minuteStep() * t, s = ((e.hours * 60 + e.minutes + i) % (24 * 60) + 24 * 60) % (24 * 60), n = Math.floor(s / 60), r = s % 60, o = _(n, r, e.seconds, this._withSeconds());
612
+ this._pending = this._clampToBounds(o), this._emitInput("keyboard-step"), this._updateHostState();
581
613
  }
582
614
  _onRootKeyDown(t) {
583
615
  const e = t, i = e.target;
@@ -592,12 +624,12 @@ class M extends x {
592
624
  }
593
625
  if (e.key === "Enter") {
594
626
  e.preventDefault();
595
- const n = this._normalizeCanonical(this._draft);
596
- if (!n && this._draft.trim()) {
627
+ const s = this._normalizeCanonical(this._draft);
628
+ if (!s && this._draft.trim()) {
597
629
  this._inlineError = this.getAttribute("error") || this._translations().invalidTime, this._emitInvalid(this._draft, "parse"), this._updateHostState();
598
630
  return;
599
631
  }
600
- this._commit(n, "enter"), this._isInlineMode() || this._setOpen(!1, "enter");
632
+ this._commit(s, "enter"), this._isInlineMode() || this._setOpen(!1, "enter");
601
633
  return;
602
634
  }
603
635
  if (e.key === "Escape" && this._open && !this._isInlineMode()) {
@@ -608,11 +640,11 @@ class M extends x {
608
640
  }
609
641
  }
610
642
  _onOverlayClick(t) {
611
- var n;
643
+ var s;
612
644
  const e = t.target;
613
645
  if (!e)
614
646
  return;
615
- const i = (n = e.closest("[data-action]")) == null ? void 0 : n.getAttribute("data-action");
647
+ const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
616
648
  if (i) {
617
649
  if (i === "backdrop") {
618
650
  this._setOpen(!1, "outside");
@@ -627,8 +659,8 @@ class M extends x {
627
659
  return;
628
660
  }
629
661
  if (i === "now") {
630
- const s = /* @__PURE__ */ new Date(), o = _(s.getHours(), s.getMinutes(), s.getSeconds(), this._withSeconds());
631
- this._pending = this._clampToBounds(o), this._emitInput("now"), this._renderOverlay();
662
+ const n = /* @__PURE__ */ new Date(), r = _(n.getHours(), n.getMinutes(), n.getSeconds(), this._withSeconds());
663
+ this._pending = this._clampToBounds(r), this._emitInput("now"), this._renderOverlay();
632
664
  return;
633
665
  }
634
666
  i === "apply" && (this._commit(this._pending, "apply"), this._setOpen(!1, "apply"));
@@ -653,22 +685,22 @@ class M extends x {
653
685
  _updateHostState() {
654
686
  if (!this._hasView)
655
687
  return;
656
- const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", n = this._inlineError || i, s = !!this._value, o = this.getAttribute("name") || "", r = this._allowInput() ? this._draft : this._formatDisplay(this._value), l = this._isInlineMode(), a = this._isDisabled(), d = this._translations();
657
- this._labelEl && (this._labelEl.hidden = !t), this._labelTextEl && (this._labelTextEl.textContent = t), this._requiredEl && (this._requiredEl.hidden = !this.hasAttribute("required")), this._inputEl && (this._inputEl.value !== r && (this._inputEl.value = r), this._inputEl.placeholder = this._withSeconds() ? d.timePlaceholderSeconds : d.timePlaceholder, this._inputEl.readOnly = !this._allowInput() || this._isReadonly(), this._inputEl.disabled = a, this._inputEl.required = this.hasAttribute("required")), this._clearBtn && (this._clearBtn.hidden = !(this._clearable() && s), this._clearBtn.disabled = a || this._isReadonly(), this._clearBtn.setAttribute("aria-label", d.clear)), this._toggleBtn && (this._toggleBtn.hidden = l, this._toggleBtn.disabled = a || this._isReadonly(), this._toggleBtn.setAttribute("aria-label", d.toggleCalendar)), this._hintEl && (this._hintEl.hidden = !e, this._hintEl.textContent = e), this._errorEl && (this._errorEl.hidden = !n, this._errorEl.textContent = n), this._hiddenInputEl && (this._hiddenInputEl.disabled = !o, this._hiddenInputEl.name = o, this._hiddenInputEl.value = this._value || ""), !l && this._open && this._syncOverlayState();
688
+ const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", s = this._inlineError || i, n = !!this._value, r = this.getAttribute("name") || "", o = this._allowInput() ? this._draft : this._formatDisplay(this._value), l = this._isInlineMode(), a = this._isDisabled(), d = this._translations();
689
+ this._labelEl && (this._labelEl.hidden = !t), this._labelTextEl && (this._labelTextEl.textContent = t), this._requiredEl && (this._requiredEl.hidden = !this.hasAttribute("required")), this._inputEl && (this._inputEl.value !== o && (this._inputEl.value = o), this._inputEl.placeholder = this._withSeconds() ? d.timePlaceholderSeconds : d.timePlaceholder, this._inputEl.readOnly = !this._allowInput() || this._isReadonly(), this._inputEl.disabled = a, this._inputEl.required = this.hasAttribute("required")), this._clearBtn && (this._clearBtn.hidden = !(this._clearable() && n), this._clearBtn.disabled = a || this._isReadonly(), this._clearBtn.setAttribute("aria-label", d.clear)), this._toggleBtn && (this._toggleBtn.hidden = l, this._toggleBtn.disabled = a || this._isReadonly(), this._toggleBtn.setAttribute("aria-label", d.toggleCalendar)), this._hintEl && (this._hintEl.hidden = !e, this._hintEl.textContent = e), this._errorEl && (this._errorEl.hidden = !s, this._errorEl.textContent = s), this._hiddenInputEl && (this._hiddenInputEl.disabled = !r, this._hiddenInputEl.name = r, this._hiddenInputEl.value = this._value || ""), !l && this._open && this._syncOverlayState();
658
690
  }
659
691
  render() {
660
692
  this._hasView || (this.setContent(`
661
- <style>${D}</style>
693
+ <style>${M}</style>
662
694
  <div class="root">
663
695
  <label class="label" part="label">
664
696
  <span class="label-text"></span>
665
697
  <span class="required">*</span>
666
698
  </label>
667
699
  <div class="field" part="field input">
668
- <span class="icon" part="icon">${O}</span>
700
+ <span class="icon" part="icon">${A}</span>
669
701
  <input class="input" part="input" />
670
- <button type="button" class="btn" part="clear" data-action="clear">${I}</button>
671
- <button type="button" class="btn" part="toggle" data-action="toggle">${A}</button>
702
+ <button type="button" class="btn" part="clear" data-action="clear">${D}</button>
703
+ <button type="button" class="btn" part="toggle" data-action="toggle">${$}</button>
672
704
  </div>
673
705
  <div class="hint" part="hint"></div>
674
706
  <div class="error" part="error" role="alert"></div>
@@ -680,7 +712,7 @@ class M extends x {
680
712
  return !1;
681
713
  }
682
714
  }
683
- typeof customElements < "u" && !customElements.get("ui-time-picker") && customElements.define("ui-time-picker", M);
715
+ typeof customElements < "u" && !customElements.get("ui-time-picker") && customElements.define("ui-time-picker", L);
684
716
  export {
685
- M as UITimePicker
717
+ L as UITimePicker
686
718
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-1b301e7f.js"),w=require("./portal-d8d7fbca.js"),d=140,y=120,m=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-1b301e7f.js"),w=require("./portal-c69756c0.js");require("./positioner-33529bb8.js");const d=140,y=120,m=`
2
2
  .tooltip {
3
3
  color-scheme: light dark;
4
4
  --ui-tooltip-bg: color-mix(in srgb, var(--ui-color-text, #0f172a) 92%, #0b1220 8%);
@@ -1,5 +1,6 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { s as E } from "./portal-1cf392ca.mjs";
2
+ import { s as E } from "./portal-fe73e5cc.mjs";
3
+ import "./positioner-e9770c66.mjs";
3
4
  const d = 140, w = 120, m = `
4
5
  .tooltip {
5
6
  color-scheme: light dark;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/ui-core",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Framework-agnostic Web Components and primitives for the Editora UI ecosystem",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1 +0,0 @@
1
- "use strict";const c=require("./calendar-a8735e40.js"),C=require("./scroll-lock-48793569.js"),$=new Map;function h(t,e,n){return Math.max(e,Math.min(n,t))}function s(t){return String(t).padStart(2,"0")}function M(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function I(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function v(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function L(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function N(t,e=!1){if(t==null)return e;const n=t.trim().toLowerCase();return n?n!=="false"&&n!=="0"&&n!=="off"&&n!=="no":!0}function O(t){const e=(t||"").trim();return e||(typeof navigator<"u"&&navigator.language?navigator.language:"en-US")}function f(t){if(!t)return null;const e=c.parseISO(t);return e?`${e.y}-${s(e.m)}-${s(e.d)}`:null}function D(t){if(!t)return null;const e=/^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());if(!e)return null;const n=f(e[1]);if(!n)return null;const r=m(e[2],!0);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:w(r,o)}}function U(t,e){if(!t||!e)return null;const n=f(t),r=m(e,!0);return!n||!r?null:`${n}T${w(r,e.split(":").length>=3)}`}function F(t){if(!t)return null;const e=f(t);if(e)return e;const n=D(t);return(n==null?void 0:n.date)||null}function z(t){if(!t)return null;const e=D(t);if(e)return e;const n=f(t);return n?{date:n,time:"00:00"}:null}function B(t,e,n){const r=c.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify(n||{})}`;let i=$.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC",...n||{}}),$.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function Y(t,e,n,r){if(!t)return"";if(n==="iso")return t;if(n==="custom"&&r){const o=c.parseISO(t);if(!o)return t;const i=v(e),u=L(e);return r.replace(/YYYY/g,String(o.y)).replace(/MMM/g,i[o.m-1]||"").replace(/MMMM/g,u[o.m-1]||"").replace(/MM/g,s(o.m)).replace(/DD/g,s(o.d))}return B(t,e)}function k(t,e){const n=f(t.trim());if(n)return n;const r=I(t);if(!r)return null;const o=f(r);if(o)return o;const i=r.split("/").map(b=>b.trim()).filter(Boolean);if(i.length!==3)return null;const u=M(i[0]),a=M(i[1]),y=M(i[2]);if(u==null||a==null||y==null)return null;let l=y;l<100&&(l+=l>=70?1900:2e3);const T=e.toLowerCase().startsWith("en-us"),d=T?u:a,p=T?a:u;if(l<1e3||d<1||d>12||p<1||p>31)return null;const S=`${l}-${s(d)}-${s(p)}`;return f(S)}function m(t,e){const n=t.trim().toLowerCase();if(!n)return null;const r=/^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(n);if(!r)return null;let o=Number(r[1]);const i=Number(r[2]??"0"),u=Number(r[3]??"0");if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(u)||i<0||i>59||u<0||u>59||!e&&u!==0)return null;const a=r[4];if(a){if(o<1||o>12)return null;a==="pm"&&o<12&&(o+=12),a==="am"&&o===12&&(o=0)}return o<0||o>23?null:{hours:o,minutes:i,seconds:u}}function w(t,e=!1){if(!t)return"";const n=s(h(t.hours,0,23)),r=s(h(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=s(h(t.seconds,0,59));return`${n}:${r}:${o}`}function q(t,e){const n=m(t,!0);if(!n)return t;const r=new Date;return r.setHours(n.hours,n.minutes,n.seconds,0),new Intl.DateTimeFormat(e,{hour:"numeric",minute:"2-digit",second:t.split(":").length>2?"2-digit":void 0,hour12:!0}).format(r)}function g(t,e){const n=m(t,!0),r=m(e,!0);if(!n||!r)return t.localeCompare(e);const o=n.hours*3600+n.minutes*60+n.seconds,i=r.hours*3600+r.minutes*60+r.seconds;return o-i}function x(t,e,n){const r=m(t,!0);if(!r)return t;let o=w(r,t.split(":").length>=3);return e&&g(o,e)<0&&(o=e),n&&g(o,n)>0&&(o=n),o}function A(t,e,n){let r=t;return e&&c.compareISO(r,e)<0&&(r=e),n&&c.compareISO(r,n)>0&&(r=n),r}function P(t,e){const n=D(t),r=D(e);if(!n||!r)return t.localeCompare(e);const o=c.compareISO(n.date,r.date);return o!==0?o:g(n.time,r.time)}function H(t){const e=c.parseISO(t);if(!e)return{start:t,end:t};const n=c.startOfMonth(e.y,e.m),r=c.endOfMonth(e.y,e.m);return{start:`${n.y}-${s(n.m)}-${s(n.d)}`,end:`${r.y}-${s(r.m)}-${s(r.d)}`}}function W(t,e){const n=h(e,1,366);return{start:c.addDaysISO(t,-(n-1)),end:t}}function Z(t,e,n=8,r=8){const o=typeof window<"u"?window.innerWidth:1200,i=typeof window<"u"?window.innerHeight:800,u=typeof window<"u"&&window.scrollY||0,a=typeof window<"u"&&window.scrollX||0,l=t.bottom+r+e.height<=i-n?"bottom":"top",T=l==="bottom"?t.bottom+r+u:t.top-e.height-r+u,d=t.left+a,p=a+o-e.width-n,S=h(d,a+n,Math.max(a+n,p));return{top:T,left:S,placement:l}}function X(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function J(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function j(){return C.acquireBodyScrollLock()}exports.clampDateIso=A;exports.clampTime=x;exports.combineDateTime=U;exports.compareDateTimes=P;exports.compareTimes=g;exports.computeLastDaysRange=W;exports.computeMonthRange=H;exports.computePopoverPosition=Z;exports.formatDateForDisplay=Y;exports.formatTime=w;exports.isTruthyAttr=N;exports.lockBodyScroll=j;exports.normalizeDateIso=f;exports.normalizeLocale=O;exports.parseConstraintDate=F;exports.parseConstraintDateTime=z;exports.parseTimeInput=m;exports.parseUserDateInput=k;exports.rafThrottle=X;exports.shouldUseMobileSheet=J;exports.splitDateTime=D;exports.to12hDisplay=q;