monobill-mintui 0.6.708 → 0.6.710

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 (87) hide show
  1. package/bin/component-dependencies.json +4 -3
  2. package/dist/components/chunks/{date-picker-Bqre6M4g.js → date-picker-C0U4312C.js} +24 -6
  3. package/dist/components/chunks/date-picker-MT1QYTbL.js +1 -0
  4. package/dist/components/chunks/{input-j6FCwb-x.js → input-BTRS6ggP.js} +89 -11
  5. package/dist/components/chunks/input-D9FDLgwb.js +1 -0
  6. package/dist/components/chunks/{popover-C1qiTAvR.js → popover-D5-jzS7p.js} +10 -2
  7. package/dist/components/chunks/{popover-6cborap6.js → popover-DFxM40QK.js} +1 -1
  8. package/dist/components/chunks/select-B1T9k1wp.js +615 -0
  9. package/dist/components/chunks/select-DYbwUtkq.js +1 -0
  10. package/dist/components/chunks/{time-picker-DY5emLWw.js → time-picker-BJY2sFyL.js} +22 -7
  11. package/dist/components/chunks/time-picker-DA-kUn8C.js +1 -0
  12. package/dist/components/date-picker/DatePicker.d.ts +6 -0
  13. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  14. package/dist/components/date-picker/browser.js +1 -1
  15. package/dist/components/date-picker/index.cjs +1 -1
  16. package/dist/components/date-picker/index.js +1 -1
  17. package/dist/components/datetime-picker/DateTimePicker.d.ts +4 -0
  18. package/dist/components/datetime-picker/DateTimePicker.d.ts.map +1 -1
  19. package/dist/components/datetime-picker/browser.js +21 -6
  20. package/dist/components/datetime-picker/index.cjs +1 -1
  21. package/dist/components/datetime-picker/index.js +21 -6
  22. package/dist/components/input/Input.d.ts +3 -0
  23. package/dist/components/input/Input.d.ts.map +1 -1
  24. package/dist/components/input/browser.js +1 -1
  25. package/dist/components/input/index.cjs +1 -1
  26. package/dist/components/input/index.js +1 -1
  27. package/dist/components/navigation/browser.js +1 -1
  28. package/dist/components/navigation/index.cjs +1 -1
  29. package/dist/components/navigation/index.js +1 -1
  30. package/dist/components/off-canvas/OffCanvas.d.ts +2 -0
  31. package/dist/components/off-canvas/OffCanvas.d.ts.map +1 -1
  32. package/dist/components/off-canvas/browser.js +17 -12
  33. package/dist/components/off-canvas/index.cjs +1 -1
  34. package/dist/components/off-canvas/index.js +17 -12
  35. package/dist/components/page/browser.js +1 -1
  36. package/dist/components/page/index.cjs +1 -1
  37. package/dist/components/page/index.js +1 -1
  38. package/dist/components/popover/Popover.d.ts.map +1 -1
  39. package/dist/components/popover/browser.js +1 -1
  40. package/dist/components/popover/index.cjs +1 -1
  41. package/dist/components/popover/index.js +1 -1
  42. package/dist/components/resource-table/ResourceTable.d.ts +7 -0
  43. package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
  44. package/dist/components/resource-table/browser.js +40 -14
  45. package/dist/components/resource-table/index.cjs +2 -2
  46. package/dist/components/resource-table/index.js +40 -14
  47. package/dist/components/search/browser.js +1 -1
  48. package/dist/components/search/index.cjs +1 -1
  49. package/dist/components/search/index.js +1 -1
  50. package/dist/components/select/NativeSelect.d.ts +4 -0
  51. package/dist/components/select/NativeSelect.d.ts.map +1 -1
  52. package/dist/components/select/Select.d.ts +4 -0
  53. package/dist/components/select/Select.d.ts.map +1 -1
  54. package/dist/components/select/browser.js +2 -578
  55. package/dist/components/select/index.cjs +1 -1
  56. package/dist/components/select/index.js +2 -578
  57. package/dist/components/side-navigation/browser.js +1 -1
  58. package/dist/components/side-navigation/index.cjs +1 -1
  59. package/dist/components/side-navigation/index.js +1 -1
  60. package/dist/components/sortable/browser.js +1 -1
  61. package/dist/components/sortable/index.cjs +1 -1
  62. package/dist/components/sortable/index.js +1 -1
  63. package/dist/components/tags/browser.js +1 -1
  64. package/dist/components/tags/index.cjs +1 -1
  65. package/dist/components/tags/index.js +1 -1
  66. package/dist/components/time-picker/TimePicker.d.ts +4 -0
  67. package/dist/components/time-picker/TimePicker.d.ts.map +1 -1
  68. package/dist/components/time-picker/browser.js +1 -1
  69. package/dist/components/time-picker/index.cjs +1 -1
  70. package/dist/components/time-picker/index.js +1 -1
  71. package/dist/components/tree/browser.js +2 -2
  72. package/dist/components/tree/index.cjs +1 -1
  73. package/dist/components/tree/index.js +2 -2
  74. package/dist/date-picker.css +1 -1
  75. package/dist/index.cjs +4 -4
  76. package/dist/index.css +5 -5
  77. package/dist/index.js +2469 -2269
  78. package/dist/input.css +1 -1
  79. package/dist/off-canvas.css +1 -1
  80. package/dist/resource-table.css +1 -1
  81. package/dist/select.css +1 -1
  82. package/package.json +1 -1
  83. package/dist/components/chunks/date-picker-CBucQNne.js +0 -1
  84. package/dist/components/chunks/input-Br2qLesW.js +0 -1
  85. package/dist/components/chunks/time-picker-CxdBZbER.js +0 -1
  86. /package/dist/components/chunks/{sortable-Dgk6LvmB.js → sortable-BSw58wy_.js} +0 -0
  87. /package/dist/components/chunks/{sortable-BAL3k9Se.js → sortable-D3et5wXB.js} +0 -0
