@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 q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk-6UPI7GHJ.js";import{a as X}from"./chunks/chunk-L74LXUGL.js";import{a as U}from"./chunks/chunk-XSMCT4DF.js";import{a as G}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as F,c as j,d as K,e as E}from"./chunks/chunk-2IQUMAMI.js";import{a as S}from"./chunks/chunk-ONYUXQV2.js";import{a as N,b as y,c as w,d as R,e as V,f as A,g as O}from"./chunks/chunk-5TH3P53V.js";import{a as B}from"./chunks/chunk-T7WABJEJ.js";import{a as P}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as v}from"./chunks/chunk-5EVP7YNE.js";import{a as c,f as I,g as _,h as u,i as C,j as k,n as f,p as b,s as D}from"./chunks/chunk-XH6NREVZ.js";var oe=_`
1
+ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk-6UPI7GHJ.js";import{a as X}from"./chunks/chunk-L74LXUGL.js";import{a as U}from"./chunks/chunk-XSMCT4DF.js";import{a as G}from"./chunks/chunk-GW3VP2L7.js";import{a as z,b as F,c as j,d as K,e as C}from"./chunks/chunk-KNM5QHDK.js";import{a as S}from"./chunks/chunk-YYCEPZUN.js";import{a as N,b as y,c as w,d as R,e as V,f as A,g as O}from"./chunks/chunk-5TH3P53V.js";import{a as B}from"./chunks/chunk-T7WABJEJ.js";import{a as P}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as v}from"./chunks/chunk-5EVP7YNE.js";import{a as c,f as I,g as _,h as u,i as E,j as k,n as f,p as b,s as D}from"./chunks/chunk-XH6NREVZ.js";var re=_`
2
2
  #field {
3
3
  resize: vertical;
4
4
  min-height: 6rem;
@@ -153,8 +153,8 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
153
153
  #char-count[data-exceeded] {
154
154
  color: var(--_errorColor);
155
155
  }
