@eunomia/elements 1.0.0-beta.2 → 1.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cdn/components/chunks/chunk-3LMI7KUA.js +48 -0
  2. package/dist/cdn/components/chunks/{chunk-74HHV4CX.js → chunk-53QH6MPM.js} +2 -2
  3. package/dist/cdn/components/chunks/{chunk-7WTSHE7M.js → chunk-EAGGN3ZI.js} +1 -1
  4. package/dist/cdn/components/chunks/chunk-GU6BVMFJ.js +1 -0
  5. package/dist/cdn/components/chunks/chunk-KNM5QHDK.js +38 -0
  6. package/dist/cdn/components/chunks/{chunk-AQQMW353.js → chunk-TBKKTJOX.js} +1 -1
  7. package/dist/cdn/components/chunks/chunk-YYCEPZUN.js +1 -0
  8. package/dist/cdn/components/chunks/{chunk-27Q2SLRY.js → chunk-Z6PJYSC3.js} +30 -11
  9. package/dist/cdn/components/eun-animate.js +178 -2
  10. package/dist/cdn/components/eun-button.js +1 -1
  11. package/dist/cdn/components/eun-card.js +15 -7
  12. package/dist/cdn/components/eun-carousel.js +1 -1
  13. package/dist/cdn/components/eun-check-card.js +1 -1
  14. package/dist/cdn/components/eun-checkbox-list.js +2 -2
  15. package/dist/cdn/components/eun-checkbox.js +1 -1
  16. package/dist/cdn/components/eun-chip.js +11 -14
  17. package/dist/cdn/components/eun-collapse.js +8 -15
  18. package/dist/cdn/components/eun-color-picker.js +19 -19
  19. package/dist/cdn/components/eun-counter.js +4 -4
  20. package/dist/cdn/components/eun-date-picker.js +2 -2
  21. package/dist/cdn/components/eun-icon.js +1 -1
  22. package/dist/cdn/components/eun-input-file.js +11 -11
  23. package/dist/cdn/components/eun-input-phone.js +3 -3
  24. package/dist/cdn/components/eun-input.js +1 -1
  25. package/dist/cdn/components/eun-radio-card.js +1 -1
  26. package/dist/cdn/components/eun-radio-list.js +3 -3
  27. package/dist/cdn/components/eun-radio.js +1 -1
  28. package/dist/cdn/components/eun-search.js +1 -1
  29. package/dist/cdn/components/eun-select.js +33 -12
  30. package/dist/cdn/components/eun-sidebar.js +1 -1
  31. package/dist/cdn/components/eun-slider.js +3 -3
  32. package/dist/cdn/components/eun-sliding-card.js +4 -8
  33. package/dist/cdn/components/eun-switch.js +1 -1
  34. package/dist/cdn/components/eun-table.js +1 -1
  35. package/dist/cdn/components/eun-tag.js +13 -9
  36. package/dist/cdn/components/eun-textarea.js +11 -11
  37. package/dist/cdn/components/eun-time-picker.js +2 -2
  38. package/dist/cdn/components/eun-toggle-group.js +2 -2
  39. package/dist/cdn/components/eun-toggle-item.js +1 -1
  40. package/dist/cdn/components/eun-toggle.js +2 -2
  41. package/dist/cdn/components/eun-toolbar.js +14 -12
  42. package/dist/cdn/components/eun-tooltip.js +2 -2
  43. package/dist/components/action/button/button.d.ts +5 -6
  44. package/dist/components/action/button/button.js +5 -6
  45. package/dist/components/action/button/button.styles.js +31 -9
  46. package/dist/components/action/toggle/toggle-group.js +1 -1
  47. package/dist/components/action/toggle/toggle-item.styles.js +1 -1
  48. package/dist/components/action/toggle/toggle.js +1 -1
  49. package/dist/components/content/card/card.d.ts +1 -1
  50. package/dist/components/content/card/card.js +1 -1
  51. package/dist/components/content/card/card.styles.js +13 -5
  52. package/dist/components/content/card/sliding-card.styles.js +0 -4
  53. package/dist/components/content/chip/chip.styles.js +6 -9
  54. package/dist/components/content/collapse/collapse.styles.js +0 -7
  55. package/dist/components/content/icon/icon.d.ts +48 -5
  56. package/dist/components/content/icon/icon.js +92 -20
  57. package/dist/components/content/tag/tag.styles.js +10 -6
  58. package/dist/components/content/tooltip/tooltip.styles.js +2 -2
  59. package/dist/components/form/checkbox/checkbox-list.js +1 -1
  60. package/dist/components/form/color-picker/color-picker.js +9 -7
  61. package/dist/components/form/counter/counter.js +3 -3
  62. package/dist/components/form/date-picker/date-picker.js +3 -3
  63. package/dist/components/form/input/input.js +2 -2
  64. package/dist/components/form/input-file/input-file.js +5 -5
  65. package/dist/components/form/input-phone/input-phone.js +3 -3
  66. package/dist/components/form/radio/radio-list.js +2 -2
  67. package/dist/components/form/select/select.d.ts +16 -0
  68. package/dist/components/form/select/select.js +28 -5
  69. package/dist/components/form/select/select.styles.js +11 -0
  70. package/dist/components/form/slider/slider.js +2 -2
  71. package/dist/components/form/textarea/textarea.js +4 -4
  72. package/dist/components/form/time-picker/time-picker.js +3 -3
  73. package/dist/components/layout/animate/animate.d.ts +40 -5
  74. package/dist/components/layout/animate/animate.js +30 -11
  75. package/dist/components/layout/animate/animate.styles.d.ts +1 -1
  76. package/dist/components/layout/animate/animate.styles.js +191 -1
  77. package/dist/components/navigation/carousel/carousel.styles.js +1 -1
  78. package/dist/components/navigation/toolbar/toolbar.d.ts +22 -0
  79. package/dist/components/navigation/toolbar/toolbar.js +28 -2
  80. package/dist/components/navigation/toolbar/toolbar.styles.js +4 -3
  81. package/dist/events/change.event.d.ts +13 -1
  82. package/dist/events/change.event.js +2 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +1 -1
  85. package/dist/mixins/check.mixin.js +6 -2
  86. package/dist/mixins/form.mixin.d.ts +4 -0
  87. package/dist/mixins/form.mixin.js +78 -2
  88. package/dist/mixins/radio.mixin.js +6 -2
  89. package/dist/ssr/animate-ssr.css +149 -0
  90. package/dist/ssr/overlay-ssr.css +57 -0
  91. package/dist/ssr/sidebar-ssr.css +57 -0
  92. package/dist/ssr/toolbar-ssr.css +41 -0
  93. package/package.json +9 -3
  94. package/dist/cdn/components/chunks/chunk-2IQUMAMI.js +0 -38
  95. package/dist/cdn/components/chunks/chunk-7Q6AHVI5.js +0 -1
  96. package/dist/cdn/components/chunks/chunk-DENMN3WH.js +0 -48
  97. package/dist/cdn/components/chunks/chunk-ONYUXQV2.js +0 -1
  98. package/dist/components/layout/animate/animate-ssr.css +0 -64
@@ -1,4 +1,4 @@
1
- import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk-LYYQAALT.js";import{a as i}from"./chunks/chunk-ONYUXQV2.js";import{e as g}from"./chunks/chunk-5TH3P53V.js";import{a as c}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as n,f as h,g as u,h as a,i as v,j as d,l,n as r,p as o,s as f}from"./chunks/chunk-XH6NREVZ.js";var m=u`
1
+ import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk-LYYQAALT.js";import{a as i}from"./chunks/chunk-YYCEPZUN.js";import{e as g}from"./chunks/chunk-5TH3P53V.js";import{a as c}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as n,f as h,g as u,h as o,i as v,j as d,l,n as r,p as a,s as f}from"./chunks/chunk-XH6NREVZ.js";var m=u`
2
2
  :host {
3
3
  display: block;
4
4
  width: 100%;
@@ -161,13 +161,6 @@ import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk
161
161
  #rich-text :last-child {
162
162
  margin-block-end: 0;
163
163
  }
164
- #rich-text p {
165
- margin-block: var(--eun-space-xs, 4px) 0;
166
- }
167
- #rich-text ul {
168
- margin-block: var(--eun-space-xs, 4px) 0;
169
- padding-inline-start: var(--eun-space-m, 16px);
170
- }
171
164
  #rich-text a {
172
165
  color: var(--_richTextLinkColor);
173
166
  }
@@ -223,11 +216,11 @@ import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk
223
216
  class=${c({hidden:!this.icon&&!this.iconSlotEls.length})}
224
217
  @slotchange=${this.handleSlotChange}
225
218
  >
226
- ${this.icon?r`<eun-icon name=${this.icon} size="20"></eun-icon>`:o}
219
+ ${this.icon?r`<eun-icon name=${this.icon} size="20"></eun-icon>`:a}
227
220
  </slot>
228
221
  <span id="heading-group">
229
222
  <span id="heading">${this.heading}</span>
230
- ${this.subheading?r`<span id="subheading">${this.subheading}</span>`:o}
223
+ ${this.subheading?r`<span id="subheading">${this.subheading}</span>`:a}
231
224
  </span>
232
225
  </span>
233
226
  <span id="actions">
@@ -238,11 +231,11 @@ import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk
238
231
  >
239
232
  ${this.tag?r`<eun-tag color="primary" size="s" rounded
240
233
  >${this.tag}</eun-tag
241
- >`:o}
234
+ >`:a}
242
235
  </slot>
243
236
  <span id="chevron">
244
237
  <slot name="chevron" @slotchange=${this.handleSlotChange}>
245
- ${this.chevronSlotEls.length?o:r`<eun-icon
238
+ ${this.chevronSlotEls.length?a:r`<eun-icon
246
239
  name=${this.chevronIcon}
247
240
  size="20"
248
241
  ></eun-icon>`}
@@ -256,17 +249,17 @@ import{a as b}from"./chunks/chunk-UDOZRIJZ.js";import{b as p}from"./chunks/chunk
256
249
  <div
257
250
  id="panel"
258
251
  ?inert=${!this.open&&(this.disabled||!p)}
259
- hidden=${this.panelHidden?"until-found":o}
252
+ hidden=${this.panelHidden?"until-found":a}
260
253
  @beforematch=${this.handleBeforeMatch}
261
254
  >
262
255
  <div id="panel-inner">
263
256
  <div id="panel-content">
264
257
  ${this.richText?r`<div id="rich-text">
265
258
  ${g(this.richText)}
266
- </div>`:o}
259
+ </div>`:a}
267
260
  <slot></slot>
268
261
  </div>
269
262
  </div>
270
263
  </div>
271
264
  </div>
272
- `}};t.styles=[m],n([a()],t.prototype,"heading",2),n([a()],t.prototype,"subheading",2),n([a({type:Number})],t.prototype,"level",2),n([a()],t.prototype,"icon",2),n([a()],t.prototype,"tag",2),n([a({attribute:"chevron-icon"})],t.prototype,"chevronIcon",2),n([a({attribute:"rich-text"})],t.prototype,"richText",2),n([a({type:Boolean,reflect:!0})],t.prototype,"open",2),n([a({type:Boolean,reflect:!0})],t.prototype,"disabled",2),n([a({type:Boolean,reflect:!0})],t.prototype,"independent",2),n([d("#header")],t.prototype,"headerEl",2),n([d("#panel-content")],t.prototype,"panelContentEl",2),n([d("#panel")],t.prototype,"panelEl",2),n([v()],t.prototype,"panelHidden",2),n([l({slot:"icon"})],t.prototype,"iconSlotEls",2),n([l({slot:"tag"})],t.prototype,"tagSlotEls",2),n([l({slot:"chevron"})],t.prototype,"chevronSlotEls",2),t=n([h(_)],t);export{t as EunomiaCollapse,_ as EunomiaCollapseTagName};
265
+ `}};t.styles=[m],n([o()],t.prototype,"heading",2),n([o()],t.prototype,"subheading",2),n([o({type:Number})],t.prototype,"level",2),n([o()],t.prototype,"icon",2),n([o()],t.prototype,"tag",2),n([o({attribute:"chevron-icon"})],t.prototype,"chevronIcon",2),n([o({attribute:"rich-text"})],t.prototype,"richText",2),n([o({type:Boolean,reflect:!0})],t.prototype,"open",2),n([o({type:Boolean,reflect:!0})],t.prototype,"disabled",2),n([o({type:Boolean,reflect:!0})],t.prototype,"independent",2),n([d("#header")],t.prototype,"headerEl",2),n([d("#panel-content")],t.prototype,"panelContentEl",2),n([d("#panel")],t.prototype,"panelEl",2),n([v()],t.prototype,"panelHidden",2),n([l({slot:"icon"})],t.prototype,"iconSlotEls",2),n([l({slot:"tag"})],t.prototype,"tagSlotEls",2),n([l({slot:"chevron"})],t.prototype,"chevronSlotEls",2),t=n([h(_)],t);export{t as EunomiaCollapse,_ as EunomiaCollapseTagName};
@@ -1,4 +1,4 @@
1
- import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk-E4IS25H7.js";import{a as z,b as N}from"./chunks/chunk-32KRPOPV.js";import{a as k,b as H}from"./chunks/chunk-T4PTHUYF.js";import{a as B}from"./chunks/chunk-LK5BJ4SH.js";import{a as V}from"./chunks/chunk-6UPI7GHJ.js";import{a as x}from"./chunks/chunk-LYYQAALT.js";import{a as S}from"./chunks/chunk-XSMCT4DF.js";import{a as F}from"./chunks/chunk-GW3VP2L7.js";import{a as O,c as R,d as D,e as y}from"./chunks/chunk-2IQUMAMI.js";import{a as C}from"./chunks/chunk-ONYUXQV2.js";import{a as M}from"./chunks/chunk-T7WABJEJ.js";import{a as c}from"./chunks/chunk-A4EQSU36.js";import{a as b,b as I,c as T}from"./chunks/chunk-SGM2X2TC.js";import{a as u}from"./chunks/chunk-5EVP7YNE.js";import{a as s,f as $,g as L,h as p,i as g,j as m,k as E,n as d,o as v,p as l,s as A}from"./chunks/chunk-XH6NREVZ.js";var f=I(class extends T{constructor(n){if(super(n),n.type!==b.PROPERTY&&n.type!==b.ATTRIBUTE&&n.type!==b.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!k(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[o]){if(o===v||o===l)return o;let e=n.element,t=n.name;if(n.type===b.PROPERTY){if(o===e[t])return v}else if(n.type===b.BOOLEAN_ATTRIBUTE){if(!!o===e.hasAttribute(t))return v}else if(n.type===b.ATTRIBUTE&&e.getAttribute(t)===o+"")return v;return H(n),o}});var U=L`
1
+ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk-E4IS25H7.js";import{a as z,b as N}from"./chunks/chunk-32KRPOPV.js";import{a as k,b as H}from"./chunks/chunk-T4PTHUYF.js";import{a as B}from"./chunks/chunk-LK5BJ4SH.js";import{a as V}from"./chunks/chunk-6UPI7GHJ.js";import{a as x}from"./chunks/chunk-LYYQAALT.js";import{a as S}from"./chunks/chunk-XSMCT4DF.js";import{a as F}from"./chunks/chunk-GW3VP2L7.js";import{a as O,c as R,d as D,e as y}from"./chunks/chunk-KNM5QHDK.js";import{a as C}from"./chunks/chunk-YYCEPZUN.js";import{a as M}from"./chunks/chunk-T7WABJEJ.js";import{a as c}from"./chunks/chunk-A4EQSU36.js";import{a as b,b as I,c as T}from"./chunks/chunk-SGM2X2TC.js";import{a as h}from"./chunks/chunk-5EVP7YNE.js";import{a as s,f as $,g as L,h as p,i as g,j as m,k as E,n as d,o as v,p as l,s as A}from"./chunks/chunk-XH6NREVZ.js";var f=I(class extends T{constructor(n){if(super(n),n.type!==b.PROPERTY&&n.type!==b.ATTRIBUTE&&n.type!==b.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!k(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[o]){if(o===v||o===l)return o;let e=n.element,t=n.name;if(n.type===b.PROPERTY){if(o===e[t])return v}else if(n.type===b.BOOLEAN_ATTRIBUTE){if(!!o===e.hasAttribute(t))return v}else if(n.type===b.ATTRIBUTE&&e.getAttribute(t)===o+"")return v;return H(n),o}});var U=L`
2
2
  button#field {
