@editora/ui-core 0.1.13 → 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.
- package/README.md +96 -6
- package/dist/color-picker.cjs.js +1 -1
- package/dist/color-picker.esm.js +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts +6 -0
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts +3 -0
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +30 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts +3 -0
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +12 -12
- package/dist/context-menu.esm.js +159 -132
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +2 -1
- package/dist/date-picker.cjs.js +1 -1
- package/dist/date-picker.esm.js +2 -1
- package/dist/date-range-picker.cjs.js +1 -1
- package/dist/date-range-picker.esm.js +2 -1
- package/dist/date-range-time-picker.cjs.js +2 -2
- package/dist/date-range-time-picker.esm.js +2 -1
- package/dist/date-time-picker.cjs.js +2 -2
- package/dist/date-time-picker.esm.js +2 -1
- package/dist/date-time-utils-66480de4.js +1 -0
- package/dist/date-time-utils-a2c7af25.mjs +307 -0
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +52 -25
- package/dist/gantt.cjs.js +656 -74
- package/dist/gantt.esm.js +1050 -100
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +61 -38
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +158 -146
- package/dist/menu.cjs.js +1 -1
- package/dist/menu.esm.js +2 -2
- package/dist/menubar.cjs.js +1 -1
- package/dist/menubar.esm.js +2 -2
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/portal-c69756c0.js +1 -0
- package/dist/portal-fe73e5cc.mjs +123 -0
- package/dist/portal.d.ts +29 -3
- package/dist/portal.d.ts.map +1 -1
- package/dist/positioner-33529bb8.js +1 -0
- package/dist/positioner-e9770c66.mjs +582 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +36 -26
- package/dist/primitives/positioner.d.ts +199 -1
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/{runtime-864efe2f.mjs → runtime-161f68a2.mjs} +24 -23
- package/dist/runtime-3f13807b.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +39 -24
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +14 -13
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +2 -1
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +2 -1
- package/package.json +2 -2
- package/dist/date-time-utils-378ecc21.js +0 -1
- package/dist/date-time-utils-a8b17ea7.mjs +0 -299
- package/dist/portal-9060f7a6.mjs +0 -114
- package/dist/portal-d9bae456.js +0 -1
- package/dist/positioner-16f3cca1.mjs +0 -132
- package/dist/positioner-43b1c75a.js +0 -1
- package/dist/runtime-668914fe.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("./ElementBase-1b301e7f.js"),J=require("./dismissable-layer-193e3bed.js"),B=require("./calendar-a8735e40.js"),s=require("./date-time-utils-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("./ElementBase-1b301e7f.js"),J=require("./dismissable-layer-193e3bed.js"),B=require("./calendar-a8735e40.js"),s=require("./date-time-utils-66480de4.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");let G=0;const Q=`
|
|
2
2
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { E as tt } from "./ElementBase-909688f3.mjs";
|
|
2
2
|
import { c as et } from "./dismissable-layer-9c7e6b58.mjs";
|
|
3
3
|
import { r as it, c as N } from "./calendar-2c11b824.mjs";
|
|
4
|
-
import { r as nt, e as rt, i as m, s as st, b as at, p as K, f as Z, a as j, l as W, c as ot, d as w, g as lt, h as dt, n as L } from "./date-time-utils-
|
|
4
|
+
import { r as nt, e as rt, i as m, s as st, b as at, p as K, f as Z, a as j, l as W, c as ot, d as w, g as lt, h as dt, n as L } from "./date-time-utils-a2c7af25.mjs";
|
|
5
5
|
import "./scroll-lock-31da444f.mjs";
|
|
6
|
+
import "./positioner-e9770c66.mjs";
|
|
6
7
|
let ut = 0;
|
|
7
8
|
const ct = `
|
|
8
9
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("./ElementBase-1b301e7f.js"),G=require("./dismissable-layer-193e3bed.js"),Q=require("./calendar-a8735e40.js"),s=require("./date-time-utils-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("./ElementBase-1b301e7f.js"),G=require("./dismissable-layer-193e3bed.js"),Q=require("./calendar-a8735e40.js"),s=require("./date-time-utils-66480de4.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");let X=0;const tt=`
|
|
2
2
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
<style>${st}</style>
|
|
549
549
|
${t?'<div class="sheet-backdrop" data-action="backdrop"></div>':""}
|
|
550
550
|
<section class="${t?"sheet":"panel"}" id="${this._panelId}" role="dialog" aria-modal="${t?"true":"false"}" aria-label="${o}" part="${t?"sheet":"popover"}">${f}</section>
|
|
551
|
-
`}_syncCalendar(t){const e=(d,h)=>{if(h==null||h===""){t.hasAttribute(d)&&t.removeAttribute(d);return}t.getAttribute(d)!==h&&t.setAttribute(d,h)},i=(d,h)=>{h?e(d,""):e(d,null)};e("selection","range"),e("value",JSON.stringify({...this._pending.startDate?{start:this._pending.startDate}:{},...this._pending.endDate?{end:this._pending.endDate}:{}}));const r=s.parseConstraintDateTime(this.getAttribute("min")),l=s.parseConstraintDateTime(this.getAttribute("max"));e("min",(r==null?void 0:r.date)||null),e("max",(l==null?void 0:l.date)||null),e("locale",this.getAttribute("locale")),e("translations",this.getAttribute("translations")),e("week-start",this.getAttribute("week-start"));const n=this.getAttribute("size")||"sm",o=t.classList.contains("drtp-calendar-inline");e("size",n==="lg"?"md":"sm"),e("variant",this.getAttribute("variant")),i("readonly",this._isReadonly()),i("disabled",this._isInteractionBlocked()),i("bare",this._isBare()),e("tabindex","-1"),n==="lg"?(t.style.setProperty("--ui-calendar-day-height","1.95em"),t.style.setProperty("--ui-calendar-day-padding-block","0.2em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.26em"),t.style.setProperty("--ui-calendar-gap","0.42em"),t.style.setProperty("--ui-calendar-day-font-size","0.78em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.7em"),t.style.setProperty("--ui-calendar-title-font-size","0.88em")):(t.style.setProperty("--ui-calendar-day-height","2.4em"),t.style.setProperty("--ui-calendar-day-padding-block","0.14em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.22em"),t.style.setProperty("--ui-calendar-gap","0.34em"),t.style.setProperty("--ui-calendar-day-font-size","0.72em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.64em"),t.style.setProperty("--ui-calendar-title-font-size","0.8em")),o?(t.style.setProperty("--ui-calendar-frame-padding","0.32em"),t.style.setProperty("--ui-calendar-week-gap","0.18em"),t.style.setProperty("--ui-calendar-control-height","1.72em"),t.style.setProperty("--ui-calendar-gap","0.24em")):(t.style.removeProperty("--ui-calendar-frame-padding"),t.style.removeProperty("--ui-calendar-week-gap"),t.style.removeProperty("--ui-calendar-control-height")),e("aria-label",this.getAttribute("label")||this._translations().selectDateRange)}_overlaySignature(t){return[t?"sheet":"popover",this._step(),this.getAttribute("locale")||"",this.getAttribute("label")||"",this.getAttribute("translations")||""].join(":")}_ensureOverlayContent(t){if(!this._overlay)return;const e=this._overlaySignature(t);this._overlayKey===e&&this._overlay.querySelector(".drtp-calendar")||(this._overlayKey=e,this._overlay.innerHTML=t?`<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>`:`<div class="overlay">${this._renderSurfaceInner(!1)}</div>`)}_setClosestOptionValue(t,e){const i=Array.from(t.options).map(a=>Number(a.value)).filter(a=>Number.isFinite(a));if(!i.length)return;let r=i[0],l=Math.abs(r-e);for(let a=1;a<i.length;a+=1){const n=i[a],o=Math.abs(n-e);o<l&&(r=n,l=o)}t.value=String(r)}_syncOverlayState(){if(!this._overlay)return;this._syncOverlayHostZIndex();const t=this._isMobileSheet();this._ensureOverlayContent(t),this._syncDismissableLayer();const e=this._translations(),i=this._overlay.querySelector(".panel, .sheet"),r=this._overlay.querySelector(".presets"),l=this._overlay.querySelector(".footer");i&&(i.dataset.bare=this._isBare()?"true":"false");const a=this._showFooter();r&&(r.hidden=!a),l&&(l.hidden=!a);const n=this._overlay.querySelector(".head-title");if(n){const g=(this.getAttribute("label")||"").trim();n.textContent=g,n.hidden=!g}const o=this._overlay.querySelector(".head-meta"),d=this._valueFromPending();o&&(o.textContent=d.start&&d.end?`${this._formatDateTimeDisplay(d.start)} — ${this._formatDateTimeDisplay(d.end)}`:e.selectDateRange);const h=this._overlay.querySelector(".drtp-calendar");h&&this._syncCalendar(h);const b=s.parseTimeInput(this._pending.startTime,!0)||{hours:0,minutes:0,seconds:0},_=s.parseTimeInput(this._pending.endTime,!0)||{hours:0,minutes:0,seconds:0},x=this._overlay.querySelector('select[data-time="start"][data-segment="hours"]'),u=this._overlay.querySelector('select[data-time="start"][data-segment="minutes"]'),f=this._overlay.querySelector('select[data-time="end"][data-segment="hours"]'),y=this._overlay.querySelector('select[data-time="end"][data-segment="minutes"]');x&&this._setClosestOptionValue(x,b.hours),u&&this._setClosestOptionValue(u,b.minutes),f&&this._setClosestOptionValue(f,_.hours),y&&this._setClosestOptionValue(y,_.minutes);const v=this._isInteractionBlocked()||this._isReadonly();[x,u,f,y].forEach(g=>{g&&(g.disabled=v)}),this._overlay.querySelectorAll(".action, .preset").forEach(g=>{g.disabled=v}),t||this._schedulePosition.run()}_renderOverlay(){this._syncOverlayState()}_applyTimeFromOverlay(t){var o,d;const e=t.getAttribute("data-time"),i=(o=this._overlay)==null?void 0:o.querySelector(`select[data-time="${e}"][data-segment="hours"]`),r=(d=this._overlay)==null?void 0:d.querySelector(`select[data-time="${e}"][data-segment="minutes"]`);if(!e||!i||!r)return;const l=Number(i.value),a=Number(r.value);if(!Number.isFinite(l)||!Number.isFinite(a))return;const n=`${S(l)}:${S(a)}`;e==="start"&&(this._pending.startTime=n),e==="end"&&(this._pending.endTime=n),this._pending=this._normalizePendingState(this._pending),this._emitInput("time")}_todayIso(){const t=new Date,e=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${i}`}_applyPreset(t){const e=this._todayIso();if(t==="preset-today"){this._pending.startDate=e,this._pending.endDate=e,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-today");return}if(t==="preset-last7"){const r=s.computeLastDaysRange(e,7);this._pending.startDate=r.start,this._pending.endDate=r.end,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-last7");return}const i=s.computeMonthRange(e);this._pending.startDate=i.start,this._pending.endDate=i.end,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-month")}_onRootClick(t){var r;const e=t.target;if(!e)return;const i=(r=e.closest("[data-action]"))==null?void 0:r.getAttribute("data-action");if(i&&!this._isInteractionBlocked()&&!(this._isReadonly()&&i!=="toggle")){if(i==="toggle"){this._restoreFocusEl=e,this._setOpen(!this._open,"toggle");return}if(i==="clear"){this._isInlineMode()?(this._pending=D({start:null,end:null}),this._emitInput("clear"),this._updateHostState()):(this._pending=D({start:null,end:null}),this._commit(this._pending,"clear"));return}if(this._isInlineMode()&&(i==="preset-today"||i==="preset-last7"||i==="preset-month")){this._applyPreset(i),this._updateHostState();return}if(this._isInlineMode()&&i==="cancel"){this._pending=D(this._value),this._updateHostState();return}this._isInlineMode()&&i==="apply"&&this._commit(this._pending,"apply")}}_onRootChange(t){if(!this._isInlineMode())return;const e=t.target;if(e){if(e.tagName.toLowerCase()==="ui-calendar"){this._onOverlayCalendar(t);return}if(e instanceof HTMLSelectElement&&e.closest(".inline-panel")){if(!e.matches("select[data-time][data-segment]")||this._isInteractionBlocked()||this._isReadonly())return;if(this._applyTimeFromOverlay(e),this._shouldAutoCommit()){const i=this._valueFromPending();if(i.start&&i.end){this._commit(this._pending,"time");return}}this._updateHostState()}}}_onRootKeyDown(t){const e=t;if(!this._isInteractionBlocked()){if(e.key==="Escape"&&this._open&&!this._isInlineMode()){e.preventDefault(),this._setOpen(!1,"escape");return}e.key==="ArrowDown"&&!this._open&&!this._isInlineMode()&&(e.preventDefault(),this._setOpen(!0,"keyboard"))}}_onOverlayClick(t){var r;const e=t.target;if(!e)return;const i=(r=e.closest("[data-action]"))==null?void 0:r.getAttribute("data-action");if(i&&!(this._isInteractionBlocked()||this._isReadonly())){if(i==="backdrop"){this._setOpen(!1,"outside");return}if(i==="cancel"){this._pending=D(this._value),this._setOpen(!1,"cancel");return}if(i==="clear"){this._pending=D({start:null,end:null}),this._emitInput("clear"),this._renderOverlay();return}if(i==="preset-today"||i==="preset-last7"||i==="preset-month"){this._applyPreset(i),this._renderOverlay();return}i==="apply"&&(this._commit(this._pending,"apply"),this._setOpen(!1,"apply"))}}_onOverlayChange(t){const e=t.target;if(e instanceof HTMLSelectElement&&e.matches("select[data-time][data-segment]")&&!(this._isInteractionBlocked()||this._isReadonly())&&(this._applyTimeFromOverlay(e),this._shouldAutoCommit())){const i=this._valueFromPending();i.start&&i.end&&(this._commit(this._pending,"time"),this._setOpen(!1,"time"))}}_onOverlayCalendar(t){if(this._isInteractionBlocked()||this._isReadonly())return;const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-calendar")return;const i=t.detail;if(!(!i||i.mode!=="range")){if(this._pending.startDate=i.start||null,this._pending.endDate=i.end||null,this._pending=this._normalizePendingState(this._pending),this._emitInput("calendar"),this._shouldAutoCommit()&&this._pending.startDate&&this._pending.endDate){this._commit(this._pending,"calendar"),this._setOpen(!1,"calendar");return}this._isInlineMode()?this._updateHostState():this._renderOverlay()}}_onDocumentPointerDown(t){if(!this._open||!this._overlay)return;const e=t.composedPath();e.includes(this)||e.includes(this._overlay)||this._setOpen(!1,"outside")}_onDocumentKeyDown(t){this._open&&t.key==="Escape"&&(t.preventDefault(),this._setOpen(!1,"escape"))}_updateHostState(){if(!this._hasView)return;const t=this.getAttribute("label")||"",e=this.getAttribute("hint")||"",i=this.getAttribute("error")||"",r=this._inlineError||i,l=!!(this._value.start||this._value.end),a=this.getAttribute("name")||"",n=this._isInlineMode(),o=this._translations(),d=r?"error":this._state(),h=this._formatDisplay();this._display=h,this._state()==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const b=this.root.querySelector(".label"),_=this.root.querySelector(".label-text"),x=this.root.querySelector(".required"),u=this.root.querySelector(".input"),f=this.root.querySelector('.btn[data-action="clear"]'),y=this.root.querySelector('.btn[data-action="toggle"]'),v=this.root.querySelector(".hint"),g=this.root.querySelector(".error"),C=this.root.querySelector(".hidden-input");if(b&&(b.hidden=!t,b.id=this._labelId,b.setAttribute("for",this._inputId)),_&&(_.textContent=t),x&&(x.hidden=!this.hasAttribute("required")),u&&(u.value!==h&&(u.value=h),u.id=this._inputId,u.placeholder=o.dateRangeTimePlaceholder,u.readOnly=!0,u.disabled=this._isInteractionBlocked(),u.required=this.hasAttribute("required"),u.autocomplete="off",u.setAttribute("role","combobox"),u.setAttribute("aria-haspopup","dialog"),u.setAttribute("aria-expanded",n?"false":String(this._open)),u.setAttribute("aria-controls",this._panelId),u.setAttribute("aria-invalid",r?"true":"false"),t?u.setAttribute("aria-labelledby",this._labelId):u.removeAttribute("aria-labelledby")),f&&(f.hidden=!(this._clearable()&&l),f.setAttribute("aria-label",o.clearDateRange),f.disabled=this._isInteractionBlocked()),y&&(y.hidden=n,y.setAttribute("aria-label",o.toggleCalendar),y.setAttribute("aria-expanded",n?"false":String(this._open)),y.setAttribute("aria-controls",this._panelId),y.disabled=this._isInteractionBlocked()),v&&(v.id=this._hintId,v.hidden=!e,v.textContent=e),g&&(g.id=this._errorId,g.hidden=!r,g.textContent=r),u){const w=[];e&&v&&!v.hidden&&w.push(this._hintId),r&&w.push(this._errorId),w.length?u.setAttribute("aria-describedby",w.join(" ")):u.removeAttribute("aria-describedby")}C&&(C.disabled=!a,C.name=a,C.value=W(this._value)||"");const I=this.root.querySelector(".field");I&&(I.dataset.open=this._open&&!n?"true":"false",I.dataset.invalid=r?"true":"false",I.dataset.state=d);const c=this.root.querySelector(".inline-panel");if(c){c.hidden=!n,c.id=this._panelId,c.dataset.bare=this._isBare()?"true":"false",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false"),c.setAttribute("aria-label",t||o.selectDateRange);const w=c.querySelector(".panel-title");w&&(w.textContent=t,w.hidden=!t);const $=c.querySelector(".head-title");$&&($.textContent=t,$.hidden=!t);const R=c.querySelector(".head-meta"),A=this._valueFromPending();R&&(R.textContent=A.start&&A.end?`${this._formatDateTimeDisplay(A.start)} — ${this._formatDateTimeDisplay(A.end)}`:o.selectDateRange);const q=c.querySelector(".drtp-calendar-inline");q&&this._syncCalendar(q);const O=c.querySelector('select[data-time="start"][data-segment="hours"]'),z=c.querySelector('select[data-time="start"][data-segment="minutes"]'),P=c.querySelector('select[data-time="end"][data-segment="hours"]'),B=c.querySelector('select[data-time="end"][data-segment="minutes"]'),L=s.parseTimeInput(this._pending.startTime,!0)||{hours:0,minutes:0,seconds:0},M=s.parseTimeInput(this._pending.endTime,!0)||{hours:0,minutes:0,seconds:0};O&&this._setClosestOptionValue(O,L.hours),z&&this._setClosestOptionValue(z,L.minutes),P&&this._setClosestOptionValue(P,M.hours),B&&this._setClosestOptionValue(B,M.minutes),[O,z,P,B].forEach(T=>{T&&(T.disabled=this._isInteractionBlocked()||this._isReadonly())});const E=c.querySelector('[data-action="preset-today"]');E&&(E.textContent=o.today);const H=c.querySelector('[data-action="preset-last7"]');H&&(H.textContent=o.last7Days);const V=c.querySelector('[data-action="preset-month"]');V&&(V.textContent=o.thisMonth);const F=c.querySelector('[data-action="clear"]');F&&(F.textContent=o.clear);const N=c.querySelector('[data-action="apply"]');N&&(N.textContent=o.apply);const K=c.querySelector(".presets"),U=c.querySelector(".footer"),Z=this._showFooter();K&&(K.hidden=!Z),U&&(U.hidden=!Z),c.querySelectorAll(".action, .preset").forEach(T=>{T.disabled=this._isInteractionBlocked()||this._isReadonly()})}!n&&this._open&&this._syncOverlayState(),n&&this._destroyOverlay()}render(){if(!this._hasView){const t=this._translations();this.setContent(`
|
|
551
|
+
`}_syncCalendar(t){const e=(d,h)=>{if(h==null||h===""){t.hasAttribute(d)&&t.removeAttribute(d);return}t.getAttribute(d)!==h&&t.setAttribute(d,h)},i=(d,h)=>{h?e(d,""):e(d,null)};e("selection","range"),e("value",JSON.stringify({...this._pending.startDate?{start:this._pending.startDate}:{},...this._pending.endDate?{end:this._pending.endDate}:{}}));const r=s.parseConstraintDateTime(this.getAttribute("min")),l=s.parseConstraintDateTime(this.getAttribute("max"));e("min",(r==null?void 0:r.date)||null),e("max",(l==null?void 0:l.date)||null),e("locale",this.getAttribute("locale")),e("translations",this.getAttribute("translations")),e("week-start",this.getAttribute("week-start"));const n=this.getAttribute("size")||"sm",o=t.classList.contains("drtp-calendar-inline");e("size",n==="lg"?"md":"sm"),e("variant",this.getAttribute("variant")),i("readonly",this._isReadonly()),i("disabled",this._isInteractionBlocked()),i("bare",this._isBare()),e("tabindex","-1"),n==="lg"?(t.style.setProperty("--ui-calendar-day-height","1.95em"),t.style.setProperty("--ui-calendar-day-padding-block","0.2em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.26em"),t.style.setProperty("--ui-calendar-gap","0.42em"),t.style.setProperty("--ui-calendar-day-font-size","0.78em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.7em"),t.style.setProperty("--ui-calendar-title-font-size","0.88em")):(t.style.setProperty("--ui-calendar-day-height","2.4em"),t.style.setProperty("--ui-calendar-day-padding-block","0.14em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.22em"),t.style.setProperty("--ui-calendar-gap","0.34em"),t.style.setProperty("--ui-calendar-day-font-size","0.72em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.64em"),t.style.setProperty("--ui-calendar-title-font-size","0.8em")),o?(t.style.setProperty("--ui-calendar-frame-padding","0.32em"),t.style.setProperty("--ui-calendar-week-gap","0.18em"),t.style.setProperty("--ui-calendar-control-height","1.72em"),t.style.setProperty("--ui-calendar-gap","0.24em")):(t.style.removeProperty("--ui-calendar-frame-padding"),t.style.removeProperty("--ui-calendar-week-gap"),t.style.removeProperty("--ui-calendar-control-height")),e("aria-label",this.getAttribute("label")||this._translations().selectDateRange)}_overlaySignature(t){return[t?"sheet":"popover",this._step(),this.getAttribute("locale")||"",this.getAttribute("label")||"",this.getAttribute("translations")||""].join(":")}_ensureOverlayContent(t){if(!this._overlay)return;const e=this._overlaySignature(t);this._overlayKey===e&&this._overlay.querySelector(".drtp-calendar")||(this._overlayKey=e,this._overlay.innerHTML=t?`<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>`:`<div class="overlay">${this._renderSurfaceInner(!1)}</div>`)}_setClosestOptionValue(t,e){const i=Array.from(t.options).map(a=>Number(a.value)).filter(a=>Number.isFinite(a));if(!i.length)return;let r=i[0],l=Math.abs(r-e);for(let a=1;a<i.length;a+=1){const n=i[a],o=Math.abs(n-e);o<l&&(r=n,l=o)}t.value=String(r)}_syncOverlayState(){if(!this._overlay)return;this._syncOverlayHostZIndex();const t=this._isMobileSheet();this._ensureOverlayContent(t),this._syncDismissableLayer();const e=this._translations(),i=this._overlay.querySelector(".panel, .sheet"),r=this._overlay.querySelector(".presets"),l=this._overlay.querySelector(".footer");i&&(i.dataset.bare=this._isBare()?"true":"false");const a=this._showFooter();r&&(r.hidden=!a),l&&(l.hidden=!a);const n=this._overlay.querySelector(".head-title");if(n){const g=(this.getAttribute("label")||"").trim();n.textContent=g,n.hidden=!g}const o=this._overlay.querySelector(".head-meta"),d=this._valueFromPending();o&&(o.textContent=d.start&&d.end?`${this._formatDateTimeDisplay(d.start)} — ${this._formatDateTimeDisplay(d.end)}`:e.selectDateRange);const h=this._overlay.querySelector(".drtp-calendar");h&&this._syncCalendar(h);const b=s.parseTimeInput(this._pending.startTime,!0)||{hours:0,minutes:0,seconds:0},_=s.parseTimeInput(this._pending.endTime,!0)||{hours:0,minutes:0,seconds:0},x=this._overlay.querySelector('select[data-time="start"][data-segment="hours"]'),u=this._overlay.querySelector('select[data-time="start"][data-segment="minutes"]'),f=this._overlay.querySelector('select[data-time="end"][data-segment="hours"]'),y=this._overlay.querySelector('select[data-time="end"][data-segment="minutes"]');x&&this._setClosestOptionValue(x,b.hours),u&&this._setClosestOptionValue(u,b.minutes),f&&this._setClosestOptionValue(f,_.hours),y&&this._setClosestOptionValue(y,_.minutes);const v=this._isInteractionBlocked()||this._isReadonly();[x,u,f,y].forEach(g=>{g&&(g.disabled=v)}),this._overlay.querySelectorAll(".action, .preset").forEach(g=>{g.disabled=v}),t||this._schedulePosition.run()}_renderOverlay(){this._syncOverlayState()}_applyTimeFromOverlay(t){var o,d;const e=t.getAttribute("data-time"),i=(o=this._overlay)==null?void 0:o.querySelector(`select[data-time="${e}"][data-segment="hours"]`),r=(d=this._overlay)==null?void 0:d.querySelector(`select[data-time="${e}"][data-segment="minutes"]`);if(!e||!i||!r)return;const l=Number(i.value),a=Number(r.value);if(!Number.isFinite(l)||!Number.isFinite(a))return;const n=`${S(l)}:${S(a)}`;e==="start"&&(this._pending.startTime=n),e==="end"&&(this._pending.endTime=n),this._pending=this._normalizePendingState(this._pending),this._emitInput("time")}_todayIso(){const t=new Date,e=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${i}`}_applyPreset(t){const e=this._todayIso();if(t==="preset-today"){this._pending.startDate=e,this._pending.endDate=e,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-today");return}if(t==="preset-last7"){const r=s.computeLastDaysRange(e,7);this._pending.startDate=r.start,this._pending.endDate=r.end,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-last7");return}const i=s.computeMonthRange(e);this._pending.startDate=i.start,this._pending.endDate=i.end,this._pending=this._normalizePendingState(this._pending),this._emitInput("preset-month")}_onRootClick(t){var r;const e=t.target;if(!e)return;const i=(r=e.closest("[data-action]"))==null?void 0:r.getAttribute("data-action");if(i&&!this._isInteractionBlocked()&&!(this._isReadonly()&&i!=="toggle")){if(i==="toggle"){this._restoreFocusEl=e,this._setOpen(!this._open,"toggle");return}if(i==="clear"){this._isInlineMode()?(this._pending=D({start:null,end:null}),this._emitInput("clear"),this._updateHostState()):(this._pending=D({start:null,end:null}),this._commit(this._pending,"clear"));return}if(this._isInlineMode()&&(i==="preset-today"||i==="preset-last7"||i==="preset-month")){this._applyPreset(i),this._updateHostState();return}if(this._isInlineMode()&&i==="cancel"){this._pending=D(this._value),this._updateHostState();return}this._isInlineMode()&&i==="apply"&&this._commit(this._pending,"apply")}}_onRootChange(t){if(!this._isInlineMode())return;const e=t.target;if(e){if(e.tagName.toLowerCase()==="ui-calendar"){this._onOverlayCalendar(t);return}if(e instanceof HTMLSelectElement&&e.closest(".inline-panel")){if(!e.matches("select[data-time][data-segment]")||this._isInteractionBlocked()||this._isReadonly())return;if(this._applyTimeFromOverlay(e),this._shouldAutoCommit()){const i=this._valueFromPending();if(i.start&&i.end){this._commit(this._pending,"time");return}}this._updateHostState()}}}_onRootKeyDown(t){const e=t;if(!this._isInteractionBlocked()){if(e.key==="Escape"&&this._open&&!this._isInlineMode()){e.preventDefault(),this._setOpen(!1,"escape");return}e.key==="ArrowDown"&&!this._open&&!this._isInlineMode()&&(e.preventDefault(),this._setOpen(!0,"keyboard"))}}_onOverlayClick(t){var r;const e=t.target;if(!e)return;const i=(r=e.closest("[data-action]"))==null?void 0:r.getAttribute("data-action");if(i&&!(this._isInteractionBlocked()||this._isReadonly())){if(i==="backdrop"){this._setOpen(!1,"outside");return}if(i==="cancel"){this._pending=D(this._value),this._setOpen(!1,"cancel");return}if(i==="clear"){this._pending=D({start:null,end:null}),this._emitInput("clear"),this._renderOverlay();return}if(i==="preset-today"||i==="preset-last7"||i==="preset-month"){this._applyPreset(i),this._renderOverlay();return}i==="apply"&&(this._commit(this._pending,"apply"),this._setOpen(!1,"apply"))}}_onOverlayChange(t){const e=t.target;if(e instanceof HTMLSelectElement&&e.matches("select[data-time][data-segment]")&&!(this._isInteractionBlocked()||this._isReadonly())&&(this._applyTimeFromOverlay(e),this._shouldAutoCommit())){const i=this._valueFromPending();i.start&&i.end&&(this._commit(this._pending,"time"),this._setOpen(!1,"time"))}}_onOverlayCalendar(t){if(this._isInteractionBlocked()||this._isReadonly())return;const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-calendar")return;const i=t.detail;if(!(!i||i.mode!=="range")){if(this._pending.startDate=i.start||null,this._pending.endDate=i.end||null,this._pending=this._normalizePendingState(this._pending),this._emitInput("calendar"),this._shouldAutoCommit()&&this._pending.startDate&&this._pending.endDate){this._commit(this._pending,"calendar"),this._setOpen(!1,"calendar");return}this._isInlineMode()?this._updateHostState():this._renderOverlay()}}_onDocumentPointerDown(t){if(!this._open||!this._overlay)return;const e=t.composedPath();e.includes(this)||e.includes(this._overlay)||this._setOpen(!1,"outside")}_onDocumentKeyDown(t){this._open&&t.key==="Escape"&&(t.preventDefault(),this._setOpen(!1,"escape"))}_updateHostState(){if(!this._hasView)return;const t=this.getAttribute("label")||"",e=this.getAttribute("hint")||"",i=this.getAttribute("error")||"",r=this._inlineError||i,l=!!(this._value.start||this._value.end),a=this.getAttribute("name")||"",n=this._isInlineMode(),o=this._translations(),d=r?"error":this._state(),h=this._formatDisplay();this._display=h,this._state()==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const b=this.root.querySelector(".label"),_=this.root.querySelector(".label-text"),x=this.root.querySelector(".required"),u=this.root.querySelector(".input"),f=this.root.querySelector('.btn[data-action="clear"]'),y=this.root.querySelector('.btn[data-action="toggle"]'),v=this.root.querySelector(".hint"),g=this.root.querySelector(".error"),C=this.root.querySelector(".hidden-input");if(b&&(b.hidden=!t,b.id=this._labelId,b.setAttribute("for",this._inputId)),_&&(_.textContent=t),x&&(x.hidden=!this.hasAttribute("required")),u&&(u.value!==h&&(u.value=h),u.id=this._inputId,u.placeholder=o.dateRangeTimePlaceholder,u.readOnly=!0,u.disabled=this._isInteractionBlocked(),u.required=this.hasAttribute("required"),u.autocomplete="off",u.setAttribute("role","combobox"),u.setAttribute("aria-haspopup","dialog"),u.setAttribute("aria-expanded",n?"false":String(this._open)),u.setAttribute("aria-controls",this._panelId),u.setAttribute("aria-invalid",r?"true":"false"),t?u.setAttribute("aria-labelledby",this._labelId):u.removeAttribute("aria-labelledby")),f&&(f.hidden=!(this._clearable()&&l),f.setAttribute("aria-label",o.clearDateRange),f.disabled=this._isInteractionBlocked()),y&&(y.hidden=n,y.setAttribute("aria-label",o.toggleCalendar),y.setAttribute("aria-expanded",n?"false":String(this._open)),y.setAttribute("aria-controls",this._panelId),y.disabled=this._isInteractionBlocked()),v&&(v.id=this._hintId,v.hidden=!e,v.textContent=e),g&&(g.id=this._errorId,g.hidden=!r,g.textContent=r),u){const w=[];e&&v&&!v.hidden&&w.push(this._hintId),r&&w.push(this._errorId),w.length?u.setAttribute("aria-describedby",w.join(" ")):u.removeAttribute("aria-describedby")}C&&(C.disabled=!a,C.name=a,C.value=W(this._value)||"");const I=this.root.querySelector(".field");I&&(I.dataset.open=this._open&&!n?"true":"false",I.dataset.invalid=r?"true":"false",I.dataset.state=d);const c=this.root.querySelector(".inline-panel");if(c){c.hidden=!n,c.id=this._panelId,c.dataset.bare=this._isBare()?"true":"false",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false"),c.setAttribute("aria-label",t||o.selectDateRange);const w=c.querySelector(".panel-title");w&&(w.textContent=t,w.hidden=!t);const $=c.querySelector(".head-title");$&&($.textContent=t,$.hidden=!t);const q=c.querySelector(".head-meta"),A=this._valueFromPending();q&&(q.textContent=A.start&&A.end?`${this._formatDateTimeDisplay(A.start)} — ${this._formatDateTimeDisplay(A.end)}`:o.selectDateRange);const R=c.querySelector(".drtp-calendar-inline");R&&this._syncCalendar(R);const O=c.querySelector('select[data-time="start"][data-segment="hours"]'),z=c.querySelector('select[data-time="start"][data-segment="minutes"]'),P=c.querySelector('select[data-time="end"][data-segment="hours"]'),B=c.querySelector('select[data-time="end"][data-segment="minutes"]'),L=s.parseTimeInput(this._pending.startTime,!0)||{hours:0,minutes:0,seconds:0},M=s.parseTimeInput(this._pending.endTime,!0)||{hours:0,minutes:0,seconds:0};O&&this._setClosestOptionValue(O,L.hours),z&&this._setClosestOptionValue(z,L.minutes),P&&this._setClosestOptionValue(P,M.hours),B&&this._setClosestOptionValue(B,M.minutes),[O,z,P,B].forEach(T=>{T&&(T.disabled=this._isInteractionBlocked()||this._isReadonly())});const E=c.querySelector('[data-action="preset-today"]');E&&(E.textContent=o.today);const H=c.querySelector('[data-action="preset-last7"]');H&&(H.textContent=o.last7Days);const V=c.querySelector('[data-action="preset-month"]');V&&(V.textContent=o.thisMonth);const F=c.querySelector('[data-action="clear"]');F&&(F.textContent=o.clear);const N=c.querySelector('[data-action="apply"]');N&&(N.textContent=o.apply);const K=c.querySelector(".presets"),U=c.querySelector(".footer"),Z=this._showFooter();K&&(K.hidden=!Z),U&&(U.hidden=!Z),c.querySelectorAll(".action, .preset").forEach(T=>{T.disabled=this._isInteractionBlocked()||this._isReadonly()})}!n&&this._open&&this._syncOverlayState(),n&&this._destroyOverlay()}render(){if(!this._hasView){const t=this._translations();this.setContent(`
|
|
552
552
|
<style>${rt}</style>
|
|
553
553
|
<div class="root">
|
|
554
554
|
<label class="label" part="label" id="${this._labelId}">
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { E as tt } from "./ElementBase-909688f3.mjs";
|
|
2
2
|
import { c as et } from "./dismissable-layer-9c7e6b58.mjs";
|
|
3
3
|
import { r as it } from "./calendar-2c11b824.mjs";
|
|
4
|
-
import { r as rt, e as st, i as C, s as nt, b as at, j as D, k, f as ot, m as I, o as P, l as lt, c as dt, q as A, g as ut, h as ct } from "./date-time-utils-
|
|
4
|
+
import { r as rt, e as st, i as C, s as nt, b as at, j as D, k, f as ot, m as I, o as P, l as lt, c as dt, q as A, g as ut, h as ct } from "./date-time-utils-a2c7af25.mjs";
|
|
5
5
|
import "./scroll-lock-31da444f.mjs";
|
|
6
|
+
import "./positioner-e9770c66.mjs";
|
|
6
7
|
let pt = 0;
|
|
7
8
|
const ht = `
|
|
8
9
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const F=require("./ElementBase-1b301e7f.js"),N=require("./dismissable-layer-193e3bed.js"),K=require("./calendar-a8735e40.js"),l=require("./date-time-utils-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const F=require("./ElementBase-1b301e7f.js"),N=require("./dismissable-layer-193e3bed.js"),K=require("./calendar-a8735e40.js"),l=require("./date-time-utils-66480de4.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");let U=0;const Z=`
|
|
2
2
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
@@ -470,7 +470,7 @@
|
|
|
470
470
|
<style>${J}</style>
|
|
471
471
|
${t?'<div class="sheet-backdrop" data-action="backdrop"></div>':""}
|
|
472
472
|
<section class="${t?"sheet":"panel"}" id="${this._panelId}" role="dialog" aria-modal="${t?"true":"false"}" aria-label="${n}" part="${t?"sheet":"popover"}">${u}</section>
|
|
473
|
-
`}_syncCalendar(t){const e=(n,r)=>{if(r==null||r===""){t.hasAttribute(n)&&t.removeAttribute(n);return}t.getAttribute(n)!==r&&t.setAttribute(n,r)},i=(n,r)=>{r?e(n,""):e(n,null)};e("selection","single"),e("value",this._pending.date),e("min",this.getAttribute("min")),e("max",this.getAttribute("max")),e("locale",this.getAttribute("locale")),e("translations",this.getAttribute("translations")),e("week-start",this.getAttribute("week-start"));const a=this.getAttribute("size")||"sm",o=t.classList.contains("dt-calendar-inline");e("size",a==="lg"?"md":"sm"),e("variant",this.getAttribute("variant")),i("readonly",this._isReadonly()),i("disabled",this._isInteractionBlocked()),i("bare",this._isBare()),e("tabindex","-1"),a==="lg"?(t.style.setProperty("--ui-calendar-day-height","1.95em"),t.style.setProperty("--ui-calendar-day-padding-block","0.2em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.26em"),t.style.setProperty("--ui-calendar-gap","0.42em"),t.style.setProperty("--ui-calendar-day-font-size","0.78em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.7em"),t.style.setProperty("--ui-calendar-title-font-size","0.88em")):(t.style.setProperty("--ui-calendar-day-height","2.4em"),t.style.setProperty("--ui-calendar-day-padding-block","0.14em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.22em"),t.style.setProperty("--ui-calendar-gap","0.34em"),t.style.setProperty("--ui-calendar-day-font-size","0.72em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.64em"),t.style.setProperty("--ui-calendar-title-font-size","0.8em")),o?(t.style.setProperty("--ui-calendar-frame-padding","0.32em"),t.style.setProperty("--ui-calendar-week-gap","0.18em"),t.style.setProperty("--ui-calendar-control-height","1.72em"),t.style.setProperty("--ui-calendar-gap","0.24em")):(t.style.removeProperty("--ui-calendar-frame-padding"),t.style.removeProperty("--ui-calendar-week-gap"),t.style.removeProperty("--ui-calendar-control-height")),e("aria-label",this.getAttribute("label")||this._translations().selectDate)}_overlaySignature(t){return[t?"sheet":"popover",this._minuteStep(),this._is12h()?"12h":"24h",this.getAttribute("locale")||"",this.getAttribute("translations")||""].join(":")}_ensureOverlayContent(t){if(!this._overlay)return;const e=this._overlaySignature(t);this._overlayKey===e&&this._overlay.querySelector(".dt-calendar")||(this._overlayKey=e,this._overlay.innerHTML=t?`<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>`:`<div class="overlay">${this._renderSurfaceInner(!1)}</div>`)}_setClosestOptionValue(t,e){const i=Array.from(t.options).map(o=>Number(o.value)).filter(o=>Number.isFinite(o));if(!i.length)return;let s=i[0],a=Math.abs(s-e);for(let o=1;o<i.length;o+=1){const n=i[o],r=Math.abs(n-e);r<a&&(s=n,a=r)}t.value=String(s)}_syncOverlayState(){if(!this._overlay)return;this._syncOverlayHostZIndex();const t=this._isMobileSheet();this._ensureOverlayContent(t),this._syncDismissableLayer();const e=this._translations(),i=this._overlay.querySelector(".panel, .sheet"),s=this._overlay.querySelector(".footer");i&&(i.dataset.bare=this._isBare()?"true":"false"),s&&(s.hidden=!this._showFooter());const a=this._overlay.querySelector(".head-title");if(a){const d=(this.getAttribute("label")||"").trim();a.textContent=d,a.hidden=!d}const o=this._overlay.querySelector(".head-meta");o&&(o.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):e.selectDate);const n=this._overlay.querySelector(".dt-calendar");n&&this._syncCalendar(n);const r=l.parseTimeInput(this._pending.time||"00:00",!0)||{hours:0,minutes:0,seconds:0},u=this._overlay.querySelector('select[data-segment="hours"]'),f=this._overlay.querySelector('select[data-segment="minutes"]'),_=this._overlay.querySelector('select[data-segment="meridiem"]');if(u){const d=this._is12h()?r.hours%12||12:r.hours;this._setClosestOptionValue(u,d),u.disabled=this._isInteractionBlocked()||this._isReadonly()}f&&(this._setClosestOptionValue(f,r.minutes),f.disabled=this._isInteractionBlocked()||this._isReadonly()),_&&(_.value=r.hours>=12?"pm":"am",_.disabled=this._isInteractionBlocked()||this._isReadonly());const x=this._isInteractionBlocked()||this._isReadonly();this._overlay.querySelectorAll(".action").forEach(d=>{d.disabled=x}),t||this._schedulePosition.run()}_renderOverlay(){this._syncOverlayState()}_applyTimeFromSurface(t){const e=t.querySelector('select[data-segment="hours"]'),i=t.querySelector('select[data-segment="minutes"]'),s=t.querySelector('select[data-segment="meridiem"]');if(!e||!i)return;const a=Number(e.value),o=Number(i.value);if(!Number.isFinite(a)||!Number.isFinite(o))return;let n=a;if(this._is12h()){const r=(s==null?void 0:s.value)==="pm"?"pm":"am";r==="pm"&&n<12&&(n+=12),r==="am"&&n===12&&(n=0)}this._pending=this._clampState({date:this._pending.date,time:`${h(n)}:${h(o)}`}),this._emitInput("time")}_onRootClick(t){var s;const e=t.target;if(!e)return;const i=(s=e.closest("[data-action]"))==null?void 0:s.getAttribute("data-action");if(i&&!(this._isInteractionBlocked()||this._isReadonly())){if(i==="toggle"){this._restoreFocusEl=e,this._setOpen(!this._open,"toggle");return}if(i==="clear"){this._isInlineMode()?(this._pending={date:null,time:null},this._emitInput("clear"),this._updateHostState()):this._commit({date:null,time:null},"clear");return}if(this._isInlineMode()&&i==="now"){const a=new Date,o=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),r=`${a.getFullYear()}-${o}-${n}`,u=`${h(a.getHours())}:${h(a.getMinutes())}`;this._pending=this._clampState({date:r,time:u}),this._emitInput("now"),this._updateHostState();return}if(this._isInlineMode()&&i==="cancel"){this._pending={...this._value},this._updateHostState();return}this._isInlineMode()&&i==="apply"&&this._commit(this._pending,"apply")}}_onRootChange(t){if(!this._isInlineMode())return;const e=t.target;if(e){if(e.tagName.toLowerCase()==="ui-calendar"){this._onOverlayCalendar(t);return}if(e instanceof HTMLSelectElement&&e.closest(".inline-panel")){if(!e.matches("select[data-segment]")||this._isInteractionBlocked()||this._isReadonly())return;const i=this.root.querySelector(".inline-panel");if(!i)return;if(this._applyTimeFromSurface(i),this._shouldAutoCommit()&&this._pending.date&&this._pending.time){this._commit(this._pending,"time");return}this._updateHostState()}}}_onRootInput(t){const e=t.target;e instanceof HTMLInputElement&&e.classList.contains("input")&&this._allowInput()&&(this._isInteractionBlocked()||(this._draft=e.value,this._inlineError="",this._emitInput("typing")))}_onRootBlur(t){const e=t.target;if(!(e instanceof HTMLInputElement)||!e.classList.contains("input")||!this._allowInput()||this._isInteractionBlocked())return;const i=this._draft.trim();if(!i){this._commit({date:null,time:null},"blur");return}const s=/^(.+)\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]m)?)$/i.exec(i);if(!s){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}const a=this._parseDateInput(s[1]),o=l.parseTimeInput(s[2],!0)?s[2]:null;if(!a||!o){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}this._commit({date:a,time:o},"blur")}_onRootKeyDown(t){const e=t;if(!this._isInteractionBlocked()){if(e.key==="Escape"&&this._open&&!this._isInlineMode()){e.preventDefault(),this._setOpen(!1,"escape");return}e.key==="ArrowDown"&&!this._open&&!this._isInlineMode()&&(e.preventDefault(),this._setOpen(!0,"keyboard"))}}_onOverlayClick(t){var s;const e=t.target;if(!e)return;const i=(s=e.closest("[data-action]"))==null?void 0:s.getAttribute("data-action");if(i&&!this._isInteractionBlocked()&&!(this._isReadonly()&&i!=="toggle")){if(i==="backdrop"){this._setOpen(!1,"outside");return}if(i==="cancel"){this._pending={...this._value},this._setOpen(!1,"cancel");return}if(i==="clear"){this._pending={date:null,time:null},this._emitInput("clear"),this._renderOverlay();return}if(i==="now"){const a=new Date,o=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),r=`${a.getFullYear()}-${o}-${n}`,u=`${h(a.getHours())}:${h(a.getMinutes())}`;this._pending=this._clampState({date:r,time:u}),this._emitInput("now"),this._renderOverlay();return}i==="apply"&&(this._commit(this._pending,"apply"),this._setOpen(!1,"apply"))}}_onOverlayChange(t){const e=t.target;e instanceof HTMLSelectElement&&e.matches("select[data-segment]")&&(this._isInteractionBlocked()||this._overlay&&(this._applyTimeFromSurface(this._overlay),this._shouldAutoCommit()&&this._pending.date&&this._pending.time&&(this._commit(this._pending,"time"),this._setOpen(!1,"time"))))}_onOverlayCalendar(t){if(this._isInteractionBlocked()||this._isReadonly())return;const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-calendar")return;const i=t.type,s=t.detail,a=l.normalizeDateIso(i==="select"?(s==null?void 0:s.value)||null:s==null?void 0:s.value);if(a){if(this._pending=this._clampState({date:a,time:this._pending.time||"09:00"}),this._emitInput("calendar"),this._shouldAutoCommit()&&this._pending.time){this._commit(this._pending,"calendar"),this._setOpen(!1,"calendar");return}this._updateHostState()}}_onDocumentPointerDown(t){if(!this._open||!this._overlay)return;const e=t.composedPath();e.includes(this)||e.includes(this._overlay)||this._setOpen(!1,"outside")}_onDocumentKeyDown(t){this._open&&t.key==="Escape"&&(t.preventDefault(),this._setOpen(!1,"escape"))}_updateHostState(){if(!this._hasView)return;const t=this.getAttribute("label")||"",e=this.getAttribute("hint")||"",i=this.getAttribute("error")||"",s=this._inlineError||i,a=!!y(this._value),o=this.getAttribute("name")||"",n=this._allowInput()?this._draft:this._formatDisplay(this._value),r=this._isInlineMode(),u=this._translations(),f=s?"error":this._state();this._state()==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const _=this.root.querySelector(".label"),x=this.root.querySelector(".label-text"),k=this.root.querySelector(".required"),d=this.root.querySelector(".input"),I=this.root.querySelector('.btn[data-action="clear"]'),g=this.root.querySelector('.btn[data-action="toggle"]'),v=this.root.querySelector(".hint"),S=this.root.querySelector(".error"),w=this.root.querySelector(".hidden-input");if(_&&(_.hidden=!t),_&&(_.id=this._labelId,_.setAttribute("for",this._inputId)),x&&(x.textContent=t),k&&(k.hidden=!this.hasAttribute("required")),d&&(d.value!==n&&(d.value=n),d.id=this._inputId,d.placeholder=u.dateTimePlaceholder,d.readOnly=!this._allowInput()||this._isReadonly(),d.disabled=this._isInteractionBlocked(),d.required=this.hasAttribute("required"),d.autocomplete="off",d.setAttribute("role","combobox"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded",r?"false":String(this._open)),d.setAttribute("aria-controls",this._panelId),d.setAttribute("aria-invalid",s?"true":"false"),t?d.setAttribute("aria-labelledby",this._labelId):d.removeAttribute("aria-labelledby")),I&&(I.hidden=!(this._clearable()&&a),I.setAttribute("aria-label",u.clear),I.disabled=this._isInteractionBlocked()),g&&(g.hidden=r,g.setAttribute("aria-label",u.toggleCalendar),g.setAttribute("aria-expanded",r?"false":String(this._open)),g.setAttribute("aria-controls",this._panelId),g.disabled=this._isInteractionBlocked()),v&&(v.id=this._hintId,v.hidden=!e,v.textContent=e),S&&(S.id=this._errorId,S.hidden=!s,S.textContent=s),d){const b=[];e&&v&&!v.hidden&&b.push(this._hintId),s&&b.push(this._errorId),b.length?d.setAttribute("aria-describedby",b.join(" ")):d.removeAttribute("aria-describedby")}w&&(w.disabled=!o,w.name=o,w.value=y(this._value)||"");const A=this.root.querySelector(".field");A&&(A.dataset.open=this._open&&!r?"true":"false",A.dataset.invalid=s?"true":"false",A.dataset.state=f);const c=this.root.querySelector(".inline-panel");if(c){c.hidden=!r,c.id=this._panelId,c.dataset.bare=this._isBare()?"true":"false",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false"),c.setAttribute("aria-label",t||u.selectDate);const b=c.querySelector(".panel-title");b&&(b.textContent=t,b.hidden=!t);const D=c.querySelector(".head-title");D&&(D.textContent=t,D.hidden=!t);const T=c.querySelector(".head-meta");T&&(T.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):u.selectDate);const L=c.querySelector('[data-action="now"]');L&&(L.textContent=u.now);const R=c.querySelector('[data-action="clear"]');R&&(R.textContent=u.clear);const q=c.querySelector('[data-action="apply"]');q&&(q.textContent=u.apply);const E=c.querySelector(".footer");E&&(E.hidden=!this._showFooter());const M=c.querySelector(".dt-calendar-inline");M&&this._syncCalendar(M);const O=c.querySelector('select[data-segment="hours"]'),$=c.querySelector('select[data-segment="minutes"]'),B=c.querySelector('select[data-segment="meridiem"]'),C=l.parseTimeInput(this._pending.time||"00:00",!0)||{hours:0,minutes:0,seconds:0};if(O){const z=this._is12h()?C.hours%12||12:C.hours;this._setClosestOptionValue(O,z),O.disabled=this._isInteractionBlocked()||this._isReadonly()}$&&(this._setClosestOptionValue($,C.minutes),$.disabled=this._isInteractionBlocked()||this._isReadonly()),B&&(B.value=C.hours>=12?"pm":"am",B.disabled=this._isInteractionBlocked()||this._isReadonly()),c.querySelectorAll(".action").forEach(z=>{z.disabled=this._isInteractionBlocked()||this._isReadonly()})}!r&&this._open&&this._syncOverlayState(),r&&this._destroyOverlay()}render(){if(!this._hasView){const t=this._translations();this.setContent(`
|
|
473
|
+
`}_syncCalendar(t){const e=(n,r)=>{if(r==null||r===""){t.hasAttribute(n)&&t.removeAttribute(n);return}t.getAttribute(n)!==r&&t.setAttribute(n,r)},i=(n,r)=>{r?e(n,""):e(n,null)};e("selection","single"),e("value",this._pending.date),e("min",this.getAttribute("min")),e("max",this.getAttribute("max")),e("locale",this.getAttribute("locale")),e("translations",this.getAttribute("translations")),e("week-start",this.getAttribute("week-start"));const a=this.getAttribute("size")||"sm",o=t.classList.contains("dt-calendar-inline");e("size",a==="lg"?"md":"sm"),e("variant",this.getAttribute("variant")),i("readonly",this._isReadonly()),i("disabled",this._isInteractionBlocked()),i("bare",this._isBare()),e("tabindex","-1"),a==="lg"?(t.style.setProperty("--ui-calendar-day-height","1.95em"),t.style.setProperty("--ui-calendar-day-padding-block","0.2em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.26em"),t.style.setProperty("--ui-calendar-gap","0.42em"),t.style.setProperty("--ui-calendar-day-font-size","0.78em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.7em"),t.style.setProperty("--ui-calendar-title-font-size","0.88em")):(t.style.setProperty("--ui-calendar-day-height","2.4em"),t.style.setProperty("--ui-calendar-day-padding-block","0.14em"),t.style.setProperty("--ui-calendar-day-padding-inline","0.22em"),t.style.setProperty("--ui-calendar-gap","0.34em"),t.style.setProperty("--ui-calendar-day-font-size","0.72em"),t.style.setProperty("--ui-calendar-weekday-font-size","0.64em"),t.style.setProperty("--ui-calendar-title-font-size","0.8em")),o?(t.style.setProperty("--ui-calendar-frame-padding","0.32em"),t.style.setProperty("--ui-calendar-week-gap","0.18em"),t.style.setProperty("--ui-calendar-control-height","1.72em"),t.style.setProperty("--ui-calendar-gap","0.24em")):(t.style.removeProperty("--ui-calendar-frame-padding"),t.style.removeProperty("--ui-calendar-week-gap"),t.style.removeProperty("--ui-calendar-control-height")),e("aria-label",this.getAttribute("label")||this._translations().selectDate)}_overlaySignature(t){return[t?"sheet":"popover",this._minuteStep(),this._is12h()?"12h":"24h",this.getAttribute("locale")||"",this.getAttribute("translations")||""].join(":")}_ensureOverlayContent(t){if(!this._overlay)return;const e=this._overlaySignature(t);this._overlayKey===e&&this._overlay.querySelector(".dt-calendar")||(this._overlayKey=e,this._overlay.innerHTML=t?`<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>`:`<div class="overlay">${this._renderSurfaceInner(!1)}</div>`)}_setClosestOptionValue(t,e){const i=Array.from(t.options).map(o=>Number(o.value)).filter(o=>Number.isFinite(o));if(!i.length)return;let s=i[0],a=Math.abs(s-e);for(let o=1;o<i.length;o+=1){const n=i[o],r=Math.abs(n-e);r<a&&(s=n,a=r)}t.value=String(s)}_syncOverlayState(){if(!this._overlay)return;this._syncOverlayHostZIndex();const t=this._isMobileSheet();this._ensureOverlayContent(t),this._syncDismissableLayer();const e=this._translations(),i=this._overlay.querySelector(".panel, .sheet"),s=this._overlay.querySelector(".footer");i&&(i.dataset.bare=this._isBare()?"true":"false"),s&&(s.hidden=!this._showFooter());const a=this._overlay.querySelector(".head-title");if(a){const d=(this.getAttribute("label")||"").trim();a.textContent=d,a.hidden=!d}const o=this._overlay.querySelector(".head-meta");o&&(o.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):e.selectDate);const n=this._overlay.querySelector(".dt-calendar");n&&this._syncCalendar(n);const r=l.parseTimeInput(this._pending.time||"00:00",!0)||{hours:0,minutes:0,seconds:0},u=this._overlay.querySelector('select[data-segment="hours"]'),f=this._overlay.querySelector('select[data-segment="minutes"]'),_=this._overlay.querySelector('select[data-segment="meridiem"]');if(u){const d=this._is12h()?r.hours%12||12:r.hours;this._setClosestOptionValue(u,d),u.disabled=this._isInteractionBlocked()||this._isReadonly()}f&&(this._setClosestOptionValue(f,r.minutes),f.disabled=this._isInteractionBlocked()||this._isReadonly()),_&&(_.value=r.hours>=12?"pm":"am",_.disabled=this._isInteractionBlocked()||this._isReadonly());const x=this._isInteractionBlocked()||this._isReadonly();this._overlay.querySelectorAll(".action").forEach(d=>{d.disabled=x}),t||this._schedulePosition.run()}_renderOverlay(){this._syncOverlayState()}_applyTimeFromSurface(t){const e=t.querySelector('select[data-segment="hours"]'),i=t.querySelector('select[data-segment="minutes"]'),s=t.querySelector('select[data-segment="meridiem"]');if(!e||!i)return;const a=Number(e.value),o=Number(i.value);if(!Number.isFinite(a)||!Number.isFinite(o))return;let n=a;if(this._is12h()){const r=(s==null?void 0:s.value)==="pm"?"pm":"am";r==="pm"&&n<12&&(n+=12),r==="am"&&n===12&&(n=0)}this._pending=this._clampState({date:this._pending.date,time:`${h(n)}:${h(o)}`}),this._emitInput("time")}_onRootClick(t){var s;const e=t.target;if(!e)return;const i=(s=e.closest("[data-action]"))==null?void 0:s.getAttribute("data-action");if(i&&!(this._isInteractionBlocked()||this._isReadonly())){if(i==="toggle"){this._restoreFocusEl=e,this._setOpen(!this._open,"toggle");return}if(i==="clear"){this._isInlineMode()?(this._pending={date:null,time:null},this._emitInput("clear"),this._updateHostState()):this._commit({date:null,time:null},"clear");return}if(this._isInlineMode()&&i==="now"){const a=new Date,o=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),r=`${a.getFullYear()}-${o}-${n}`,u=`${h(a.getHours())}:${h(a.getMinutes())}`;this._pending=this._clampState({date:r,time:u}),this._emitInput("now"),this._updateHostState();return}if(this._isInlineMode()&&i==="cancel"){this._pending={...this._value},this._updateHostState();return}this._isInlineMode()&&i==="apply"&&this._commit(this._pending,"apply")}}_onRootChange(t){if(!this._isInlineMode())return;const e=t.target;if(e){if(e.tagName.toLowerCase()==="ui-calendar"){this._onOverlayCalendar(t);return}if(e instanceof HTMLSelectElement&&e.closest(".inline-panel")){if(!e.matches("select[data-segment]")||this._isInteractionBlocked()||this._isReadonly())return;const i=this.root.querySelector(".inline-panel");if(!i)return;if(this._applyTimeFromSurface(i),this._shouldAutoCommit()&&this._pending.date&&this._pending.time){this._commit(this._pending,"time");return}this._updateHostState()}}}_onRootInput(t){const e=t.target;e instanceof HTMLInputElement&&e.classList.contains("input")&&this._allowInput()&&(this._isInteractionBlocked()||(this._draft=e.value,this._inlineError="",this._emitInput("typing")))}_onRootBlur(t){const e=t.target;if(!(e instanceof HTMLInputElement)||!e.classList.contains("input")||!this._allowInput()||this._isInteractionBlocked())return;const i=this._draft.trim();if(!i){this._commit({date:null,time:null},"blur");return}const s=/^(.+)\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]m)?)$/i.exec(i);if(!s){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}const a=this._parseDateInput(s[1]),o=l.parseTimeInput(s[2],!0)?s[2]:null;if(!a||!o){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}this._commit({date:a,time:o},"blur")}_onRootKeyDown(t){const e=t;if(!this._isInteractionBlocked()){if(e.key==="Escape"&&this._open&&!this._isInlineMode()){e.preventDefault(),this._setOpen(!1,"escape");return}e.key==="ArrowDown"&&!this._open&&!this._isInlineMode()&&(e.preventDefault(),this._setOpen(!0,"keyboard"))}}_onOverlayClick(t){var s;const e=t.target;if(!e)return;const i=(s=e.closest("[data-action]"))==null?void 0:s.getAttribute("data-action");if(i&&!this._isInteractionBlocked()&&!(this._isReadonly()&&i!=="toggle")){if(i==="backdrop"){this._setOpen(!1,"outside");return}if(i==="cancel"){this._pending={...this._value},this._setOpen(!1,"cancel");return}if(i==="clear"){this._pending={date:null,time:null},this._emitInput("clear"),this._renderOverlay();return}if(i==="now"){const a=new Date,o=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),r=`${a.getFullYear()}-${o}-${n}`,u=`${h(a.getHours())}:${h(a.getMinutes())}`;this._pending=this._clampState({date:r,time:u}),this._emitInput("now"),this._renderOverlay();return}i==="apply"&&(this._commit(this._pending,"apply"),this._setOpen(!1,"apply"))}}_onOverlayChange(t){const e=t.target;e instanceof HTMLSelectElement&&e.matches("select[data-segment]")&&(this._isInteractionBlocked()||this._overlay&&(this._applyTimeFromSurface(this._overlay),this._shouldAutoCommit()&&this._pending.date&&this._pending.time&&(this._commit(this._pending,"time"),this._setOpen(!1,"time"))))}_onOverlayCalendar(t){if(this._isInteractionBlocked()||this._isReadonly())return;const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-calendar")return;const i=t.type,s=t.detail,a=l.normalizeDateIso(i==="select"?(s==null?void 0:s.value)||null:s==null?void 0:s.value);if(a){if(this._pending=this._clampState({date:a,time:this._pending.time||"09:00"}),this._emitInput("calendar"),this._shouldAutoCommit()&&this._pending.time){this._commit(this._pending,"calendar"),this._setOpen(!1,"calendar");return}this._updateHostState()}}_onDocumentPointerDown(t){if(!this._open||!this._overlay)return;const e=t.composedPath();e.includes(this)||e.includes(this._overlay)||this._setOpen(!1,"outside")}_onDocumentKeyDown(t){this._open&&t.key==="Escape"&&(t.preventDefault(),this._setOpen(!1,"escape"))}_updateHostState(){if(!this._hasView)return;const t=this.getAttribute("label")||"",e=this.getAttribute("hint")||"",i=this.getAttribute("error")||"",s=this._inlineError||i,a=!!y(this._value),o=this.getAttribute("name")||"",n=this._allowInput()?this._draft:this._formatDisplay(this._value),r=this._isInlineMode(),u=this._translations(),f=s?"error":this._state();this._state()==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const _=this.root.querySelector(".label"),x=this.root.querySelector(".label-text"),k=this.root.querySelector(".required"),d=this.root.querySelector(".input"),I=this.root.querySelector('.btn[data-action="clear"]'),g=this.root.querySelector('.btn[data-action="toggle"]'),v=this.root.querySelector(".hint"),S=this.root.querySelector(".error"),w=this.root.querySelector(".hidden-input");if(_&&(_.hidden=!t),_&&(_.id=this._labelId,_.setAttribute("for",this._inputId)),x&&(x.textContent=t),k&&(k.hidden=!this.hasAttribute("required")),d&&(d.value!==n&&(d.value=n),d.id=this._inputId,d.placeholder=u.dateTimePlaceholder,d.readOnly=!this._allowInput()||this._isReadonly(),d.disabled=this._isInteractionBlocked(),d.required=this.hasAttribute("required"),d.autocomplete="off",d.setAttribute("role","combobox"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded",r?"false":String(this._open)),d.setAttribute("aria-controls",this._panelId),d.setAttribute("aria-invalid",s?"true":"false"),t?d.setAttribute("aria-labelledby",this._labelId):d.removeAttribute("aria-labelledby")),I&&(I.hidden=!(this._clearable()&&a),I.setAttribute("aria-label",u.clear),I.disabled=this._isInteractionBlocked()),g&&(g.hidden=r,g.setAttribute("aria-label",u.toggleCalendar),g.setAttribute("aria-expanded",r?"false":String(this._open)),g.setAttribute("aria-controls",this._panelId),g.disabled=this._isInteractionBlocked()),v&&(v.id=this._hintId,v.hidden=!e,v.textContent=e),S&&(S.id=this._errorId,S.hidden=!s,S.textContent=s),d){const b=[];e&&v&&!v.hidden&&b.push(this._hintId),s&&b.push(this._errorId),b.length?d.setAttribute("aria-describedby",b.join(" ")):d.removeAttribute("aria-describedby")}w&&(w.disabled=!o,w.name=o,w.value=y(this._value)||"");const A=this.root.querySelector(".field");A&&(A.dataset.open=this._open&&!r?"true":"false",A.dataset.invalid=s?"true":"false",A.dataset.state=f);const c=this.root.querySelector(".inline-panel");if(c){c.hidden=!r,c.id=this._panelId,c.dataset.bare=this._isBare()?"true":"false",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false"),c.setAttribute("aria-label",t||u.selectDate);const b=c.querySelector(".panel-title");b&&(b.textContent=t,b.hidden=!t);const D=c.querySelector(".head-title");D&&(D.textContent=t,D.hidden=!t);const T=c.querySelector(".head-meta");T&&(T.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):u.selectDate);const L=c.querySelector('[data-action="now"]');L&&(L.textContent=u.now);const q=c.querySelector('[data-action="clear"]');q&&(q.textContent=u.clear);const R=c.querySelector('[data-action="apply"]');R&&(R.textContent=u.apply);const E=c.querySelector(".footer");E&&(E.hidden=!this._showFooter());const M=c.querySelector(".dt-calendar-inline");M&&this._syncCalendar(M);const O=c.querySelector('select[data-segment="hours"]'),$=c.querySelector('select[data-segment="minutes"]'),B=c.querySelector('select[data-segment="meridiem"]'),C=l.parseTimeInput(this._pending.time||"00:00",!0)||{hours:0,minutes:0,seconds:0};if(O){const z=this._is12h()?C.hours%12||12:C.hours;this._setClosestOptionValue(O,z),O.disabled=this._isInteractionBlocked()||this._isReadonly()}$&&(this._setClosestOptionValue($,C.minutes),$.disabled=this._isInteractionBlocked()||this._isReadonly()),B&&(B.value=C.hours>=12?"pm":"am",B.disabled=this._isInteractionBlocked()||this._isReadonly()),c.querySelectorAll(".action").forEach(z=>{z.disabled=this._isInteractionBlocked()||this._isReadonly()})}!r&&this._open&&this._syncOverlayState(),r&&this._destroyOverlay()}render(){if(!this._hasView){const t=this._translations();this.setContent(`
|
|
474
474
|
<style>${Y}</style>
|
|
475
475
|
<div class="root">
|
|
476
476
|
<label class="label" part="label" id="${this._labelId}">
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { E as W } from "./ElementBase-909688f3.mjs";
|
|
2
2
|
import { c as Y } from "./dismissable-layer-9c7e6b58.mjs";
|
|
3
3
|
import { r as J } from "./calendar-2c11b824.mjs";
|
|
4
|
-
import { r as G, e as Q, i as v, s as X, b as tt, f as et, t as it, n as R, d as st, p as F, o as N, a as nt, m as E, j as Z, k as j, q as y, l as rt, c as at } from "./date-time-utils-
|
|
4
|
+
import { r as G, e as Q, i as v, s as X, b as tt, f as et, t as it, n as R, d as st, p as F, o as N, a as nt, m as E, j as Z, k as j, q as y, l as rt, c as at } from "./date-time-utils-a2c7af25.mjs";
|
|
5
5
|
import "./scroll-lock-31da444f.mjs";
|
|
6
|
+
import "./positioner-e9770c66.mjs";
|
|
6
7
|
let ot = 0;
|
|
7
8
|
const lt = `
|
|
8
9
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./calendar-a8735e40.js"),C=require("./scroll-lock-d7b0df21.js"),I=require("./positioner-33529bb8.js"),w=new Map,v=24;function y(t,e,n){return Math.max(e,Math.min(n,t))}function s(t){return String(t).padStart(2,"0")}function b(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function N(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function O(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 U(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 F(t,e){const n=typeof t.composedPath=="function"?t.composedPath():[];for(const o of e)if(o&&n.includes(o))return!0;const r=t.target;if(!(r instanceof Node))return!1;for(const o of e)if(o instanceof Node&&o.contains(r))return!0;return!1}function P(t){const e=(t||"").trim();return e||(typeof navigator<"u"&&navigator.language?navigator.language:"en-US")}function m(t){if(!t)return null;const e=l.parseISO(t);return e?`${e.y}-${s(e.m)}-${s(e.d)}`:null}function g(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=m(e[1]);if(!n)return null;const r=d(e[2],!0);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:M(r,o)}}function z(t,e){if(!t||!e)return null;const n=m(t),r=d(e,!0);return!n||!r?null:`${n}T${M(r,e.split(":").length>=3)}`}function A(t){if(!t)return null;const e=m(t);if(e)return e;const n=g(t);return(n==null?void 0:n.date)||null}function Y(t){if(!t)return null;const e=g(t);if(e)return e;const n=m(t);return n?{date:n,time:"00:00"}:null}function k(t,e,n){const r=l.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify(n||{})}`;let i=w.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC",...n||{}}),w.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function q(t,e,n,r){if(!t)return"";if(n==="iso")return t;if(n==="custom"&&r){const o=l.parseISO(t);if(!o)return t;const i=O(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 k(t,e)}function B(t,e){const n=m(t.trim());if(n)return n;const r=N(t);if(!r)return null;const o=m(r);if(o)return o;const i=r.split("/").map($=>$.trim()).filter(Boolean);if(i.length!==3)return null;const u=b(i[0]),a=b(i[1]),h=b(i[2]);if(u==null||a==null||h==null)return null;let f=h;f<100&&(f+=f>=70?1900:2e3);const p=e.toLowerCase().startsWith("en-us"),c=p?u:a,D=p?a:u;if(f<1e3||c<1||c>12||D<1||D>31)return null;const T=`${f}-${s(c)}-${s(D)}`;return m(T)}function d(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 M(t,e=!1){if(!t)return"";const n=s(y(t.hours,0,23)),r=s(y(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=s(y(t.seconds,0,59));return`${n}:${r}:${o}`}function x(t,e){const n=d(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 S(t,e){const n=d(t,!0),r=d(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 H(t,e,n){const r=d(t,!0);if(!r)return t;let o=M(r,t.split(":").length>=3);return e&&S(o,e)<0&&(o=e),n&&S(o,n)>0&&(o=n),o}function E(t,e,n){let r=t;return e&&l.compareISO(r,e)<0&&(r=e),n&&l.compareISO(r,n)>0&&(r=n),r}function W(t,e){const n=g(t),r=g(e);if(!n||!r)return t.localeCompare(e);const o=l.compareISO(n.date,r.date);return o!==0?o:S(n.time,r.time)}function Z(t){const e=l.parseISO(t);if(!e)return{start:t,end:t};const n=l.startOfMonth(e.y,e.m),r=l.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 _(t,e){const n=y(e,1,366);return{start:l.addDaysISO(t,-(n-1)),end:t}}function R(t,e,n=8,r=8,o=null){const u=(typeof window<"u"?window.innerHeight:800)-t.bottom-r-n,a=t.top-r-n,h=u>=e.height,f=a>=e.height,p=o==="top"?"top":"bottom";let c;if(h&&!f)c="bottom";else if(f&&!h)c="top";else if(f&&h)c=p;else{const T=p==="bottom"?u:a,$=p==="bottom"?a:u;T>0&&$<=T+v?c=p:c=u>=a?"bottom":"top"}const D=I.computePositionState(t,e,{placement:`${c}-start`,strategy:"fixed",offset:r,shift:!1,flip:!1,boundaryPadding:n});return{top:Math.round(D.y),left:Math.round(D.x),placement:c}}function G(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 K(){return C.acquireBodyScrollLock()}exports.clampDateIso=E;exports.clampTime=H;exports.combineDateTime=z;exports.compareDateTimes=W;exports.compareTimes=S;exports.computeLastDaysRange=_;exports.computeMonthRange=Z;exports.computePopoverPosition=R;exports.eventOriginatesWithin=F;exports.formatDateForDisplay=q;exports.formatTime=M;exports.isTruthyAttr=U;exports.lockBodyScroll=K;exports.normalizeDateIso=m;exports.normalizeLocale=P;exports.parseConstraintDate=A;exports.parseConstraintDateTime=Y;exports.parseTimeInput=d;exports.parseUserDateInput=B;exports.rafThrottle=G;exports.shouldUseMobileSheet=J;exports.splitDateTime=g;exports.to12hDisplay=x;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { p as T, c as b, s as N, e as v, a as F } from "./calendar-2c11b824.mjs";
|
|
2
|
+
import { a as L } from "./scroll-lock-31da444f.mjs";
|
|
3
|
+
import { c as U } from "./positioner-e9770c66.mjs";
|
|
4
|
+
const C = /* @__PURE__ */ new Map(), I = 24;
|
|
5
|
+
function D(t, e, n) {
|
|
6
|
+
return Math.max(e, Math.min(n, t));
|
|
7
|
+
}
|
|
8
|
+
function u(t) {
|
|
9
|
+
return String(t).padStart(2, "0");
|
|
10
|
+
}
|
|
11
|
+
function $(t) {
|
|
12
|
+
if (!/^-?\d+$/.test(t))
|
|
13
|
+
return null;
|
|
14
|
+
const e = Number(t);
|
|
15
|
+
return Number.isFinite(e) ? Math.trunc(e) : null;
|
|
16
|
+
}
|
|
17
|
+
function O(t) {
|
|
18
|
+
return t.replace(/[.\-]/g, "/").replace(/\s+/g, " ").trim();
|
|
19
|
+
}
|
|
20
|
+
function P(t) {
|
|
21
|
+
const e = [];
|
|
22
|
+
for (let n = 0; n < 12; n += 1)
|
|
23
|
+
e.push(
|
|
24
|
+
new Intl.DateTimeFormat(t, {
|
|
25
|
+
month: "short",
|
|
26
|
+
timeZone: "UTC"
|
|
27
|
+
}).format(new Date(Date.UTC(2024, n, 1)))
|
|
28
|
+
);
|
|
29
|
+
return e;
|
|
30
|
+
}
|
|
31
|
+
function A(t) {
|
|
32
|
+
const e = [];
|
|
33
|
+
for (let n = 0; n < 12; n += 1)
|
|
34
|
+
e.push(
|
|
35
|
+
new Intl.DateTimeFormat(t, {
|
|
36
|
+
month: "long",
|
|
37
|
+
timeZone: "UTC"
|
|
38
|
+
}).format(new Date(Date.UTC(2024, n, 1)))
|
|
39
|
+
);
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
function B(t, e = !1) {
|
|
43
|
+
if (t == null)
|
|
44
|
+
return e;
|
|
45
|
+
const n = t.trim().toLowerCase();
|
|
46
|
+
return n ? n !== "false" && n !== "0" && n !== "off" && n !== "no" : !0;
|
|
47
|
+
}
|
|
48
|
+
function H(t, e) {
|
|
49
|
+
const n = typeof t.composedPath == "function" ? t.composedPath() : [];
|
|
50
|
+
for (const o of e)
|
|
51
|
+
if (o && n.includes(o))
|
|
52
|
+
return !0;
|
|
53
|
+
const r = t.target;
|
|
54
|
+
if (!(r instanceof Node))
|
|
55
|
+
return !1;
|
|
56
|
+
for (const o of e)
|
|
57
|
+
if (o instanceof Node && o.contains(r))
|
|
58
|
+
return !0;
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
function q(t) {
|
|
62
|
+
const e = (t || "").trim();
|
|
63
|
+
return e || (typeof navigator < "u" && navigator.language ? navigator.language : "en-US");
|
|
64
|
+
}
|
|
65
|
+
function m(t) {
|
|
66
|
+
if (!t)
|
|
67
|
+
return null;
|
|
68
|
+
const e = T(t);
|
|
69
|
+
return e ? `${e.y}-${u(e.m)}-${u(e.d)}` : null;
|
|
70
|
+
}
|
|
71
|
+
function y(t) {
|
|
72
|
+
if (!t)
|
|
73
|
+
return null;
|
|
74
|
+
const e = /^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());
|
|
75
|
+
if (!e)
|
|
76
|
+
return null;
|
|
77
|
+
const n = m(e[1]);
|
|
78
|
+
if (!n)
|
|
79
|
+
return null;
|
|
80
|
+
const r = h(e[2], !0);
|
|
81
|
+
if (!r)
|
|
82
|
+
return null;
|
|
83
|
+
const o = e[2].split(":").length === 3;
|
|
84
|
+
return { date: n, time: w(r, o) };
|
|
85
|
+
}
|
|
86
|
+
function E(t, e) {
|
|
87
|
+
if (!t || !e)
|
|
88
|
+
return null;
|
|
89
|
+
const n = m(t), r = h(e, !0);
|
|
90
|
+
return !n || !r ? null : `${n}T${w(r, e.split(":").length >= 3)}`;
|
|
91
|
+
}
|
|
92
|
+
function Z(t) {
|
|
93
|
+
if (!t)
|
|
94
|
+
return null;
|
|
95
|
+
const e = m(t);
|
|
96
|
+
if (e)
|
|
97
|
+
return e;
|
|
98
|
+
const n = y(t);
|
|
99
|
+
return (n == null ? void 0 : n.date) || null;
|
|
100
|
+
}
|
|
101
|
+
function _(t) {
|
|
102
|
+
if (!t)
|
|
103
|
+
return null;
|
|
104
|
+
const e = y(t);
|
|
105
|
+
if (e)
|
|
106
|
+
return e;
|
|
107
|
+
const n = m(t);
|
|
108
|
+
return n ? { date: n, time: "00:00" } : null;
|
|
109
|
+
}
|
|
110
|
+
function z(t, e, n) {
|
|
111
|
+
const r = T(t);
|
|
112
|
+
if (!r)
|
|
113
|
+
return t;
|
|
114
|
+
const o = `${e}::${JSON.stringify(n || {})}`;
|
|
115
|
+
let s = C.get(o);
|
|
116
|
+
return s || (s = new Intl.DateTimeFormat(e, {
|
|
117
|
+
year: "numeric",
|
|
118
|
+
month: "short",
|
|
119
|
+
day: "2-digit",
|
|
120
|
+
timeZone: "UTC",
|
|
121
|
+
...n || {}
|
|
122
|
+
}), C.set(o, s)), s.format(new Date(Date.UTC(r.y, r.m - 1, r.d)));
|
|
123
|
+
}
|
|
124
|
+
function W(t, e, n, r) {
|
|
125
|
+
if (!t)
|
|
126
|
+
return "";
|
|
127
|
+
if (n === "iso")
|
|
128
|
+
return t;
|
|
129
|
+
if (n === "custom" && r) {
|
|
130
|
+
const o = T(t);
|
|
131
|
+
if (!o)
|
|
132
|
+
return t;
|
|
133
|
+
const s = P(e), i = A(e);
|
|
134
|
+
return r.replace(/YYYY/g, String(o.y)).replace(/MMM/g, s[o.m - 1] || "").replace(/MMMM/g, i[o.m - 1] || "").replace(/MM/g, u(o.m)).replace(/DD/g, u(o.d));
|
|
135
|
+
}
|
|
136
|
+
return z(t, e);
|
|
137
|
+
}
|
|
138
|
+
function j(t, e) {
|
|
139
|
+
const n = m(t.trim());
|
|
140
|
+
if (n)
|
|
141
|
+
return n;
|
|
142
|
+
const r = O(t);
|
|
143
|
+
if (!r)
|
|
144
|
+
return null;
|
|
145
|
+
const o = m(r);
|
|
146
|
+
if (o)
|
|
147
|
+
return o;
|
|
148
|
+
const s = r.split("/").map((M) => M.trim()).filter(Boolean);
|
|
149
|
+
if (s.length !== 3)
|
|
150
|
+
return null;
|
|
151
|
+
const i = $(s[0]), a = $(s[1]), d = $(s[2]);
|
|
152
|
+
if (i == null || a == null || d == null)
|
|
153
|
+
return null;
|
|
154
|
+
let f = d;
|
|
155
|
+
f < 100 && (f += f >= 70 ? 1900 : 2e3);
|
|
156
|
+
const l = e.toLowerCase().startsWith("en-us"), c = l ? i : a, p = l ? a : i;
|
|
157
|
+
if (f < 1e3 || c < 1 || c > 12 || p < 1 || p > 31)
|
|
158
|
+
return null;
|
|
159
|
+
const g = `${f}-${u(c)}-${u(p)}`;
|
|
160
|
+
return m(g);
|
|
161
|
+
}
|
|
162
|
+
function h(t, e) {
|
|
163
|
+
const n = t.trim().toLowerCase();
|
|
164
|
+
if (!n)
|
|
165
|
+
return null;
|
|
166
|
+
const r = /^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(n);
|
|
167
|
+
if (!r)
|
|
168
|
+
return null;
|
|
169
|
+
let o = Number(r[1]);
|
|
170
|
+
const s = Number(r[2] ?? "0"), i = Number(r[3] ?? "0");
|
|
171
|
+
if (!Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(i) || s < 0 || s > 59 || i < 0 || i > 59 || !e && i !== 0)
|
|
172
|
+
return null;
|
|
173
|
+
const a = r[4];
|
|
174
|
+
if (a) {
|
|
175
|
+
if (o < 1 || o > 12)
|
|
176
|
+
return null;
|
|
177
|
+
a === "pm" && o < 12 && (o += 12), a === "am" && o === 12 && (o = 0);
|
|
178
|
+
}
|
|
179
|
+
return o < 0 || o > 23 ? null : { hours: o, minutes: s, seconds: i };
|
|
180
|
+
}
|
|
181
|
+
function w(t, e = !1) {
|
|
182
|
+
if (!t)
|
|
183
|
+
return "";
|
|
184
|
+
const n = u(D(t.hours, 0, 23)), r = u(D(t.minutes, 0, 59));
|
|
185
|
+
if (!e)
|
|
186
|
+
return `${n}:${r}`;
|
|
187
|
+
const o = u(D(t.seconds, 0, 59));
|
|
188
|
+
return `${n}:${r}:${o}`;
|
|
189
|
+
}
|
|
190
|
+
function G(t, e) {
|
|
191
|
+
const n = h(t, !0);
|
|
192
|
+
if (!n)
|
|
193
|
+
return t;
|
|
194
|
+
const r = /* @__PURE__ */ new Date();
|
|
195
|
+
return r.setHours(n.hours, n.minutes, n.seconds, 0), new Intl.DateTimeFormat(e, {
|
|
196
|
+
hour: "numeric",
|
|
197
|
+
minute: "2-digit",
|
|
198
|
+
second: t.split(":").length > 2 ? "2-digit" : void 0,
|
|
199
|
+
hour12: !0
|
|
200
|
+
}).format(r);
|
|
201
|
+
}
|
|
202
|
+
function S(t, e) {
|
|
203
|
+
const n = h(t, !0), r = h(e, !0);
|
|
204
|
+
if (!n || !r)
|
|
205
|
+
return t.localeCompare(e);
|
|
206
|
+
const o = n.hours * 3600 + n.minutes * 60 + n.seconds, s = r.hours * 3600 + r.minutes * 60 + r.seconds;
|
|
207
|
+
return o - s;
|
|
208
|
+
}
|
|
209
|
+
function J(t, e, n) {
|
|
210
|
+
const r = h(t, !0);
|
|
211
|
+
if (!r)
|
|
212
|
+
return t;
|
|
213
|
+
let o = w(r, t.split(":").length >= 3);
|
|
214
|
+
return e && S(o, e) < 0 && (o = e), n && S(o, n) > 0 && (o = n), o;
|
|
215
|
+
}
|
|
216
|
+
function K(t, e, n) {
|
|
217
|
+
let r = t;
|
|
218
|
+
return e && b(r, e) < 0 && (r = e), n && b(r, n) > 0 && (r = n), r;
|
|
219
|
+
}
|
|
220
|
+
function V(t, e) {
|
|
221
|
+
const n = y(t), r = y(e);
|
|
222
|
+
if (!n || !r)
|
|
223
|
+
return t.localeCompare(e);
|
|
224
|
+
const o = b(n.date, r.date);
|
|
225
|
+
return o !== 0 ? o : S(n.time, r.time);
|
|
226
|
+
}
|
|
227
|
+
function Q(t) {
|
|
228
|
+
const e = T(t);
|
|
229
|
+
if (!e)
|
|
230
|
+
return { start: t, end: t };
|
|
231
|
+
const n = N(e.y, e.m), r = v(e.y, e.m);
|
|
232
|
+
return {
|
|
233
|
+
start: `${n.y}-${u(n.m)}-${u(n.d)}`,
|
|
234
|
+
end: `${r.y}-${u(r.m)}-${u(r.d)}`
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function R(t, e) {
|
|
238
|
+
const n = D(e, 1, 366);
|
|
239
|
+
return {
|
|
240
|
+
start: F(t, -(n - 1)),
|
|
241
|
+
end: t
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function X(t, e, n = 8, r = 8, o = null) {
|
|
245
|
+
const i = (typeof window < "u" ? window.innerHeight : 800) - t.bottom - r - n, a = t.top - r - n, d = i >= e.height, f = a >= e.height, l = o === "top" ? "top" : "bottom";
|
|
246
|
+
let c;
|
|
247
|
+
if (d && !f)
|
|
248
|
+
c = "bottom";
|
|
249
|
+
else if (f && !d)
|
|
250
|
+
c = "top";
|
|
251
|
+
else if (f && d)
|
|
252
|
+
c = l;
|
|
253
|
+
else {
|
|
254
|
+
const g = l === "bottom" ? i : a, M = l === "bottom" ? a : i;
|
|
255
|
+
g > 0 && M <= g + I ? c = l : c = i >= a ? "bottom" : "top";
|
|
256
|
+
}
|
|
257
|
+
const p = U(t, e, {
|
|
258
|
+
placement: `${c}-start`,
|
|
259
|
+
strategy: "fixed",
|
|
260
|
+
offset: r,
|
|
261
|
+
shift: !1,
|
|
262
|
+
flip: !1,
|
|
263
|
+
boundaryPadding: n
|
|
264
|
+
});
|
|
265
|
+
return { top: Math.round(p.y), left: Math.round(p.x), placement: c };
|
|
266
|
+
}
|
|
267
|
+
function tt(t) {
|
|
268
|
+
let e = 0;
|
|
269
|
+
return { run: () => {
|
|
270
|
+
e || (e = requestAnimationFrame(() => {
|
|
271
|
+
e = 0, t();
|
|
272
|
+
}));
|
|
273
|
+
}, cancel: () => {
|
|
274
|
+
e && (cancelAnimationFrame(e), e = 0);
|
|
275
|
+
} };
|
|
276
|
+
}
|
|
277
|
+
function et(t) {
|
|
278
|
+
return (t || "popover") === "inline" || typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(max-width: 639px)").matches;
|
|
279
|
+
}
|
|
280
|
+
function nt() {
|
|
281
|
+
return L();
|
|
282
|
+
}
|
|
283
|
+
export {
|
|
284
|
+
K as a,
|
|
285
|
+
q as b,
|
|
286
|
+
X as c,
|
|
287
|
+
j as d,
|
|
288
|
+
H as e,
|
|
289
|
+
W as f,
|
|
290
|
+
R as g,
|
|
291
|
+
Q as h,
|
|
292
|
+
B as i,
|
|
293
|
+
E as j,
|
|
294
|
+
y as k,
|
|
295
|
+
nt as l,
|
|
296
|
+
V as m,
|
|
297
|
+
m as n,
|
|
298
|
+
_ as o,
|
|
299
|
+
Z as p,
|
|
300
|
+
h as q,
|
|
301
|
+
tt as r,
|
|
302
|
+
et as s,
|
|
303
|
+
G as t,
|
|
304
|
+
w as u,
|
|
305
|
+
J as v,
|
|
306
|
+
S as w
|
|
307
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./ElementBase-1b301e7f.js"),f=require("./positioner-33529bb8.js"),p=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -200,8 +200,8 @@
|
|
|
200
200
|
transition: none !important;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
`;function
|
|
204
|
-
<style>${
|
|
203
|
+
`;function g(i,t){if(i==null||i==="")return t;const e=Number(i);return Number.isFinite(e)?e:t}function h(i,t){if(i==null)return t;const e=i.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="off"}function _(i){if(!document.body.contains(i))return!1;const t=window.getComputedStyle(i);return!(t.display==="none"||t.visibility==="hidden"||Number.parseFloat(t.opacity||"1")<=0)}function m(i){return i==="top"||i==="bottom"?i:"auto"}function v(i){return i==="start"||i==="end"?i:"center"}function y(i,t){const e=i==="top"?"top":"bottom";return t==="start"?`${e}-start`:t==="end"?`${e}-end`:e}function w(i){const t='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',e=[];return i.forEach(o=>{o instanceof HTMLElement&&(o.matches(t)&&e.push(o),e.push(...Array.from(o.querySelectorAll(t))))}),Array.from(new Set(e))}class d extends b.ElementBase{constructor(){super(...arguments),this._anchor=null,this._panel=null,this._toolbarSlot=null,this._defaultSlot=null,this._raf=null,this._resizeObserver=null,this._mutationObserver=null,this._positioner=null,this._positionerPlacement=null,this._positionerOffset=0,this._globalListenersBound=!1,this._isOpen=!1,this._closeReason="programmatic",this._onWindowChangeBound=this._onWindowChange.bind(this),this._onDocumentPointerDownBound=this._onDocumentPointerDown.bind(this),this._onDocumentKeyDownBound=this._onDocumentKeyDown.bind(this),this._onPanelKeyDownBound=this._onPanelKeyDown.bind(this),this._onSlotChangeBound=this._onSlotChange.bind(this)}static get observedAttributes(){return["open","anchor-id","headless","disabled","placement","align","offset","close-on-outside","close-on-escape","aria-label","aria-labelledby","variant","density","shape","elevation","tone"]}connectedCallback(){super.connectedCallback(),this._syncAnchorFromAttribute(),this._syncOpenState(),this._schedulePosition()}disconnectedCallback(){var t;this._unbindGlobalListeners(),this._teardownObservers(),(t=this._positioner)==null||t.destroy(),this._positioner=null,this._raf!=null&&(cancelAnimationFrame(this._raf),this._raf=null),super.disconnectedCallback()}attributeChangedCallback(t,e,o){if(e!==o){if(t==="anchor-id"){this._syncAnchorFromAttribute(),this.hasAttribute("open")&&!this._anchor&&this._requestClose("anchor-missing"),this._schedulePosition();return}if(t==="open"){this._syncOpenState(),this._schedulePosition();return}if(t==="disabled"){this.hasAttribute("disabled")&&this.hasAttribute("open")&&this._requestClose("disabled");return}if(t==="headless"){this._syncOpenState(),this._schedulePosition();return}if(t==="aria-label"||t==="aria-labelledby"){this._syncPanelA11y();return}(t==="placement"||t==="align"||t==="offset")&&this._schedulePosition()}}showForAnchorId(t){if(this.hasAttribute("disabled")||!t)return;const e=document.getElementById(t);if(!e){this._requestClose("anchor-missing");return}this._anchor=e,this.setAttribute("anchor-id",t),this.openToolbar()}hide(){this.closeToolbar("programmatic")}openToolbar(){this.hasAttribute("disabled")||(this.hasAttribute("open")||this.setAttribute("open",""),this._schedulePosition())}closeToolbar(t="programmatic"){this.hasAttribute("open")&&(this._closeReason=t,this.removeAttribute("open"))}_syncOpenState(){var e;const t=this.hasAttribute("open")&&!this.hasAttribute("headless")&&!this.hasAttribute("disabled");if(t===this._isOpen){t&&this._schedulePosition();return}if(this._isOpen=t,t){this._bindGlobalListeners(),this._ensureObservers(),this._dispatchOpenEvents(),this._schedulePosition();return}this._unbindGlobalListeners(),this._teardownObservers(),(e=this._positioner)==null||e.destroy(),this._positioner=null,this._positionerPlacement=null,this._positionerOffset=0,this._raf!=null&&(cancelAnimationFrame(this._raf),this._raf=null),this._dispatchCloseEvents(this._closeReason),this._closeReason="programmatic"}_dispatchOpenEvents(){this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0}}))}_dispatchCloseEvents(t){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}))}_requestClose(t){if(!this.hasAttribute("open"))return;const e=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e);const o=new CustomEvent("ui-request-close",{detail:{reason:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(o),!(e.defaultPrevented||o.defaultPrevented)&&this.closeToolbar(t)}_syncAnchorFromAttribute(){const t=this.getAttribute("anchor-id");if(!t){this._anchor=null;return}this._anchor=document.getElementById(t)}_schedulePosition(){!this.hasAttribute("open")||this.hasAttribute("headless")||this.hasAttribute("disabled")||(this._raf!=null&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._raf=null,this._position()}))}_ensureObservers(){if(!(this._resizeObserver&&this._mutationObserver)){if(typeof ResizeObserver<"u"){if(this._resizeObserver=new ResizeObserver(()=>this._schedulePosition()),this._panel)try{this._resizeObserver.observe(this._panel)}catch{}if(this._anchor)try{this._resizeObserver.observe(this._anchor)}catch{}}if(typeof MutationObserver<"u"&&this._anchor){this._mutationObserver=new MutationObserver(()=>this._schedulePosition());try{this._mutationObserver.observe(this._anchor,{attributes:!0,childList:!1,subtree:!1})}catch{}}}}_teardownObservers(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}_refreshObservers(){this._isOpen&&(this._teardownObservers(),this._ensureObservers())}_bindGlobalListeners(){this._globalListenersBound||(window.addEventListener("scroll",this._onWindowChangeBound,{passive:!0,capture:!0}),window.addEventListener("resize",this._onWindowChangeBound),document.addEventListener("pointerdown",this._onDocumentPointerDownBound,!0),document.addEventListener("keydown",this._onDocumentKeyDownBound,!0),this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(window.removeEventListener("scroll",this._onWindowChangeBound,!0),window.removeEventListener("resize",this._onWindowChangeBound),document.removeEventListener("pointerdown",this._onDocumentPointerDownBound,!0),document.removeEventListener("keydown",this._onDocumentKeyDownBound,!0),this._globalListenersBound=!1)}_position(){var s,a;if(!this.hasAttribute("open")||this.hasAttribute("headless")||this.hasAttribute("disabled"))return;if(!this._anchor){this._requestClose("anchor-missing");return}if(!_(this._anchor)){this._requestClose("anchor-hidden");return}if(!this._panel)return;const t=Math.max(0,g(this.getAttribute("offset"),8)),e=m(this.getAttribute("placement")),o=v(this.getAttribute("align")),n=y(e,o);if(!this._positioner||this._positionerPlacement!==n||this._positionerOffset!==t){(s=this._positioner)==null||s.destroy(),this._positioner=f.createPositioner({anchor:this._anchor,floating:this._panel,placement:n,strategy:"fixed",offset:t,flip:!0,shift:!0,boundaryPadding:8,observeWindowResize:!1,observeScroll:!1,observeAncestorScroll:!1,observeAncestorResize:!1,observeLayoutShift:!1,observeAnchorResize:!1,observeFloatingResize:!1,onUpdate:l=>{var u;const c=l.placement.startsWith("top")?"top":"bottom";this.style.setProperty("--ui-floating-toolbar-origin-x",o==="start"?"0%":o==="end"?"100%":"50%"),(u=this._panel)==null||u.setAttribute("data-side",c)}}),this._positionerPlacement=n,this._positionerOffset=t;return}(a=this._positioner)==null||a.update()}_onWindowChange(){this.hasAttribute("open")&&this._schedulePosition()}_onDocumentPointerDown(t){if(!this.hasAttribute("open")||!h(this.getAttribute("close-on-outside"),!0))return;const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||this._requestClose("outside")}_onDocumentKeyDown(t){this.hasAttribute("open")&&t.key==="Escape"&&h(this.getAttribute("close-on-escape"),!0)&&(t.preventDefault(),this._requestClose("escape"))}_onPanelKeyDown(t){if(!this._panel||!["ArrowRight","ArrowLeft","Home","End"].includes(t.key))return;const e=this._getFocusableItems();if(e.length===0)return;const o=document.activeElement,n=o?e.indexOf(o):-1;let r=n;t.key==="Home"?r=0:t.key==="End"?r=e.length-1:t.key==="ArrowRight"?r=n<0?0:(n+1)%e.length:t.key==="ArrowLeft"&&(r=n<0?e.length-1:(n-1+e.length)%e.length);const s=e[r];s&&(t.preventDefault(),s.focus())}_getFocusableItems(){var o,n;const t=((o=this._toolbarSlot)==null?void 0:o.assignedElements({flatten:!0}))||[],e=((n=this._defaultSlot)==null?void 0:n.assignedElements({flatten:!0}))||[];return w([...t,...e])}_onSlotChange(){this._syncRowVisibility(),this._schedulePosition()}_syncRowVisibility(){var r,s;const t=this.root.querySelector(".row-toolbar"),e=this.root.querySelector(".row-default");if(!t||!e)return;const o=(((r=this._toolbarSlot)==null?void 0:r.assignedNodes({flatten:!0}))||[]).some(a=>{var l;return a.nodeType===Node.TEXT_NODE?!!((l=a.textContent)!=null&&l.trim()):a.nodeType===Node.ELEMENT_NODE}),n=(((s=this._defaultSlot)==null?void 0:s.assignedNodes({flatten:!0}))||[]).some(a=>{var l;return a.nodeType===Node.TEXT_NODE?!!((l=a.textContent)!=null&&l.trim()):a.nodeType===Node.ELEMENT_NODE});o?t.removeAttribute("hidden"):t.setAttribute("hidden",""),n?e.removeAttribute("hidden"):e.setAttribute("hidden","")}_syncPanelA11y(){if(!this._panel)return;const t=this.getAttribute("aria-labelledby"),e=this.getAttribute("aria-label")||(t?null:"Floating toolbar");t?this._panel.setAttribute("aria-labelledby",t):this._panel.removeAttribute("aria-labelledby"),e?this._panel.setAttribute("aria-label",e):this._panel.removeAttribute("aria-label")}render(){var t,e,o,n,r,s;this.setContent(`
|
|
204
|
+
<style>${p}</style>
|
|
205
205
|
<section class="panel" part="panel" role="toolbar" aria-orientation="horizontal" tabindex="-1">
|
|
206
206
|
<div class="row row-toolbar" part="row-toolbar">
|
|
207
207
|
<slot name="toolbar"></slot>
|
|
@@ -210,4 +210,4 @@
|
|
|
210
210
|
<slot></slot>
|
|
211
211
|
</div>
|
|
212
212
|
</section>
|
|
213
|
-
`),this._panel=this.root.querySelector(".panel"),this._toolbarSlot=this.root.querySelector('slot[name="toolbar"]'),this._defaultSlot=this.root.querySelector("slot:not([name])"),(t=this._panel)==null||t.removeEventListener("keydown",this._onPanelKeyDownBound),(e=this._panel)==null||e.addEventListener("keydown",this._onPanelKeyDownBound),(o=this._toolbarSlot)==null||o.removeEventListener("slotchange",this._onSlotChangeBound),(n=this._defaultSlot)==null||n.removeEventListener("slotchange",this._onSlotChangeBound),(r=this._toolbarSlot)==null||r.addEventListener("slotchange",this._onSlotChangeBound),(s=this._defaultSlot)==null||s.addEventListener("slotchange",this._onSlotChangeBound),this._syncPanelA11y(),this._syncRowVisibility(),this._refreshObservers(),this._schedulePosition()}}typeof customElements<"u"&&!customElements.get("ui-floating-toolbar")&&customElements.define("ui-floating-toolbar",
|
|
213
|
+
`),this._panel=this.root.querySelector(".panel"),this._toolbarSlot=this.root.querySelector('slot[name="toolbar"]'),this._defaultSlot=this.root.querySelector("slot:not([name])"),(t=this._panel)==null||t.removeEventListener("keydown",this._onPanelKeyDownBound),(e=this._panel)==null||e.addEventListener("keydown",this._onPanelKeyDownBound),(o=this._toolbarSlot)==null||o.removeEventListener("slotchange",this._onSlotChangeBound),(n=this._defaultSlot)==null||n.removeEventListener("slotchange",this._onSlotChangeBound),(r=this._toolbarSlot)==null||r.addEventListener("slotchange",this._onSlotChangeBound),(s=this._defaultSlot)==null||s.addEventListener("slotchange",this._onSlotChangeBound),this._syncPanelA11y(),this._syncRowVisibility(),this._refreshObservers(),this._schedulePosition()}}typeof customElements<"u"&&!customElements.get("ui-floating-toolbar")&&customElements.define("ui-floating-toolbar",d);exports.UIFloatingToolbar=d;
|