156
- `,Y=[W,oe];var re="eun-textarea",H={bold:"STRONG",italic:"EM",underline:"U"},T={bold:()=>document.createElement("strong"),italic:()=>document.createElement("em"),underline:()=>document.createElement("u")},se={b:"bold",i:"italic",u:"underline"};function ce(n){return!(n.ctrlKey||n.metaKey)||n.altKey?null:se[n.key.toLowerCase()]??null}function J(n,l){let e=l;for(;e&&e.parentNode!==n;)e=e.parentNode;return e}function m(n){let l=n.getRootNode();return l instanceof ShadowRoot&&typeof l.getSelection=="function"?l.getSelection():window.getSelection()}function $(n){let l=m(n);if(!l||!l.rangeCount)return null;let e=l.getRangeAt(0);return e.collapsed||!n.contains(e.commonAncestorContainer)?null:e}function ne(n,l){let e=document.createRange();e.selectNodeContents(l),n.removeAllRanges(),n.addRange(e)}function Q(n){let l=m(n);if(!l||!l.rangeCount)return null;let e=l.getRangeAt(0);return!e.collapsed||!n.contains(e.commonAncestorContainer)?null:e}function de(n){return!n.bold&&!n.italic&&!n.underline&&!n.color&&!n.highlight}var x="\u200B";function ue(n){let l=[];if(n.bold&&l.push(T.bold()),n.italic&&l.push(T.italic()),n.underline&&l.push(T.underline()),n.color){let e=y(n.color),t=document.createElement("span");t.setAttribute("data-color",n.color),t.style.color=e?.text??"inherit",l.push(t)}if(n.highlight){let e=y(n.highlight),t=document.createElement("span");t.setAttribute("data-highlight",n.highlight),t.style.backgroundColor=e?.highlight??"transparent",l.push(t)}if(!l.length)return null;for(let e=0;e<l.length-1;e+=1)l[e].appendChild(l[e+1]);return l[l.length-1].appendChild(document.createTextNode(x)),l[0]}function he(n,l){let e=l;for(;e.parentNode&&e.parentNode!==n&&e.parentNode.childNodes.length===1;)e=e.parentNode;return e}function Z(n,l){let e=he(n,l),t=e.parentNode,i=Array.from(t.childNodes).indexOf(e);t.removeChild(e);let a=document.createRange();return a.setStart(t,i),a.collapse(!0),a}function ee(n,l,e,t){let i=l,a=e;for(;;){let o=i.parentNode;if(!o||o===n)break;let r=i.nodeType===Node.TEXT_NODE?i.textContent?.length??0:i.childNodes.length;if(!(t?a===0:a===r))break;let h=Array.from(o.childNodes).indexOf(i);i=o,a=t?h:h+1}return{container:i,offset:a}}function le(n,l){let e=ee(n,l.startContainer,l.startOffset,!0),t=ee(n,l.endContainer,l.endOffset,!1);l.setStart(e.container,e.offset),l.setEnd(t.container,t.offset)}function ae(n,l){n.querySelectorAll("*").forEach(e=>{if(!l(e))return;let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}})}function pe(n,l,e){let t=m(n),i=$(n);if(!t||!i)return!1;le(n,i);let a=H[l],o=i.extractContents();ae(o,d=>d.tagName===a);let r=o;if(e){let d=T[l]();d.appendChild(o),r=d}return i.insertNode(r),ne(t,r),!0}function fe(n,l,e){let t=m(n),i=$(n);if(!t||!i)return!1;le(n,i);let a=l==="color"?"color":"highlight",o=i.extractContents();ae(o,d=>d.tagName==="SPAN"&&d.hasAttribute(`data-${a}`));let r=o;if(e){let d=y(e),h=document.createElement("span");h.setAttribute(`data-${a}`,e),h.style.cssText=l==="color"?`color: ${d?.text??"inherit"}`:`background-color: ${d?.highlight??"transparent"}`,h.appendChild(o),r=h}return i.insertNode(r),ne(t,r),!0}function te(n){let l=m(n);if(!l||!l.anchorNode||!n.contains(l.anchorNode))return[];let e=new Set,t=l.anchorNode;for(;t&&t!==n;){if(t instanceof HTMLElement){let i=Object.entries(H).find(([,a])=>a===t.tagName)?.[0];i&&e.add(i)}t=t.parentNode}return Array.from(e)}function ie(n,l){let e=m(n);if(!e||!e.anchorNode||!n.contains(e.anchorNode))return null;let t=e.anchorNode;for(;t&&t!==n;){if(t instanceof HTMLElement){let i=l==="color"?t.getAttribute("data-color"):t.getAttribute("data-highlight");if(i)return i}t=t.parentNode}return null}var ge=B(K(D)),me=U(G(z(q(j(ge))))),s=class extends me{constructor(){super(...arguments);this.formatting=!1;this.formatToolbarLabel="Text formatting";this.formatBoldLabel="Bold";this.formatItalicLabel="Italic";this.formatUnderlineLabel="Underline";this.formatAlignLabel="Text alignment";this.formatAlignStartLabel="Align left";this.formatAlignCenterLabel="Center";this.formatAlignEndLabel="Align right";this.formatAlignJustifyLabel="Justify";this.formatTextColorLabel="Text color";this.formatHighlightLabel="Highlight";this.formatColorClearLabel="Default";this.colorLabels=Object.fromEntries(N.map(e=>[e.name,e.label]));this.autocomplete="off";this.emptyValueLabel="No value set";this.confirmLabel="Save";this.cancelLabel="Cancel";this.openPicker=null;this.activeTextColor=null;this.activeHighlight=null;this.previousActiveFormats=[];this.pendingMarks={bold:!1,italic:!1,underline:!1,color:null,highlight:null};this.pendingCaretNode=null;this.handleHostFocus=()=>{this.fieldEl?.focus()};this.checkLocalValidators=()=>this.formatting?this.checkEditableValidators():X(this.fieldEl,["valueMissing","tooShort","tooLong"]);this.handleEditableInput=()=>{let e=this.fieldEl;if(!(e instanceof HTMLDivElement))return;let t=O(e);this.lastSyncedValue=t,this.value=t,this.resizeEditableField(),this.dispatchEvent(new S),this.syncToolbarToSelection()};this.handleEditableBeforeInput=e=>{if(this.maxlength===void 0)return;let t=this.fieldEl;if(!(t instanceof HTMLDivElement)||!e.inputType.startsWith("insert"))return;let i=m(t);!(i&&!i.isCollapsed)&&(t.textContent?.length??0)>=this.maxlength&&e.preventDefault()};this.handleEditablePaste=e=>{let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;e.preventDefault();let i=e.clipboardData?.getData("text/plain")??"";if(!i)return;let a=m(t);if(!a||!a.rangeCount)return;let o=a.getRangeAt(0);o.deleteContents();let r=i.split(`
157
- `);if(r.length===1){let d=document.createTextNode(r[0]);o.insertNode(d),o.setStartAfter(d),o.collapse(!0)}else{let d=J(t,o.startContainer),h=o.cloneRange();d&&h.setEndAfter(d.lastChild??d);let p=h.extractContents();o.insertNode(document.createTextNode(r[0]));let g=d;for(let M=1;M<r.length;M+=1){let L=document.createElement("p");L.textContent=r[M],g?.after(L),g=L}g?.appendChild(p),g&&o.selectNodeContents(g),o.collapse(!1)}a.removeAllRanges(),a.addRange(o),this.handleEditableInput()};this.handleEditableKeydown=e=>{let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;let i=ce(e);if(i){e.preventDefault();let g=te(t).includes(i);this.applyFormat(i,!g);return}if(e.key!=="Enter")return;e.preventDefault();let a=m(t);if(!a||!a.rangeCount)return;let o=a.getRangeAt(0);o.deleteContents();let r=J(t,o.startContainer);if(!r)return;r.hasChildNodes()||r.appendChild(document.createElement("br"));let d=o.cloneRange();d.setEndAfter(r.lastChild??r);let h=d.extractContents();r.hasChildNodes()||r.appendChild(document.createElement("br"));let p=document.createElement("p");p.appendChild(h),p.hasChildNodes()||p.appendChild(document.createElement("br")),r.after(p),o.selectNodeContents(p),o.collapse(!0),a.removeAllRanges(),a.addRange(o),this.handleEditableInput()};this.handleSelectionChange=()=>{this.cleanupAbandonedPendingMarker(),this.syncToolbarToSelection()};this.handleOutsideClick=e=>{e.composedPath().some(a=>a instanceof HTMLElement&&a.classList.contains("color-picker"))||this.closeColorPicker()}}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),document.removeEventListener("click",this.handleOutsideClick,{capture:!0}),super.disconnectedCallback?.()}firstUpdated(){this.formatting&&this.fieldEl instanceof HTMLDivElement?(A(this.fieldEl,this.value??""),this.lastSyncedValue=this.value,this.resizeEditableField()):this.resizeToContent()}updated(e){if(super.updated(e),e.has("editing")&&this.editing&&this.fieldEl?.focus(),!this.formatting){(e.has("value")||e.has("editing"))&&this.resizeToContent();return}(e.has("editing")&&this.editing||e.has("formatting")&&this.formatting||e.has("value")&&this.value!==this.lastSyncedValue)&&this.fieldEl instanceof HTMLDivElement&&this.fieldEl instanceof HTMLDivElement&&(A(this.fieldEl,this.value??""),this.lastSyncedValue=this.value),(e.has("value")||e.has("editing"))&&this.resizeEditableField()}checkEditableValidators(){let e=R(this.value??"");return this.minlength!==void 0&&e>0&&e<this.minlength?{validity:{tooShort:!0},message:`Please lengthen this text to ${this.minlength} characters or more (you are currently using ${e} characters).`}:this.maxlength!==void 0&&e>this.maxlength?{validity:{tooLong:!0},message:`Please shorten this text to ${this.maxlength} characters or less (you are currently using ${e} characters).`}:{validity:{}}}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}resizeToContent(){let e=this.fieldEl;if(!e||this.rows!==void 0)return;e.style.height="";let t=e.clientHeight;e.style.height="0px";let i=e.scrollHeight;e.style.height=i>t?`${i}px`:""}resizeEditableField(){let e=this.fieldEl;if(!e||!(e instanceof HTMLDivElement))return;if(this.rows===void 0){e.style.height="",e.style.overflowY="";return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;e.style.height=`${t*this.rows}px`,e.style.overflowY="auto"}handleInput(e){this.value=e.target.value,this.resizeToContent(),this.dispatchEvent(new S)}syncToolbarToSelection(){if(!(!this.formatting||!this.fieldEl)){if(this.toolbarEl){let e=te(this.fieldEl);this.previousActiveFormats=e,this.toolbarEl.value=e}this.activeTextColor=ie(this.fieldEl,"color"),this.activeHighlight=ie(this.fieldEl,"highlight")}}cleanupAbandonedPendingMarker(){let e=this.fieldEl,t=this.pendingCaretNode;if(!t||!(e instanceof HTMLDivElement))return;let i=m(e),a=i?.rangeCount?i.getRangeAt(0):null;a&&a.collapsed&&a.startContainer===t||(t.data===x?Z(e,t):t.data=t.data.replace(x,""),this.pendingCaretNode=null,this.pendingMarks={bold:!1,italic:!1,underline:!1,color:null,highlight:null})}updatePendingMarker(e,t){let i=t,a=this.pendingCaretNode,o=!!a&&t.startContainer===a;if(o&&a.data===x?(i=Z(e,a),this.pendingCaretNode=null):o&&(a.data=a.data.replace(x,""),this.pendingCaretNode=null),de(this.pendingMarks))return;let r=ue(this.pendingMarks);if(!r)return;i.insertNode(r);let h=document.createTreeWalker(r,NodeFilter.SHOW_TEXT).nextNode();if(!h)return;this.pendingCaretNode=h;let p=m(e);if(!p)return;let g=document.createRange();g.setStart(h,h.data.length),g.collapse(!0),p.removeAllRanges(),p.addRange(g)}applyFormat(e,t){let i=this.fieldEl;if(!(i instanceof HTMLDivElement))return;if($(i)){if(!pe(i,e,t))return;this.handleEditableInput(),this.updateComplete.then(()=>{i.focus(),this.syncToolbarToSelection()});return}let o=Q(i);o&&(this.pendingMarks={...this.pendingMarks,[e]:t},this.updatePendingMarker(i,o),i.focus(),this.syncToolbarToSelection())}handleToolbarChange(e){e.stopPropagation();let i=e.target.value;Object.keys(H).forEach(a=>{let o=this.previousActiveFormats.includes(a),r=i.includes(a);o!==r&&this.applyFormat(a,r)}),this.previousActiveFormats=i}handleAlignChange(e){e.stopPropagation();let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;let[i]=e.target.value;t.style.textAlign=i==="start"?"":i,this.handleEditableInput(),this.updateComplete.then(()=>t.focus())}toggleColorPicker(e){if(this.openPicker===e){this.closeColorPicker();return}this.openPicker=e,document.addEventListener("click",this.handleOutsideClick,{capture:!0})}closeColorPicker(){this.openPicker!==null&&(this.openPicker=null,document.removeEventListener("click",this.handleOutsideClick,{capture:!0}))}selectColor(e,t){let i=this.fieldEl;if(i instanceof HTMLDivElement)if($(i))fe(i,e,t)&&this.handleEditableInput();else{let o=Q(i);o&&(this.pendingMarks={...this.pendingMarks,[e]:t},this.updatePendingMarker(i,o),this.syncToolbarToSelection())}this.closeColorPicker(),this.updateComplete.then(()=>this.fieldEl?.focus())}renderToolbar(){let e=this.disabled||this.readonly,t=w(this.value??"").align;return f`
156
+ `,Y=[W,re];var oe="eun-textarea",H={bold:"STRONG",italic:"EM",underline:"U"},T={bold:()=>document.createElement("strong"),italic:()=>document.createElement("em"),underline:()=>document.createElement("u")},se={b:"bold",i:"italic",u:"underline"};function ce(n){return!(n.ctrlKey||n.metaKey)||n.altKey?null:se[n.key.toLowerCase()]??null}function J(n,l){let e=l;for(;e&&e.parentNode!==n;)e=e.parentNode;return e}function m(n){let l=n.getRootNode();return l instanceof ShadowRoot&&typeof l.getSelection=="function"?l.getSelection():window.getSelection()}function $(n){let l=m(n);if(!l||!l.rangeCount)return null;let e=l.getRangeAt(0);return e.collapsed||!n.contains(e.commonAncestorContainer)?null:e}function ne(n,l){let e=document.createRange();e.selectNodeContents(l),n.removeAllRanges(),n.addRange(e)}function Q(n){let l=m(n);if(!l||!l.rangeCount)return null;let e=l.getRangeAt(0);return!e.collapsed||!n.contains(e.commonAncestorContainer)?null:e}function de(n){return!n.bold&&!n.italic&&!n.underline&&!n.color&&!n.highlight}var x="\u200B";function ue(n){let l=[];if(n.bold&&l.push(T.bold()),n.italic&&l.push(T.italic()),n.underline&&l.push(T.underline()),n.color){let e=y(n.color),t=document.createElement("span");t.setAttribute("data-color",n.color),t.style.color=e?.text??"inherit",l.push(t)}if(n.highlight){let e=y(n.highlight),t=document.createElement("span");t.setAttribute("data-highlight",n.highlight),t.style.backgroundColor=e?.highlight??"transparent",l.push(t)}if(!l.length)return null;for(let e=0;e<l.length-1;e+=1)l[e].appendChild(l[e+1]);return l[l.length-1].appendChild(document.createTextNode(x)),l[0]}function he(n,l){let e=l;for(;e.parentNode&&e.parentNode!==n&&e.parentNode.childNodes.length===1;)e=e.parentNode;return e}function Z(n,l){let e=he(n,l),t=e.parentNode,i=Array.from(t.childNodes).indexOf(e);t.removeChild(e);let a=document.createRange();return a.setStart(t,i),a.collapse(!0),a}function ee(n,l,e,t){let i=l,a=e;for(;;){let r=i.parentNode;if(!r||r===n)break;let o=i.nodeType===Node.TEXT_NODE?i.textContent?.length??0:i.childNodes.length;if(!(t?a===0:a===o))break;let h=Array.from(r.childNodes).indexOf(i);i=r,a=t?h:h+1}return{container:i,offset:a}}function le(n,l){let e=ee(n,l.startContainer,l.startOffset,!0),t=ee(n,l.endContainer,l.endOffset,!1);l.setStart(e.container,e.offset),l.setEnd(t.container,t.offset)}function ae(n,l){n.querySelectorAll("*").forEach(e=>{if(!l(e))return;let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}})}function pe(n,l,e){let t=m(n),i=$(n);if(!t||!i)return!1;le(n,i);let a=H[l],r=i.extractContents();ae(r,d=>d.tagName===a);let o=r;if(e){let d=T[l]();d.appendChild(r),o=d}return i.insertNode(o),ne(t,o),!0}function fe(n,l,e){let t=m(n),i=$(n);if(!t||!i)return!1;le(n,i);let a=l==="color"?"color":"highlight",r=i.extractContents();ae(r,d=>d.tagName==="SPAN"&&d.hasAttribute(`data-${a}`));let o=r;if(e){let d=y(e),h=document.createElement("span");h.setAttribute(`data-${a}`,e),h.style.cssText=l==="color"?`color: ${d?.text??"inherit"}`:`background-color: ${d?.highlight??"transparent"}`,h.appendChild(r),o=h}return i.insertNode(o),ne(t,o),!0}function te(n){let l=m(n);if(!l||!l.anchorNode||!n.contains(l.anchorNode))return[];let e=new Set,t=l.anchorNode;for(;t&&t!==n;){if(t instanceof HTMLElement){let i=Object.entries(H).find(([,a])=>a===t.tagName)?.[0];i&&e.add(i)}t=t.parentNode}return Array.from(e)}function ie(n,l){let e=m(n);if(!e||!e.anchorNode||!n.contains(e.anchorNode))return null;let t=e.anchorNode;for(;t&&t!==n;){if(t instanceof HTMLElement){let i=l==="color"?t.getAttribute("data-color"):t.getAttribute("data-highlight");if(i)return i}t=t.parentNode}return null}var ge=B(K(D)),me=U(G(z(q(j(ge))))),s=class extends me{constructor(){super(...arguments);this.formatting=!1;this.formatToolbarLabel="Text formatting";this.formatBoldLabel="Bold";this.formatItalicLabel="Italic";this.formatUnderlineLabel="Underline";this.formatAlignLabel="Text alignment";this.formatAlignStartLabel="Align left";this.formatAlignCenterLabel="Center";this.formatAlignEndLabel="Align right";this.formatAlignJustifyLabel="Justify";this.formatTextColorLabel="Text color";this.formatHighlightLabel="Highlight";this.formatColorClearLabel="Default";this.colorLabels=Object.fromEntries(N.map(e=>[e.name,e.label]));this.autocomplete="off";this.emptyValueLabel="No value set";this.confirmLabel="Save";this.cancelLabel="Cancel";this.openPicker=null;this.activeTextColor=null;this.activeHighlight=null;this.previousActiveFormats=[];this.pendingMarks={bold:!1,italic:!1,underline:!1,color:null,highlight:null};this.pendingCaretNode=null;this.handleHostFocus=()=>{this.fieldEl?.focus()};this.checkLocalValidators=()=>this.formatting?this.checkEditableValidators():X(this.fieldEl,["valueMissing","tooShort","tooLong"]);this.handleEditableInput=()=>{let e=this.fieldEl;if(!(e instanceof HTMLDivElement))return;let t=O(e);this.lastSyncedValue=t,this.value=t,this.resizeEditableField(),this.dispatchEvent(new S(this.value)),this.syncToolbarToSelection()};this.handleEditableBeforeInput=e=>{if(this.maxlength===void 0)return;let t=this.fieldEl;if(!(t instanceof HTMLDivElement)||!e.inputType.startsWith("insert"))return;let i=m(t);!(i&&!i.isCollapsed)&&(t.textContent?.length??0)>=this.maxlength&&e.preventDefault()};this.handleEditablePaste=e=>{let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;e.preventDefault();let i=e.clipboardData?.getData("text/plain")??"";if(!i)return;let a=m(t);if(!a||!a.rangeCount)return;let r=a.getRangeAt(0);r.deleteContents();let o=i.split(`
157
+ `);if(o.length===1){let d=document.createTextNode(o[0]);r.insertNode(d),r.setStartAfter(d),r.collapse(!0)}else{let d=J(t,r.startContainer),h=r.cloneRange();d&&h.setEndAfter(d.lastChild??d);let p=h.extractContents();r.insertNode(document.createTextNode(o[0]));let g=d;for(let M=1;M<o.length;M+=1){let L=document.createElement("p");L.textContent=o[M],g?.after(L),g=L}g?.appendChild(p),g&&r.selectNodeContents(g),r.collapse(!1)}a.removeAllRanges(),a.addRange(r),this.handleEditableInput()};this.handleEditableKeydown=e=>{let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;let i=ce(e);if(i){e.preventDefault();let g=te(t).includes(i);this.applyFormat(i,!g);return}if(e.key!=="Enter")return;e.preventDefault();let a=m(t);if(!a||!a.rangeCount)return;let r=a.getRangeAt(0);r.deleteContents();let o=J(t,r.startContainer);if(!o)return;o.hasChildNodes()||o.appendChild(document.createElement("br"));let d=r.cloneRange();d.setEndAfter(o.lastChild??o);let h=d.extractContents();o.hasChildNodes()||o.appendChild(document.createElement("br"));let p=document.createElement("p");p.appendChild(h),p.hasChildNodes()||p.appendChild(document.createElement("br")),o.after(p),r.selectNodeContents(p),r.collapse(!0),a.removeAllRanges(),a.addRange(r),this.handleEditableInput()};this.handleSelectionChange=()=>{this.cleanupAbandonedPendingMarker(),this.syncToolbarToSelection()};this.handleOutsideClick=e=>{e.composedPath().some(a=>a instanceof HTMLElement&&a.classList.contains("color-picker"))||this.closeColorPicker()}}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),document.removeEventListener("click",this.handleOutsideClick,{capture:!0}),super.disconnectedCallback?.()}firstUpdated(){this.formatting&&this.fieldEl instanceof HTMLDivElement?(A(this.fieldEl,this.value??""),this.lastSyncedValue=this.value,this.resizeEditableField()):this.resizeToContent()}updated(e){if(super.updated(e),e.has("editing")&&this.editing&&this.fieldEl?.focus(),!this.formatting){(e.has("value")||e.has("editing"))&&this.resizeToContent();return}(e.has("editing")&&this.editing||e.has("formatting")&&this.formatting||e.has("value")&&this.value!==this.lastSyncedValue)&&this.fieldEl instanceof HTMLDivElement&&this.fieldEl instanceof HTMLDivElement&&(A(this.fieldEl,this.value??""),this.lastSyncedValue=this.value),(e.has("value")||e.has("editing"))&&this.resizeEditableField()}checkEditableValidators(){let e=R(this.value??"");return this.minlength!==void 0&&e>0&&e<this.minlength?{validity:{tooShort:!0},message:`Please lengthen this text to ${this.minlength} characters or more (you are currently using ${e} characters).`}:this.maxlength!==void 0&&e>this.maxlength?{validity:{tooLong:!0},message:`Please shorten this text to ${this.maxlength} characters or less (you are currently using ${e} characters).`}:{validity:{}}}getFocusAnchor(){return this.fieldEl??void 0}focus(){super.focus?.(),this.fieldEl?.focus()}resizeToContent(){let e=this.fieldEl;if(!e||this.rows!==void 0)return;e.style.height="";let t=e.clientHeight;e.style.height="0px";let i=e.scrollHeight;e.style.height=i>t?`${i}px`:""}resizeEditableField(){let e=this.fieldEl;if(!e||!(e instanceof HTMLDivElement))return;if(this.rows===void 0){e.style.height="",e.style.overflowY="";return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;e.style.height=`${t*this.rows}px`,e.style.overflowY="auto"}handleInput(e){this.value=e.target.value,this.resizeToContent(),this.dispatchEvent(new S(this.value))}syncToolbarToSelection(){if(!(!this.formatting||!this.fieldEl)){if(this.toolbarEl){let e=te(this.fieldEl);this.previousActiveFormats=e,this.toolbarEl.value=e}this.activeTextColor=ie(this.fieldEl,"color"),this.activeHighlight=ie(this.fieldEl,"highlight")}}cleanupAbandonedPendingMarker(){let e=this.fieldEl,t=this.pendingCaretNode;if(!t||!(e instanceof HTMLDivElement))return;let i=m(e),a=i?.rangeCount?i.getRangeAt(0):null;a&&a.collapsed&&a.startContainer===t||(t.data===x?Z(e,t):t.data=t.data.replace(x,""),this.pendingCaretNode=null,this.pendingMarks={bold:!1,italic:!1,underline:!1,color:null,highlight:null})}updatePendingMarker(e,t){let i=t,a=this.pendingCaretNode,r=!!a&&t.startContainer===a;if(r&&a.data===x?(i=Z(e,a),this.pendingCaretNode=null):r&&(a.data=a.data.replace(x,""),this.pendingCaretNode=null),de(this.pendingMarks))return;let o=ue(this.pendingMarks);if(!o)return;i.insertNode(o);let h=document.createTreeWalker(o,NodeFilter.SHOW_TEXT).nextNode();if(!h)return;this.pendingCaretNode=h;let p=m(e);if(!p)return;let g=document.createRange();g.setStart(h,h.data.length),g.collapse(!0),p.removeAllRanges(),p.addRange(g)}applyFormat(e,t){let i=this.fieldEl;if(!(i instanceof HTMLDivElement))return;if($(i)){if(!pe(i,e,t))return;this.handleEditableInput(),this.updateComplete.then(()=>{i.focus(),this.syncToolbarToSelection()});return}let r=Q(i);r&&(this.pendingMarks={...this.pendingMarks,[e]:t},this.updatePendingMarker(i,r),i.focus(),this.syncToolbarToSelection())}handleToolbarChange(e){e.stopPropagation();let i=e.target.value;Object.keys(H).forEach(a=>{let r=this.previousActiveFormats.includes(a),o=i.includes(a);r!==o&&this.applyFormat(a,o)}),this.previousActiveFormats=i}handleAlignChange(e){e.stopPropagation();let t=this.fieldEl;if(!(t instanceof HTMLDivElement))return;let[i]=e.target.value;t.style.textAlign=i==="start"?"":i,this.handleEditableInput(),this.updateComplete.then(()=>t.focus())}toggleColorPicker(e){if(this.openPicker===e){this.closeColorPicker();return}this.openPicker=e,document.addEventListener("click",this.handleOutsideClick,{capture:!0})}closeColorPicker(){this.openPicker!==null&&(this.openPicker=null,document.removeEventListener("click",this.handleOutsideClick,{capture:!0}))}selectColor(e,t){let i=this.fieldEl;if(i instanceof HTMLDivElement)if($(i))fe(i,e,t)&&this.handleEditableInput();else{let r=Q(i);r&&(this.pendingMarks={...this.pendingMarks,[e]:t},this.updatePendingMarker(i,r),this.syncToolbarToSelection())}this.closeColorPicker(),this.updateComplete.then(()=>this.fieldEl?.focus())}renderToolbar(){let e=this.disabled||this.readonly,t=w(this.value??"").align;return f`
158
158
  <div