3
3
  flex: 1 1 auto;
4
4
  display: flex;
@@ -193,7 +193,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
193
193
  outline: 2px solid var(--_focusIndicator);
194
194
  outline-offset: 2px;
195
195
  }
196
- `,P=[V,z,...x?[]:[N],U];function w(n){let o=n.trim();if(!o)return null;if(/^#[0-9a-f]{6}$/i.test(o))return o.toLowerCase();if(/^#[0-9a-f]{3}$/i.test(o)){let[i,r,h]=o.slice(1);return`#${i}${i}${r}${r}${h}${h}`.toLowerCase()}let e=o.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(!e)return null;let t=i=>Math.min(255,Math.max(0,Math.round(Number(i)))).toString(16).padStart(2,"0");return`#${t(e[1])}${t(e[2])}${t(e[3])}`}var Y="eun-color-picker",j=M(D(A)),G=B(S(F(O(_(R(j)))))),a=class extends G{constructor(){super(...arguments);this.emptyValueLabel="No color selected";this.swatchesLabel="Presets";this.customLabel="Custom";this.nativeInputLabel="Pick a custom color";this.hexInputLabel="Hex color";this.confirmLabel="Confirm";this.cancelLabel="Cancel";this.noAnimation=!1;this.swatchOnly=!1;this.presetsOnly=!1;this.presetsInline=!1;this.isOpen=!1;this.hexDraft="";this.handlePopoverToggle=e=>{if(e.newState==="open"){this.isOpen=!0,this.fieldWrapperEl&&this.listboxEl&&this.anchorFloatingElement(this.fieldWrapperEl,this.listboxEl,{forceFallback:x}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closeListbox());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility()};this.handleWindowBlur=()=>{this.isOpen&&this.closeListbox()};this.handleFocusOut=()=>{this.isOpen&&requestAnimationFrame(()=>{document.activeElement!==this&&this.closeListbox()})};this.handleConfirmClick=()=>{this.closeListbox(),this.confirmEdit()};this.handleCancelClick=()=>{this.closeListbox(),this.cancelEdit()}}get defaultValue(){return super.defaultValue}set defaultValue(e){let t=Array.isArray(e)?e[0]:e;super.defaultValue=t}get presets(){return W(this.children)}get hexDraftInvalid(){return this.hexDraft!==""&&w(this.hexDraft)===null}get triggerAccessibleLabel(){return this.label?this.label:this.ariaLabel?this.ariaLabel:this.swatchOnly?this.value||this.emptyValueLabel:void 0}connectedCallback(){super.connectedCallback?.(),window.addEventListener("blur",this.handleWindowBlur)}disconnectedCallback(){window.removeEventListener("blur",this.handleWindowBlur),super.disconnectedCallback?.()}willUpdate(e){super.willUpdate(e),e.has("value")&&!this.isOpen&&(this.hexDraft=this.value??"")}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}openListbox(){if(this.disabled||this.readonly)return;this.hexDraft=this.value??"";let e=this.listboxEl;this.listboxAnimation?.cancel(),this.listboxAnimation=void 0,e?.matches(":popover-open")||e?.showPopover(),e&&this.playListboxOpenAnimation(e)}listboxAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--field-listbox-transition-duration").trim();if(t){let i=t.endsWith("ms")?Number.parseFloat(t):Number.parseFloat(t)*1e3;if(Number.isFinite(i)&&i>=0)return i}return 200}playListboxOpenAnimation(e){e.style.removeProperty("pointer-events");let t=this.listboxAnimationDuration(e);t!==0&&(this.listboxAnimation=e.animate([{opacity:0,transform:"scaleY(0.01)"},{opacity:1,transform:"scaleY(1)"}],{duration:t,easing:"ease",fill:"forwards"}))}closeListbox(){let e=this.listboxEl;this.listboxAnimation?.cancel(),this.listboxAnimation=void 0,e?.matches(":popover-open")&&this.playListboxCloseAnimation(e)}playListboxCloseAnimation(e){e.style.pointerEvents="none";let t=this.listboxAnimationDuration(e);if(t===0){e.hidePopover();return}let i=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.listboxAnimation=i,i.finished.then(()=>{this.listboxAnimation===i&&(this.listboxAnimation=void 0),e.hidePopover()}).catch(()=>{})}handleFieldActivate(){this.isOpen||this.openListbox()}handleFieldKeydown(e){e.key==="ArrowDown"&&!this.isOpen&&(e.preventDefault(),this.openListbox())}handleSelect(e){this.value=e,this.hexDraft=e,this.dispatchEvent(new C),this.closeListbox()}handlePresetKeydown(e,t){let i=this.presets,r;switch(e.key){case"ArrowRight":case"ArrowDown":r=(t+1)%i.length;break;case"ArrowLeft":case"ArrowUp":r=(t-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;default:return}e.preventDefault(),this.presetButtonEls[r]?.focus()}handleNativeInput(e){this.handleSelect(e.target.value)}handleHexInput(e){this.hexDraft=e.target.value}handleHexCommit(){let e=w(this.hexDraft);e?this.handleSelect(e):this.hexDraft=this.value??""}handleSlotChange(){this.requestUpdate()}renderEditActions(){return d`
196
+ `,P=[V,z,...x?[]:[N],U];function w(n){let o=n.trim();if(!o)return null;if(/^#[0-9a-f]{6}$/i.test(o))return o.toLowerCase();if(/^#[0-9a-f]{3}$/i.test(o)){let[i,r,u]=o.slice(1);return`#${i}${i}${r}${r}${u}${u}`.toLowerCase()}let e=o.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(!e)return null;let t=i=>Math.min(255,Math.max(0,Math.round(Number(i)))).toString(16).padStart(2,"0");return`#${t(e[1])}${t(e[2])}${t(e[3])}`}var Y="eun-color-picker",j=M(D(A)),G=B(S(F(O(_(R(j)))))),a=class extends G{constructor(){super(...arguments);this.emptyValueLabel="No color selected";this.swatchesLabel="Presets";this.customLabel="Custom";this.nativeInputLabel="Pick a custom color";this.hexInputLabel="Hex color";this.confirmLabel="Confirm";this.cancelLabel="Cancel";this.noAnimation=!1;this.swatchOnly=!1;this.presetsOnly=!1;this.presetsInline=!1;this.isOpen=!1;this.hexDraft="";this.handlePopoverToggle=e=>{if(e.newState==="open"){this.isOpen=!0,this.fieldWrapperEl&&this.listboxEl&&this.anchorFloatingElement(this.fieldWrapperEl,this.listboxEl,{forceFallback:x}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closeListbox());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility()};this.handleWindowBlur=()=>{this.isOpen&&this.closeListbox()};this.handleFocusOut=()=>{this.isOpen&&requestAnimationFrame(()=>{document.activeElement!==this&&this.closeListbox()})};this.handleConfirmClick=()=>{this.closeListbox(),this.confirmEdit()};this.handleCancelClick=()=>{this.closeListbox(),this.cancelEdit()}}get defaultValue(){return super.defaultValue}set defaultValue(e){let t=Array.isArray(e)?e[0]:e;super.defaultValue=t}get presets(){return W(this.children)}get hexDraftInvalid(){return this.hexDraft!==""&&w(this.hexDraft)===null}get triggerAccessibleLabel(){return this.label?this.label:this.ariaLabel?this.ariaLabel:this.swatchOnly?this.value||this.emptyValueLabel:void 0}connectedCallback(){super.connectedCallback?.(),window.addEventListener("blur",this.handleWindowBlur)}disconnectedCallback(){window.removeEventListener("blur",this.handleWindowBlur),super.disconnectedCallback?.()}willUpdate(e){super.willUpdate(e),e.has("value")&&!this.isOpen&&(this.hexDraft=this.value??"")}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}openListbox(){if(this.disabled||this.readonly)return;this.hexDraft=this.value??"";let e=this.listboxEl;this.listboxAnimation?.cancel(),this.listboxAnimation=void 0,e?.matches(":popover-open")||e?.showPopover(),e&&this.playListboxOpenAnimation(e)}listboxAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--field-listbox-transition-duration").trim();if(t){let i=t.endsWith("ms")?Number.parseFloat(t):Number.parseFloat(t)*1e3;if(Number.isFinite(i)&&i>=0)return i}return 200}playListboxOpenAnimation(e){e.style.removeProperty("pointer-events");let t=this.listboxAnimationDuration(e);t!==0&&(this.listboxAnimation=e.animate([{opacity:0,transform:"scaleY(0.01)"},{opacity:1,transform:"scaleY(1)"}],{duration:t,easing:"ease",fill:"forwards"}))}closeListbox(){let e=this.listboxEl;this.listboxAnimation?.cancel(),this.listboxAnimation=void 0,e?.matches(":popover-open")&&this.playListboxCloseAnimation(e)}playListboxCloseAnimation(e){e.style.pointerEvents="none";let t=this.listboxAnimationDuration(e);if(t===0){e.hidePopover();return}let i=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.listboxAnimation=i,i.finished.then(()=>{this.listboxAnimation===i&&(this.listboxAnimation=void 0),e.hidePopover()}).catch(()=>{})}handleFieldActivate(){this.isOpen||this.openListbox()}handleFieldKeydown(e){e.key==="ArrowDown"&&!this.isOpen&&(e.preventDefault(),this.openListbox())}handleSelect(e){this.value=e,this.hexDraft=e,this.dispatchEvent(new C(this.value)),this.closeListbox()}handlePresetKeydown(e,t){let i=this.presets,r;switch(e.key){case"ArrowRight":case"ArrowDown":r=(t+1)%i.length;break;case"ArrowLeft":case"ArrowUp":r=(t-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;default:return}e.preventDefault(),this.presetButtonEls[r]?.focus()}handleNativeInput(e){this.handleSelect(e.target.value)}handleHexInput(e){this.hexDraft=e.target.value}handleHexCommit(){let e=w(this.hexDraft);e?this.handleSelect(e):this.hexDraft=this.value??""}handleSlotChange(){this.requestUpdate()}renderEditActions(){return d`
197
197
  <div id="edit-actions">
198
198
  <eun-button
199
199
  class="confirm"
@@ -220,13 +220,13 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
220
220
  id="readonly-display"
221
221
  role="button"
222
222
  tabindex="0"
223
- aria-label=${u(this.triggerAccessibleLabel)}
223
+ aria-label=${h(this.triggerAccessibleLabel)}
224
224
  @click=${this.startEdit}
225
225
  @keydown=${e=>(e.key==="Enter"||e.key===" ")&&this.startEdit()}
226
226
  >
227
227
  <span
228
228
  class=${c({swatch:!0,empty:!this.value})}
229
- style="--_swatchColor: ${u(this.value)}"
229
+ style="--_swatchColor: ${h(this.value)}"
230
230
  ></span>
