@aquera/nile-elements 1.3.8-beta-1.0 → 1.3.8-beta-1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3271,20 +3271,21 @@ const de=1,he=2,Te=3,ye=4,Ae=e=>(...t)=>({_$litDirective$:e,values:t});let Oe=cl
3271
3271
  `;let nM=class extends Re{constructor(){super(...arguments),this.label="",this.sublabel="",this.textPosition="right",this.isChecked=!1,this.fullWidth=!1,this.disabled=!1,this.helpText="",this.errorMessage=""}connectedCallback(){super.connectedCallback(),this.emit("nile-init"),this.style.setProperty("--slide-toggle-width",this.fullWidth?"100%":"auto")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}toggleValue(){this.isChecked=!this.isChecked,this.emit("change",{checked:this.isChecked,value:this.isChecked}),this.emit("nile-change",{checked:this.isChecked,value:this.isChecked})}render(){const e=!!this.helpText,t=!!this.errorMessage;return R`
3272
3272
  <div
3273
3273
  class=${pe({"nile-slide-toggle":!0,"nile-slide--disabled":this.disabled,"nile-slide-toggle--reverse":"left"==this.textPosition})}
3274
+ part="base"
3274
3275
  >
3275
3276
  <label
3276
3277
  class="${pe({"nile-slide-toggle__switch":!0,"nile-slide-toggle__switch--left":"right"==this.textPosition,"nile-slide-toggle__switch--right":"left"==this.textPosition})}"
3277
- class="nile-slide-toggle__switch">
3278
+ class="nile-slide-toggle__switch" part="slide-toggle-switch">
3278
3279
  <input
3279
3280
  type="checkbox"
3280
3281
  .checked=${this.isChecked}
3281
3282
  @change=${this.toggleValue}
3282
3283
  />
3283
- <span class="nile-slide-toggle__slider"></span>
3284
+ <span class="nile-slide-toggle__slider" part="slide-toggle-slider"></span>
3284
3285
  </label>
3285
- <span class="nile-slide-toggle__label">
3286
- <span>${this.label}</span>
3287
- <span class="nile-slide-toggle__sublabel">${this.sublabel}</span>
3286
+ <span class="nile-slide-toggle__label" part="slide-toggle-label-container">
3287
+ <span part="slide-toggle-label">${this.label}</span>
3288
+ <span class="nile-slide-toggle__sublabel" part="slide-toggle-sublabel">${this.sublabel}</span>
3288
3289
  </span>
3289
3290
  </div>
3290
3291
  ${e?R` <nile-form-help-text>${this.helpText}</nile-form-help-text> `:""}
@@ -6393,7 +6394,7 @@ box-shadow: none;
6393
6394
  display:block;
6394
6395
  width: 100%;
6395
6396
  }
6396
- `;function hn(e,t){if(!e)return null;const i=t.match(/[^A-Z]/i);if(!i)return null;const M=i[0];if(!e.includes(M))return null;const n=e.split(M),o=t.split(M);let r=null,s=null,a=null;for(let e=0;e<o.length;e++){const t=o[e],i=n[e];if(!i)return null;if("DD"===t){if(2!==i.length)return null;r=Number(i)}if("MM"===t){if(2!==i.length)return null;s=Number(i)-1}if("YYYY"===t){if(4!==i.length)return null;a=Number(i)}}if(null==r||null==s||null==a)return null;const l=new Date(a,s,r);return l.getFullYear()!==a||l.getMonth()!==s||l.getDate()!==r?null:l}function Tn(e,t){if(!e)return"";const i=String(e.getDate()).padStart(2,"0"),M=String(e.getMonth()+1).padStart(2,"0"),n=e.getFullYear();switch(t){case"DD/MM/YYYY":default:return`${i}/${M}/${n}`;case"MM/DD/YYYY":return`${M}/${i}/${n}`;case"YYYY/MM/DD":return`${n}/${M}/${i}`;case"YYYY.MM.DD":return`${n}.${M}.${i}`;case"DD.MM.YYYY":return`${i}.${M}.${n}`}}let yn=class extends Re{constructor(){super(...arguments),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.open=!1,this.hideTimeZone=!1,this.type="absolute",this.showManualInputs=!1,this.hideDurationFields=[],this.allowedDates="{}",this.syncDatePicker=!1,this.dateFormat="DD/MM/YYYY",this.rangeSeparator=" - ",this.showYearDropdown=!1,this.showMonthDropdown=!1}static get styles(){return[dn]}firstUpdated(){if(super.firstUpdated?.(new Map),!this.syncDatePicker)return;const e=this.querySelector("nile-input");e&&e.addEventListener("nile-input",(e=>{const t=e.detail.value,{first:i,second:M}=function(e,t,i,M){if(!i)return{first:hn(e,t),second:null};if(!e.includes(M))return{first:hn(e,t),second:null};const[n,o]=e.split(M);return{first:hn(n,t),second:o?hn(o,t):null}}(t,this.dateFormat,this.range,this.rangeSeparator);if(this.range){if(i&&!M&&(this.jumpTo(i),this.syncRangeCalendar(i,null)),i&&M){const[e,t]=function(e,t){return e&&t&&e.getTime()>t.getTime()?[t,e]:[e,t]}(i,M);t&&this.jumpTo(t),this.syncRangeCalendar(e,t)}}else i&&this.jumpTo(i)}))}jumpTo(e){this.open=!0;const t=this.shadowRoot.querySelector("nile-calendar");t&&(t.currentYear=e.getFullYear(),t.currentMonth=e.getMonth(),t.value=e,t.valueAttribute=e.toISOString())}syncRangeCalendar(e,t){const i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(e&&(i.startDate=e),t&&(i.endDate=t))}render(){return R`
6397
+ `;function hn(e,t){if(!e)return null;const i=t.match(/[^A-Z]/i);if(!i)return null;const M=i[0];if(!e.includes(M))return null;const n=e.split(M),o=t.split(M);let r=null,s=null,a=null;for(let e=0;e<o.length;e++){const t=o[e],i=n[e];if(!i)return null;if("DD"===t){if(2!==i.length)return null;r=Number(i)}if("MM"===t){if(2!==i.length)return null;s=Number(i)-1}if("YYYY"===t){if(4!==i.length)return null;a=Number(i)}}if(null==r||null==s||null==a)return null;const l=new Date(a,s,r);return l.getFullYear()!==a||l.getMonth()!==s||l.getDate()!==r?null:l}function Tn(e,t){if(!e)return"";const i=String(e.getDate()).padStart(2,"0"),M=String(e.getMonth()+1).padStart(2,"0"),n=e.getFullYear();switch(t){case"DD/MM/YYYY":default:return`${i}/${M}/${n}`;case"MM/DD/YYYY":return`${M}/${i}/${n}`;case"YYYY/MM/DD":return`${n}/${M}/${i}`;case"YYYY.MM.DD":return`${n}.${M}.${i}`;case"DD.MM.YYYY":return`${i}.${M}.${n}`}}let yn=class extends Re{constructor(){super(...arguments),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.open=!1,this.hideTimeZone=!1,this.type="absolute",this.showManualInputs=!1,this.hideDurationFields=[],this.allowedDates="{}",this.syncDatePicker=!1,this.dateFormat="DD/MM/YYYY",this.rangeSeparator=" - "}static get styles(){return[dn]}firstUpdated(){if(super.firstUpdated?.(new Map),!this.syncDatePicker)return;const e=this.querySelector("nile-input");e&&e.addEventListener("nile-input",(e=>{const t=e.detail.value,{first:i,second:M}=function(e,t,i,M){if(!i)return{first:hn(e,t),second:null};if(!e.includes(M))return{first:hn(e,t),second:null};const[n,o]=e.split(M);return{first:hn(n,t),second:o?hn(o,t):null}}(t,this.dateFormat,this.range,this.rangeSeparator);if(this.range){if(i&&!M&&(this.jumpTo(i),this.syncRangeCalendar(i,null)),i&&M){const[e,t]=function(e,t){return e&&t&&e.getTime()>t.getTime()?[t,e]:[e,t]}(i,M);t&&this.jumpTo(t),this.syncRangeCalendar(e,t)}}else i&&this.jumpTo(i)}))}jumpTo(e){this.open=!0;const t=this.shadowRoot.querySelector("nile-calendar");t&&(t.currentYear=e.getFullYear(),t.currentMonth=e.getMonth(),t.value=e,t.valueAttribute=e.toISOString())}syncRangeCalendar(e,t){const i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(e&&(i.startDate=e),t&&(i.endDate=t))}render(){return R`
6397
6398
  <nile-dropdown .open="${this.open}" part="dd-base" .hoist="${!0}" distance="6" exportparts="base">
6398
6399
  <slot slot="trigger" part="trigger" name="trigger"></slot>
6399
6400
 
@@ -6416,13 +6417,9 @@ box-shadow: none;
6416
6417
  .showManualInputs="${this.showManualInputs}"
6417
6418
  .doubleClickUnselect="${this.doubleClickUnselect}"
6418
6419
  .allowClear="${this.allowClear}"
6419
- .startYear="${this.startYear}"
6420
- .endYear="${this.endYear}"
6421
- ?showYearDropdown="${this.showYearDropdown}"
6422
- ?showMonthDropdown="${this.showMonthDropdown}"
6423
6420
  ></nile-calendar>
6424
6421
  </nile-dropdown>