159
159
  id="toolbar-groups"
160
160
  @mousedown=${i=>i.preventDefault()}
@@ -213,13 +213,13 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
213
213
  ${this.renderColorPicker("color",this.formatTextColorLabel,"format_color_text")}
214
214
  ${this.renderColorPicker("highlight",this.formatHighlightLabel,"format_color_fill")}
215
215
  </div>
216
- `}renderColorPicker(e,t,i){let a=this.disabled||this.readonly,o=this.openPicker===e,r=e==="color"?this.activeTextColor:this.activeHighlight,d=r?y(r):void 0,h=e==="color"?d?.text:d?.highlight;return f`
216
+ `}renderColorPicker(e,t,i){let a=this.disabled||this.readonly,r=this.openPicker===e,o=e==="color"?this.activeTextColor:this.activeHighlight,d=o?y(o):void 0,h=e==="color"?d?.text:d?.highlight;return f`
217
217
  <div class="color-picker">
218
218
  <button
219
219
  type="button"
220
220
  class="color-picker-trigger"
221
221
  aria-haspopup="true"
222
- aria-expanded=${o?"true":"false"}
222
+ aria-expanded=${r?"true":"false"}
223
223
  aria-label=${t}
224
224
  ?disabled=${a}
225
225
  style=${h?`--_border-indicator-color: ${h}`:""}
@@ -227,7 +227,7 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
227
227
  >
228
228
  <eun-icon name=${i} size="18"></eun-icon>
229
229
  </button>
230
- ${o?f`
230
+ ${r?f`
231
231
  <div
232
232
  class="color-picker-panel"
233
233
  role="menu"
@@ -238,7 +238,7 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
238
238
  type="button"
239
239
  class="color-swatch clear"
240
240
  role="menuitemradio"
241
- aria-checked=${r===null?"true":"false"}
241
+ aria-checked=${o===null?"true":"false"}
242
242
  aria-label=${this.formatColorClearLabel}
243
243
  @click=${()=>this.selectColor(e,null)}
244
244
  ></button>
@@ -247,7 +247,7 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
247
247
  type="button"
248
248
  class="color-swatch"
249
249
  role="menuitemradio"
250
- aria-checked=${r===p.name?"true":"false"}
250
+ aria-checked=${o===p.name?"true":"false"}
251
251
  aria-label=${this.colorLabels[p.name]??p.label}
252
252
  style="--_swatch-bg: ${e==="color"?p.text:p.highlight}"
253
253
  @click=${()=>this.selectColor(e,p.name)}
@@ -287,7 +287,7 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
287
287
  ?required=${this.required}
288
288
  minlength=${v(this.minlength)}
289
289
  maxlength=${v(this.maxlength)}
290
- aria-invalid=${this.valid?"false":"true"}
290
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
291
291
  aria-label=${v(this.label)}
292
292
  aria-describedby=${e||b}
293
293
  @input=${this.handleInput}
@@ -304,7 +304,7 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
304
304
  role="textbox"
305
305
  aria-multiline="true"
306
306
  aria-required=${this.required?"true":b}
307
- aria-invalid=${this.valid?"false":"true"}
307
+ aria-invalid=${!this.hideError&&!this.disabled&&!this.valid}
308
308
  aria-label=${v(this.label)}
309
309
  aria-describedby=${e||b}
310
310
  @beforeinput=${this.handleEditableBeforeInput}
@@ -355,4 +355,4 @@ import{a as q}from"./chunks/chunk-E4IS25H7.js";import{a as W}from"./chunks/chunk
355
355
  </div>
356
356
  `)}
357
357
  </div>
358
- `}};s.styles=[Y,E.base,E.errorMessages,E.hintMessages],c([u({attribute:"default-value"})],s.prototype,"defaultValue",1),c([u()],s.prototype,"placeholder",2),c([u({type:Number,reflect:!0})],s.prototype,"rows",2),c([u({type:Boolean,reflect:!0})],s.prototype,"formatting",2),c([u({attribute:"format-toolbar-label"})],s.prototype,"formatToolbarLabel",2),c([u({attribute:"format-bold-label"})],s.prototype,"formatBoldLabel",2),c([u({attribute:"format-italic-label"})],s.prototype,"formatItalicLabel",2),c([u({attribute:"format-underline-label"})],s.prototype,"formatUnderlineLabel",2),c([u({attribute:"format-align-label"})],s.prototype,"formatAlignLabel",2),c([u({attribute:"format-align-start-label"})],s.prototype,"formatAlignStartLabel",2),c([u({attribute:"format-align-center-label"})],s.prototype,"formatAlignCenterLabel",2),c([u({attribute:"format-align-end-label"})],s.prototype,"formatAlignEndLabel",2),c([u({attribute:"format-align-justify-label"})],s.prototype,"formatAlignJustifyLabel",2),c([u({attribute:"format-text-color-label"})],s.prototype,"formatTextColorLabel",2),c([u({attribute:"format-highlight-label"})],s.prototype,"formatHighlightLabel",2),c([u({attribute:"format-color-clear-label"})],s.prototype,"formatColorClearLabel",2),c([u({attribute:!1})],s.prototype,"colorLabels",2),c([u()],s.prototype,"autocomplete",2),c([u({type:Number})],s.prototype,"minlength",2),c([u({type:Number})],s.prototype,"maxlength",2),c([u({attribute:"empty-value-label"})],s.prototype,"emptyValueLabel",2),c([u({attribute:"confirm-label"})],s.prototype,"confirmLabel",2),c([u({attribute:"cancel-label"})],s.prototype,"cancelLabel",2),c([C()],s.prototype,"openPicker",2),c([C()],s.prototype,"activeTextColor",2),c([C()],s.prototype,"activeHighlight",2),c([k("#field")],s.prototype,"fieldEl",2),c([k("#toolbar")],s.prototype,"toolbarEl",2),s=c([I(re)],s);export{s as EunomiaTextarea,re as EunomiaTextareaTagName};
358
+ `}};s.styles=[Y,C.base,C.errorMessages,C.hintMessages],c([u({attribute:"default-value"})],s.prototype,"defaultValue",1),c([u()],s.prototype,"placeholder",2),c([u({type:Number,reflect:!0})],s.prototype,"rows",2),c([u({type:Boolean,reflect:!0})],s.prototype,"formatting",2),c([u({attribute:"format-toolbar-label"})],s.prototype,"formatToolbarLabel",2),c([u({attribute:"format-bold-label"})],s.prototype,"formatBoldLabel",2),c([u({attribute:"format-italic-label"})],s.prototype,"formatItalicLabel",2),c([u({attribute:"format-underline-label"})],s.prototype,"formatUnderlineLabel",2),c([u({attribute:"format-align-label"})],s.prototype,"formatAlignLabel",2),c([u({attribute:"format-align-start-label"})],s.prototype,"formatAlignStartLabel",2),c([u({attribute:"format-align-center-label"})],s.prototype,"formatAlignCenterLabel",2),c([u({attribute:"format-align-end-label"})],s.prototype,"formatAlignEndLabel",2),c([u({attribute:"format-align-justify-label"})],s.prototype,"formatAlignJustifyLabel",2),c([u({attribute:"format-text-color-label"})],s.prototype,"formatTextColorLabel",2),c([u({attribute:"format-highlight-label"})],s.prototype,"formatHighlightLabel",2),c([u({attribute:"format-color-clear-label"})],s.prototype,"formatColorClearLabel",2),c([u({attribute:!1})],s.prototype,"colorLabels",2),c([u()],s.prototype,"autocomplete",2),c([u({type:Number})],s.prototype,"minlength",2),c([u({type:Number})],s.prototype,"maxlength",2),c([u({attribute:"empty-value-label"})],s.prototype,"emptyValueLabel",2),c([u({attribute:"confirm-label"})],s.prototype,"confirmLabel",2),c([u({attribute:"cancel-label"})],s.prototype,"cancelLabel",2),c([E()],s.prototype,"openPicker",2),c([E()],s.prototype,"activeTextColor",2),c([E()],s.prototype,"activeHighlight",2),c([k("#field")],s.prototype,"fieldEl",2),c([k("#toolbar")],s.prototype,"toolbarEl",2),s=c([I(oe)],s);export{s as EunomiaTextarea,oe as EunomiaTextareaTagName};
@@ -1,4 +1,4 @@
1
- import{a as Y,b as T,c as G,d as Z,e as J,f as Q,g as $,h as E,i as X,j as D,k as ee,m as h,o as H,p as te,q as ie,r as oe,s as re}from"./chunks/chunk-5C7YND22.js";import"./chunks/chunk-SD2H5UDZ.js";import{a as R}from"./chunks/chunk-ATH2OAMU.js";import"./chunks/chunk-T4PTHUYF.js";import{a as U}from"./chunks/chunk-LK5BJ4SH.js";import{a as q}from"./chunks/chunk-6UPI7GHJ.js";import{a as A}from"./chunks/chunk-LYYQAALT.js";import{a as j}from"./chunks/chunk-XSMCT4DF.js";import{a as W}from"./chunks/chunk-GW3VP2L7.js";import{a as N,c as K,d as B,e as C}from"./chunks/chunk-2IQUMAMI.js";import{a as P}from"./chunks/chunk-ONYUXQV2.js";import{a as _}from"./chunks/chunk-T7WABJEJ.js";import{a as V}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-5EVP7YNE.js";import{a as r,f as O,g as x,h as s,i as M,j as b,n as u,p as w,s as z}from"./chunks/chunk-XH6NREVZ.js";var ue=x`
1
+ import{a as Y,b as T,c as G,d as Z,e as J,f as Q,g as $,h as E,i as X,j as D,k as ee,m as h,o as H,p as te,q as ie,r as oe,s as re}from"./chunks/chunk-5C7YND22.js";import"./chunks/chunk-SD2H5UDZ.js";import{a as R}from"./chunks/chunk-ATH2OAMU.js";import"./chunks/chunk-T4PTHUYF.js";import{a as U}from"./chunks/chunk-LK5BJ4SH.js";import{a as q}from"./chunks/chunk-6UPI7GHJ.js";import{a as A}from"./chunks/chunk-LYYQAALT.js";import{a as j}from"./chunks/chunk-XSMCT4DF.js";import{a as W}from"./chunks/chunk-GW3VP2L7.js";import{a as N,c as K,d as B,e as C}from"./chunks/chunk-KNM5QHDK.js";import{a as P}from"./chunks/chunk-YYCEPZUN.js";import{a as _}from"./chunks/chunk-T7WABJEJ.js";import{a as V}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import"./chunks/chunk-5EVP7YNE.js";import{a as r,f as O,g as x,h as s,i as M,j as b,n as u,p as w,s as z}from"./chunks/chunk-XH6NREVZ.js";var ue=x`
2
2
  :host {
3
3
  display: block;
4
4
  width: 100%;
@@ -263,7 +263,7 @@ import{a as Y,b as T,c as G,d as Z,e as J,f as Q,g as $,h as E,i as X,j as D,k a
263
263
  </button>
264
264
  `)}