231
231
  ${this.swatchOnly?l:d`
232
232
  <span class=${c({empty:!this.value})}
@@ -243,10 +243,10 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
243
243
  <div
244
244
  id="swatches"
245
245
  role="radiogroup"
246
- aria-label=${u(t)}
246
+ aria-label=${h(t)}
247
247
  aria-describedby=${i?"description":l}
248
248
  >
249
- ${e.map((r,h)=>{let K=this.value===r.value;return d`
249
+ ${e.map((r,u)=>{let K=this.value===r.value;return d`
250
250
  <button
251
251
  type="button"
252
252
  class="swatch-button"
@@ -256,7 +256,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
256
256
  tabindex="0"
257
257
  style="--_optionColor: ${r.value}"
258
258
  @click=${()=>this.handleSelect(r.value)}
259
- @keydown=${q=>this.handlePresetKeydown(q,h)}
259
+ @keydown=${q=>this.handlePresetKeydown(q,u)}
260
260
  >
261
261
  <span class="swatch"></span>
262
262
  </button>
@@ -269,7 +269,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
269
269
  type="text"
270
270
  id="hex-input"
271
271
  aria-label=${this.hexInputLabel}
272
- aria-invalid=${this.hexDraftInvalid?"true":"false"}
272
+ aria-invalid=${!this.hideError&&!this.disabled&&this.hexDraftInvalid}
273
273
  ?disabled=${this.disabled}
274
274
  ?readonly=${this.readonly}
275
275
  .value=${f(this.hexDraft)}
@@ -289,7 +289,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
289
289
  <label id="native-swatch">
290
290
  <span
291
291
  class=${c({swatch:!0,empty:!this.value})}
292
- style="--_swatchColor: ${u(this.value)}"
292
+ style="--_swatchColor: ${h(this.value)}"
293
293
  ></span>
294
294
  <input
295
295
  type="color"
@@ -306,7 +306,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
306
306
  aria-label=${this.label||this.hexInputLabel}
307
307
  aria-describedby=${e?"description":l}
308
308
  aria-required=${this.required?"true":"false"}
309
- aria-invalid=${this.hexDraftInvalid||!this.valid?"true":"false"}
309
+ aria-invalid=${!this.hideError&&!this.disabled&&(this.hexDraftInvalid||!this.valid)}
310
310
  ?disabled=${this.disabled}
311
311
  ?readonly=${this.readonly}
312
312
  .value=${f(this.hexDraft)}
@@ -323,7 +323,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
323
323
  <label id="native-swatch">
324
324
  <span
325
325
  class=${c({swatch:!0,empty:!this.value})}
326
- style="--_swatchColor: ${u(this.value)}"
326
+ style="--_swatchColor: ${h(this.value)}"
327
327
  ></span>
328
328
  <input
329
329
  type="color"
@@ -340,11 +340,11 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
340
340
  id="field"
341
341
  aria-haspopup="true"
342
342
  aria-expanded=${this.isOpen}
343
- aria-label=${u(this.triggerAccessibleLabel)}
343
+ aria-label=${h(this.triggerAccessibleLabel)}
344
344
  aria-describedby=${e?"description":l}
345
345
  ?disabled=${this.disabled}
346
346
  aria-required=${this.required?"true":"false"}
347
- aria-invalid=${this.valid?"false":"true"}
347
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
348
348
  @click=${this.handleFieldActivate}
349
349
  @keydown=${this.handleFieldKeydown}
350
350
  >
@@ -352,7 +352,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
352
352
  <span
353
353
  id="trigger-swatch"
354
354
  class=${c({swatch:!0,empty:!this.value})}
355
- style="--_swatchColor: ${u(this.value)}"
355
+ style="--_swatchColor: ${h(this.value)}"
356
356
  ></span>
357
357
  `:l}
358
358
  <span id="value-text" class=${c({empty:!this.value})}>
@@ -370,7 +370,7 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
370
370
  <div
371
371
  id="listbox"
372
372
  popover="auto"
373
- aria-label=${u(this.label)}
373
+ aria-label=${h(this.label)}
374
374
  @toggle=${this.handlePopoverToggle}
375
375
  >
376
376
  ${this.renderPresets(this.presets)}
@@ -382,22 +382,22 @@ import{a as W}from"./chunks/chunk-KBH5PCUO.js";import{a as _}from"./chunks/chunk
382
382
  <span
383
383
  id="trigger-swatch"
384
384
  class=${c({swatch:!0,empty:!this.value})}
385
- style="--_swatchColor: ${u(this.value)}"
385
+ style="--_swatchColor: ${h(this.value)}"
386
386
  ></span>
387
387
  <input
388
388
  type="color"
389
389
  id="field"
390
- aria-label=${u(this.triggerAccessibleLabel)}
390
+ aria-label=${h(this.triggerAccessibleLabel)}
391
391
  aria-describedby=${e?"description":l}
392
392
  ?disabled=${this.disabled||this.readonly}
393
- aria-invalid=${this.valid?"false":"true"}
393
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
394
394
  .value=${f(this.value||"#000000")}
395
395
  @input=${this.handleNativeInput}
396
396
  />
397
397
  </label>
398
398
  </div>
399
399
  ${this.readonlyAvailable?this.renderEditActions():l}
400
- `}render(){let e=this.readonlyAvailable&&!this.editing,t=this.renderDescription(),i=t!==l,r,h=this.presets.length>0;return e?r=this.renderReadonlyDisplay():this.swatchOnly?r=this.renderSwatchOnlyField(i):this.presetsInline&&h?r=this.renderInlinePresetsField(i):h?r=this.renderField(i):r=this.renderInlineCustomField(i),d`
400
+ `}render(){let e=this.readonlyAvailable&&!this.editing,t=this.renderDescription(),i=t!==l,r,u=this.presets.length>0;return e?r=this.renderReadonlyDisplay():this.swatchOnly?r=this.renderSwatchOnlyField(i):this.presetsInline&&u?r=this.renderInlinePresetsField(i):u?r=this.renderField(i):r=this.renderInlineCustomField(i),d`
401
401
  <div id="wrapper" @focusout=${this.handleFocusOut}>
402
402
  ${this.renderFormLabels(e?void 0:"field")}
403
403
  ${r} ${t}
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunks/chunk-L74LXUGL.js";import{a as w}from"./chunks/chunk-XSMCT4DF.js";import{a as y}from"./chunks/chunk-GW3VP2L7.js";import{a as h,c as v,d as x,e as d}from"./chunks/chunk-2IQUMAMI.js";import{a as u}from"./chunks/chunk-ONYUXQV2.js";import{a as m}from"./chunks/chunk-T7WABJEJ.js";import{a as o}from"./chunks/chunk-5EVP7YNE.js";import{a as t,f as c,g as p,h as n,j as f,n as l,p as s,s as b}from"./chunks/chunk-XH6NREVZ.js";var k=p`
1
+ import{a as g}from"./chunks/chunk-L74LXUGL.js";import{a as w}from"./chunks/chunk-XSMCT4DF.js";import{a as y}from"./chunks/chunk-GW3VP2L7.js";import{a as h,c as v,d as x,e as d}from"./chunks/chunk-KNM5QHDK.js";import{a as u}from"./chunks/chunk-YYCEPZUN.js";import{a as m}from"./chunks/chunk-T7WABJEJ.js";import{a as o}from"./chunks/chunk-5EVP7YNE.js";import{a as t,f as c,g as p,h as n,j as b,n as l,p as s,s as f}from"./chunks/chunk-XH6NREVZ.js";var k=p`
2
2
  :host {
3
3
  --_borderColor: var(
4
4
  --counter-border-color,
@@ -180,7 +180,7 @@ import{a as g}from"./chunks/chunk-L74LXUGL.js";import{a as w}from"./chunks/chunk
180
180
  :host([variant="underline"]) #field-wrapper:focus-within {
181
181
  outline: none;
182
182
  }
183
- `,M=k;var I="eun-counter",$=m(x(b)),C=w(y(h(v($)))),i=class extends C{constructor(){super(...arguments);this.step=1;this.ariaLabelIncrement="Increase value";this.ariaLabelDecrement="Decrease value";this.handleHostFocus=()=>{this.fieldEl?.focus()};this.checkLocalValidators=()=>g(this.fieldEl,["valueMissing","rangeUnderflow","rangeOverflow","stepMismatch","badInput"])}get value(){return super.value}set value(e){super.value=e}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}connectedCallback(){super.connectedCallback?.(),this.addEventListener("focus",this.handleHostFocus)}disconnectedCallback(){this.removeEventListener("focus",this.handleHostFocus),super.disconnectedCallback?.()}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}roundToStep(e){let r=(String(this.step).split(".")[1]??"").length;return r?Number(e.toFixed(r)):e}clamp(e){let r=e;return this.min!==void 0&&(r=Math.max(r,this.min)),this.max!==void 0&&(r=Math.min(r,this.max)),this.roundToStep(r)}commitValue(e){this.value=e,this.dispatchEvent(new u)}stepBy(e){if(this.disabled||this.readonly)return;let r=this.value??this.min??0;this.commitValue(this.clamp(r+e*this.step))}handleInput(e){let r=e.target.value,a=r===""?void 0:Number(r);this.value=a===void 0||Number.isNaN(a)?void 0:a,this.dispatchEvent(new u)}handleKeydown(e){this.disabled||this.readonly||(e.key==="Home"&&this.min!==void 0?(e.preventDefault(),this.commitValue(this.min)):e.key==="End"&&this.max!==void 0&&(e.preventDefault(),this.commitValue(this.max)))}renderField(e){let r=!this.disabled&&!this.readonly&&!(this.value!==void 0&&this.min!==void 0&&this.value<=this.min),a=!this.disabled&&!this.readonly&&!(this.value!==void 0&&this.max!==void 0&&this.value>=this.max),_=!Number.isInteger(this.step);return l`
183
+ `,M=k;var I="eun-counter",$=m(x(f)),C=w(y(h(v($)))),i=class extends C{constructor(){super(...arguments);this.step=1;this.ariaLabelIncrement="Increase value";this.ariaLabelDecrement="Decrease value";this.handleHostFocus=()=>{this.fieldEl?.focus()};this.checkLocalValidators=()=>g(this.fieldEl,["valueMissing","rangeUnderflow","rangeOverflow","stepMismatch","badInput"])}get value(){return super.value}set value(e){super.value=e}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}connectedCallback(){super.connectedCallback?.(),this.addEventListener("focus",this.handleHostFocus)}disconnectedCallback(){this.removeEventListener("focus",this.handleHostFocus),super.disconnectedCallback?.()}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}roundToStep(e){let r=(String(this.step).split(".")[1]??"").length;return r?Number(e.toFixed(r)):e}clamp(e){let r=e;return this.min!==void 0&&(r=Math.max(r,this.min)),this.max!==void 0&&(r=Math.min(r,this.max)),this.roundToStep(r)}commitValue(e){this.value=e,this.dispatchEvent(new u(this.value))}stepBy(e){if(this.disabled||this.readonly)return;let r=this.value??this.min??0;this.commitValue(this.clamp(r+e*this.step))}handleInput(e){let r=e.target.value,a=r===""?void 0:Number(r);this.value=a===void 0||Number.isNaN(a)?void 0:a,this.dispatchEvent(new u(this.value))}handleKeydown(e){this.disabled||this.readonly||(e.key==="Home"&&this.min!==void 0?(e.preventDefault(),this.commitValue(this.min)):e.key==="End"&&this.max!==void 0&&(e.preventDefault(),this.commitValue(this.max)))}renderField(e){let r=!this.disabled&&!this.readonly&&!(this.value!==void 0&&this.min!==void 0&&this.value<=this.min),a=!this.disabled&&!this.readonly&&!(this.value!==void 0&&this.max!==void 0&&this.value>=this.max),_=!Number.isInteger(this.step);return l`
184
184
  <div id="field-wrapper">
185
185
  <button
186
186
  type="button"
@@ -203,7 +203,7 @@ import{a as g}from"./chunks/chunk-L74LXUGL.js";import{a as w}from"./chunks/chunk
203
203
  max=${o(this.max)}
204
204
  step=${this.step}
205
205
  inputmode=${_?"decimal":"numeric"}
206
- aria-invalid=${this.valid?"false":"true"}
206
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
207
207
  aria-label=${o(this.label)}
208
208
  aria-describedby=${e?"description":s}
209
209
  @input=${this.handleInput}
@@ -225,4 +225,4 @@ import{a as g}from"./chunks/chunk-L74LXUGL.js";import{a as w}from"./chunks/chunk
225
225
  ${this.renderFormLabels("field")}
226
226
  ${this.renderField(e!==s)} ${e}
227
227
  </div>
228
- `}};i.styles=[M,d.base,d.errorMessages,d.hintMessages],t([n({type:Number})],i.prototype,"min",2),t([n({type:Number})],i.prototype,"max",2),t([n({type:Number})],i.prototype,"step",2),t([n({attribute:"aria-label-increment"})],i.prototype,"ariaLabelIncrement",2),t([n({attribute:"aria-label-decrement"})],i.prototype,"ariaLabelDecrement",2),t([n({type:Number})],i.prototype,"value",1),t([n({attribute:"default-value",type:Number})],i.prototype,"defaultValue",1),t([f("#field")],i.prototype,"fieldEl",2),i=t([c(I)],i);export{i as EunomiaCounter,I as EunomiaCounterTagName};
228
+ `}};i.styles=[M,d.base,d.errorMessages,d.hintMessages],t([n({type:Number})],i.prototype,"min",2),t([n({type:Number})],i.prototype,"max",2),t([n({type:Number})],i.prototype,"step",2),t([n({attribute:"aria-label-increment"})],i.prototype,"ariaLabelIncrement",2),t([n({attribute:"aria-label-decrement"})],i.prototype,"ariaLabelDecrement",2),t([n({type:Number})],i.prototype,"value",1),t([n({attribute:"default-value",type:Number})],i.prototype,"defaultValue",1),t([b("#field")],i.prototype,"fieldEl",2),i=t([c(I)],i);export{i as EunomiaCounter,I as EunomiaCounterTagName};
@@ -1,4 +1,4 @@
1
- import{a as we,b as Z,c as Te,d as ke,e as Me,f as $e,g as J,h as E,i as Ce,j as ee,k as Ye,l as te,m as K,n as ae,o as Ae,p as Re,q as Le,r as Pe,s as Fe}from"./chunks/chunk-5C7YND22.js";import"./chunks/chunk-SD2H5UDZ.js";import{a as ge}from"./chunks/chunk-ATH2OAMU.js";import"./chunks/chunk-T4PTHUYF.js";import{a as xe}from"./chunks/chunk-LK5BJ4SH.js";import{a as Se}from"./chunks/chunk-6UPI7GHJ.js";import{a as q}from"./chunks/chunk-LYYQAALT.js";import{a as De}from"./chunks/chunk-XSMCT4DF.js";import{a as ye}from"./chunks/chunk-GW3VP2L7.js";import{a as ve,c as fe,d as be,e as z}from"./chunks/chunk-2IQUMAMI.js";import{a as H}from"./chunks/chunk-ONYUXQV2.js";import{a as ce}from"./chunks/chunk-T7WABJEJ.js";import{a as b,c as B,d as y,e as X,f as F,g as Q,h as $,k as w,l as g,m as W,n as T,o as R,p as he,q as O,r as N,s as pe,t as me}from"./chunks/chunk-MJ4RDZLL.js";import{a as A}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-5EVP7YNE.js";import{a as s,f as de,g as S,h,i as v,j as P,n as u,p as Y,s as ue}from"./chunks/chunk-XH6NREVZ.js";var Ue=["day","month","year"];function Ke(r){let e=new Intl.DateTimeFormat(r,{day:"numeric",month:"numeric",year:"numeric"}).formatToParts(new Date(2e3,0,2)).map(t=>t.type).filter(t=>t==="day"||t==="month"||t==="year");return e.length===3?e:Ue}function j(r){switch(r){case"year":return["year"];case"month":return["month","year"];default:return["day","month","year"]}}function re(r,n=["day","month","year"]){let e=Number(r.year);if(!Number.isInteger(e)||e<1)return null;let t=n.includes("month"),a=t?Number(r.month):1;if(t&&(!Number.isInteger(a)||a<1||a>12))return null;let i=n.includes("day"),l=i?Number(r.day):1;if(i&&(!Number.isInteger(l)||l<1||l>31))return null;let d=new Date(e,a-1,l);return d.getFullYear()!==e||d.getMonth()!==a-1||i&&d.getDate()!==l?null:d}function Ge(r,n=["day","month","year"]){return n.every(e=>r[e].length===(e==="year"?4:2))}function G(r){return r?{day:String(r.getDate()).padStart(2,"0"),month:String(r.getMonth()+1).padStart(2,"0"),year:String(r.getFullYear()).padStart(4,"0")}:{day:"",month:"",year:""}}var Oe=S`
1
+ import{a as we,b as Z,c as Te,d as ke,e as Me,f as $e,g as J,h as E,i as Ce,j as ee,k as Ye,l as te,m as K,n as ae,o as Ae,p as Re,q as Le,r as Pe,s as Fe}from"./chunks/chunk-5C7YND22.js";import"./chunks/chunk-SD2H5UDZ.js";import{a as ge}from"./chunks/chunk-ATH2OAMU.js";import"./chunks/chunk-T4PTHUYF.js";import{a as xe}from"./chunks/chunk-LK5BJ4SH.js";import{a as Se}from"./chunks/chunk-6UPI7GHJ.js";import{a as q}from"./chunks/chunk-LYYQAALT.js";import{a as De}from"./chunks/chunk-XSMCT4DF.js";import{a as ye}from"./chunks/chunk-GW3VP2L7.js";import{a as ve,c as fe,d as be,e as z}from"./chunks/chunk-KNM5QHDK.js";import{a as H}from"./chunks/chunk-YYCEPZUN.js";import{a as ce}from"./chunks/chunk-T7WABJEJ.js";import{a as b,c as B,d as y,e as X,f as F,g as Q,h as $,k as w,l as g,m as W,n as T,o as R,p as he,q as O,r as N,s as pe,t as me}from"./chunks/chunk-MJ4RDZLL.js";import{a as A}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-5EVP7YNE.js";import{a as s,f as de,g as S,h,i as v,j as P,n as u,p as Y,s as ue}from"./chunks/chunk-XH6NREVZ.js";var Ue=["day","month","year"];function Ke(r){let e=new Intl.DateTimeFormat(r,{day:"numeric",month:"numeric",year:"numeric"}).formatToParts(new Date(2e3,0,2)).map(t=>t.type).filter(t=>t==="day"||t==="month"||t==="year");return e.length===3?e:Ue}function j(r){switch(r){case"year":return["year"];case"month":return["month","year"];default:return["day","month","year"]}}function re(r,n=["day","month","year"]){let e=Number(r.year);if(!Number.isInteger(e)||e<1)return null;let t=n.includes("month"),a=t?Number(r.month):1;if(t&&(!Number.isInteger(a)||a<1||a>12))return null;let i=n.includes("day"),l=i?Number(r.day):1;if(i&&(!Number.isInteger(l)||l<1||l>31))return null;let d=new Date(e,a-1,l);return d.getFullYear()!==e||d.getMonth()!==a-1||i&&d.getDate()!==l?null:d}function Ge(r,n=["day","month","year"]){return n.every(e=>r[e].length===(e==="year"?4:2))}function G(r){return r?{day:String(r.getDate()).padStart(2,"0"),month:String(r.getMonth()+1).padStart(2,"0"),year:String(r.getFullYear()).padStart(4,"0")}:{day:"",month:"",year:""}}var Oe=S`
2
2
  #calendar {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -686,7 +686,7 @@ import{a as we,b as Z,c as Te,d as ke,e as Me,f as $e,g as J,h as E,i as Ce,j as
686
686
  >
687
687
  <span class="cell-label">${r.getFullYear()}</span>
688
688
  </button>
689
- `}function it(r,n){let e=[];for(let t=0;t<r.length;t+=n)e.push(r.slice(t,t+n));return e}var nt="eun-date-picker",ot={day:{min:1,max:31},month:{min:1,max:12}},st=ce(be(ue)),lt=ge(xe(De(ye(ve(fe(st)))))),o=class extends lt{constructor(){super(...arguments);this.mode="single";this.granularity="day";this.rangeValue={start:null,end:null};this.weekStartsOn=1;this.workWeek=!1;this.noAnimation=!1;this.withTime=!1;this.stepMinute=1;this.todayLabel="Today";this.applyLabel="Apply";this.cancelLabel="Cancel";this.ariaLabelCalendar="Open calendar";this.dayPlaceholder="jj";this.monthPlaceholder="mm";this.yearPlaceholder="yyyy";this.hourPlaceholder="hh";this.minutePlaceholder="mm";this.isOpen=!1;this.isModalOpen=!1;this.displayedAnchor=y(new Date);this.focusedDate=b(new Date);this.navLevel=this.granularity;this.hoverDate=null;this.stagingValue=null;this.stagingRange={start:null,end:null};this.stagingTime=null;this.segments={day:"",month:"",year:""};this.rangeSegments={start:{day:"",month:"",year:""},end:{day:"",month:"",year:""}};this.timeSegments={hour:"",minute:"",period:""};this.checkLocalValidators=()=>{let e=j(this.granularity);if((this.mode==="single"?[this.segments]:[this.rangeSegments.start,this.rangeSegments.end]).some(i=>dt(i)&&!re(i,e)))return{validity:{badInput:!0},message:"Enter a valid date"};if(this.isWithTimeActive()){let i=this.resolvedHourFormat();if(ut(this.timeSegments)&&!E(this.timeSegments,i))return{validity:{badInput:!0},message:"Enter a valid time"};if(this.value){let{hour:l,minute:d}=K(this.value,this.timezone),c=Ye({hour:l,minute:d},ee(this.minTime),ee(this.maxTime));if(!c.valid)return c.violation==="min"?{validity:{rangeUnderflow:!0},message:`Time must be at or after ${this.minTime}`}:{validity:{rangeOverflow:!0},message:`Time must be at or before ${this.maxTime}`}}}return{validity:{}}};this.buildCommonValidators=()=>{let e=this.mode==="range"?!this.rangeValue.start||!this.rangeValue.end:this.value===void 0||this.value===null,t={},a;return this.required&&e&&(t.valueMissing=!0,a="Field value is missing"),{validity:t,message:a}};this.handleTriggerClick=()=>{if(!(this.disabled||this.readonly)){if(this.resetStaging(),this.isMobileViewport()){this.isModalOpen=!0;return}this.updateComplete.then(()=>{let e=this.popoverEl;if(!e)return;let t=this.popoverAnimation!==void 0;this.popoverAnimation?.cancel(),this.popoverAnimation=void 0;let a=!e.matches(":popover-open");a&&e.showPopover(),(a||t)&&this.playPopoverOpenAnimation(e)})}};this.handlePopoverToggle=e=>{if(e.newState==="open"){this.isOpen=!0,this.fieldWrapperEl&&this.popoverEl&&this.anchorFloatingElement(this.fieldWrapperEl,this.popoverEl,{forceFallback:q}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closePopover()),this.updateComplete.then(()=>this.focusCalendarCell());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility(),this.triggerEl?.focus()};this.handleModalConfirm=()=>{this.commitStaged(),this.isModalOpen=!1};this.handleModalCancel=()=>{this.isModalOpen=!1};this.handlePopoverApply=()=>{this.commitStaged(),this.closePopover()};this.handlePopoverCancel=()=>{this.closePopover()};this.handleTimeHourChange=e=>{this.stagingTime={hour:e,minute:this.stagingTime?.minute??0}};this.handleTimeMinuteChange=e=>{this.stagingTime={hour:this.stagingTime?.hour??0,minute:e}};this.handleTimePeriodChange=e=>{let t=this.stagingTime??{hour:0,minute:0},{hour:a}=Z(t.hour);this.stagingTime={hour:Te(a,e),minute:t.minute}};this.handleDayKeydown=(e,t)=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,$,a=>this.isDayFocusSkippable(a));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,$,a=>this.isDayFocusSkippable(a));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-7,$,a=>this.isDayFocusSkippable(a));break;case"ArrowDown":e.preventDefault(),this.moveFocused(7,$,a=>this.isDayFocusSkippable(a));break;case"Home":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(B(this.focusedDate,this.weekStartsOn),1));break;case"End":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay($(B(this.focusedDate,this.weekStartsOn),6),-1));break;case"PageUp":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(w(this.focusedDate,e.shiftKey?-12:-1),1));break;case"PageDown":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(w(this.focusedDate,e.shiftKey?12:1),1));break;case"Enter":case" ":e.preventDefault(),this.handleDayClick(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.handleMonthKeydown=(e,t,a=i=>this.handleMonthClick(i))=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,w,i=>this.isMonthDisabled(i));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,w,i=>this.isMonthDisabled(i));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-3,w,i=>this.isMonthDisabled(i));break;case"ArrowDown":e.preventDefault(),this.moveFocused(3,w,i=>this.isMonthDisabled(i));break;case"Home":e.preventDefault(),this.jumpFocused(new Date(this.focusedDate.getFullYear(),0,1));break;case"End":e.preventDefault(),this.jumpFocused(new Date(this.focusedDate.getFullYear(),11,1));break;case"PageUp":e.preventDefault(),this.jumpFocused(g(this.focusedDate,e.shiftKey?-10:-1));break;case"PageDown":e.preventDefault(),this.jumpFocused(g(this.focusedDate,e.shiftKey?10:1));break;case"Enter":case" ":e.preventDefault(),a(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.handleYearKeydown=(e,t,a=i=>this.handleYearClick(i))=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,g,i=>this.isYearDisabled(i));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,g,i=>this.isYearDisabled(i));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-3,g,i=>this.isYearDisabled(i));break;case"ArrowDown":e.preventDefault(),this.moveFocused(3,g,i=>this.isYearDisabled(i));break;case"Home":e.preventDefault(),this.jumpFocused(new Date(V(this.focusedDate.getFullYear()),0,1));break;case"End":e.preventDefault(),this.jumpFocused(new Date(V(this.focusedDate.getFullYear())+11,0,1));break;case"PageUp":e.preventDefault(),this.jumpFocused(g(this.focusedDate,-12));break;case"PageDown":e.preventDefault(),this.jumpFocused(g(this.focusedDate,12));break;case"Enter":case" ":e.preventDefault(),a(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.enterMonthNav=()=>{this.navLevel="month"};this.enterYearNav=()=>{this.navLevel="year"};this.handleQuickNavMonthClick=e=>{if(this.isMonthDisabled(e))return;let t=(e.getFullYear()-this.focusedDate.getFullYear())*12+(e.getMonth()-this.focusedDate.getMonth());this.jumpFocused(w(this.focusedDate,t)),this.navLevel="day"};this.handleQuickNavYearClick=e=>{if(this.isYearDisabled(e))return;let t=e.getFullYear()-this.focusedDate.getFullYear();this.jumpFocused(g(this.focusedDate,t)),this.navLevel="month"};this.handleHover=e=>{this.hoverDate=e};this.handlePreviousMonth=()=>{this.displayedAnchor=w(this.displayedAnchor,-1)};this.handleNextMonth=()=>{this.displayedAnchor=w(this.displayedAnchor,1)};this.handlePreviousYear=()=>{this.displayedAnchor=g(this.displayedAnchor,-1)};this.handleNextYear=()=>{this.displayedAnchor=g(this.displayedAnchor,1)};this.handlePreviousYearsPage=()=>{this.displayedAnchor=g(this.displayedAnchor,-12)};this.handleNextYearsPage=()=>{this.displayedAnchor=g(this.displayedAnchor,12)};this.handleToday=()=>{let e=new Date;this.displayedAnchor=y(e),this.jumpFocused(this.nearestWorkweekDay(b(e),1))};this.navigateGridPrevious=()=>{switch(this.navLevel){case"month":this.handlePreviousYear();break;case"year":this.handlePreviousYearsPage();break;default:this.handlePreviousMonth();break}};this.navigateGridNext=()=>{switch(this.navLevel){case"month":this.handleNextYear();break;case"year":this.handleNextYearsPage();break;default:this.handleNextMonth();break}};this.swipeStart=null;this.handleSwipeStart=e=>{e.pointerType==="touch"&&(this.swipeStart={x:e.clientX,y:e.clientY})};this.handleSwipeEnd=e=>{let t=this.swipeStart;if(this.swipeStart=null,e.pointerType!=="touch"||!t)return;let a=e.clientX-t.x,i=e.clientY-t.y;Math.abs(a)<o.SWIPE_THRESHOLD_PX||Math.abs(a)<Math.abs(i)||(a<0?(this.navigateGridNext(),this.playSwipeAnimation("next")):(this.navigateGridPrevious(),this.playSwipeAnimation("previous")))};this.handleSwipeCancel=()=>{this.swipeStart=null};this.handlePeriodSegmentClick=()=>{this.setPeriodSegment(ke(this.timeSegments.period||"AM"))};this.handlePeriodSegmentKeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":case"Enter":case" ":e.preventDefault(),this.handlePeriodSegmentClick();break;case"a":case"A":e.preventDefault(),this.setPeriodSegment("AM");break;case"p":case"P":e.preventDefault(),this.setPeriodSegment("PM");break;case"ArrowLeft":e.preventDefault(),this.focusPreviousTimeSegment("period");break;case"ArrowRight":e.preventDefault(),this.focusNextTimeSegment("period");break;default:break}}}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}connectedCallback(){super.connectedCallback?.(),this.mode==="range"&&this.defaultRangeValue&&(this.rangeValue=this.defaultRangeValue)}formResetCallback(){super.formResetCallback(),this.mode==="range"&&(this.rangeValue=this.defaultRangeValue??{start:null,end:null})}willUpdate(e){let t=e.has("segments")||e.has("rangeSegments")||e.has("timeSegments")||e.has("minTime")||e.has("maxTime");if(this.isWithTimeActive()&&(e.has("value")||e.has("timezone")||e.has("hourFormat")||e.has("locale"))){let a=this.resolvedHourFormat();if(this.value){let i=K(this.value,this.timezone);this.timeSegments=J(i.hour,i.minute,a)}else this.timeSegments=J(null,null,a);t=!0}t&&this.checkValidity(this.value??null),super.willUpdate(e)}updated(e){super.updated(e),e.has("value")&&this.mode==="single"&&(this.segments=G(this.value??null)),e.has("rangeValue")&&this.mode==="range"&&(this.rangeSegments={start:G(this.rangeValue.start),end:G(this.rangeValue.end)}),(e.has("valid")||e.has("hideError")||e.has("disabled"))&&this.setAttribute("aria-invalid",String(!this.hideError&&!this.disabled&&!this.valid))}getFocusAnchor(){return this.firstSegmentEl??void 0}focus(){super.focus?.(),this.firstSegmentEl?.focus()}isMobileViewport(){return window.matchMedia("(max-width: 767px)").matches}isDayDisabled(e){return ie(e,this.minDate,this.maxDate,this.isDateDisabled)}isMonthDisabled(e){return ne(e,this.minDate,this.maxDate,this.isDateDisabled)}isYearDisabled(e){return oe(e,this.minDate,this.maxDate,this.isDateDisabled)}resetStaging(){this.stagingValue=this.value??null,this.stagingRange={start:this.rangeValue.start,end:this.rangeValue.end},this.hoverDate=null,this.navLevel=this.granularity;let e=this.mode==="single"?this.value??new Date:this.rangeValue.start??new Date;if(this.displayedAnchor=e,this.focusedDate=b(e),this.isWithTimeActive()){let t=this.mode==="single"?this.value:this.rangeValue.start;if(t){let{hour:a,minute:i}=K(t,this.timezone);this.stagingTime={hour:a,minute:i}}else this.stagingTime={hour:0,minute:0}}}isWithTimeActive(){return this.withTime&&this.granularity==="day"}resolvedHourFormat(){return we(this.locale,this.hourFormat)}composeWithTime(e){let t=this.stagingTime??{hour:0,minute:0},a=K(e,this.timezone);return ae({year:a.year,month:a.month,day:a.day,hour:t.hour,minute:t.minute},this.timezone??te())}commitStaged(){this.mode==="single"?(this.value=this.isWithTimeActive()&&this.stagingValue?this.composeWithTime(this.stagingValue):this.stagingValue,this.segments=G(this.value)):(this.rangeValue=this.stagingRange,this.rangeSegments={start:G(this.stagingRange.start),end:G(this.stagingRange.end)}),this.dispatchEvent(new H)}commitTypedDate(e,t){e==="value"?this.value=this.isWithTimeActive()?this.composeTypedDateTime(t):t:this.rangeValue={...this.rangeValue,[e]:t},this.dispatchEvent(new H),(this.isOpen||this.isModalOpen)&&this.resetStaging()}composeTypedDateTime(e){let t=this.resolvedHourFormat(),i=E(this.timeSegments,t);if(!i)if(this.value){let{hour:l,minute:d}=K(this.value,this.timezone);i={hour:l,minute:d}}else i={hour:0,minute:0};return ae({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:i.hour,minute:i.minute},this.timezone??te())}commitTypedTime(e,t){this.value=Ae(this.value??new Date,this.timezone,e,t),this.dispatchEvent(new H),(this.isOpen||this.isModalOpen)&&this.resetStaging()}commitTimeSegmentGroupIfComplete(e){let t=this.resolvedHourFormat();if(!Ce(e,t))return;let a=E(e,t);a&&this.commitTypedTime(a.hour,a.minute)}popoverAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--date-picker-panel-transition-duration").trim();if(t){let a=t.endsWith("ms")?Number.parseFloat(t):Number.parseFloat(t)*1e3;if(Number.isFinite(a)&&a>=0)return a}return 200}playPopoverOpenAnimation(e){e.style.removeProperty("pointer-events");let t=this.popoverAnimationDuration(e);t!==0&&(this.popoverAnimation=e.animate([{opacity:0,transform:"scaleY(0.01)"},{opacity:1,transform:"scaleY(1)"}],{duration:t,easing:"ease",fill:"forwards"}))}closePopover(){let e=this.popoverEl;this.popoverAnimation?.cancel(),this.popoverAnimation=void 0,e?.matches(":popover-open")&&this.playPopoverCloseAnimation(e)}playPopoverCloseAnimation(e){e.style.pointerEvents="none";let t=this.popoverAnimationDuration(e);if(t===0){e.hidePopover();return}let a=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.popoverAnimation=a,a.finished.then(()=>{this.popoverAnimation===a&&(this.popoverAnimation=void 0),e.hidePopover()}).catch(()=>{})}focusCalendarCell(){(this.isModalOpen?this.shadowRoot:this.popoverEl)?.querySelector('.grid-cell[tabindex="0"]')?.focus({preventScroll:!0})}syncDisplayedAnchor(){switch(this.granularity){case"month":R(this.focusedDate,this.displayedAnchor)||(this.displayedAnchor=this.focusedDate);break;case"year":V(this.focusedDate.getFullYear())!==V(this.displayedAnchor.getFullYear())&&(this.displayedAnchor=this.focusedDate);break;default:T(this.focusedDate,this.displayedAnchor)||(this.displayedAnchor=y(this.focusedDate));break}}moveFocused(e,t,a){let i=e>0?1:-1,l=t(this.focusedDate,e);for(let d=0;a(l)&&d<1e3;d+=1)l=t(l,i);this.focusedDate=l,this.syncDisplayedAnchor(),this.updateComplete.then(()=>this.focusCalendarCell())}jumpFocused(e){this.focusedDate=e,this.syncDisplayedAnchor(),this.updateComplete.then(()=>this.focusCalendarCell())}isDayFocusSkippable(e){return this.isDayDisabled(e)||this.workWeek&&O(e)}nearestWorkweekDay(e,t){if(!this.workWeek)return e;let a=e;for(let i=0;O(a)&&i<2;i+=1)a=$(a,t);return a}commitCell(e){this.focusedDate=e;let t;if(this.mode==="single")this.stagingValue=e,t=!0;else{let{start:a,end:i}=this.stagingRange;if(!a||i)this.stagingRange={start:e,end:null},this.hoverDate=null,t=!1;else{let[l,d]=e.getTime()<a.getTime()?[e,a]:[a,e];this.stagingRange={start:l,end:d},t=!0}}this.isModalOpen||this.isWithTimeActive()&&this.isOpen||t&&(this.commitStaged(),this.closePopover())}handleDayClick(e){this.isDayDisabled(e)||this.commitCell(e)}handleMonthClick(e){this.isMonthDisabled(e)||this.commitCell(e)}handleYearClick(e){this.isYearDisabled(e)||this.commitCell(e)}playSwipeAnimation(e){this.updateComplete.then(()=>{let t=this.swipeAreaEl;t&&(t.classList.remove("slide-in-next","slide-in-previous"),t.getBoundingClientRect(),t.classList.add(e==="next"?"slide-in-next":"slide-in-previous"))})}handleSegmentInput(e,t,a){let i=e.target,l=a==="year"?4:2,d=i.value.replace(/\D/g,"").slice(0,l);i.value=d;let p={...this.readSegmentGroup(t),[a]:d};this.writeSegmentGroup(t,p),d.length===l&&this.focusNextSegment(t,a),this.commitSegmentGroupIfComplete(t,p)}commitSegmentGroupIfComplete(e,t){let a=j(this.granularity);if(!Ge(t,a))return;let i=re(t,a);i&&this.commitTypedDate(e,i)}handleSegmentKeydown(e,t,a){let i=e.target;e.key==="Backspace"&&i.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousSegment(t,a)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextSegment(t,a)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustSegment(t,a,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustSegment(t,a,-1))}adjustSegment(e,t,a){let i=this.readSegmentGroup(e),l=Number(i[t]),d=ct(t),c;if(i[t]===""||Number.isNaN(l))c=d;else{let m=ot[t];c=l+a,m&&c>m.max?c=m.min:m&&c<m.min?c=m.max:m||(c=Math.max(0,c))}let p=t==="year"?4:2,k=String(c).padStart(p,"0").slice(-p),D={...i,[t]:k};this.writeSegmentGroup(e,D),this.commitSegmentGroupIfComplete(e,D)}readSegmentGroup(e){return e==="value"?this.segments:this.rangeSegments[e]}writeSegmentGroup(e,t){e==="value"?this.segments=t:this.rangeSegments={...this.rangeSegments,[e]:t}}visibleSegmentOrder(){let e=j(this.granularity);return Ke(this.locale).filter(t=>e.includes(t))}focusPreviousSegment(e,t){let a=this.visibleSegmentOrder(),i=a.indexOf(t);i<=0||this.focusSegment(e,a[i-1])}focusNextSegment(e,t){let a=this.visibleSegmentOrder(),i=a.indexOf(t);i===-1||i>=a.length-1||this.focusSegment(e,a[i+1])}focusSegment(e,t){this.shadowRoot?.querySelector(`.segment-group[data-target="${e}"] .segment-${t}`)?.focus()}handleTimeSegmentInput(e,t){let a=e.target,i=a.value.replace(/\D/g,"").slice(0,2);a.value=i;let l={...this.timeSegments,[t]:i};this.timeSegments=l,i.length===2&&this.focusNextTimeSegment(t),this.commitTimeSegmentGroupIfComplete(l)}handleTimeSegmentKeydown(e,t){let a=e.target;e.key==="Backspace"&&a.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousTimeSegment(t)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextTimeSegment(t)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustTimeSegment(t,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustTimeSegment(t,-1))}adjustTimeSegment(e,t){let a=this.resolvedHourFormat(),i=e==="hour"?a===12?{min:1,max:12}:{min:0,max:23}:{min:0,max:59},l=Number(this.timeSegments[e]),d;if(this.timeSegments[e]===""||Number.isNaN(l)){let p=K(this.value??new Date,this.timezone);d=e==="hour"?a===12?Z(p.hour).hour:p.hour:p.minute}else d=l+t,d>i.max?d=i.min:d<i.min&&(d=i.max);let c={...this.timeSegments,[e]:String(d).padStart(2,"0")};this.timeSegments=c,this.commitTimeSegmentGroupIfComplete(c)}setPeriodSegment(e){if(this.disabled||this.readonly)return;let t={...this.timeSegments,period:e};this.timeSegments=t,this.commitTimeSegmentGroupIfComplete(t)}visibleTimeSegmentOrder(){let e=Me(this.resolvedHourFormat());return $e(this.locale).filter(t=>e.includes(t))}focusPreviousTimeSegment(e){let t=this.visibleTimeSegmentOrder(),a=t.indexOf(e);a<=0||this.focusTimeSegment(t[a-1])}focusNextTimeSegment(e){let t=this.visibleTimeSegmentOrder(),a=t.indexOf(e);a===-1||a>=t.length-1||this.focusTimeSegment(t[a+1])}focusTimeSegment(e){this.shadowRoot?.querySelector(`.segment-${e}`)?.focus()}renderTimeSegmentGroup(){let e=this.visibleTimeSegmentOrder();return u`
689
+ `}function it(r,n){let e=[];for(let t=0;t<r.length;t+=n)e.push(r.slice(t,t+n));return e}var nt="eun-date-picker",ot={day:{min:1,max:31},month:{min:1,max:12}},st=ce(be(ue)),lt=ge(xe(De(ye(ve(fe(st)))))),o=class extends lt{constructor(){super(...arguments);this.mode="single";this.granularity="day";this.rangeValue={start:null,end:null};this.weekStartsOn=1;this.workWeek=!1;this.noAnimation=!1;this.withTime=!1;this.stepMinute=1;this.todayLabel="Today";this.applyLabel="Apply";this.cancelLabel="Cancel";this.ariaLabelCalendar="Open calendar";this.dayPlaceholder="jj";this.monthPlaceholder="mm";this.yearPlaceholder="yyyy";this.hourPlaceholder="hh";this.minutePlaceholder="mm";this.isOpen=!1;this.isModalOpen=!1;this.displayedAnchor=y(new Date);this.focusedDate=b(new Date);this.navLevel=this.granularity;this.hoverDate=null;this.stagingValue=null;this.stagingRange={start:null,end:null};this.stagingTime=null;this.segments={day:"",month:"",year:""};this.rangeSegments={start:{day:"",month:"",year:""},end:{day:"",month:"",year:""}};this.timeSegments={hour:"",minute:"",period:""};this.checkLocalValidators=()=>{let e=j(this.granularity);if((this.mode==="single"?[this.segments]:[this.rangeSegments.start,this.rangeSegments.end]).some(i=>dt(i)&&!re(i,e)))return{validity:{badInput:!0},message:"Enter a valid date"};if(this.isWithTimeActive()){let i=this.resolvedHourFormat();if(ut(this.timeSegments)&&!E(this.timeSegments,i))return{validity:{badInput:!0},message:"Enter a valid time"};if(this.value){let{hour:l,minute:d}=K(this.value,this.timezone),c=Ye({hour:l,minute:d},ee(this.minTime),ee(this.maxTime));if(!c.valid)return c.violation==="min"?{validity:{rangeUnderflow:!0},message:`Time must be at or after ${this.minTime}`}:{validity:{rangeOverflow:!0},message:`Time must be at or before ${this.maxTime}`}}}return{validity:{}}};this.buildCommonValidators=()=>{let e=this.mode==="range"?!this.rangeValue.start||!this.rangeValue.end:this.value===void 0||this.value===null,t={},a;return this.required&&e&&(t.valueMissing=!0,a="Field value is missing"),{validity:t,message:a}};this.handleTriggerClick=()=>{if(!(this.disabled||this.readonly)){if(this.resetStaging(),this.isMobileViewport()){this.isModalOpen=!0;return}this.updateComplete.then(()=>{let e=this.popoverEl;if(!e)return;let t=this.popoverAnimation!==void 0;this.popoverAnimation?.cancel(),this.popoverAnimation=void 0;let a=!e.matches(":popover-open");a&&e.showPopover(),(a||t)&&this.playPopoverOpenAnimation(e)})}};this.handlePopoverToggle=e=>{if(e.newState==="open"){this.isOpen=!0,this.fieldWrapperEl&&this.popoverEl&&this.anchorFloatingElement(this.fieldWrapperEl,this.popoverEl,{forceFallback:q}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closePopover()),this.updateComplete.then(()=>this.focusCalendarCell());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility(),this.triggerEl?.focus()};this.handleModalConfirm=()=>{this.commitStaged(),this.isModalOpen=!1};this.handleModalCancel=()=>{this.isModalOpen=!1};this.handlePopoverApply=()=>{this.commitStaged(),this.closePopover()};this.handlePopoverCancel=()=>{this.closePopover()};this.handleTimeHourChange=e=>{this.stagingTime={hour:e,minute:this.stagingTime?.minute??0}};this.handleTimeMinuteChange=e=>{this.stagingTime={hour:this.stagingTime?.hour??0,minute:e}};this.handleTimePeriodChange=e=>{let t=this.stagingTime??{hour:0,minute:0},{hour:a}=Z(t.hour);this.stagingTime={hour:Te(a,e),minute:t.minute}};this.handleDayKeydown=(e,t)=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,$,a=>this.isDayFocusSkippable(a));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,$,a=>this.isDayFocusSkippable(a));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-7,$,a=>this.isDayFocusSkippable(a));break;case"ArrowDown":e.preventDefault(),this.moveFocused(7,$,a=>this.isDayFocusSkippable(a));break;case"Home":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(B(this.focusedDate,this.weekStartsOn),1));break;case"End":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay($(B(this.focusedDate,this.weekStartsOn),6),-1));break;case"PageUp":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(w(this.focusedDate,e.shiftKey?-12:-1),1));break;case"PageDown":e.preventDefault(),this.jumpFocused(this.nearestWorkweekDay(w(this.focusedDate,e.shiftKey?12:1),1));break;case"Enter":case" ":e.preventDefault(),this.handleDayClick(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.handleMonthKeydown=(e,t,a=i=>this.handleMonthClick(i))=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,w,i=>this.isMonthDisabled(i));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,w,i=>this.isMonthDisabled(i));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-3,w,i=>this.isMonthDisabled(i));break;case"ArrowDown":e.preventDefault(),this.moveFocused(3,w,i=>this.isMonthDisabled(i));break;case"Home":e.preventDefault(),this.jumpFocused(new Date(this.focusedDate.getFullYear(),0,1));break;case"End":e.preventDefault(),this.jumpFocused(new Date(this.focusedDate.getFullYear(),11,1));break;case"PageUp":e.preventDefault(),this.jumpFocused(g(this.focusedDate,e.shiftKey?-10:-1));break;case"PageDown":e.preventDefault(),this.jumpFocused(g(this.focusedDate,e.shiftKey?10:1));break;case"Enter":case" ":e.preventDefault(),a(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.handleYearKeydown=(e,t,a=i=>this.handleYearClick(i))=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.moveFocused(-1,g,i=>this.isYearDisabled(i));break;case"ArrowRight":e.preventDefault(),this.moveFocused(1,g,i=>this.isYearDisabled(i));break;case"ArrowUp":e.preventDefault(),this.moveFocused(-3,g,i=>this.isYearDisabled(i));break;case"ArrowDown":e.preventDefault(),this.moveFocused(3,g,i=>this.isYearDisabled(i));break;case"Home":e.preventDefault(),this.jumpFocused(new Date(V(this.focusedDate.getFullYear()),0,1));break;case"End":e.preventDefault(),this.jumpFocused(new Date(V(this.focusedDate.getFullYear())+11,0,1));break;case"PageUp":e.preventDefault(),this.jumpFocused(g(this.focusedDate,-12));break;case"PageDown":e.preventDefault(),this.jumpFocused(g(this.focusedDate,12));break;case"Enter":case" ":e.preventDefault(),a(t);break;case"Escape":e.preventDefault(),this.closePopover();break;default:break}};this.enterMonthNav=()=>{this.navLevel="month"};this.enterYearNav=()=>{this.navLevel="year"};this.handleQuickNavMonthClick=e=>{if(this.isMonthDisabled(e))return;let t=(e.getFullYear()-this.focusedDate.getFullYear())*12+(e.getMonth()-this.focusedDate.getMonth());this.jumpFocused(w(this.focusedDate,t)),this.navLevel="day"};this.handleQuickNavYearClick=e=>{if(this.isYearDisabled(e))return;let t=e.getFullYear()-this.focusedDate.getFullYear();this.jumpFocused(g(this.focusedDate,t)),this.navLevel="month"};this.handleHover=e=>{this.hoverDate=e};this.handlePreviousMonth=()=>{this.displayedAnchor=w(this.displayedAnchor,-1)};this.handleNextMonth=()=>{this.displayedAnchor=w(this.displayedAnchor,1)};this.handlePreviousYear=()=>{this.displayedAnchor=g(this.displayedAnchor,-1)};this.handleNextYear=()=>{this.displayedAnchor=g(this.displayedAnchor,1)};this.handlePreviousYearsPage=()=>{this.displayedAnchor=g(this.displayedAnchor,-12)};this.handleNextYearsPage=()=>{this.displayedAnchor=g(this.displayedAnchor,12)};this.handleToday=()=>{let e=new Date;this.displayedAnchor=y(e),this.jumpFocused(this.nearestWorkweekDay(b(e),1))};this.navigateGridPrevious=()=>{switch(this.navLevel){case"month":this.handlePreviousYear();break;case"year":this.handlePreviousYearsPage();break;default:this.handlePreviousMonth();break}};this.navigateGridNext=()=>{switch(this.navLevel){case"month":this.handleNextYear();break;case"year":this.handleNextYearsPage();break;default:this.handleNextMonth();break}};this.swipeStart=null;this.handleSwipeStart=e=>{e.pointerType==="touch"&&(this.swipeStart={x:e.clientX,y:e.clientY})};this.handleSwipeEnd=e=>{let t=this.swipeStart;if(this.swipeStart=null,e.pointerType!=="touch"||!t)return;let a=e.clientX-t.x,i=e.clientY-t.y;Math.abs(a)<o.SWIPE_THRESHOLD_PX||Math.abs(a)<Math.abs(i)||(a<0?(this.navigateGridNext(),this.playSwipeAnimation("next")):(this.navigateGridPrevious(),this.playSwipeAnimation("previous")))};this.handleSwipeCancel=()=>{this.swipeStart=null};this.handlePeriodSegmentClick=()=>{this.setPeriodSegment(ke(this.timeSegments.period||"AM"))};this.handlePeriodSegmentKeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":case"Enter":case" ":e.preventDefault(),this.handlePeriodSegmentClick();break;case"a":case"A":e.preventDefault(),this.setPeriodSegment("AM");break;case"p":case"P":e.preventDefault(),this.setPeriodSegment("PM");break;case"ArrowLeft":e.preventDefault(),this.focusPreviousTimeSegment("period");break;case"ArrowRight":e.preventDefault(),this.focusNextTimeSegment("period");break;default:break}}}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}connectedCallback(){super.connectedCallback?.(),this.mode==="range"&&this.defaultRangeValue&&(this.rangeValue=this.defaultRangeValue)}formResetCallback(){super.formResetCallback(),this.mode==="range"&&(this.rangeValue=this.defaultRangeValue??{start:null,end:null})}willUpdate(e){let t=e.has("segments")||e.has("rangeSegments")||e.has("timeSegments")||e.has("minTime")||e.has("maxTime");if(this.isWithTimeActive()&&(e.has("value")||e.has("timezone")||e.has("hourFormat")||e.has("locale"))){let a=this.resolvedHourFormat();if(this.value){let i=K(this.value,this.timezone);this.timeSegments=J(i.hour,i.minute,a)}else this.timeSegments=J(null,null,a);t=!0}t&&this.checkValidity(this.value??null),super.willUpdate(e)}updated(e){super.updated(e),e.has("value")&&this.mode==="single"&&(this.segments=G(this.value??null)),e.has("rangeValue")&&this.mode==="range"&&(this.rangeSegments={start:G(this.rangeValue.start),end:G(this.rangeValue.end)}),(e.has("valid")||e.has("hideError")||e.has("disabled"))&&this.setAttribute("aria-invalid",String(!this.hideError&&!this.disabled&&!this.valid))}getFocusAnchor(){return this.firstSegmentEl??void 0}focus(){super.focus?.(),this.firstSegmentEl?.focus()}isMobileViewport(){return window.matchMedia("(max-width: 767px)").matches}isDayDisabled(e){return ie(e,this.minDate,this.maxDate,this.isDateDisabled)}isMonthDisabled(e){return ne(e,this.minDate,this.maxDate,this.isDateDisabled)}isYearDisabled(e){return oe(e,this.minDate,this.maxDate,this.isDateDisabled)}resetStaging(){this.stagingValue=this.value??null,this.stagingRange={start:this.rangeValue.start,end:this.rangeValue.end},this.hoverDate=null,this.navLevel=this.granularity;let e=this.mode==="single"?this.value??new Date:this.rangeValue.start??new Date;if(this.displayedAnchor=e,this.focusedDate=b(e),this.isWithTimeActive()){let t=this.mode==="single"?this.value:this.rangeValue.start;if(t){let{hour:a,minute:i}=K(t,this.timezone);this.stagingTime={hour:a,minute:i}}else this.stagingTime={hour:0,minute:0}}}isWithTimeActive(){return this.withTime&&this.granularity==="day"}resolvedHourFormat(){return we(this.locale,this.hourFormat)}composeWithTime(e){let t=this.stagingTime??{hour:0,minute:0},a=K(e,this.timezone);return ae({year:a.year,month:a.month,day:a.day,hour:t.hour,minute:t.minute},this.timezone??te())}commitStaged(){this.mode==="single"?(this.value=this.isWithTimeActive()&&this.stagingValue?this.composeWithTime(this.stagingValue):this.stagingValue,this.segments=G(this.value)):(this.rangeValue=this.stagingRange,this.rangeSegments={start:G(this.stagingRange.start),end:G(this.stagingRange.end)}),this.dispatchEvent(new H(this.mode==="single"?this.value:this.rangeValue))}commitTypedDate(e,t){e==="value"?this.value=this.isWithTimeActive()?this.composeTypedDateTime(t):t:this.rangeValue={...this.rangeValue,[e]:t},this.dispatchEvent(new H(e==="value"?this.value:this.rangeValue)),(this.isOpen||this.isModalOpen)&&this.resetStaging()}composeTypedDateTime(e){let t=this.resolvedHourFormat(),i=E(this.timeSegments,t);if(!i)if(this.value){let{hour:l,minute:d}=K(this.value,this.timezone);i={hour:l,minute:d}}else i={hour:0,minute:0};return ae({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:i.hour,minute:i.minute},this.timezone??te())}commitTypedTime(e,t){this.value=Ae(this.value??new Date,this.timezone,e,t),this.dispatchEvent(new H(this.value)),(this.isOpen||this.isModalOpen)&&this.resetStaging()}commitTimeSegmentGroupIfComplete(e){let t=this.resolvedHourFormat();if(!Ce(e,t))return;let a=E(e,t);a&&this.commitTypedTime(a.hour,a.minute)}popoverAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--date-picker-panel-transition-duration").trim();if(t){let a=t.endsWith("ms")?Number.parseFloat(t):Number.parseFloat(t)*1e3;if(Number.isFinite(a)&&a>=0)return a}return 200}playPopoverOpenAnimation(e){e.style.removeProperty("pointer-events");let t=this.popoverAnimationDuration(e);t!==0&&(this.popoverAnimation=e.animate([{opacity:0,transform:"scaleY(0.01)"},{opacity:1,transform:"scaleY(1)"}],{duration:t,easing:"ease",fill:"forwards"}))}closePopover(){let e=this.popoverEl;this.popoverAnimation?.cancel(),this.popoverAnimation=void 0,e?.matches(":popover-open")&&this.playPopoverCloseAnimation(e)}playPopoverCloseAnimation(e){e.style.pointerEvents="none";let t=this.popoverAnimationDuration(e);if(t===0){e.hidePopover();return}let a=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.popoverAnimation=a,a.finished.then(()=>{this.popoverAnimation===a&&(this.popoverAnimation=void 0),e.hidePopover()}).catch(()=>{})}focusCalendarCell(){(this.isModalOpen?this.shadowRoot:this.popoverEl)?.querySelector('.grid-cell[tabindex="0"]')?.focus({preventScroll:!0})}syncDisplayedAnchor(){switch(this.granularity){case"month":R(this.focusedDate,this.displayedAnchor)||(this.displayedAnchor=this.focusedDate);break;case"year":V(this.focusedDate.getFullYear())!==V(this.displayedAnchor.getFullYear())&&(this.displayedAnchor=this.focusedDate);break;default:T(this.focusedDate,this.displayedAnchor)||(this.displayedAnchor=y(this.focusedDate));break}}moveFocused(e,t,a){let i=e>0?1:-1,l=t(this.focusedDate,e);for(let d=0;a(l)&&d<1e3;d+=1)l=t(l,i);this.focusedDate=l,this.syncDisplayedAnchor(),this.updateComplete.then(()=>this.focusCalendarCell())}jumpFocused(e){this.focusedDate=e,this.syncDisplayedAnchor(),this.updateComplete.then(()=>this.focusCalendarCell())}isDayFocusSkippable(e){return this.isDayDisabled(e)||this.workWeek&&O(e)}nearestWorkweekDay(e,t){if(!this.workWeek)return e;let a=e;for(let i=0;O(a)&&i<2;i+=1)a=$(a,t);return a}commitCell(e){this.focusedDate=e;let t;if(this.mode==="single")this.stagingValue=e,t=!0;else{let{start:a,end:i}=this.stagingRange;if(!a||i)this.stagingRange={start:e,end:null},this.hoverDate=null,t=!1;else{let[l,d]=e.getTime()<a.getTime()?[e,a]:[a,e];this.stagingRange={start:l,end:d},t=!0}}this.isModalOpen||this.isWithTimeActive()&&this.isOpen||t&&(this.commitStaged(),this.closePopover())}handleDayClick(e){this.isDayDisabled(e)||this.commitCell(e)}handleMonthClick(e){this.isMonthDisabled(e)||this.commitCell(e)}handleYearClick(e){this.isYearDisabled(e)||this.commitCell(e)}playSwipeAnimation(e){this.updateComplete.then(()=>{let t=this.swipeAreaEl;t&&(t.classList.remove("slide-in-next","slide-in-previous"),t.getBoundingClientRect(),t.classList.add(e==="next"?"slide-in-next":"slide-in-previous"))})}handleSegmentInput(e,t,a){let i=e.target,l=a==="year"?4:2,d=i.value.replace(/\D/g,"").slice(0,l);i.value=d;let p={...this.readSegmentGroup(t),[a]:d};this.writeSegmentGroup(t,p),d.length===l&&this.focusNextSegment(t,a),this.commitSegmentGroupIfComplete(t,p)}commitSegmentGroupIfComplete(e,t){let a=j(this.granularity);if(!Ge(t,a))return;let i=re(t,a);i&&this.commitTypedDate(e,i)}handleSegmentKeydown(e,t,a){let i=e.target;e.key==="Backspace"&&i.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousSegment(t,a)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextSegment(t,a)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustSegment(t,a,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustSegment(t,a,-1))}adjustSegment(e,t,a){let i=this.readSegmentGroup(e),l=Number(i[t]),d=ct(t),c;if(i[t]===""||Number.isNaN(l))c=d;else{let m=ot[t];c=l+a,m&&c>m.max?c=m.min:m&&c<m.min?c=m.max:m||(c=Math.max(0,c))}let p=t==="year"?4:2,k=String(c).padStart(p,"0").slice(-p),D={...i,[t]:k};this.writeSegmentGroup(e,D),this.commitSegmentGroupIfComplete(e,D)}readSegmentGroup(e){return e==="value"?this.segments:this.rangeSegments[e]}writeSegmentGroup(e,t){e==="value"?this.segments=t:this.rangeSegments={...this.rangeSegments,[e]:t}}visibleSegmentOrder(){let e=j(this.granularity);return Ke(this.locale).filter(t=>e.includes(t))}focusPreviousSegment(e,t){let a=this.visibleSegmentOrder(),i=a.indexOf(t);i<=0||this.focusSegment(e,a[i-1])}focusNextSegment(e,t){let a=this.visibleSegmentOrder(),i=a.indexOf(t);i===-1||i>=a.length-1||this.focusSegment(e,a[i+1])}focusSegment(e,t){this.shadowRoot?.querySelector(`.segment-group[data-target="${e}"] .segment-${t}`)?.focus()}handleTimeSegmentInput(e,t){let a=e.target,i=a.value.replace(/\D/g,"").slice(0,2);a.value=i;let l={...this.timeSegments,[t]:i};this.timeSegments=l,i.length===2&&this.focusNextTimeSegment(t),this.commitTimeSegmentGroupIfComplete(l)}handleTimeSegmentKeydown(e,t){let a=e.target;e.key==="Backspace"&&a.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousTimeSegment(t)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextTimeSegment(t)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustTimeSegment(t,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustTimeSegment(t,-1))}adjustTimeSegment(e,t){let a=this.resolvedHourFormat(),i=e==="hour"?a===12?{min:1,max:12}:{min:0,max:23}:{min:0,max:59},l=Number(this.timeSegments[e]),d;if(this.timeSegments[e]===""||Number.isNaN(l)){let p=K(this.value??new Date,this.timezone);d=e==="hour"?a===12?Z(p.hour).hour:p.hour:p.minute}else d=l+t,d>i.max?d=i.min:d<i.min&&(d=i.max);let c={...this.timeSegments,[e]:String(d).padStart(2,"0")};this.timeSegments=c,this.commitTimeSegmentGroupIfComplete(c)}setPeriodSegment(e){if(this.disabled||this.readonly)return;let t={...this.timeSegments,period:e};this.timeSegments=t,this.commitTimeSegmentGroupIfComplete(t)}visibleTimeSegmentOrder(){let e=Me(this.resolvedHourFormat());return $e(this.locale).filter(t=>e.includes(t))}focusPreviousTimeSegment(e){let t=this.visibleTimeSegmentOrder(),a=t.indexOf(e);a<=0||this.focusTimeSegment(t[a-1])}focusNextTimeSegment(e){let t=this.visibleTimeSegmentOrder(),a=t.indexOf(e);a===-1||a>=t.length-1||this.focusTimeSegment(t[a+1])}focusTimeSegment(e){this.shadowRoot?.querySelector(`.segment-${e}`)?.focus()}renderTimeSegmentGroup(){let e=this.visibleTimeSegmentOrder();return u`
690
690
  <div
691
691
  class="segment-group time-segment-group"
692
692
  role="group"
@@ -1 +1 @@
1
- import{a,b}from"./chunks/chunk-DENMN3WH.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-XH6NREVZ.js";export{b as EunomiaIcon,a as EunomiaIconTagName};
1
+ import{a,b,c}from"./chunks/chunk-3LMI7KUA.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-XH6NREVZ.js";export{c as EunomiaIcon,a as EunomiaIconTagName,b as setIconBaseUrl};
@@ -1,4 +1,4 @@
1
- import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as C,e as h}from"./chunks/chunk-2IQUMAMI.js";import{a as u}from"./chunks/chunk-ONYUXQV2.js";import{a as L}from"./chunks/chunk-T7WABJEJ.js";import{a as m}from"./chunks/chunk-5EVP7YNE.js";import{a as l,f as y,g as k,h as s,i as F,j as $,n as d,p as b,s as w}from"./chunks/chunk-XH6NREVZ.js";var v=class g extends Event{static{this.eventName="eunfilereject"}constructor(x){super(g.eventName,{bubbles:!0,composed:!1}),this.files=x}};var M=k`
1
+ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as C,e as h}from"./chunks/chunk-KNM5QHDK.js";import{a as u}from"./chunks/chunk-YYCEPZUN.js";import{a as L}from"./chunks/chunk-T7WABJEJ.js";import{a as m}from"./chunks/chunk-5EVP7YNE.js";import{a as l,f as y,g as k,h as s,i as F,j as $,n as d,p as b,s as w}from"./chunks/chunk-XH6NREVZ.js";var v=class g extends Event{static{this.eventName="eunfilereject"}constructor(x){super(g.eventName,{bubbles:!0,composed:!1}),this.files=x}};var M=k`
2
2
  :host {
3
3
  --_borderColor: var(
4
4
  --input-file-border-color,
@@ -272,11 +272,11 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
272
272
  outline: 2px solid var(--_focusIndicator);
273
273
  outline-offset: 2px;
274
274
  }
275
- `,S=M;var D="eun-input-file",j=L(C(w)),B=E(z(_(j))),i=class extends B{constructor(){super(...arguments);this.kind="image";this.multiple=!1;this.selectable=!1;this.dropLabel="Drag and drop files here, or";this.browseLabel="browse files";this.ariaLabelRemove="Remove file";this.ariaLabelSelect="Select file";this.removeAllLabel="Remove all";this.selectAllLabel="Select all";this.deleteSelectedLabel="Delete selected";this.ariaLabelOpen="Open in a new tab";this.dragging=!1;this.selected=new Set;this.dragCounter=0;this.objectUrls=new Map;this.handleHostFocus=()=>{this.firstFocusable()?.focus()};this.handleNativeChange=e=>{let t=e.target;t.files?.length&&this.processFiles(t.files),t.value=""};this.handleDragEnter=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||(e.preventDefault(),this.dragCounter+=1,this.dragging=!0)};this.handleDragOver=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||e.preventDefault()};this.handleDragLeave=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||(this.dragCounter=Math.max(this.dragCounter-1,0),this.dragCounter===0&&(this.dragging=!1))};this.handleDrop=e=>{if(e.preventDefault(),this.dragCounter=0,this.dragging=!1,this.disabled||this.readonly)return;let t=e.dataTransfer?.files;t?.length&&this.processFiles(t)}}connectedCallback(){super.connectedCallback?.(),this.addEventListener("focus",this.handleHostFocus),this.addEventListener("dragenter",this.handleDragEnter),this.addEventListener("dragover",this.handleDragOver),this.addEventListener("dragleave",this.handleDragLeave),this.addEventListener("drop",this.handleDrop)}disconnectedCallback(){this.removeEventListener("focus",this.handleHostFocus),this.removeEventListener("dragenter",this.handleDragEnter),this.removeEventListener("dragover",this.handleDragOver),this.removeEventListener("dragleave",this.handleDragLeave),this.removeEventListener("drop",this.handleDrop),this.objectUrls.forEach(e=>URL.revokeObjectURL(e)),this.objectUrls.clear(),super.disconnectedCallback?.()}firstFocusable(){return this.fieldEl??this.shadowRoot?.querySelector(".item")??void 0}updated(e){if(super.updated(e),e.has("value")){let t=new Set(this.value??[]);if(this.objectUrls.forEach((r,o)=>{t.has(o)||(URL.revokeObjectURL(r),this.objectUrls.delete(o))}),this.selected.size){let r=new Set(Array.from(this.selected).filter(o=>t.has(o)));r.size!==this.selected.size&&(this.selected=r)}}}getFocusAnchor(){return this.firstFocusable()}focus(){super.focus?.(),this.firstFocusable()?.focus()}get effectiveAccept(){return this.accept?this.accept:this.kind==="image"?"image/*":void 0}getObjectUrl(e){let t=this.objectUrls.get(e);return t||(t=URL.createObjectURL(e),this.objectUrls.set(e,t)),t}matchesAccept(e,t){let r=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);if(!r.length)return!0;let o=e.name.toLowerCase(),a=e.type.toLowerCase();return r.some(n=>n.startsWith(".")?o.endsWith(n):n.endsWith("/*")?a.startsWith(n.slice(0,-1)):a===n)}processFiles(e){if(this.disabled||this.readonly)return;let t=this.multiple?Array.from(e):Array.from(e).slice(0,1),r=[],o=this.effectiveAccept,a=[];t.forEach(c=>{if(o&&!this.matchesAccept(c,o)){r.push({file:c,reason:"type"});return}if(this.maxSize!=null&&c.size>this.maxSize){r.push({file:c,reason:"size"});return}a.push(c)});let n=this.value??[],f;if(this.multiple){if(this.maxFiles!=null){let c=Math.max(this.maxFiles-n.length,0);a.length>c&&(r.push(...a.slice(c).map(R=>({file:R,reason:"max-files"}))),a=a.slice(0,c))}f=[...n,...a]}else f=a;a.length&&(this.value=f,this.dispatchEvent(new u)),r.length&&this.dispatchEvent(new v(r))}carriesFiles(e){return!!e.dataTransfer?.types.includes("Files")}removeFile(e){let t=this.value??[],r=t.indexOf(e);if(r===-1)return;let o=t.filter(a=>a!==e);this.value=o,this.dispatchEvent(new u),this.updateComplete.then(()=>{if(!o.length){this.firstFocusable()?.focus();return}let a=Array.from(this.shadowRoot?.querySelectorAll(".item")??[]);a[Math.min(r,a.length-1)]?.focus()})}removeAll(){this.selected=new Set,this.value=[],this.dispatchEvent(new u),this.updateComplete.then(()=>this.firstFocusable()?.focus())}deleteSelected(){let t=(this.value??[]).filter(r=>!this.selected.has(r));this.selected=new Set,this.value=t,this.dispatchEvent(new u),this.updateComplete.then(()=>this.firstFocusable()?.focus())}toggleSelected(e,t){let r=new Set(this.selected);t?r.add(e):r.delete(e),this.selected=r}toggleSelectAll(e){this.selected=e?new Set(this.value??[]):new Set}openFile(e){window.open(this.getObjectUrl(e),"_blank","noopener")}handleItemKeydown(e,t){if(!this.disabled){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.openFile(t);return}(e.key==="Delete"||e.key==="Backspace")&&(e.preventDefault(),this.removeFile(t))}}getFileIcon(e){return e.type==="application/pdf"?"picture_as_pdf":e.type.startsWith("image/")?"image":"insert_drive_file"}formatBytes(e){if(e<1024)return`${e} B`;let t=["KB","MB","GB","TB"],r=e/1024,o=0;for(;r>=1024&&o<t.length-1;)r/=1024,o+=1;let a=o===0||r>=10?0:1;return`${r.toFixed(a)} ${t[o]}`}renderDropzone(e,t){return d`
275
+ `,S=M;var D="eun-input-file",j=L(C(w)),B=E(z(_(j))),r=class extends B{constructor(){super(...arguments);this.kind="image";this.multiple=!1;this.selectable=!1;this.dropLabel="Drag and drop files here, or";this.browseLabel="browse files";this.ariaLabelRemove="Remove file";this.ariaLabelSelect="Select file";this.removeAllLabel="Remove all";this.selectAllLabel="Select all";this.deleteSelectedLabel="Delete selected";this.ariaLabelOpen="Open in a new tab";this.dragging=!1;this.selected=new Set;this.dragCounter=0;this.objectUrls=new Map;this.handleHostFocus=()=>{this.firstFocusable()?.focus()};this.handleNativeChange=e=>{let t=e.target;t.files?.length&&this.processFiles(t.files),t.value=""};this.handleDragEnter=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||(e.preventDefault(),this.dragCounter+=1,this.dragging=!0)};this.handleDragOver=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||e.preventDefault()};this.handleDragLeave=e=>{this.disabled||this.readonly||!this.carriesFiles(e)||(this.dragCounter=Math.max(this.dragCounter-1,0),this.dragCounter===0&&(this.dragging=!1))};this.handleDrop=e=>{if(e.preventDefault(),this.dragCounter=0,this.dragging=!1,this.disabled||this.readonly)return;let t=e.dataTransfer?.files;t?.length&&this.processFiles(t)}}connectedCallback(){super.connectedCallback?.(),this.addEventListener("focus",this.handleHostFocus),this.addEventListener("dragenter",this.handleDragEnter),this.addEventListener("dragover",this.handleDragOver),this.addEventListener("dragleave",this.handleDragLeave),this.addEventListener("drop",this.handleDrop)}disconnectedCallback(){this.removeEventListener("focus",this.handleHostFocus),this.removeEventListener("dragenter",this.handleDragEnter),this.removeEventListener("dragover",this.handleDragOver),this.removeEventListener("dragleave",this.handleDragLeave),this.removeEventListener("drop",this.handleDrop),this.objectUrls.forEach(e=>URL.revokeObjectURL(e)),this.objectUrls.clear(),super.disconnectedCallback?.()}firstFocusable(){return this.fieldEl??this.shadowRoot?.querySelector(".item")??void 0}updated(e){if(super.updated(e),e.has("value")){let t=new Set(this.value??[]);if(this.objectUrls.forEach((i,o)=>{t.has(o)||(URL.revokeObjectURL(i),this.objectUrls.delete(o))}),this.selected.size){let i=new Set(Array.from(this.selected).filter(o=>t.has(o)));i.size!==this.selected.size&&(this.selected=i)}}}getFocusAnchor(){return this.firstFocusable()}focus(){super.focus?.(),this.firstFocusable()?.focus()}get effectiveAccept(){return this.accept?this.accept:this.kind==="image"?"image/*":void 0}getObjectUrl(e){let t=this.objectUrls.get(e);return t||(t=URL.createObjectURL(e),this.objectUrls.set(e,t)),t}matchesAccept(e,t){let i=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);if(!i.length)return!0;let o=e.name.toLowerCase(),a=e.type.toLowerCase();return i.some(n=>n.startsWith(".")?o.endsWith(n):n.endsWith("/*")?a.startsWith(n.slice(0,-1)):a===n)}processFiles(e){if(this.disabled||this.readonly)return;let t=this.multiple?Array.from(e):Array.from(e).slice(0,1),i=[],o=this.effectiveAccept,a=[];t.forEach(c=>{if(o&&!this.matchesAccept(c,o)){i.push({file:c,reason:"type"});return}if(this.maxSize!=null&&c.size>this.maxSize){i.push({file:c,reason:"size"});return}a.push(c)});let n=this.value??[],f;if(this.multiple){if(this.maxFiles!=null){let c=Math.max(this.maxFiles-n.length,0);a.length>c&&(i.push(...a.slice(c).map(R=>({file:R,reason:"max-files"}))),a=a.slice(0,c))}f=[...n,...a]}else f=a;a.length&&(this.value=f,this.dispatchEvent(new u(this.value))),i.length&&this.dispatchEvent(new v(i))}carriesFiles(e){return!!e.dataTransfer?.types.includes("Files")}removeFile(e){let t=this.value??[],i=t.indexOf(e);if(i===-1)return;let o=t.filter(a=>a!==e);this.value=o,this.dispatchEvent(new u(this.value)),this.updateComplete.then(()=>{if(!o.length){this.firstFocusable()?.focus();return}let a=Array.from(this.shadowRoot?.querySelectorAll(".item")??[]);a[Math.min(i,a.length-1)]?.focus()})}removeAll(){this.selected=new Set,this.value=[],this.dispatchEvent(new u(this.value)),this.updateComplete.then(()=>this.firstFocusable()?.focus())}deleteSelected(){let t=(this.value??[]).filter(i=>!this.selected.has(i));this.selected=new Set,this.value=t,this.dispatchEvent(new u(this.value)),this.updateComplete.then(()=>this.firstFocusable()?.focus())}toggleSelected(e,t){let i=new Set(this.selected);t?i.add(e):i.delete(e),this.selected=i}toggleSelectAll(e){this.selected=e?new Set(this.value??[]):new Set}openFile(e){window.open(this.getObjectUrl(e),"_blank","noopener")}handleItemKeydown(e,t){if(!this.disabled){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.openFile(t);return}(e.key==="Delete"||e.key==="Backspace")&&(e.preventDefault(),this.removeFile(t))}}getFileIcon(e){return e.type==="application/pdf"?"picture_as_pdf":e.type.startsWith("image/")?"image":"insert_drive_file"}formatBytes(e){if(e<1024)return`${e} B`;let t=["KB","MB","GB","TB"],i=e/1024,o=0;for(;i>=1024&&o<t.length-1;)i/=1024,o+=1;let a=o===0||i>=10?0:1;return`${i.toFixed(a)} ${t[o]}`}renderDropzone(e,t){return d`
276
276
  <label
277
277
  id="dropzone"
278
278
  aria-disabled=${e?"true":"false"}
279
- @click=${r=>{this.readonly&&r.preventDefault()}}
279
+ @click=${i=>{this.readonly&&i.preventDefault()}}
280
280
  >
281
281
  <eun-icon id="drop-icon" name="cloud_upload" size="24"></eun-icon>
282
282
  <span class="drop-label"
@@ -290,7 +290,7 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
290
290
  ?multiple=${this.multiple}
291
291
  ?disabled=${e}
292
292
  aria-label=${m(this.label)}
293
- aria-invalid=${this.valid?"false":"true"}
293
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
294
294
  aria-describedby=${t?"description":b}
295
295
  @change=${this.handleNativeChange}
296
296
  />
@@ -302,7 +302,7 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
302
302
  tabindex=${this.disabled?"-1":"0"}
303
303
  aria-label="${e.name} — ${this.ariaLabelOpen}"
304
304
  @click=${()=>!this.disabled&&this.openFile(e)}
305
- @keydown=${r=>this.handleItemKeydown(r,e)}
305
+ @keydown=${i=>this.handleItemKeydown(i,e)}
306
306
  >
307
307
  ${p(this.selectable,()=>d`
308
308
  <input
@@ -311,8 +311,8 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
311
311
  aria-label="${this.ariaLabelSelect} ${e.name}"
312
312
  .checked=${t}
313
313
  ?disabled=${this.disabled||this.readonly}
314
- @click=${r=>r.stopPropagation()}
315
- @change=${r=>this.toggleSelected(e,r.target.checked)}
314
+ @click=${i=>i.stopPropagation()}
315
+ @change=${i=>this.toggleSelected(e,i.target.checked)}
316
316
  />
317
317
  `)}
318
318
  ${this.kind==="image"?d`<img src=${this.getObjectUrl(e)} alt="" />`:d`
@@ -331,16 +331,16 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
331
331
  class="item-remove"
332
332
  aria-label="${this.ariaLabelRemove} ${e.name}"
333
333
  ?disabled=${this.disabled||this.readonly}
334
- @click=${r=>{r.stopPropagation(),this.removeFile(e)}}
334
+ @click=${i=>{i.stopPropagation(),this.removeFile(e)}}
335
335
  >
336
336
  <eun-icon name="close" size="14"></eun-icon>
337
337
  </button>
338
338
  </div>
339
- `}render(){let e=this.renderDescription(),t=this.value??[],r=this.multiple||t.length===0,o=this.multiple&&this.maxFiles!=null&&t.length>=this.maxFiles,a=t.length>0&&this.selected.size===t.length;return d`
339
+ `}render(){let e=this.renderDescription(),t=this.value??[],i=this.multiple||t.length===0,o=this.multiple&&this.maxFiles!=null&&t.length>=this.maxFiles,a=t.length>0&&this.selected.size===t.length;return d`
340
340
  <div id="wrapper">
341
341
  ${this.renderFormLabels("field")}
342
342
  <div id="content">
343
- ${p(r,()=>this.renderDropzone(this.disabled||o,e!==b))}
343
+ ${p(i,()=>this.renderDropzone(this.disabled||o,e!==b))}
344
344
  ${p(t.length>0,()=>d`
345
345
  <div id="header">
346
346
  <span aria-live="polite"
@@ -386,4 +386,4 @@ import{a as E}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as p,c as _,d as
386
386
  </div>
387
387
  ${e}
388
388
  </div>
389
- `}};i.styles=[S,h.base,h.errorMessages,h.hintMessages],l([s({reflect:!0})],i.prototype,"kind",2),l([s()],i.prototype,"accept",2),l([s({type:Boolean,reflect:!0})],i.prototype,"multiple",2),l([s({type:Number,attribute:"max-size"})],i.prototype,"maxSize",2),l([s({type:Number,attribute:"max-files"})],i.prototype,"maxFiles",2),l([s({type:Boolean,reflect:!0})],i.prototype,"selectable",2),l([s({attribute:"drop-label"})],i.prototype,"dropLabel",2),l([s({attribute:"browse-label"})],i.prototype,"browseLabel",2),l([s({attribute:"aria-label-remove"})],i.prototype,"ariaLabelRemove",2),l([s({attribute:"aria-label-select"})],i.prototype,"ariaLabelSelect",2),l([s({attribute:"remove-all-label"})],i.prototype,"removeAllLabel",2),l([s({attribute:"select-all-label"})],i.prototype,"selectAllLabel",2),l([s({attribute:"delete-selected-label"})],i.prototype,"deleteSelectedLabel",2),l([s({attribute:"aria-label-open"})],i.prototype,"ariaLabelOpen",2),l([s({type:Boolean,reflect:!0})],i.prototype,"dragging",2),l([F()],i.prototype,"selected",2),l([$("#field")],i.prototype,"fieldEl",2),i=l([y(D)],i);export{i as EunomiaInputFile,D as EunomiaInputFileTagName};
389
+ `}};r.styles=[S,h.base,h.errorMessages,h.hintMessages],l([s({reflect:!0})],r.prototype,"kind",2),l([s()],r.prototype,"accept",2),l([s({type:Boolean,reflect:!0})],r.prototype,"multiple",2),l([s({type:Number,attribute:"max-size"})],r.prototype,"maxSize",2),l([s({type:Number,attribute:"max-files"})],r.prototype,"maxFiles",2),l([s({type:Boolean,reflect:!0})],r.prototype,"selectable",2),l([s({attribute:"drop-label"})],r.prototype,"dropLabel",2),l([s({attribute:"browse-label"})],r.prototype,"browseLabel",2),l([s({attribute:"aria-label-remove"})],r.prototype,"ariaLabelRemove",2),l([s({attribute:"aria-label-select"})],r.prototype,"ariaLabelSelect",2),l([s({attribute:"remove-all-label"})],r.prototype,"removeAllLabel",2),l([s({attribute:"select-all-label"})],r.prototype,"selectAllLabel",2),l([s({attribute:"delete-selected-label"})],r.prototype,"deleteSelectedLabel",2),l([s({attribute:"aria-label-open"})],r.prototype,"ariaLabelOpen",2),l([s({type:Boolean,reflect:!0})],r.prototype,"dragging",2),l([F()],r.prototype,"selected",2),l([$("#field")],r.prototype,"fieldEl",2),r=l([y(D)],r);export{r as EunomiaInputFile,D as EunomiaInputFileTagName};