@descope/web-components-ui 3.17.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cjs/index.cjs.js +2807 -1010
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +3244 -1442
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/1408.js +8 -8
  6. package/dist/umd/1408.js.map +1 -1
  7. package/dist/umd/5260.js +1 -1
  8. package/dist/umd/5260.js.map +1 -1
  9. package/dist/umd/6618.js +1 -1
  10. package/dist/umd/6618.js.map +1 -1
  11. package/dist/umd/67.js +2 -0
  12. package/dist/umd/67.js.map +1 -0
  13. package/dist/umd/7092.js +1 -1
  14. package/dist/umd/7092.js.map +1 -1
  15. package/dist/umd/7939.js +1 -1
  16. package/dist/umd/7939.js.map +1 -1
  17. package/dist/umd/8350.js +1 -1
  18. package/dist/umd/8350.js.map +1 -1
  19. package/dist/umd/9439.js +2 -0
  20. package/dist/umd/9439.js.map +1 -0
  21. package/dist/umd/DescopeDev.js +1 -1
  22. package/dist/umd/DescopeDev.js.map +1 -1
  23. package/dist/umd/descope-attachment.js +1 -1
  24. package/dist/umd/descope-attachment.js.map +1 -1
  25. package/dist/umd/descope-badge.js +1 -1
  26. package/dist/umd/descope-badge.js.map +1 -1
  27. package/dist/umd/descope-date-field-descope-calendar-index-js.js +10 -10
  28. package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
  29. package/dist/umd/descope-date-field-index-js.js +1 -1
  30. package/dist/umd/descope-date-field-index-js.js.map +1 -1
  31. package/dist/umd/descope-filter.js +2 -0
  32. package/dist/umd/descope-filter.js.map +1 -0
  33. package/dist/umd/descope-month-day-field.js +1 -1
  34. package/dist/umd/descope-month-day-field.js.map +1 -1
  35. package/dist/umd/descope-multi-line-mappings.js +4 -4
  36. package/dist/umd/descope-multi-line-mappings.js.LICENSE.txt +6 -0
  37. package/dist/umd/descope-multi-line-mappings.js.map +1 -1
  38. package/dist/umd/descope-multi-select-combo-box.js +2 -1
  39. package/dist/umd/descope-multi-select-combo-box.js.LICENSE.txt +5 -0
  40. package/dist/umd/descope-multi-select-combo-box.js.map +1 -1
  41. package/dist/umd/descope-multi-sso.js +1 -1
  42. package/dist/umd/descope-multi-sso.js.map +1 -1
  43. package/dist/umd/descope-new-password-index-js.js +1 -1
  44. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  45. package/dist/umd/descope-passcode-index-js.js +1 -1
  46. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  47. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  48. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  49. package/dist/umd/descope-security-questions-verify-index-js.js +1 -1
  50. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  51. package/dist/umd/descope-text-field.js +1 -1
  52. package/dist/umd/descope-text-field.js.map +1 -1
  53. package/dist/umd/descope-trusted-devices.js +1 -1
  54. package/dist/umd/descope-trusted-devices.js.map +1 -1
  55. package/dist/umd/descope-user-attribute-index-js.js +1 -1
  56. package/dist/umd/descope-user-attribute-index-js.js.map +1 -1
  57. package/dist/umd/descope-user-auth-method-index-js.js +1 -1
  58. package/dist/umd/descope-user-auth-method-index-js.js.map +1 -1
  59. package/dist/umd/index.js +1 -1
  60. package/dist/umd/index.js.map +1 -1
  61. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  62. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  63. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  64. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  65. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  66. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
  67. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  68. package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
  69. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  70. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  71. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  72. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  73. package/package.json +42 -41
  74. package/src/theme/components/index.js +2 -0
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[9257],{28027(e,t,i){i.d(t,{T:()=>l,w:()=>h});var r=i(88961),o=i(63200),n=i(25964),s=i(79673),a=i(47656);const l=(0,n.xE)("text-field"),p=["type","label-type","copy-to-clipboard"],h=(0,o.Zz)((0,r.RF)({mappings:a.A}),r.VO,(0,r.OZ)({proxyProps:["value","selectionStart","selectionEnd"],useProxyTargets:!0}),r.tQ,e=>class extends e{static get observedAttributes(){return p.concat(e.observedAttributes||[])}icon;init(){super.init?.()}renderCopyToClipboard(e){if(!e)return void this.icon?.remove();const t={icon:"vaadin:copy-o",title:"Copy",style:"cursor: pointer"},i={icon:"vaadin:check-circle-o",title:"Copied",style:"cursor: initial"};this.icon=Object.assign(document.createElement("vaadin-icon"),{slot:"suffix",...t}),this.baseElement.appendChild(this.icon),this.icon.addEventListener("click",()=>{navigator.clipboard.writeText(this.value),Object.assign(this.icon,i),setTimeout(()=>{Object.assign(this.icon,t)},5e3)})}onLabelClick(){this.focus()}attributeChangedCallback(e,t,i){super.attributeChangeCallback?.(e,t,i),"type"===e&&this.baseElement._setType(i),t!==i&&("label-type"===e?"floating"===i?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick):"copy-to-clipboard"===e&&this.renderCopyToClipboard("true"===i))}})((0,r.tz)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${h.cssVarList.inputOutlineWidth}) + var(${h.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${(0,s.$J)("vaadin-text-field")}\n\t\t\t${(0,s.cy)(h.cssVarList)}\n\t\t\t${(0,s.LJ)("vaadin-text-field",h.cssVarList)}\n ${(0,s.Kl)()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:l}))},64014(e,t,i){i.r(t),i.d(t,{TextFieldClass:()=>r.w,componentName:()=>r.T}),i(11284),i(37182),i(95260);var r=i(28027);customElements.define(r.T,r.w)},47656(e,t,i){i.d(t,{A:()=>C});const{host:r,label:o,placeholder:n,requiredIndicator:s,inputField:a,input:l,inputMask:p,helperText:h,errorMessage:d,disabledPlaceholder:c,inputDisabled:u,inputIcon:g,externalInput:y,externalInputDisabled:m,externalPlaceholder:b,externalDisabledPlaceholder:v}={host:{selector:()=>":host"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},placeholder:[{selector:"> input:placeholder-shown"},{selector:()=>":host::slotted(input:placeholder-shown)"}],disabledPlaceholder:{selector:"> input:disabled::placeholder"},inputField:{selector:"::part(input-field)"},input:{selector:"input"},inputMask:{selector:"::part(input-field)::before"},inputDisabled:{selector:"input:disabled"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},inputIcon:{selector:"vaadin-icon"},externalInput:{selector:()=>"::slotted(input)"},externalInputDisabled:{selector:()=>"::slotted(input:disabled)"},externalPlaceholder:{selector:()=>"::slotted(input:placeholder-shown)"},externalDisabledPlaceholder:{selector:()=>"::slotted(input:disabled::placeholder)"}},C={fontSize:[{},r],fontFamily:[o,a,h,d],labelFontSize:{...o,property:"font-size"},labelFontWeight:{...o,property:"font-weight"},inputValueFontWeight:[{...l,property:"font-weight"},{...y,property:"font-weight"}],inputPlaceholderFontWeight:[{selector:()=>":host input:placeholder-shown",property:"font-weight"},{...b,property:"font-weight"}],helperTextFontWeight:{...h,property:"font-weight"},errorMessageFontWeight:{...d,property:"font-weight"},labelTextColor:[{...o,property:"color"},{...s,property:"color"},{...o,property:"-webkit-text-fill-color"},{...s,property:"-webkit-text-fill-color"}],hostWidth:{...r,property:"width"},hostMinWidth:{...r,property:"min-width"},hostDirection:{...r,property:"direction"},inputDirection:{...l,property:"direction"},inputBackgroundColor:[{...a,property:"background-color"},{...p,property:"background-color"}],errorMessageTextColor:{...d,property:"color"},errorMessageIcon:{...d,property:"background-image"},errorMessageIconSize:{...d,property:"background-size"},errorMessageIconPadding:{...d,property:"padding-inline-start"},errorMessageIconRepeat:{...d,property:"background-repeat"},errorMessageIconPosition:{...d,property:"background-position"},errorMessageFontSize:{...d,property:"font-size"},helperTextColor:{...h,property:"-webkit-text-fill-color"},inputValueTextColor:[{...a,property:"color"},{...u,property:"-webkit-text-fill-color"},{...m,property:"-webkit-text-fill-color"}],inputCaretTextColor:[{...l,property:"caret-color"},{...y,property:"caret-color"}],labelRequiredIndicator:{...s,property:"content"},inputBorderColor:{...a,property:"border-color"},inputBorderWidth:{...a,property:"border-width"},inputBorderStyle:{...a,property:"border-style"},inputBorderRadius:{...a,property:"border-radius"},inputHeight:{...a,property:"height"},inputHorizontalPadding:[{...l,property:"padding-left"},{...l,property:"padding-right"},{...y,property:"padding-left"},{...y,property:"padding-right"}],inputOutlineColor:{...a,property:"outline-color"},inputOutlineStyle:{...a,property:"outline-style"},inputOutlineWidth:{...a,property:"outline-width"},inputOutlineOffset:{...a,property:"outline-offset"},textAlign:{},inputTextAlign:[{...l,property:"text-align"},{...y,property:"text-align"}],inputPlaceholderColor:[{selector:()=>":host input:placeholder-shown",property:"color"},{...b,property:"color"},{...n,property:"color"},{...c,property:"-webkit-text-fill-color"},{...v,property:"-webkit-text-fill-color"}],labelPosition:{...o,property:"position"},labelTopPosition:{...o,property:"top"},labelHorizontalPosition:[{...o,property:"left"},{...o,property:"right"}],inputTransformY:{...o,property:"transform"},inputTransition:{...o,property:"transition"},marginInlineStart:{...o,property:"margin-inline-start"},placeholderOpacity:[{selector:"> input:placeholder-shown",property:"opacity"},{...b,property:"opacity"}],inputVerticalAlignment:[{...a,property:"align-items"},{...y,property:"align-items"}],valueInputHeight:[{...l,property:"height"},{...y,property:"height"}],valueInputMarginBottom:[{...l,property:"margin-bottom"},{...y,property:"margin-bottom"}],inputIconOffset:[{...g,property:"margin-right"},{...g,property:"margin-left"}],inputIconSize:{...g,property:"font-size"},inputIconColor:{...g,property:"color"},inputTextSecurity:[{...l,property:"-webkit-text-security"},{...l,property:"text-security"},{...y,property:"-webkit-text-security"},{...y,property:"text-security"}]}},79981(e,t,i){i.r(t),i.d(t,{DateFieldClass:()=>k,componentName:()=>y}),i(20428),i(88350),i(64014);var r=i(25964),o=i(28027),n=i(3393),s=i(79365),a=i(97810),l=i(9696),p=i(49224),h=i(77421),d=i(80071),c=i(64101);class u{#e=Object.freeze([]);constructor({id:e,min:t,max:i,placeholder:r},o){this.id=e,this.min=t,this.max=i,this.placeholder=r,this.onChange=o}get data(){return this.#e}set data(e){this.#e=Object.freeze(e),this.onChange?.()}get#t(){return this.data.length?this.numberValue:0}get numberValue(){return Number(this.stringValue)}get stringValue(){return(this.data.join("")||this.placeholder).padStart(this.length,"0")}get isFull(){return 10*this.numberValue>this.max||this.data.length===this.length}get isEmpty(){return this.stringValue===this.placeholder}get length(){return this.max.toString().length}set(e){this.data=e.toString().split("")}add(e){let{data:t}=this;return t=[...t,e],Number(t.join(""))>this.max?t=[e]:this.length<t.length&&(t=t.slice(1,t.length)),this.data=t,e}del(){this.data.filter(e=>"0"!==e).filter(Boolean).length?this.data=this.data.slice(0,this.data.length-1):this.data=[]}clear(){this.data=[]}inc(e){this.replaceValue(this.#t<this.max?Math.max(this.#t+(e||1),this.min):this.min)}dec(e){this.replaceValue(this.#t>this.min?Math.min(this.#t-(e||1),this.max):this.max)}isInRange(e){return e>=this.min&&e<=this.max}replaceValue(e){this.isInRange(e)&&(this.data=e.toString().padStart(this.length,0).split(""))}setMin(e){this.min=Number(e)}setMax(e){this.max=Number(e)}}var g=i(15177);const y=(0,a.xE)("date-field"),m=(0,n.y)({componentName:y,baseSelector:"vaadin-popover"}),b=["format","opened","initial-value","readonly","disable-calendar","utc-time"],v=["years-range","calendar-months","calendar-weekdays"],C=[...b,...v],f=o.w.cssVarList,{host:x,input:w,inputEleRTL:E,toggleButton:I,overlay:T,backdrop:S,errorMessage:V}={host:{selector:()=>":host"},input:{selector:()=>"descope-text-field"},inputEleRTL:{selector:()=>':host([st-host-direction="rtl"]) descope-text-field'},toggleButton:{selector:()=>".toggle-calendar"},overlay:{selector:"vaadin-popover-overlay::part(overlay)"},backdrop:{selector:"vaadin-popover-overlay::part(backdrop)"}},k=(0,l.Zz)((0,s.RF)({componentNameOverride:(0,a.xE)("input-wrapper")}),(0,s.RF)({mappings:{iconMargin:{...I,property:"margin-inline-end"},hostWidth:{...x,property:"width"},hostDirection:{...x,property:"direction"},textAlign:{...w,property:"text-align"},rtlInputDirection:{...E,property:f.inputDirection},rtlInputAlignment:{...E,property:f.inputTextAlign},overlayGap:{property:()=>k.cssVarList.overlayGap},overlayBackgroundColor:{property:()=>k.cssVarList.overlayBackgroundColor},overlayPadding:{property:()=>k.cssVarList.overlayPadding},overlayBoxShadow:{property:()=>k.overlayBoxShadow},overlayOutlineWidth:{property:()=>k.cssVarList.overlayOutlineWidth},overlayOutlineColor:{property:()=>k.cssVarList.overlayOutlineColor},overlayOutlineStyle:{property:()=>k.cssVarList.overlayOutlineStyle},errorMessageIcon:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageIcon},errorMessageIconSize:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageIconSize},errorMessageIconPadding:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageIconPadding},errorMessageIconRepeat:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageIconRepeat},errorMessageIconPosition:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageIconPosition},errorMessageFontSize:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageFontSize},labelFontWeight:{selector:o.w.componentName,property:o.w.cssVarList.labelFontWeight},inputValueFontWeight:{selector:o.w.componentName,property:o.w.cssVarList.inputValueFontWeight},inputPlaceholderFontWeight:{selector:o.w.componentName,property:o.w.cssVarList.inputPlaceholderFontWeight},helperTextFontWeight:{selector:o.w.componentName,property:o.w.cssVarList.helperTextFontWeight},errorMessageFontWeight:{selector:o.w.componentName,property:o.w.cssVarList.errorMessageFontWeight}}}),(0,s.mA)({name:"overlay",selector:"",mappings:{marginTop:{...T,property:"margin-top"},backgroundColor:{...T},backdropBackgroundColor:{...S,property:"background-color"},backdropPointerEvents:{...S,property:"pointer-events"},padding:{...T},boxShadow:{...T},outlineWidth:{...T},outlineColor:{...T},outlineStyle:{...T}}}),s.VO,s.tQ)(class extends m{epoch="";format=c.ui;selectedCounterIdx=0;updateCountersDisplay(){this.inputElement.value=this.countersValue}updateValue(){if(this.isCountersOutOfRange)this.resetEpoch();else{const e=h.F[this.format].getDate(this.inputElement.value);this.updateEpoch((0,p.xq)(e,this.isUtcTime))}}onDateCounterChange=()=>{this.updateCountersDisplay(),this.updateValue(),this.#i()};updateEpoch(e){this.epoch=(0,p.xq)(e,this.isUtcTime)}dateCounters=[new u(c.rR.MONTH,this.onDateCounterChange.bind(this)),new u(c.rR.DAY,this.onDateCounterChange.bind(this)),new u(c.rR.YEAR,this.onDateCounterChange.bind(this))];static get observedAttributes(){return[].concat(m.observedAttributes||[],C)}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div>\n <descope-text-field inputmode="numeric">\n <span slot="suffix" class="toggle-calendar">\n ${d.ki}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `,(0,r.fz)('\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly="true"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n ',this),this.inputElement=this.shadowRoot.querySelector("descope-text-field"),this.popoverToggleButton=this.inputElement.querySelector(".toggle-calendar")}get validationTarget(){return this.inputElement}get opened(){return"true"===this.getAttribute("opened")}get displayValueEpoch(){const e=h.F[this.format].getDate(this.inputElement.value);return(0,p.mZ)(e?.getTime())?e.getTime():null}get sortedCounters(){return this.format.split(c.eT).map(e=>this.dateCounters.find(t=>t.placeholder===e))}get activeCounter(){return this.sortedCounters[this.selectedCounterIdx]}get countersValue(){return this.sortedCounters.map(e=>e.stringValue).join(c.eT)}get overlay(){return this.baseElement.shadowRoot?.querySelector("vaadin-popover-overlay")}get backdrop(){return this.overlay.shadowRoot?.querySelector("#backdrop")}get calendar(){return this.overlay?.querySelector("descope-calendar")}get isRTL(){const e=getComputedStyle(this.baseElement).getPropertyValue("direction");return e?"rtl"===e:"rtl"===this.getAttribute("st-host-direction")}get value(){return this.isInvalidDate()?"":this.epoch}set value(e){const t=parseInt(e,10);Number.isNaN(t)?(this.resetEpoch(),this.resetDateCounters(),this.clearInputEle()):(this.updateEpoch(t),this.updateDateCounters(new Date(t)))}resetEpoch(){this.epoch=""}get isCountersEmpty(){return this.dateCounters.every(e=>e.isEmpty)}get isCountersOutOfRange(){return this.dateCounters.some(e=>!e.isInRange(e.numberValue))}get disableCalendar(){return"true"===this.getAttribute("disable-calendar")}get isUtcTime(){return"true"===this.getAttribute("utc-time")}get isSelectAll(){const e=this.inputElement.baseElement.inputElement;return e.value.length===e.selectionStart+e.selectionEnd}reportValidity(){this.inputElement.reportValidity()}#i(){this.inputElement.baseElement.dispatchEvent(new Event("input",{bubbles:!0}))}updateInputDisplay(){this.inputElement.value=(0,p.jO)((0,g.N)(this.countersValue).getTime(),this.format)}init(){super.init?.(),this.updateFormatPattern(),this.initPopover(),this.onDateCounterChange(),this.initInputElement(),setTimeout(()=>{this.#r()},0)}initInputElement(){this.inputElement.getValidity=this.getValidity.bind(this),this.inputElement.baseElement.checkValidity=this.checkValidity.bind(this),this.popoverToggleButton.addEventListener("click",this.onPopoverToggle.bind(this)),this.inputElement.addEventListener("focus",this.onFocus.bind(this)),this.inputElement.addEventListener("blur",this.onBlur.bind(this)),this.inputElement.addEventListener("click",this.handleMouseCaretPositionChange.bind(this)),this.inputElement.addEventListener("keydown",this.handleKeyboard.bind(this)),this.inputElement.addEventListener("beforeinput",this.handleInput.bind(this)),this.inputElement.addEventListener("pointerdown",this.onPointerDown.bind(this)),this.inputElement.addEventListener("paste",this.onPaste.bind(this)),(0,a.EA)(this,this.inputElement,{includeAttrs:["label","label-type","placeholder","disabled","readonly","bordered","required","full-width","st-host-direction","pattern","bordered","data-errormessage-value-missing","data-errormessage-pattern-mismatch","data-errormessage-range-underflow","data-errormessage-range-overflow","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"]})}handleInput(e){e.preventDefault(),this.handleSelectAll(),e.data&&(0,p.Et)(e.data)?(this.parseDigits(e.data),this.updateCountersDisplay()):e.inputType&&this.handleNavKeys(e)}initPopover(){this.baseElement.trigger=["click"],this.baseElement.withBackdrop=!0,this.baseElement.renderer=this.#o.bind(this),this.baseElement.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()})}handleSelectAll(){this.isSelectAll&&this.selectFirstCounter()}#n;#o(e){e.firstChild||(this.overlay.positionTarget=this.shadowRoot.querySelector(".toggle-calendar"),e.appendChild(this.#s()),(0,p.Xs)(this.baseElement),this.backdrop.addEventListener("click",this.closePopover.bind(this))),e.style.setProperty("visibility","hidden"),setTimeout(()=>{this.#a(e),e.style.setProperty("visibility","visible"),this.updateCalendarView(e)},100)}#a(){const e=this.shadowRoot.querySelector("vaadin-popover").shadowRoot;this.#n?.replaceSync("vaadin-popover-overlay::part(overlay) { transform: none; }");const t=document.body.getBoundingClientRect(),i=this.getBoundingClientRect(),o=this.calendar.getBoundingClientRect(),n=this.isRTL?"right":"left",s=i[n]-o[n],a=o.left,l=t.width-o.right;let p;p=s>0?Math.min(s,l):-1*Math.min(Math.abs(s),a);const h=`\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${p}px);\n }\n `;this.#n?this.#n.replaceSync(h):this.#n=(0,r.fz)(h,e)}#s(){const e=document.createElement("span");e.innerHTML="<descope-calendar></descope-calendar>";const t=e.querySelector("descope-calendar");return t.addEventListener("date-submit",this.onCalendarSubmit.bind(this)),t.addEventListener("cancel",this.closePopover.bind(this)),e}#r(){this.overlay._attachOverlay=()=>this.overlay.bringToFront(),this.overlay._detachOverlay=()=>{},this.overlay._enterModalState=()=>{}}onPopoverToggle(){this.opened?this.closePopover():this.openPopover()}openPopover(){this.disableCalendar||this.setAttribute("opened","true")}closePopover(){this.removeAttribute("opened"),this.inputElement.focus()}getCounterById(e){return this.dateCounters.find(t=>t.id===e)}onCalendarSubmit(){if(!this.isReadOnly){if(!this.calendar.value)return;const e=(0,g.N)(this.calendar.value);this.value=(0,p.xq)(e,this.isUtcTime),this.getCounterById("year").replaceValue(e.getFullYear()),this.getCounterById("month").replaceValue(e.getMonth()+1),this.getCounterById("day").replaceValue(e.getDate()),this.#i()}this.closePopover()}updateCalendarView(){const e=(0,p.mZ)((0,g.N)(this.inputElement.value||"").getTime())&&h.F[this.format].validate(this.inputElement.value);this.displayValueEpoch||e?this.calendar.setAttribute("initial-value",(0,p.jO)(this.displayValueEpoch||this.epoch,c.wJ)):(this.calendar.clearValue(),this.calendar.setAttribute("preview",(0,p.jO)((0,p.Ln)(),c.wJ))),(0,a.EA)(this,this.calendar,{includeAttrs:["st-host-direction","readonly","initial-month","initial-year","years-range","calendar-label-submit","calendar-label-cancel","calendar-months","calendar-weekdays","calendar-weekdays-short"]})}onPointerDown(e){setTimeout(()=>this.handleMouseCaretPositionChange(e),c.SZ)}onFocus(){this.isReadOnly||setTimeout(()=>this.resetDisplay())}resetDisplay(){this.inputElement.value||(this.inputElement.value=this.format),this.selectFirstCounter(),this.inputElement.setSelectionRange(0,this.sortedCounters[0].length)}onBlur(){this.opened||this.inputElement.value===this.format&&this.clearInputEle()}clearInputEle(){this.inputElement.value=""}onFormatUpdate(e){Object.keys(h.F).includes(e)&&(this.format=e,this.updateFormatPattern())}updateFormatPattern(){const e=this.getAttribute("format")||this.format||c.ui;this.setAttribute("type","date"),this.setAttribute("pattern",h.F[e].pattern)}parseDigits(e){this.activeCounter.add(e),this.activeCounter.isFull&&this.selectNextCounter(),this.setInputSelectionRange()}getCounterIdx(e){const[t,i]=this.sortedCounters.map(e=>e.length);return[e<=t,e>=t&&e<=t+i+1,e>=t+i+2].indexOf(!0)}setSelectedCounterByCaretPosition(e){this.selectedCounterIdx=this.getCounterIdx(e.target?.selectionStart||this.inputElement.selectionStart)}selectFirstCounter(){this.selectedCounterIdx=0}selectNextCounter(){this.selectedCounterIdx<this.dateCounters.length&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx+1,2))}selectPrevCounter(){this.selectedCounterIdx>0&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx-1,1))}setInputSelectionRange(){this.selectedCounterIdx<0||setTimeout(()=>{const e=this.sortedCounters.slice(0,this.selectedCounterIdx).reduce((e,t)=>e+t.length,this.selectedCounterIdx);this.inputElement.setSelectionRange(e,e+this.sortedCounters[this.selectedCounterIdx].length)})}resetDateCounters(){this.dateCounters.forEach(e=>e.clear())}updateDateCounters(e){this.dateCounters.forEach(t=>{switch(t.id){case c.rR.MONTH.id:t.set(this.isUtcTime?e.getUTCMonth()+1:e.getMonth()+1);break;case c.rR.YEAR.id:t.set(this.isUtcTime?e.getUTCFullYear():e.getFullYear());break;case c.rR.DAY.id:t.set(this.isUtcTime?e.getUTCDate():e.getDate())}})}handleKeyboard(e){e.metaKey||e.ctrlKey?"x"===e.key.toLowerCase()&&this.onCut(e):(this.handleSelectAll(),"ArrowUp"===e.key?this.activeCounter.inc():"ArrowDown"===e.key?this.activeCounter.dec():"ArrowRight"===e.key?this.selectNextCounter():"ArrowLeft"===e.key&&this.selectPrevCounter(),this.setInputSelectionRange())}handleNavKeys(e){this.isReadOnly||(this.opened&&this.closePopover(),this.activeCounter&&("deleteContentBackward"===e.inputType&&this.handleBackspace(),this.setInputSelectionRange()))}handleBackspace(){if(this.isSelectAll)return void this.resetToInitialState();const e=this.activeCounter;e.isEmpty?(this.selectPrevCounter(),this.setInputSelectionRange()):e.set(""),setTimeout(()=>{this.updateCountersDisplay(),this.setInputSelectionRange()})}handleMouseCaretPositionChange(e){this.opened||(e.preventDefault(),this.setSelectedCounterByCaretPosition(e),this.setInputSelectionRange())}onInitialValueChange(e){this.value||setTimeout(()=>{Number.isNaN(parseInt(e,10))||(this.value=Number(e))})}togglePopoverAccess(e){e?this.popoverToggleButton.classList.remove("hidden"):this.popoverToggleButton.classList.add("hidden")}attributeChangedCallback(e,t,i){super.attributeChangedCallback?.(e,t,i),t!==i&&("disable-calendar"===e&&this.togglePopoverAccess("true"!==i),b.includes(e)?(i&&"format"===e&&this.onFormatUpdate(i),"initial-value"===e&&this.onInitialValueChange(i)):v.includes(e)&&(i?this.calendar?.setAttribute(e,i):this.calendar?.removeAttribute(e)))}isInvalidDate(){const e=this.getCounterById("year"),t=e.numberValue>c.nr.year.max||e.numberValue<c.nr.year.min,i=Object.entries(this.getDateVals()).some(([e,t])=>{const i=this.getCounterById(e);return!t||i.numberValue!==t});return t||i}getValidity(){return this.isRequired&&this.isCountersEmpty?{valueMissing:!0}:this.isCountersOutOfRange||this.isInvalidDate()?{patternMismatch:!0}:{}}getDateVals(){const e={day:"",month:"",year:""};if(Number.isNaN(this.epoch))return e;try{const t=new Date(this.epoch);this.isUtcTime?(e.month=t.getUTCMonth()+1,e.day=t.getUTCDate(),e.year=t.getUTCFullYear()):(e.month=t.getMonth()+1,e.day=t.getDate(),e.year=t.getFullYear())}catch(e){}return e}resetToInitialState(){this.resetDateCounters(),this.selectFirstCounter(),this.resetDisplay()}onCut(e){e.preventDefault(),this.isSelectAll?(this.#l(this.countersValue),this.resetToInitialState()):(this.#l(this.activeCounter.stringValue),this.activeCounter.set("")),this.setInputSelectionRange()}#l(e){try{navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy date value:",e)}}onPaste(e){e.preventDefault();const t=(e.clipboardData||window.clipboardData).getData("Text"),i=(0,p.Rm)(t,this.format);if(i)this.value=(0,p.xq)(i,this.isUtcTime),this.onDateCounterChange(),setTimeout(()=>this.inputElement.setSelectionRange(0,this.inputElement.value.length));else{const e=Number(t);e&&this.activeCounter.min<=e&&this.activeCounter.max>=e&&(this.activeCounter.set(String(e)),setTimeout(()=>this.setInputSelectionRange()))}}});customElements.define(y,k)}}]);
1
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[9257],{79981(e,t,i){i.r(t),i.d(t,{DateFieldClass:()=>P,componentName:()=>m}),i(20428),i(88350),i(64014);var s=i(25964),n=i(28027),r=i(3393),a=i(79365),o=i(97810),l=i(9696),h=i(49224),u=i(77421),d=i(80071),c=i(64101);class p{#e=Object.freeze([]);constructor({id:e,min:t,max:i,placeholder:s},n){this.id=e,this.min=t,this.max=i,this.placeholder=s,this.onChange=n}get data(){return this.#e}set data(e){this.#e=Object.freeze(e),this.onChange?.()}get#t(){return this.data.length?this.numberValue:0}get numberValue(){return Number(this.stringValue)}get stringValue(){return(this.data.join("")||this.placeholder).padStart(this.length,"0")}get isFull(){return 10*this.numberValue>this.max||this.data.length===this.length}get isEmpty(){return this.stringValue===this.placeholder}get length(){return this.max.toString().length}set(e){this.data=e.toString().split("")}add(e){let{data:t}=this;return t=[...t,e],Number(t.join(""))>this.max?t=[e]:this.length<t.length&&(t=t.slice(1,t.length)),this.data=t,e}del(){this.data.filter(e=>"0"!==e).filter(Boolean).length?this.data=this.data.slice(0,this.data.length-1):this.data=[]}clear(){this.data=[]}inc(e){this.replaceValue(this.#t<this.max?Math.max(this.#t+(e||1),this.min):this.min)}dec(e){this.replaceValue(this.#t>this.min?Math.min(this.#t-(e||1),this.max):this.max)}isInRange(e){return e>=this.min&&e<=this.max}replaceValue(e){this.isInRange(e)&&(this.data=e.toString().padStart(this.length,0).split(""))}setMin(e){this.min=Number(e)}setMax(e){this.max=Number(e)}}var g=i(15177);const m=(0,o.xE)("date-field"),v=(0,r.y)({componentName:m,baseSelector:"vaadin-popover"}),y=["format","opened","initial-value","readonly","disable-calendar","utc-time"],C=["years-range","calendar-months","calendar-weekdays"],b=[...y,...C],E=n.w.cssVarList,{host:w,input:V,inputEleRTL:I,toggleButton:S,overlay:f,backdrop:x,errorMessage:T}={host:{selector:()=>":host"},input:{selector:()=>"descope-text-field"},inputEleRTL:{selector:()=>':host([st-host-direction="rtl"]) descope-text-field'},toggleButton:{selector:()=>".toggle-calendar"},overlay:{selector:"vaadin-popover-overlay::part(overlay)"},backdrop:{selector:"vaadin-popover-overlay::part(backdrop)"}},P=(0,l.Zz)((0,a.RF)({componentNameOverride:(0,o.xE)("input-wrapper")}),(0,a.RF)({mappings:{iconMargin:{...S,property:"margin-inline-end"},hostWidth:{...w,property:"width"},hostDirection:{...w,property:"direction"},textAlign:{...V,property:"text-align"},rtlInputDirection:{...I,property:E.inputDirection},rtlInputAlignment:{...I,property:E.inputTextAlign},overlayGap:{property:()=>P.cssVarList.overlayGap},overlayBackgroundColor:{property:()=>P.cssVarList.overlayBackgroundColor},overlayPadding:{property:()=>P.cssVarList.overlayPadding},overlayBoxShadow:{property:()=>P.overlayBoxShadow},overlayOutlineWidth:{property:()=>P.cssVarList.overlayOutlineWidth},overlayOutlineColor:{property:()=>P.cssVarList.overlayOutlineColor},overlayOutlineStyle:{property:()=>P.cssVarList.overlayOutlineStyle},errorMessageIcon:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageIcon},errorMessageIconSize:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageIconSize},errorMessageIconPadding:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageIconPadding},errorMessageIconRepeat:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageIconRepeat},errorMessageIconPosition:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageIconPosition},errorMessageFontSize:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageFontSize},labelFontWeight:{selector:n.w.componentName,property:n.w.cssVarList.labelFontWeight},inputValueFontWeight:{selector:n.w.componentName,property:n.w.cssVarList.inputValueFontWeight},inputPlaceholderFontWeight:{selector:n.w.componentName,property:n.w.cssVarList.inputPlaceholderFontWeight},helperTextFontWeight:{selector:n.w.componentName,property:n.w.cssVarList.helperTextFontWeight},errorMessageFontWeight:{selector:n.w.componentName,property:n.w.cssVarList.errorMessageFontWeight}}}),(0,a.mA)({name:"overlay",selector:"",mappings:{marginTop:{...f,property:"margin-top"},backgroundColor:{...f},backdropBackgroundColor:{...x,property:"background-color"},backdropPointerEvents:{...x,property:"pointer-events"},padding:{...f},boxShadow:{...f},outlineWidth:{...f},outlineColor:{...f},outlineStyle:{...f}}}),a.VO,a.tQ)(class extends v{epoch="";format=c.ui;selectedCounterIdx=0;updateCountersDisplay(){this.inputElement.value=this.countersValue}updateValue(){if(this.isCountersOutOfRange)this.resetEpoch();else{const e=u.F[this.format].getDate(this.inputElement.value);this.updateEpoch((0,h.xq)(e,this.isUtcTime))}}onDateCounterChange=()=>{this.updateCountersDisplay(),this.updateValue(),this.#i()};updateEpoch(e){this.epoch=(0,h.xq)(e,this.isUtcTime)}dateCounters=[new p(c.rR.MONTH,this.onDateCounterChange.bind(this)),new p(c.rR.DAY,this.onDateCounterChange.bind(this)),new p(c.rR.YEAR,this.onDateCounterChange.bind(this))];static get observedAttributes(){return[].concat(v.observedAttributes||[],b)}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div>\n <descope-text-field inputmode="numeric">\n <span slot="suffix" class="toggle-calendar">\n ${d.ki}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `,(0,s.fz)('\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly="true"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n ',this),this.inputElement=this.shadowRoot.querySelector("descope-text-field"),this.popoverToggleButton=this.inputElement.querySelector(".toggle-calendar")}get validationTarget(){return this.inputElement}get opened(){return"true"===this.getAttribute("opened")}get displayValueEpoch(){const e=u.F[this.format].getDate(this.inputElement.value);return(0,h.mZ)(e?.getTime())?e.getTime():null}get sortedCounters(){return this.format.split(c.eT).map(e=>this.dateCounters.find(t=>t.placeholder===e))}get activeCounter(){return this.sortedCounters[this.selectedCounterIdx]}get countersValue(){return this.sortedCounters.map(e=>e.stringValue).join(c.eT)}get overlay(){return this.baseElement.shadowRoot?.querySelector("vaadin-popover-overlay")}get backdrop(){return this.overlay.shadowRoot?.querySelector("#backdrop")}get calendar(){return this.overlay?.querySelector("descope-calendar")}get isRTL(){const e=getComputedStyle(this.baseElement).getPropertyValue("direction");return e?"rtl"===e:"rtl"===this.getAttribute("st-host-direction")}get value(){return this.isInvalidDate()?"":this.epoch}set value(e){const t=parseInt(e,10);Number.isNaN(t)?(this.resetEpoch(),this.resetDateCounters(),this.clearInputEle()):(this.updateEpoch(t),this.updateDateCounters(new Date(t)))}resetEpoch(){this.epoch=""}get isCountersEmpty(){return this.dateCounters.every(e=>e.isEmpty)}get isCountersOutOfRange(){return this.dateCounters.some(e=>!e.isInRange(e.numberValue))}get disableCalendar(){return"true"===this.getAttribute("disable-calendar")}get isUtcTime(){return"true"===this.getAttribute("utc-time")}get isSelectAll(){const e=this.inputElement.baseElement.inputElement;return e.value.length===e.selectionStart+e.selectionEnd}reportValidity(){this.inputElement.reportValidity()}#i(){this.inputElement.baseElement.dispatchEvent(new Event("input",{bubbles:!0}))}updateInputDisplay(){this.inputElement.value=(0,h.jO)((0,g.N)(this.countersValue).getTime(),this.format)}init(){super.init?.(),this.updateFormatPattern(),this.initPopover(),this.onDateCounterChange(),this.initInputElement(),setTimeout(()=>{this.#s()},0)}initInputElement(){this.inputElement.getValidity=this.getValidity.bind(this),this.inputElement.baseElement.checkValidity=this.checkValidity.bind(this),this.popoverToggleButton.addEventListener("click",this.onPopoverToggle.bind(this)),this.inputElement.addEventListener("focus",this.onFocus.bind(this)),this.inputElement.addEventListener("blur",this.onBlur.bind(this)),this.inputElement.addEventListener("click",this.handleMouseCaretPositionChange.bind(this)),this.inputElement.addEventListener("keydown",this.handleKeyboard.bind(this)),this.inputElement.addEventListener("beforeinput",this.handleInput.bind(this)),this.inputElement.addEventListener("pointerdown",this.onPointerDown.bind(this)),this.inputElement.addEventListener("paste",this.onPaste.bind(this)),(0,o.EA)(this,this.inputElement,{includeAttrs:["label","label-type","placeholder","disabled","readonly","bordered","required","full-width","st-host-direction","pattern","bordered","data-errormessage-value-missing","data-errormessage-pattern-mismatch","data-errormessage-range-underflow","data-errormessage-range-overflow","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"]})}handleInput(e){e.preventDefault(),this.handleSelectAll(),e.data&&(0,h.Et)(e.data)?(this.parseDigits(e.data),this.updateCountersDisplay()):e.inputType&&this.handleNavKeys(e)}initPopover(){this.baseElement.trigger=["click"],this.baseElement.withBackdrop=!0,this.baseElement.renderer=this.#n.bind(this),this.baseElement.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()})}handleSelectAll(){this.isSelectAll&&this.selectFirstCounter()}#r;#n(e){e.firstChild||(this.overlay.positionTarget=this.shadowRoot.querySelector(".toggle-calendar"),e.appendChild(this.#a()),(0,h.Xs)(this.baseElement),this.backdrop.addEventListener("click",this.closePopover.bind(this))),e.style.setProperty("visibility","hidden"),setTimeout(()=>{this.#o(e),e.style.setProperty("visibility","visible"),this.updateCalendarView(e)},100)}#o(){const e=this.shadowRoot.querySelector("vaadin-popover").shadowRoot;this.#r?.replaceSync("vaadin-popover-overlay::part(overlay) { transform: none; }");const t=document.body.getBoundingClientRect(),i=this.getBoundingClientRect(),n=this.calendar.getBoundingClientRect(),r=this.isRTL?"right":"left",a=i[r]-n[r],o=n.left,l=t.width-n.right;let h;h=a>0?Math.min(a,l):-1*Math.min(Math.abs(a),o);const u=`\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${h}px);\n }\n `;this.#r?this.#r.replaceSync(u):this.#r=(0,s.fz)(u,e)}#a(){const e=document.createElement("span");e.innerHTML="<descope-calendar></descope-calendar>";const t=e.querySelector("descope-calendar");return t.addEventListener("date-submit",this.onCalendarSubmit.bind(this)),t.addEventListener("cancel",this.closePopover.bind(this)),e}#s(){this.overlay._attachOverlay=()=>this.overlay.bringToFront(),this.overlay._detachOverlay=()=>{},this.overlay._enterModalState=()=>{}}onPopoverToggle(){this.opened?this.closePopover():this.openPopover()}openPopover(){this.disableCalendar||this.setAttribute("opened","true")}closePopover(){this.removeAttribute("opened"),this.inputElement.focus()}getCounterById(e){return this.dateCounters.find(t=>t.id===e)}onCalendarSubmit(){if(!this.isReadOnly){if(!this.calendar.value)return;const e=(0,g.N)(this.calendar.value);this.value=(0,h.xq)(e,this.isUtcTime),this.getCounterById("year").replaceValue(e.getFullYear()),this.getCounterById("month").replaceValue(e.getMonth()+1),this.getCounterById("day").replaceValue(e.getDate()),this.#i()}this.closePopover()}updateCalendarView(){const e=(0,h.mZ)((0,g.N)(this.inputElement.value||"").getTime())&&u.F[this.format].validate(this.inputElement.value);this.displayValueEpoch||e?this.calendar.setAttribute("initial-value",(0,h.jO)(this.displayValueEpoch||this.epoch,c.wJ)):(this.calendar.clearValue(),this.calendar.setAttribute("preview",(0,h.jO)((0,h.Ln)(),c.wJ))),(0,o.EA)(this,this.calendar,{includeAttrs:["st-host-direction","readonly","initial-month","initial-year","years-range","calendar-label-submit","calendar-label-cancel","calendar-months","calendar-weekdays","calendar-weekdays-short"]})}onPointerDown(e){setTimeout(()=>this.handleMouseCaretPositionChange(e),c.SZ)}onFocus(){this.isReadOnly||setTimeout(()=>this.resetDisplay())}resetDisplay(){this.inputElement.value||(this.inputElement.value=this.format),this.selectFirstCounter(),this.inputElement.setSelectionRange(0,this.sortedCounters[0].length)}onBlur(){this.opened||this.inputElement.value===this.format&&this.clearInputEle()}clearInputEle(){this.inputElement.value=""}onFormatUpdate(e){Object.keys(u.F).includes(e)&&(this.format=e,this.updateFormatPattern())}updateFormatPattern(){const e=this.getAttribute("format")||this.format||c.ui;this.setAttribute("type","date"),this.setAttribute("pattern",u.F[e].pattern)}parseDigits(e){this.activeCounter.add(e),this.activeCounter.isFull&&this.selectNextCounter(),this.setInputSelectionRange()}getCounterIdx(e){const[t,i]=this.sortedCounters.map(e=>e.length);return[e<=t,e>=t&&e<=t+i+1,e>=t+i+2].indexOf(!0)}setSelectedCounterByCaretPosition(e){this.selectedCounterIdx=this.getCounterIdx(e.target?.selectionStart||this.inputElement.selectionStart)}selectFirstCounter(){this.selectedCounterIdx=0}selectNextCounter(){this.selectedCounterIdx<this.dateCounters.length&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx+1,2))}selectPrevCounter(){this.selectedCounterIdx>0&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx-1,1))}setInputSelectionRange(){this.selectedCounterIdx<0||setTimeout(()=>{const e=this.sortedCounters.slice(0,this.selectedCounterIdx).reduce((e,t)=>e+t.length,this.selectedCounterIdx);this.inputElement.setSelectionRange(e,e+this.sortedCounters[this.selectedCounterIdx].length)})}resetDateCounters(){this.dateCounters.forEach(e=>e.clear())}updateDateCounters(e){this.dateCounters.forEach(t=>{switch(t.id){case c.rR.MONTH.id:t.set(this.isUtcTime?e.getUTCMonth()+1:e.getMonth()+1);break;case c.rR.YEAR.id:t.set(this.isUtcTime?e.getUTCFullYear():e.getFullYear());break;case c.rR.DAY.id:t.set(this.isUtcTime?e.getUTCDate():e.getDate())}})}handleKeyboard(e){e.metaKey||e.ctrlKey?"x"===e.key.toLowerCase()&&this.onCut(e):(this.handleSelectAll(),"ArrowUp"===e.key?this.activeCounter.inc():"ArrowDown"===e.key?this.activeCounter.dec():"ArrowRight"===e.key?this.selectNextCounter():"ArrowLeft"===e.key&&this.selectPrevCounter(),this.setInputSelectionRange())}handleNavKeys(e){this.isReadOnly||(this.opened&&this.closePopover(),this.activeCounter&&("deleteContentBackward"===e.inputType&&this.handleBackspace(),this.setInputSelectionRange()))}handleBackspace(){if(this.isSelectAll)return void this.resetToInitialState();const e=this.activeCounter;e.isEmpty?(this.selectPrevCounter(),this.setInputSelectionRange()):e.set(""),setTimeout(()=>{this.updateCountersDisplay(),this.setInputSelectionRange()})}handleMouseCaretPositionChange(e){this.opened||(e.preventDefault(),this.setSelectedCounterByCaretPosition(e),this.setInputSelectionRange())}onInitialValueChange(e){this.value||setTimeout(()=>{Number.isNaN(parseInt(e,10))||(this.value=Number(e))})}togglePopoverAccess(e){e?this.popoverToggleButton.classList.remove("hidden"):this.popoverToggleButton.classList.add("hidden")}attributeChangedCallback(e,t,i){super.attributeChangedCallback?.(e,t,i),t!==i&&("disable-calendar"===e&&this.togglePopoverAccess("true"!==i),y.includes(e)?(i&&"format"===e&&this.onFormatUpdate(i),"initial-value"===e&&this.onInitialValueChange(i)):C.includes(e)&&(i?this.calendar?.setAttribute(e,i):this.calendar?.removeAttribute(e)))}isInvalidDate(){const e=this.getCounterById("year"),t=e.numberValue>c.nr.year.max||e.numberValue<c.nr.year.min,i=Object.entries(this.getDateVals()).some(([e,t])=>{const i=this.getCounterById(e);return!t||i.numberValue!==t});return t||i}getValidity(){return this.isRequired&&this.isCountersEmpty?{valueMissing:!0}:this.isCountersOutOfRange||this.isInvalidDate()?{patternMismatch:!0}:{}}getDateVals(){const e={day:"",month:"",year:""};if(Number.isNaN(this.epoch))return e;try{const t=new Date(this.epoch);this.isUtcTime?(e.month=t.getUTCMonth()+1,e.day=t.getUTCDate(),e.year=t.getUTCFullYear()):(e.month=t.getMonth()+1,e.day=t.getDate(),e.year=t.getFullYear())}catch(e){}return e}resetToInitialState(){this.resetDateCounters(),this.selectFirstCounter(),this.resetDisplay()}onCut(e){e.preventDefault(),this.isSelectAll?(this.#l(this.countersValue),this.resetToInitialState()):(this.#l(this.activeCounter.stringValue),this.activeCounter.set("")),this.setInputSelectionRange()}#l(e){try{navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy date value:",e)}}onPaste(e){e.preventDefault();const t=(e.clipboardData||window.clipboardData).getData("Text"),i=(0,h.Rm)(t,this.format);if(i)this.value=(0,h.xq)(i,this.isUtcTime),this.onDateCounterChange(),setTimeout(()=>this.inputElement.setSelectionRange(0,this.inputElement.value.length));else{const e=Number(t);e&&this.activeCounter.min<=e&&this.activeCounter.max>=e&&(this.activeCounter.set(String(e)),setTimeout(()=>this.setInputSelectionRange()))}}});customElements.define(m,P)}}]);
2
2
  //# sourceMappingURL=descope-date-field-index-js.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-date-field-index-js.js","mappings":"0NAiBO,MAAMA,GAAgB,QAAiB,cAExCC,EAAgB,CAAC,OAAQ,aAAc,qBA+EhCC,GAAiB,SAC5B,QAAiB,CACfC,SAAU,MAEZ,MACA,QAAgB,CACdC,WAAY,CAAC,QAAS,iBAAkB,gBACxCC,iBAAiB,IAEnB,KAtFmBC,GACnB,cAA6BA,EAC3B,6BAAWC,GACT,OAAON,EAAcO,OAAOF,EAAWC,oBAAsB,GAC/D,CAEAE,KAEA,IAAAC,GACEC,MAAMD,QACR,CAEA,qBAAAE,CAAsBC,GACpB,IAAKA,EAEH,YADAC,KAAKL,MAAMM,SAIb,MAAMC,EAAiB,CACrBP,KAAM,gBAC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kBAAkB,EAAG3S,KAAKgL,aAAa/J,MAAMgG,aAC3E,CACL,MAAMhG,EAAQkG,OAAO2O,GAGjB7U,GAASjB,KAAK+M,cAAcnG,KAAO3F,GAASjB,KAAK+M,cAAclG,KAAO5F,IAExEjB,KAAK+M,cAAcrF,IAAIyO,OAAOlV,IAE9BC,WAAW,IAAMlB,KAAKiT,0BAE1B,CACF,ICj2BF/Q,eAAeC,OAAOjD,EAAeoK,E","sources":["webpack://@descope/web-components-ui/../components/descope-text-field/src/component/TextFieldClass.js","webpack://@descope/web-components-ui/../components/descope-text-field/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-text-field/src/component/textFieldMappings.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateCounterClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/index.js"],"sourcesContent":["import {\n createStyleMixin,\n draggableMixin,\n createProxy,\n proxyInputMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport {\n inputFloatingLabelStyle,\n resetInputLabelPosition,\n resetInputOverrides,\n useHostExternalPadding,\n} from '@descope-ui/common/theme-helpers';\nimport textFieldMappings from './textFieldMappings';\n\nexport const componentName = getComponentName('text-field');\n\nconst observedAttrs = ['type', 'label-type', 'copy-to-clipboard'];\n\nconst customMixin = (superclass) =>\n class TextFieldClass extends superclass {\n static get observedAttributes() {\n return observedAttrs.concat(superclass.observedAttributes || []);\n }\n\n icon;\n\n init() {\n super.init?.();\n }\n\n renderCopyToClipboard(shouldRender) {\n if (!shouldRender) {\n this.icon?.remove();\n return;\n }\n\n const iconInitConfig = {\n icon: 'vaadin:copy-o',\n title: 'Copy',\n style: 'cursor: pointer',\n };\n\n const iconCopiedConfig = {\n icon: 'vaadin:check-circle-o',\n title: 'Copied',\n style: 'cursor: initial',\n };\n\n this.icon = Object.assign(document.createElement('vaadin-icon'), {\n slot: 'suffix',\n ...iconInitConfig,\n });\n\n this.baseElement.appendChild(this.icon);\n this.icon.addEventListener('click', () => {\n navigator.clipboard.writeText(this.value);\n Object.assign(this.icon, iconCopiedConfig);\n\n // we want the icon to go back to the initial state after 5 seconds\n setTimeout(() => {\n Object.assign(this.icon, iconInitConfig);\n }, 5000);\n });\n }\n\n onLabelClick() {\n this.focus();\n }\n\n attributeChangedCallback(attrName, oldVal, newVal) {\n super.attributeChangeCallback?.(attrName, oldVal, newVal);\n\n // Vaadin doesn't allow to change the input type attribute.\n // We need the ability to do that, so we're overriding their\n // behavior with their private API.\n // When receiving a `type` attribute, we use their private API\n // to set it on the input.\n if (attrName === 'type') {\n this.baseElement._setType(newVal);\n }\n\n if (oldVal !== newVal) {\n if (attrName === 'label-type') {\n if (newVal === 'floating') {\n this.addEventListener('click', this.onLabelClick);\n } else {\n this.removeEventListener('click', this.onLabelClick);\n }\n } else if (attrName === 'copy-to-clipboard') {\n this.renderCopyToClipboard(newVal === 'true');\n }\n }\n }\n };\n\nexport const TextFieldClass = compose(\n createStyleMixin({\n mappings: textFieldMappings,\n }),\n draggableMixin,\n proxyInputMixin({\n proxyProps: ['value', 'selectionStart', 'selectionEnd'],\n useProxyTargets: true,\n }),\n componentNameValidationMixin,\n customMixin,\n)(\n createProxy({\n slots: ['prefix', 'suffix'],\n wrappedEleName: 'vaadin-text-field',\n style: () => `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${TextFieldClass.cssVarList.inputOutlineWidth}) + var(${\n TextFieldClass.cssVarList.inputOutlineOffset\n }));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type=\"floating\"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type=\"floating\"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${resetInputLabelPosition('vaadin-text-field')}\n\t\t\t${useHostExternalPadding(TextFieldClass.cssVarList)}\n\t\t\t${resetInputOverrides('vaadin-text-field', TextFieldClass.cssVarList)}\n ${inputFloatingLabelStyle()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n }),\n);\n","import '@vaadin/text-field';\nimport '@vaadin/icons';\nimport '@vaadin/icon';\n\nimport { componentName, TextFieldClass } from './TextFieldClass';\n\ncustomElements.define(componentName, TextFieldClass);\n\nexport { TextFieldClass, componentName };\n","const {\n host,\n label,\n placeholder,\n requiredIndicator,\n inputField,\n input,\n inputMask,\n helperText,\n errorMessage,\n disabledPlaceholder,\n inputDisabled,\n inputIcon,\n externalInput,\n externalInputDisabled,\n externalPlaceholder,\n externalDisabledPlaceholder,\n} = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n requiredIndicator: {\n selector: '[required]::part(required-indicator)::after',\n },\n placeholder: [\n { selector: '> input:placeholder-shown' },\n { selector: () => ':host::slotted(input:placeholder-shown)' },\n ],\n disabledPlaceholder: { selector: '> input:disabled::placeholder' },\n inputField: { selector: '::part(input-field)' },\n input: { selector: 'input' },\n inputMask: { selector: '::part(input-field)::before' },\n inputDisabled: { selector: 'input:disabled' },\n helperText: { selector: '::part(helper-text)' },\n errorMessage: { selector: '::part(error-message)' },\n inputIcon: { selector: 'vaadin-icon' },\n externalInput: { selector: () => '::slotted(input)' },\n externalInputDisabled: { selector: () => '::slotted(input:disabled)' },\n externalPlaceholder: { selector: () => '::slotted(input:placeholder-shown)' },\n externalDisabledPlaceholder: {\n selector: () => '::slotted(input:disabled::placeholder)',\n },\n};\n\nexport default {\n // we apply font-size also on the host so we can set its width with em\n fontSize: [{}, host],\n fontFamily: [label, inputField, helperText, errorMessage],\n\n labelFontSize: { ...label, property: 'font-size' },\n labelFontWeight: { ...label, property: 'font-weight' },\n\n inputValueFontWeight: [\n { ...input, property: 'font-weight' },\n { ...externalInput, property: 'font-weight' },\n ],\n inputPlaceholderFontWeight: [\n {\n selector: () => ':host input:placeholder-shown',\n property: 'font-weight',\n },\n { ...externalPlaceholder, property: 'font-weight' },\n ],\n helperTextFontWeight: { ...helperText, property: 'font-weight' },\n errorMessageFontWeight: { ...errorMessage, property: 'font-weight' },\n\n labelTextColor: [\n { ...label, property: 'color' },\n { ...requiredIndicator, property: 'color' },\n { ...label, property: '-webkit-text-fill-color' },\n { ...requiredIndicator, property: '-webkit-text-fill-color' },\n ],\n\n hostWidth: { ...host, property: 'width' },\n hostMinWidth: { ...host, property: 'min-width' },\n hostDirection: { ...host, property: 'direction' },\n inputDirection: { ...input, property: 'direction' },\n\n inputBackgroundColor: [\n { ...inputField, property: 'background-color' },\n { ...inputMask, property: 'background-color' },\n ],\n\n errorMessageTextColor: { ...errorMessage, property: 'color' },\n errorMessageIcon: { ...errorMessage, property: 'background-image' },\n errorMessageIconSize: { ...errorMessage, property: 'background-size' },\n errorMessageIconPadding: {\n ...errorMessage,\n property: 'padding-inline-start',\n },\n errorMessageIconRepeat: { ...errorMessage, property: 'background-repeat' },\n errorMessageIconPosition: {\n ...errorMessage,\n property: 'background-position',\n },\n errorMessageFontSize: { ...errorMessage, property: 'font-size' },\n\n helperTextColor: { ...helperText, property: '-webkit-text-fill-color' },\n\n inputValueTextColor: [\n { ...inputField, property: 'color' },\n { ...inputDisabled, property: '-webkit-text-fill-color' },\n { ...externalInputDisabled, property: '-webkit-text-fill-color' },\n ],\n inputCaretTextColor: [\n { ...input, property: 'caret-color' },\n { ...externalInput, property: 'caret-color' },\n ],\n\n labelRequiredIndicator: { ...requiredIndicator, property: 'content' },\n\n inputBorderColor: { ...inputField, property: 'border-color' },\n inputBorderWidth: { ...inputField, property: 'border-width' },\n inputBorderStyle: { ...inputField, property: 'border-style' },\n inputBorderRadius: { ...inputField, property: 'border-radius' },\n\n inputHeight: { ...inputField, property: 'height' },\n inputHorizontalPadding: [\n { ...input, property: 'padding-left' },\n { ...input, property: 'padding-right' },\n { ...externalInput, property: 'padding-left' },\n { ...externalInput, property: 'padding-right' },\n ],\n\n inputOutlineColor: { ...inputField, property: 'outline-color' },\n inputOutlineStyle: { ...inputField, property: 'outline-style' },\n inputOutlineWidth: { ...inputField, property: 'outline-width' },\n inputOutlineOffset: { ...inputField, property: 'outline-offset' },\n\n textAlign: {},\n\n inputTextAlign: [\n { ...input, property: 'text-align' },\n { ...externalInput, property: 'text-align' },\n ],\n\n inputPlaceholderColor: [\n { selector: () => ':host input:placeholder-shown', property: 'color' },\n { ...externalPlaceholder, property: 'color' },\n { ...placeholder, property: 'color' },\n { ...disabledPlaceholder, property: '-webkit-text-fill-color' },\n { ...externalDisabledPlaceholder, property: '-webkit-text-fill-color' },\n ],\n\n labelPosition: { ...label, property: 'position' },\n labelTopPosition: { ...label, property: 'top' },\n labelHorizontalPosition: [\n { ...label, property: 'left' },\n { ...label, property: 'right' },\n ],\n inputTransformY: { ...label, property: 'transform' },\n inputTransition: { ...label, property: 'transition' },\n marginInlineStart: { ...label, property: 'margin-inline-start' },\n placeholderOpacity: [\n { selector: '> input:placeholder-shown', property: 'opacity' },\n { ...externalPlaceholder, property: 'opacity' },\n ],\n inputVerticalAlignment: [\n { ...inputField, property: 'align-items' },\n { ...externalInput, property: 'align-items' },\n ],\n valueInputHeight: [\n { ...input, property: 'height' },\n { ...externalInput, property: 'height' },\n ],\n valueInputMarginBottom: [\n { ...input, property: 'margin-bottom' },\n { ...externalInput, property: 'margin-bottom' },\n ],\n\n inputIconOffset: [\n { ...inputIcon, property: 'margin-right' },\n { ...inputIcon, property: 'margin-left' },\n ],\n inputIconSize: { ...inputIcon, property: 'font-size' },\n inputIconColor: { ...inputIcon, property: 'color' },\n inputTextSecurity: [\n { ...input, property: '-webkit-text-security' },\n { ...input, property: 'text-security' },\n { ...externalInput, property: '-webkit-text-security' },\n { ...externalInput, property: 'text-security' },\n ],\n};\n","// DateCounterClass allows us to add several counters to the input, and use them seperately.\n// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate\n// between different ranges.\nexport class DateCounter {\n #data = Object.freeze([]);\n\n constructor({ id, min, max, placeholder }, onChange) {\n this.id = id;\n this.min = min;\n this.max = max;\n this.placeholder = placeholder;\n this.onChange = onChange;\n }\n\n get data() {\n return this.#data;\n }\n\n set data(val) {\n this.#data = Object.freeze(val);\n this.onChange?.();\n }\n\n get #initialNumValue() {\n return this.data.length ? this.numberValue : 0;\n }\n\n get numberValue() {\n return Number(this.stringValue);\n }\n\n get stringValue() {\n return (this.data.join('') || this.placeholder).padStart(this.length, '0');\n }\n\n get isFull() {\n return this.numberValue * 10 > this.max || this.data.length === this.length;\n }\n\n get isEmpty() {\n return this.stringValue === this.placeholder;\n }\n\n get length() {\n return this.max.toString().length;\n }\n\n set(val) {\n this.data = val.toString().split('');\n }\n\n add(num) {\n // use local var to avoid triggering onChange\n let { data } = this;\n\n data = [...data, num];\n\n // we need to re-evaluate the number value\n const numVal = Number(data.join(''));\n\n if (numVal > this.max) {\n data = [num];\n } else if (this.length < data.length) {\n data = data.slice(1, data.length);\n }\n\n this.data = data;\n\n return num;\n }\n\n del() {\n if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {\n this.data = [];\n } else {\n this.data = this.data.slice(0, this.data.length - 1);\n }\n }\n\n clear() {\n this.data = [];\n }\n\n inc(gap) {\n this.replaceValue(\n this.#initialNumValue < this.max\n ? Math.max(this.#initialNumValue + (gap || 1), this.min)\n : this.min\n );\n }\n\n dec(gap) {\n this.replaceValue(\n this.#initialNumValue > this.min\n ? Math.min(this.#initialNumValue - (gap || 1), this.max)\n : this.max\n );\n }\n\n isInRange(val) {\n return val >= this.min && val <= this.max;\n }\n\n replaceValue(val) {\n if (this.isInRange(val)) {\n this.data = val.toString().padStart(this.length, 0).split('');\n }\n }\n\n setMin(val) {\n this.min = Number(val);\n }\n\n setMax(val) {\n this.max = Number(val);\n }\n}\n","import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { TextFieldClass } from '@descope-ui/descope-text-field/class';\nimport { createBaseInputClass } from '../../baseClasses/createBaseInputClass';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n portalMixin,\n} from '../../mixins';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { compose } from '../../helpers';\nimport {\n isValidEpoch,\n formatEpoch,\n isNumber,\n getCurrentTime,\n overrideConstructedStylesheet,\n dateToEpoch,\n parseDateString,\n} from './helpers';\nimport { formats } from './formats';\nimport { calendarIcon } from './icons';\nimport {\n counterConfig,\n DEFAULT_FORMAT,\n DIVIDER,\n MOBILE_DEVICE_INTERACTION_TIMEOUT_MS,\n NATIVE_FORMAT,\n valRange,\n} from './consts';\nimport { DateCounter } from './DateCounterClass';\nimport { newDate } from './date-utils';\n\nexport const componentName = getComponentName('date-field');\n\n// we set baseSelector to `vaadin-popover` as a temporary hack, so our portalMixin will\n// be able to process this component's overlay. The whole process needs refactoring as soon as possible.\nconst BASE_SELECTOR = 'vaadin-popover';\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: BASE_SELECTOR });\n\nconst dateFieldAttrs = [\n 'format',\n 'opened',\n 'initial-value',\n 'readonly',\n 'disable-calendar',\n 'utc-time',\n];\nconst calendarAttrs = ['years-range', 'calendar-months', 'calendar-weekdays'];\nconst observedAttrs = [...dateFieldAttrs, ...calendarAttrs];\n\nclass RawDateFieldClass extends BaseInputClass {\n epoch = '';\n\n format = DEFAULT_FORMAT;\n\n selectedCounterIdx = 0;\n\n updateCountersDisplay() {\n this.inputElement.value = this.countersValue;\n }\n\n updateValue() {\n if (this.isCountersOutOfRange) {\n this.resetEpoch();\n } else {\n const date = formats[this.format].getDate(this.inputElement.value);\n this.updateEpoch(dateToEpoch(date, this.isUtcTime));\n }\n }\n\n onDateCounterChange = () => {\n this.updateCountersDisplay();\n this.updateValue();\n // update validity\n this.#dispatchInput();\n };\n\n updateEpoch(epoch) {\n this.epoch = dateToEpoch(epoch, this.isUtcTime);\n }\n\n dateCounters = [\n new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this)),\n ];\n\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttrs);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <descope-text-field inputmode=\"numeric\">\n <span slot=\"suffix\" class=\"toggle-calendar\">\n ${calendarIcon}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly=\"true\"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.inputElement = this.shadowRoot.querySelector('descope-text-field');\n this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n get opened() {\n return this.getAttribute('opened') === 'true';\n }\n\n // returns the input's value as a epoch\n get displayValueEpoch() {\n const date = formats[this.format].getDate(this.inputElement.value);\n\n if (!isValidEpoch(date?.getTime())) {\n return null;\n }\n\n return date.getTime();\n }\n\n get sortedCounters() {\n return this.format\n .split(DIVIDER)\n .map((placeholder) => this.dateCounters.find((dc) => dc.placeholder === placeholder));\n }\n\n get activeCounter() {\n return this.sortedCounters[this.selectedCounterIdx];\n }\n\n get countersValue() {\n return this.sortedCounters.map((dc) => dc.stringValue).join(DIVIDER);\n }\n\n get overlay() {\n return this.baseElement.shadowRoot?.querySelector('vaadin-popover-overlay');\n }\n\n get backdrop() {\n return this.overlay.shadowRoot?.querySelector('#backdrop');\n }\n\n get calendar() {\n return this.overlay?.querySelector('descope-calendar');\n }\n\n get isRTL() {\n const computedStyleDirection = getComputedStyle(this.baseElement).getPropertyValue('direction');\n\n if (computedStyleDirection) {\n return computedStyleDirection === 'rtl';\n }\n\n // Fallback: If for some reason computed style was not calculated in time, fallback to check on attribute\n return this.getAttribute('st-host-direction') === 'rtl';\n }\n\n get value() {\n if (this.isInvalidDate()) {\n return '';\n }\n return this.epoch;\n }\n\n set value(val) {\n const value = parseInt(val, 10);\n if (!Number.isNaN(value)) {\n this.updateEpoch(value);\n this.updateDateCounters(new Date(value));\n } else {\n this.resetEpoch();\n this.resetDateCounters();\n this.clearInputEle();\n }\n }\n\n resetEpoch() {\n this.epoch = '';\n }\n\n get isCountersEmpty() {\n return this.dateCounters.every((dc) => dc.isEmpty);\n }\n\n get isCountersOutOfRange() {\n return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));\n }\n\n get disableCalendar() {\n return this.getAttribute('disable-calendar') === 'true';\n }\n\n get isUtcTime() {\n return this.getAttribute('utc-time') === 'true';\n }\n\n get isSelectAll() {\n const inputEle = this.inputElement.baseElement.inputElement;\n return inputEle.value.length === inputEle.selectionStart + inputEle.selectionEnd;\n }\n\n reportValidity() {\n this.inputElement.reportValidity();\n }\n\n #dispatchInput() {\n this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n updateInputDisplay() {\n this.inputElement.value = formatEpoch(newDate(this.countersValue).getTime(), this.format);\n }\n\n init() {\n super.init?.();\n\n this.updateFormatPattern();\n this.initPopover();\n this.onDateCounterChange();\n this.initInputElement();\n\n setTimeout(() => {\n this.#overrideOverlaySettings();\n }, 0);\n }\n\n initInputElement() {\n this.inputElement.getValidity = this.getValidity.bind(this);\n this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);\n\n this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));\n\n this.inputElement.addEventListener('focus', this.onFocus.bind(this));\n this.inputElement.addEventListener('blur', this.onBlur.bind(this));\n this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));\n this.inputElement.addEventListener('keydown', this.handleKeyboard.bind(this));\n this.inputElement.addEventListener('beforeinput', this.handleInput.bind(this));\n this.inputElement.addEventListener('pointerdown', this.onPointerDown.bind(this));\n this.inputElement.addEventListener('paste', this.onPaste.bind(this));\n\n forwardAttrs(this, this.inputElement, {\n includeAttrs: [\n 'label',\n 'label-type',\n 'placeholder',\n 'disabled',\n 'readonly',\n 'bordered',\n 'required',\n 'full-width',\n 'st-host-direction',\n 'pattern',\n 'bordered',\n 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch',\n 'data-errormessage-range-underflow',\n 'data-errormessage-range-overflow',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n });\n }\n\n handleInput(e) {\n e.preventDefault();\n\n this.handleSelectAll();\n\n if (e.data && isNumber(e.data)) {\n this.parseDigits(e.data);\n this.updateCountersDisplay();\n } else if (e.inputType) {\n this.handleNavKeys(e);\n }\n }\n\n initPopover() {\n this.baseElement.trigger = ['click'];\n this.baseElement.withBackdrop = true;\n this.baseElement.renderer = this.#popoverRenderer.bind(this);\n\n // block popover events from focusing/blurring the text-field\n this.baseElement.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n }\n\n handleSelectAll() {\n if (this.isSelectAll) {\n this.selectFirstCounter();\n }\n }\n\n #popoverPosStylesheet;\n\n #popoverRenderer(root) {\n // popoverRenderer should run only once, when the popover is first rendering.\n if (!root.firstChild) {\n this.overlay.positionTarget = this.shadowRoot.querySelector('.toggle-calendar');\n\n root.appendChild(this.#getPopoverContent());\n\n // override vaadin's constructed stylesheet which hides the host element\n overrideConstructedStylesheet(this.baseElement);\n\n this.backdrop.addEventListener('click', this.closePopover.bind(this));\n }\n\n // Hide overlay before adjusting position to prevent flickering\n root.style.setProperty('visibility', 'hidden');\n\n // Wait until overlay is ready\n setTimeout(() => {\n this.#adjustPopoverPosition(root);\n\n // Show adjusted overlay\n root.style.setProperty('visibility', 'visible');\n this.updateCalendarView(root);\n }, 100);\n }\n\n #adjustPopoverPosition() {\n const popover = this.shadowRoot.querySelector('vaadin-popover').shadowRoot;\n\n // Reset any previous transform so getBoundingClientRect measures the natural position\n this.#popoverPosStylesheet?.replaceSync(\n `vaadin-popover-overlay::part(overlay) { transform: none; }`\n );\n\n const windowRect = document.body.getBoundingClientRect();\n const inputRect = this.getBoundingClientRect();\n const calendarRect = this.calendar.getBoundingClientRect();\n\n const side = this.isRTL ? 'right' : 'left';\n const offset = inputRect[side] - calendarRect[side];\n const availableLeft = calendarRect.left;\n const availableRight = windowRect.width - calendarRect.right;\n\n let newOffset;\n if (offset > 0) {\n newOffset = Math.min(offset, availableRight);\n } else {\n newOffset = Math.min(Math.abs(offset), availableLeft) * -1;\n }\n\n const css = `\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${newOffset}px);\n }\n `;\n\n if (this.#popoverPosStylesheet) {\n this.#popoverPosStylesheet.replaceSync(css);\n } else {\n this.#popoverPosStylesheet = injectStyle(css, popover);\n }\n }\n\n #getPopoverContent() {\n const ele = document.createElement('span');\n\n ele.innerHTML = `<descope-calendar></descope-calendar>`;\n\n const calendar = ele.querySelector('descope-calendar');\n\n calendar.addEventListener('date-submit', this.onCalendarSubmit.bind(this));\n calendar.addEventListener('cancel', this.closePopover.bind(this));\n\n return ele;\n }\n\n // the default vaadin behavior is to attach the overlay to the body when opened\n // we do not want that because it's difficult to style the overlay in this way\n // so we override it to open inside the shadow DOM\n #overrideOverlaySettings() {\n this.overlay._attachOverlay = () => this.overlay.bringToFront();\n this.overlay._detachOverlay = () => {};\n this.overlay._enterModalState = () => {};\n }\n\n onPopoverToggle() {\n this.opened ? this.closePopover() : this.openPopover();\n }\n\n openPopover() {\n if (this.disableCalendar) return;\n this.setAttribute('opened', 'true');\n }\n\n closePopover() {\n this.removeAttribute('opened');\n this.inputElement.focus();\n }\n\n getCounterById(id) {\n return this.dateCounters.find((dc) => dc.id === id);\n }\n\n onCalendarSubmit() {\n if (!this.isReadOnly) {\n if (!this.calendar.value) return;\n\n const calendarDate = newDate(this.calendar.value);\n\n this.value = dateToEpoch(calendarDate, this.isUtcTime);\n\n this.getCounterById('year').replaceValue(calendarDate.getFullYear());\n this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);\n this.getCounterById('day').replaceValue(calendarDate.getDate());\n\n this.#dispatchInput();\n }\n\n this.closePopover();\n }\n\n updateCalendarView() {\n const validInputVal =\n isValidEpoch(newDate(this.inputElement.value || '').getTime()) &&\n formats[this.format].validate(this.inputElement.value);\n\n if (this.displayValueEpoch || validInputVal) {\n this.calendar.setAttribute(\n 'initial-value',\n formatEpoch(this.displayValueEpoch || this.epoch, NATIVE_FORMAT)\n );\n } else {\n this.calendar.clearValue();\n this.calendar.setAttribute('preview', formatEpoch(getCurrentTime(), NATIVE_FORMAT));\n }\n\n forwardAttrs(this, this.calendar, {\n includeAttrs: [\n 'st-host-direction',\n 'readonly',\n 'initial-month',\n 'initial-year',\n 'years-range',\n 'calendar-label-submit',\n 'calendar-label-cancel',\n 'calendar-months',\n 'calendar-weekdays',\n 'calendar-weekdays-short',\n ],\n });\n }\n\n // In mobile devices, there are cases were `pointerdown` is triggered\n // instead of `click`.\n onPointerDown(e) {\n setTimeout(() => this.handleMouseCaretPositionChange(e), MOBILE_DEVICE_INTERACTION_TIMEOUT_MS);\n }\n\n onFocus() {\n if (this.isReadOnly) {\n return;\n }\n\n // We need to wait for focus to end before we set selection\n setTimeout(() => this.resetDisplay());\n }\n\n resetDisplay() {\n if (!this.inputElement.value) {\n this.inputElement.value = this.format;\n }\n\n // On focus select the first counter\n this.selectFirstCounter();\n // set selection on first counter\n this.inputElement.setSelectionRange(0, this.sortedCounters[0].length);\n }\n\n onBlur() {\n if (this.opened) {\n return;\n }\n\n if (this.inputElement.value === this.format) {\n this.clearInputEle();\n }\n }\n\n clearInputEle() {\n this.inputElement.value = '';\n }\n\n onFormatUpdate(format) {\n if (Object.keys(formats).includes(format)) {\n this.format = format;\n this.updateFormatPattern();\n }\n }\n\n updateFormatPattern() {\n const format = this.getAttribute('format') || this.format || DEFAULT_FORMAT;\n this.setAttribute('type', 'date');\n this.setAttribute('pattern', formats[format].pattern);\n }\n\n parseDigits(value) {\n this.activeCounter.add(value);\n\n if (this.activeCounter.isFull) {\n this.selectNextCounter();\n }\n\n // We wait for the digit to be parsed, and only then set the selection.\n // Failing to do so results in unexpected \"jump\" of the screen in mobile devices.\n this.setInputSelectionRange();\n }\n\n getCounterIdx(caretPos) {\n const [counter1ln, counter2ln] = this.sortedCounters.map((dc) => dc.length);\n\n const c1 = caretPos <= counter1ln;\n const c2 = caretPos >= counter1ln && caretPos <= counter1ln + counter2ln + 1;\n const c3 = caretPos >= counter1ln + counter2ln + 2;\n\n return [c1, c2, c3].indexOf(true);\n }\n\n setSelectedCounterByCaretPosition(e) {\n this.selectedCounterIdx = this.getCounterIdx(\n // if triggered by touch event, target might not include `selectionStart`\n // in that case we fall back to the inputElement's `selectionStart` value.\n // Therefore, it is recommended to run this function with setTimeout,\n // at least for mobile events.\n e.target?.selectionStart || this.inputElement.selectionStart\n );\n }\n\n selectFirstCounter() {\n this.selectedCounterIdx = 0;\n }\n\n selectNextCounter() {\n if (this.selectedCounterIdx < this.dateCounters.length) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx + 1, 2);\n }\n }\n\n selectPrevCounter() {\n if (this.selectedCounterIdx > 0) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx - 1, 1);\n }\n }\n\n // Sets the text selection range in the input element based on the selected counter.\n // The function calculates the starting position of the selection by summing the lengths\n // of all counters before the currently selected counter (`selectedCounterIdx`).\n // It then selects the entire length of the current counter in the input element.\n setInputSelectionRange() {\n // For preview/readonly state we don't have a caret or a caretIdx, so we skip setting input selection range\n if (this.selectedCounterIdx < 0) {\n return;\n }\n\n // We wait for before setting the selection, otherwise there's an\n // unexpected \"jump\" of the screen in mobile devices.\n setTimeout(() => {\n const caretStart = this.sortedCounters\n .slice(0, this.selectedCounterIdx)\n .reduce((acc, counter) => acc + counter.length, this.selectedCounterIdx);\n\n this.inputElement.setSelectionRange(\n caretStart,\n caretStart + this.sortedCounters[this.selectedCounterIdx].length\n );\n });\n }\n\n resetDateCounters() {\n this.dateCounters.forEach((dc) => dc.clear());\n }\n\n // in case value is set from external source we need to update date counters\n updateDateCounters(date) {\n this.dateCounters.forEach((dc) => {\n switch (dc.id) {\n case counterConfig.MONTH.id:\n dc.set(this.isUtcTime ? date.getUTCMonth() + 1 : date.getMonth() + 1);\n break;\n case counterConfig.YEAR.id:\n dc.set(this.isUtcTime ? date.getUTCFullYear() : date.getFullYear());\n break;\n case counterConfig.DAY.id:\n dc.set(this.isUtcTime ? date.getUTCDate() : date.getDate());\n break;\n default:\n break;\n }\n });\n }\n\n handleKeyboard(e) {\n if (e.metaKey || e.ctrlKey) {\n if (e.key.toLowerCase() === 'x') {\n this.onCut(e);\n }\n\n return;\n }\n\n this.handleSelectAll();\n\n if (e.key === 'ArrowUp') {\n this.activeCounter.inc();\n } else if (e.key === 'ArrowDown') {\n this.activeCounter.dec();\n } else if (e.key === 'ArrowRight') {\n this.selectNextCounter();\n } else if (e.key === 'ArrowLeft') {\n this.selectPrevCounter();\n }\n\n this.setInputSelectionRange();\n }\n\n handleNavKeys(e) {\n if (this.isReadOnly) {\n return;\n }\n\n if (this.opened) {\n this.closePopover();\n }\n\n if (!this.activeCounter) return;\n\n if (e.inputType === 'deleteContentBackward') {\n this.handleBackspace();\n }\n\n this.setInputSelectionRange();\n }\n\n handleBackspace() {\n if (this.isSelectAll) {\n this.resetToInitialState();\n return;\n }\n\n const counter = this.activeCounter;\n\n if (counter.isEmpty) {\n this.selectPrevCounter();\n this.setInputSelectionRange();\n } else {\n counter.set('');\n }\n\n // To support keyboards like SwiftKey, we need to re-render the counters display and selection,\n // otherwise we get an unexpected behavior, where the format is deleted.\n setTimeout(() => {\n this.updateCountersDisplay();\n this.setInputSelectionRange();\n });\n }\n\n handleMouseCaretPositionChange(e) {\n if (this.opened) {\n return;\n }\n\n e.preventDefault();\n\n this.setSelectedCounterByCaretPosition(e);\n this.setInputSelectionRange();\n }\n\n onInitialValueChange(val) {\n // if component already has a value don't re-set value\n if (this.value) return;\n\n // we need to wait for the text-field to init\n setTimeout(() => {\n if (Number.isNaN(parseInt(val, 10))) {\n return;\n }\n this.value = Number(val);\n });\n }\n\n togglePopoverAccess(visibility) {\n if (visibility) {\n this.popoverToggleButton.classList.remove('hidden');\n } else {\n this.popoverToggleButton.classList.add('hidden');\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'disable-calendar') {\n this.togglePopoverAccess(newValue !== 'true');\n }\n if (dateFieldAttrs.includes(attrName)) {\n if (newValue && attrName === 'format') {\n this.onFormatUpdate(newValue);\n }\n if (attrName === 'initial-value') {\n this.onInitialValueChange(newValue);\n }\n } else if (calendarAttrs.includes(attrName)) {\n if (newValue) {\n this.calendar?.setAttribute(attrName, newValue);\n } else {\n this.calendar?.removeAttribute(attrName);\n }\n }\n }\n }\n\n // we want to validate the date supplied actually exists. For example: Feb 31 is not an actual date,\n // but in JS when create a `new Date('1999-02-31') we get March 2nd 1999.\n // To prevent this error from being submitted, we evaluate the\n // date parts against their generated Date value.\n isInvalidDate() {\n const yearCounter = this.getCounterById('year');\n const isYearOutOfRange =\n yearCounter.numberValue > valRange.year.max || yearCounter.numberValue < valRange.year.min;\n\n const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {\n const counter = this.getCounterById(key);\n return !val || counter.numberValue !== val;\n });\n\n return isYearOutOfRange || isDateDisplayMismatch;\n }\n\n getValidity() {\n if (this.isRequired && this.isCountersEmpty) {\n return { valueMissing: true };\n }\n\n if (this.isCountersOutOfRange || this.isInvalidDate()) {\n return { patternMismatch: true };\n }\n\n return {};\n }\n\n getDateVals() {\n const ret = {\n day: '',\n month: '',\n year: '',\n };\n\n if (Number.isNaN(this.epoch)) {\n return ret;\n }\n\n try {\n const date = new Date(this.epoch);\n\n if (this.isUtcTime) {\n ret.month = date.getUTCMonth() + 1;\n ret.day = date.getUTCDate();\n ret.year = date.getUTCFullYear();\n } else {\n ret.month = date.getMonth() + 1;\n ret.day = date.getDate();\n ret.year = date.getFullYear();\n }\n } catch (e) {}\n\n return ret;\n }\n\n resetToInitialState() {\n this.resetDateCounters();\n this.selectFirstCounter();\n this.resetDisplay();\n }\n\n onCut(e) {\n e.preventDefault();\n\n if (this.isSelectAll) {\n this.#copyToClipboard(this.countersValue);\n this.resetToInitialState();\n } else {\n this.#copyToClipboard(this.activeCounter.stringValue);\n this.activeCounter.set('');\n }\n\n this.setInputSelectionRange();\n }\n\n #copyToClipboard(value) {\n try {\n navigator.clipboard.writeText(value);\n } catch (err) {\n console.error('Failed to copy date value:', err);\n }\n }\n\n onPaste(e) {\n e.preventDefault();\n\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n\n // try paste entire date if valid\n const validDate = parseDateString(pastedData, this.format);\n\n if (validDate) {\n this.value = dateToEpoch(validDate, this.isUtcTime);\n this.onDateCounterChange();\n\n // select all\n setTimeout(() => this.inputElement.setSelectionRange(0, this.inputElement.value.length));\n } else {\n const value = Number(pastedData);\n\n // try paste in counter if possible\n if (value && this.activeCounter.min <= value && this.activeCounter.max >= value) {\n // use String to get rid of any zero padding\n this.activeCounter.set(String(value));\n\n setTimeout(() => this.setInputSelectionRange());\n }\n }\n }\n}\n\nconst textVars = TextFieldClass.cssVarList;\nconst { host, input, inputEleRTL, toggleButton, overlay, backdrop, errorMessage } = {\n host: { selector: () => ':host' },\n input: { selector: () => 'descope-text-field' },\n inputEleRTL: { selector: () => ':host([st-host-direction=\"rtl\"]) descope-text-field' },\n toggleButton: { selector: () => '.toggle-calendar' },\n overlay: { selector: 'vaadin-popover-overlay::part(overlay)' },\n backdrop: { selector: 'vaadin-popover-overlay::part(backdrop)' },\n};\n\nexport const DateFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n iconMargin: { ...toggleButton, property: 'margin-inline-end' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n textAlign: { ...input, property: 'text-align' },\n rtlInputDirection: { ...inputEleRTL, property: textVars.inputDirection },\n rtlInputAlignment: { ...inputEleRTL, property: textVars.inputTextAlign },\n overlayGap: {\n property: () => DateFieldClass.cssVarList.overlayGap,\n },\n overlayBackgroundColor: {\n property: () => DateFieldClass.cssVarList.overlayBackgroundColor,\n },\n overlayPadding: {\n property: () => DateFieldClass.cssVarList.overlayPadding,\n },\n overlayBoxShadow: { property: () => DateFieldClass.overlayBoxShadow },\n overlayOutlineWidth: {\n property: () => DateFieldClass.cssVarList.overlayOutlineWidth,\n },\n overlayOutlineColor: {\n property: () => DateFieldClass.cssVarList.overlayOutlineColor,\n },\n overlayOutlineStyle: {\n property: () => DateFieldClass.cssVarList.overlayOutlineStyle,\n },\n errorMessageIcon: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIcon,\n },\n errorMessageIconSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconSize,\n },\n errorMessageIconPadding: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPadding,\n },\n errorMessageIconRepeat: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconRepeat,\n },\n errorMessageIconPosition: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPosition,\n },\n errorMessageFontSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontSize,\n },\n labelFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.labelFontWeight,\n },\n inputValueFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.inputValueFontWeight,\n },\n inputPlaceholderFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.inputPlaceholderFontWeight,\n },\n helperTextFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.helperTextFontWeight,\n },\n errorMessageFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontWeight,\n },\n },\n }),\n portalMixin({\n name: 'overlay',\n selector: '',\n mappings: {\n marginTop: { ...overlay, property: 'margin-top' },\n backgroundColor: { ...overlay },\n backdropBackgroundColor: { ...backdrop, property: 'background-color' },\n backdropPointerEvents: { ...backdrop, property: 'pointer-events' },\n padding: { ...overlay },\n boxShadow: { ...overlay },\n outlineWidth: { ...overlay },\n outlineColor: { ...overlay },\n outlineStyle: { ...overlay },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawDateFieldClass);\n","import '@vaadin/popover/src/vaadin-popover';\nimport './descope-calendar';\nimport '@descope-ui/descope-text-field';\n\nimport { componentName, DateFieldClass } from './DateFieldClass';\n\ncustomElements.define(componentName, DateFieldClass);\n\nexport { DateFieldClass, componentName };\n"],"names":["componentName","observedAttrs","TextFieldClass","mappings","proxyProps","useProxyTargets","superclass","observedAttributes","concat","icon","init","super","renderCopyToClipboard","shouldRender","this","remove","iconInitConfig","title","style","iconCopiedConfig","Object","assign","document","createElement","slot","baseElement","appendChild","addEventListener","navigator","clipboard","writeText","value","setTimeout","onLabelClick","focus","attributeChangedCallback","attrName","oldVal","newVal","attributeChangeCallback","_setType","removeEventListener","slots","wrappedEleName","cssVarList","inputOutlineWidth","inputOutlineOffset","excludeAttrsSync","customElements","define","host","label","placeholder","requiredIndicator","inputField","input","inputMask","helperText","errorMessage","disabledPlaceholder","inputDisabled","inputIcon","externalInput","externalInputDisabled","externalPlaceholder","externalDisabledPlaceholder","selector","fontSize","fontFamily","labelFontSize","property","labelFontWeight","inputValueFontWeight","inputPlaceholderFontWeight","helperTextFontWeight","errorMessageFontWeight","labelTextColor","hostWidth","hostMinWidth","hostDirection","inputDirection","inputBackgroundColor","errorMessageTextColor","errorMessageIcon","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","helperTextColor","inputValueTextColor","inputCaretTextColor","labelRequiredIndicator","inputBorderColor","inputBorderWidth","inputBorderStyle","inputBorderRadius","inputHeight","inputHorizontalPadding","inputOutlineColor","inputOutlineStyle","textAlign","inputTextAlign","inputPlaceholderColor","labelPosition","labelTopPosition","labelHorizontalPosition","inputTransformY","inputTransition","marginInlineStart","placeholderOpacity","inputVerticalAlignment","valueInputHeight","valueInputMarginBottom","inputIconOffset","inputIconSize","inputIconColor","inputTextSecurity","DateCounter","freeze","constructor","id","min","max","onChange","data","val","length","numberValue","Number","stringValue","join","padStart","isFull","isEmpty","toString","set","split","add","num","slice","del","filter","d","Boolean","clear","inc","gap","replaceValue","Math","dec","isInRange","setMin","setMax","BaseInputClass","createBaseInputClass","baseSelector","dateFieldAttrs","calendarAttrs","textVars","inputEleRTL","toggleButton","overlay","backdrop","DateFieldClass","componentNameOverride","iconMargin","rtlInputDirection","rtlInputAlignment","overlayGap","overlayBackgroundColor","overlayPadding","overlayBoxShadow","overlayOutlineWidth","overlayOutlineColor","overlayOutlineStyle","name","marginTop","backgroundColor","backdropBackgroundColor","backdropPointerEvents","padding","boxShadow","outlineWidth","outlineColor","outlineStyle","epoch","format","selectedCounterIdx","updateCountersDisplay","inputElement","countersValue","updateValue","isCountersOutOfRange","resetEpoch","date","formats","getDate","updateEpoch","isUtcTime","onDateCounterChange","dateCounters","MONTH","bind","DAY","YEAR","attachShadow","mode","innerHTML","shadowRoot","querySelector","popoverToggleButton","validationTarget","opened","getAttribute","displayValueEpoch","getTime","sortedCounters","map","find","dc","activeCounter","calendar","isRTL","computedStyleDirection","getComputedStyle","getPropertyValue","isInvalidDate","parseInt","isNaN","resetDateCounters","clearInputEle","updateDateCounters","Date","isCountersEmpty","every","some","disableCalendar","isSelectAll","inputEle","selectionStart","selectionEnd","reportValidity","dispatchEvent","Event","bubbles","updateInputDisplay","updateFormatPattern","initPopover","initInputElement","getValidity","checkValidity","onPopoverToggle","onFocus","onBlur","handleMouseCaretPositionChange","handleKeyboard","handleInput","onPointerDown","onPaste","includeAttrs","e","preventDefault","handleSelectAll","parseDigits","inputType","handleNavKeys","trigger","withBackdrop","renderer","stopPropagation","selectFirstCounter","root","firstChild","positionTarget","closePopover","setProperty","updateCalendarView","popover","replaceSync","windowRect","body","getBoundingClientRect","inputRect","calendarRect","side","offset","availableLeft","left","availableRight","width","right","newOffset","abs","css","ele","onCalendarSubmit","_attachOverlay","bringToFront","_detachOverlay","_enterModalState","openPopover","setAttribute","removeAttribute","getCounterById","isReadOnly","calendarDate","getFullYear","getMonth","validInputVal","validate","clearValue","resetDisplay","setSelectionRange","onFormatUpdate","keys","includes","pattern","selectNextCounter","setInputSelectionRange","getCounterIdx","caretPos","counter1ln","counter2ln","indexOf","setSelectedCounterByCaretPosition","target","selectPrevCounter","caretStart","reduce","acc","counter","forEach","getUTCMonth","getUTCFullYear","getUTCDate","metaKey","ctrlKey","key","toLowerCase","onCut","handleBackspace","resetToInitialState","onInitialValueChange","togglePopoverAccess","visibility","classList","oldValue","newValue","yearCounter","isYearOutOfRange","year","isDateDisplayMismatch","entries","getDateVals","isRequired","valueMissing","patternMismatch","ret","day","month","err","console","error","pastedData","clipboardData","window","getData","validDate","String"],"sourceRoot":""}
1
+ {"version":3,"file":"descope-date-field-index-js.js","mappings":"0UAGO,MAAMA,EACX,GAAQC,OAAOC,OAAO,IAEtB,WAAAC,EAAY,GAAEC,EAAE,IAAEC,EAAG,IAAEC,EAAG,YAAEC,GAAeC,GACzCC,KAAKL,GAAKA,EACVK,KAAKJ,IAAMA,EACXI,KAAKH,IAAMA,EACXG,KAAKF,YAAcA,EACnBE,KAAKD,SAAWA,CAClB,CAEA,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KAAOgG,IAExE7F,KAAK+H,cAAcnH,IAAIsR,OAAOrM,IAE9BiE,WAAW,IAAM9J,KAAK0O,0BAE1B,CACF,ICj2BFyD,eAAeC,OAAOtQ,EAAekB,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-date-field/DateCounterClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/index.js"],"sourcesContent":["// DateCounterClass allows us to add several counters to the input, and use them seperately.\n// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate\n// between different ranges.\nexport class DateCounter {\n #data = Object.freeze([]);\n\n constructor({ id, min, max, placeholder }, onChange) {\n this.id = id;\n this.min = min;\n this.max = max;\n this.placeholder = placeholder;\n this.onChange = onChange;\n }\n\n get data() {\n return this.#data;\n }\n\n set data(val) {\n this.#data = Object.freeze(val);\n this.onChange?.();\n }\n\n get #initialNumValue() {\n return this.data.length ? this.numberValue : 0;\n }\n\n get numberValue() {\n return Number(this.stringValue);\n }\n\n get stringValue() {\n return (this.data.join('') || this.placeholder).padStart(this.length, '0');\n }\n\n get isFull() {\n return this.numberValue * 10 > this.max || this.data.length === this.length;\n }\n\n get isEmpty() {\n return this.stringValue === this.placeholder;\n }\n\n get length() {\n return this.max.toString().length;\n }\n\n set(val) {\n this.data = val.toString().split('');\n }\n\n add(num) {\n // use local var to avoid triggering onChange\n let { data } = this;\n\n data = [...data, num];\n\n // we need to re-evaluate the number value\n const numVal = Number(data.join(''));\n\n if (numVal > this.max) {\n data = [num];\n } else if (this.length < data.length) {\n data = data.slice(1, data.length);\n }\n\n this.data = data;\n\n return num;\n }\n\n del() {\n if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {\n this.data = [];\n } else {\n this.data = this.data.slice(0, this.data.length - 1);\n }\n }\n\n clear() {\n this.data = [];\n }\n\n inc(gap) {\n this.replaceValue(\n this.#initialNumValue < this.max\n ? Math.max(this.#initialNumValue + (gap || 1), this.min)\n : this.min\n );\n }\n\n dec(gap) {\n this.replaceValue(\n this.#initialNumValue > this.min\n ? Math.min(this.#initialNumValue - (gap || 1), this.max)\n : this.max\n );\n }\n\n isInRange(val) {\n return val >= this.min && val <= this.max;\n }\n\n replaceValue(val) {\n if (this.isInRange(val)) {\n this.data = val.toString().padStart(this.length, 0).split('');\n }\n }\n\n setMin(val) {\n this.min = Number(val);\n }\n\n setMax(val) {\n this.max = Number(val);\n }\n}\n","import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { TextFieldClass } from '@descope-ui/descope-text-field/class';\nimport { createBaseInputClass } from '../../baseClasses/createBaseInputClass';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n portalMixin,\n} from '../../mixins';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { compose } from '../../helpers';\nimport {\n isValidEpoch,\n formatEpoch,\n isNumber,\n getCurrentTime,\n overrideConstructedStylesheet,\n dateToEpoch,\n parseDateString,\n} from './helpers';\nimport { formats } from './formats';\nimport { calendarIcon } from './icons';\nimport {\n counterConfig,\n DEFAULT_FORMAT,\n DIVIDER,\n MOBILE_DEVICE_INTERACTION_TIMEOUT_MS,\n NATIVE_FORMAT,\n valRange,\n} from './consts';\nimport { DateCounter } from './DateCounterClass';\nimport { newDate } from './date-utils';\n\nexport const componentName = getComponentName('date-field');\n\n// we set baseSelector to `vaadin-popover` as a temporary hack, so our portalMixin will\n// be able to process this component's overlay. The whole process needs refactoring as soon as possible.\nconst BASE_SELECTOR = 'vaadin-popover';\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: BASE_SELECTOR });\n\nconst dateFieldAttrs = [\n 'format',\n 'opened',\n 'initial-value',\n 'readonly',\n 'disable-calendar',\n 'utc-time',\n];\nconst calendarAttrs = ['years-range', 'calendar-months', 'calendar-weekdays'];\nconst observedAttrs = [...dateFieldAttrs, ...calendarAttrs];\n\nclass RawDateFieldClass extends BaseInputClass {\n epoch = '';\n\n format = DEFAULT_FORMAT;\n\n selectedCounterIdx = 0;\n\n updateCountersDisplay() {\n this.inputElement.value = this.countersValue;\n }\n\n updateValue() {\n if (this.isCountersOutOfRange) {\n this.resetEpoch();\n } else {\n const date = formats[this.format].getDate(this.inputElement.value);\n this.updateEpoch(dateToEpoch(date, this.isUtcTime));\n }\n }\n\n onDateCounterChange = () => {\n this.updateCountersDisplay();\n this.updateValue();\n // update validity\n this.#dispatchInput();\n };\n\n updateEpoch(epoch) {\n this.epoch = dateToEpoch(epoch, this.isUtcTime);\n }\n\n dateCounters = [\n new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this)),\n ];\n\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttrs);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <descope-text-field inputmode=\"numeric\">\n <span slot=\"suffix\" class=\"toggle-calendar\">\n ${calendarIcon}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly=\"true\"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.inputElement = this.shadowRoot.querySelector('descope-text-field');\n this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n get opened() {\n return this.getAttribute('opened') === 'true';\n }\n\n // returns the input's value as a epoch\n get displayValueEpoch() {\n const date = formats[this.format].getDate(this.inputElement.value);\n\n if (!isValidEpoch(date?.getTime())) {\n return null;\n }\n\n return date.getTime();\n }\n\n get sortedCounters() {\n return this.format\n .split(DIVIDER)\n .map((placeholder) => this.dateCounters.find((dc) => dc.placeholder === placeholder));\n }\n\n get activeCounter() {\n return this.sortedCounters[this.selectedCounterIdx];\n }\n\n get countersValue() {\n return this.sortedCounters.map((dc) => dc.stringValue).join(DIVIDER);\n }\n\n get overlay() {\n return this.baseElement.shadowRoot?.querySelector('vaadin-popover-overlay');\n }\n\n get backdrop() {\n return this.overlay.shadowRoot?.querySelector('#backdrop');\n }\n\n get calendar() {\n return this.overlay?.querySelector('descope-calendar');\n }\n\n get isRTL() {\n const computedStyleDirection = getComputedStyle(this.baseElement).getPropertyValue('direction');\n\n if (computedStyleDirection) {\n return computedStyleDirection === 'rtl';\n }\n\n // Fallback: If for some reason computed style was not calculated in time, fallback to check on attribute\n return this.getAttribute('st-host-direction') === 'rtl';\n }\n\n get value() {\n if (this.isInvalidDate()) {\n return '';\n }\n return this.epoch;\n }\n\n set value(val) {\n const value = parseInt(val, 10);\n if (!Number.isNaN(value)) {\n this.updateEpoch(value);\n this.updateDateCounters(new Date(value));\n } else {\n this.resetEpoch();\n this.resetDateCounters();\n this.clearInputEle();\n }\n }\n\n resetEpoch() {\n this.epoch = '';\n }\n\n get isCountersEmpty() {\n return this.dateCounters.every((dc) => dc.isEmpty);\n }\n\n get isCountersOutOfRange() {\n return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));\n }\n\n get disableCalendar() {\n return this.getAttribute('disable-calendar') === 'true';\n }\n\n get isUtcTime() {\n return this.getAttribute('utc-time') === 'true';\n }\n\n get isSelectAll() {\n const inputEle = this.inputElement.baseElement.inputElement;\n return inputEle.value.length === inputEle.selectionStart + inputEle.selectionEnd;\n }\n\n reportValidity() {\n this.inputElement.reportValidity();\n }\n\n #dispatchInput() {\n this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n updateInputDisplay() {\n this.inputElement.value = formatEpoch(newDate(this.countersValue).getTime(), this.format);\n }\n\n init() {\n super.init?.();\n\n this.updateFormatPattern();\n this.initPopover();\n this.onDateCounterChange();\n this.initInputElement();\n\n setTimeout(() => {\n this.#overrideOverlaySettings();\n }, 0);\n }\n\n initInputElement() {\n this.inputElement.getValidity = this.getValidity.bind(this);\n this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);\n\n this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));\n\n this.inputElement.addEventListener('focus', this.onFocus.bind(this));\n this.inputElement.addEventListener('blur', this.onBlur.bind(this));\n this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));\n this.inputElement.addEventListener('keydown', this.handleKeyboard.bind(this));\n this.inputElement.addEventListener('beforeinput', this.handleInput.bind(this));\n this.inputElement.addEventListener('pointerdown', this.onPointerDown.bind(this));\n this.inputElement.addEventListener('paste', this.onPaste.bind(this));\n\n forwardAttrs(this, this.inputElement, {\n includeAttrs: [\n 'label',\n 'label-type',\n 'placeholder',\n 'disabled',\n 'readonly',\n 'bordered',\n 'required',\n 'full-width',\n 'st-host-direction',\n 'pattern',\n 'bordered',\n 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch',\n 'data-errormessage-range-underflow',\n 'data-errormessage-range-overflow',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n });\n }\n\n handleInput(e) {\n e.preventDefault();\n\n this.handleSelectAll();\n\n if (e.data && isNumber(e.data)) {\n this.parseDigits(e.data);\n this.updateCountersDisplay();\n } else if (e.inputType) {\n this.handleNavKeys(e);\n }\n }\n\n initPopover() {\n this.baseElement.trigger = ['click'];\n this.baseElement.withBackdrop = true;\n this.baseElement.renderer = this.#popoverRenderer.bind(this);\n\n // block popover events from focusing/blurring the text-field\n this.baseElement.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n }\n\n handleSelectAll() {\n if (this.isSelectAll) {\n this.selectFirstCounter();\n }\n }\n\n #popoverPosStylesheet;\n\n #popoverRenderer(root) {\n // popoverRenderer should run only once, when the popover is first rendering.\n if (!root.firstChild) {\n this.overlay.positionTarget = this.shadowRoot.querySelector('.toggle-calendar');\n\n root.appendChild(this.#getPopoverContent());\n\n // override vaadin's constructed stylesheet which hides the host element\n overrideConstructedStylesheet(this.baseElement);\n\n this.backdrop.addEventListener('click', this.closePopover.bind(this));\n }\n\n // Hide overlay before adjusting position to prevent flickering\n root.style.setProperty('visibility', 'hidden');\n\n // Wait until overlay is ready\n setTimeout(() => {\n this.#adjustPopoverPosition(root);\n\n // Show adjusted overlay\n root.style.setProperty('visibility', 'visible');\n this.updateCalendarView(root);\n }, 100);\n }\n\n #adjustPopoverPosition() {\n const popover = this.shadowRoot.querySelector('vaadin-popover').shadowRoot;\n\n // Reset any previous transform so getBoundingClientRect measures the natural position\n this.#popoverPosStylesheet?.replaceSync(\n `vaadin-popover-overlay::part(overlay) { transform: none; }`\n );\n\n const windowRect = document.body.getBoundingClientRect();\n const inputRect = this.getBoundingClientRect();\n const calendarRect = this.calendar.getBoundingClientRect();\n\n const side = this.isRTL ? 'right' : 'left';\n const offset = inputRect[side] - calendarRect[side];\n const availableLeft = calendarRect.left;\n const availableRight = windowRect.width - calendarRect.right;\n\n let newOffset;\n if (offset > 0) {\n newOffset = Math.min(offset, availableRight);\n } else {\n newOffset = Math.min(Math.abs(offset), availableLeft) * -1;\n }\n\n const css = `\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${newOffset}px);\n }\n `;\n\n if (this.#popoverPosStylesheet) {\n this.#popoverPosStylesheet.replaceSync(css);\n } else {\n this.#popoverPosStylesheet = injectStyle(css, popover);\n }\n }\n\n #getPopoverContent() {\n const ele = document.createElement('span');\n\n ele.innerHTML = `<descope-calendar></descope-calendar>`;\n\n const calendar = ele.querySelector('descope-calendar');\n\n calendar.addEventListener('date-submit', this.onCalendarSubmit.bind(this));\n calendar.addEventListener('cancel', this.closePopover.bind(this));\n\n return ele;\n }\n\n // the default vaadin behavior is to attach the overlay to the body when opened\n // we do not want that because it's difficult to style the overlay in this way\n // so we override it to open inside the shadow DOM\n #overrideOverlaySettings() {\n this.overlay._attachOverlay = () => this.overlay.bringToFront();\n this.overlay._detachOverlay = () => {};\n this.overlay._enterModalState = () => {};\n }\n\n onPopoverToggle() {\n this.opened ? this.closePopover() : this.openPopover();\n }\n\n openPopover() {\n if (this.disableCalendar) return;\n this.setAttribute('opened', 'true');\n }\n\n closePopover() {\n this.removeAttribute('opened');\n this.inputElement.focus();\n }\n\n getCounterById(id) {\n return this.dateCounters.find((dc) => dc.id === id);\n }\n\n onCalendarSubmit() {\n if (!this.isReadOnly) {\n if (!this.calendar.value) return;\n\n const calendarDate = newDate(this.calendar.value);\n\n this.value = dateToEpoch(calendarDate, this.isUtcTime);\n\n this.getCounterById('year').replaceValue(calendarDate.getFullYear());\n this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);\n this.getCounterById('day').replaceValue(calendarDate.getDate());\n\n this.#dispatchInput();\n }\n\n this.closePopover();\n }\n\n updateCalendarView() {\n const validInputVal =\n isValidEpoch(newDate(this.inputElement.value || '').getTime()) &&\n formats[this.format].validate(this.inputElement.value);\n\n if (this.displayValueEpoch || validInputVal) {\n this.calendar.setAttribute(\n 'initial-value',\n formatEpoch(this.displayValueEpoch || this.epoch, NATIVE_FORMAT)\n );\n } else {\n this.calendar.clearValue();\n this.calendar.setAttribute('preview', formatEpoch(getCurrentTime(), NATIVE_FORMAT));\n }\n\n forwardAttrs(this, this.calendar, {\n includeAttrs: [\n 'st-host-direction',\n 'readonly',\n 'initial-month',\n 'initial-year',\n 'years-range',\n 'calendar-label-submit',\n 'calendar-label-cancel',\n 'calendar-months',\n 'calendar-weekdays',\n 'calendar-weekdays-short',\n ],\n });\n }\n\n // In mobile devices, there are cases were `pointerdown` is triggered\n // instead of `click`.\n onPointerDown(e) {\n setTimeout(() => this.handleMouseCaretPositionChange(e), MOBILE_DEVICE_INTERACTION_TIMEOUT_MS);\n }\n\n onFocus() {\n if (this.isReadOnly) {\n return;\n }\n\n // We need to wait for focus to end before we set selection\n setTimeout(() => this.resetDisplay());\n }\n\n resetDisplay() {\n if (!this.inputElement.value) {\n this.inputElement.value = this.format;\n }\n\n // On focus select the first counter\n this.selectFirstCounter();\n // set selection on first counter\n this.inputElement.setSelectionRange(0, this.sortedCounters[0].length);\n }\n\n onBlur() {\n if (this.opened) {\n return;\n }\n\n if (this.inputElement.value === this.format) {\n this.clearInputEle();\n }\n }\n\n clearInputEle() {\n this.inputElement.value = '';\n }\n\n onFormatUpdate(format) {\n if (Object.keys(formats).includes(format)) {\n this.format = format;\n this.updateFormatPattern();\n }\n }\n\n updateFormatPattern() {\n const format = this.getAttribute('format') || this.format || DEFAULT_FORMAT;\n this.setAttribute('type', 'date');\n this.setAttribute('pattern', formats[format].pattern);\n }\n\n parseDigits(value) {\n this.activeCounter.add(value);\n\n if (this.activeCounter.isFull) {\n this.selectNextCounter();\n }\n\n // We wait for the digit to be parsed, and only then set the selection.\n // Failing to do so results in unexpected \"jump\" of the screen in mobile devices.\n this.setInputSelectionRange();\n }\n\n getCounterIdx(caretPos) {\n const [counter1ln, counter2ln] = this.sortedCounters.map((dc) => dc.length);\n\n const c1 = caretPos <= counter1ln;\n const c2 = caretPos >= counter1ln && caretPos <= counter1ln + counter2ln + 1;\n const c3 = caretPos >= counter1ln + counter2ln + 2;\n\n return [c1, c2, c3].indexOf(true);\n }\n\n setSelectedCounterByCaretPosition(e) {\n this.selectedCounterIdx = this.getCounterIdx(\n // if triggered by touch event, target might not include `selectionStart`\n // in that case we fall back to the inputElement's `selectionStart` value.\n // Therefore, it is recommended to run this function with setTimeout,\n // at least for mobile events.\n e.target?.selectionStart || this.inputElement.selectionStart\n );\n }\n\n selectFirstCounter() {\n this.selectedCounterIdx = 0;\n }\n\n selectNextCounter() {\n if (this.selectedCounterIdx < this.dateCounters.length) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx + 1, 2);\n }\n }\n\n selectPrevCounter() {\n if (this.selectedCounterIdx > 0) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx - 1, 1);\n }\n }\n\n // Sets the text selection range in the input element based on the selected counter.\n // The function calculates the starting position of the selection by summing the lengths\n // of all counters before the currently selected counter (`selectedCounterIdx`).\n // It then selects the entire length of the current counter in the input element.\n setInputSelectionRange() {\n // For preview/readonly state we don't have a caret or a caretIdx, so we skip setting input selection range\n if (this.selectedCounterIdx < 0) {\n return;\n }\n\n // We wait for before setting the selection, otherwise there's an\n // unexpected \"jump\" of the screen in mobile devices.\n setTimeout(() => {\n const caretStart = this.sortedCounters\n .slice(0, this.selectedCounterIdx)\n .reduce((acc, counter) => acc + counter.length, this.selectedCounterIdx);\n\n this.inputElement.setSelectionRange(\n caretStart,\n caretStart + this.sortedCounters[this.selectedCounterIdx].length\n );\n });\n }\n\n resetDateCounters() {\n this.dateCounters.forEach((dc) => dc.clear());\n }\n\n // in case value is set from external source we need to update date counters\n updateDateCounters(date) {\n this.dateCounters.forEach((dc) => {\n switch (dc.id) {\n case counterConfig.MONTH.id:\n dc.set(this.isUtcTime ? date.getUTCMonth() + 1 : date.getMonth() + 1);\n break;\n case counterConfig.YEAR.id:\n dc.set(this.isUtcTime ? date.getUTCFullYear() : date.getFullYear());\n break;\n case counterConfig.DAY.id:\n dc.set(this.isUtcTime ? date.getUTCDate() : date.getDate());\n break;\n default:\n break;\n }\n });\n }\n\n handleKeyboard(e) {\n if (e.metaKey || e.ctrlKey) {\n if (e.key.toLowerCase() === 'x') {\n this.onCut(e);\n }\n\n return;\n }\n\n this.handleSelectAll();\n\n if (e.key === 'ArrowUp') {\n this.activeCounter.inc();\n } else if (e.key === 'ArrowDown') {\n this.activeCounter.dec();\n } else if (e.key === 'ArrowRight') {\n this.selectNextCounter();\n } else if (e.key === 'ArrowLeft') {\n this.selectPrevCounter();\n }\n\n this.setInputSelectionRange();\n }\n\n handleNavKeys(e) {\n if (this.isReadOnly) {\n return;\n }\n\n if (this.opened) {\n this.closePopover();\n }\n\n if (!this.activeCounter) return;\n\n if (e.inputType === 'deleteContentBackward') {\n this.handleBackspace();\n }\n\n this.setInputSelectionRange();\n }\n\n handleBackspace() {\n if (this.isSelectAll) {\n this.resetToInitialState();\n return;\n }\n\n const counter = this.activeCounter;\n\n if (counter.isEmpty) {\n this.selectPrevCounter();\n this.setInputSelectionRange();\n } else {\n counter.set('');\n }\n\n // To support keyboards like SwiftKey, we need to re-render the counters display and selection,\n // otherwise we get an unexpected behavior, where the format is deleted.\n setTimeout(() => {\n this.updateCountersDisplay();\n this.setInputSelectionRange();\n });\n }\n\n handleMouseCaretPositionChange(e) {\n if (this.opened) {\n return;\n }\n\n e.preventDefault();\n\n this.setSelectedCounterByCaretPosition(e);\n this.setInputSelectionRange();\n }\n\n onInitialValueChange(val) {\n // if component already has a value don't re-set value\n if (this.value) return;\n\n // we need to wait for the text-field to init\n setTimeout(() => {\n if (Number.isNaN(parseInt(val, 10))) {\n return;\n }\n this.value = Number(val);\n });\n }\n\n togglePopoverAccess(visibility) {\n if (visibility) {\n this.popoverToggleButton.classList.remove('hidden');\n } else {\n this.popoverToggleButton.classList.add('hidden');\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'disable-calendar') {\n this.togglePopoverAccess(newValue !== 'true');\n }\n if (dateFieldAttrs.includes(attrName)) {\n if (newValue && attrName === 'format') {\n this.onFormatUpdate(newValue);\n }\n if (attrName === 'initial-value') {\n this.onInitialValueChange(newValue);\n }\n } else if (calendarAttrs.includes(attrName)) {\n if (newValue) {\n this.calendar?.setAttribute(attrName, newValue);\n } else {\n this.calendar?.removeAttribute(attrName);\n }\n }\n }\n }\n\n // we want to validate the date supplied actually exists. For example: Feb 31 is not an actual date,\n // but in JS when create a `new Date('1999-02-31') we get March 2nd 1999.\n // To prevent this error from being submitted, we evaluate the\n // date parts against their generated Date value.\n isInvalidDate() {\n const yearCounter = this.getCounterById('year');\n const isYearOutOfRange =\n yearCounter.numberValue > valRange.year.max || yearCounter.numberValue < valRange.year.min;\n\n const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {\n const counter = this.getCounterById(key);\n return !val || counter.numberValue !== val;\n });\n\n return isYearOutOfRange || isDateDisplayMismatch;\n }\n\n getValidity() {\n if (this.isRequired && this.isCountersEmpty) {\n return { valueMissing: true };\n }\n\n if (this.isCountersOutOfRange || this.isInvalidDate()) {\n return { patternMismatch: true };\n }\n\n return {};\n }\n\n getDateVals() {\n const ret = {\n day: '',\n month: '',\n year: '',\n };\n\n if (Number.isNaN(this.epoch)) {\n return ret;\n }\n\n try {\n const date = new Date(this.epoch);\n\n if (this.isUtcTime) {\n ret.month = date.getUTCMonth() + 1;\n ret.day = date.getUTCDate();\n ret.year = date.getUTCFullYear();\n } else {\n ret.month = date.getMonth() + 1;\n ret.day = date.getDate();\n ret.year = date.getFullYear();\n }\n } catch (e) {}\n\n return ret;\n }\n\n resetToInitialState() {\n this.resetDateCounters();\n this.selectFirstCounter();\n this.resetDisplay();\n }\n\n onCut(e) {\n e.preventDefault();\n\n if (this.isSelectAll) {\n this.#copyToClipboard(this.countersValue);\n this.resetToInitialState();\n } else {\n this.#copyToClipboard(this.activeCounter.stringValue);\n this.activeCounter.set('');\n }\n\n this.setInputSelectionRange();\n }\n\n #copyToClipboard(value) {\n try {\n navigator.clipboard.writeText(value);\n } catch (err) {\n console.error('Failed to copy date value:', err);\n }\n }\n\n onPaste(e) {\n e.preventDefault();\n\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n\n // try paste entire date if valid\n const validDate = parseDateString(pastedData, this.format);\n\n if (validDate) {\n this.value = dateToEpoch(validDate, this.isUtcTime);\n this.onDateCounterChange();\n\n // select all\n setTimeout(() => this.inputElement.setSelectionRange(0, this.inputElement.value.length));\n } else {\n const value = Number(pastedData);\n\n // try paste in counter if possible\n if (value && this.activeCounter.min <= value && this.activeCounter.max >= value) {\n // use String to get rid of any zero padding\n this.activeCounter.set(String(value));\n\n setTimeout(() => this.setInputSelectionRange());\n }\n }\n }\n}\n\nconst textVars = TextFieldClass.cssVarList;\nconst { host, input, inputEleRTL, toggleButton, overlay, backdrop, errorMessage } = {\n host: { selector: () => ':host' },\n input: { selector: () => 'descope-text-field' },\n inputEleRTL: { selector: () => ':host([st-host-direction=\"rtl\"]) descope-text-field' },\n toggleButton: { selector: () => '.toggle-calendar' },\n overlay: { selector: 'vaadin-popover-overlay::part(overlay)' },\n backdrop: { selector: 'vaadin-popover-overlay::part(backdrop)' },\n};\n\nexport const DateFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n iconMargin: { ...toggleButton, property: 'margin-inline-end' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n textAlign: { ...input, property: 'text-align' },\n rtlInputDirection: { ...inputEleRTL, property: textVars.inputDirection },\n rtlInputAlignment: { ...inputEleRTL, property: textVars.inputTextAlign },\n overlayGap: {\n property: () => DateFieldClass.cssVarList.overlayGap,\n },\n overlayBackgroundColor: {\n property: () => DateFieldClass.cssVarList.overlayBackgroundColor,\n },\n overlayPadding: {\n property: () => DateFieldClass.cssVarList.overlayPadding,\n },\n overlayBoxShadow: { property: () => DateFieldClass.overlayBoxShadow },\n overlayOutlineWidth: {\n property: () => DateFieldClass.cssVarList.overlayOutlineWidth,\n },\n overlayOutlineColor: {\n property: () => DateFieldClass.cssVarList.overlayOutlineColor,\n },\n overlayOutlineStyle: {\n property: () => DateFieldClass.cssVarList.overlayOutlineStyle,\n },\n errorMessageIcon: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIcon,\n },\n errorMessageIconSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconSize,\n },\n errorMessageIconPadding: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPadding,\n },\n errorMessageIconRepeat: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconRepeat,\n },\n errorMessageIconPosition: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPosition,\n },\n errorMessageFontSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontSize,\n },\n labelFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.labelFontWeight,\n },\n inputValueFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.inputValueFontWeight,\n },\n inputPlaceholderFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.inputPlaceholderFontWeight,\n },\n helperTextFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.helperTextFontWeight,\n },\n errorMessageFontWeight: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontWeight,\n },\n },\n }),\n portalMixin({\n name: 'overlay',\n selector: '',\n mappings: {\n marginTop: { ...overlay, property: 'margin-top' },\n backgroundColor: { ...overlay },\n backdropBackgroundColor: { ...backdrop, property: 'background-color' },\n backdropPointerEvents: { ...backdrop, property: 'pointer-events' },\n padding: { ...overlay },\n boxShadow: { ...overlay },\n outlineWidth: { ...overlay },\n outlineColor: { ...overlay },\n outlineStyle: { ...overlay },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawDateFieldClass);\n","import '@vaadin/popover/src/vaadin-popover';\nimport './descope-calendar';\nimport '@descope-ui/descope-text-field';\n\nimport { componentName, DateFieldClass } from './DateFieldClass';\n\ncustomElements.define(componentName, DateFieldClass);\n\nexport { DateFieldClass, componentName };\n"],"names":["DateCounter","Object","freeze","constructor","id","min","max","placeholder","onChange","this","data","val","length","numberValue","Number","stringValue","join","padStart","isFull","isEmpty","toString","set","split","add","num","slice","del","filter","d","Boolean","clear","inc","gap","replaceValue","Math","dec","isInRange","setMin","setMax","componentName","BaseInputClass","createBaseInputClass","baseSelector","dateFieldAttrs","calendarAttrs","observedAttrs","textVars","TextFieldClass","cssVarList","host","input","inputEleRTL","toggleButton","overlay","backdrop","errorMessage","selector","DateFieldClass","componentNameOverride","mappings","iconMargin","property","hostWidth","hostDirection","textAlign","rtlInputDirection","inputDirection","rtlInputAlignment","inputTextAlign","overlayGap","overlayBackgroundColor","overlayPadding","overlayBoxShadow","overlayOutlineWidth","overlayOutlineColor","overlayOutlineStyle","errorMessageIcon","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","labelFontWeight","inputValueFontWeight","inputPlaceholderFontWeight","helperTextFontWeight","errorMessageFontWeight","name","marginTop","backgroundColor","backdropBackgroundColor","backdropPointerEvents","padding","boxShadow","outlineWidth","outlineColor","outlineStyle","epoch","format","selectedCounterIdx","updateCountersDisplay","inputElement","value","countersValue","updateValue","isCountersOutOfRange","resetEpoch","date","formats","getDate","updateEpoch","isUtcTime","onDateCounterChange","dateCounters","MONTH","bind","DAY","YEAR","observedAttributes","concat","super","attachShadow","mode","innerHTML","shadowRoot","querySelector","popoverToggleButton","validationTarget","opened","getAttribute","displayValueEpoch","getTime","sortedCounters","map","find","dc","activeCounter","baseElement","calendar","isRTL","computedStyleDirection","getComputedStyle","getPropertyValue","isInvalidDate","parseInt","isNaN","resetDateCounters","clearInputEle","updateDateCounters","Date","isCountersEmpty","every","some","disableCalendar","isSelectAll","inputEle","selectionStart","selectionEnd","reportValidity","dispatchEvent","Event","bubbles","updateInputDisplay","init","updateFormatPattern","initPopover","initInputElement","setTimeout","getValidity","checkValidity","addEventListener","onPopoverToggle","onFocus","onBlur","handleMouseCaretPositionChange","handleKeyboard","handleInput","onPointerDown","onPaste","includeAttrs","e","preventDefault","handleSelectAll","parseDigits","inputType","handleNavKeys","trigger","withBackdrop","renderer","stopPropagation","selectFirstCounter","root","firstChild","positionTarget","appendChild","closePopover","style","setProperty","updateCalendarView","popover","replaceSync","windowRect","document","body","getBoundingClientRect","inputRect","calendarRect","side","offset","availableLeft","left","availableRight","width","right","newOffset","abs","css","ele","createElement","onCalendarSubmit","_attachOverlay","bringToFront","_detachOverlay","_enterModalState","openPopover","setAttribute","removeAttribute","focus","getCounterById","isReadOnly","calendarDate","getFullYear","getMonth","validInputVal","validate","clearValue","resetDisplay","setSelectionRange","onFormatUpdate","keys","includes","pattern","selectNextCounter","setInputSelectionRange","getCounterIdx","caretPos","counter1ln","counter2ln","indexOf","setSelectedCounterByCaretPosition","target","selectPrevCounter","caretStart","reduce","acc","counter","forEach","getUTCMonth","getUTCFullYear","getUTCDate","metaKey","ctrlKey","key","toLowerCase","onCut","handleBackspace","resetToInitialState","onInitialValueChange","togglePopoverAccess","visibility","classList","remove","attributeChangedCallback","attrName","oldValue","newValue","yearCounter","isYearOutOfRange","year","isDateDisplayMismatch","entries","getDateVals","isRequired","valueMissing","patternMismatch","ret","day","month","navigator","clipboard","writeText","err","console","error","pastedData","clipboardData","window","getData","validDate","String","customElements","define"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3267,4188,5673,7164],{8074(t){t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxNCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPHBhdGggZD0iTTEgMTZDMSAxNy4xIDEuOSAxOCAzIDE4SDExQzEyLjEgMTggMTMgMTcuMSAxMyAxNlY0SDFWMTZaTTMgNkgxMVYxNkgzVjZaTTEwLjUgMUw5LjUgMEg0LjVMMy41IDFIMFYzSDE0VjFIMTAuNVoiIGZpbGw9ImN1cnJlbnRjb2xvciIvPiA8L3N2Zz4="},13094(t,e,o){"use strict";o.r(e),o.d(e,{AnchoredClass:()=>c,componentName:()=>r});var s=o(88961),n=o(72270),i=o(25964),a=o(63200);const r=(0,i.xE)("anchored");class l extends((0,n.qu)({componentName:r,baseSelector:".anchored-root"})){#t=null;#e=null;#o=null;#s=null;get#n(){return this.defaultSlot.assignedElements({flatten:!0})[0]}get#i(){return this.shadowRoot.querySelector('slot[name="anchored"]')?.assignedElements()[0]}get#a(){return this.getRootNode().host}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="anchored-root" part="root">\n <slot></slot>\n <div class="anchored-host" part="anchored">\n <slot name="anchored"></slot>\n </div>\n </div>\n ',this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])")}init(){super.init?.(),(0,i.fz)("\n :host {\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n }\n\n :host(:not([has-anchor])) {\n display: none;\n }\n\n .anchored-root {\n position: relative;\n display: flex;\n width: 100%;\n min-width: 0;\n }\n\n /* Make anchor fill the flex row and allow it to shrink. */\n ::slotted(*:not([slot])) {\n flex-grow: 1; /* fill the flex row */\n flex-shrink: 1; /* compress when constrained */\n flex-basis: auto; /* start from the anchor's natural size */\n min-width: 0; /* flex items won't shrink below content size without this */\n }\n\n /* Anchored container covers the anchor but is invisible to pointer events. */\n .anchored-host {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n\n /* Restore interactivity for actual anchored content. */\n ::slotted([slot=\"anchored\"]) {\n pointer-events: auto;\n }\n ",this),this.#r(),this.defaultSlot.addEventListener("slotchange",()=>this.#l()),this.#l()}#c(){const t=this.#n?.classList?.contains("hidden");this.classList.toggle("hidden",t)}#l(){this.#h(),this.#t=this.#d(this.#t,this.#a,"stretch"),this.#e=this.#d(this.#e,this.#i,"st-host-direction"),this.#u()}#u(){this.#s?.disconnect(),this.#n&&(this.#s=(0,i.mx)(this.#n,()=>this.#c(),{includeAttrs:["class"]}))}connectedCallback(){super.connectedCallback?.(),this.#u(),this.#c()}#r(){const t="\n descope-anchored {\n width: 100%; /* fill the outer host so the anchored element spans the full anchor width */\n }\n :host([stretch]) {\n display: inline-flex; /* switch from inline-block so internal children are flex items */\n width: 100%; /* fill non-flex parents */\n flex-grow: 1; /* absorb extra space in flex parents */\n flex-shrink: 0; /* hold full width — shrink:1 would let siblings squeeze it below 100% */\n flex-basis: auto; /* defer to width:100% on the main axis; avoids forcing 100% height in column-flex parents */\n min-width: 0; /* prevent overflow when the outer host is itself inside a constrained flex row */\n }\n ";this.#o?this.#o.replaceSync(t):this.#a&&(this.#o=(0,i.fz)(t,this.#a))}#d(t,e,o){return t?.disconnect(),e?.removeAttribute(o),this.#n&&e?(0,i.EA)(this.#n,e,{includeAttrs:[o]}):null}disconnectedCallback(){super.disconnectedCallback?.(),this.#t?.disconnect(),this.#e?.disconnect(),this.#s?.disconnect()}#h(){this.toggleAttribute("has-anchor",!!this.#n),this.#c()}}const c=(0,a.Zz)(s.tQ)(l);customElements.define(r,c)},11298(t,e,o){"use strict";o.d(e,{T:()=>r,q:()=>u});var s=o(88961),n=o(72270),i=o(25964),a=o(63200);const r=(0,i.xE)("attachment"),l=["top-end","top-start","top-center","bottom-start","bottom-end","bottom-center"],c=l[0];class h extends((0,n.qu)({componentName:r,baseSelector:"descope-anchored"})){#p=null;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <descope-anchored>\n <slot></slot>\n <div slot="anchored" class="attachment-container">\n <slot name="attachment"></slot>\n </div>\n </descope-anchored>\n ',this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.attachmentSlot=this.shadowRoot.querySelector('slot[name="attachment"]'),this.anchored=this.shadowRoot.querySelector("descope-anchored")}get#m(){return this.attachmentSlot?.assignedElements()[0]}static get observedAttributes(){return[...super.observedAttributes||[],"position"]}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),"position"===t&&e!==o&&this.#b()}init(){super.init?.(),(0,i.fz)("\n :host {\n display: inline-block;\n }\n :host(.hidden) {\n display: none;\n }\n .attachment-container {\n position: absolute;\n z-index: 1;\n pointer-events: none;\n width: 100%;\n display: flex;\n align-items: center;\n container-type: inline-size;\n }\n",this),this.#b();const t=this.shadowRoot.querySelector(".attachment-container");(0,i.mx)(t,()=>this.#g(),{includeAttrs:["st-host-direction"]}),this.attachmentSlot.addEventListener("slotchange",()=>this.#g()),this.defaultSlot.addEventListener("slotchange",()=>{this.#y(),window.requestAnimationFrame(()=>this.#w())}),window.requestAnimationFrame(()=>this.#y())}#c(){const t=this.anchored?.classList?.contains("hidden");this.classList.toggle("hidden",t)}#v(){this.#p?.disconnect(),this.anchored&&(this.#p=(0,i.mx)(this.anchored,()=>this.#c(),{includeAttrs:["class"]}))}connectedCallback(){super.connectedCallback?.(),this.#c(),this.#v()}disconnectedCallback(){super.disconnectedCallback?.(),this.#p?.disconnect()}#w(){const t=this.defaultSlot?.assignedElements()?.[0],e=t?.getBoundingClientRect();if(e){const t=e.width;this.#m?.setAttribute("data-attachment-size",Number(t))}}#y(){const t=this.defaultSlot?.assignedElements()?.length>0;this.classList.toggle("hidden",!t)}#g(){const t=this.shadowRoot.querySelector(".attachment-container")?.getAttribute("st-host-direction");t&&this.#m?.setAttribute("st-host-direction",t)}get offsetX(){return this.getAttribute("offset-x")||"0px"}get offsetY(){return this.getAttribute("offset-y")||"0px"}#b(){const t=this.getAttribute("position");l.includes(t)||this.setAttribute("position",c)}}const d={selector:()=>".attachment-container"},u=(0,a.Zz)((0,s.RF)({mappings:{transform:{...d},justifyContent:{...d},maxWidth:{...d},top:{...d},bottom:{...d},left:{...d},right:{...d},offsetX:{},offsetY:{}}}),s.VO,s.tQ)(h)},28313(t,e,o){"use strict";o.r(e),o.d(e,{AttachmentClass:()=>s.q,componentName:()=>s.T}),o(13094);var s=o(11298);customElements.define(s.T,s.q)},77888(t,e,o){"use strict";o.d(e,{T:()=>r,e:()=>c});var s=o(88961),n=o(72270),i=o(25964),a=o(63200);const r=(0,i.xE)("badge");class l extends((0,n.qu)({componentName:r,baseSelector:":host > div"})){static get observedAttributes(){return["data-attachment-size","shrink-to-indicator-threshold"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<div>\n <slot></slot>\n\t\t</div>\n\t\t",(0,i.fz)("\n :host {\n display: inline-flex;\n }\n :host > div {\n position: relative;\n width: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n ",this)}get shrinkToIndicatorThreshold(){return this.getAttribute("shrink-to-indicator-threshold")||65}#f(t){this.toggleAttribute("shrink-to-indicator",parseFloat(t)<this.shrinkToIndicatorThreshold)}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),"data-attachment-size"===t&&e!==o&&this.#f(o)}}const c=(0,a.Zz)((0,s.RF)({mappings:{hostWidth:[{selector:()=>":host",property:"width"}],hostHeight:[{selector:()=>":host",property:"height"}],hostDirection:{property:"direction"},fontFamily:{},fontSize:{},fontWeight:{},lineHeight:{},textTransform:{},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-left"},{property:"padding-right"}],borderWidth:{},borderStyle:{},borderColor:{},borderRadius:{},backgroundColor:{},textColor:{property:"color"},textAlign:{},boxShadow:{},textIndent:{}}}),s.VO,s.tQ)(l)},11065(t,e,o){"use strict";o.r(e),o.d(e,{BadgeClass:()=>s.e,componentName:()=>s.T});var s=o(77888);customElements.define(s.T,s.e)},92320(t,e,o){"use strict";o.r(e),o.d(e,{FilterClass:()=>j,componentName:()=>P}),o(20428),o(64014),o(27092),o(70067),o(30576),o(56737);var s=o(88961),n=o(63200),i=o(25964),a=o(72270),r=o(19624),l=o(86365),c=o(94681),h=o(28027);const d={equal:{label:"Equal"},"not-equal":{label:"Not Equal"},contains:{label:"Contains"},"not-contains":{label:"Excludes"},"starts-with":{label:"Starts with"},"ends-with":{label:"Ends with"},gt:{label:"Greater Than"},lt:{label:"Less Than"},gte:{label:"Not Less Than"},lte:{label:"Not Greater Than"},"is-any-of":{label:"Is any of"},"not-any-of":{label:"Not any of"},"is-empty":{label:"Is empty",noValue:!0},"is-not-empty":{label:"Is not empty",noValue:!0}},u=Object.keys(d).map(t=>`data-operator-label-${t}`),p={text:["contains","not-contains","equal","not-equal","starts-with","ends-with","is-empty","is-not-empty"],number:["equal","not-equal","gt","lte","lt","gte","is-empty","is-not-empty"],email:["equal","not-equal","contains","not-contains","is-empty","is-not-empty"],boolean:["equal","not-equal","is-empty","is-not-empty"],singleselect:["equal","not-equal","is-empty","is-not-empty"],multiselect:["is-any-of","not-any-of","is-empty","is-not-empty"]},m=(t,e)=>({id:t,...e[t]||{}}),b=(t,e,o,s=d)=>{const n=((o||p)[t]||[]).map(t=>m(t,s));return Array.isArray(e)&&0!==e.length?e.every(t=>"string"==typeof t)?n.filter(t=>e.includes(t.id)):e.map(t=>{const e="string"==typeof t?t:t.id,o="string"==typeof t?{}:t;return{...n.find(t=>t.id===e)||m(e,s),...o}}):n},g=t=>{if(!t||!t.column||!t.operator)return!1;if(t.noValue||(e=t.operator,d[e]?.noValue))return!0;var e;const{value:o}=t;return null!=o&&(Array.isArray(o)?o.length>0:String(o).length>0)},y=(t,e,o)=>{o.forEach(o=>((t,e,o)=>{Array.from(e.querySelectorAll(`:scope > [data-slot-copy="${o}"]`)).forEach(t=>t.remove()),Array.from(t.children).filter(t=>t.getAttribute?.("slot")===o).forEach(t=>{const s=t.cloneNode(!0);s.setAttribute("data-slot-copy",o),e.appendChild(s)})})(t,e,o))},w=t=>{let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch{return[]}return Array.isArray(e)?e.filter(t=>t&&"object"==typeof t&&"string"==typeof t.column&&"string"==typeof t.operator):[]},v=(t,e)=>{const o=t.getAttribute(e);if(!o)return null;try{return JSON.parse(o)}catch{return null}};var f=o(8074),A=o.n(f);const S=(0,i.xE)("filter-row"),C=["text","number","email"],R=["boolean","singleselect"],x=t=>!t||C.includes(t),V=t=>R.includes(t),L=t=>"multiselect"===t,E=()=>new Promise(t=>setTimeout(t)),{host:N}={host:{selector:()=>":host"}},T=(0,n.Zz)((0,s.RF)({mappings:{hostWidth:{...N,property:"width"},hostMinWidth:{selector:()=>":host",property:"min-width"},hostDirection:[{...N,property:"direction"},{selector:()=>r.J.componentName,property:r.J.cssVarList.hostDirection},{selector:()=>l.C.componentName,property:l.C.cssVarList.hostDirection},{selector:()=>c.t.componentName,property:c.t.cssVarList.hostDirection}],rowGap:{selector:()=>".row",property:"gap"},inputWidth:[{selector:()=>l.C.componentName,property:l.C.cssVarList.hostWidth},{selector:()=>h.w.componentName,property:h.w.cssVarList.hostWidth},{selector:()=>c.t.componentName,property:c.t.cssVarList.hostWidth}],deleteDisabledIconColor:{selector:()=>`${r.J.componentName}.delete-btn[disabled="true"]`,property:r.J.cssVarList.iconColor}}}),s.tQ,t=>class extends t{#A=[];#S=null;#C=!1;#R;#x;#V;#L;#E;#N;#T=null;#I=(t=>{let e;const o=(...o)=>{clearTimeout(e),e=setTimeout(()=>t(...o),350)};return o.cancel=()=>clearTimeout(e),o})(()=>this.#k());static get observedAttributes(){return[...t.observedAttributes||[],"data","value","disable-delete","label-type","operators-catalog","data-value-label-true","data-value-label-false",...u]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="row">\n <descope-combo-box class="col-select" placeholder="Column" bordered="true" item-label-path="data-name" item-value-path="data-id"></descope-combo-box>\n <descope-combo-box class="op-select" placeholder="Operator" bordered="true" item-label-path="data-name" item-value-path="data-id"></descope-combo-box>\n <div class="value-wrapper">\n <descope-text-field class="text-value" placeholder="Value" bordered="true"></descope-text-field>\n <descope-combo-box class="combo-value hidden" placeholder="Value" bordered="true" item-label-path="data-name" item-value-path="data-id"></descope-combo-box>\n <descope-multi-select-combo-box class="multi-value hidden" placeholder="Value" bordered="true" item-label-path="data-name" item-value-path="data-id"></descope-multi-select-combo-box>\n </div>\n <descope-button class="delete-btn" variant="link" mode="primary" size="md" square="true">\n <slot name="delete-row-icon">\n <descope-icon src="${A()}" src-dark="${A()}"></descope-icon>\n </slot>\n </descope-button>\n </div>\n `,(0,i.fz)("\n :host {\n display: block;\n }\n .row {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;\n align-items: center;\n }\n .col-select,\n .op-select,\n .value-wrapper {\n min-width: 0;\n overflow: hidden;\n }\n /* Let value inputs shrink to the cell instead of growing to fit their\n content (e.g. the multi-select's chip area). */\n .text-value,\n .combo-value,\n .multi-value {\n min-width: 0;\n }\n .hidden {\n display: none;\n }\n .value-wrapper.no-value {\n visibility: hidden;\n }\n ",this),this.#R=this.shadowRoot.querySelector(".col-select"),this.#x=this.shadowRoot.querySelector(".op-select"),this.#V=this.shadowRoot.querySelector(".text-value"),this.#L=this.shadowRoot.querySelector(".combo-value"),this.#E=this.shadowRoot.querySelector(".multi-value"),this.#N=this.shadowRoot.querySelector(".delete-btn")}init(){super.init?.(),this.#O(),this.#N.addEventListener("click",()=>this.#q("delete")),this.#D()}#D(){const t=[this.#R,this.#x,this.#V,this.#L,this.#E];[...t,this.#N].forEach(t=>(0,i.EA)(this,t,{includeAttrs:["size","disabled"]})),this.#z(),t.forEach(t=>(0,i.EA)(this,t,{includeAttrs:["label-type"]}))}#z(){const t=t=>({includeAttrs:[t],mapAttrs:{[t]:"placeholder"}});(0,i.EA)(this,this.#R,t("data-column-placeholder")),(0,i.EA)(this,this.#x,t("data-operator-placeholder")),[this.#V,this.#L,this.#E].forEach(e=>(0,i.EA)(this,e,t("data-value-placeholder")))}#M(t,e){const o=this.#C;this.#C=!0,t.value=e,this.#C=o}#O(){this.shadowRoot.querySelector(".row").addEventListener("input",t=>{this.#C||(t.target===this.#R?this.#B():t.target===this.#x?this.#W():this.#P()?this.#I():this.#k())})}#P(){return!this.#V.classList.contains("hidden")}#F(t){return this.#A.find(e=>e.id===t)}get trueLabel(){return this.getAttribute("data-value-label-true")||"True"}get falseLabel(){return this.getAttribute("data-value-label-false")||"False"}#J(){return[{value:"true",label:this.trueLabel},{value:"false",label:this.falseLabel}]}#H(t){return t?b(t.inputType,t.operators,v(this,"operators-catalog")).map(t=>{const e=this.getAttribute(`data-operator-label-${t.id}`);return e?{...t,label:e}:t}):[]}#B(){const t=this.#F(this.#R.value);if(!t)return;this.#I.cancel();const e=this.#H(t);this.#x.data=e.map(t=>({value:t.id,label:t.label}));const o=e.find(t=>t.id===this.#x.value)||e[0];o&&this.#M(this.#x,o.id);const s=this.#T,n=t.inputType,i=s!==n;this.#T=n,this.#G(t,o,{resetValue:i}),this.#k()}#W(){const t=this.#F(this.#R.value),e=this.#H(t).find(t=>t.id===this.#x.value);this.#G(t,e),this.#k()}#G(t,e,o={}){const s=t?.inputType,n=o.resetValue??!1;this.shadowRoot.querySelector(".value-wrapper").classList.toggle("no-value",!!e?.noValue),this.#Z(s),x(s)?this.#j(s,n):V(s)?this.#$(t,n):L(s)&&this.#_(t,n)}#Z(t){this.#V.classList.toggle("hidden",!x(t)),this.#L.classList.toggle("hidden",!V(t)),this.#E.classList.toggle("hidden",!L(t))}#j(t,e){"number"===t?this.#V.setAttribute("type","number"):"email"===t?this.#V.setAttribute("type","email"):this.#V.removeAttribute("type"),e&&this.#M(this.#V,"")}#$(t,e){const o="boolean"===t.inputType?this.#J():t.options||[];this.#L.data=o.map(t=>({value:t.value,label:t.label})),e&&this.#M(this.#L,"")}#_(t,e){this.#E.data=(t.options||[]).map(t=>({value:t.value,label:t.label})),e&&this.#M(this.#E,[])}#Q(t){return L(t)?this.#E:V(t)?this.#L:x(t)?this.#V:null}#Y(t){const e=this.#Q(t.inputType);return e?e.value??(L(t.inputType)?[]:""):null}#U(){const t=this.#R?.value||"",e=this.#x?.value||"",o=this.#F(t),s=this.#H(o).find(t=>t.id===e),n=!!s?.noValue,i=s&&!n&&o?this.#Y(o):null;return{id:this.#S,column:t,operator:e,value:i,noValue:n}}#q(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}#k(){this.#q("change",{value:this.#U()})}async#X(t){if(this.#S=t.id??null,t.column){this.#C=!0;try{const e=this.#F(t.column);if(!e)return;await E(),this.#R.value=t.column;const o=this.#H(e);if(this.#x.data=o.map(t=>({value:t.id,label:t.label})),t.operator){await E(),this.#x.value=t.operator;const s=o.find(e=>e.id===t.operator);this.#G(e,s)}null!==t.value&&void 0!==t.value&&(await E(),this.#K(e,t.value))}finally{this.#C=!1}}}#K(t,e){const o=t.inputType,s=this.#Q(o);s&&(L(o)?this.#M(s,Array.isArray(e)?e:[]):V(o)?this.#M(s,String(e)):this.#M(s,e??""))}#tt(t){const e="floating"===t;[this.#R,this.#x,this.#V,this.#L,this.#E].forEach(t=>{if(t)if(e){const e=t.getAttribute("placeholder");e&&t.setAttribute("label",e)}else t.removeAttribute("label")})}get value(){return JSON.stringify(this.#U())}set value(t){this.setAttribute("value","string"==typeof t?t:JSON.stringify(t))}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&("data"===t&&this.#et(o),"value"===t&&this.#ot(o),"label-type"===t&&this.#tt(o),"disable-delete"===t&&this.#st(o),("operators-catalog"===t||t.startsWith("data-operator-label-"))&&this.#nt(),"data-value-label-true"!==t&&"data-value-label-false"!==t||this.#it())}#et(t){if(t)try{this.#A=JSON.parse(t),this.#R.data=this.#A.map(t=>({value:t.id,label:t.label}))}catch{}}#ot(t){if(t)try{this.#X(JSON.parse(t))}catch{}}#st(t){null!==t&&"false"!==t?this.#N.setAttribute("disabled","true"):this.#N.removeAttribute("disabled")}#it(){const t=this.#F(this.#R?.value);t&&"boolean"===t.inputType&&this.#L&&(this.#L.data=this.#J())}#nt(){const t=this.#F(this.#R?.value);if(!t||!this.#x)return;const e=this.#H(t);this.#x.data=e.map(t=>({value:t.id,label:t.label}))}})((0,a.qu)({componentName:S,baseSelector:".row"}));customElements.define(S,T);const I=(0,i.xE)("filter-rows"),{host:k,container:O,rowsList:q,actions:D,addRowIcon:z}={host:{selector:()=>":host"},container:{selector:()=>".container"},rowsList:{selector:()=>".rows-list"},actions:{selector:()=>".actions"},addRowIcon:{selector:()=>'::slotted([slot="add-row-icon"])'}},M=(0,n.Zz)((0,s.RF)({mappings:{hostWidth:{...k,property:"width"},hostMinWidth:{...k,property:"min-width"},hostDirection:[{...k,property:"direction"},{selector:()=>r.J.componentName,property:r.J.cssVarList.hostDirection},{selector:()=>T.componentName,property:T.cssVarList.hostDirection}],containerWidth:{...O,property:"width"},containerPadding:{...O,property:"padding"},containerGap:{...O,property:"gap"},listGap:{...q,property:"gap"},listMaxHeight:{...q,property:"max-height"},actionsGap:{...D,property:"gap"},addRowIconSize:[{...z,property:"width"},{...z,property:"height"}]}}),s.tQ,t=>class extends t{#at=[];#rt=0;#lt(){return this.#rt+=1,`row-${this.#rt}`}#ct(){return{id:this.#lt(),column:"",operator:"",value:null}}#ht(t){const e=t.value,o=null!=e&&""!==e&&!(Array.isArray(e)&&0===e.length);return!t.column&&!t.operator&&!o}#dt=[];#ut;#pt;#mt;#bt;static get observedAttributes(){return[...t.observedAttributes||[],"data","value","clear-all-button-label","add-button-label","max-rows"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="container">\n <div class="rows-list"></div>\n <div class="actions">\n <descope-button class="add-row" variant="link" mode="primary">\n <slot name="add-row-icon" slot="prefix"></slot>\n <span class="add-button-label">Add filter</span>\n </descope-button>\n <descope-button class="clear-all" variant="link" mode="error">Clear all</descope-button>\n </div>\n </div>\n ',(0,i.fz)('\n :host {\n display: block;\n box-sizing: border-box;\n }\n .container {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n }\n .rows-list {\n display: flex;\n flex-direction: column;\n overflow: hidden auto;\n }\n .rows-list:empty {\n display: none;\n }\n .actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n }\n .add-row {\n margin-inline-end: auto;\n }\n .hidden {\n display: none;\n }\n ::slotted([slot="add-row-icon"]) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n ',this),this.#ut=this.shadowRoot.querySelector(".rows-list"),this.#pt=this.shadowRoot.querySelector(".add-row"),this.#mt=this.shadowRoot.querySelector(".add-button-label"),this.#bt=this.shadowRoot.querySelector(".clear-all")}init(){super.init?.(),(0,i.Ge)(this,this.#gt.bind(this)),this.#pt.addEventListener("click",this.#yt.bind(this)),this.#bt.addEventListener("click",this.#wt.bind(this)),this.#ut.addEventListener("change",this.#vt.bind(this)),this.#ut.addEventListener("delete",this.#ft.bind(this)),[this.#pt,this.#bt].forEach(t=>(0,i.EA)(this,t,{includeAttrs:["size"]})),this.#At(),this.#gt(),this.#St(),this.#Ct(),setTimeout(()=>this.#Rt())}#At(){const t=v(this,"data");this.#dt=Array.isArray(t)?t:[]}#gt(){this.#ut.querySelectorAll(S).forEach(t=>{t.querySelectorAll(':scope > [slot="delete-row-icon"]').forEach(t=>t.remove()),this.#xt(t)})}#Vt(){const t=new Set(this.#at.map(t=>t.id));this.#ut.querySelectorAll(S).forEach(e=>{t.has(e.dataset.rowId)||e.remove()})}#Lt(t){return this.#ut.querySelector(`${S}[data-row-id="${t}"]`)}#Ct(){this.#Vt(),this.#at.forEach(t=>{(this.#Lt(t.id)||this.#Et(t.id)).setAttribute("value",JSON.stringify(t))}),this.#Rt(),this.#Nt()}#Et(t){const e=document.createElement(S);return e.dataset.rowId=t,this.#ut.appendChild(e),(0,i.EA)(this,e,{includeAttrs:["data","size","label-type","operators-catalog","data-value-label-true","data-value-label-false","data-column-placeholder","data-operator-placeholder","data-value-placeholder",...u]}),this.#xt(e),e}#xt(t){Array.from(this.children).filter(t=>"delete-row-icon"===t.getAttribute?.("slot")).forEach(e=>{const o=e.cloneNode(!0);o.setAttribute("slot","delete-row-icon"),t.appendChild(o)})}#Rt(){const t=1===this.#at.length&&this.#ht(this.#at[0]);this.#ut.querySelectorAll(S).forEach(e=>{t?e.setAttribute("disable-delete",""):e.removeAttribute("disable-delete")}),t?this.#bt.setAttribute("disabled","true"):this.#bt.removeAttribute("disabled")}#St(){0===this.#at.length&&(this.#at=[this.#ct()])}#Nt(){const t=parseInt(this.getAttribute("max-rows"),10),e=!Number.isNaN(t)&&this.#at.length>=t;this.#pt.classList.toggle("hidden",e)}#yt(){this.#at=[...this.#at,this.#ct()],this.#Ct(),this.#k()}#wt(){this.#at=[this.#ct()],this.#Ct(),this.#q("clear")}#vt(t){const e=t.target.closest(S);if(!e)return;t.stopPropagation();const o=e.dataset.rowId;this.#at=this.#at.map(e=>e.id===o?t.detail.value:e),this.#Rt(),this.#k()}#ft(t){const e=t.target.closest(S);if(!e)return;const o=e.dataset.rowId;this.#at=this.#at.filter(t=>t.id!==o),this.#St(),this.#Ct(),this.#k()}#q(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}#Tt({column:t,operator:e}){const o=this.#dt.find(e=>e.id===t);return o&&b(o.inputType,o.operators,v(this,"operators-catalog")).find(t=>t.id===e)||null}#It(t){const e=this.#Tt(t);return e?{...null!=e.prefix&&{prefix:e.prefix},...null!=e.suffix&&{suffix:e.suffix}}:{}}#k(){const t=t=>({column:t.column,operator:t.operator,value:t.value,...this.#It(t)}),e=this.#at.filter(g).map(t),o=this.#at.map(e=>({...t(e),...null!=e.noValue&&{noValue:e.noValue}}));this.#q("change",{value:e,rows:o})}get value(){return JSON.stringify(this.#at)}set value(t){this.setAttribute("value","string"==typeof t?t:JSON.stringify(t))}get addButtonLabel(){return this.getAttribute("add-button-label")||"Add filter"}get clearAllButtonLabel(){return this.getAttribute("clear-all-button-label")||"Clear all"}#kt(){this.#mt.textContent=this.addButtonLabel}#Ot(){this.#bt.textContent=this.clearAllButtonLabel}#qt(t){if(t)try{const e=JSON.parse(t);this.#at=(Array.isArray(e)?e:[]).map(t=>{const e=this.#Tt(t);return{...t,id:t.id||this.#lt(),...e&&{noValue:!!e.noValue}}}),this.#St(),this.#Ct()}catch{}}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&("data"===t&&(this.#At(),this.#Ct()),"value"===t&&this.#qt(o),"add-button-label"===t&&this.#kt(),"clear-all-button-label"===t&&this.#Ot(),"max-rows"===t&&this.#Nt())}})((0,a.qu)({componentName:I,baseSelector:".container"}));customElements.define(I,M),o(11065),o(28313);var B=o(77888),W=o(11298);const P=(0,i.xE)("filter"),F=(0,a.qu)({componentName:P,baseSelector:"vaadin-popover"}),J=["add-row-icon","delete-row-icon"],{host:H,overlay:G,backdrop:Z}={host:{selector:()=>":host"},overlay:{selector:"vaadin-popover-overlay::part(overlay)"},backdrop:{selector:"vaadin-popover-overlay::part(backdrop)"}},j=(0,n.Zz)((0,s.RF)({mappings:{hostWidth:{...H,property:"width"},hostDirection:[{...H,property:"direction"},{selector:()=>r.J.componentName,property:r.J.cssVarList.hostDirection},{selector:()=>M.componentName,property:M.cssVarList.hostDirection}],counterBorderRadius:{selector:()=>B.e.componentName,property:B.e.cssVarList.borderRadius},counterWidth:{selector:()=>B.e.componentName,property:B.e.cssVarList.hostWidth},counterHeight:{selector:()=>B.e.componentName,property:B.e.cssVarList.hostHeight},counterFontSize:{selector:()=>B.e.componentName,property:B.e.cssVarList.fontSize},counterLineHeight:{selector:()=>B.e.componentName,property:B.e.cssVarList.lineHeight},counterBackgroundColor:{selector:()=>B.e.componentName,property:B.e.cssVarList.backgroundColor},counterTextColor:{selector:()=>B.e.componentName,property:B.e.cssVarList.textColor},counterBorderColor:{selector:()=>B.e.componentName,property:B.e.cssVarList.borderColor},counterOffsetX:{selector:()=>W.q.componentName,property:W.q.cssVarList.offsetX},counterOffsetY:{selector:()=>W.q.componentName,property:W.q.cssVarList.offsetY},rowsHostWidth:{selector:()=>M.componentName,property:M.cssVarList.hostWidth},rowsContainerWidth:{selector:()=>M.componentName,property:M.cssVarList.containerWidth},rowsContainerPadding:{selector:()=>M.componentName,property:M.cssVarList.containerPadding},rowsContainerGap:{selector:()=>M.componentName,property:M.cssVarList.containerGap},rowsListGap:{selector:()=>M.componentName,property:M.cssVarList.listGap},rowsListMaxHeight:{selector:()=>M.componentName,property:M.cssVarList.listMaxHeight},rowsActionsGap:{selector:()=>M.componentName,property:M.cssVarList.actionsGap},rowsAddRowIconSize:{selector:()=>M.componentName,property:M.cssVarList.addRowIconSize},rowWidth:{...H,property:T.cssVarList.hostWidth},rowMinWidth:{...H,property:T.cssVarList.hostMinWidth},rowValueWidth:{...H,property:T.cssVarList.inputWidth},rowGap:{...H,property:T.cssVarList.rowGap},rowDisabledDeleteColor:{...H,property:T.cssVarList.deleteDisabledIconColor}}}),(0,s.mA)({name:"overlay",selector:"",mappings:{marginTop:{...G,property:"margin-top"},width:{...G},backgroundColor:{...G},backdropBackgroundColor:{...Z,property:"background-color"},backdropPointerEvents:{...Z,property:"pointer-events"},padding:{...G},boxShadow:{...G},borderRadius:{...G},outlineWidth:{...G},outlineColor:{...G},outlineStyle:{...G}}}),s.VO,s.tQ)(class extends F{#Dt=[];#zt=!1;#Mt;#Bt=null;#Wt=null;#Pt=null;static get observedAttributes(){return[...F.observedAttributes||[],"label","disable-indicator","data","value"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <descope-attachment class="attachment" position="top-end" st-offset-x="0px">\n <descope-button class="trigger-btn">\n <slot name="button-icon"></slot>\n <span class="trigger-label"></span>\n </descope-button>\n <descope-badge slot="attachment" class="counter hidden" mode="primary" variant="contained" bordered="true" size="xs">\n <span class="counter-text">0</span>\n </descope-badge>\n </descope-attachment>\n <vaadin-popover></vaadin-popover>\n <slot name="add-row-icon" class="hidden"></slot>\n <slot name="delete-row-icon" class="hidden"></slot>\n </div>\n ',(0,i.fz)('\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host([full-width="true"]) {\n display: block;\n }\n\n \n .hidden {\n display: none;\n }\n\n :host([read-only="true"]) .trigger-btn {\n pointer-events: none;\n }\n ',this),this.triggerBtn=this.shadowRoot.querySelector(".trigger-btn"),this.triggerLabel=this.shadowRoot.querySelector(".trigger-label"),this.counter=this.shadowRoot.querySelector(".counter"),this.counterText=this.shadowRoot.querySelector(".counter-text")}get opened(){return"true"===this.getAttribute("opened")}get isIndicatorVisible(){return"true"!==this.getAttribute("disable-indicator")}get isFullWidth(){return"true"===this.getAttribute("full-width")}get overlay(){return this.#Pt??=this.baseElement.shadowRoot?.querySelector("vaadin-popover-overlay")||null,this.#Pt}get backdrop(){return this.overlay?.shadowRoot?.querySelector("#backdrop")}get filterRowsElement(){return this.overlay?.querySelector(I)||null}init(){super.init?.(),this.#Ft(),this.#Jt(),this.#Ht(),(0,i.EA)(this,this.triggerBtn,{includeAttrs:["button-mode","button-variant","size","full-width"],mapAttrs:{"button-mode":"mode","button-variant":"variant"}}),this.#Gt(),setTimeout(()=>{this.#Zt()})}#Gt(){J.forEach(t=>{const e=this.shadowRoot.querySelector(`slot[name="${t}"]`);e?.addEventListener("slotchange",()=>{this.#Wt?.isConnected&&y(this,this.#Wt,[t])})})}#Ft(){this.baseElement.trigger=[],this.baseElement.withBackdrop=!0,this.baseElement.renderer=this.#jt.bind(this),this.baseElement.addEventListener("click",t=>{t.stopPropagation()}),this.triggerBtn.addEventListener("click",()=>this.onPopoverToggle())}#jt(t){if(!t.firstChild){this.overlay.positionTarget=this.triggerBtn;const e=document.createElement(I);(0,i.EA)(this,e,{includeAttrs:["operators","size","max-rows","clear-all-button-label","add-button-label","label-type","data-value-label-true","data-value-label-false","data-column-placeholder","data-operator-placeholder","data-value-placeholder",...u],mapAttrs:{operators:"operators-catalog"}}),this.#$t(e),t.appendChild(e),this.#Wt=e,e.setAttribute("value",JSON.stringify(this.#Dt)),e.addEventListener("change",this.#_t.bind(this)),e.addEventListener("clear",this.#Qt.bind(this));const o=new CSSStyleSheet;o.insertRule(":host{display:block!important;}"),this.baseElement?.shadowRoot?.adoptedStyleSheets?.push(o),this.backdrop?.addEventListener("click",()=>this.closePopover())}this.#Wt&&y(this,this.#Wt,J),t.style.setProperty("visibility","hidden"),setTimeout(()=>{this.#Yt(),t.style.setProperty("visibility","visible")},50)}#Yt(){if(!this.overlay)return;const t=this.shadowRoot.querySelector("vaadin-popover")?.shadowRoot;if(!t)return;this.#Mt&&(t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>t!==this.#Mt));const e=document.body.getBoundingClientRect(),o=this.triggerBtn.getBoundingClientRect(),s=this.overlay.getBoundingClientRect(),n=o.left-s.left,a=s.left,r=e.width-s.right;let l;l=n>0?Math.min(n,r):-1*Math.min(Math.abs(n),a);const c=Math.round(this.getBoundingClientRect().width);this.#Mt=(0,i.fz)(`\n vaadin-popover-overlay::part(overlay) {\n margin-left: ${l}px;\n ${this.isFullWidth?`width: ${c}px; max-width: ${c}px;`:""}\n }\n `,t)}#q(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}#Ut(t){this.#zt=!0,this.setAttribute("value",JSON.stringify(w(t))),this.#zt=!1}#_t(t){const e=w(t.detail.value||[]);JSON.stringify(e)!==JSON.stringify(this.#Dt)&&(this.#Ut(e),this.#q("filter-apply",{value:this.#Dt,action:"apply"}))}#Qt(){this.#Ut([]),this.#q("filter-clear",{value:this.#Dt,action:"clear-all"})}#Jt(){if(!this.counter)return;const t=this.#Dt.length;this.counterText.textContent=String(t),this.counter.classList.toggle("hidden",t<1||!this.isIndicatorVisible)}#Ht(){if(!this.triggerLabel)return;const t=this.getAttribute("label")||"";this.triggerLabel.textContent=t,this.triggerLabel.classList.toggle("hidden",!t)}#$t(t){t&&this.#Bt&&t.setAttribute("data",JSON.stringify(this.#Bt))}get value(){return JSON.stringify(this.#Dt)}set value(t){this.#Ut(t)}set data(t){this.#Bt=Array.isArray(t)?t:null,this.filterRowsElement&&this.#Bt&&this.filterRowsElement.setAttribute("data",JSON.stringify(this.#Bt))}get data(){return this.#Bt}#Zt(){this.overlay&&(this.overlay._attachOverlay=()=>this.overlay.bringToFront(),this.overlay._detachOverlay=()=>{})}get readOnly(){return"true"===this.getAttribute("read-only")}onPopoverToggle(){this.readOnly||(this.opened?this.closePopover():this.openPopover())}openPopover(){this.setAttribute("opened","true"),this.baseElement.opened=!0}closePopover(){this.removeAttribute("opened"),this.baseElement.opened=!1}#Xt(t){t&&(this.#Dt=w(t),this.#Jt(),this.#zt||this.filterRowsElement?.setAttribute("value",JSON.stringify(this.#Dt)))}#Kt(t){if(t)try{this.#Bt=JSON.parse(t),this.filterRowsElement?.setAttribute("data",JSON.stringify(this.#Bt))}catch{}}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&("value"===t&&this.#Xt(o),"data"===t&&this.#Kt(o),"label"===t&&this.#Ht(),"disable-indicator"===t&&this.#Jt())}});customElements.define(P,j)},56737(t,e,o){"use strict";o.r(e),o.d(e,{IconClass:()=>s.S,componentName:()=>s.T}),o(53455);var s=o(98538);customElements.define(s.T,s.S)},53455(t,e,o){"use strict";o.r(e),o.d(e,{ImageClass:()=>s.q,componentName:()=>s.T});var s=o(8512);customElements.define(s.T,s.q)}}]);
2
+ //# sourceMappingURL=descope-filter.js.map