265
265
  </div>
266
- `}var he="eun-time-picker",fe=_(B(z)),ve=R(U(j(W(N(K(fe)))))),o=class extends ve{constructor(){super(...arguments);this.stepMinute=1;this.mobileMode="wheel";this.panelMode="columns";this.listStepMinutes=30;this.noAnimation=!1;this.applyLabel="Apply";this.cancelLabel="Cancel";this.ariaLabelClock="Open clock";this.hourPlaceholder="hh";this.minutePlaceholder="mm";this.hideTimezoneLabel=!1;this.isOpen=!1;this.isModalOpen=!1;this.stagingValue=null;this.segments={hour:"",minute:"",period:""};this.checkLocalValidators=()=>{let e=this.resolvedHourFormat();if(be(this.segments)&&!E(this.segments,e))return{validity:{badInput:!0},message:"Enter a valid time"};if(this.value){let{hour:t,minute:i}=h(this.value,this.timezone),n=ee({hour:t,minute:i},D(this.minTime),D(this.maxTime));if(!n.valid)return n.violation==="min"?{validity:{rangeUnderflow:!0},message:this.dictionary.timePicker.mustBeAtOrAfter(this.minTime??"")}:{validity:{rangeOverflow:!0},message:this.dictionary.timePicker.mustBeAtOrBefore(this.maxTime??"")}}return{validity:{}}};this.handleHourColumnChange=e=>{let{minute:t}=h(this.displaySource,this.timezone);this.commitAdjustment(e,t)};this.handleMinuteColumnChange=e=>{let{hour:t}=h(this.displaySource,this.timezone);this.commitAdjustment(t,e)};this.handlePeriodColumnChange=e=>{let{hour:t,minute:i}=h(this.displaySource,this.timezone),{hour:n}=T(t);this.commitAdjustment(G(n,e),i)};this.handleTriggerClick=()=>{if(!(this.disabled||this.readonly)){if(this.resetStaging(),this.panelMode!=="list"&&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 i=!e.matches(":popover-open");i&&e.showPopover(),(i||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:A}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closePopover()),this.updateComplete.then(()=>this.panelMode==="list"?this.focusListSelection():this.focusFirstSpinbutton());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility(),this.triggerEl?.focus()};this.handleModalConfirm=()=>{this.commitStaged(),this.isModalOpen=!1};this.handleModalCancel=()=>{this.isModalOpen=!1};this.handleListPick=(e,t)=>{this.commitAdjustment(e,t),this.closePopover()};this.handlePeriodSegmentClick=()=>{this.setPeriodSegment(Z(this.segments.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.focusPreviousSegment("period");break;case"ArrowRight":e.preventDefault(),this.focusNextSegment("period");break;default:break}}}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}willUpdate(e){let t=e.has("segments")||e.has("minTime")||e.has("maxTime");if(e.has("value")||e.has("timezone")||e.has("hourFormat")||e.has("locale")){let i=this.resolvedHourFormat();if(this.value){let n=h(this.value,this.timezone);this.segments=$(n.hour,n.minute,i)}else this.segments=$(null,null,i);t=!0}t&&this.checkValidity(this.value??null),super.willUpdate(e)}updated(e){super.updated(e),(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}resolvedHourFormat(){return Y(this.locale,this.hourFormat)}get displaySource(){return this.stagingValue??this.value??new Date}resetStaging(){this.stagingValue=this.value??null}commitStaged(){this.value=this.stagingValue,this.dispatchEvent(new P)}commitAdjustment(e,t){let i=H(this.displaySource,this.timezone,e,t);this.stagingValue=i,!this.isModalOpen&&(this.value=i,this.dispatchEvent(new P))}commitTypedTime(e,t){this.value=H(this.value??new Date,this.timezone,e,t),this.dispatchEvent(new P),(this.isOpen||this.isModalOpen)&&this.resetStaging()}commitSegmentGroupIfComplete(e){let t=this.resolvedHourFormat();if(!X(e,t))return;let i=E(e,t);i&&this.commitTypedTime(i.hour,i.minute)}popoverAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--time-picker-panel-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}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 i=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.popoverAnimation=i,i.finished.then(()=>{this.popoverAnimation===i&&(this.popoverAnimation=void 0),e.hidePopover()}).catch(()=>{})}focusFirstSpinbutton(){(this.isModalOpen?this.shadowRoot:this.popoverEl)?.querySelector('[role="spinbutton"]')?.focus({preventScroll:!0})}focusListSelection(){let e=this.popoverEl?.querySelector('[role="option"][aria-selected="true"]')??this.popoverEl?.querySelector('[role="option"]');e?.focus({preventScroll:!0}),e?.scrollIntoView({block:"center",behavior:this.noAnimation?"instant":"smooth"})}visibleSegmentOrder(){let e=J(this.resolvedHourFormat());return Q(this.locale).filter(t=>e.includes(t))}focusPreviousSegment(e){let t=this.visibleSegmentOrder(),i=t.indexOf(e);i<=0||this.focusSegment(t[i-1])}focusNextSegment(e){let t=this.visibleSegmentOrder(),i=t.indexOf(e);i===-1||i>=t.length-1||this.focusSegment(t[i+1])}focusSegment(e){this.shadowRoot?.querySelector(`.segment-${e}`)?.focus()}handleSegmentInput(e,t){let i=e.target,n=i.value.replace(/\D/g,"").slice(0,2);i.value=n;let c={...this.segments,[t]:n};this.segments=c,n.length===2&&this.focusNextSegment(t),this.commitSegmentGroupIfComplete(c)}handleSegmentKeydown(e,t){let i=e.target;e.key==="Backspace"&&i.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousSegment(t)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextSegment(t)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustSegment(t,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustSegment(t,-1))}adjustSegment(e,t){let i=this.resolvedHourFormat(),n=e==="hour"?i===12?{min:1,max:12}:{min:0,max:23}:{min:0,max:59},c=Number(this.segments[e]),m;if(this.segments[e]===""||Number.isNaN(c)){let f=h(this.displaySource,this.timezone);m=e==="hour"?i===12?T(f.hour).hour:f.hour:f.minute}else m=c+t,m>n.max?m=n.min:m<n.min&&(m=n.max);let S={...this.segments,[e]:String(m).padStart(2,"0")};this.segments=S,this.commitSegmentGroupIfComplete(S)}setPeriodSegment(e){if(this.disabled||this.readonly)return;let t={...this.segments,period:e};this.segments=t,this.commitSegmentGroupIfComplete(t)}renderSegment(e){return e==="period"?u`
266
+ `}var he="eun-time-picker",fe=_(B(z)),ve=R(U(j(W(N(K(fe)))))),o=class extends ve{constructor(){super(...arguments);this.stepMinute=1;this.mobileMode="wheel";this.panelMode="columns";this.listStepMinutes=30;this.noAnimation=!1;this.applyLabel="Apply";this.cancelLabel="Cancel";this.ariaLabelClock="Open clock";this.hourPlaceholder="hh";this.minutePlaceholder="mm";this.hideTimezoneLabel=!1;this.isOpen=!1;this.isModalOpen=!1;this.stagingValue=null;this.segments={hour:"",minute:"",period:""};this.checkLocalValidators=()=>{let e=this.resolvedHourFormat();if(be(this.segments)&&!E(this.segments,e))return{validity:{badInput:!0},message:"Enter a valid time"};if(this.value){let{hour:t,minute:i}=h(this.value,this.timezone),n=ee({hour:t,minute:i},D(this.minTime),D(this.maxTime));if(!n.valid)return n.violation==="min"?{validity:{rangeUnderflow:!0},message:this.dictionary.timePicker.mustBeAtOrAfter(this.minTime??"")}:{validity:{rangeOverflow:!0},message:this.dictionary.timePicker.mustBeAtOrBefore(this.maxTime??"")}}return{validity:{}}};this.handleHourColumnChange=e=>{let{minute:t}=h(this.displaySource,this.timezone);this.commitAdjustment(e,t)};this.handleMinuteColumnChange=e=>{let{hour:t}=h(this.displaySource,this.timezone);this.commitAdjustment(t,e)};this.handlePeriodColumnChange=e=>{let{hour:t,minute:i}=h(this.displaySource,this.timezone),{hour:n}=T(t);this.commitAdjustment(G(n,e),i)};this.handleTriggerClick=()=>{if(!(this.disabled||this.readonly)){if(this.resetStaging(),this.panelMode!=="list"&&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 i=!e.matches(":popover-open");i&&e.showPopover(),(i||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:A}),this.observeAnchorVisibility(this.fieldWrapperEl,()=>this.closePopover()),this.updateComplete.then(()=>this.panelMode==="list"?this.focusListSelection():this.focusFirstSpinbutton());return}this.isOpen=!1,this.unanchorFloatingElement(),this.unobserveAnchorVisibility(),this.triggerEl?.focus()};this.handleModalConfirm=()=>{this.commitStaged(),this.isModalOpen=!1};this.handleModalCancel=()=>{this.isModalOpen=!1};this.handleListPick=(e,t)=>{this.commitAdjustment(e,t),this.closePopover()};this.handlePeriodSegmentClick=()=>{this.setPeriodSegment(Z(this.segments.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.focusPreviousSegment("period");break;case"ArrowRight":e.preventDefault(),this.focusNextSegment("period");break;default:break}}}get defaultValue(){return super.defaultValue}set defaultValue(e){super.defaultValue=e}willUpdate(e){let t=e.has("segments")||e.has("minTime")||e.has("maxTime");if(e.has("value")||e.has("timezone")||e.has("hourFormat")||e.has("locale")){let i=this.resolvedHourFormat();if(this.value){let n=h(this.value,this.timezone);this.segments=$(n.hour,n.minute,i)}else this.segments=$(null,null,i);t=!0}t&&this.checkValidity(this.value??null),super.willUpdate(e)}updated(e){super.updated(e),(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}resolvedHourFormat(){return Y(this.locale,this.hourFormat)}get displaySource(){return this.stagingValue??this.value??new Date}resetStaging(){this.stagingValue=this.value??null}commitStaged(){this.value=this.stagingValue,this.dispatchEvent(new P(this.value))}commitAdjustment(e,t){let i=H(this.displaySource,this.timezone,e,t);this.stagingValue=i,!this.isModalOpen&&(this.value=i,this.dispatchEvent(new P(this.value)))}commitTypedTime(e,t){this.value=H(this.value??new Date,this.timezone,e,t),this.dispatchEvent(new P(this.value)),(this.isOpen||this.isModalOpen)&&this.resetStaging()}commitSegmentGroupIfComplete(e){let t=this.resolvedHourFormat();if(!X(e,t))return;let i=E(e,t);i&&this.commitTypedTime(i.hour,i.minute)}popoverAnimationDuration(e){if(this.noAnimation||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=getComputedStyle(e).getPropertyValue("--time-picker-panel-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}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 i=e.animate([{opacity:1,transform:"scaleY(1)"},{opacity:0,transform:"scaleY(0.01)"}],{duration:t,easing:"ease",fill:"forwards"});this.popoverAnimation=i,i.finished.then(()=>{this.popoverAnimation===i&&(this.popoverAnimation=void 0),e.hidePopover()}).catch(()=>{})}focusFirstSpinbutton(){(this.isModalOpen?this.shadowRoot:this.popoverEl)?.querySelector('[role="spinbutton"]')?.focus({preventScroll:!0})}focusListSelection(){let e=this.popoverEl?.querySelector('[role="option"][aria-selected="true"]')??this.popoverEl?.querySelector('[role="option"]');e?.focus({preventScroll:!0}),e?.scrollIntoView({block:"center",behavior:this.noAnimation?"instant":"smooth"})}visibleSegmentOrder(){let e=J(this.resolvedHourFormat());return Q(this.locale).filter(t=>e.includes(t))}focusPreviousSegment(e){let t=this.visibleSegmentOrder(),i=t.indexOf(e);i<=0||this.focusSegment(t[i-1])}focusNextSegment(e){let t=this.visibleSegmentOrder(),i=t.indexOf(e);i===-1||i>=t.length-1||this.focusSegment(t[i+1])}focusSegment(e){this.shadowRoot?.querySelector(`.segment-${e}`)?.focus()}handleSegmentInput(e,t){let i=e.target,n=i.value.replace(/\D/g,"").slice(0,2);i.value=n;let c={...this.segments,[t]:n};this.segments=c,n.length===2&&this.focusNextSegment(t),this.commitSegmentGroupIfComplete(c)}handleSegmentKeydown(e,t){let i=e.target;e.key==="Backspace"&&i.value===""||e.key==="ArrowLeft"?(e.preventDefault(),this.focusPreviousSegment(t)):e.key==="ArrowRight"?(e.preventDefault(),this.focusNextSegment(t)):e.key==="ArrowUp"?(e.preventDefault(),this.adjustSegment(t,1)):e.key==="ArrowDown"&&(e.preventDefault(),this.adjustSegment(t,-1))}adjustSegment(e,t){let i=this.resolvedHourFormat(),n=e==="hour"?i===12?{min:1,max:12}:{min:0,max:23}:{min:0,max:59},c=Number(this.segments[e]),m;if(this.segments[e]===""||Number.isNaN(c)){let f=h(this.displaySource,this.timezone);m=e==="hour"?i===12?T(f.hour).hour:f.hour:f.minute}else m=c+t,m>n.max?m=n.min:m<n.min&&(m=n.max);let S={...this.segments,[e]:String(m).padStart(2,"0")};this.segments=S,this.commitSegmentGroupIfComplete(S)}setPeriodSegment(e){if(this.disabled||this.readonly)return;let t={...this.segments,period:e};this.segments=t,this.commitSegmentGroupIfComplete(t)}renderSegment(e){return e==="period"?u`
267
267
  <button