6425
- `}handleChanged(e){e.stopPropagation();const t=e.detail,i=this.querySelector("nile-input");if(!this.range){const M=t.value;return M&&i&&(i.value=Tn(new Date(M),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),void this.dropdown?.hide()}const M=t.startDate,n=t.endDate;if(i){let e="";M&&(e+=Tn(new Date(M),this.dateFormat)),M&&n&&(e+=" - "+Tn(new Date(n),this.dateFormat)),i.value=e,i.emit("nile-input",{value:e})}this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),this.dropdown&&this.dropdown.hide()}connectedCallback(){super.connectedCallback(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}};e([ce({type:Boolean})],yn.prototype,"range",void 0),e([ce({type:Boolean})],yn.prototype,"hideTypes",void 0),e([ce({type:Boolean,reflect:!0})],yn.prototype,"doubleClickUnselect",void 0),e([ce({type:Boolean,reflect:!0})],yn.prototype,"allowClear",void 0),e([ce({type:Boolean})],yn.prototype,"open",void 0),e([ce({type:Boolean,attribute:"hide-time-zone"})],yn.prototype,"hideTimeZone",void 0),e([ce({type:String,reflect:!0})],yn.prototype,"type",void 0),e([ce({type:Boolean,attribute:"showManualInputs"})],yn.prototype,"showManualInputs",void 0),e([ce()],yn.prototype,"value",void 0),e([ce({type:Array,attribute:"hide-duration-fields"})],yn.prototype,"hideDurationFields",void 0),e([ce({attribute:"allowedDates"})],yn.prototype,"allowedDates",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],yn.prototype,"syncDatePicker",void 0),e([ce({type:String,attribute:!0,reflect:!0})],yn.prototype,"dateFormat",void 0),e([ce({type:String,attribute:!0,reflect:!0})],yn.prototype,"rangeSeparator",void 0),e([ce({type:Number,attribute:!0,reflect:!0})],yn.prototype,"startYear",void 0),e([ce({type:Number,attribute:!0,reflect:!0})],yn.prototype,"endYear",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],yn.prototype,"showYearDropdown",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],yn.prototype,"showMonthDropdown",void 0),e([Ie("nile-dropdown")],yn.prototype,"dropdown",void 0),yn=e([Ne("nile-date-picker")],yn);const An=r`
6422
+ `}handleChanged(e){e.stopPropagation();const t=e.detail,i=this.querySelector("nile-input");if(!this.range){const M=t.value;return M&&i&&(i.value=Tn(new Date(M),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),void this.dropdown?.hide()}const M=t.startDate,n=t.endDate;if(i){let e="";M&&(e+=Tn(new Date(M),this.dateFormat)),M&&n&&(e+=" - "+Tn(new Date(n),this.dateFormat)),i.value=e,i.emit("nile-input",{value:e})}this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),this.dropdown&&this.dropdown.hide()}connectedCallback(){super.connectedCallback(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}};e([ce({type:Boolean})],yn.prototype,"range",void 0),e([ce({type:Boolean})],yn.prototype,"hideTypes",void 0),e([ce({type:Boolean,reflect:!0})],yn.prototype,"doubleClickUnselect",void 0),e([ce({type:Boolean,reflect:!0})],yn.prototype,"allowClear",void 0),e([ce({type:Boolean})],yn.prototype,"open",void 0),e([ce({type:Boolean,attribute:"hide-time-zone"})],yn.prototype,"hideTimeZone",void 0),e([ce({type:String,reflect:!0})],yn.prototype,"type",void 0),e([ce({type:Boolean,attribute:"showManualInputs"})],yn.prototype,"showManualInputs",void 0),e([ce()],yn.prototype,"value",void 0),e([ce({type:Array,attribute:"hide-duration-fields"})],yn.prototype,"hideDurationFields",void 0),e([ce({attribute:"allowedDates"})],yn.prototype,"allowedDates",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],yn.prototype,"syncDatePicker",void 0),e([ce({type:String,attribute:!0,reflect:!0})],yn.prototype,"dateFormat",void 0),e([ce({type:String,attribute:!0,reflect:!0})],yn.prototype,"rangeSeparator",void 0),e([Ie("nile-dropdown")],yn.prototype,"dropdown",void 0),yn=e([Ne("nile-date-picker")],yn);const An=r`
6426
6423
  :host {
6427
6424
  -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
6428
6425
  -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));
@@ -14751,7 +14748,7 @@ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
14751
14748
 
14752
14749
 
14753
14750
 