@@ -0,0 +1 @@
1
+ require(`./icon-CWOP4Com.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./icon-D6C1XGp2.js`),require(`./popover-DFxM40QK.js`);var t=`data-mint-native-select-part`,n=class extends HTMLElement{static get observedAttributes(){return[`name`,`value`,`disabled`,`id`,`required`,`label`,`info`,`error`,`error-message`,`multiple`,`loading`,`aria-label`,`aria-labelledby`,`aria-describedby`]}constructor(){super(),this._select=null,this._wrapper=null,this._prependNodes=[],this._appendNodes=[],this._caretUpIcon=null,this._caretDownIcon=null,this._changeHandler=null,this._optionObserver=null,this._childrenObserver=null,this._hostOptionsObserverRaf=null,this._generatedControlId=`mint-native-select-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-native-select-host`),this.getLabel()||console.error(`mint-native-select: The "label" attribute is required. Please provide a label for the select.`),this.render(),this._childrenObserver&&this._childrenObserver.disconnect(),this._childrenObserver=new MutationObserver(e=>{if(e.some(e=>{let t=e.target;if(this._select&&(t===this._select||this._select.contains(t)))return!1;let n=Array.from(e.addedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`))||Array.from(e.removedNodes).some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)),r=e.type===`attributes`&&e.target.nodeType===Node.ELEMENT_NODE&&(e.target.tagName===`OPTION`||e.target.tagName===`OPTGROUP`);return n||r})){if(this._hostOptionsObserverRaf!==null)return;this._hostOptionsObserverRaf=requestAnimationFrame(()=>{this._hostOptionsObserverRaf=null,this.isConnected&&this.render()})}}),this._childrenObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`,`selected`,`disabled`]})}disconnectedCallback(){this._select&&this._changeHandler&&(this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=null),this._optionObserver&&=(this._optionObserver.disconnect(),null),this._childrenObserver&&=(this._childrenObserver.disconnect(),null),this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null)}isLoading(){let e=this.getAttribute(`loading`);return e!==null&&e!==`false`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._select&&(this._select.className=this.getSelectClasses(),this._select.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._syncSelectAccessibility());return}if(e===`loading`){this.render();return}if(e===`value`){if(this._select)if(this.isMultiple()){let e=[];try{let t=n?JSON.parse(n):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=n?[String(n)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=n||``;return}this.render()}}getName(){return this.getAttribute(`name`)||``}getValue(){if(this.isMultiple()&&this._select){let e=Array.from(this._select.selectedOptions).map(e=>e.value);return JSON.stringify(e)}return this.hasAttribute(`value`)?this.getAttribute(`value`)||``:this._select?this._select.value:``}setValue(e){if(this.isMultiple()){let t=Array.isArray(e)?e.map(e=>String(e)):e==null||e===``?[]:[String(e)];this.setAttribute(`value`,JSON.stringify(t)),this._select&&Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)});return}let t=e==null?``:String(e);this.setAttribute(`value`,t),this._select&&(this._select.value=t)}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{if(this.isMultiple()){this.setValue(e);return}let t=e||``;(this.getAttribute(`value`)||``)!==t&&this.setAttribute(`value`,t),this._select&&requestAnimationFrame(()=>{this._select&&(t===``||Array.from(this._select.options).some(e=>e.value===t))&&this._select.value!==t&&(this._select.value=t)})}catch{}}isDisabled(){let e=this.getAttribute(`disabled`);return e!==null&&e!==`false`}isMultiple(){let e=this.getAttribute(`multiple`);return e!==null&&e!==`false`}isRequired(){let e=this.getAttribute(`required`);return e!==null&&e!==`false`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getSelectClasses(){return[`mint-native-select-control`,this.isMultiple()?`is-multiple`:``,this.hasError()?`has-error`:``].filter(Boolean).join(` `)}render(){this._hostOptionsObserverRaf!==null&&(cancelAnimationFrame(this._hostOptionsObserverRaf),this._hostOptionsObserverRaf=null);let e=this.isLoading(),n=this.isMultiple(),r=this.getValue();this._collectAdornments();let i=[];this._select&&Array.from(this._select.children).forEach(e=>{(e.tagName===`OPTION`||e.tagName===`OPTGROUP`)&&i.push(e.cloneNode(!0))}),Array.from(this.children).forEach(e=>{e instanceof HTMLElement&&e.hasAttribute(t)&&e.remove()}),this._wrapper=null,this._select=null;let a=Array.from(this.children).filter(e=>e.tagName===`OPTION`||e.tagName===`OPTGROUP`).map(e=>e.cloneNode(!0)),o=this.getLabel(),s=this.getInfo(),c=this.getId()||this._generatedControlId,l=this.getName(),u=this.isDisabled(),d=this.hasError();if(o){let e=document.createElement(`label`);e.setAttribute(t,`label`),e.className=`mint-native-select-label`,c&&e.setAttribute(`for`,c);let n=document.createTextNode(o);e.appendChild(n),this.appendChild(e)}this._wrapper=document.createElement(`div`),this._wrapper.setAttribute(t,`wrapper`),this._wrapper.className=`mint-native-select-control-wrap`,this.appendChild(this._wrapper);let f=this._makeAdornment(`prepend`,this._prependNodes);f&&this._wrapper.appendChild(f),this._select=document.createElement(`select`),this._select.className=this.getSelectClasses(),c&&(this._select.id=c),l&&(this._select.name=l),u&&(this._select.disabled=!0),this._select.required=this.isRequired(),n&&(this._select.multiple=!0),this._select.setAttribute(`aria-invalid`,d?`true`:`false`);let p=this.getAttribute(`aria-label`)?.trim(),m=this.getAttribute(`aria-labelledby`)?.trim();m?this._select.setAttribute(`aria-labelledby`,m):o?this._select.removeAttribute(`aria-label`):this._select.setAttribute(`aria-label`,p||`Select an option`);let h=a.length>0?a:i;if(h.length>0&&h.forEach(e=>{this._select.appendChild(e)}),this._select.options.length===0){let e=document.createElement(`option`);e.value=``,e.textContent=`Select an option`,e.disabled=!0,e.selected=!0,this._select.appendChild(e)}if(n){let e=[];try{let t=r?JSON.parse(r):[];e=Array.isArray(t)?t.map(e=>String(e)):[]}catch{e=r?[String(r)]:[]}Array.from(this._select.options).forEach(t=>{t.selected=e.includes(t.value)})}else this._select.value=r||``;this._changeHandler&&this._select&&this._select.removeEventListener(`change`,this._changeHandler),this._changeHandler=e=>{let t=e.target,r=n?Array.from(t.selectedOptions).map(e=>e.value):t.value,i=n?JSON.stringify(r):String(r||``);(this.getAttribute(`value`)||``)!==i&&(i?this.setAttribute(`value`,i):this.removeAttribute(`value`));let a=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,cancelable:!0,composed:!0}))},this._select.addEventListener(`change`,this._changeHandler),this._optionObserver&&this._optionObserver.disconnect(),this._optionObserver=new MutationObserver(()=>{let e=this.getAttribute(`value`)||this.value||``;this._select&&e&&requestAnimationFrame(()=>{if(this._select)if(n){let t=[];try{let n=JSON.parse(e);t=Array.isArray(n)?n.map(e=>String(e)):[]}catch{t=[String(e)]}Array.from(this._select.options).forEach(e=>{e.selected=t.includes(e.value)})}else Array.from(this._select.options).some(t=>t.value===e)&&this._select.value!==e&&(this._select.value=e)})}),this._optionObserver.observe(this._select,{childList:!0,subtree:!0});let g=document.createElement(`div`);if(g.className=`mint-native-select-control-main`,g.appendChild(this._select),this._wrapper.appendChild(g),n)this._caretUpIcon=null,this._caretDownIcon=null;else{let e=document.createElement(`div`);e.className=`mint-native-select-caret`,this._caretUpIcon=document.createElement(`mint-icon`),this._caretUpIcon.setAttribute(`name`,`caret-up`),this._caretUpIcon.className=`mint-native-select-caret-up`,this._caretUpIcon.setAttribute(`aria-hidden`,`true`),e.appendChild(this._caretUpIcon),this._caretDownIcon=document.createElement(`mint-icon`),this._caretDownIcon.setAttribute(`name`,`caret-down`),this._caretDownIcon.className=`mint-native-select-caret-down`,this._caretDownIcon.setAttribute(`aria-hidden`,`true`),e.appendChild(this._caretDownIcon),g.appendChild(e)}let _=this._makeAdornment(`append`,this._appendNodes);if(_&&this._wrapper.appendChild(_),s){let e=document.createElement(`div`);e.setAttribute(t,`info`),e.className=`mint-native-select-info`,e.textContent=s,this.appendChild(e)}this._renderErrorState(),this._syncSelectAccessibility(),this._renderSkeleton(e)}_collectAdornments(){let e=[...this._prependNodes,...this._appendNodes,...Array.from(this.querySelectorAll(`:scope > [slot="prepend"], :scope > [slot="append"]`))];this._prependNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendNodes=e.filter(e=>e.getAttribute(`slot`)===`append`),this._prependNodes.forEach(e=>this.appendChild(e)),this._appendNodes.forEach(e=>this.appendChild(e))}_makeAdornment(e,t){if(!t.length)return null;let n=document.createElement(`span`);return n.className=`mint-native-select-adornment mint-native-select-${e}-slot`,t.forEach(e=>n.appendChild(e)),n}_renderSkeleton(e){let t=this.querySelector(`.mint-native-select-skeleton-container`),n=this._wrapper;if(e){t||(t=document.createElement(`div`),t.className=`mint-native-select-skeleton-container`,t.setAttribute(`aria-hidden`,`true`),n?n.appendChild(t):this.appendChild(t));let e=t.querySelector(`.mint-native-select-skeleton`);e||(e=document.createElement(`div`),t.appendChild(e));let r=this.isMultiple();e.classList.toggle(`is-multiple`,r),e.style.height=r?`5rem`:`2rem`,t.style.display=`block`,this._select&&(this._select.style.opacity=`0`,this._select.style.pointerEvents=`none`,this._select.setAttribute(`aria-busy`,`true`))}else t&&(t.style.display=`none`),this._select&&(this._select.style.opacity=`1`,this._select.style.pointerEvents=`auto`,this._select.removeAttribute(`aria-busy`))}_renderErrorState(){let e=this.hasError(),n=this.getErrorMessage(),r=this.querySelector(`.mint-native-select-error`);e&&n?(r?r.hasAttribute(t)||r.setAttribute(t,`error`):(r=document.createElement(`div`),r.setAttribute(t,`error`),r.className=`mint-native-select-error`,this.appendChild(r)),r.textContent=n):r&&r.remove()}_syncSelectAccessibility(){if(!this._select)return;let e=this._select.id||this._generatedControlId,n=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),r=this.querySelector(`[${t}="info"]`),i=this.querySelector(`.mint-native-select-error`);r&&(r.id=`${e}-info`,n.push(r.id)),i&&(i.id=`${e}-error`,n.push(i.id)),n.length?this._select.setAttribute(`aria-describedby`,Array.from(new Set(n)).join(` `)):this._select.removeAttribute(`aria-describedby`)}};customElements.get(`mint-native-select`)||e.t(`mint-native-select`,n);var r=`data-mint-select-part`,i=class extends HTMLElement{constructor(...e){super(...e),this._native=null,this._trigger=null,this._popover=null,this._list=null,this._prependNodes=[],this._appendNodes=[],this._observer=null,this._syncing=!1,this._typeahead=``,this._typeaheadTimer=null,this._pointerSelectedOption=null,this._id=`mint-select-${Math.random().toString(36).slice(2,10)}`}static get observedAttributes(){return[`name`,`value`,`values`,`multiple`,`disabled`,`id`,`required`,`label`,`info`,`error`,`error-message`,`loading`,`placeholder`,`aria-label`,`aria-labelledby`,`aria-describedby`,`form`]}connectedCallback(){this.classList.add(`mint-select-host`),this.render(),this._observer?.disconnect(),this._observer=new MutationObserver(e=>{this._syncing||e.some(e=>{let t=e.target instanceof Element?e.target:e.target.parentElement;return t===this||t?.closest(`[${r}]`)?!1:e.type===`attributes`?[`value`,`label`,`disabled`,`selected`].includes(e.attributeName):t instanceof HTMLOptionElement||t instanceof HTMLOptGroupElement||[...e.addedNodes,...e.removedNodes].some(e=>e instanceof HTMLOptionElement||e instanceof HTMLOptGroupElement)})&&this.render()}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`,`label`,`disabled`,`selected`]})}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._typeaheadTimer!==null&&window.clearTimeout(this._typeaheadTimer)}attributeChangedCallback(e,t,n){if(!(t===n||!this.isConnected)){if(e===`values`&&this._native&&this.isMultiple()){this._applyValues(this.parseValues(n)),this.updateDisplay();return}if(e===`multiple`&&this._native){this.render();return}if(e===`value`&&this._native){this.isMultiple()?this._applyValues(n?[n]:[]):this._native.value=n||``,this.updateDisplay();return}this.render()}}get value(){return this.isMultiple()?this.values:this._native?.value||this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get values(){return this._native&&this.isMultiple()?Array.from(this._native.selectedOptions,e=>e.value):this.parseValues(this.getAttribute(`values`))}set values(e){this.setValue(e)}getValue(){return this.value}setValue(e){if(this.isMultiple()){let t=Array.isArray(e)?e.map(String):e==null||e===``?[]:[String(e)];this.setAttribute(`values`,JSON.stringify(t)),this._applyValues(t)}else{let t=e==null?``:String(e);this.setAttribute(`value`,t),this._native&&(this._native.value=t)}this.updateDisplay()}isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}isLoading(){let e=this.getAttribute(`loading`);return e!==null&&e!==`false`}isRequired(){return this.hasAttribute(`required`)&&this.getAttribute(`required`)!==`false`}isMultiple(){return this.hasAttribute(`multiple`)&&this.getAttribute(`multiple`)!==`false`}hasError(){return this.getAttribute(`error`)===`true`}parseValues(e){if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t)){if(t.length===1&&typeof t[0]==`string`&&t[0].trim().startsWith(`[`))try{let e=JSON.parse(t[0]);if(Array.isArray(e))return e.map(String)}catch{}return t.map(String)}}catch{}return[e]}_applyValues(e){if(!this._native)return;let t=new Set(e);Array.from(this._native.options).forEach(e=>{e.selected=t.has(e.value)})}options(){return Array.from(this.querySelectorAll(`:scope > option, :scope > optgroup > option`))}selectedOption(){return this._native?.selectedOptions[0]||this.options().find(e=>e.value===this.value)}render(){let e=this._native?.value||this.getAttribute(`value`)||``,t=this._native?.multiple?Array.from(this._native.selectedOptions,e=>e.value):[],n=t.length?t:this.parseValues(this.getAttribute(`values`));this._syncing=!0,this._collectAdornments(),Array.from(this.children).forEach(e=>{e.hasAttribute(r)&&e.remove()});let i=this.getAttribute(`label`)?.trim()||``,a=this.getAttribute(`id`)||this._id;if(i){let e=document.createElement(`label`);e.setAttribute(r,`label`),e.className=`mint-select-label`,e.htmlFor=`${a}-trigger`,e.textContent=i,this.append(e)}let o=document.createElement(`div`);o.setAttribute(r,`wrap`),o.className=`mint-select-control-wrap`,o.style.position=`relative`,this.append(o);let s=this._makeAdornment(`prepend`,this._prependNodes);s&&o.append(s);let c=document.createElement(`button`);c.type=`button`,c.id=`${a}-trigger`,c.className=`mint-select-trigger`,c.disabled=this.isDisabled()||this.isLoading(),c.setAttribute(`role`,`combobox`),c.setAttribute(`aria-busy`,String(this.isLoading())),c.setAttribute(`aria-haspopup`,`listbox`),c.setAttribute(`aria-expanded`,`false`),c.setAttribute(`aria-required`,String(this.isRequired())),c.setAttribute(`aria-invalid`,String(this.hasError()));let l=this.getAttribute(`aria-labelledby`),u=this.getAttribute(`aria-label`)?.trim();if(l?c.setAttribute(`aria-labelledby`,l):!i&&u?c.setAttribute(`aria-label`,u):i&&c.setAttribute(`aria-labelledby`,`${a}-label`),i){let e=this.querySelector(`[${r}="label"]`);e&&(e.id=`${a}-label`)}let d=document.createElement(`span`);d.className=`mint-select-value`,c.append(d);let f=document.createElement(`span`);f.className=`mint-select-caret`,f.setAttribute(`aria-hidden`,`true`),f.innerHTML=`<mint-icon name="caret-up"></mint-icon><mint-icon name="caret-down"></mint-icon>`,c.append(f),o.append(c);let p=this._makeAdornment(`append`,this._appendNodes);p&&o.append(p);let m=null;this.isLoading()?(m=document.createElement(`div`),m.className=`mint-select-skeleton`,m.setAttribute(`aria-hidden`,`true`),m.style.cssText=`position:absolute;inset:0;z-index:1;border:1px solid var(--mint-color-border,#dfe6e0);border-radius:.5rem;background:var(--mint-color-surface-muted,#e8eee9);animation:mint-select-pulse 1.4s ease-in-out infinite;`,o.append(m),c.style.visibility=`hidden`,this.setAttribute(`aria-busy`,`true`)):this.removeAttribute(`aria-busy`);let h=document.createElement(`select`);h.setAttribute(r,`native`),h.className=`mint-select-native-control`,h.id=`${a}-native`,h.name=this.getAttribute(`name`)||``,h.multiple=this.isMultiple(),this.hasAttribute(`form`)&&h.setAttribute(`form`,this.getAttribute(`form`)||``),h.required=this.isRequired(),h.disabled=this.isDisabled(),h.tabIndex=-1,h.setAttribute(`aria-hidden`,`true`),h.setAttribute(`aria-invalid`,String(this.hasError()));let g=[this.getAttribute(`aria-describedby`),i?`${a}-label`:``,this.getAttribute(`info`)?`${a}-info`:``,this.getAttribute(`error-message`)?`${a}-error`:``].filter(Boolean).join(` `);if(g&&h.setAttribute(`aria-describedby`,g),this.options().forEach(e=>h.append(e.cloneNode(!0))),!h.options.length){let e=document.createElement(`option`);e.value=``,e.textContent=this.getAttribute(`placeholder`)||`Select an option`,e.disabled=!0,h.append(e)}if(h.multiple){let t=n.length?n:this.parseValues(this.getAttribute(`values`)).length?this.parseValues(this.getAttribute(`values`)):e?[e]:[];t.length&&Array.from(h.options).forEach(e=>{e.selected=t.includes(e.value)})}else h.value=e;o.append(h),this._native=h,this._trigger=c;let _=document.createElement(`mint-popover`);_.className=`mint-select-popover`,_.setAttribute(r,`popover`),_.setAttribute(`trigger-id`,c.id),_.setAttribute(`trigger-toggle`,`false`),_.setAttribute(`direction`,`down`),_.setAttribute(`trigger-align`,`start`),_.setAttribute(`align-selected`,`true`),_.setAttribute(`distance`,`4`),_.setAttribute(`padding`,`0`),_.setAttribute(`aria-label`,i?`${i} options`:`Select options`);let v=document.createElement(`div`);v.className=`mint-select-options`,v.id=`${a}-listbox`,v.setAttribute(`role`,`listbox`),v.setAttribute(`aria-multiselectable`,String(this.isMultiple())),c.setAttribute(`aria-controls`,v.id),_.append(v),this.append(_),this._popover=_,this._list=v,this.renderOptions(),this.updateDisplay(),this.bindEvents();let y=this.getAttribute(`info`);if(y){let e=document.createElement(`div`);e.setAttribute(r,`info`),e.className=`mint-select-info`,e.id=`${a}-info`,e.textContent=y,this.append(e)}let b=this.getAttribute(`error-message`);if(this.hasError()&&b){let e=document.createElement(`div`);e.setAttribute(r,`error`),e.className=`mint-select-error`,e.id=`${a}-error`,e.textContent=b,this.append(e)}this._syncing=!1}renderOptions(){this._list&&(this._list.replaceChildren(),Array.from(this.children).filter(e=>e.tagName===`OPTION`||e.tagName===`OPTGROUP`).forEach(e=>{if(e instanceof HTMLOptGroupElement){let t=document.createElement(`div`);t.className=`mint-select-group-label`,t.setAttribute(`role`,`presentation`),t.textContent=e.label,this._list.append(t),Array.from(e.children).forEach(t=>this.addOption(t,e.disabled))}else this.addOption(e,!1)}))}_collectAdornments(){let e=[...this._prependNodes,...this._appendNodes,...Array.from(this.querySelectorAll(`:scope > [slot="prepend"], :scope > [slot="append"]`))];this._prependNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendNodes=e.filter(e=>e.getAttribute(`slot`)===`append`),this._prependNodes.forEach(e=>this.append(e)),this._appendNodes.forEach(e=>this.append(e))}_makeAdornment(e,t){if(!t.length)return null;let n=document.createElement(`span`);return n.className=`mint-select-adornment mint-select-${e}-slot`,t.forEach(e=>n.append(e)),n}addOption(e,t){if(!this._list)return;let n=document.createElement(`button`);n.type=`button`,n.className=`mint-select-option`,n.dataset.value=e.value,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,String(this.isMultiple()?this.values.includes(e.value):e.value===this.value)),n.disabled=e.disabled||t||this.isDisabled(),n.tabIndex=-1;let r=document.createElement(`span`);r.textContent=e.label||e.textContent||``,n.append(r);let i=document.createElement(`mint-icon`);i.setAttribute(`name`,`check`),i.setAttribute(`aria-hidden`,`true`),i.className=`mint-select-option-check`,n.append(i),this._list.append(n)}updateDisplay(){if(!this._native||!this._trigger)return;let e=this.selectedOption(),t=this.values,n=this.isMultiple()?t.map(e=>this.options().find(t=>t.value===e)?.label||e):[],r=this._trigger.querySelector(`.mint-select-value`);r&&(r.textContent=this.isMultiple()?n.join(`, `)||this.getAttribute(`placeholder`)||`Select an option`:e?.getAttribute(`data-display-label`)||e?.label||e?.textContent?.trim()||this.getAttribute(`placeholder`)||`Select an option`,r.classList.toggle(`is-placeholder`,this.isMultiple()?t.length===0:!e||e.value===``)),this._trigger.setAttribute(`aria-invalid`,String(this.hasError())),this._trigger.setAttribute(`aria-haspopup`,`listbox`),this._list?.setAttribute(`aria-multiselectable`,String(this.isMultiple())),this._list?.querySelectorAll(`[role="option"]`).forEach(e=>e.setAttribute(`aria-selected`,String(this.isMultiple()?t.includes(e.dataset.value||``):e.dataset.value===this._native.value)))}bindEvents(){!this._trigger||!this._popover||!this._native||!this._list||(this._trigger.onclick=()=>{this._popover.style.setProperty(`--mint-select-popover-width`,`${this._trigger.getBoundingClientRect().width}px`),this._popover.hasAttribute(`open`)?this._popover.close():this.openPopover()},this._trigger.onkeydown=e=>{let t=Array.from(this._list.querySelectorAll(`[role="option"]:not(:disabled)`));if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),this._popover.hasAttribute(`open`)||this.openPopover();let n=t.findIndex(e=>e.dataset.value===(this.isMultiple()?this.values[0]:this._native.value));t[e.key===`ArrowDown`?Math.min(t.length-1,n+1):Math.max(0,n<=0?0:n-1)]?.focus()}else if(e.key===`Enter`||e.key===` `)if(this._popover.hasAttribute(`open`)){e.preventDefault();let t=this._list.querySelector(`[role="option"]:focus`);t?this.selectOption(t.dataset.value||``):this.openPopover()}else e.key===` `&&(e.preventDefault(),this.openPopover());else e.key===`Escape`&&this._popover.hasAttribute(`open`)?(e.preventDefault(),this._popover.close(),this._trigger.focus()):e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&this.typeahead(e.key)},this._list.onpointerdown=e=>{let t=e.target.closest(`[role="option"]`);if(!t||t.disabled)return;e.preventDefault();let n=t.dataset.value||``;this._pointerSelectedOption={value:n,time:Date.now()},this.selectOption(n)},this._list.onclick=e=>{let t=e.target.closest(`[role="option"]`);if(!t||t.disabled)return;let n=t.dataset.value||``,r=this._pointerSelectedOption?.value===n&&Date.now()-this._pointerSelectedOption.time<1e3;this._pointerSelectedOption=null,r||this.selectOption(n)},this._list.onkeydown=e=>{let t=Array.from(this._list.querySelectorAll(`[role="option"]:not(:disabled)`)),n=t.indexOf(e.target),r=n;if(e.key===`ArrowDown`)r=Math.min(t.length-1,n+1);else if(e.key===`ArrowUp`)r=Math.max(0,n-1);else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else if(e.key===`Escape`){e.preventDefault(),this._popover.close(),this._trigger.focus();return}else if(e.key===`Enter`||e.key===` `){e.preventDefault(),this.selectOption(e.target.dataset.value||``);return}else if(e.key.length===1){this.typeahead(e.key);return}else return;e.preventDefault(),t[r]?.focus()},this._native.onchange=()=>{this.isMultiple()?this.setAttribute(`values`,JSON.stringify(this.values)):this.setAttribute(`value`,this._native.value),this.updateDisplay(),this.dispatchSelectionEvents()})}openPopover(){this._popover&&this._popover.open()}selectOption(e){if(this._native){if(this.isMultiple()){let t=new Set(this.values);t.has(e)?t.delete(e):t.add(e);let n=[...t];this._applyValues(n),this.setAttribute(`values`,JSON.stringify(n)),this.updateDisplay(),this.dispatchSelectionEvents();return}this._native.value=e,this.setAttribute(`value`,e),this.updateDisplay(),this._popover?.close(),this._trigger?.focus(),this.dispatchSelectionEvents()}}dispatchSelectionEvents(){let e=this.isMultiple()?this.values:this._native?.value||``,t=this.isMultiple()?{value:e,values:e}:{value:e};this.dispatchEvent(new CustomEvent(`input`,{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0,detail:t}))}typeahead(e){this._typeahead+=e.toLocaleLowerCase(),this._typeaheadTimer!==null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>{this._typeahead=``},700);let t=Array.from(this._list?.querySelectorAll(`[role="option"]:not(:disabled)`)||[]).find(e=>e.textContent?.trim().toLocaleLowerCase().startsWith(this._typeahead));t&&(this._popover?.hasAttribute(`open`)||this.openPopover(),t.focus())}};customElements.get(`mint-select`)||e.t(`mint-select`,i),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
@@ -1,12 +1,12 @@
1
1
  import "./icon-hyFz3uhh.js";
2
2
  import { t as e } from "./register-element-BFYmIynH.js";
3
3
  import "./text-C-6UCBp-.js";
4
- import "./input-j6FCwb-x.js";
5
- import "./popover-C1qiTAvR.js";
4
+ import "./input-BTRS6ggP.js";
5
+ import "./popover-D5-jzS7p.js";
6
6
  //#region src/components/time-picker/TimePicker.ts
7
7
  var t = class extends HTMLElement {
8
8
  constructor(...e) {
9
- super(...e), this._triggerId = `mint-time-picker-trigger-${Math.random().toString(36).slice(2, 10)}`, this._popover = null, this._popoverObserver = null, this._triggerClickObserver = null, this._inputEl = null, this._hiddenInput = null, this._single = {
9
+ super(...e), this._triggerId = `mint-time-picker-trigger-${Math.random().toString(36).slice(2, 10)}`, this._popover = null, this._popoverObserver = null, this._triggerClickObserver = null, this._inputEl = null, this._hiddenInput = null, this._prependSlotNodes = [], this._appendSlotNodes = [], this._slotObserver = null, this._single = {
10
10
  hour: 9,
11
11
  minute: 0,
12
12
  second: 0,
@@ -43,10 +43,17 @@ var t = class extends HTMLElement {
43
43
  ];
44
44
  }
45
45
  connectedCallback() {
46
- this.classList.add("mint-time-picker-host"), this._parseAndApplyValue(this.getAttribute("value") || ""), this.render();
46
+ this.classList.add("mint-time-picker-host"), this._parseAndApplyValue(this.getAttribute("value") || ""), this.render(), this._slotObserver = new MutationObserver((e) => {
47
+ e.some((e) => e.type === "attributes" && e.target.hasAttribute("slot") || e.type === "childList" && e.target === this && Array.from(e.addedNodes).some((e) => e instanceof HTMLElement && (e.slot === "prepend" || e.slot === "append"))) && this.render();
48
+ }), this._slotObserver.observe(this, {
49
+ childList: !0,
50
+ subtree: !0,
51
+ attributes: !0,
52
+ attributeFilter: ["slot"]
53
+ });
47
54
  }
48
55
  disconnectedCallback() {
49
- this._popoverObserver &&= (this._popoverObserver.disconnect(), null), this._triggerClickObserver &&= (document.removeEventListener("click", this._triggerClickObserver, !0), null);
56
+ this._slotObserver?.disconnect(), this._slotObserver = null, this._popoverObserver &&= (this._popoverObserver.disconnect(), null), this._triggerClickObserver &&= (document.removeEventListener("click", this._triggerClickObserver, !0), null);
50
57
  }
51
58
  attributeChangedCallback(e, t, n) {
52
59
  if (t !== n) {
@@ -329,11 +336,11 @@ var t = class extends HTMLElement {
329
336
  }
330
337
  render() {
331
338
  let e = this.isDisabled(), t = this.isReadonly(), n = this._getEffectiveError();
332
- this._triggerClickObserver &&= (document.removeEventListener("click", this._triggerClickObserver, !0), null), this.innerHTML = "";
339
+ this._collectAdornmentNodes(), this._triggerClickObserver &&= (document.removeEventListener("click", this._triggerClickObserver, !0), null), this.innerHTML = "";
333
340
  let r = document.createElement("div");
334
341
  r.className = "mint-time-picker-control";
335
342
  let i = this.getAttribute("inline") === "true";
336
- i || (this._inputEl = document.createElement("mint-input"), this._inputEl.id = this._triggerId, this._inputEl.classList.add("mint-time-picker-trigger"), this._inputEl.setAttribute("type", "text"), this._inputEl.setAttribute("icon", "clock"), this._inputEl.setAttribute("placeholder", this._getExpectedFormat()), this._inputEl.setAttribute("label", this.getLabel()), this._inputEl.setAttribute("info", this.getInfo()), this._inputEl.setAttribute("value", this._getDisplayValue()), this._inputEl.setAttribute("error", n.hasError ? "true" : "false"), this._inputEl.setAttribute("error-message", n.message || ""), e && this._inputEl.setAttribute("disabled", "true"), t && this._inputEl.setAttribute("readonly", "true"), this._inputEl.addEventListener("change", (n) => {
343
+ i || (this._inputEl = document.createElement("mint-input"), this._inputEl.id = this._triggerId, this._inputEl.classList.add("mint-time-picker-trigger"), this._inputEl.setAttribute("type", "text"), this._inputEl.setAttribute("icon", "clock"), this._inputEl.setAttribute("placeholder", this._getExpectedFormat()), this._inputEl.setAttribute("label", this.getLabel()), this._inputEl.setAttribute("info", this.getInfo()), this._inputEl.setAttribute("value", this._getDisplayValue()), this._inputEl.setAttribute("error", n.hasError ? "true" : "false"), this._inputEl.setAttribute("error-message", n.message || ""), this._prependSlotNodes.forEach((e) => this._inputEl.appendChild(e)), this._appendSlotNodes.forEach((e) => this._inputEl.appendChild(e)), e && this._inputEl.setAttribute("disabled", "true"), t && this._inputEl.setAttribute("readonly", "true"), this._inputEl.addEventListener("change", (n) => {
337
344
  if (e || t) return;
338
345
  let r = n.target;
339
346
  this._handleTypedValue((r?.value || "").toString());
@@ -354,6 +361,14 @@ var t = class extends HTMLElement {
354
361
  }, document.addEventListener("click", this._triggerClickObserver, !0);
355
362
  }
356
363
  }
364
+ _collectAdornmentNodes() {
365
+ let e = [
366
+ ...this._prependSlotNodes,
367
+ ...this._appendSlotNodes,
368
+ ...Array.from(this.querySelectorAll("[slot=\"prepend\"], [slot=\"append\"]"))
369
+ ];
370
+ this._prependSlotNodes = e.filter((e) => e.getAttribute("slot") === "prepend"), this._appendSlotNodes = e.filter((e) => e.getAttribute("slot") === "append");
371
+ }
357
372
  };
358
373
  customElements.get("mint-time-picker") || e("mint-time-picker", t);
359
374
  //#endregion
@@ -0,0 +1 @@
1
+ require(`./icon-CWOP4Com.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./text-CfvRRKGZ.js`),require(`./input-D9FDLgwb.js`),require(`./popover-DFxM40QK.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._triggerClickObserver=null,this._inputEl=null,this._hiddenInput=null,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`inline`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render(),this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}disconnectedCallback(){this._slotObserver?.disconnect(),this._slotObserver=null,this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue();{let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e){let t=e.querySelector(`button[data-selected="true"]`);if(!t)return;let n=t.offsetTop-e.offsetTop-(e.clientHeight/2-t.offsetHeight/2),r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,n));e.scrollTo({top:r,behavior:`instant`})}_centerAllColumnsInPopoverBody(){let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&Array.from(e.querySelectorAll(`.mint-time-picker-column`)).forEach(e=>this._centerSelectedInColumn(e))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`tall`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody());return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this._collectAdornmentNodes(),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null),this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`;let i=this.getAttribute(`inline`)===`true`;i||(this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),this._prependSlotNodes.forEach(e=>this._inputEl.appendChild(e)),this._appendSlotNodes.forEach(e=>this._inputEl.appendChild(e)),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl)),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput();let a=document.createElement(`div`);if(a.setAttribute(`data-mint-time-picker-body`,`true`),a.className=`mint-time-picker-popover`,this._buildPopoverContent(a),i?(this._popover=null,r.appendChild(a),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody())):(this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`),this._popover.appendChild(a),r.appendChild(this._popover),this._setupPopoverOpenObserver()),this.appendChild(r),!i&&this._inputEl){let e=this._inputEl;this._triggerClickObserver=t=>{t.composedPath().includes(e)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover?.getAttribute(`open`)===`true`&&this._centerAllColumnsInPopoverBody()})})},document.addEventListener(`click`,this._triggerClickObserver,!0)}}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}};customElements.get(`mint-time-picker`)||e.t(`mint-time-picker`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
@@ -36,6 +36,11 @@ declare class MintDatePicker extends HTMLElement {
36
36
  private _isTouchActive;
37
37
  private _resizeObserver;
38
38
  private _popoverObserver;
39
+ private _slotObserver;
40
+ private _prependSlotNodes;
41
+ private _appendSlotNodes;
42
+ private _prependSlotContainer;
43
+ private _appendSlotContainer;
39
44
  private _focusTrapHandler;
40
45
  private _escapeHandler;
41
46
  private _a11yId;
@@ -92,6 +97,7 @@ declare class MintDatePicker extends HTMLElement {
92
97
  private _formatDatePhp;
93
98
  private _validateDateString;
94
99
  render(): void;
100
+ private _syncSlotAdornments;
95
101
  private _renderErrorState;
96
102
  private _syncDateFieldDescriptions;
97
103
  private _applyErrorVisuals;
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,CAAA;AACvB,OAAO,kBAAkB,CAAA;AACzB,OAAO,eAAe,CAAA;AAItB,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,IAAI,GAAG;QAAE,KAAK,EAAE,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;CACvD;AAED,cAAM,cAAe,SAAQ,WAAW;IACtC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,kBAAkB,CAA2B;IACrD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,YAAY,CAAmC;IACvD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,QAA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AsBvB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,eAAe;IA2EvB,OAAO,CAAC,gBAAgB;CAUzB;AAOD,eAAe,cAAc,CAAA"}
@@ -16,5 +16,5 @@ __mintLoadStyle('icon', '../../icon.css')
16
16
  __mintLoadStyle('popover', '../../popover.css')
17
17
  __mintLoadStyle('stack', '../../stack.css')
18
18
  __mintLoadStyle('date-picker', '../../date-picker.css')
19
- import { t as e } from "../chunks/date-picker-Bqre6M4g.js";
19
+ import { t as e } from "../chunks/date-picker-C0U4312C.js";
20
20
  export { e as default };
@@ -1 +1 @@
1
- const e=require(`../chunks/date-picker-CBucQNne.js`);module.exports=e.t;
1
+ const e=require(`../chunks/date-picker-MT1QYTbL.js`);module.exports=e.t;
@@ -4,5 +4,5 @@ import '../../icon.css'
4
4
  import '../../popover.css'
5
5
  import '../../stack.css'
6
6
  import '../../date-picker.css'
7
- import { t as e } from "../chunks/date-picker-Bqre6M4g.js";
7
+ import { t as e } from "../chunks/date-picker-C0U4312C.js";
8
8
  export { e as default };
@@ -17,6 +17,9 @@ declare class MintDateTimePicker extends HTMLElement {
17
17
  private _ready;
18
18
  private _writingValue;
19
19
  private _displayControlBound;
20
+ private _prependSlotNodes;
21
+ private _appendSlotNodes;
22
+ private _slotObserver;
20
23
  connectedCallback(): void;
21
24
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
22
25
  get value(): string;
@@ -30,6 +33,7 @@ declare class MintDateTimePicker extends HTMLElement {
30
33
  private _syncValue;
31
34
  private _syncState;
32
35
  private render;
36
+ private _collectAdornmentNodes;
33
37
  private _getPopover;
34
38
  private _getPopoverContent;
35
39
  private _waitForPopover;
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../src/components/datetime-picker/DateTimePicker.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAA;AAC7B,OAAO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CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,MAAM;IAmDd,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,2BAA2B;IAoBnC,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,WAAW;CAWpB;AAGD,eAAe,kBAAkB,CAAA"}
@@ -22,12 +22,12 @@ __mintLoadStyle('datetime-picker', '../../datetime-picker.css')
22
22
  import "../chunks/icon-hyFz3uhh.js";
23
23
  import { t as e } from "../chunks/register-element-BFYmIynH.js";
24
24
  import "../chunks/text-C-6UCBp-.js";
25
- import "../chunks/date-picker-Bqre6M4g.js";
26
- import "../chunks/time-picker-DY5emLWw.js";
25
+ import "../chunks/date-picker-C0U4312C.js";
26
+ import "../chunks/time-picker-BJY2sFyL.js";
27
27
  //#region src/components/datetime-picker/DateTimePicker.ts
28
28
  var t = class extends HTMLElement {
29
29
  constructor(...e) {
30
- super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1;
30
+ super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1, this._prependSlotNodes = [], this._appendSlotNodes = [], this._slotObserver = null;
31
31
  }
32
32
  static get observedAttributes() {
33
33
  return [
@@ -51,7 +51,14 @@ var t = class extends HTMLElement {
51
51
  ];
52
52
  }
53
53
  connectedCallback() {
54
- this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0;
54
+ this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0, this._slotObserver = new MutationObserver((e) => {
55
+ e.some((e) => e.type === "attributes" && e.target.hasAttribute("slot") || e.type === "childList" && e.target === this && Array.from(e.addedNodes).some((e) => e instanceof HTMLElement && (e.slot === "prepend" || e.slot === "append"))) && this.render();
56
+ }), this._slotObserver.observe(this, {
57
+ childList: !0,
58
+ subtree: !0,
59
+ attributes: !0,
60
+ attributeFilter: ["slot"]
61
+ });
55
62
  }
56
63
  attributeChangedCallback(e, t, n) {
57
64
  if (!(t === n || !this._ready || e === "value" && this._writingValue)) {
@@ -157,7 +164,7 @@ var t = class extends HTMLElement {
157
164
  }
158
165
  render() {
159
166
  let e = this.getAttribute("label") || "", t = this.getAttribute("info") || "", n = this.getAttribute("format") || "mm/dd/yyyy", r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
160
- this._displayControlBound = !1;
167
+ this._collectAdornmentNodes(), this._displayControlBound = !1;
161
168
  let a = document.createElement("mint-date-picker");
162
169
  a.setAttribute("class", "mint-datetime-picker-date"), a.setAttribute("keep-open-on-select", "true"), a.setAttribute("format", n), a.setAttribute("value", this._dateValue), a.setAttribute("label", e), a.setAttribute("info", t), a.setAttribute("display-format", this.getAttribute("display-format") || "F j, Y");
163
170
  for (let e of [
@@ -165,7 +172,7 @@ var t = class extends HTMLElement {
165
172
  "max",
166
173
  "shortcuts"
167
174
  ]) this.hasAttribute(e) && a.setAttribute(e, this.getAttribute(e) || "");
168
- r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), a.addEventListener("change", (e) => {
175
+ r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), this._prependSlotNodes.forEach((e) => a.appendChild(e)), this._appendSlotNodes.forEach((e) => a.appendChild(e)), a.addEventListener("change", (e) => {
169
176
  e.stopPropagation();
170
177
  let t = e.detail?.value || a.value || "";
171
178
  this._parseDate(t, n) && (this._dateValue = t, this._dateStageComplete = !0, this._syncValue(!1), this._syncCombinedDisplay(), this._openTimeStage());
@@ -173,6 +180,14 @@ var t = class extends HTMLElement {
173
180
  let o = document.createElement("div");
174
181
  o.className = "mint-datetime-picker-content", this._content = o, this.innerHTML = "", this.appendChild(o), o.appendChild(a), this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.name = this.getAttribute("name") || "", this._hiddenInput.value = this.getValue(), this.appendChild(this._hiddenInput), this._waitForPopover();
175
182
  }
183
+ _collectAdornmentNodes() {
184
+ let e = [
185
+ ...this._prependSlotNodes,
186
+ ...this._appendSlotNodes,
187
+ ...Array.from(this.querySelectorAll("[slot=\"prepend\"], [slot=\"append\"]"))
188
+ ];
189
+ this._prependSlotNodes = e.filter((e) => e.getAttribute("slot") === "prepend"), this._appendSlotNodes = e.filter((e) => e.getAttribute("slot") === "append");
190
+ }
176
191
  _getPopover() {
177
192
  let e = this._datePicker, t = e?.getPopoverElement?.() || e?._popover;
178
193
  if (t) return t;
@@ -1 +1 @@
1
- require(`../chunks/icon-CWOP4Com.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/date-picker-CBucQNne.js`),require(`../chunks/time-picker-CxdBZbER.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._datePicker=null,this._timePicker=null,this._content=null,this._popoverContent=null,this._popoverObserver=null,this._hiddenInput=null,this._dateValue=``,this._timeValue=``,this._dateStageComplete=!1,this._ready=!1,this._writingValue=!1,this._displayControlBound=!1}static get observedAttributes(){return[`value`,`label`,`info`,`name`,`required`,`disabled`,`readonly`,`format`,`display-format`,`min`,`max`,`shortcuts`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-datetime-picker`),this._readValue(this.getAttribute(`value`)||``),this.render(),this._ready=!0}attributeChangedCallback(e,t,n){if(!(t===n||!this._ready||e===`value`&&this._writingValue)){if(e===`value`){this._readValue(n||``),this.render();return}if(e===`error`||e===`error-message`){this._syncState();return}this.render()}}get value(){return this.getAttribute(`value`)||``}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){this._readValue(e),this._writingValue=!0,e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._writingValue=!1,this.render(),this._syncState()}_parseDate(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));let r={yyyy:`(\\d{4})`,yy:`(\\d{2})`,Y:`(\\d{4})`,y:`(\\d{2})`,mm:`(\\d{1,2})`,m:`(\\d{1,2})`,n:`(\\d{1,2})`,dd:`(\\d{1,2})`,d:`(\\d{1,2})`,j:`(\\d{1,2})`,M:`([A-Za-z]+)`,F:`([A-Za-z]+)`},i=Object.keys(r).sort((e,t)=>t.length-e.length),a=[],o=`^`;for(let e=0;e<t.length;){let n=i.find(n=>t.startsWith(n,e));n?(o+=r[n],a.push(n),e+=n.length):(o+=t[e].replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),e++)}let s=e.match(RegExp(`${o}$`,`i`));if(!s)return null;let c=2e3,l=1,u=1;a.forEach((e,t)=>{let n=s[t+1];if(e===`Y`||e===`yyyy`)c=Number(n);else if(e===`y`||e===`yy`)c=Number(n)+2e3;else if(e===`m`||e===`mm`||e===`n`)l=Number(n);else if(e===`d`||e===`dd`||e===`j`)u=Number(n);else if(e===`M`||e===`F`){let e=new Date(`${n} 1, 2000`).getMonth();Number.isNaN(e)||(l=e+1)}});let d=new Date(c,l-1,u);return d.getFullYear()===c&&d.getMonth()===l-1&&d.getDate()===u?d:null}_formatDate(e,t){let n=e=>String(e).padStart(2,`0`),r={Y:String(e.getFullYear()),yyyy:String(e.getFullYear()),yy:String(e.getFullYear()).slice(-2),y:String(e.getFullYear()).slice(-2),mm:n(e.getMonth()+1),m:n(e.getMonth()+1),n:String(e.getMonth()+1),dd:n(e.getDate()),d:n(e.getDate()),j:String(e.getDate()),M:e.toLocaleString(void 0,{month:`short`}),F:e.toLocaleString(void 0,{month:`long`})};return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g,e=>r[e])}_readValue(e){let[t=``,n=``]=e.split(/[T ]/),r=this._parseDate(t,this.getAttribute(`format`)||`mm/dd/yyyy`);this._dateValue=r?this._formatDate(r,this.getAttribute(`format`)||`mm/dd/yyyy`):``,this._timeValue=n||``,this._dateStageComplete=!!r}_toISODate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}_syncValue(e=!1){let t=this._toISODate(),n=this._timeValue,r=t&&n?`${t}T${n}`:``;this._writingValue=!0,r?this.setAttribute(`value`,r):this.removeAttribute(`value`),this._writingValue=!1,this._hiddenInput&&(this._hiddenInput.value=r),e&&r&&(this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,composed:!0})))}_syncState(){this._datePicker&&(this._datePicker.setAttribute(`value`,this._dateValue),this._datePicker.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._datePicker.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._timePicker?.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._timePicker?.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._hiddenInput&&(this._hiddenInput.value=this.getValue()),this._syncCombinedDisplay())}render(){let e=this.getAttribute(`label`)||``,t=this.getAttribute(`info`)||``,n=this.getAttribute(`format`)||`mm/dd/yyyy`,r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;this._displayControlBound=!1;let a=document.createElement(`mint-date-picker`);a.setAttribute(`class`,`mint-datetime-picker-date`),a.setAttribute(`keep-open-on-select`,`true`),a.setAttribute(`format`,n),a.setAttribute(`value`,this._dateValue),a.setAttribute(`label`,e),a.setAttribute(`info`,t),a.setAttribute(`display-format`,this.getAttribute(`display-format`)||`F j, Y`);for(let e of[`min`,`max`,`shortcuts`])this.hasAttribute(e)&&a.setAttribute(e,this.getAttribute(e)||``);r&&a.setAttribute(`disabled`,`true`),i&&a.setAttribute(`readonly`,`true`),this.hasAttribute(`required`)&&a.setAttribute(`required`,this.getAttribute(`required`)||`true`),this.hasAttribute(`error`)&&a.setAttribute(`error`,this.getAttribute(`error`)||`false`),this.hasAttribute(`error-message`)&&a.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),a.addEventListener(`change`,e=>{e.stopPropagation();let t=e.detail?.value||a.value||``;this._parseDate(t,n)&&(this._dateValue=t,this._dateStageComplete=!0,this._syncValue(!1),this._syncCombinedDisplay(),this._openTimeStage())}),this._datePicker=a,this._bindCombinedDisplayControl();let o=document.createElement(`div`);o.className=`mint-datetime-picker-content`,this._content=o,this.innerHTML=``,this.appendChild(o),o.appendChild(a),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getAttribute(`name`)||``,this._hiddenInput.value=this.getValue(),this.appendChild(this._hiddenInput),this._waitForPopover()}_getPopover(){let e=this._datePicker,t=e?.getPopoverElement?.()||e?._popover;if(t)return t;let n=e?.querySelector?.(`.mint-date-picker-icon-button`)?.id;return n?document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`):null}_getPopoverContent(e){return e.querySelector(`.popover-content`)||e}_waitForPopover(e=0){let t=this._getPopover();if(!t){e<120&&requestAnimationFrame(()=>this._waitForPopover(e+1));return}if(this._popoverContent=this._datePicker?.getPopoverContentElement?.()||this._getPopoverContent(t),this._bindCombinedDisplayControl(),this._syncCombinedDisplay(),this._popoverObserver?.disconnect(),this._popoverObserver=new MutationObserver(()=>{if(t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}),this._popoverObserver.observe(t,{attributes:!0,attributeFilter:[`open`]}),t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}_bindCombinedDisplayControl(){if(this._displayControlBound||!this._datePicker)return;this._displayControlBound=!0;let e=e=>{if(!e.target?.closest(`.mint-date-picker-field`)||this.getAttribute(`disabled`)===`true`||this.getAttribute(`readonly`)===`true`||e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation();let t=this._getPopover();t?.open?t.open():t?.setAttribute(`open`,`true`)};this._datePicker.addEventListener(`click`,e,!0),this._datePicker.addEventListener(`keydown`,e,!0)}_openTimeStage(){queueMicrotask(()=>{let e=this._getPopover();if(e?.getAttribute(`open`)!==`true`){typeof e?.open==`function`?e.open():e?.setAttribute(`open`,`true`),requestAnimationFrame(()=>this._renderTimeStage());return}this._renderTimeStage()})}_renderTimeStage(){if(!this._popoverContent||!this._dateStageComplete)return;let e=document.createElement(`div`);e.className=`mint-datetime-picker-panel`;let t=document.createElement(`button`);t.type=`button`,t.className=`mint-datetime-picker-time-heading`,t.setAttribute(`aria-label`,`Change date, ${this._dateValue}`),t.textContent=this._getFormattedDate(),t.addEventListener(`click`,()=>{let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()});let n=document.createElement(`mint-time-picker`),r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;n.setAttribute(`inline`,`true`),n.setAttribute(`value`,this._timeValue||`09:00`),n.setAttribute(`label`,``);for(let e of[`hours`,`minutes`,`seconds`])this.hasAttribute(e)&&n.setAttribute(e,this.getAttribute(e)||``);r&&n.setAttribute(`disabled`,`true`),i&&n.setAttribute(`readonly`,`true`),n.addEventListener(`change`,()=>{this._timeValue=n.getValue?.()||n.getAttribute(`value`)||``,this._syncValue(!0),this._syncCombinedDisplay()}),n.addEventListener(`change`,e=>e.stopPropagation()),n.addEventListener(`input`,e=>e.stopPropagation()),this._timePicker=n,e.appendChild(t),e.appendChild(n),this._popoverContent.replaceChildren(e)}_syncCombinedDisplay(){let e=this._datePicker?.getDisplayElement?.()||this._datePicker?.querySelector(`.mint-date-picker-display`);if(!e||!this._dateValue)return;let t=this._getFormattedDate();e.textContent=this._timeValue?`${t} · ${this._formatTime(this._timeValue)}`:t,e.setAttribute(`aria-label`,`${this.getAttribute(`label`)||`Date and time`}: ${e.textContent}`)}_getFormattedDate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?this._formatDate(e,this.getAttribute(`display-format`)||`F j, Y`):this._dateValue}_formatTime(e){let[t=`00`,n=`00`,r]=e.split(`:`),i=Number(t),a=this.getAttribute(`hours`)!==`false`,o=this.getAttribute(`minutes`)!==`false`,s=this.getAttribute(`seconds`)===`true`;if(!a)return[o?n:``,s?r||`00`:``].filter(Boolean).join(`:`);let c=i%12||12;return`${[String(c),o?n:``,s?r||`00`:``].filter(Boolean).join(`:`)} ${i>=12?`pm`:`am`}`}};customElements.get(`mint-datetime-picker`)||e.t(`mint-datetime-picker`,t),module.exports=t;
1
+ require(`../chunks/icon-CWOP4Com.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/date-picker-MT1QYTbL.js`),require(`../chunks/time-picker-DA-kUn8C.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._datePicker=null,this._timePicker=null,this._content=null,this._popoverContent=null,this._popoverObserver=null,this._hiddenInput=null,this._dateValue=``,this._timeValue=``,this._dateStageComplete=!1,this._ready=!1,this._writingValue=!1,this._displayControlBound=!1,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null}static get observedAttributes(){return[`value`,`label`,`info`,`name`,`required`,`disabled`,`readonly`,`format`,`display-format`,`min`,`max`,`shortcuts`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-datetime-picker`),this._readValue(this.getAttribute(`value`)||``),this.render(),this._ready=!0,this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}attributeChangedCallback(e,t,n){if(!(t===n||!this._ready||e===`value`&&this._writingValue)){if(e===`value`){this._readValue(n||``),this.render();return}if(e===`error`||e===`error-message`){this._syncState();return}this.render()}}get value(){return this.getAttribute(`value`)||``}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){this._readValue(e),this._writingValue=!0,e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._writingValue=!1,this.render(),this._syncState()}_parseDate(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));let r={yyyy:`(\\d{4})`,yy:`(\\d{2})`,Y:`(\\d{4})`,y:`(\\d{2})`,mm:`(\\d{1,2})`,m:`(\\d{1,2})`,n:`(\\d{1,2})`,dd:`(\\d{1,2})`,d:`(\\d{1,2})`,j:`(\\d{1,2})`,M:`([A-Za-z]+)`,F:`([A-Za-z]+)`},i=Object.keys(r).sort((e,t)=>t.length-e.length),a=[],o=`^`;for(let e=0;e<t.length;){let n=i.find(n=>t.startsWith(n,e));n?(o+=r[n],a.push(n),e+=n.length):(o+=t[e].replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),e++)}let s=e.match(RegExp(`${o}$`,`i`));if(!s)return null;let c=2e3,l=1,u=1;a.forEach((e,t)=>{let n=s[t+1];if(e===`Y`||e===`yyyy`)c=Number(n);else if(e===`y`||e===`yy`)c=Number(n)+2e3;else if(e===`m`||e===`mm`||e===`n`)l=Number(n);else if(e===`d`||e===`dd`||e===`j`)u=Number(n);else if(e===`M`||e===`F`){let e=new Date(`${n} 1, 2000`).getMonth();Number.isNaN(e)||(l=e+1)}});let d=new Date(c,l-1,u);return d.getFullYear()===c&&d.getMonth()===l-1&&d.getDate()===u?d:null}_formatDate(e,t){let n=e=>String(e).padStart(2,`0`),r={Y:String(e.getFullYear()),yyyy:String(e.getFullYear()),yy:String(e.getFullYear()).slice(-2),y:String(e.getFullYear()).slice(-2),mm:n(e.getMonth()+1),m:n(e.getMonth()+1),n:String(e.getMonth()+1),dd:n(e.getDate()),d:n(e.getDate()),j:String(e.getDate()),M:e.toLocaleString(void 0,{month:`short`}),F:e.toLocaleString(void 0,{month:`long`})};return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g,e=>r[e])}_readValue(e){let[t=``,n=``]=e.split(/[T ]/),r=this._parseDate(t,this.getAttribute(`format`)||`mm/dd/yyyy`);this._dateValue=r?this._formatDate(r,this.getAttribute(`format`)||`mm/dd/yyyy`):``,this._timeValue=n||``,this._dateStageComplete=!!r}_toISODate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}_syncValue(e=!1){let t=this._toISODate(),n=this._timeValue,r=t&&n?`${t}T${n}`:``;this._writingValue=!0,r?this.setAttribute(`value`,r):this.removeAttribute(`value`),this._writingValue=!1,this._hiddenInput&&(this._hiddenInput.value=r),e&&r&&(this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,composed:!0})))}_syncState(){this._datePicker&&(this._datePicker.setAttribute(`value`,this._dateValue),this._datePicker.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._datePicker.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._timePicker?.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._timePicker?.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._hiddenInput&&(this._hiddenInput.value=this.getValue()),this._syncCombinedDisplay())}render(){let e=this.getAttribute(`label`)||``,t=this.getAttribute(`info`)||``,n=this.getAttribute(`format`)||`mm/dd/yyyy`,r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;this._collectAdornmentNodes(),this._displayControlBound=!1;let a=document.createElement(`mint-date-picker`);a.setAttribute(`class`,`mint-datetime-picker-date`),a.setAttribute(`keep-open-on-select`,`true`),a.setAttribute(`format`,n),a.setAttribute(`value`,this._dateValue),a.setAttribute(`label`,e),a.setAttribute(`info`,t),a.setAttribute(`display-format`,this.getAttribute(`display-format`)||`F j, Y`);for(let e of[`min`,`max`,`shortcuts`])this.hasAttribute(e)&&a.setAttribute(e,this.getAttribute(e)||``);r&&a.setAttribute(`disabled`,`true`),i&&a.setAttribute(`readonly`,`true`),this.hasAttribute(`required`)&&a.setAttribute(`required`,this.getAttribute(`required`)||`true`),this.hasAttribute(`error`)&&a.setAttribute(`error`,this.getAttribute(`error`)||`false`),this.hasAttribute(`error-message`)&&a.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._prependSlotNodes.forEach(e=>a.appendChild(e)),this._appendSlotNodes.forEach(e=>a.appendChild(e)),a.addEventListener(`change`,e=>{e.stopPropagation();let t=e.detail?.value||a.value||``;this._parseDate(t,n)&&(this._dateValue=t,this._dateStageComplete=!0,this._syncValue(!1),this._syncCombinedDisplay(),this._openTimeStage())}),this._datePicker=a,this._bindCombinedDisplayControl();let o=document.createElement(`div`);o.className=`mint-datetime-picker-content`,this._content=o,this.innerHTML=``,this.appendChild(o),o.appendChild(a),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getAttribute(`name`)||``,this._hiddenInput.value=this.getValue(),this.appendChild(this._hiddenInput),this._waitForPopover()}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}_getPopover(){let e=this._datePicker,t=e?.getPopoverElement?.()||e?._popover;if(t)return t;let n=e?.querySelector?.(`.mint-date-picker-icon-button`)?.id;return n?document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`):null}_getPopoverContent(e){return e.querySelector(`.popover-content`)||e}_waitForPopover(e=0){let t=this._getPopover();if(!t){e<120&&requestAnimationFrame(()=>this._waitForPopover(e+1));return}if(this._popoverContent=this._datePicker?.getPopoverContentElement?.()||this._getPopoverContent(t),this._bindCombinedDisplayControl(),this._syncCombinedDisplay(),this._popoverObserver?.disconnect(),this._popoverObserver=new MutationObserver(()=>{if(t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}),this._popoverObserver.observe(t,{attributes:!0,attributeFilter:[`open`]}),t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}_bindCombinedDisplayControl(){if(this._displayControlBound||!this._datePicker)return;this._displayControlBound=!0;let e=e=>{if(!e.target?.closest(`.mint-date-picker-field`)||this.getAttribute(`disabled`)===`true`||this.getAttribute(`readonly`)===`true`||e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation();let t=this._getPopover();t?.open?t.open():t?.setAttribute(`open`,`true`)};this._datePicker.addEventListener(`click`,e,!0),this._datePicker.addEventListener(`keydown`,e,!0)}_openTimeStage(){queueMicrotask(()=>{let e=this._getPopover();if(e?.getAttribute(`open`)!==`true`){typeof e?.open==`function`?e.open():e?.setAttribute(`open`,`true`),requestAnimationFrame(()=>this._renderTimeStage());return}this._renderTimeStage()})}_renderTimeStage(){if(!this._popoverContent||!this._dateStageComplete)return;let e=document.createElement(`div`);e.className=`mint-datetime-picker-panel`;let t=document.createElement(`button`);t.type=`button`,t.className=`mint-datetime-picker-time-heading`,t.setAttribute(`aria-label`,`Change date, ${this._dateValue}`),t.textContent=this._getFormattedDate(),t.addEventListener(`click`,()=>{let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()});let n=document.createElement(`mint-time-picker`),r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;n.setAttribute(`inline`,`true`),n.setAttribute(`value`,this._timeValue||`09:00`),n.setAttribute(`label`,``);for(let e of[`hours`,`minutes`,`seconds`])this.hasAttribute(e)&&n.setAttribute(e,this.getAttribute(e)||``);r&&n.setAttribute(`disabled`,`true`),i&&n.setAttribute(`readonly`,`true`),n.addEventListener(`change`,()=>{this._timeValue=n.getValue?.()||n.getAttribute(`value`)||``,this._syncValue(!0),this._syncCombinedDisplay()}),n.addEventListener(`change`,e=>e.stopPropagation()),n.addEventListener(`input`,e=>e.stopPropagation()),this._timePicker=n,e.appendChild(t),e.appendChild(n),this._popoverContent.replaceChildren(e)}_syncCombinedDisplay(){let e=this._datePicker?.getDisplayElement?.()||this._datePicker?.querySelector(`.mint-date-picker-display`);if(!e||!this._dateValue)return;let t=this._getFormattedDate();e.textContent=this._timeValue?`${t} · ${this._formatTime(this._timeValue)}`:t,e.setAttribute(`aria-label`,`${this.getAttribute(`label`)||`Date and time`}: ${e.textContent}`)}_getFormattedDate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?this._formatDate(e,this.getAttribute(`display-format`)||`F j, Y`):this._dateValue}_formatTime(e){let[t=`00`,n=`00`,r]=e.split(`:`),i=Number(t),a=this.getAttribute(`hours`)!==`false`,o=this.getAttribute(`minutes`)!==`false`,s=this.getAttribute(`seconds`)===`true`;if(!a)return[o?n:``,s?r||`00`:``].filter(Boolean).join(`:`);let c=i%12||12;return`${[String(c),o?n:``,s?r||`00`:``].filter(Boolean).join(`:`)} ${i>=12?`pm`:`am`}`}};customElements.get(`mint-datetime-picker`)||e.t(`mint-datetime-picker`,t),module.exports=t;
@@ -10,12 +10,12 @@ import '../../datetime-picker.css'
10
10
  import "../chunks/icon-hyFz3uhh.js";
11
11
  import { t as e } from "../chunks/register-element-BFYmIynH.js";
12
12
  import "../chunks/text-C-6UCBp-.js";
13
- import "../chunks/date-picker-Bqre6M4g.js";
14
- import "../chunks/time-picker-DY5emLWw.js";
13
+ import "../chunks/date-picker-C0U4312C.js";
14
+ import "../chunks/time-picker-BJY2sFyL.js";
15
15
  //#region src/components/datetime-picker/DateTimePicker.ts
16
16
  var t = class extends HTMLElement {
17
17
  constructor(...e) {
18
- super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1;
18
+ super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1, this._prependSlotNodes = [], this._appendSlotNodes = [], this._slotObserver = null;
19
19
  }
20
20
  static get observedAttributes() {
21
21
  return [
@@ -39,7 +39,14 @@ var t = class extends HTMLElement {
39
39
  ];
40
40
  }
41
41
  connectedCallback() {
42
- this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0;
42
+ this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0, this._slotObserver = new MutationObserver((e) => {
43
+ e.some((e) => e.type === "attributes" && e.target.hasAttribute("slot") || e.type === "childList" && e.target === this && Array.from(e.addedNodes).some((e) => e instanceof HTMLElement && (e.slot === "prepend" || e.slot === "append"))) && this.render();
44
+ }), this._slotObserver.observe(this, {
45
+ childList: !0,
46
+ subtree: !0,
47
+ attributes: !0,
48
+ attributeFilter: ["slot"]
49
+ });
43
50
  }
44
51
  attributeChangedCallback(e, t, n) {
45
52
  if (!(t === n || !this._ready || e === "value" && this._writingValue)) {
@@ -145,7 +152,7 @@ var t = class extends HTMLElement {
145
152
  }
146
153
  render() {
147
154
  let e = this.getAttribute("label") || "", t = this.getAttribute("info") || "", n = this.getAttribute("format") || "mm/dd/yyyy", r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
148
- this._displayControlBound = !1;
155
+ this._collectAdornmentNodes(), this._displayControlBound = !1;
149
156
  let a = document.createElement("mint-date-picker");
150
157
  a.setAttribute("class", "mint-datetime-picker-date"), a.setAttribute("keep-open-on-select", "true"), a.setAttribute("format", n), a.setAttribute("value", this._dateValue), a.setAttribute("label", e), a.setAttribute("info", t), a.setAttribute("display-format", this.getAttribute("display-format") || "F j, Y");
151
158
  for (let e of [
@@ -153,7 +160,7 @@ var t = class extends HTMLElement {
153
160
  "max",
154
161
  "shortcuts"
155
162
  ]) this.hasAttribute(e) && a.setAttribute(e, this.getAttribute(e) || "");
156
- r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), a.addEventListener("change", (e) => {
163
+ r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), this._prependSlotNodes.forEach((e) => a.appendChild(e)), this._appendSlotNodes.forEach((e) => a.appendChild(e)), a.addEventListener("change", (e) => {
157
164
  e.stopPropagation();
158
165
  let t = e.detail?.value || a.value || "";
159
166
  this._parseDate(t, n) && (this._dateValue = t, this._dateStageComplete = !0, this._syncValue(!1), this._syncCombinedDisplay(), this._openTimeStage());
@@ -161,6 +168,14 @@ var t = class extends HTMLElement {
161
168
  let o = document.createElement("div");
162
169
  o.className = "mint-datetime-picker-content", this._content = o, this.innerHTML = "", this.appendChild(o), o.appendChild(a), this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.name = this.getAttribute("name") || "", this._hiddenInput.value = this.getValue(), this.appendChild(this._hiddenInput), this._waitForPopover();
163
170
  }
171
+ _collectAdornmentNodes() {
172
+ let e = [
173
+ ...this._prependSlotNodes,
174
+ ...this._appendSlotNodes,
175
+ ...Array.from(this.querySelectorAll("[slot=\"prepend\"], [slot=\"append\"]"))
176
+ ];
177
+ this._prependSlotNodes = e.filter((e) => e.getAttribute("slot") === "prepend"), this._appendSlotNodes = e.filter((e) => e.getAttribute("slot") === "append");
178
+ }
164
179
  _getPopover() {
165
180
  let e = this._datePicker, t = e?.getPopoverElement?.() || e?._popover;
166
181
  if (t) return t;
@@ -33,6 +33,9 @@ declare class MintInput extends HTMLElement {
33
33
  private _getNormalizedType;
34
34
  private _isTextarea;
35
35
  private _isMoney;
36
+ private _getMoneyDecimalPlaces;
37
+ private _formatMoneyValue;
38
+ private _formatMoneyInput;
36
39
  private _isColor;
37
40
  private _isNumber;
38
41
  getPlaceholder(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAMtB,cAAM,SAAU,SAAQ,WAAW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AkD3B,SAAS,IAAI,OAAO;IAKpB,MAAM,IAAI,IAAI;IAqlBd,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,yBAAyB;IAgCjC,mBAAmB,IAAI,IAAI;IAwF3B,oBAAoB,IAAI,IAAI;IAgB5B,KAAK,IAAI,IAAI;IAQb,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,eAAe;CAmCxB;AAOD,eAAe,SAAS,CAAA"}
@@ -13,5 +13,5 @@ const __mintLoadStyle = (key, url) => {
13
13
  __mintLoadStyle('theme', '../../theme.css')
14
14
  __mintLoadStyle('icon', '../../icon.css')
15
15
  __mintLoadStyle('input', '../../input.css')
16
- import { t as e } from "../chunks/input-j6FCwb-x.js";
16
+ import { t as e } from "../chunks/input-BTRS6ggP.js";
17
17
  export { e as default };
@@ -1 +1 @@
1
- const e=require(`../chunks/input-Br2qLesW.js`);module.exports=e.t;
1
+ const e=require(`../chunks/input-D9FDLgwb.js`);module.exports=e.t;
@@ -1,5 +1,5 @@
1
1
  import '../../theme.css'
2
2
  import '../../icon.css'
3
3
  import '../../input.css'
4
- import { t as e } from "../chunks/input-j6FCwb-x.js";
4
+ import { t as e } from "../chunks/input-BTRS6ggP.js";
5
5
  export { e as default };
@@ -21,7 +21,7 @@ __mintLoadStyle('navigation', '../../navigation.css')
21
21
  import "../chunks/icon-hyFz3uhh.js";
22
22
  import { t as e } from "../chunks/register-element-BFYmIynH.js";
23
23
  import "../chunks/button-JPTyQfRs.js";
24
- import "../chunks/popover-C1qiTAvR.js";
24
+ import "../chunks/popover-D5-jzS7p.js";
25
25
  import "../chunks/link-ACOyvLkd.js";
26
26
  //#region src/components/navigation/Navigation.js
27
27
  var t = 0, n = class extends HTMLElement {
@@ -1 +1 @@
1
- require(`../chunks/icon-CWOP4Com.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/button-B_yN18B-.js`),require(`../chunks/popover-6cborap6.js`),require(`../chunks/link-DVKhDl3O.js`);var t=0,n=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`,`fixed`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._leadingActions=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++t,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`leading-actions`),r=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=r.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let i=e.filter(e=>e!==t&&!n.includes(e)&&!r.includes(e));this.replaceChildren();let a=document.createElement(`div`);a.className=`mint-navigation-shell`;let o=document.createElement(`div`);o.className=`mint-navigation-bar`,this._leadingActions=document.createElement(`div`),this._leadingActions.className=`mint-navigation-leading-actions`;for(let e of n)e.removeAttribute(`slot`),this._leadingActions.appendChild(e);this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,o.append(this._leadingActions,this._brand,this._mobileActions,this._toggle);let s=document.createElement(`div`);this._content=s,s.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let c=0;for(let e of i)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,c++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let l=document.createElement(`div`);this._actions=l,l.className=`mint-navigation-actions`;for(let e of r)e.removeAttribute(`slot`),l.appendChild(e);let u=document.createElement(`section`);u.className=`mint-navigation-submenu`,u.setAttribute(`aria-label`,`Navigation submenu`);let d=document.createElement(`div`);d.className=`mint-navigation-submenu-header`;let f=document.createElement(`mint-button`);f.className=`mint-navigation-submenu-back`,f.setAttribute(`variant`,`ghost`),f.setAttribute(`tone`,`action`),f.setAttribute(`button-type`,`button`),f.setAttribute(`icon`,`arrow-left`),f.setAttribute(`aria-label`,`Back to main navigation`),f.addEventListener(`click`,()=>this._closeSubmenu());let p=document.createElement(`h3`);p.className=`mint-navigation-submenu-title`,d.append(f,p);let m=document.createElement(`nav`);m.className=`mint-navigation-submenu-items`,m.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),u.append(d,m),this._submenu=u,this._submenuTitle=p,this._submenuItems=m;for(let e of this._dropdowns)m.append(...e.submenuItems);s.append(this._items,l,u),a.append(o,s),this.appendChild(a),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&e.t(`mint-navigation`,n),module.exports=n;
1
+ require(`../chunks/icon-CWOP4Com.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/button-B_yN18B-.js`),require(`../chunks/popover-DFxM40QK.js`),require(`../chunks/link-DVKhDl3O.js`);var t=0,n=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`,`fixed`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._leadingActions=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++t,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`leading-actions`),r=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=r.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let i=e.filter(e=>e!==t&&!n.includes(e)&&!r.includes(e));this.replaceChildren();let a=document.createElement(`div`);a.className=`mint-navigation-shell`;let o=document.createElement(`div`);o.className=`mint-navigation-bar`,this._leadingActions=document.createElement(`div`),this._leadingActions.className=`mint-navigation-leading-actions`;for(let e of n)e.removeAttribute(`slot`),this._leadingActions.appendChild(e);this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,o.append(this._leadingActions,this._brand,this._mobileActions,this._toggle);let s=document.createElement(`div`);this._content=s,s.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let c=0;for(let e of i)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,c++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let l=document.createElement(`div`);this._actions=l,l.className=`mint-navigation-actions`;for(let e of r)e.removeAttribute(`slot`),l.appendChild(e);let u=document.createElement(`section`);u.className=`mint-navigation-submenu`,u.setAttribute(`aria-label`,`Navigation submenu`);let d=document.createElement(`div`);d.className=`mint-navigation-submenu-header`;let f=document.createElement(`mint-button`);f.className=`mint-navigation-submenu-back`,f.setAttribute(`variant`,`ghost`),f.setAttribute(`tone`,`action`),f.setAttribute(`button-type`,`button`),f.setAttribute(`icon`,`arrow-left`),f.setAttribute(`aria-label`,`Back to main navigation`),f.addEventListener(`click`,()=>this._closeSubmenu());let p=document.createElement(`h3`);p.className=`mint-navigation-submenu-title`,d.append(f,p);let m=document.createElement(`nav`);m.className=`mint-navigation-submenu-items`,m.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),u.append(d,m),this._submenu=u,this._submenuTitle=p,this._submenuItems=m;for(let e of this._dropdowns)m.append(...e.submenuItems);s.append(this._items,l,u),a.append(o,s),this.appendChild(a),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&e.t(`mint-navigation`,n),module.exports=n;
@@ -9,7 +9,7 @@ import '../../navigation.css'
9
9
  import "../chunks/icon-hyFz3uhh.js";
10
10
  import { t as e } from "../chunks/register-element-BFYmIynH.js";
11
11
  import "../chunks/button-JPTyQfRs.js";
12
- import "../chunks/popover-C1qiTAvR.js";
12
+ import "../chunks/popover-D5-jzS7p.js";
13
13
  import "../chunks/link-ACOyvLkd.js";
14
14
  //#region src/components/navigation/Navigation.js
15
15
  var t = 0, n = class extends HTMLElement {
@@ -16,6 +16,8 @@ declare class MintOffCanvas extends HTMLElement {
16
16
  private _contentObserver;
17
17
  private _renderFrame;
18
18
  private _exitTimer;
19
+ private _enterPending;
20
+ private _exitPending;
19
21
  private _previousFocus;
20
22
  private _dialogWasOpen;
21
23
  private _dialogKeydownHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"OffCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/off-canvas/OffCanvas.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,eAAe,CAAA;AACtB,OAAO,gBAAgB,CAAA;AAEvB,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,cAAM,aAAc,SAAQ,WAAW;IACrC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,C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