268
268
  type="button"
269
269
  class="segment segment-period"
@@ -1,4 +1,4 @@
1
- import{a as T}from"./chunks/chunk-SD2H5UDZ.js";import{a as C}from"./chunks/chunk-ONYUXQV2.js";import{a as I}from"./chunks/chunk-T7WABJEJ.js";import{a as E}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as p}from"./chunks/chunk-5EVP7YNE.js";import{a as s,b as g,c as f,d as b,f as y,g as x,h as c,j as m,l as k,n as d,p as v,s as w}from"./chunks/chunk-XH6NREVZ.js";var $=x`
1
+ import{a as T}from"./chunks/chunk-SD2H5UDZ.js";import{a as C}from"./chunks/chunk-YYCEPZUN.js";import{a as I}from"./chunks/chunk-T7WABJEJ.js";import{a as E}from"./chunks/chunk-A4EQSU36.js";import"./chunks/chunk-SGM2X2TC.js";import{a as p}from"./chunks/chunk-5EVP7YNE.js";import{a as s,b as g,c as f,d as b,f as y,g as x,h as c,j as m,l as k,n as d,p as v,s as w}from"./chunks/chunk-XH6NREVZ.js";var $=x`
2
2
  :host {
3
3
  display: inline-flex;
4
4
  font-family: var(--eun-font-family, "Mulish", sans-serif);
@@ -180,7 +180,7 @@ import{a as T}from"./chunks/chunk-SD2H5UDZ.js";import{a as C}from"./chunks/chunk
180
180
  outline-color: var(--_variantColor);
181
181
  color: var(--_variantColor);
182
182
  }
183
- `;var A="eun-toggle-group",u,h,n=class extends I(w){constructor(){super(...arguments);this.options=[];this.value=[];this.single=!1;this.appearance="default";f(this,u);f(this,h,!1);this.debounceMoveIndicator=T(()=>this.moveIndicator(!0),50);this.handleSlotChange=()=>{this.settleAndSync(!1)}}get totalCount(){return this.options.length+(this.items?.length??0)}get exclusive(){return this.single||this.totalCount===2}get entries(){let e=Array.from(this.trackEl?.querySelectorAll("button")??[]),t=this.options.map((r,o)=>({value:r.value,disabled:!!this.disabled,element:e[o]})),a=(this.items??[]).map(r=>({value:r.value,disabled:!!this.disabled||!!r.disabled,element:r}));return[...t,...a]}connectedCallback(){super.connectedCallback?.(),b(this,u,new ResizeObserver(this.debounceMoveIndicator)),g(this,u).observe(this)}disconnectedCallback(){g(this,u)?.disconnect(),super.disconnectedCallback?.()}firstUpdated(){this.settleAndSync(!1)}updated(e){super.updated(e),e.has("disabled")&&this.removeAttribute("tabindex"),(e.has("value")||e.has("options")||e.has("single")||e.has("appearance"))&&this.settleAndSync(!0),e.has("disabled")&&this.disabled&&this.items?.forEach(t=>{t.disabled=!0})}whenItemsReady(){let e=new Set((this.items??[]).filter(t=>!customElements.get(t.tagName.toLowerCase())).map(t=>t.tagName.toLowerCase()));return e.size?Promise.all([...e].map(t=>customElements.whenDefined(t))):Promise.resolve()}settleAndSync(e){this.whenItemsReady().then(()=>{this.seedInitialValue(),this.applyExclusiveDefault(),this.syncItems(),this.refreshIndicator(e)})}seedInitialValue(){if(g(this,h)||(b(this,h,!0),this.value.length))return;let e=(this.items??[]).filter(t=>t.checked).map(t=>t.value);e.length&&(this.value=this.exclusive?[e[0]]:e)}applyExclusiveDefault(){if(!this.exclusive||this.value.length)return;let[e]=this.entries;e&&(this.value=[e.value])}activateValue(e){if(!this.disabled){if(this.exclusive){if(this.value[0]===e)return;this.value=[e]}else this.value=this.value.includes(e)?this.value.filter(t=>t!==e):[...this.value,e];this.dispatchEvent(new C)}}activateItem(e){this.disabled||e.disabled||this.activateValue(e.value)}syncItems(){this.items?.length&&(this.items.forEach(e=>{e.checked=this.value.includes(e.value),e.toggleAttribute("exclusive",this.exclusive),e.setAttribute("appearance",this.appearance)}),this.exclusive&&this.applyRovingTabindex())}whenItemReady(e){return typeof e.updateComplete?.then=="function"?e.updateComplete:customElements.whenDefined(e.tagName.toLowerCase()).then(()=>e.updateComplete)}applyRovingTabindex(){let e=this.entries,t=Math.max(0,e.findIndex(a=>a.value===this.value[0]));e.forEach((a,r)=>{if(a.element.tagName==="BUTTON")return;let o=a.element,i=r===t?"0":"-1";this.whenItemReady(o).then(()=>{o.setAttribute("tabindex",i)})})}refreshIndicator(e){if(!this.exclusive||this.appearance!=="default")return;let t=this.entries.find(a=>a.value===this.value[0]);if(t&&t.element.tagName!=="BUTTON"){this.whenItemReady(t.element).then(()=>this.moveIndicator(e));return}this.moveIndicator(e)}moveIndicator(e){let t=this.indicatorEl;if(!this.exclusive||!t||!this.trackEl)return;let a=this.entries.find(i=>i.value===this.value[0]);if(!a){t.style.opacity="0";return}let r=this.trackEl.getBoundingClientRect(),o=a.element.getBoundingClientRect();e||(t.style.transition="none"),t.style.opacity="1",t.style.width=`${Math.floor(o.width)}px`,t.style.transform=`translateX(${Math.floor(o.left-r.left)}px)`,e||(t.getBoundingClientRect(),t.style.transition="")}exclusiveTabIndex(e,t){let a=this.value[0]===e,r=this.value.length===0;return a||r&&t===0?0:-1}handleKeydown(e){if(this.disabled)return;if(!this.exclusive){let l=e.target;this.items?.includes(l)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.activateItem(l));return}let t=this.entries;if(!t.length)return;let a=t.findIndex(l=>l.value===this.value[0]),r,o;switch(e.key){case"ArrowRight":case"ArrowDown":r=1,o=a===-1?0:(a+1)%t.length;break;case"ArrowLeft":case"ArrowUp":r=-1,o=a===-1?t.length-1:(a-1+t.length)%t.length;break;case"Home":r=1,o=0;break;case"End":r=-1,o=t.length-1;break;default:return}e.preventDefault();for(let l=0;l<t.length&&t[o]?.disabled;l+=1)o=(o+r+t.length)%t.length;let i=t[o];!i||i.disabled||(this.activateValue(i.value),i.element.focus())}render(){let e=this.exclusive,t=e&&this.appearance==="default";return d`
183
+ `;var A="eun-toggle-group",u,h,n=class extends I(w){constructor(){super(...arguments);this.options=[];this.value=[];this.single=!1;this.appearance="default";f(this,u);f(this,h,!1);this.debounceMoveIndicator=T(()=>this.moveIndicator(!0),50);this.handleSlotChange=()=>{this.settleAndSync(!1)}}get totalCount(){return this.options.length+(this.items?.length??0)}get exclusive(){return this.single||this.totalCount===2}get entries(){let e=Array.from(this.trackEl?.querySelectorAll("button")??[]),t=this.options.map((r,o)=>({value:r.value,disabled:!!this.disabled,element:e[o]})),a=(this.items??[]).map(r=>({value:r.value,disabled:!!this.disabled||!!r.disabled,element:r}));return[...t,...a]}connectedCallback(){super.connectedCallback?.(),b(this,u,new ResizeObserver(this.debounceMoveIndicator)),g(this,u).observe(this)}disconnectedCallback(){g(this,u)?.disconnect(),super.disconnectedCallback?.()}firstUpdated(){this.settleAndSync(!1)}updated(e){super.updated(e),e.has("disabled")&&this.removeAttribute("tabindex"),(e.has("value")||e.has("options")||e.has("single")||e.has("appearance"))&&this.settleAndSync(!0),e.has("disabled")&&this.disabled&&this.items?.forEach(t=>{t.disabled=!0})}whenItemsReady(){let e=new Set((this.items??[]).filter(t=>!customElements.get(t.tagName.toLowerCase())).map(t=>t.tagName.toLowerCase()));return e.size?Promise.all([...e].map(t=>customElements.whenDefined(t))):Promise.resolve()}settleAndSync(e){this.whenItemsReady().then(()=>{this.seedInitialValue(),this.applyExclusiveDefault(),this.syncItems(),this.refreshIndicator(e)})}seedInitialValue(){if(g(this,h)||(b(this,h,!0),this.value.length))return;let e=(this.items??[]).filter(t=>t.checked).map(t=>t.value);e.length&&(this.value=this.exclusive?[e[0]]:e)}applyExclusiveDefault(){if(!this.exclusive||this.value.length)return;let[e]=this.entries;e&&(this.value=[e.value])}activateValue(e){if(!this.disabled){if(this.exclusive){if(this.value[0]===e)return;this.value=[e]}else this.value=this.value.includes(e)?this.value.filter(t=>t!==e):[...this.value,e];this.dispatchEvent(new C(this.value))}}activateItem(e){this.disabled||e.disabled||this.activateValue(e.value)}syncItems(){this.items?.length&&(this.items.forEach(e=>{e.checked=this.value.includes(e.value),e.toggleAttribute("exclusive",this.exclusive),e.setAttribute("appearance",this.appearance)}),this.exclusive&&this.applyRovingTabindex())}whenItemReady(e){return typeof e.updateComplete?.then=="function"?e.updateComplete:customElements.whenDefined(e.tagName.toLowerCase()).then(()=>e.updateComplete)}applyRovingTabindex(){let e=this.entries,t=Math.max(0,e.findIndex(a=>a.value===this.value[0]));e.forEach((a,r)=>{if(a.element.tagName==="BUTTON")return;let o=a.element,i=r===t?"0":"-1";this.whenItemReady(o).then(()=>{o.setAttribute("tabindex",i)})})}refreshIndicator(e){if(!this.exclusive||this.appearance!=="default")return;let t=this.entries.find(a=>a.value===this.value[0]);if(t&&t.element.tagName!=="BUTTON"){this.whenItemReady(t.element).then(()=>this.moveIndicator(e));return}this.moveIndicator(e)}moveIndicator(e){let t=this.indicatorEl;if(!this.exclusive||!t||!this.trackEl)return;let a=this.entries.find(i=>i.value===this.value[0]);if(!a){t.style.opacity="0";return}let r=this.trackEl.getBoundingClientRect(),o=a.element.getBoundingClientRect();e||(t.style.transition="none"),t.style.opacity="1",t.style.width=`${Math.floor(o.width)}px`,t.style.transform=`translateX(${Math.floor(o.left-r.left)}px)`,e||(t.getBoundingClientRect(),t.style.transition="")}exclusiveTabIndex(e,t){let a=this.value[0]===e,r=this.value.length===0;return a||r&&t===0?0:-1}handleKeydown(e){if(this.disabled)return;if(!this.exclusive){let l=e.target;this.items?.includes(l)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.activateItem(l));return}let t=this.entries;if(!t.length)return;let a=t.findIndex(l=>l.value===this.value[0]),r,o;switch(e.key){case"ArrowRight":case"ArrowDown":r=1,o=a===-1?0:(a+1)%t.length;break;case"ArrowLeft":case"ArrowUp":r=-1,o=a===-1?t.length-1:(a-1+t.length)%t.length;break;case"Home":r=1,o=0;break;case"End":r=-1,o=t.length-1;break;default:return}e.preventDefault();for(let l=0;l<t.length&&t[o]?.disabled;l+=1)o=(o+r+t.length)%t.length;let i=t[o];!i||i.disabled||(this.activateValue(i.value),i.element.focus())}render(){let e=this.exclusive,t=e&&this.appearance==="default";return d`
184
184
  <div