14754
- `,BS={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let GS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),fS(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(RS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=BS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?ZS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){ZS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=CS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&US(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;bS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":fS(this.editorEl,"strong");break;case"italic":fS(this.editorEl,"em");break;case"underline":fS(this.editorEl,"u");break;case"left":bS(this.editorEl,"left");break;case"center":bS(this.editorEl,"center");break;case"right":bS(this.editorEl,"right");break;case"justify":bS(this.editorEl,"justify");break;case"ul":PS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":PS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=CS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=vS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=vS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],GS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],GS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],GS.prototype,"singleLineEditor",void 0),e([ce({type:String})],GS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],GS.prototype,"mentions",void 0),e([De()],GS.prototype,"content",void 0),GS=e([Ne("nile-rich-text-editor")],GS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.3.8-beta-1.0"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const _S=r`
14751
+ `,BS={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let GS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),fS(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(RS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=BS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?ZS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){ZS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=CS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&US(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;bS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":fS(this.editorEl,"strong");break;case"italic":fS(this.editorEl,"em");break;case"underline":fS(this.editorEl,"u");break;case"left":bS(this.editorEl,"left");break;case"center":bS(this.editorEl,"center");break;case"right":bS(this.editorEl,"right");break;case"justify":bS(this.editorEl,"justify");break;case"ul":PS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":PS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=CS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=vS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=vS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],GS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],GS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],GS.prototype,"singleLineEditor",void 0),e([ce({type:String})],GS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],GS.prototype,"mentions",void 0),e([De()],GS.prototype,"content",void 0),GS=e([Ne("nile-rich-text-editor")],GS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.3.8-beta-1.1"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const _S=r`
14755
14752
  :host {
14756
14753
  --sidebar-width: 240px;
14757
14754
  --sidebar-collapsed-width: 70px;
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-date-picker.css.cjs.js","../internal/nile-element.cjs.js","./nile-date-picker-utils.cjs.js"],function(_export,_context){"use strict";var t,e,i,s,n,o,a,r,l,h,_templateObject,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;s=_litDecoratorsJs.query;n=_litDecoratorsJs.customElement;},function(_nileDatePickerCssCjsJs){o=_nileDatePickerCssCjsJs.s;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;},function(_nileDatePickerUtilsCjsJs){r=_nileDatePickerUtilsCjsJs.p;l=_nileDatePickerUtilsCjsJs.n;h=_nileDatePickerUtilsCjsJs.f;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_a){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.range=!1,_this.hideTypes=!1,_this.doubleClickUnselect=!1,_this.allowClear=!1,_this.open=!1,_this.hideTimeZone=!1,_this.type="absolute",_this.showManualInputs=!1,_this.hideDurationFields=[],_this.allowedDates="{}",_this.syncDatePicker=!1,_this.dateFormat="DD/MM/YYYY",_this.rangeSeparator=" - ",_this.showYearDropdown=!1,_this.showMonthDropdown=!1;return _this;}_inherits(d,_a);return _createClass(d,[{key:"firstUpdated",value:function firstUpdated(){var _superPropGet2,_this2=this;if((_superPropGet2=_superPropGet(d,"firstUpdated",this,3))!==null&&_superPropGet2!==void 0&&_superPropGet2([new Map()]),!this.syncDatePicker)return;var t=this.querySelector("nile-input");t&&t.addEventListener("nile-input",function(t){var e=t.detail.value,_r=r(e,_this2.dateFormat,_this2.range,_this2.rangeSeparator),i=_r.first,s=_r.second;if(_this2.range){if(i&&!s&&(_this2.jumpTo(i),_this2.syncRangeCalendar(i,null)),i&&s){var _l=l(i,s),_l2=_slicedToArray(_l,2),_t=_l2[0],_e=_l2[1];_e&&_this2.jumpTo(_e),_this2.syncRangeCalendar(_t,_e);}}else i&&_this2.jumpTo(i);});}},{key:"jumpTo",value:function jumpTo(t){this.open=!0;var e=this.shadowRoot.querySelector("nile-calendar");e&&(e.currentYear=t.getFullYear(),e.currentMonth=t.getMonth(),e.value=t,e.valueAttribute=t.toISOString());}},{key:"syncRangeCalendar",value:function syncRangeCalendar(t,e){var i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(t&&(i.startDate=t),e&&(i.endDate=e));}},{key:"render",value:function render(){var _this3=this;return e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-dropdown .open=\"","\" part=\"dd-base\" .hoist=\"","\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"","\"\n .type=\"","\"\n value=\"","\"\n .range=\"","\"\n @nile-init=\"","\"\n @nile-destroy=\"","\"\n @nile-changed=\"","\"\n\n @nile-change=\"","\"\n\n .allowedDates=\"","\"\n\n @nile-type-change=\"","\"\n @nile-clear=\"","\"\n .hideDurationFields=\"","\"\n .showManualInputs=\"","\"\n .doubleClickUnselect=\"","\"\n .allowClear=\"","\"\n .startYear=\"","\"\n .endYear=\"","\"\n ?showYearDropdown=\"","\"\n ?showMonthDropdown=\"","\"\n ></nile-calendar>\n </nile-dropdown>\n "])),this.open,!0,this.hideTypes,this.type,this.value,this.range,function(t){return t.stopPropagation();},function(t){return t.stopPropagation();},function(t){return t.stopPropagation();},this.handleChanged,this.allowedDates,function(t){t.stopPropagation(),_this3.emit("nile-type-change",t.detail);},function(t){t.stopPropagation(),_this3.emit("nile-clear");},this.hideDurationFields,this.showManualInputs,this.doubleClickUnselect,this.allowClear,this.startYear,this.endYear,this.showYearDropdown,this.showMonthDropdown);}},{key:"handleChanged",value:function handleChanged(t){t.stopPropagation();var e=t.detail,i=this.querySelector("nile-input");if(!this.range){var _this$dropdown;var _s=e.value;return _s&&i&&(i.value=h(new Date(_s),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",t.detail),this.emit("nile-change",t.detail),void((_this$dropdown=this.dropdown)===null||_this$dropdown===void 0?void 0:_this$dropdown.hide());}var s=e.startDate,n=e.endDate;if(i){var _t2="";s&&(_t2+=h(new Date(s),this.dateFormat)),s&&n&&(_t2+=" - "+h(new Date(n),this.dateFormat)),i.value=_t2,i.emit("nile-input",{value:_t2});}this.emit("nile-changed",t.detail),this.emit("nile-change",t.detail),this.dropdown&&this.dropdown.hide();}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(d,"connectedCallback",this,3)([]),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(d,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}}],[{key:"styles",get:function get(){return[o];}}]);}(a));t([i({type:Boolean})],d.prototype,"range",void 0),t([i({type:Boolean})],d.prototype,"hideTypes",void 0),t([i({type:Boolean,reflect:!0})],d.prototype,"doubleClickUnselect",void 0),t([i({type:Boolean,reflect:!0})],d.prototype,"allowClear",void 0),t([i({type:Boolean})],d.prototype,"open",void 0),t([i({type:Boolean,attribute:"hide-time-zone"})],d.prototype,"hideTimeZone",void 0),t([i({type:String,reflect:!0})],d.prototype,"type",void 0),t([i({type:Boolean,attribute:"showManualInputs"})],d.prototype,"showManualInputs",void 0),t([i()],d.prototype,"value",void 0),t([i({type:Array,attribute:"hide-duration-fields"})],d.prototype,"hideDurationFields",void 0),t([i({attribute:"allowedDates"})],d.prototype,"allowedDates",void 0),t([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"syncDatePicker",void 0),t([i({type:String,attribute:!0,reflect:!0})],d.prototype,"dateFormat",void 0),t([i({type:String,attribute:!0,reflect:!0})],d.prototype,"rangeSeparator",void 0),t([i({type:Number,attribute:!0,reflect:!0})],d.prototype,"startYear",void 0),t([i({type:Number,attribute:!0,reflect:!0})],d.prototype,"endYear",void 0),t([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"showYearDropdown",void 0),t([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"showMonthDropdown",void 0),t([s("nile-dropdown")],d.prototype,"dropdown",void 0),_export("N",d=t([n("nile-date-picker")],d));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-date-picker.css.cjs.js","../internal/nile-element.cjs.js","./nile-date-picker-utils.cjs.js"],function(_export,_context){"use strict";var e,t,i,s,n,l,a,o,r,h,_templateObject,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;s=_litDecoratorsJs.query;n=_litDecoratorsJs.customElement;},function(_nileDatePickerCssCjsJs){l=_nileDatePickerCssCjsJs.s;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;},function(_nileDatePickerUtilsCjsJs){o=_nileDatePickerUtilsCjsJs.p;r=_nileDatePickerUtilsCjsJs.n;h=_nileDatePickerUtilsCjsJs.f;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_a){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.range=!1,_this.hideTypes=!1,_this.doubleClickUnselect=!1,_this.allowClear=!1,_this.open=!1,_this.hideTimeZone=!1,_this.type="absolute",_this.showManualInputs=!1,_this.hideDurationFields=[],_this.allowedDates="{}",_this.syncDatePicker=!1,_this.dateFormat="DD/MM/YYYY",_this.rangeSeparator=" - ";return _this;}_inherits(d,_a);return _createClass(d,[{key:"firstUpdated",value:function firstUpdated(){var _superPropGet2,_this2=this;if((_superPropGet2=_superPropGet(d,"firstUpdated",this,3))!==null&&_superPropGet2!==void 0&&_superPropGet2([new Map()]),!this.syncDatePicker)return;var e=this.querySelector("nile-input");e&&e.addEventListener("nile-input",function(e){var t=e.detail.value,_o=o(t,_this2.dateFormat,_this2.range,_this2.rangeSeparator),i=_o.first,s=_o.second;if(_this2.range){if(i&&!s&&(_this2.jumpTo(i),_this2.syncRangeCalendar(i,null)),i&&s){var _r=r(i,s),_r2=_slicedToArray(_r,2),_e=_r2[0],_t=_r2[1];_t&&_this2.jumpTo(_t),_this2.syncRangeCalendar(_e,_t);}}else i&&_this2.jumpTo(i);});}},{key:"jumpTo",value:function jumpTo(e){this.open=!0;var t=this.shadowRoot.querySelector("nile-calendar");t&&(t.currentYear=e.getFullYear(),t.currentMonth=e.getMonth(),t.value=e,t.valueAttribute=e.toISOString());}},{key:"syncRangeCalendar",value:function syncRangeCalendar(e,t){var i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(e&&(i.startDate=e),t&&(i.endDate=t));}},{key:"render",value:function render(){var _this3=this;return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-dropdown .open=\"","\" part=\"dd-base\" .hoist=\"","\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"","\"\n .type=\"","\"\n value=\"","\"\n .range=\"","\"\n @nile-init=\"","\"\n @nile-destroy=\"","\"\n @nile-changed=\"","\"\n\n @nile-change=\"","\"\n\n .allowedDates=\"","\"\n\n @nile-type-change=\"","\"\n @nile-clear=\"","\"\n .hideDurationFields=\"","\"\n .showManualInputs=\"","\"\n .doubleClickUnselect=\"","\"\n .allowClear=\"","\"\n ></nile-calendar>\n </nile-dropdown>\n "])),this.open,!0,this.hideTypes,this.type,this.value,this.range,function(e){return e.stopPropagation();},function(e){return e.stopPropagation();},function(e){return e.stopPropagation();},this.handleChanged,this.allowedDates,function(e){e.stopPropagation(),_this3.emit("nile-type-change",e.detail);},function(e){e.stopPropagation(),_this3.emit("nile-clear");},this.hideDurationFields,this.showManualInputs,this.doubleClickUnselect,this.allowClear);}},{key:"handleChanged",value:function handleChanged(e){e.stopPropagation();var t=e.detail,i=this.querySelector("nile-input");if(!this.range){var _this$dropdown;var _s=t.value;return _s&&i&&(i.value=h(new Date(_s),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),void((_this$dropdown=this.dropdown)===null||_this$dropdown===void 0?void 0:_this$dropdown.hide());}var s=t.startDate,n=t.endDate;if(i){var _e2="";s&&(_e2+=h(new Date(s),this.dateFormat)),s&&n&&(_e2+=" - "+h(new Date(n),this.dateFormat)),i.value=_e2,i.emit("nile-input",{value:_e2});}this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),this.dropdown&&this.dropdown.hide();}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(d,"connectedCallback",this,3)([]),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(d,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}}],[{key:"styles",get:function get(){return[l];}}]);}(a));e([i({type:Boolean})],d.prototype,"range",void 0),e([i({type:Boolean})],d.prototype,"hideTypes",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"doubleClickUnselect",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"allowClear",void 0),e([i({type:Boolean})],d.prototype,"open",void 0),e([i({type:Boolean,attribute:"hide-time-zone"})],d.prototype,"hideTimeZone",void 0),e([i({type:String,reflect:!0})],d.prototype,"type",void 0),e([i({type:Boolean,attribute:"showManualInputs"})],d.prototype,"showManualInputs",void 0),e([i()],d.prototype,"value",void 0),e([i({type:Array,attribute:"hide-duration-fields"})],d.prototype,"hideDurationFields",void 0),e([i({attribute:"allowedDates"})],d.prototype,"allowedDates",void 0),e([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"syncDatePicker",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"dateFormat",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"rangeSeparator",void 0),e([s("nile-dropdown")],d.prototype,"dropdown",void 0),_export("N",d=e([n("nile-date-picker")],d));}};});
2
2
  //# sourceMappingURL=nile-date-picker.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-date-picker.cjs.js","sources":["../../../src/nile-date-picker/nile-date-picker.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { \n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport NileElement from '../internal/nile-element';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n\nimport {\n parseDateFromFormat,\n formatDateToFormat,\n parseRangeFromFormat,\n normalizeDateRange\n} from './nile-date-picker-utils';\n\n\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean }) range = false;\n\n @property({ type: Boolean }) hideTypes = false;\n\n @property({ type: Boolean, reflect: true }) doubleClickUnselect = false;\n\n @property({ type: Boolean, reflect: true }) allowClear = false;\n\n @property({ type: Boolean }) open = false;\n\n @property({ type: Boolean, attribute: 'hide-time-zone' }) hideTimeZone = false;\n\n @property({ type: String, reflect: true }) type: 'absolute' | 'relative' = 'absolute';\n\n @property({ type: Boolean, attribute: 'showManualInputs' }) \n showManualInputs = false;\n\n @property() value: any;\n\n @property({ type: Array, attribute: 'hide-duration-fields' }) \n hideDurationFields: any = [];\n\n @property({ attribute: 'allowedDates' }) allowedDates: any = '{}';\n\n @property({ type: Boolean, attribute: true, reflect: true }) syncDatePicker = false;\n\n @property({ type: String, attribute: true, reflect: true }) dateFormat = \"DD/MM/YYYY\"; \n\n @property({ type: String, attribute: true, reflect: true }) rangeSeparator = \" - \";\n\n @property({ type: Number, attribute: true, reflect: true }) startYear: number;\n\n @property({ type: Number, attribute: true, reflect: true }) endYear: number;\n\n @property({ type: Boolean, attribute: true, reflect: true }) showYearDropdown = false;\n\n @property({ type: Boolean, attribute: true, reflect: true }) showMonthDropdown = false;\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n /**\n * Render method\n * @slot This is a slot test\n */\n firstUpdated() {\n super.firstUpdated?.(new Map());\n\n if (!this.syncDatePicker) return;\n\n const input = this.querySelector(\"nile-input\");\n if (!input) return;\n\n input.addEventListener(\"nile-input\", (e: any) => {\n const text = e.detail.value;\n const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range, this.rangeSeparator);\n\n if (!this.range) {\n if (first) this.jumpTo(first);\n return;\n }\n\n if (first && !second) {\n this.jumpTo(first);\n this.syncRangeCalendar(first, null);\n }\n\n if (first && second) {\n const [start, end] = normalizeDateRange(first, second);\n if (end) this.jumpTo(end);\n this.syncRangeCalendar(start, end);\n }\n });\n }\n\n private jumpTo(date: Date) {\n this.open = true;\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n cal.currentYear = date.getFullYear();\n cal.currentMonth = date.getMonth();\n cal.value = date;\n cal.valueAttribute = date.toISOString();\n }\n\n\n private syncRangeCalendar(first: Date | null, second: Date | null) {\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n if (!this.range) return;\n\n if (first) cal.startDate = first;\n if (second) cal.endDate = second;\n }\n\n render(): TemplateResult {\n return html`\n <nile-dropdown .open=\"${this.open}\" part=\"dd-base\" .hoist=\"${true}\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"${this.hideTypes}\"\n .type=\"${this.type}\"\n value=\"${this.value}\"\n .range=\"${this.range}\"\n @nile-init=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-destroy=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-changed=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n\n @nile-change=\"${this.handleChanged}\"\n\n .allowedDates=\"${this.allowedDates}\"\n\n @nile-type-change=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-type-change',e.detail)}}\"\n @nile-clear=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-clear')}}\"\n .hideDurationFields=\"${this.hideDurationFields}\"\n .showManualInputs=\"${this.showManualInputs}\"\n .doubleClickUnselect=\"${this.doubleClickUnselect}\"\n .allowClear=\"${this.allowClear}\"\n .startYear=\"${this.startYear}\"\n .endYear=\"${this.endYear}\"\n ?showYearDropdown=\"${this.showYearDropdown}\"\n ?showMonthDropdown=\"${this.showMonthDropdown}\"\n ></nile-calendar>\n </nile-dropdown>\n `;\n }\n\n\n handleChanged(event: CustomEvent) {\n event.stopPropagation();\n\n const detail = event.detail;\n const triggerInput = this.querySelector(\"nile-input\");\n\n if (!this.range) {\n const picked = detail.value;\n\n if (picked && triggerInput) {\n triggerInput.value = formatDateToFormat(new Date(picked), this.dateFormat);\n triggerInput.emit(\"nile-input\", { value: triggerInput.value });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n this.dropdown?.hide();\n return;\n }\n\n const start = detail.startDate;\n const end = detail.endDate;\n\n if (triggerInput) {\n let text = \"\";\n if (start) text += formatDateToFormat(new Date(start), this.dateFormat);\n if (start && end) text += \" - \" + formatDateToFormat(new Date(end), this.dateFormat);\n\n triggerInput.value = text;\n triggerInput.emit(\"nile-input\", { value: text });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"],"names":["NileDatePicker","d","constructor","this","range","hideTypes","doubleClickUnselect","allowClear","open","hideTimeZone","type","showManualInputs","hideDurationFields","allowedDates","syncDatePicker","dateFormat","rangeSeparator","showYearDropdown","showMonthDropdown","_this","_inherits","_a","_createClass","key","value","firstUpdated","_superPropGet2","_this2","super","Map","input","querySelector","addEventListener","e","text","detail","first","parseRangeFromFormat","second","jumpTo","syncRangeCalendar","_l","normalizeDateRange","start","end","date","cal","shadowRoot","currentYear","getFullYear","currentMonth","getMonth","valueAttribute","toISOString","startDate","endDate","render","_this3","html","_templateObject","_taggedTemplateLiteral","stopPropagation","handleChanged","emit","startYear","endYear","event","triggerInput","_this$dropdown","picked","formatDateToFormat","Date","dropdown","hide","connectedCallback","disconnectedCallback","__decorate","get","styles","NileElement","property","Boolean","prototype","reflect","attribute","String","Array","Number","query","customElement"],"mappings":"ukKAkCaA,4BAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCASwBC,KAAAA,CAAKC,KAAG,CAAA,CAAA,CAAA,CAERD,KAAAA,CAASE,SAAG,CAAA,CAAA,CAAA,CAEGF,KAAAA,CAAmBG,mBAAG,CAAA,CAAA,CAAA,CAEtBH,KAAAA,CAAUI,UAAAA,CAAAA,CAAG,CAE5BJ,CAAAA,KAAAA,CAAIK,MAAG,CAEsBL,CAAAA,KAAAA,CAAYM,cAAG,CAE9BN,CAAAA,KAAAA,CAAIO,KAA4B,UAG3EP,CAAAA,KAAAA,CAAgBQ,gBAAG,CAAA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aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { \n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport NileElement from '../internal/nile-element';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n\nimport {\n parseDateFromFormat,\n formatDateToFormat,\n parseRangeFromFormat,\n normalizeDateRange\n} from './nile-date-picker-utils';\n\n\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean }) range = false;\n\n @property({ type: Boolean }) hideTypes = false;\n\n @property({ type: Boolean, reflect: true }) doubleClickUnselect = false;\n\n @property({ type: Boolean, reflect: true }) allowClear = false;\n\n @property({ type: Boolean }) open = false;\n\n @property({ type: Boolean, attribute: 'hide-time-zone' }) hideTimeZone = false;\n\n @property({ type: String, reflect: true }) type: 'absolute' | 'relative' = 'absolute';\n\n @property({ type: Boolean, attribute: 'showManualInputs' }) \n showManualInputs = false;\n\n @property() value: any;\n\n @property({ type: Array, attribute: 'hide-duration-fields' }) \n hideDurationFields: any = [];\n\n @property({ attribute: 'allowedDates' }) allowedDates: any = '{}';\n\n @property({ type: Boolean, attribute: true, reflect: true }) syncDatePicker = false;\n\n @property({ type: String, attribute: true, reflect: true }) dateFormat = \"DD/MM/YYYY\"; \n\n @property({ type: String, attribute: true, reflect: true }) rangeSeparator = \" - \";\n\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n /**\n * Render method\n * @slot This is a slot test\n */\n firstUpdated() {\n super.firstUpdated?.(new Map());\n\n if (!this.syncDatePicker) return;\n\n const input = this.querySelector(\"nile-input\");\n if (!input) return;\n\n input.addEventListener(\"nile-input\", (e: any) => {\n const text = e.detail.value;\n const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range, this.rangeSeparator);\n\n if (!this.range) {\n if (first) this.jumpTo(first);\n return;\n }\n\n if (first && !second) {\n this.jumpTo(first);\n this.syncRangeCalendar(first, null);\n }\n\n if (first && second) {\n const [start, end] = normalizeDateRange(first, second);\n if (end) this.jumpTo(end);\n this.syncRangeCalendar(start, end);\n }\n });\n }\n\n private jumpTo(date: Date) {\n this.open = true;\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n cal.currentYear = date.getFullYear();\n cal.currentMonth = date.getMonth();\n cal.value = date;\n cal.valueAttribute = date.toISOString();\n }\n\n\n private syncRangeCalendar(first: Date | null, second: Date | null) {\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n if (!this.range) return;\n\n if (first) cal.startDate = first;\n if (second) cal.endDate = second;\n }\n\n render(): TemplateResult {\n return html`\n <nile-dropdown .open=\"${this.open}\" part=\"dd-base\" .hoist=\"${true}\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"${this.hideTypes}\"\n .type=\"${this.type}\"\n value=\"${this.value}\"\n .range=\"${this.range}\"\n @nile-init=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-destroy=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-changed=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n\n @nile-change=\"${this.handleChanged}\"\n\n .allowedDates=\"${this.allowedDates}\"\n\n @nile-type-change=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-type-change',e.detail)}}\"\n @nile-clear=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-clear')}}\"\n .hideDurationFields=\"${this.hideDurationFields}\"\n .showManualInputs=\"${this.showManualInputs}\"\n .doubleClickUnselect=\"${this.doubleClickUnselect}\"\n .allowClear=\"${this.allowClear}\"\n ></nile-calendar>\n </nile-dropdown>\n `;\n }\n\n\n handleChanged(event: CustomEvent) {\n event.stopPropagation();\n\n const detail = event.detail;\n const triggerInput = this.querySelector(\"nile-input\");\n\n if (!this.range) {\n const picked = detail.value;\n\n if (picked && triggerInput) {\n triggerInput.value = formatDateToFormat(new Date(picked), this.dateFormat);\n triggerInput.emit(\"nile-input\", { value: triggerInput.value });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n this.dropdown?.hide();\n return;\n }\n\n const start = detail.startDate;\n const end = detail.endDate;\n\n if (triggerInput) {\n let text = \"\";\n if (start) text += formatDateToFormat(new Date(start), this.dateFormat);\n if (start && end) text += \" - \" + formatDateToFormat(new Date(end), this.dateFormat);\n\n triggerInput.value = text;\n triggerInput.emit(\"nile-input\", { value: text });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"],"names":["NileDatePicker","d","constructor","this","range","hideTypes","doubleClickUnselect","allowClear","open","hideTimeZone","type","showManualInputs","hideDurationFields","allowedDates","syncDatePicker","dateFormat","rangeSeparator","_this","_inherits","_a","_createClass","key","value","firstUpdated","super","Map","input","querySelector","addEventListener","e","text","detail","parseRangeFromFormat","first","second","jumpTo","syncRangeCalendar","_r","normalizeDateRange","end","start","date","cal","shadowRoot","currentYear","getFullYear","currentMonth","getMonth","valueAttribute","toISOString","startDate","endDate","render","_this3","html","_templateObject","_taggedTemplateLiteral","stopPropagation","handleChanged","emit","event","triggerInput","_this$dropdown","picked","formatDateToFormat","Date","dropdown","hide","connectedCallback","disconnectedCallback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AEYH,CAAA,CAAA,CAAxCC,EAAS,CAAEI,SAAAA,CAAW,cAA2C9E,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4E,UAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAELH,CAAA,CAAA,CAA5DC,CAAS,CAAA,CAAEhE,IAAMiE,CAAAA,OAAAA,CAASG,WAAW,CAAMD,CAAAA,OAAAA,CAAAA,CAAS,CAA+B7E,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4E,UAAA,gBAAA,CAAA,IAAA,EAAA,CAAA,CAExBH,CAAA,CAAA,CAA3DC,EAAS,CAAEhE,IAAAA,CAAMqE,MAAQD,CAAAA,SAAAA,CAAAA,CAAW,CAAMD,CAAAA,OAAAA,CAAAA,CAAS,CAAkC7E,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4E,UAAA,YAAA,CAAA,IAAA,EAAA,CAAA,CAE1BH,CAAA,CAAA,CAA3DC,EAAS,CAAEhE,IAAAA,CAAMqE,MAAQD,CAAAA,SAAAA,CAAAA,CAAW,EAAMD,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B7E,CAAA4E,CAAAA,SAAAA,CAAA,gBAAA,CAAA,IAAA,EAAA,CAAA,CAG3DH,CAAA,CAAA,CAAvBQ,EAAM,eAAwCjF,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4E,SAAA,CAAA,UAAA,CAAA,IAAA,gBAxCpC5E,CAAcyE,CAAAA,CAAAA,CAAA,CAD1BS,CAAAA,CAAc,qBACFlF"}