185
185
  id="track"
186
186
  role=${e?"radiogroup":"group"}
@@ -10,7 +10,7 @@ import{a as l}from"./chunks/chunk-T7WABJEJ.js";import{a as e,f as i,g as n,h as
10
10
  position: relative;
11
11
  z-index: 1;
12
12
  display: inline-block;
13
- outline: none;
13
+ outline: none !important;
14
14
  }
15
15
  #item {
16
16
  box-sizing: border-box;
@@ -1,4 +1,4 @@
1
- import{a as c}from"./chunks/chunk-ONYUXQV2.js";import{a as d}from"./chunks/chunk-T7WABJEJ.js";import{a as r,f as l,g as n,h as t,n as a,s}from"./chunks/chunk-XH6NREVZ.js";var i=n`
1
+ import{a as c}from"./chunks/chunk-YYCEPZUN.js";import{a as d}from"./chunks/chunk-T7WABJEJ.js";import{a as r,f as l,g as s,h as t,n as a,s as n}from"./chunks/chunk-XH6NREVZ.js";var i=s`
2
2
  :host {
3
3
  --_hoverColor: var(
4
4
  --toggle-hover-color,
@@ -102,4 +102,4 @@ import{a as c}from"./chunks/chunk-ONYUXQV2.js";import{a as d}from"./chunks/chunk
102
102
  :host(:not([checked])) ::slotted([slot="checked"]) {
103
103
  display: none;
104
104
  }
105
- `;var g="eun-toggle",o=class extends d(s){constructor(){super(...arguments);this.checked=!1;this.swap=!1;this.appearance="default";this.toggle=()=>{this.disabled||(this.checked=!this.checked,this.dispatchEvent(new c))};this.handleKeydown=e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.toggle())}}connectedCallback(){super.connectedCallback?.(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this.toggle),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("click",this.toggle),this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback?.()}updated(e){super.updated(e),e.has("checked")&&this.setAttribute("aria-pressed",String(this.checked))}render(){let e=this.swap?a`<slot name="unchecked"></slot><slot name="checked"></slot>`:a`<slot></slot>`;return a`<div id="toggle" part="toggle">${e}</div>`}};o.styles=[i],r([t({type:Boolean,reflect:!0})],o.prototype,"checked",2),r([t({type:Boolean,reflect:!0})],o.prototype,"swap",2),r([t({reflect:!0})],o.prototype,"appearance",2),o=r([l(g)],o);export{o as EunomiaToggle,g as EunomiaToggleTagName};
105
+ `;var g="eun-toggle",o=class extends d(n){constructor(){super(...arguments);this.checked=!1;this.swap=!1;this.appearance="default";this.toggle=()=>{this.disabled||(this.checked=!this.checked,this.dispatchEvent(new c(this.checked)))};this.handleKeydown=e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.toggle())}}connectedCallback(){super.connectedCallback?.(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this.toggle),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("click",this.toggle),this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback?.()}updated(e){super.updated(e),e.has("checked")&&this.setAttribute("aria-pressed",String(this.checked))}render(){let e=this.swap?a`<slot name="unchecked"></slot><slot name="checked"></slot>`:a`<slot></slot>`;return a`<div id="toggle" part="toggle">${e}</div>`}};o.styles=[i],r([t({type:Boolean,reflect:!0})],o.prototype,"checked",2),r([t({type:Boolean,reflect:!0})],o.prototype,"swap",2),r([t({reflect:!0})],o.prototype,"appearance",2),o=r([l(g)],o);export{o as EunomiaToggle,g as EunomiaToggleTagName};
@@ -1,4 +1,4 @@
1
- import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js";import"./chunks/chunk-UDOZRIJZ.js";import{a as l}from"./chunks/chunk-ONYUXQV2.js";import{a as v}from"./chunks/chunk-VRGRCYIO.js";import{a as u}from"./chunks/chunk-BKHD4S57.js";import{a as i,f as d,g as c,h as r,j as p,n as o,p as n,s as h}from"./chunks/chunk-XH6NREVZ.js";var m=c`
1
+ import{a as g}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js";import"./chunks/chunk-UDOZRIJZ.js";import{a as s}from"./chunks/chunk-YYCEPZUN.js";import{a as b}from"./chunks/chunk-VRGRCYIO.js";import{a as v}from"./chunks/chunk-BKHD4S57.js";import{a as i,f as c,g as h,h as r,j as p,l as d,n as o,p as l,s as u}from"./chunks/chunk-XH6NREVZ.js";var f=h`
2
2
  :host {
3
3
  --_height: var(--toolbar-height, 72px);
4
4
  --_heightCollapsed: var(--toolbar-height-collapsed, 56px);
@@ -44,6 +44,7 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
44
44
  color-mix(in srgb, var(--_skipLinksBase) 82%, black 18%)
45
45
  );
46
46
  --_skipLinksColor: var(--toolbar-skip-links-color, #fff);
47
+ --_skipLinksGap: var(--toolbar-skip-links-gap, var(--eun-space-m, 16px));
47
48
  --_skipLinksSeparatorColor: var(
48
49
  --toolbar-skip-links-separator-color,
49
50
  color-mix(in srgb, var(--_skipLinksColor) 50%, transparent)
@@ -166,7 +167,7 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
166
167
  z-index: calc(var(--_zIndex) + 2);
167
168
  display: flex;
168
169
  align-items: center;
169
- gap: var(--eun-space-m);
170
+ gap: var(--_skipLinksGap);
170
171
  overflow: hidden;
171
172
  height: var(--_skipLinksHeight);
172
173
  padding-inline: var(--eun-space-m);
@@ -218,13 +219,12 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
218
219
  #skip-links ::slotted(a:not(:first-child)),
219
220
  #skip-links ::slotted(eun-link:not(:first-child)) {
220
221
  position: relative;
221
- padding-inline-start: var(--eun-space-s);
222
222
  }
223
223
  #skip-links ::slotted(a:not(:first-child))::before,
224
224
  #skip-links ::slotted(eun-link:not(:first-child))::before {
225
225
  content: "";
226
226
  position: absolute;
227
- inset-inline-start: 0;
227
+ inset-inline-start: calc(var(--_skipLinksGap) / -2);
228
228
  inset-block: 0;
229
229
  width: 1px;
230
230
  background: var(--_skipLinksSeparatorColor);
@@ -355,7 +355,7 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
355
355
  transition-duration: 0.01ms;
356
356
  }
357
357
  }
358
- `,g=m;var f="eun-toolbar",t=class extends b(h){constructor(){super(...arguments);this.position="sticky";this.logoAlt="Home";this.logoHref="#";this.mobileBreakpoint=v.tablet;this.open=!1;this.panelDirection="top";this.closeOnBackdrop=!0;this.ariaLabelMenuOpen="Open menu";this.ariaLabelMenuClose="Close menu";this.ariaLabelMenu="Menu";this.collapseOnScroll=!1;this.collapseThreshold=24;this.collapsed=!1;this.transparentAtTop=!1;this.atTop=!0;this.adaptiveTheme=!1;this.adaptiveThemeSelector="[data-toolbar-theme]";this.theme="light";this.defaultTheme="light";this.skipLinkLabel="Skip to main content";this.mobile=!1;this.scrollTargetEl=window;this.scrollListenerAttached=!1;this.intersectingThemeEls=new Set;this.handleMediaChange=e=>{this.mobile=e.matches,!this.mobile&&this.open&&this.hide()};this.handleScroll=()=>{this.scrollRafId===void 0&&(this.scrollRafId=requestAnimationFrame(()=>{this.scrollRafId=void 0,this.updateScrollState()}))};this.handleThemeIntersect=e=>{for(let a of e)a.isIntersecting?this.intersectingThemeEls.add(a.target):this.intersectingThemeEls.delete(a.target);this.resolveAdaptiveTheme()};this.handleLogoClick=e=>{u(this,e,this.logoHref,"_self")};this.handlePanelToggle=e=>{let a=e;if(this.syncingFromPopover=!0,this.open=a.newState==="open",this.syncingFromPopover=!1,this.open){this.openDialogSurface({surfaceEl:this.panelEl,onEscape:()=>this.hide(),onOutsideClick:()=>{this.closeOnBackdrop&&this.hide()}}),this.dispatchEvent(new l),this.updateComplete.then(()=>this.focusInitialElement());return}this.closeDialogSurface(this.burgerEl),this.dispatchEvent(new l)};this.handleSkipLinkClick=e=>{let s=e.composedPath().find(k=>k instanceof HTMLAnchorElement)?.getAttribute("href");!s||!s.startsWith("#")||s.length<2||document.getElementById(s.slice(1))?.focus()}}connectedCallback(){super.connectedCallback(),this.updateMediaQuery(),this.syncScrollListener()}disconnectedCallback(){this.mediaQueryList?.removeEventListener("change",this.handleMediaChange),this.detachScrollListener(),this.teardownAdaptiveThemeObserver(),this.teardownDialogSurface(this.open),super.disconnectedCallback()}updated(e){super.updated(e),e.has("mobileBreakpoint")&&this.updateMediaQuery(),e.has("open")&&this.syncPopoverOpenState(this.open,this.panelEl),e.has("panelSize")&&(this.panelSize?this.style.setProperty("--toolbar-panel-size",this.panelSize):this.style.removeProperty("--toolbar-panel-size")),this.updateScrollListenerFor(e),this.updateAdaptiveThemeObserverFor(e)}updateScrollListenerFor(e){(e.has("collapseOnScroll")||e.has("transparentAtTop"))&&this.syncScrollListener(),e.has("scrollTarget")&&this.scrollListenerAttached&&this.attachScrollListener()}updateAdaptiveThemeObserverFor(e){if(e.has("adaptiveTheme")){this.adaptiveTheme?this.setupAdaptiveThemeObserver():(this.teardownAdaptiveThemeObserver(),this.theme=this.defaultTheme);return}this.adaptiveTheme&&(e.has("adaptiveThemeSelector")||e.has("collapsed")||e.has("scrollTarget"))&&this.setupAdaptiveThemeObserver()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}refreshAdaptiveTheme(){this.themeObserver&&(this.themeObserver.disconnect(),this.intersectingThemeEls.clear(),document.querySelectorAll(this.adaptiveThemeSelector).forEach(e=>this.themeObserver?.observe(e)),this.resolveAdaptiveTheme())}updateMediaQuery(){this.mediaQueryList?.removeEventListener("change",this.handleMediaChange),this.mediaQueryList=window.matchMedia(`(max-width: ${Math.max(this.mobileBreakpoint-1,0)}px)`),this.mediaQueryList.addEventListener("change",this.handleMediaChange),this.mobile=this.mediaQueryList.matches}resolveScrollTarget(){if(this.scrollTarget){let e=document.querySelector(this.scrollTarget);if(e)return e}return window}resolveIntersectionRoot(){if(this.scrollTarget){let e=document.querySelector(this.scrollTarget);if(e)return e}return null}syncScrollListener(){let e=this.collapseOnScroll||this.transparentAtTop;e&&!this.scrollListenerAttached?(this.attachScrollListener(),this.scrollListenerAttached=!0):!e&&this.scrollListenerAttached&&(this.detachScrollListener(),this.scrollListenerAttached=!1)}attachScrollListener(){this.scrollTargetEl?.removeEventListener("scroll",this.handleScroll),this.scrollTargetEl=this.resolveScrollTarget(),this.scrollTargetEl.addEventListener("scroll",this.handleScroll,{passive:!0}),this.updateScrollState()}detachScrollListener(){this.scrollTargetEl?.removeEventListener("scroll",this.handleScroll),this.scrollRafId!==void 0&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=void 0)}currentScrollY(){return this.scrollTargetEl instanceof Element?this.scrollTargetEl.scrollTop:window.scrollY}updateScrollState(){let e=this.currentScrollY();this.collapseOnScroll&&this.setCollapsed(e>this.collapseThreshold),this.transparentAtTop&&(this.atTop=e<=0)}setCollapsed(e){this.collapsed!==e&&(this.collapsed=e,this.dispatchEvent(new l))}setTheme(e){this.theme!==e&&(this.theme=e,this.dispatchEvent(new l))}barHeightPx(){return this.barEl?.getBoundingClientRect().height??(this.collapsed?56:72)}setupAdaptiveThemeObserver(){this.teardownAdaptiveThemeObserver();let e=this.barHeightPx();this.themeObserver=new IntersectionObserver(this.handleThemeIntersect,{root:this.resolveIntersectionRoot(),rootMargin:`-${e}px 0px -85% 0px`}),document.querySelectorAll(this.adaptiveThemeSelector).forEach(a=>this.themeObserver?.observe(a)),this.resolveAdaptiveTheme()}teardownAdaptiveThemeObserver(){this.themeObserver?.disconnect(),this.themeObserver=void 0,this.intersectingThemeEls.clear()}resolveAdaptiveTheme(){if(this.intersectingThemeEls.size===0){this.setTheme(this.defaultTheme);return}let e=document.querySelectorAll(this.adaptiveThemeSelector);for(let a=e.length-1;a>=0;a-=1)if(this.intersectingThemeEls.has(e[a])){this.setTheme(e[a].getAttribute("data-toolbar-theme")==="dark"?"dark":"light");return}this.setTheme(this.defaultTheme)}focusInitialElement(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.panelEl?.focus()}hasSkipLinksContent(){return this.skipLinkTarget!==void 0||this.querySelector('[slot="skip-links"]')!==null}renderSkipLinks(){return o`
358
+ `,k=f;var y="eun-toolbar",t=class extends g(u){constructor(){super(...arguments);this.position="sticky";this.logoAlt="Home";this.logoHref="#";this.mobileBreakpoint=b.tablet;this.open=!1;this.panelDirection="top";this.closeOnBackdrop=!0;this.ariaLabelMenuOpen="Open menu";this.ariaLabelMenuClose="Close menu";this.ariaLabelMenu="Menu";this.collapseOnScroll=!1;this.collapseThreshold=24;this.collapsed=!1;this.transparentAtTop=!1;this.atTop=!0;this.adaptiveTheme=!1;this.adaptiveThemeSelector="[data-toolbar-theme]";this.theme="light";this.defaultTheme="light";this.skipLinkLabel="Skip to main content";this.mobile=!1;this.handleIconSlotChange=()=>{this.requestUpdate()};this.scrollTargetEl=window;this.scrollListenerAttached=!1;this.intersectingThemeEls=new Set;this.handleMediaChange=e=>{this.mobile=e.matches,!this.mobile&&this.open&&this.hide()};this.handleScroll=()=>{this.scrollRafId===void 0&&(this.scrollRafId=requestAnimationFrame(()=>{this.scrollRafId=void 0,this.updateScrollState()}))};this.handleThemeIntersect=e=>{for(let a of e)a.isIntersecting?this.intersectingThemeEls.add(a.target):this.intersectingThemeEls.delete(a.target);this.resolveAdaptiveTheme()};this.handleLogoClick=e=>{v(this,e,this.logoHref,"_self")};this.handlePanelToggle=e=>{let a=e;if(this.syncingFromPopover=!0,this.open=a.newState==="open",this.syncingFromPopover=!1,this.open){this.openDialogSurface({surfaceEl:this.panelEl,onEscape:()=>this.hide(),onOutsideClick:()=>{this.closeOnBackdrop&&this.hide()}}),this.dispatchEvent(new s),this.updateComplete.then(()=>this.focusInitialElement());return}this.closeDialogSurface(this.burgerEl),this.dispatchEvent(new s)};this.handleSkipLinkClick=e=>{let n=e.composedPath().find(m=>m instanceof HTMLAnchorElement)?.getAttribute("href");!n||!n.startsWith("#")||n.length<2||document.getElementById(n.slice(1))?.focus()}}connectedCallback(){super.connectedCallback(),this.updateMediaQuery(),this.syncScrollListener()}disconnectedCallback(){this.mediaQueryList?.removeEventListener("change",this.handleMediaChange),this.detachScrollListener(),this.teardownAdaptiveThemeObserver(),this.teardownDialogSurface(this.open),super.disconnectedCallback()}updated(e){super.updated(e),e.has("mobileBreakpoint")&&this.updateMediaQuery(),e.has("open")&&this.syncPopoverOpenState(this.open,this.panelEl),e.has("panelSize")&&(this.panelSize?this.style.setProperty("--toolbar-panel-size",this.panelSize):this.style.removeProperty("--toolbar-panel-size")),this.updateScrollListenerFor(e),this.updateAdaptiveThemeObserverFor(e)}updateScrollListenerFor(e){(e.has("collapseOnScroll")||e.has("transparentAtTop"))&&this.syncScrollListener(),e.has("scrollTarget")&&this.scrollListenerAttached&&this.attachScrollListener()}updateAdaptiveThemeObserverFor(e){if(e.has("adaptiveTheme")){this.adaptiveTheme?this.setupAdaptiveThemeObserver():(this.teardownAdaptiveThemeObserver(),this.theme=this.defaultTheme);return}this.adaptiveTheme&&(e.has("adaptiveThemeSelector")||e.has("collapsed")||e.has("scrollTarget"))&&this.setupAdaptiveThemeObserver()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}refreshAdaptiveTheme(){this.themeObserver&&(this.themeObserver.disconnect(),this.intersectingThemeEls.clear(),document.querySelectorAll(this.adaptiveThemeSelector).forEach(e=>this.themeObserver?.observe(e)),this.resolveAdaptiveTheme())}updateMediaQuery(){this.mediaQueryList?.removeEventListener("change",this.handleMediaChange),this.mediaQueryList=window.matchMedia(`(max-width: ${Math.max(this.mobileBreakpoint-1,0)}px)`),this.mediaQueryList.addEventListener("change",this.handleMediaChange),this.mobile=this.mediaQueryList.matches}resolveScrollTarget(){if(this.scrollTarget){let e=document.querySelector(this.scrollTarget);if(e)return e}return window}resolveIntersectionRoot(){if(this.scrollTarget){let e=document.querySelector(this.scrollTarget);if(e)return e}return null}syncScrollListener(){let e=this.collapseOnScroll||this.transparentAtTop;e&&!this.scrollListenerAttached?(this.attachScrollListener(),this.scrollListenerAttached=!0):!e&&this.scrollListenerAttached&&(this.detachScrollListener(),this.scrollListenerAttached=!1)}attachScrollListener(){this.scrollTargetEl?.removeEventListener("scroll",this.handleScroll),this.scrollTargetEl=this.resolveScrollTarget(),this.scrollTargetEl.addEventListener("scroll",this.handleScroll,{passive:!0}),this.updateScrollState()}detachScrollListener(){this.scrollTargetEl?.removeEventListener("scroll",this.handleScroll),this.scrollRafId!==void 0&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=void 0)}currentScrollY(){return this.scrollTargetEl instanceof Element?this.scrollTargetEl.scrollTop:window.scrollY}updateScrollState(){let e=this.currentScrollY();this.collapseOnScroll&&this.setCollapsed(e>this.collapseThreshold),this.transparentAtTop&&(this.atTop=e<=0)}setCollapsed(e){this.collapsed!==e&&(this.collapsed=e,this.dispatchEvent(new s))}setTheme(e){this.theme!==e&&(this.theme=e,this.dispatchEvent(new s))}barHeightPx(){return this.barEl?.getBoundingClientRect().height??(this.collapsed?56:72)}setupAdaptiveThemeObserver(){this.teardownAdaptiveThemeObserver();let e=this.barHeightPx();this.themeObserver=new IntersectionObserver(this.handleThemeIntersect,{root:this.resolveIntersectionRoot(),rootMargin:`-${e}px 0px -85% 0px`}),document.querySelectorAll(this.adaptiveThemeSelector).forEach(a=>this.themeObserver?.observe(a)),this.resolveAdaptiveTheme()}teardownAdaptiveThemeObserver(){this.themeObserver?.disconnect(),this.themeObserver=void 0,this.intersectingThemeEls.clear()}resolveAdaptiveTheme(){if(this.intersectingThemeEls.size===0){this.setTheme(this.defaultTheme);return}let e=document.querySelectorAll(this.adaptiveThemeSelector);for(let a=e.length-1;a>=0;a-=1)if(this.intersectingThemeEls.has(e[a])){this.setTheme(e[a].getAttribute("data-toolbar-theme")==="dark"?"dark":"light");return}this.setTheme(this.defaultTheme)}focusInitialElement(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.panelEl?.focus()}hasSkipLinksContent(){return this.skipLinkTarget!==void 0||this.querySelector('[slot="skip-links"]')!==null}renderSkipLinks(){return o`
359
359
  <div id="skip-links" @click=${this.handleSkipLinkClick}>
360
360
  <slot name="skip-links">