@@ -1,4 +1,4 @@
1
- import{__decorate as e}from"tslib";import{html as t}from"lit";import{property as i,query as s,customElement as n}from"lit/decorators.js";import{s as o}from"./nile-date-picker.css.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{p as r,n as l,f as h}from"./nile-date-picker-utils.esm.js";let d=class extends a{constructor(){super(...arguments),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.open=!1,this.hideTimeZone=!1,this.type="absolute",this.showManualInputs=!1,this.hideDurationFields=[],this.allowedDates="{}",this.syncDatePicker=!1,this.dateFormat="DD/MM/YYYY",this.rangeSeparator=" - ",this.showYearDropdown=!1,this.showMonthDropdown=!1}static get styles(){return[o]}firstUpdated(){if(super.firstUpdated?.(new Map),!this.syncDatePicker)return;const e=this.querySelector("nile-input");e&&e.addEventListener("nile-input",(e=>{const t=e.detail.value,{first:i,second:s}=r(t,this.dateFormat,this.range,this.rangeSeparator);if(this.range){if(i&&!s&&(this.jumpTo(i),this.syncRangeCalendar(i,null)),i&&s){const[e,t]=l(i,s);t&&this.jumpTo(t),this.syncRangeCalendar(e,t)}}else i&&this.jumpTo(i)}))}jumpTo(e){this.open=!0;const t=this.shadowRoot.querySelector("nile-calendar");t&&(t.currentYear=e.getFullYear(),t.currentMonth=e.getMonth(),t.value=e,t.valueAttribute=e.toISOString())}syncRangeCalendar(e,t){const i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(e&&(i.startDate=e),t&&(i.endDate=t))}render(){return t`
1
+ import{__decorate as e}from"tslib";import{html as t}from"lit";import{property as i,query as s,customElement as n}from"lit/decorators.js";import{s as l}from"./nile-date-picker.css.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{p as o,n as r,f as h}from"./nile-date-picker-utils.esm.js";let d=class extends a{constructor(){super(...arguments),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.open=!1,this.hideTimeZone=!1,this.type="absolute",this.showManualInputs=!1,this.hideDurationFields=[],this.allowedDates="{}",this.syncDatePicker=!1,this.dateFormat="DD/MM/YYYY",this.rangeSeparator=" - "}static get styles(){return[l]}firstUpdated(){if(super.firstUpdated?.(new Map),!this.syncDatePicker)return;const e=this.querySelector("nile-input");e&&e.addEventListener("nile-input",(e=>{const t=e.detail.value,{first:i,second:s}=o(t,this.dateFormat,this.range,this.rangeSeparator);if(this.range){if(i&&!s&&(this.jumpTo(i),this.syncRangeCalendar(i,null)),i&&s){const[e,t]=r(i,s);t&&this.jumpTo(t),this.syncRangeCalendar(e,t)}}else i&&this.jumpTo(i)}))}jumpTo(e){this.open=!0;const t=this.shadowRoot.querySelector("nile-calendar");t&&(t.currentYear=e.getFullYear(),t.currentMonth=e.getMonth(),t.value=e,t.valueAttribute=e.toISOString())}syncRangeCalendar(e,t){const i=this.shadowRoot.querySelector("nile-calendar");i&&this.range&&(e&&(i.startDate=e),t&&(i.endDate=t))}render(){return t`
2
2
  <nile-dropdown .open="${this.open}" part="dd-base" .hoist="${!0}" distance="6" exportparts="base">