361
361
  ${this.skipLinkTarget?o`
@@ -366,7 +366,7 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
366
366
  >
367
367
  ${this.skipLinkLabel}
368
368
  </a>
369
- `:n}
369
+ `:l}
370
370
  </slot>
371
371
  </div>
372
372
  `}renderStart(){return o`
@@ -379,10 +379,10 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
379
379
  >
380
380
  <img id="logo-image" src=${this.logoSrc} alt=${this.logoAlt} />
381
381
  </a>
382
- `:n}
382
+ `:l}
383
383
  <slot name="start"></slot>
384
384
  </div>
385
- `}renderEnd(){return o` <div id="end"><slot name="end"></slot></div> `}renderBurger(){return o`
385
+ `}renderEnd(){return o` <div id="end"><slot name="end"></slot></div> `}renderBurger(){let e=this.open?"close-icon":"menu-icon",a=this.open?"close":"menu",n=this.open?this.closeIconSlotEls.length:this.menuIconSlotEls.length;return o`
386
386
  <eun-button
387
387
  id="burger"
388
388
  appearance="ghost"
@@ -392,7 +392,9 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
392
392
  aria-label=${this.open?this.ariaLabelMenuClose:this.ariaLabelMenuOpen}
393
393
  @click=${()=>this.toggle()}
394
394
  >
395
- <eun-icon name=${this.open?"close":"menu"} size="20"></eun-icon>
395
+ <slot name=${e} @slotchange=${this.handleIconSlotChange}>
396
+ ${n?l:o`<eun-icon name=${a} size="20"></eun-icon>`}
397
+ </slot>
396
398
  </eun-button>
397
399
  `}renderPanel(){return o`
398
400
  <div
@@ -411,11 +413,11 @@ import{a as b}from"./chunks/chunk-N6ZW5CDN.js";import"./chunks/chunk-RIFF2D2F.js
411
413
  </div>
412
414
  </div>
413
415
  `}render(){return o`
414
- ${this.hasSkipLinksContent()?this.renderSkipLinks():n}
416
+ ${this.hasSkipLinksContent()?this.renderSkipLinks():l}
415
417
  <nav id="bar" aria-label=${this.ariaLabel??"Main navigation"}>
416
418
  ${this.renderStart()}
417
419
  <div id="center"><slot name="center"></slot></div>
418
420
  ${this.renderEnd()}
419
421
  </nav>
420
- ${this.mobile?this.renderPanel():n}
421
- `}};t.styles=g,i([r({reflect:!0})],t.prototype,"position",2),i([r({attribute:"logo-src"})],t.prototype,"logoSrc",2),i([r({attribute:"logo-alt"})],t.prototype,"logoAlt",2),i([r({attribute:"logo-href"})],t.prototype,"logoHref",2),i([r({type:Number,attribute:"mobile-breakpoint"})],t.prototype,"mobileBreakpoint",2),i([r({type:Boolean,reflect:!0})],t.prototype,"open",2),i([r({reflect:!0,attribute:"panel-direction"})],t.prototype,"panelDirection",2),i([r({attribute:"panel-size"})],t.prototype,"panelSize",2),i([r({type:Boolean,attribute:"close-on-backdrop"})],t.prototype,"closeOnBackdrop",2),i([r({attribute:"aria-label-menu-open"})],t.prototype,"ariaLabelMenuOpen",2),i([r({attribute:"aria-label-menu-close"})],t.prototype,"ariaLabelMenuClose",2),i([r({attribute:"aria-label-menu"})],t.prototype,"ariaLabelMenu",2),i([r({type:Boolean,attribute:"collapse-on-scroll"})],t.prototype,"collapseOnScroll",2),i([r({type:Number,attribute:"collapse-threshold"})],t.prototype,"collapseThreshold",2),i([r({type:Boolean,reflect:!0})],t.prototype,"collapsed",2),i([r({type:Boolean,attribute:"transparent-at-top"})],t.prototype,"transparentAtTop",2),i([r({type:Boolean,reflect:!0,attribute:"at-top"})],t.prototype,"atTop",2),i([r({attribute:"scroll-target"})],t.prototype,"scrollTarget",2),i([r({type:Boolean,attribute:"adaptive-theme"})],t.prototype,"adaptiveTheme",2),i([r({attribute:"adaptive-theme-selector"})],t.prototype,"adaptiveThemeSelector",2),i([r({reflect:!0})],t.prototype,"theme",2),i([r({attribute:"default-theme"})],t.prototype,"defaultTheme",2),i([r({attribute:"skip-link-target"})],t.prototype,"skipLinkTarget",2),i([r({attribute:"skip-link-label"})],t.prototype,"skipLinkLabel",2),i([r({type:Boolean,reflect:!0})],t.prototype,"mobile",2),i([p("#bar")],t.prototype,"barEl",2),i([p("#panel")],t.prototype,"panelEl",2),i([p("#burger")],t.prototype,"burgerEl",2),t=i([d(f)],t);export{t as EunomiaToolbar,f as EunomiaToolbarTagName};
422
+ ${this.mobile?this.renderPanel():l}
423
+ `}};t.styles=k,i([r({reflect:!0})],t.prototype,"position",2),i([r({attribute:"logo-src"})],t.prototype,"logoSrc",2),i([r({attribute:"logo-alt"})],t.prototype,"logoAlt",2),i([r({attribute:"logo-href"})],t.prototype,"logoHref",2),i([r({type:Number,attribute:"mobile-breakpoint"})],t.prototype,"mobileBreakpoint",2),i([r({type:Boolean,reflect:!0})],t.prototype,"open",2),i([r({reflect:!0,attribute:"panel-direction"})],t.prototype,"panelDirection",2),i([r({attribute:"panel-size"})],t.prototype,"panelSize",2),i([r({type:Boolean,attribute:"close-on-backdrop"})],t.prototype,"closeOnBackdrop",2),i([r({attribute:"aria-label-menu-open"})],t.prototype,"ariaLabelMenuOpen",2),i([r({attribute:"aria-label-menu-close"})],t.prototype,"ariaLabelMenuClose",2),i([r({attribute:"aria-label-menu"})],t.prototype,"ariaLabelMenu",2),i([r({type:Boolean,attribute:"collapse-on-scroll"})],t.prototype,"collapseOnScroll",2),i([r({type:Number,attribute:"collapse-threshold"})],t.prototype,"collapseThreshold",2),i([r({type:Boolean,reflect:!0})],t.prototype,"collapsed",2),i([r({type:Boolean,attribute:"transparent-at-top"})],t.prototype,"transparentAtTop",2),i([r({type:Boolean,reflect:!0,attribute:"at-top"})],t.prototype,"atTop",2),i([r({attribute:"scroll-target"})],t.prototype,"scrollTarget",2),i([r({type:Boolean,attribute:"adaptive-theme"})],t.prototype,"adaptiveTheme",2),i([r({attribute:"adaptive-theme-selector"})],t.prototype,"adaptiveThemeSelector",2),i([r({reflect:!0})],t.prototype,"theme",2),i([r({attribute:"default-theme"})],t.prototype,"defaultTheme",2),i([r({attribute:"skip-link-target"})],t.prototype,"skipLinkTarget",2),i([r({attribute:"skip-link-label"})],t.prototype,"skipLinkLabel",2),i([r({type:Boolean,reflect:!0})],t.prototype,"mobile",2),i([p("#bar")],t.prototype,"barEl",2),i([p("#panel")],t.prototype,"panelEl",2),i([p("#burger")],t.prototype,"burgerEl",2),i([d({slot:"menu-icon"})],t.prototype,"menuIconSlotEls",2),i([d({slot:"close-icon"})],t.prototype,"closeIconSlotEls",2),t=i([c(y)],t);export{t as EunomiaToolbar,y as EunomiaToolbarTagName};
@@ -46,12 +46,12 @@ import{c as f}from"./chunks/chunk-CEDHJUUH.js";import{a as k}from"./chunks/chunk
46
46
  .eun-tooltip-panel:not([data-severity])[data-color="light"] {
47
47
  --_accent: var(--eun-color-grey-600, #666e8a);
48
48
  --_borderColor: var(--eun-color-grey-300, #dee0e7);
49
- --_backgroundFilled: var(--eun-color-grey-100, #f7f8fa);
49
+ --_backgroundFilled: var(--eun-color-grey-0, #ffffff);
50
50
  }
51
51
  .eun-tooltip-panel:not([data-severity])[data-color="medium"] {
52
52
  --_accent: var(--eun-color-grey-900, #000000);
53
53
  --_borderColor: var(--eun-color-grey-300, #dee0e7);
54
- --_backgroundFilled: var(--eun-color-grey-500, #8d93aa);
54
+ --_backgroundFilled: var(--eun-color-grey-700, #484e61);
55
55
  }
56
56
  .eun-tooltip-panel:not([data-severity])[data-color="dark"] {
57
57
  --_accent: var(--eun-color-grey-800, #071621);
@@ -21,7 +21,7 @@ declare const EunomiaButton_base: import("../../../utils/constructor.type.js").C
21
21
  * @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the button
22
22
  * @prop {boolean} rounded - Whether the button has fully rounded corners
23
23
  * @prop {boolean} slide - Whether the button uses a sliding open animation
24
- * @prop {boolean} full - Whether the button stretches to fill 100% of the width and height available from its parent, instead of sizing to its content. Its content stays centered on both axes once stretched
24
+ * @prop {boolean} full - Whether the button stretches to fill 100% of the width available from its parent, instead of sizing to its content. Its content stays centered once stretched
25
25
  * @prop {boolean} [disabled=false] - Whether the button is disabled. For a link button, this removes the href instead, since links have no native disabled state
26
26
  * @prop {string} href - The URL the button navigates to. When set, the button renders as a link instead of a button
27
27
  * @prop {'_blank' | '_self' | '_parent' | '_top'} target - Where to open the linked URL. Only used when href is set. Opening in a new tab automatically adds an external link icon and announces it to assistive technology
@@ -47,6 +47,7 @@ declare const EunomiaButton_base: import("../../../utils/constructor.type.js").C
47
47
  * @cssprop [--button-border-color] - Sets the border color, overriding the color the active variant would otherwise use
48
48
  * @cssprop [--button-border-color-hover] - Sets the border color on hover or focus, falling back to button-border-color when unset
49
49
  * @cssprop [--button-border-size] - Sets the width of the border
50
+ * @cssprop [--button-full] - Set to true to stretch the button like the full attribute does. Unlike the attribute, a container query can set it, keeping the responsive behavior in pure CSS. Needs a browser supporting the CSS if() function
50
51
  * @element eun-button
51
52
  */
52
53
  export declare class EunomiaButton extends EunomiaButton_base {
@@ -91,11 +92,9 @@ export declare class EunomiaButton extends EunomiaButton_base {
91
92
  */
92
93
  appearance: EunomiaButtonAppearance;
93
94
  /**
94
- * Whether the button stretches to fill 100% of the width and height
95
- * available from its parent, instead of sizing to its content. Useful for
96
- * two buttons side by side that should share the same height regardless
97
- * of their own content. Content stays centered on both axes once
98
- * stretched.
95
+ * Whether the button stretches to fill 100% of the width available from
96
+ * its parent, instead of sizing to its content. Content stays centered
97
+ * once stretched.
99
98
  * @default false
100
99
  */
101
100
  full: boolean;
@@ -31,7 +31,7 @@ export const EunomiaButtonTagName = "eun-button";
31
31
  * @prop {'xs' | 's' | 'm' | 'l' | 'xl'} [size='m'] - The size of the button
32
32
  * @prop {boolean} rounded - Whether the button has fully rounded corners
33
33
  * @prop {boolean} slide - Whether the button uses a sliding open animation
34
- * @prop {boolean} full - Whether the button stretches to fill 100% of the width and height available from its parent, instead of sizing to its content. Its content stays centered on both axes once stretched
34
+ * @prop {boolean} full - Whether the button stretches to fill 100% of the width available from its parent, instead of sizing to its content. Its content stays centered once stretched
35
35
  * @prop {boolean} [disabled=false] - Whether the button is disabled. For a link button, this removes the href instead, since links have no native disabled state
36
36
  * @prop {string} href - The URL the button navigates to. When set, the button renders as a link instead of a button
37
37
  * @prop {'_blank' | '_self' | '_parent' | '_top'} target - Where to open the linked URL. Only used when href is set. Opening in a new tab automatically adds an external link icon and announces it to assistive technology
@@ -57,6 +57,7 @@ export const EunomiaButtonTagName = "eun-button";
57
57
  * @cssprop [--button-border-color] - Sets the border color, overriding the color the active variant would otherwise use
58
58
  * @cssprop [--button-border-color-hover] - Sets the border color on hover or focus, falling back to button-border-color when unset
59
59
  * @cssprop [--button-border-size] - Sets the width of the border
60
+ * @cssprop [--button-full] - Set to true to stretch the button like the full attribute does. Unlike the attribute, a container query can set it, keeping the responsive behavior in pure CSS. Needs a browser supporting the CSS if() function
60
61
  * @element eun-button
61
62
  */
62
63
  let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(DisabledMixin(LitElement))) {
@@ -80,11 +81,9 @@ let EunomiaButton = class EunomiaButton extends ButtonMixin(CommandMixin(Disable
80
81
  */
81
82
  this.appearance = "fill";
82
83
  /**
83
- * Whether the button stretches to fill 100% of the width and height
84
- * available from its parent, instead of sizing to its content. Useful for
85
- * two buttons side by side that should share the same height regardless
86
- * of their own content. Content stays centered on both axes once
87
- * stretched.
84
+ * Whether the button stretches to fill 100% of the width available from
85
+ * its parent, instead of sizing to its content. Content stays centered
86
+ * once stretched.
88
87
  * @default false
89
88
  */
90
89
  this.full = false;
@@ -16,6 +16,7 @@ import { css } from "lit";
16
16
  * [--button-border-color] - Set a custom border color, overriding whatever the active variant would otherwise use
17
17
  * [--button-border-color-hover] - Set a custom border color for hover/focus-visible state, falling back to --button-border-color
18
18
  * [--button-border-size] - Set a custom border width
19
+ * [--button-full] - Set to `true` to get the same result as the `full` attribute. Meant to be set from a container query
19
20
  */
20
21
  const base = css `
21
22
  :host {
@@ -134,22 +135,34 @@ const base = css `
134
135
  --_mainColor-outline: var(--eun-color-warning-100, #c85207);
135
136
  }
136
137
  :host([variant="light"]) {
137
- --_mainColor: var(--eun-color-grey-100, #f7f8fa);
138
+ --_mainColor: var(--eun-color-grey-0, #ffffff);
138
139
  --_mainColor-hover: var(--eun-color-grey-200, #ecedf0);
139
140
  --_mainColor-active: var(--eun-color-grey-300, #dee0e7);
140
- --_mainColor-text: var(--eun-color-grey-700, #484e61);
141
+ --_mainColor-text: var(--eun-color-grey-900, #000000);
141
142
  --_mainColor-outline: var(--eun-color-grey-500, #8d93aa);
142
143
  }
143
144
  :host([variant="medium"]) {
144
- --_mainColor: var(--eun-color-grey-300, #dee0e7);
145
- --_mainColor-hover: var(--eun-color-grey-400, #c1c9d6);
146
- --_mainColor-active: var(--eun-color-grey-500, #8d93aa);
145
+ --_mainColor: color-mix(
146
+ in srgb,
147
+ var(--eun-color-grey-700, #484e61) 20%,
148
+ transparent
149
+ );
150
+ --_mainColor-hover: color-mix(
151
+ in srgb,
152
+ var(--eun-color-grey-700, #484e61) 30%,
153
+ transparent
154
+ );
155
+ --_mainColor-active: color-mix(
156
+ in srgb,
157
+ var(--eun-color-grey-700, #484e61) 40%,
158
+ transparent
159
+ );
147
160
  --_mainColor-text: var(--eun-color-grey-900, #000000);
148
- --_mainColor-outline: var(--eun-color-grey-600, #666e8a);
161
+ --_mainColor-outline: var(--eun-color-grey-700, #484e61);
149
162
  }
150
163
  :host([variant="dark"]) {
151
164
  --_mainColor: var(--eun-color-grey-800, #071621);
152
- --_mainColor-hover: var(--eun-color-grey-700, #484e61);
165
+ --_mainColor-hover: var(--eun-color-grey-900, #000000);
153
166
  --_mainColor-active: var(--eun-color-grey-900, #000000);
154
167
  --_mainColor-text: var(--eun-color-grey-0, #ffffff);
155
168
  --_mainColor-outline: var(--eun-color-grey-800, #071621);
@@ -578,13 +591,21 @@ const full = css `
578
591
  :host([full]) {
579
592
  display: flex;
580
593
  width: 100%;
581
- height: 100%;
582
594
  }
583
595
  :host([full]) #button {
584
- height: 100%;
585
596
  justify-content: center;
586
597
  }
587
598
  `;
599
+ const fullVariable = css `
600
+ @supports (width: if(style(--a: b): 1px; else: 2px)) {
601
+ :host {
602
+ width: if(style(--button-full: true): 100%; else: auto);
603
+ }
604
+ #button {
605
+ justify-content: if(style(--button-full: true): center; else: normal);
606
+ }
607
+ }
608
+ `;
588
609
  export const buttonStyles = [
589
610
  base,
590
611
  fill,
@@ -595,5 +616,6 @@ export const buttonStyles = [
595
616
  defaultAppearance,
596
617
  disabled,
597
618
  slide,
619
+ fullVariable,
598
620
  full,
599
621
  ];
@@ -310,7 +310,7 @@ let EunomiaToggleGroup = class EunomiaToggleGroup extends DisabledMixin(LitEleme
310
310
  ? this.value.filter((v) => v !== value)
311
311
  : [...this.value, value];
312
312
  }
313
- this.dispatchEvent(new ChangeEvent());
313
+ this.dispatchEvent(new ChangeEvent(this.value));
314
314
  }
315
315
  /**
316
316
  * Activates the given `eun-toggle-item`'s value, unless the group or the
@@ -16,7 +16,7 @@ export const toggleItemStyles = css `
16
16
  position: relative;
17
17
  z-index: 1;
18
18
  display: inline-block;
19
- outline: none;
19
+ outline: none !important;
20
20
  }
21
21
  #item {
22
22
  box-sizing: border-box;
@@ -77,7 +77,7 @@ let EunomiaToggle = class EunomiaToggle extends DisabledMixin(LitElement) {
77
77
  return;
78
78
  }
79
79
  this.checked = !this.checked;
80
- this.dispatchEvent(new ChangeEvent());
80
+ this.dispatchEvent(new ChangeEvent(this.checked));
81
81
  };
82
82
  /**
83
83
  * Activates the toggle with `Enter`/`Space`, following native `<button>`