3
3
  <slot slot="trigger" part="trigger" name="trigger"></slot>
4
4
 
@@ -21,10 +21,6 @@ import{__decorate as e}from"tslib";import{html as t}from"lit";import{property as
21
21
  .showManualInputs="${this.showManualInputs}"
22
22
  .doubleClickUnselect="${this.doubleClickUnselect}"
23
23
  .allowClear="${this.allowClear}"
24
- .startYear="${this.startYear}"
25
- .endYear="${this.endYear}"
26
- ?showYearDropdown="${this.showYearDropdown}"
27
- ?showMonthDropdown="${this.showMonthDropdown}"
28
24
  ></nile-calendar>
29
25
  </nile-dropdown>
30
- `}handleChanged(e){e.stopPropagation();const t=e.detail,i=this.querySelector("nile-input");if(!this.range){const s=t.value;return s&&i&&(i.value=h(new Date(s),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),void this.dropdown?.hide()}const s=t.startDate,n=t.endDate;if(i){let e="";s&&(e+=h(new Date(s),this.dateFormat)),s&&n&&(e+=" - "+h(new Date(n),this.dateFormat)),i.value=e,i.emit("nile-input",{value:e})}this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),this.dropdown&&this.dropdown.hide()}connectedCallback(){super.connectedCallback(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}};e([i({type:Boolean})],d.prototype,"range",void 0),e([i({type:Boolean})],d.prototype,"hideTypes",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"doubleClickUnselect",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"allowClear",void 0),e([i({type:Boolean})],d.prototype,"open",void 0),e([i({type:Boolean,attribute:"hide-time-zone"})],d.prototype,"hideTimeZone",void 0),e([i({type:String,reflect:!0})],d.prototype,"type",void 0),e([i({type:Boolean,attribute:"showManualInputs"})],d.prototype,"showManualInputs",void 0),e([i()],d.prototype,"value",void 0),e([i({type:Array,attribute:"hide-duration-fields"})],d.prototype,"hideDurationFields",void 0),e([i({attribute:"allowedDates"})],d.prototype,"allowedDates",void 0),e([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"syncDatePicker",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"dateFormat",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"rangeSeparator",void 0),e([i({type:Number,attribute:!0,reflect:!0})],d.prototype,"startYear",void 0),e([i({type:Number,attribute:!0,reflect:!0})],d.prototype,"endYear",void 0),e([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"showYearDropdown",void 0),e([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"showMonthDropdown",void 0),e([s("nile-dropdown")],d.prototype,"dropdown",void 0),d=e([n("nile-date-picker")],d);export{d as N};
26
+ `}handleChanged(e){e.stopPropagation();const t=e.detail,i=this.querySelector("nile-input");if(!this.range){const s=t.value;return s&&i&&(i.value=h(new Date(s),this.dateFormat),i.emit("nile-input",{value:i.value})),this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),void this.dropdown?.hide()}const s=t.startDate,n=t.endDate;if(i){let e="";s&&(e+=h(new Date(s),this.dateFormat)),s&&n&&(e+=" - "+h(new Date(n),this.dateFormat)),i.value=e,i.emit("nile-input",{value:e})}this.emit("nile-changed",e.detail),this.emit("nile-change",e.detail),this.dropdown&&this.dropdown.hide()}connectedCallback(){super.connectedCallback(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}};e([i({type:Boolean})],d.prototype,"range",void 0),e([i({type:Boolean})],d.prototype,"hideTypes",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"doubleClickUnselect",void 0),e([i({type:Boolean,reflect:!0})],d.prototype,"allowClear",void 0),e([i({type:Boolean})],d.prototype,"open",void 0),e([i({type:Boolean,attribute:"hide-time-zone"})],d.prototype,"hideTimeZone",void 0),e([i({type:String,reflect:!0})],d.prototype,"type",void 0),e([i({type:Boolean,attribute:"showManualInputs"})],d.prototype,"showManualInputs",void 0),e([i()],d.prototype,"value",void 0),e([i({type:Array,attribute:"hide-duration-fields"})],d.prototype,"hideDurationFields",void 0),e([i({attribute:"allowedDates"})],d.prototype,"allowedDates",void 0),e([i({type:Boolean,attribute:!0,reflect:!0})],d.prototype,"syncDatePicker",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"dateFormat",void 0),e([i({type:String,attribute:!0,reflect:!0})],d.prototype,"rangeSeparator",void 0),e([s("nile-dropdown")],d.prototype,"dropdown",void 0),d=e([n("nile-date-picker")],d);export{d as N};
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","./nile-slide-toggle.css.cjs.js","../internal/nile-element.cjs.js","lit/directives/class-map.js","lit/decorators.js"],function(_export,_context){"use strict";var e,t,i,s,l,o,r,_templateObject,_templateObject2,_templateObject3,h;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_nileSlideToggleCssCjsJs){i=_nileSlideToggleCssCjsJs.s;},function(_internalNileElementCjsJs){s=_internalNileElementCjsJs.N;},function(_litDirectivesClassMapJs){l=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){o=_litDecoratorsJs.property;r=_litDecoratorsJs.customElement;}],execute:function execute(){_export("N",h=/*#__PURE__*/function(_s){function h(){var _this;_classCallCheck(this,h);_this=_callSuper(this,h,arguments),_this.label="",_this.sublabel="",_this.textPosition="right",_this.isChecked=!1,_this.fullWidth=!1,_this.disabled=!1,_this.helpText="",_this.errorMessage="";return _this;}_inherits(h,_s);return _createClass(h,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(h,"connectedCallback",this,3)([]),this.emit("nile-init"),this.style.setProperty("--slide-toggle-width",this.fullWidth?"100%":"auto");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(h,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"toggleValue",value:function toggleValue(){this.isChecked=!this.isChecked,this.emit("change",{checked:this.isChecked,value:this.isChecked}),this.emit("nile-change",{checked:this.isChecked,value:this.isChecked});}},{key:"render",value:function render(){var e=!!this.helpText,i=!!this.errorMessage;return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n class=","\n >\n <label \n class=\"","\"\n class=\"nile-slide-toggle__switch\">\n <input\n type=\"checkbox\"\n .checked=","\n @change=","\n />\n <span class=\"nile-slide-toggle__slider\"></span>\n </label>\n <span class=\"nile-slide-toggle__label\">\n <span>","</span>\n <span class=\"nile-slide-toggle__sublabel\">","</span>\n </span>\n </div>\n ","\n ","\n "])),l({"nile-slide-toggle":!0,"nile-slide--disabled":this.disabled,"nile-slide-toggle--reverse":"left"==this.textPosition}),l({"nile-slide-toggle__switch":!0,"nile-slide-toggle__switch--left":"right"==this.textPosition,"nile-slide-toggle__switch--right":"left"==this.textPosition}),this.isChecked,this.toggleValue,this.label,this.sublabel,e?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",i?t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}}]);}(s));h.styles=i,e([o({type:String})],h.prototype,"label",void 0),e([o({type:String})],h.prototype,"sublabel",void 0),e([o({type:String})],h.prototype,"textPosition",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"isChecked",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"fullWidth",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0),e([o({attribute:"help-text",reflect:!0})],h.prototype,"helpText",void 0),e([o({attribute:"error-message",reflect:!0})],h.prototype,"errorMessage",void 0),_export("N",h=e([r("nile-slide-toggle")],h));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","./nile-slide-toggle.css.cjs.js","../internal/nile-element.cjs.js","lit/directives/class-map.js","lit/decorators.js"],function(_export,_context){"use strict";var e,t,s,i,l,r,o,_templateObject,_templateObject2,_templateObject3,a;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_nileSlideToggleCssCjsJs){s=_nileSlideToggleCssCjsJs.s;},function(_internalNileElementCjsJs){i=_internalNileElementCjsJs.N;},function(_litDirectivesClassMapJs){l=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){r=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;}],execute:function execute(){_export("N",a=/*#__PURE__*/function(_i){function a(){var _this;_classCallCheck(this,a);_this=_callSuper(this,a,arguments),_this.label="",_this.sublabel="",_this.textPosition="right",_this.isChecked=!1,_this.fullWidth=!1,_this.disabled=!1,_this.helpText="",_this.errorMessage="";return _this;}_inherits(a,_i);return _createClass(a,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(a,"connectedCallback",this,3)([]),this.emit("nile-init"),this.style.setProperty("--slide-toggle-width",this.fullWidth?"100%":"auto");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(a,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"toggleValue",value:function toggleValue(){this.isChecked=!this.isChecked,this.emit("change",{checked:this.isChecked,value:this.isChecked}),this.emit("nile-change",{checked:this.isChecked,value:this.isChecked});}},{key:"render",value:function render(){var e=!!this.helpText,s=!!this.errorMessage;return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n class=","\n part=\"base\"\n >\n <label \n class=\"","\"\n class=\"nile-slide-toggle__switch\" part=\"slide-toggle-switch\">\n <input\n type=\"checkbox\"\n .checked=","\n @change=","\n />\n <span class=\"nile-slide-toggle__slider\" part=\"slide-toggle-slider\"></span>\n </label>\n <span class=\"nile-slide-toggle__label\" part=\"slide-toggle-label-container\">\n <span part=\"slide-toggle-label\">","</span>\n <span class=\"nile-slide-toggle__sublabel\" part=\"slide-toggle-sublabel\">","</span>\n </span>\n </div>\n ","\n ","\n "])),l({"nile-slide-toggle":!0,"nile-slide--disabled":this.disabled,"nile-slide-toggle--reverse":"left"==this.textPosition}),l({"nile-slide-toggle__switch":!0,"nile-slide-toggle__switch--left":"right"==this.textPosition,"nile-slide-toggle__switch--right":"left"==this.textPosition}),this.isChecked,this.toggleValue,this.label,this.sublabel,e?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",s?t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}}]);}(i));a.styles=s,e([r({type:String})],a.prototype,"label",void 0),e([r({type:String})],a.prototype,"sublabel",void 0),e([r({type:String})],a.prototype,"textPosition",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"isChecked",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"fullWidth",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),e([r({attribute:"help-text",reflect:!0})],a.prototype,"helpText",void 0),e([r({attribute:"error-message",reflect:!0})],a.prototype,"errorMessage",void 0),_export("N",a=e([o("nile-slide-toggle")],a));}};});
2
2
  //# sourceMappingURL=nile-slide-toggle.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-slide-toggle.cjs.js","sources":["../../../src/nile-slide-toggle/nile-slide-toggle.ts"],"sourcesContent":["import { CSSResultGroup,PropertyValues } from 'lit';\nimport { LitElement, html} from 'lit';\nimport styles from './nile-slide-toggle.css';\nimport NileElement from '../internal/nile-element';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('nile-slide-toggle')\nexport class NileSlideToggle extends NileElement {\n public static styles: CSSResultGroup = styles;\n\n @property({ type: String }) label = '';\n\n @property({ type: String }) sublabel = '';\n\n @property({ type: String, }) textPosition:'left' | 'right' = 'right';\n\n @property({ type: Boolean, reflect: true }) isChecked = false;\n\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n this.style.setProperty('--slide-toggle-width',this.fullWidth?'100%':'auto')\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n toggleValue() {\n this.isChecked = !this.isChecked;\n this.emit('change',{ checked: this.isChecked, value: this.isChecked });\n this.emit('nile-change',{ checked: this.isChecked, value: this.isChecked });\n }\n\n public render() {\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n class=${classMap({\n 'nile-slide-toggle': true,\n 'nile-slide--disabled': this.disabled,\n 'nile-slide-toggle--reverse':this.textPosition=='left'\n })}\n >\n <label \n class=\"${classMap({\n 'nile-slide-toggle__switch':true,\n 'nile-slide-toggle__switch--left':this.textPosition=='right',\n 'nile-slide-toggle__switch--right':this.textPosition=='left',\n })}\"\n class=\"nile-slide-toggle__switch\">\n <input\n type=\"checkbox\"\n .checked=${this.isChecked}\n @change=${this.toggleValue}\n />\n <span class=\"nile-slide-toggle__slider\"></span>\n </label>\n <span class=\"nile-slide-toggle__label\">\n <span>${this.label}</span>\n <span class=\"nile-slide-toggle__sublabel\">${this.sublabel}</span>\n </span>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n `;\n }\n}\n"],"names":["NileSlideToggle","h","constructor","this","label","sublabel","textPosition","isChecked","fullWidth","disabled","helpText","errorMessage","_this","_inherits","_s","_createClass","key","value","connectedCallback","super","emit","style","setProperty","disconnectedCallback","toggleValue","checked","render","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","_templateObject2","_templateObject3","NileElement","styles","__decorate","property","type","String","prototype","Boolean","reflect","attribute","_export","customElement"],"mappings":"myHAQaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAGuBC,EAAAA,KAAAA,CAAKC,KAAG,CAAA,EAAA,CAERD,KAAAA,CAAQE,QAAAA,CAAG,GAEVF,KAAAA,CAAYG,YAAAA,CAAoB,OAEjBH,CAAAA,KAAAA,CAASI,SAAG,CAAA,CAAA,CAAA,CAEZJ,KAAAA,CAASK,SAAG,CAAA,CAAA,CAAA,CAEZL,KAAAA,CAAQM,QAAAA,CAAAA,CAAG,CAEFN,CAAAA,KAAAA,CAAQO,SAAG,EAEPP,CAAAA,KAAAA,CAAYQ,YAAG,CAAA,EA8DzE,QAAAC,KAAA,EA5DCC,SAAA,CAAAZ,CAAA,CAAAa,EAAA,SAAAC,YAAA,CAAAd,CAAA,GAAAe,GAAA,qBAAAC,KAAA,UAAAC,iBAAAA,CAAAA,EACEC,aAAAA,CAAAA,CAAAA,iCACAhB,IAAKiB,CAAAA,IAAAA,CAAK,WACVjB,CAAAA,CAAAA,IAAAA,CAAKkB,MAAMC,WAAY,CAAA,sBAAA,CAAuBnB,KAAKK,SAAU,CAAA,MAAA,CAAO,OACrE,EAED,GAAAQ,GAAA,wBAAAC,KAAA,UAAAM,oBAAAA,CAAAA,CACEJ,CAAAA,aAAAA,CAAAA,CAAAA,oCACAhB,IAAAA,CAAKiB,KAAK,cACX,CAAA,EAED,GAAAJ,GAAA,eAAAC,KAAA,UAAAO,WAAAA,CAAAA,CAAAA,CACErB,IAAKI,CAAAA,SAAAA,CAAAA,CAAaJ,KAAKI,SACv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AAA,CAAAyC,UAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAAAI,OAAA,KAjBhE7C,EAAeqC,CAAA,CAAA,CAD3BS,CAAc,CAAA,mBAAA,CAAA,CAAA,CACF9C"}
1
+ {"version":3,"file":"nile-slide-toggle.cjs.js","sources":["../../../src/nile-slide-toggle/nile-slide-toggle.ts"],"sourcesContent":["import { CSSResultGroup,PropertyValues } from 'lit';\nimport { LitElement, html} from 'lit';\nimport styles from './nile-slide-toggle.css';\nimport NileElement from '../internal/nile-element';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('nile-slide-toggle')\nexport class NileSlideToggle extends NileElement {\n public static styles: CSSResultGroup = styles;\n\n @property({ type: String }) label = '';\n\n @property({ type: String }) sublabel = '';\n\n @property({ type: String, }) textPosition:'left' | 'right' = 'right';\n\n @property({ type: Boolean, reflect: true }) isChecked = false;\n\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n this.style.setProperty('--slide-toggle-width',this.fullWidth?'100%':'auto')\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n toggleValue() {\n this.isChecked = !this.isChecked;\n this.emit('change',{ checked: this.isChecked, value: this.isChecked });\n this.emit('nile-change',{ checked: this.isChecked, value: this.isChecked });\n }\n\n public render() {\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n class=${classMap({\n 'nile-slide-toggle': true,\n 'nile-slide--disabled': this.disabled,\n 'nile-slide-toggle--reverse':this.textPosition=='left'\n })}\n part=\"base\"\n >\n <label \n class=\"${classMap({\n 'nile-slide-toggle__switch':true,\n 'nile-slide-toggle__switch--left':this.textPosition=='right',\n 'nile-slide-toggle__switch--right':this.textPosition=='left',\n })}\"\n class=\"nile-slide-toggle__switch\" part=\"slide-toggle-switch\">\n <input\n type=\"checkbox\"\n .checked=${this.isChecked}\n @change=${this.toggleValue}\n />\n <span class=\"nile-slide-toggle__slider\" part=\"slide-toggle-slider\"></span>\n </label>\n <span class=\"nile-slide-toggle__label\" part=\"slide-toggle-label-container\">\n <span part=\"slide-toggle-label\">${this.label}</span>\n <span class=\"nile-slide-toggle__sublabel\" part=\"slide-toggle-sublabel\">${this.sublabel}</span>\n </span>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n `;\n }\n}\n"],"names":["NileSlideToggle","a","constructor","this","label","sublabel","textPosition","isChecked","fullWidth","disabled","helpText","errorMessage","_this","_inherits","_i","_createClass","key","value","connectedCallback","super","emit","style","setProperty","disconnectedCallback","toggleValue","checked","render","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","_templateObject2","_templateObject3","NileElement","styles","__decorate","property","type","String","prototype","Boolean","reflect","attribute","_export","customElement"],"mappings":"myHAQaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAGuBC,EAAAA,KAAAA,CAAKC,KAAG,CAAA,EAAA,CAERD,KAAAA,CAAQE,QAAAA,CAAG,GAEVF,KAAAA,CAAYG,YAAAA,CAAoB,OAEjBH,CAAAA,KAAAA,CAASI,SAAG,CAAA,CAAA,CAAA,CAEZJ,KAAAA,CAASK,SAAG,CAAA,CAAA,CAAA,CAEZL,KAAAA,CAAQM,QAAAA,CAAAA,CAAG,CAEFN,CAAAA,KAAAA,CAAQO,SAAG,EAEPP,CAAAA,KAAAA,CAAYQ,YAAG,CAAA,EA+DzE,QAAAC,KAAA,EA7D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,CAAEC,KAAMG,OAASC,CAAAA,OAAAA,CAAAA,CAAS,KAA0B3C,CAAAyC,CAAAA,SAAAA,CAAA,gBAAA,EAElBJ,CAAAA,CAAAA,CAAAA,CAAA,CAA3CC,CAAS,CAAA,CAAEC,KAAMG,OAASC,CAAAA,OAAAA,CAAAA,CAAS,KAAyB3C,CAAAyC,CAAAA,SAAAA,CAAA,eAAA,EAERJ,CAAAA,CAAAA,CAAAA,CAAA,CAApDC,CAAAA,CAAS,CAAEM,SAAAA,CAAW,YAAaD,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB3C,EAAAyC,SAAA,CAAA,UAAA,CAAA,IAAA,IAEVJ,CAAA,CAAA,CAAxDC,CAAS,CAAA,CAAEM,SAAW,CAAA,eAAA,CAAiBD,SAAS,CAA0B3C,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAyC,UAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAAAI,OAAA,KAjBhE7C,EAAeqC,CAAA,CAAA,CAD3BS,CAAc,CAAA,mBAAA,CAAA,CAAA,CACF9C"}
@@ -1,26 +1,27 @@
1
- import{__decorate as e}from"tslib";import{html as t}from"lit";import{s as i}from"./nile-slide-toggle.css.esm.js";import{N as s}from"../internal/nile-element.esm.js";import{classMap as l}from"lit/directives/class-map.js";import{property as o,customElement as r}from"lit/decorators.js";let h=class extends s{constructor(){super(...arguments),this.label="",this.sublabel="",this.textPosition="right",this.isChecked=!1,this.fullWidth=!1,this.disabled=!1,this.helpText="",this.errorMessage=""}connectedCallback(){super.connectedCallback(),this.emit("nile-init"),this.style.setProperty("--slide-toggle-width",this.fullWidth?"100%":"auto")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}toggleValue(){this.isChecked=!this.isChecked,this.emit("change",{checked:this.isChecked,value:this.isChecked}),this.emit("nile-change",{checked:this.isChecked,value:this.isChecked})}render(){const e=!!this.helpText,i=!!this.errorMessage;return t`
1
+ import{__decorate as e}from"tslib";import{html as t}from"lit";import{s}from"./nile-slide-toggle.css.esm.js";import{N as i}from"../internal/nile-element.esm.js";import{classMap as l}from"lit/directives/class-map.js";import{property as r,customElement as o}from"lit/decorators.js";let a=class extends i{constructor(){super(...arguments),this.label="",this.sublabel="",this.textPosition="right",this.isChecked=!1,this.fullWidth=!1,this.disabled=!1,this.helpText="",this.errorMessage=""}connectedCallback(){super.connectedCallback(),this.emit("nile-init"),this.style.setProperty("--slide-toggle-width",this.fullWidth?"100%":"auto")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}toggleValue(){this.isChecked=!this.isChecked,this.emit("change",{checked:this.isChecked,value:this.isChecked}),this.emit("nile-change",{checked:this.isChecked,value:this.isChecked})}render(){const e=!!this.helpText,s=!!this.errorMessage;return t`
2
2
  <div
3
3
  class=${l({"nile-slide-toggle":!0,"nile-slide--disabled":this.disabled,"nile-slide-toggle--reverse":"left"==this.textPosition})}
4
+ part="base"
4
5
  >
5
6
  <label
6
7
  class="${l({"nile-slide-toggle__switch":!0,"nile-slide-toggle__switch--left":"right"==this.textPosition,"nile-slide-toggle__switch--right":"left"==this.textPosition})}"
7
- class="nile-slide-toggle__switch">
8
+ class="nile-slide-toggle__switch" part="slide-toggle-switch">
8
9
  <input
9
10
  type="checkbox"
10
11
  .checked=${this.isChecked}
11
12
  @change=${this.toggleValue}
12
13
  />
13
- <span class="nile-slide-toggle__slider"></span>
14
+ <span class="nile-slide-toggle__slider" part="slide-toggle-slider"></span>
14
15
  </label>
15
- <span class="nile-slide-toggle__label">
16
- <span>${this.label}</span>
17
- <span class="nile-slide-toggle__sublabel">${this.sublabel}</span>
16
+ <span class="nile-slide-toggle__label" part="slide-toggle-label-container">
17
+ <span part="slide-toggle-label">${this.label}</span>
18
+ <span class="nile-slide-toggle__sublabel" part="slide-toggle-sublabel">${this.sublabel}</span>
18
19
  </span>
19
20
  </div>
20
21
  ${e?t` <nile-form-help-text>${this.helpText}</nile-form-help-text> `:""}
21
- ${i?t`
22
+ ${s?t`
22
23
  <nile-form-error-message
23
24
  >${this.errorMessage}</nile-form-error-message
24
25
  >
25
26
  `:""}
26
- `}};h.styles=i,e([o({type:String})],h.prototype,"label",void 0),e([o({type:String})],h.prototype,"sublabel",void 0),e([o({type:String})],h.prototype,"textPosition",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"isChecked",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"fullWidth",void 0),e([o({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0),e([o({attribute:"help-text",reflect:!0})],h.prototype,"helpText",void 0),e([o({attribute:"error-message",reflect:!0})],h.prototype,"errorMessage",void 0),h=e([r("nile-slide-toggle")],h);export{h as N};
27
+ `}};a.styles=s,e([r({type:String})],a.prototype,"label",void 0),e([r({type:String})],a.prototype,"sublabel",void 0),e([r({type:String})],a.prototype,"textPosition",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"isChecked",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"fullWidth",void 0),e([r({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),e([r({attribute:"help-text",reflect:!0})],a.prototype,"helpText",void 0),e([r({attribute:"error-message",reflect:!0})],a.prototype,"errorMessage",void 0),a=e([o("nile-slide-toggle")],a);export{a as N};
@@ -27,10 +27,6 @@ export declare class NileDatePicker extends NileElement {
27
27
  syncDatePicker: boolean;
28
28
  dateFormat: string;
29
29
  rangeSeparator: string;
30
- startYear: number;
31
- endYear: number;
32
- showYearDropdown: boolean;
33
- showMonthDropdown: boolean;
34
30
  dropdown: NileDropdown;
35
31
  /**
36
32
  * Render method
@@ -32,8 +32,6 @@ let NileDatePicker = class NileDatePicker extends NileElement {
32
32
  this.syncDatePicker = false;
33
33
  this.dateFormat = "DD/MM/YYYY";
34
34
  this.rangeSeparator = " - ";
35
- this.showYearDropdown = false;
36
- this.showMonthDropdown = false;
37
35
  }
38
36
  /**
39
37
  * The styles for DatePicker
@@ -118,10 +116,6 @@ let NileDatePicker = class NileDatePicker extends NileElement {
118
116
  .showManualInputs="${this.showManualInputs}"
119
117
  .doubleClickUnselect="${this.doubleClickUnselect}"
120
118
  .allowClear="${this.allowClear}"
121
- .startYear="${this.startYear}"
122
- .endYear="${this.endYear}"
123
- ?showYearDropdown="${this.showYearDropdown}"
124
- ?showMonthDropdown="${this.showMonthDropdown}"
125
119
  ></nile-calendar>
126
120
  </nile-dropdown>
127
121
  `;
@@ -209,18 +203,6 @@ __decorate([
209
203
  __decorate([
210
204
  property({ type: String, attribute: true, reflect: true })
211
205
  ], NileDatePicker.prototype, "rangeSeparator", void 0);
212
- __decorate([
213
- property({ type: Number, attribute: true, reflect: true })
214
- ], NileDatePicker.prototype, "startYear", void 0);
215
- __decorate([
216
- property({ type: Number, attribute: true, reflect: true })
217
- ], NileDatePicker.prototype, "endYear", void 0);
218
- __decorate([
219
- property({ type: Boolean, attribute: true, reflect: true })
220
- ], NileDatePicker.prototype, "showYearDropdown", void 0);
221
- __decorate([
222
- property({ type: Boolean, attribute: true, reflect: true })
223
- ], NileDatePicker.prototype, "showMonthDropdown", void 0);
224
206
  __decorate([
225
207
  query('nile-dropdown')
226
208
  ], NileDatePicker.prototype, "dropdown", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"nile-date-picker.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAGL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AAEH,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAI3B,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QASwB,UAAK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AC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAwB;AAExB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAA2B;AAE1B;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAwB;AAEvB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAmB;AAElB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAiB;AAEf;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wDAA0B;AAEzB;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDAA2B;AAE/D;IAAvB,KAAK,CAAC,eAAe,CAAC;gDAAwB;AA/CpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA6L1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { \n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport NileElement from '../internal/nile-element';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n\nimport {\n parseDateFromFormat,\n formatDateToFormat,\n parseRangeFromFormat,\n normalizeDateRange\n} from './nile-date-picker-utils';\n\n\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean }) range = false;\n\n @property({ type: Boolean }) hideTypes = false;\n\n @property({ type: Boolean, reflect: true }) doubleClickUnselect = false;\n\n @property({ type: Boolean, reflect: true }) allowClear = false;\n\n @property({ type: Boolean }) open = false;\n\n @property({ type: Boolean, attribute: 'hide-time-zone' }) hideTimeZone = false;\n\n @property({ type: String, reflect: true }) type: 'absolute' | 'relative' = 'absolute';\n\n @property({ type: Boolean, attribute: 'showManualInputs' }) \n showManualInputs = false;\n\n @property() value: any;\n\n @property({ type: Array, attribute: 'hide-duration-fields' }) \n hideDurationFields: any = [];\n\n @property({ attribute: 'allowedDates' }) allowedDates: any = '{}';\n\n @property({ type: Boolean, attribute: true, reflect: true }) syncDatePicker = false;\n\n @property({ type: String, attribute: true, reflect: true }) dateFormat = \"DD/MM/YYYY\"; \n\n @property({ type: String, attribute: true, reflect: true }) rangeSeparator = \" - \";\n\n @property({ type: Number, attribute: true, reflect: true }) startYear: number;\n\n @property({ type: Number, attribute: true, reflect: true }) endYear: number;\n\n @property({ type: Boolean, attribute: true, reflect: true }) showYearDropdown = false;\n\n @property({ type: Boolean, attribute: true, reflect: true }) showMonthDropdown = false;\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n /**\n * Render method\n * @slot This is a slot test\n */\n firstUpdated() {\n super.firstUpdated?.(new Map());\n\n if (!this.syncDatePicker) return;\n\n const input = this.querySelector(\"nile-input\");\n if (!input) return;\n\n input.addEventListener(\"nile-input\", (e: any) => {\n const text = e.detail.value;\n const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range, this.rangeSeparator);\n\n if (!this.range) {\n if (first) this.jumpTo(first);\n return;\n }\n\n if (first && !second) {\n this.jumpTo(first);\n this.syncRangeCalendar(first, null);\n }\n\n if (first && second) {\n const [start, end] = normalizeDateRange(first, second);\n if (end) this.jumpTo(end);\n this.syncRangeCalendar(start, end);\n }\n });\n }\n\n private jumpTo(date: Date) {\n this.open = true;\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n cal.currentYear = date.getFullYear();\n cal.currentMonth = date.getMonth();\n cal.value = date;\n cal.valueAttribute = date.toISOString();\n }\n\n\n private syncRangeCalendar(first: Date | null, second: Date | null) {\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n if (!this.range) return;\n\n if (first) cal.startDate = first;\n if (second) cal.endDate = second;\n }\n\n render(): TemplateResult {\n return html`\n <nile-dropdown .open=\"${this.open}\" part=\"dd-base\" .hoist=\"${true}\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"${this.hideTypes}\"\n .type=\"${this.type}\"\n value=\"${this.value}\"\n .range=\"${this.range}\"\n @nile-init=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-destroy=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-changed=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n\n @nile-change=\"${this.handleChanged}\"\n\n .allowedDates=\"${this.allowedDates}\"\n\n @nile-type-change=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-type-change',e.detail)}}\"\n @nile-clear=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-clear')}}\"\n .hideDurationFields=\"${this.hideDurationFields}\"\n .showManualInputs=\"${this.showManualInputs}\"\n .doubleClickUnselect=\"${this.doubleClickUnselect}\"\n .allowClear=\"${this.allowClear}\"\n .startYear=\"${this.startYear}\"\n .endYear=\"${this.endYear}\"\n ?showYearDropdown=\"${this.showYearDropdown}\"\n ?showMonthDropdown=\"${this.showMonthDropdown}\"\n ></nile-calendar>\n </nile-dropdown>\n `;\n }\n\n\n handleChanged(event: CustomEvent) {\n event.stopPropagation();\n\n const detail = event.detail;\n const triggerInput = this.querySelector(\"nile-input\");\n\n if (!this.range) {\n const picked = detail.value;\n\n if (picked && triggerInput) {\n triggerInput.value = formatDateToFormat(new Date(picked), this.dateFormat);\n triggerInput.emit(\"nile-input\", { value: triggerInput.value });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n this.dropdown?.hide();\n return;\n }\n\n const start = detail.startDate;\n const end = detail.endDate;\n\n if (triggerInput) {\n let text = \"\";\n if (start) text += formatDateToFormat(new Date(start), this.dateFormat);\n if (start && end) text += \" - \" + formatDateToFormat(new Date(end), this.dateFormat);\n\n triggerInput.value = text;\n triggerInput.emit(\"nile-input\", { value: text });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-date-picker.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAGL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AAEH,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACn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AE,CAAC;sDAAwB;AAExB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAA2B;AAE1B;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAwB;AAG3D;IAAvB,KAAK,CAAC,eAAe,CAAC;gDAAwB;AAxCpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAkL1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { \n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport NileElement from '../internal/nile-element';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n\nimport {\n parseDateFromFormat,\n formatDateToFormat,\n parseRangeFromFormat,\n normalizeDateRange\n} from './nile-date-picker-utils';\n\n\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean }) range = false;\n\n @property({ type: Boolean }) hideTypes = false;\n\n @property({ type: Boolean, reflect: true }) doubleClickUnselect = false;\n\n @property({ type: Boolean, reflect: true }) allowClear = false;\n\n @property({ type: Boolean }) open = false;\n\n @property({ type: Boolean, attribute: 'hide-time-zone' }) hideTimeZone = false;\n\n @property({ type: String, reflect: true }) type: 'absolute' | 'relative' = 'absolute';\n\n @property({ type: Boolean, attribute: 'showManualInputs' }) \n showManualInputs = false;\n\n @property() value: any;\n\n @property({ type: Array, attribute: 'hide-duration-fields' }) \n hideDurationFields: any = [];\n\n @property({ attribute: 'allowedDates' }) allowedDates: any = '{}';\n\n @property({ type: Boolean, attribute: true, reflect: true }) syncDatePicker = false;\n\n @property({ type: String, attribute: true, reflect: true }) dateFormat = \"DD/MM/YYYY\"; \n\n @property({ type: String, attribute: true, reflect: true }) rangeSeparator = \" - \";\n\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n /**\n * Render method\n * @slot This is a slot test\n */\n firstUpdated() {\n super.firstUpdated?.(new Map());\n\n if (!this.syncDatePicker) return;\n\n const input = this.querySelector(\"nile-input\");\n if (!input) return;\n\n input.addEventListener(\"nile-input\", (e: any) => {\n const text = e.detail.value;\n const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range, this.rangeSeparator);\n\n if (!this.range) {\n if (first) this.jumpTo(first);\n return;\n }\n\n if (first && !second) {\n this.jumpTo(first);\n this.syncRangeCalendar(first, null);\n }\n\n if (first && second) {\n const [start, end] = normalizeDateRange(first, second);\n if (end) this.jumpTo(end);\n this.syncRangeCalendar(start, end);\n }\n });\n }\n\n private jumpTo(date: Date) {\n this.open = true;\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n cal.currentYear = date.getFullYear();\n cal.currentMonth = date.getMonth();\n cal.value = date;\n cal.valueAttribute = date.toISOString();\n }\n\n\n private syncRangeCalendar(first: Date | null, second: Date | null) {\n const cal = this.shadowRoot!.querySelector(\"nile-calendar\") as any;\n if (!cal) return;\n\n if (!this.range) return;\n\n if (first) cal.startDate = first;\n if (second) cal.endDate = second;\n }\n\n render(): TemplateResult {\n return html`\n <nile-dropdown .open=\"${this.open}\" part=\"dd-base\" .hoist=\"${true}\" distance=\"6\" exportparts=\"base\">\n <slot slot=\"trigger\" part=\"trigger\" name=\"trigger\"></slot>\n\n <nile-calendar\n .hideTypes=\"${this.hideTypes}\"\n .type=\"${this.type}\"\n value=\"${this.value}\"\n .range=\"${this.range}\"\n @nile-init=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-destroy=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n @nile-changed=\"${(e:CustomEvent)=>e.stopPropagation()}\"\n\n @nile-change=\"${this.handleChanged}\"\n\n .allowedDates=\"${this.allowedDates}\"\n\n @nile-type-change=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-type-change',e.detail)}}\"\n @nile-clear=\"${(e:CustomEvent)=>{e.stopPropagation();this.emit('nile-clear')}}\"\n .hideDurationFields=\"${this.hideDurationFields}\"\n .showManualInputs=\"${this.showManualInputs}\"\n .doubleClickUnselect=\"${this.doubleClickUnselect}\"\n .allowClear=\"${this.allowClear}\"\n ></nile-calendar>\n </nile-dropdown>\n `;\n }\n\n\n handleChanged(event: CustomEvent) {\n event.stopPropagation();\n\n const detail = event.detail;\n const triggerInput = this.querySelector(\"nile-input\");\n\n if (!this.range) {\n const picked = detail.value;\n\n if (picked && triggerInput) {\n triggerInput.value = formatDateToFormat(new Date(picked), this.dateFormat);\n triggerInput.emit(\"nile-input\", { value: triggerInput.value });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n this.dropdown?.hide();\n return;\n }\n\n const start = detail.startDate;\n const end = detail.endDate;\n\n if (triggerInput) {\n let text = \"\";\n if (start) text += formatDateToFormat(new Date(start), this.dateFormat);\n if (start && end) text += \" - \" + formatDateToFormat(new Date(end), this.dateFormat);\n\n triggerInput.value = text;\n triggerInput.emit(\"nile-input\", { value: text });\n }\n\n this.emit('nile-changed', event.detail);\n this.emit('nile-change', event.detail);\n\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"]}