@descope/web-components-ui 1.105.0 → 1.107.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.
- package/dist/cjs/index.cjs.js +224 -128
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +856 -760
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-alert-index-js.js +1 -1
- package/dist/umd/descope-alert-index-js.js.map +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
- package/dist/umd/descope-date-field-index-js.js +1 -1
- package/dist/umd/descope-date-field-index-js.js.map +1 -1
- package/dist/umd/descope-enriched-text.js +2 -0
- package/dist/umd/descope-enriched-text.js.map +1 -0
- package/dist/umd/descope-link.js +2 -0
- package/dist/umd/descope-link.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +11 -10
- package/src/components/descope-alert/AlertClass.js +1 -1
- package/src/components/descope-alert/index.js +1 -1
- package/src/components/descope-date-field/DateFieldClass.js +94 -3
- package/src/components/descope-date-field/helpers.js +8 -0
- package/src/index.cjs.js +0 -2
- package/src/index.js +0 -2
- package/src/theme/components/index.js +2 -2
- package/dist/umd/descope-enriched-text-index-js.js +0 -2
- package/dist/umd/descope-enriched-text-index-js.js.map +0 -1
- package/dist/umd/descope-link-index-js.js +0 -2
- package/dist/umd/descope-link-index-js.js.map +0 -1
- package/src/components/descope-enriched-text/EnrichedTextClass.js +0 -209
- package/src/components/descope-enriched-text/consts.js +0 -14
- package/src/components/descope-enriched-text/helpers.js +0 -5
- package/src/components/descope-enriched-text/index.js +0 -5
- package/src/components/descope-link/LinkClass.js +0 -76
- package/src/components/descope-link/index.js +0 -6
- package/src/theme/components/enrichedText.js +0 -40
- package/src/theme/components/link.js +0 -36
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1456,
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1456,2294,4159,9261],{11339:(t,e,n)=>{n.r(e),n.d(e,{AlertClass:()=>p,componentName:()=>a}),n(55838);var o=n(79365),r=n(9696),s=n(97810),i=n(81365),l=n(76231),h=n(25964);const a=(0,s.xE)("alert");class c extends((0,i.q)({componentName:a,baseSelector:":host > div"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <div class="icon"></div>\n <div class="content">\n <descope-enriched-text>\n <slot></slot>\n </descope-enriched-text>\n </div>\n </div>\n ',(0,h.fz)('\n :host {\n display: inline-flex;\n }\n :host > div {\n display: flex;\n width: 100%;\n }\n :host([empty="true"]) {\n display: none;\n }\n .icon {\n flex-shrink: 0;\n }\n .content {\n display: flex;\n flex-wrap: wrap;\n white-space: normal;\n overflow-wrap: break-word;\n }\n ',this)}init(){super.init?.(),this.slotEle=this.shadowRoot.querySelector("slot"),this.textComp=this.shadowRoot.querySelector("descope-enriched-text"),this.slotEle.addEventListener("slotchange",this.handleSlotChange.bind(this)),(0,h.Gh)(this.textComp,this,{includeAttrs:["empty"]}),(0,h.Ge)(this,this.handleChildrenChange.bind(this)),(0,s.EA)(this,this.textComp,{includeAttrs:["variant","full-width","link-target-blank"]})}handleChildrenChange(){this.textComp.textContent=this.textContent}handleSlotChange(){const t=this.slotEle.assignedNodes({flatten:!0});t.length&&(this.textComp.textContent=t[0]?.textContent||"")}}const{icon:d}={icon:{selector:()=>".icon"}},p=(0,r.Zz)((0,o.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},textColor:{selector:l.m.componentName,property:l.m.cssVarList.textColor},backgroundColor:{},borderColor:{},borderWidth:{},borderStyle:{},borderRadius:{},fontSize:[{},{selector:l.m.componentName,property:l.m.cssVarList.fontSize}],gap:{},horizontalPadding:[{property:"padding-top"},{property:"padding-bottom"}],verticalPadding:[{property:"padding-right"},{property:"padding-left"}],alignItems:{},justifyContent:{},icon:[{...d,property:"content"},{...d,property:"display",fallback:"none"}],iconSize:[{...d,property:"width"},{...d,property:"height"}]}}),(0,o.RF)({componentNameOverride:(0,s.xE)("enriched-text")}),(0,o.RF)({componentNameOverride:(0,s.xE)("text")}),o.VO,o.tQ)(c);customElements.define(a,p)},36976:(t,e,n)=>{n.d(e,{M:()=>o});const o=["blockquote","list","image","table","code","hr","backticks","fence","reference","heading","lheading","html_block"]},54847:(t,e,n)=>{n.d(e,{G:()=>o});const o=t=>{const e=document.createElement("textarea");return e.innerHTML=t,e.value}},55838:(t,e,n)=>{n.r(e),n.d(e,{EnrichedTextClass:()=>o.m,componentName:()=>o.T}),n(74778);var o=n(76231);customElements.define(o.T,o.m)},63595:(t,e,n)=>{n.r(e),n.d(e,{TextClass:()=>o.s,componentName:()=>o.T});var o=n(66434);customElements.define(o.T,o.s)},66434:(t,e,n)=>{n.d(e,{T:()=>l,s:()=>c});var o=n(88961),r=n(63200),s=n(25964),i=n(72270);const l=(0,s.xE)("text");class h extends((0,i.qu)({componentName:l,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <slot part="text-wrapper"></slot>\n ',(0,s.fz)("\n :host {\n display: inline-block;\n line-height: 1em;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n ",this)}get hideWhenEmpty(){return"true"===this.getAttribute("hide-when-empty")}init(){super.init(),(0,s.Ge)(this,(()=>{const t=!!this.childNodes.length;this.style.display=!t&&this.hideWhenEmpty?"none":""}))}}const{host:a}={host:{selector:()=>":host"}},c=(0,r.Zz)((0,o.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},textColor:[{property:"color"}],textLineHeight:{property:"line-height"},textLetterSpacing:{property:"letter-spacing"},textShadow:{},textAlign:{},textTransform:{},fontFamily:{},fontStyle:{},fontWeight:{},borderWidth:{},borderStyle:{},borderColor:{}}}),o.VO,o.tQ)(h)},74778:(t,e,n)=>{n.r(e),n.d(e,{LinkClass:()=>y,componentName:()=>h});var o=n(88961),r=n(63200),s=n(25964),i=n(72270),l=n(66434);const h=(0,s.xE)("link");class a extends((0,i.qu)({componentName:h,baseSelector:":host a"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<div>\n\t\t\t<descope-text>\n\t\t\t\t<a>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</a>\n\t\t\t</descope-text>\n\t\t</div>\n\t\t",(0,s.fz)("\n :host {\n\t\t\tdisplay: inline-block;\n line-height: 1em;\n\t\t}\n\t\t:host a {\n\t\t\tdisplay: inline;\n\t\t}\n ",this),(0,s.EA)(this,this.shadowRoot.querySelector("a"),{includeAttrs:["href","target","tooltip"],mapAttrs:{tooltip:"title"}}),(0,s.EA)(this,this.shadowRoot.querySelector("descope-text"),{includeAttrs:["mode","variant"]})}}const c={host:{selector:()=>":host"},link:{selector:()=>":host a"},anchor:{},wrapper:{selector:()=>":host > div"},text:{selector:()=>l.s.componentName}},{anchor:d,text:p,host:m,wrapper:u,link:g}=c,y=(0,r.Zz)((0,o.RF)({mappings:{hostWidth:{...m,property:"width"},hostDirection:{...p,property:"direction"},textAlign:u,textDecoration:{...g,property:"text-decoration",fallback:"none"},textColor:[{...d,property:"color"},{...p,property:l.s.cssVarList.textColor}],cursor:d}}),o.VO,o.tQ)(a);n(63595),customElements.define(h,y)},76231:(t,e,n)=>{n.d(e,{T:()=>c,m:()=>p});var o=n(92540),r=n(88961),s=n(63200),i=n(36976),l=n(72270),h=n(54847),a=n(25964);const c=(0,a.xE)("enriched-text");class d extends((0,l.qu)({componentName:c,baseSelector:":host > div"})){#t;#e;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="content"></div>\n ',(0,a.fz)("\n :host {\n line-height: 1em;\n word-break: break-word;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n *, *:last-child {\n margin: 0;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p {\n margin-bottom: 1em;\n }\n a {\n cursor: pointer;\n }\n blockquote {\n padding: 0 2em;\n }\n u {\n text-decoration: underline\n }\n s {\n color: currentColor;\n }\n ",this),this.#n(),(0,a.Ge)(this,this.#o.bind(this))}static get observedAttributes(){return["readonly","link-target-blank"]}attributeChangedCallback(t,e,n){super.attributeChangedCallback?.(t,e,n),n!==e&&("readonly"===t&&this.onReadOnlyChange("true"===n),"link-target-blank"===t&&this.#n())}customUnderlineRenderer(){this.processor.renderer.rules.em_open=(t,e,n,o,r)=>("_"===t[e].markup&&(t[e].tag="u"),this.#e(t,e,n,o,r)),this.processor.renderer.rules.em_close=(t,e,n,o,r)=>("_"===t[e].markup&&(t[e].tag="u"),this.#e(t,e,n,o,r))}#r(){this.linkTargetBlank?this.processor.renderer.rules.link_open=(t,e,n,o,r)=>(t[e].attrSet("target","_blank"),this.#t(t,e,n,o,r)):this.processor.renderer.rules.link_open=this.#t}#s(){this.processor&&this.processor.disable(i.M)}#i(){this.#s()}#l(){this.#t=this.processor.renderer.rules.link_open||((t,e,n,o,r)=>r.renderToken(t,e,n)),this.#e=this.processor.renderer.rules.em_open||((t,e,n,o,r)=>r.renderToken(t,e,n))}#n(){this.processor=new o.A("commonmark",{html:!0}),this.#l(),this.#i(),this.#r(),this.customUnderlineRenderer()}get linkTargetBlank(){return"true"===this.getAttribute("link-target-blank")}get contentNode(){return this.shadowRoot.querySelector(".content")}#o(){if(!this.processor)return;let t=(0,h.G)(this.innerHTML);!t?.trim()&&this.isConnected?this.setAttribute("empty","true"):this.removeAttribute("empty");try{const e=this.processor.parse(t,{references:void 0});t=this.processor.renderer.render(e,{html:!0,breaks:!0})}catch(t){console.warn("Not parsing invalid markdown token")}this.contentNode.innerHTML=t}onReadOnlyChange(t){t?this.contentNode.setAttribute("inert",t):this.contentNode.removeAttribute("inert")}}const p=(0,s.Zz)((0,r.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDisplay:{selector:()=>":host",property:"display",fallback:"inline-block"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},fontWeight:{},fontWeightBold:[{selector:()=>":host strong",property:"font-weight"},{selector:()=>":host b",property:"font-weight"}],textColor:{property:"color"},textLineHeight:{property:"line-height"},textAlign:{},linkColor:{selector:"a",property:"color"},linkTextDecoration:{selector:"a",property:"text-decoration"},linkHoverTextDecoration:{selector:"a:hover",property:"text-decoration"},minHeight:{},minWidth:{}}}),(0,r.RF)({componentNameOverride:(0,a.xE)("link")}),(0,r.RF)({componentNameOverride:(0,a.xE)("text")}),r.VO,r.tQ)(d)}}]);
|
2
2
|
//# sourceMappingURL=descope-alert-index-js.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"descope-alert-index-js.js","mappings":"6JAAO,MAAMA,EAAe,CAC1B,aACA,OACA,QACA,QACA,OACA,KACA,YACA,QACA,YACA,UACA,WACA,a,qJCLK,MAAMC,GAAgB,QAAiB,SAE9C,MAAMC,WAAiB,EAAAC,EAAA,GAAgB,CAAEF,gBAAeG,aAAc,iBACpE,WAAAC,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,wMAWhD,QACE,8YAqBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SAENJ,KAAKK,QAAUL,KAAKM,WAAWC,cAAc,QAC7CP,KAAKQ,SAAWR,KAAKM,WAAWC,cAAc,yBAE9CP,KAAKK,QAAQI,iBAAiB,aAAcT,KAAKU,iBAAiBC,KAAKX,QAEvE,QAAUA,KAAKQ,SAAUR,KAAM,CAAEY,aAAc,CAAC,YAEhD,QAAgBZ,KAAMA,KAAKa,qBAAqBF,KAAKX,QAErD,QAAaA,KAAMA,KAAKQ,SAAU,CAChCI,aAAc,CAAC,UAAW,aAAc,sBAE5C,CAEA,oBAAAC,GACEb,KAAKQ,SAAS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U,eAC5BoE,UAAW,CAAC,EACZC,UAAW,CAAEzE,SAAU,IAAKI,SAAU,SACtCsE,mBAAoB,CAAE1E,SAAU,IAAKI,SAAU,mBAC/CuE,wBAAyB,CAAE3E,SAAU,UAAWI,SAAU,mBAC1DwE,UAAW,CAAC,EACZC,SAAU,CAAC,MAGf,QAAiB,CAAEvD,uBAAuB,QAAiB,WAC3D,QAAiB,CAAEA,uBAAuB,QAAiB,UAC3D,KACA,KA1B+B,CA2B/BG,E,mCChNK,MAAMqD,EAAc3B,IACzB,MAAM4B,EAAWC,SAASC,cAAc,YAExC,OADAF,EAAS/F,UAAYmE,EACd4B,EAASG,KAAK,C,iGCDvB3D,eAAeC,OAAO,IAAe,I","sources":["webpack://@descope/web-components-ui/./src/components/descope-enriched-text/consts.js","webpack://@descope/web-components-ui/./src/components/descope-alert/AlertClass.js","webpack://@descope/web-components-ui/./src/components/descope-alert/index.js","webpack://@descope/web-components-ui/./src/components/descope-enriched-text/EnrichedTextClass.js","webpack://@descope/web-components-ui/./src/components/descope-enriched-text/helpers.js","webpack://@descope/web-components-ui/./src/components/descope-enriched-text/index.js"],"sourcesContent":["export const disableRules = [\n 'blockquote',\n 'list',\n 'image',\n 'table',\n 'code',\n 'hr',\n 'backticks',\n 'fence',\n 'reference',\n 'heading',\n 'lheading',\n 'html_block',\n];\n","import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { compose } from '../../helpers';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { EnrichedTextClass } from '../descope-enriched-text/EnrichedTextClass';\nimport { injectStyle, observeChildren, syncAttrs } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('alert');\n\nclass RawAlert extends createBaseClass({ componentName, baseSelector: ':host > div' }) {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <div class=\"icon\"></div>\n <div class=\"content\">\n <descope-enriched-text>\n <slot></slot>\n </descope-enriched-text>\n </div>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n :host > div {\n display: flex;\n width: 100%;\n }\n :host([empty=\"true\"]) {\n display: none;\n }\n .icon {\n flex-shrink: 0;\n }\n .content {\n display: flex;\n flex-wrap: wrap;\n white-space: normal;\n overflow-wrap: break-word;\n }\n `,\n this\n );\n }\n\n init() {\n super.init?.();\n\n this.slotEle = this.shadowRoot.querySelector('slot');\n this.textComp = this.shadowRoot.querySelector('descope-enriched-text');\n\n this.slotEle.addEventListener('slotchange', this.handleSlotChange.bind(this));\n\n syncAttrs(this.textComp, this, { includeAttrs: ['empty'] });\n\n observeChildren(this, this.handleChildrenChange.bind(this));\n\n forwardAttrs(this, this.textComp, {\n includeAttrs: ['variant', 'full-width', 'link-target-blank'],\n });\n }\n\n handleChildrenChange() {\n this.textComp.textContent = this.textContent;\n }\n\n handleSlotChange() {\n const assignedNodes = this.slotEle.assignedNodes({ flatten: true });\n if (!assignedNodes.length) return;\n this.textComp.textContent = assignedNodes[0]?.textContent || '';\n }\n}\n\nconst { icon } = {\n icon: { selector: () => '.icon' },\n};\n\nexport const AlertClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDirection: { selector: () => ':host', property: 'direction' },\n textColor: {\n selector: EnrichedTextClass.componentName,\n property: EnrichedTextClass.cssVarList.textColor,\n },\n backgroundColor: {},\n borderColor: {},\n borderWidth: {},\n borderStyle: {},\n borderRadius: {},\n fontSize: [\n {},\n {\n selector: EnrichedTextClass.componentName,\n property: EnrichedTextClass.cssVarList.fontSize,\n },\n ],\n gap: {},\n horizontalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],\n verticalPadding: [{ property: 'padding-right' }, { property: 'padding-left' }],\n alignItems: {},\n justifyContent: {},\n icon: [\n { ...icon, property: 'content' },\n { ...icon, property: 'display', fallback: 'none' },\n ],\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('enriched-text') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n draggableMixin,\n componentNameValidationMixin\n)(RawAlert);\n","import '../descope-enriched-text';\nimport { componentName, AlertClass } from './AlertClass';\n\ncustomElements.define(componentName, AlertClass);\n\nexport { AlertClass, componentName };\n","/* eslint-disable no-param-reassign */\n\nimport MarkdownIt from 'markdown-it';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { compose } from '../../helpers';\nimport { getComponentName, observeChildren } from '../../helpers/componentHelpers';\nimport { disableRules } from './consts';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { decodeHTML } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('enriched-text');\n\nclass EnrichedText extends createBaseClass({ componentName, baseSelector: ':host > div' }) {\n #origLinkRenderer;\n\n #origEmRenderer;\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"content\"></div>\n `;\n\n injectStyle(\n `\n :host {\n line-height: 1em;\n word-break: break-word;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n *, *:last-child {\n margin: 0;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p {\n margin-bottom: 1em;\n }\n a {\n cursor: pointer;\n }\n blockquote {\n padding: 0 2em;\n }\n u {\n text-decoration: underline\n }\n s {\n color: currentColor;\n }\n `,\n this\n );\n\n this.#initProcessor();\n\n observeChildren(this, this.#parseChildren.bind(this));\n }\n\n static get observedAttributes() {\n return ['readonly', 'link-target-blank'];\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'readonly') {\n this.onReadOnlyChange(newValue === 'true');\n }\n\n if (attrName === 'link-target-blank') {\n this.#initProcessor();\n }\n }\n }\n\n // We're overriding the rule for em with single underscore to perform as underline. (_underline_)\n customUnderlineRenderer() {\n this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {\n if (tokens[idx].markup === '_') tokens[idx].tag = 'u';\n return this.#origEmRenderer(tokens, idx, options, env, self);\n };\n this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {\n if (tokens[idx].markup === '_') tokens[idx].tag = 'u';\n return this.#origEmRenderer(tokens, idx, options, env, self);\n };\n }\n\n #customizeLinkRenderer() {\n if (this.linkTargetBlank) {\n this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {\n // Add a new `target` attribute, or replace the value of the existing one.\n tokens[idx].attrSet('target', '_blank');\n // Pass the token to the default renderer.\n return this.#origLinkRenderer(tokens, idx, options, env, self);\n };\n } else {\n this.processor.renderer.rules.link_open = this.#origLinkRenderer;\n }\n }\n\n #disableCustomRules() {\n if (!this.processor) {\n return;\n }\n this.processor.disable(disableRules);\n }\n\n #updateProcessorRules() {\n this.#disableCustomRules();\n }\n\n #storeOrigRenderers() {\n const defaultLinkRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;\n\n const defaultStrongRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;\n }\n\n #initProcessor() {\n this.processor = new MarkdownIt('commonmark', { html: true });\n this.#storeOrigRenderers();\n this.#updateProcessorRules();\n this.#customizeLinkRenderer();\n this.customUnderlineRenderer();\n }\n\n get linkTargetBlank() {\n return this.getAttribute('link-target-blank') === 'true';\n }\n\n get contentNode() {\n return this.shadowRoot.querySelector('.content');\n }\n\n #parseChildren() {\n if (!this.processor) {\n return;\n }\n\n let html = decodeHTML(this.innerHTML);\n\n if (!html?.trim() && this.isConnected) {\n this.setAttribute('empty', 'true');\n } else {\n this.removeAttribute('empty');\n }\n\n try {\n const tokens = this.processor.parse(html, { references: undefined });\n html = this.processor.renderer.render(tokens, { html: true, breaks: true });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Not parsing invalid markdown token');\n }\n\n this.contentNode.innerHTML = html;\n }\n\n onReadOnlyChange(isReadOnly) {\n if (isReadOnly) {\n this.contentNode.setAttribute('inert', isReadOnly);\n } else {\n this.contentNode.removeAttribute('inert');\n }\n }\n}\n\nexport const EnrichedTextClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDisplay: { selector: () => ':host', property: 'display', fallback: 'inline-block' },\n hostDirection: { selector: () => ':host', property: 'direction' },\n fontSize: {},\n fontFamily: {},\n fontWeight: {},\n fontWeightBold: [\n { selector: () => ':host strong', property: 'font-weight' },\n { selector: () => ':host b', property: 'font-weight' },\n ],\n textColor: { property: 'color' },\n textLineHeight: { property: 'line-height' },\n textAlign: {},\n linkColor: { selector: 'a', property: 'color' },\n linkTextDecoration: { selector: 'a', property: 'text-decoration' },\n linkHoverTextDecoration: { selector: 'a:hover', property: 'text-decoration' },\n minHeight: {},\n minWidth: {},\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('link') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n draggableMixin,\n componentNameValidationMixin\n)(EnrichedText);\n","export const decodeHTML = (html) => {\n const textArea = document.createElement('textarea');\n textArea.innerHTML = html;\n return textArea.value;\n};\n","import { componentName, EnrichedTextClass } from './EnrichedTextClass';\n\ncustomElements.define(componentName, EnrichedTextClass);\n\nexport { EnrichedTextClass, componentName };\n"],"names":["disableRules","componentName","RawAlert","createBaseClass","baseSelector","constructor","super","this","attachShadow","mode","innerHTML","init","slotEle","shadowRoot","querySelector","textComp","addEventListener","handleSlotChange","bind","includeAttrs","handleChildrenChange","textContent","assignedNodes","flatten","length","icon","selector","AlertClass","mappings","hostWidth","property","hostDirection","textColor","EnrichedTextClass","cssVarList","backgroundColor","borderColor","borderWidth","borderStyle","borderRadius","fontSize","gap","horizontalPadding","verticalPadding","alignItems","justifyContent","fallback","iconSize","componentNameOverride","customElements","define","EnrichedText","observedAttributes","attributeChangedCallback","attrName","oldValue","newValue","onReadOnlyChange","customUnderlineRenderer","processor","renderer","rules","em_open","tokens","idx","options","env","self","markup","tag","em_close","linkTargetBlank","link_open","attrSet","disable","_","renderToken","html","getAttribute","contentNode","trim","isConnected","setAttribute","removeAttribute","parse","references","undefined","render","breaks","e","console","warn","isReadOnly","hostDisplay","fontFamily","fontWeight","fontWeightBold","textLineHeight","textAlign","linkColor","linkTextDecoration","linkHoverTextDecoration","minHeight","minWidth","decodeHTML","textArea","document","createElement","value"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"descope-alert-index-js.js","mappings":"2RAOO,MAAMA,GAAgB,QAAiB,SAE9C,MAAMC,WAAiB,EAAAC,EAAA,GAAgB,CAAEF,gBAAeG,aAAc,iBACpE,WAAAC,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,wMAWhD,QACE,8YAqBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SAENJ,KAAKK,QAAUL,KAAKM,WAAWC,cAAc,QAC7CP,KAAKQ,SAAWR,KAAKM,WAAWC,cAAc,yBAE9CP,KAAKK,QAAQI,iBAAiB,aAAcT,KAAKU,iBAAiBC,KAAKX,QAEvE,QAAUA,KAAKQ,SAAUR,KAAM,CAAEY,aAAc,CAAC,YAEhD,QAAgBZ,KAAMA,KAAKa,qBAAqBF,KAAKX,QAErD,QAAaA,KAAMA,KAAKQ,SAAU,CAChCI,aAAc,CAAC,UAAW,aAAc,sBAE5C,CAEA,oBAAAC,GACEb,KAAKQ,SAASM,YAAcd,KAAKc,WACnC,CAEA,gBAAAJ,GACE,MAAMK,EAAgBf,KAAKK,QAAQU,cAAc,CAAEC,SAAS,IACvDD,EAAcE,SACnBjB,KAAKQ,SAASM,YAAcC,EAAc,IAAID,aAAe,GAC/D,EAGF,MAAM,KAAEI,GAAS,CACfA,KAAM,CAAEC,SAAU,IAAM,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,OAAOtB,EAAQ,CAAE7C,MAAM,EAAMoE,QAAQ,GACtE,CAAE,MAAOC,GAEPC,QAAQC,KAAK,qCACf,CAEArH,KAAKyG,YAAYtG,UAAY2C,CAC/B,CAEA,gBAAAuC,CAAiBiC,GACXA,EACFtH,KAAKyG,YAAYG,aAAa,QAASU,GAEvCtH,KAAKyG,YAAYI,gBAAgB,QAErC,EAGK,MAAMnF,GAAoB,SAC/B,QAAiB,CACfL,SAAU,CACRC,UAAW,CAAEH,SAAU,IAAM,QAASI,SAAU,SAChDgG,YAAa,CAAEpG,SAAU,IAAM,QAASI,SAAU,UAAWgB,SAAU,gBACvEf,cAAe,CAAEL,SAAU,IAAM,QAASI,SAAU,aACpDU,SAAU,CAAC,EACXgC,WAAY,CAAC,EACbE,WAAY,CAAC,EACbqD,eAAgB,CACd,CAAErG,SAAU,IAAM,eAAgBI,SAAU,eAC5C,CAAEJ,SAAU,IAAM,UAAWI,SAAU,gBAEzCE,UAAW,CAAEF,SAAU,SACvBqC,eAAgB,CAAErC,SAAU,eAC5BwC,UAAW,CAAC,EACZ0D,UAAW,CAAEtG,SAAU,IAAKI,SAAU,SACtCmG,mBAAoB,CAAEvG,SAAU,IAAKI,SAAU,mBAC/CoG,wBAAyB,CAAExG,SAAU,UAAWI,SAAU,mBAC1DqG,UAAW,CAAC,EACZC,SAAU,CAAC,MAGf,QAAiB,CAAEpF,uBAAuB,QAAiB,WAC3D,QAAiB,CAAEA,uBAAuB,QAAiB,UAC3D,KACA,KA1B+B,CA2B/BsC,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-alert/AlertClass.js","webpack://@descope/web-components-ui/./src/components/descope-alert/index.js","webpack://@descope/web-components-ui/../components/descope-enriched-text/src/component/consts.js","webpack://@descope/web-components-ui/../components/descope-enriched-text/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-enriched-text/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/TextClass.js","webpack://@descope/web-components-ui/../components/descope-link/src/component/LinkClass.js","webpack://@descope/web-components-ui/../components/descope-link/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-enriched-text/src/component/EnrichedTextClass.js"],"sourcesContent":["import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { compose } from '../../helpers';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { EnrichedTextClass } from '@descope-ui/descope-enriched-text/class';\nimport { injectStyle, observeChildren, syncAttrs } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('alert');\n\nclass RawAlert extends createBaseClass({ componentName, baseSelector: ':host > div' }) {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <div class=\"icon\"></div>\n <div class=\"content\">\n <descope-enriched-text>\n <slot></slot>\n </descope-enriched-text>\n </div>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n :host > div {\n display: flex;\n width: 100%;\n }\n :host([empty=\"true\"]) {\n display: none;\n }\n .icon {\n flex-shrink: 0;\n }\n .content {\n display: flex;\n flex-wrap: wrap;\n white-space: normal;\n overflow-wrap: break-word;\n }\n `,\n this\n );\n }\n\n init() {\n super.init?.();\n\n this.slotEle = this.shadowRoot.querySelector('slot');\n this.textComp = this.shadowRoot.querySelector('descope-enriched-text');\n\n this.slotEle.addEventListener('slotchange', this.handleSlotChange.bind(this));\n\n syncAttrs(this.textComp, this, { includeAttrs: ['empty'] });\n\n observeChildren(this, this.handleChildrenChange.bind(this));\n\n forwardAttrs(this, this.textComp, {\n includeAttrs: ['variant', 'full-width', 'link-target-blank'],\n });\n }\n\n handleChildrenChange() {\n this.textComp.textContent = this.textContent;\n }\n\n handleSlotChange() {\n const assignedNodes = this.slotEle.assignedNodes({ flatten: true });\n if (!assignedNodes.length) return;\n this.textComp.textContent = assignedNodes[0]?.textContent || '';\n }\n}\n\nconst { icon } = {\n icon: { selector: () => '.icon' },\n};\n\nexport const AlertClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDirection: { selector: () => ':host', property: 'direction' },\n textColor: {\n selector: EnrichedTextClass.componentName,\n property: EnrichedTextClass.cssVarList.textColor,\n },\n backgroundColor: {},\n borderColor: {},\n borderWidth: {},\n borderStyle: {},\n borderRadius: {},\n fontSize: [\n {},\n {\n selector: EnrichedTextClass.componentName,\n property: EnrichedTextClass.cssVarList.fontSize,\n },\n ],\n gap: {},\n horizontalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],\n verticalPadding: [{ property: 'padding-right' }, { property: 'padding-left' }],\n alignItems: {},\n justifyContent: {},\n icon: [\n { ...icon, property: 'content' },\n { ...icon, property: 'display', fallback: 'none' },\n ],\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('enriched-text') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n draggableMixin,\n componentNameValidationMixin\n)(RawAlert);\n","import '@descope-ui/descope-enriched-text';\nimport { componentName, AlertClass } from './AlertClass';\n\ncustomElements.define(componentName, AlertClass);\n\nexport { AlertClass, componentName };\n","export const disableRules = [\n 'blockquote',\n 'list',\n 'image',\n 'table',\n 'code',\n 'hr',\n 'backticks',\n 'fence',\n 'reference',\n 'heading',\n 'lheading',\n 'html_block',\n];\n","export const decodeHTML = (html) => {\n const textArea = document.createElement('textarea');\n textArea.innerHTML = html;\n return textArea.value;\n};\n","import '@descope-ui/descope-link';\n\nimport { componentName, EnrichedTextClass } from './EnrichedTextClass';\n\ncustomElements.define(componentName, EnrichedTextClass);\n\nexport { EnrichedTextClass, componentName };\n","import { componentName, TextClass } from './TextClass';\n\ncustomElements.define(componentName, TextClass);\n\nexport { TextClass, componentName };\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n injectStyle,\n observeChildren,\n} from '@descope-ui/common/components-helpers';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\n\nexport const componentName = getComponentName('text');\n\nclass RawText extends createBaseClass({\n componentName,\n baseSelector: ':host > slot',\n}) {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <slot part=\"text-wrapper\"></slot>\n `;\n\n injectStyle(`\n :host {\n display: inline-block;\n line-height: 1em;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n `, this);\n }\n\n get hideWhenEmpty() {\n return this.getAttribute('hide-when-empty') === 'true';\n }\n\n init() {\n super.init();\n\n observeChildren(this, () => {\n const hasChildren = !!this.childNodes.length;\n this.style.display = !hasChildren && this.hideWhenEmpty ? 'none' : '';\n });\n }\n}\n\nconst { host } = {\n host: { selector: () => ':host' }\n}\n\nexport const TextClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDirection: { selector: () => ':host', property: 'direction' },\n fontSize: {},\n textColor: [\n { property: 'color' }\n ],\n textLineHeight: { property: 'line-height' },\n textLetterSpacing: { property: 'letter-spacing' },\n textShadow: {},\n textAlign: {},\n textTransform: {},\n fontFamily: {},\n fontStyle: {},\n fontWeight: {},\n borderWidth: {},\n borderStyle: {},\n borderColor: {},\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawText);\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n forwardAttrs,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { TextClass } from '@descope-ui/descope-text/class';\n\nexport const componentName = getComponentName('link');\n\nclass RawLink extends createBaseClass({ componentName, baseSelector: ':host a' }) {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<div>\n\t\t\t<descope-text>\n\t\t\t\t<a>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</a>\n\t\t\t</descope-text>\n\t\t</div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n\t\t\tdisplay: inline-block;\n line-height: 1em;\n\t\t}\n\t\t:host a {\n\t\t\tdisplay: inline;\n\t\t}\n `,\n this\n );\n\n forwardAttrs(this, this.shadowRoot.querySelector('a'), {\n includeAttrs: ['href', 'target', 'tooltip'],\n mapAttrs: {\n tooltip: 'title',\n },\n });\n\n forwardAttrs(this, this.shadowRoot.querySelector('descope-text'), {\n includeAttrs: ['mode', 'variant'],\n });\n }\n}\n\nconst selectors = {\n host: { selector: () => ':host' },\n link: { selector: () => ':host a' },\n anchor: {},\n wrapper: { selector: () => ':host > div' },\n text: { selector: () => TextClass.componentName },\n};\n\nconst { anchor, text, host, wrapper, link } = selectors;\n\nexport const LinkClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...text, property: 'direction' },\n textAlign: wrapper,\n textDecoration: { ...link, property: 'text-decoration', fallback: 'none' },\n textColor: [\n { ...anchor, property: 'color' },\n { ...text, property: TextClass.cssVarList.textColor },\n ],\n cursor: anchor,\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawLink);\n","import { componentName, LinkClass } from './LinkClass';\nimport '@descope-ui/descope-text';\n\ncustomElements.define(componentName, LinkClass);\n\nexport { LinkClass, componentName };\n","/* eslint-disable no-param-reassign */\n\nimport MarkdownIt from 'markdown-it';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '@descope-ui/common/components-mixins';\nimport { compose } from '@descope-ui/common/utils';\nimport { disableRules } from './consts';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { decodeHTML } from './helpers';\nimport { getComponentName, injectStyle, observeChildren } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('enriched-text');\n\nclass EnrichedText extends createBaseClass({ componentName, baseSelector: ':host > div' }) {\n #origLinkRenderer;\n\n #origEmRenderer;\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"content\"></div>\n `;\n\n injectStyle(\n `\n :host {\n line-height: 1em;\n word-break: break-word;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n *, *:last-child {\n margin: 0;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p {\n margin-bottom: 1em;\n }\n a {\n cursor: pointer;\n }\n blockquote {\n padding: 0 2em;\n }\n u {\n text-decoration: underline\n }\n s {\n color: currentColor;\n }\n `,\n this\n );\n\n this.#initProcessor();\n\n observeChildren(this, this.#parseChildren.bind(this));\n }\n\n static get observedAttributes() {\n return ['readonly', 'link-target-blank'];\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'readonly') {\n this.onReadOnlyChange(newValue === 'true');\n }\n\n if (attrName === 'link-target-blank') {\n this.#initProcessor();\n }\n }\n }\n\n // We're overriding the rule for em with single underscore to perform as underline. (_underline_)\n customUnderlineRenderer() {\n this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {\n if (tokens[idx].markup === '_') tokens[idx].tag = 'u';\n return this.#origEmRenderer(tokens, idx, options, env, self);\n };\n this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {\n if (tokens[idx].markup === '_') tokens[idx].tag = 'u';\n return this.#origEmRenderer(tokens, idx, options, env, self);\n };\n }\n\n #customizeLinkRenderer() {\n if (this.linkTargetBlank) {\n this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {\n // Add a new `target` attribute, or replace the value of the existing one.\n tokens[idx].attrSet('target', '_blank');\n // Pass the token to the default renderer.\n return this.#origLinkRenderer(tokens, idx, options, env, self);\n };\n } else {\n this.processor.renderer.rules.link_open = this.#origLinkRenderer;\n }\n }\n\n #disableCustomRules() {\n if (!this.processor) {\n return;\n }\n this.processor.disable(disableRules);\n }\n\n #updateProcessorRules() {\n this.#disableCustomRules();\n }\n\n #storeOrigRenderers() {\n const defaultLinkRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;\n\n const defaultStrongRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;\n }\n\n #initProcessor() {\n this.processor = new MarkdownIt('commonmark', { html: true });\n this.#storeOrigRenderers();\n this.#updateProcessorRules();\n this.#customizeLinkRenderer();\n this.customUnderlineRenderer();\n }\n\n get linkTargetBlank() {\n return this.getAttribute('link-target-blank') === 'true';\n }\n\n get contentNode() {\n return this.shadowRoot.querySelector('.content');\n }\n\n #parseChildren() {\n if (!this.processor) {\n return;\n }\n\n let html = decodeHTML(this.innerHTML);\n\n if (!html?.trim() && this.isConnected) {\n this.setAttribute('empty', 'true');\n } else {\n this.removeAttribute('empty');\n }\n\n try {\n const tokens = this.processor.parse(html, { references: undefined });\n html = this.processor.renderer.render(tokens, { html: true, breaks: true });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Not parsing invalid markdown token');\n }\n\n this.contentNode.innerHTML = html;\n }\n\n onReadOnlyChange(isReadOnly) {\n if (isReadOnly) {\n this.contentNode.setAttribute('inert', isReadOnly);\n } else {\n this.contentNode.removeAttribute('inert');\n }\n }\n}\n\nexport const EnrichedTextClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDisplay: { selector: () => ':host', property: 'display', fallback: 'inline-block' },\n hostDirection: { selector: () => ':host', property: 'direction' },\n fontSize: {},\n fontFamily: {},\n fontWeight: {},\n fontWeightBold: [\n { selector: () => ':host strong', property: 'font-weight' },\n { selector: () => ':host b', property: 'font-weight' },\n ],\n textColor: { property: 'color' },\n textLineHeight: { property: 'line-height' },\n textAlign: {},\n linkColor: { selector: 'a', property: 'color' },\n linkTextDecoration: { selector: 'a', property: 'text-decoration' },\n linkHoverTextDecoration: { selector: 'a:hover', property: 'text-decoration' },\n minHeight: {},\n minWidth: {},\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('link') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n draggableMixin,\n componentNameValidationMixin\n)(EnrichedText);\n"],"names":["componentName","RawAlert","createBaseClass","baseSelector","constructor","super","this","attachShadow","mode","innerHTML","init","slotEle","shadowRoot","querySelector","textComp","addEventListener","handleSlotChange","bind","includeAttrs","handleChildrenChange","textContent","assignedNodes","flatten","length","icon","selector","AlertClass","mappings","hostWidth","property","hostDirection","textColor","EnrichedTextClass","cssVarList","backgroundColor","borderColor","borderWidth","borderStyle","borderRadius","fontSize","gap","horizontalPadding","verticalPadding","alignItems","justifyContent","fallback","iconSize","componentNameOverride","customElements","define","disableRules","decodeHTML","html","textArea","document","createElement","value","RawText","hideWhenEmpty","getAttribute","hasChildren","childNodes","style","display","host","TextClass","textLineHeight","textLetterSpacing","textShadow","textAlign","textTransform","fontFamily","fontStyle","fontWeight","RawLink","mapAttrs","tooltip","selectors","link","anchor","wrapper","text","LinkClass","textDecoration","cursor","EnrichedText","observedAttributes","attributeChangedCallback","attrName","oldValue","newValue","onReadOnlyChange","customUnderlineRenderer","processor","renderer","rules","em_open","tokens","idx","options","env","self","markup","tag","em_close","linkTargetBlank","link_open","attrSet","disable","_","renderToken","contentNode","trim","isConnected","setAttribute","removeAttribute","parse","references","undefined","render","breaks","e","console","warn","isReadOnly","hostDisplay","fontWeightBold","linkColor","linkTextDecoration","linkHoverTextDecoration","minHeight","minWidth"],"sourceRoot":""}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[6028],{3393:(t,e,n)=>{n.d(e,{y:()=>o});var a=n(9696),r=n(79365),i=n(81365);const o=(...t)=>(0,a.Zz)(r.XX,r._$,r.yF,r.jd)((0,i.q)(...t))},10767:(t,e,n)=>{n.d(e,{G:()=>a});const a=t=>class extends t{get isLoading(){return"true"===this.getAttribute("loading")}click(){this.isLoading||super.click()}}},19624:(t,e,n)=>{n.d(e,{J:()=>u,T:()=>l});var a=n(63200),r=n(25964),i=n(88961),o=n(98538),s=n(10767);const l=(0,r.xE)("button"),{host:d,label:p,slottedIcon:h}={host:{selector:()=>":host"},label:{selector:"::part(label)"},slottedIcon:{selector:()=>"::slotted(descope-icon)"}};let c;const u=(0,a.Zz)((0,i.RF)({mappings:{hostWidth:{property:"width"},hostHeight:{property:"height"},hostDirection:{...d,property:"direction"},fontSize:{},fontFamily:{},cursor:{},backgroundColor:{},outlineOffset:{},outlineColor:{},outlineStyle:{},outlineWidth:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-right",fallback:"0.875em"},{property:"padding-left",fallback:"0.875em"}],labelTextColor:{property:"color"},iconColor:{selector:()=>"::slotted(*)",property:o.S.cssVarList.fill},labelTextDecoration:{...p,property:"text-decoration"},labelSpacing:{...p,property:"gap"},textAlign:{...p,property:"justify-content",fallback:"center"},iconSize:[{...h,property:"width"},{...h,property:"height"}]}}),s.G,i.VO,i.tQ)((0,i.tz)({slots:["","prefix","label","suffix"],wrappedEleName:"vaadin-button",style:()=>`\n\t\t\t\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n\n\t\t\t\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n\n\t\t\t${c}\n\t\t\tvaadin-button::part(label) { pointer-events: none; }\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${u.cssVarList.outlineWidth}) + var(${u.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width="true"]) {\n width: var(${u.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${u.cssVarList.hostHeight}) - var(${u.cssVarList.outlineWidth}) - var(${u.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square="true"]:not([full-width="true"]) {\n\t\t\t\twidth: calc(var(${u.cssVarList.hostWidth}) - var(${u.cssVarList.outlineWidth}) - var(${u.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:l})),{color:y,fontSize:b}=u.cssVarList;c=`\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading="true"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${y});\n\t\ttop: calc(50% - (var(${b}) / 2));\n\t\tleft: calc(50% - (var(${b}) / 2));\n\t\tborder-width: calc(var(${b}) / 10);\n\t\twidth: var(${b});\n\t\theight: var(${b});\n\t}\n\t:host([disabled="true"]),\n\t:host([loading="true"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading="true"]) ::part(prefix),\n\t:host([loading="true"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`},30576:(t,e,n)=>{n.r(e),n.d(e,{ButtonClass:()=>a.J,componentName:()=>a.T});var a=n(19624);n(83799),customElements.define(a.T,a.J)},49224:(t,e,n)=>{n.d(e,{Bl:()=>d,Et:()=>r,Ey:()=>o,Ln:()=>l,Nq:()=>s,Pj:()=>i,Xs:()=>c,_B:()=>h,tj:()=>p,xP:()=>a});const a=t=>!Number.isNaN(Number(t)),r=t=>!!String(t||"").trim()&&!Number.isNaN(Number(t)),i=t=>{const e=s(t);return[e.getFullYear(),e.getMonth()+1,e.getDate()]},o=(t,e)=>{const[n,a,r]=i(t),o={DD:String(r).padStart(2,"0"),MM:String(a).padStart(2,"0"),YYYY:String(n)};return e.replace(/DD|MM|YYYY/g,(t=>o[t]))},s=t=>"number"==typeof t?new Date(t):"string"==typeof t?new Date(t.replace(/-/g,"/")):new Date,l=()=>s().getTime(),d=t=>s(t).getFullYear().toString(),p=t=>(s(t).getMonth()+1).toString(),h=()=>s().getDate(),c=t=>{const e=new CSSStyleSheet;e.insertRule(":host{display:block!important;}"),t?.shadowRoot?.adoptedStyleSheets?.push(e)}},64101:(t,e,n)=>{n.d(e,{QF:()=>y,SP:()=>a,SZ:()=>b,Tv:()=>c,US:()=>l,V$:()=>o,eT:()=>s,lv:()=>u,mx:()=>d,nr:()=>h,rR:()=>p,ui:()=>r,wJ:()=>i});const a=["MM/DD/YYYY","DD/MM/YYYY","YYYY/MM/DD"],r=a[0],i="YYYY-MM-DD",o=100,s="/",l=["January","February","March","April","May","June","July","August","September","October","November","December"],d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p={MONTH:{id:"month",min:1,max:12,placeholder:"MM"},DAY:{id:"day",min:1,max:31,placeholder:"DD"},YEAR:{id:"year",min:0,max:9999,placeholder:"YYYY"}},h={year:{min:1900,max:2099}},c="Done",u="Cancel",y="Today",b=150},73551:(t,e,n)=>{n.d(e,{$J:()=>c,I4:()=>o,Kl:()=>u,LJ:()=>h,Qv:()=>i,X6:()=>l,cy:()=>a,fu:()=>d,kG:()=>p,lS:()=>s,zm:()=>r});const a=t=>`\n :host {\n padding: calc(var(${t.inputOutlineWidth}) + var(${t.inputOutlineOffset}))\n }\n`,r=t=>`\n ${t} {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n`,i=t=>`\n ${t}::part(input-field) {\n overflow: hidden;\n padding: 0;\n box-shadow: none;\n }\n`,o=t=>`\n ${t} > label,\n ${t}::part(label),\n ${t}::part(required-indicator) {\n cursor: pointer;\n }\n`,s=(t,e="input")=>`\n ${t}[disabled] > ${e}:placeholder-shown,\n\t${t}[readonly] > ${e}:placeholder-shown {\n\t\topacity: 1;\n\t}\n`,l=()=>"\n :host {\n --vaadin-field-default-width: auto;\n box-sizing: border-box;\n }\n",d=t=>`\n ${t}::part(input-field)::after {\n opacity: 0;\n }\n`,p=t=>`\n ${t}::part(input-field)::after {\n background: none;\n }\n`,h=(t,e)=>`\n ${r(t)}\n ${o(t)}\n ${s(t)}\n ${i(t)}\n ${((t,e)=>`\n ${t} input:-webkit-autofill,\n ${t} input:-webkit-autofill::first-line,\n ${t} input:-webkit-autofill:hover,\n ${t} input:-webkit-autofill:active,\n ${t} input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(${e.inputValueTextColor});\n box-shadow: 0 0 0 var(${e.inputHeight}) var(${e.inputBackgroundColor}) inset;\n }\n`)(t,e)}\n ${p(t)}\n ${(t=>`\n ${t}::before {\n\t\theight: unset;\n\t}\n`)(t)}\n ${(t=>`\n ${t} > input {\n -webkit-mask-image: none;\n min-height: 0;\n box-sizing: border-box;\n }\n`)(t)}\n ${(t=>`\n ${t}::part(input-field)::after {\n border: none;\n }\n`)(t)}\n`,c=t=>`\n :host ::part(error-message) {\n direction: ltr;\n }\n :host([required]) ::part(required-indicator) {\n width: 1em;\n display: inline-flex;\n }\n :host([required]) ::part(required-indicator)::after {\n position: static;\n }\n :host([has-label]) ::part(label) {\n padding-right: 0;\n padding-bottom: 0;\n display: flex;\n width: 100%;\n }\n ${t} [slot="label"] {\n max-width: calc(100% - 1em);\n overflow: hidden;\n text-overflow: ellipsis;\n padding-bottom: 0.5em;\n }\n`,u=()=>'\n :host([label-type="floating"]) {\n position: relative;\n }\n :host([label-type="floating"][has-label]) [slot="label"] {\n padding: 0;\n }\n :host([label-type="floating"][has-label]) > ::part(label) {\n z-index: 1;\n padding: 0;\n width: auto;\n }\n '},80071:(t,e,n)=>{n.d(e,{ZM:()=>r,i1:()=>i,ki:()=>a});const a='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9 5H15V4.50468C15 4.21404 15.226 4 15.5047 4H16.4953C16.786 4 17 4.22595 17 4.50468V5H18.7568C19.3028 5 19.75 5.44725 19.75 5.99896V7.00104C19.75 7.55734 19.3053 8 18.7568 8H5.24317C4.69717 8 4.25 7.55275 4.25 7.00104V5.99896C4.25 5.44266 4.69466 5 5.24317 5H7V4.50468C7 4.21404 7.22596 4 7.50468 4H8.49532C8.78596 4 9 4.22595 9 4.50468V5ZM5.50468 9H6.49532C6.78596 9 7 9.22596 7 9.50468V10.4953C7 10.786 6.77404 11 6.49532 11H5.50468C5.21404 11 5 10.774 5 10.4953V9.50468C5 9.21404 5.22595 9 5.50468 9ZM8.50468 9H9.49532C9.78596 9 10 9.22596 10 9.50468V10.4953C10 10.786 9.77404 11 9.49532 11H8.50468C8.21404 11 8 10.774 8 10.4953V9.50468C8 9.21404 8.22596 9 8.50468 9ZM11.5047 9H12.4953C12.786 9 13 9.22596 13 9.50468V10.4953C13 10.786 12.774 11 12.4953 11H11.5047C11.214 11 11 10.774 11 10.4953V9.50468C11 9.21404 11.226 9 11.5047 9ZM5.50468 12H6.49532C6.78596 12 7 12.226 7 12.5047V13.4953C7 13.786 6.77404 14 6.49532 14H5.50468C5.21404 14 5 13.774 5 13.4953V12.5047C5 12.214 5.22595 12 5.50468 12ZM8.50468 12H9.49532C9.78596 12 10 12.226 10 12.5047V13.4953C10 13.786 9.77404 14 9.49532 14H8.50468C8.21404 14 8 13.774 8 13.4953V12.5047C8 12.214 8.22596 12 8.50468 12ZM11.5047 12H12.4953C12.786 12 13 12.226 13 12.5047V13.4953C13 13.786 12.774 14 12.4953 14H11.5047C11.214 14 11 13.774 11 13.4953V12.5047C11 12.214 11.226 12 11.5047 12ZM5.50468 15H6.49532C6.78596 15 7 15.226 7 15.5047V16.4953C7 16.786 6.77404 17 6.49532 17H5.50468C5.21404 17 5 16.774 5 16.4953V15.5047C5 15.214 5.22595 15 5.50468 15ZM8.50468 15H9.49532C9.78596 15 10 15.226 10 15.5047V16.4953C10 16.786 9.77404 17 9.49532 17H8.50468C8.21404 17 8 16.774 8 16.4953V15.5047C8 15.214 8.22596 15 8.50468 15ZM11.5047 15H12.4953C12.786 15 13 15.226 13 15.5047V16.4953C13 16.786 12.774 17 12.4953 17H11.5047C11.214 17 11 16.774 11 16.4953V15.5047C11 15.214 11.226 15 11.5047 15ZM14.5047 9H15.4953C15.786 9 16 9.22596 16 9.50468V10.4953C16 10.786 15.774 11 15.4953 11H14.5047C14.214 11 14 10.774 14 10.4953V9.50468C14 9.21404 14.226 9 14.5047 9ZM14.5047 12H15.4953C15.786 12 16 12.226 16 12.5047V13.4953C16 13.786 15.774 14 15.4953 14H14.5047C14.214 14 14 13.774 14 13.4953V12.5047C14 12.214 14.226 12 14.5047 12ZM14.5047 15H15.4953C15.786 15 16 15.226 16 15.5047V16.4953C16 16.786 15.774 17 15.4953 17H14.5047C14.214 17 14 16.774 14 16.4953V15.5047C14 15.214 14.226 15 14.5047 15ZM17.5047 15H18.4953C18.786 15 19 15.226 19 15.5047V16.4953C19 16.786 18.774 17 18.4953 17H17.5047C17.214 17 17 16.774 17 16.4953V15.5047C17 15.214 17.226 15 17.5047 15ZM5.50468 18H6.49532C6.78596 18 7 18.226 7 18.5047V19.4953C7 19.786 6.77404 20 6.49532 20H5.50468C5.21404 20 5 19.774 5 19.4953V18.5047C5 18.214 5.22595 18 5.50468 18ZM8.50468 18H9.49532C9.78596 18 10 18.226 10 18.5047V19.4953C10 19.786 9.77404 20 9.49532 20H8.50468C8.21404 20 8 19.774 8 19.4953V18.5047C8 18.214 8.22596 18 8.50468 18ZM11.5047 18H12.4953C12.786 18 13 18.226 13 18.5047V19.4953C13 19.786 12.774 20 12.4953 20H11.5047C11.214 20 11 19.774 11 19.4953V18.5047C11 18.214 11.226 18 11.5047 18ZM14.5047 18H15.4953C15.786 18 16 18.226 16 18.5047V19.4953C16 19.786 15.774 20 15.4953 20H14.5047C14.214 20 14 19.774 14 19.4953V18.5047C14 18.214 14.226 18 14.5047 18ZM17.5047 18H18.4953C18.786 18 19 18.226 19 18.5047V19.4953C19 19.786 18.774 20 18.4953 20H17.5047C17.214 20 17 19.774 17 19.4953V18.5047C17 18.214 17.226 18 17.5047 18ZM17.5047 12H18.4953C18.786 12 19 12.226 19 12.5047V13.4953C19 13.786 18.774 14 18.4953 14H17.5047C17.214 14 17 13.774 17 13.4953V12.5047C17 12.214 17.226 12 17.5047 12ZM17.5047 9H18.4953C18.786 9 19 9.22596 19 9.50468V10.4953C19 10.786 18.774 11 18.4953 11H17.5047C17.214 11 17 10.774 17 10.4953V9.50468C17 9.21404 17.226 9 17.5047 9Z" fill="#808080"/>\n</svg>\n',r='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.27283 6.78069C8.87912 6.34164 8.91587 5.66655 9.35492 5.27283C9.79397 4.87912 10.4691 4.91587 10.8628 5.35492C10.8628 5.35492 16.0022 10.9543 16.366 11.36C16.7298 11.7657 16.7298 12.2392 16.366 12.6448L10.8628 18.6451C10.4691 19.0841 9.79397 19.1209 9.35492 18.7272C8.91587 18.3334 8.87912 17.6584 9.27283 17.2193L14.1368 12L9.27283 6.78069Z" fill="#808080"/>\n</svg>',i='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.7272 17.2193C15.1209 17.6584 15.0841 18.3334 14.6451 18.7272C14.206 19.1209 13.5309 19.0841 13.1372 18.6451C13.1372 18.6451 7.99776 13.0457 7.63399 12.64C7.27023 12.2343 7.27023 11.7608 7.63399 11.3552L13.1372 5.35492C13.5309 4.91587 14.206 4.87912 14.6451 5.27283C15.0841 5.66655 15.1209 6.34164 14.7272 6.78069L9.86322 12L14.7272 17.2193Z" fill="#808080"/>\n</svg>'},88350:(t,e,n)=>{n.r(e),n.d(e,{CalendarClass:()=>q,componentName:()=>m}),n(27092),n(30576);var a=n(3393),r=n(9696),i=n(97810),o=n(73551),s=n(79365),l=n(49224),d=n(80071),p=n(64101);const h=(t,e)=>Array.isArray(t)&&t.length===e&&t.filter(Boolean).length===e,c=({label:t,dataId:e,dataName:n})=>`\n\t<div class="combo-box-item"\n\t\tdata-id="${e}"\n\t\tdata-name="${n}"\n\t>\n\t\t\t${t}\n\t</div>\n`,u=(t=p.US)=>t.map(((t,e)=>c({label:t,dataId:e+1,dataName:t}))).join(""),y=(t,e)=>{const[n,a]=(0,l.Pj)(e),[r,i]=(0,l.Pj)(t);return r===n&&i===a},b=(t,e,n)=>(t.addEventListener("input",e),t.addEventListener("focusout",n),t);var v=n(19624),g=n(25964);const m=(0,i.xE)("calendar"),C=["initial-value","initial-year","initial-month","years-range","calendar-months","calendar-weekdays","calendar-label-today","st-host-direction","disabled","full-width"],w=["calendar-label-submit","calendar-label-cancel"],f=(0,a.y)({componentName:m,baseSelector:"div"}),{calendar:x,day:V,dayEntry:S,currentDay:M,selectedDay:$,disabledDay:N,weekday:D,topNav:H,topNavSelectors:E,bottomNav:k,navPrev:L,navNext:B,navPrevRTL:Y,navNextRTL:T,yearInput:I,monthInput:A}={calendar:{selector:()=>".calendar"},topNav:{selector:()=>".nav.top-nav"},topNavSelectors:{selector:()=>".nav.top-nav .selectors > span"},bottomNav:{selector:()=>".nav.bottom-nav"},day:{selector:()=>".day"},dayEntry:{selector:()=>".day-entry"},currentDay:{selector:()=>".day-entry[data-current-day] .day"},selectedDay:{selector:()=>".day-entry[data-selected] .day"},disabledDay:{selector:()=>'.day-entry[data-disabled="true"] .day'},weekday:{selector:()=>".weekday"},navPrev:{selector:()=>".nav-prev"},navNext:{selector:()=>".nav-next"},navPrevRTL:{selector:()=>':host([st-host-direction="rtl"]) .nav-prev'},navNextRTL:{selector:()=>':host([st-host-direction="rtl"]) .nav-next'},yearInput:{selector:()=>".year-input"},monthInput:{selector:()=>".month-input"}},q=(0,r.Zz)((0,s.RF)({componentNameOverride:(0,i.xE)("input-wrapper")}),(0,s.RF)({mappings:{fontSize:{},fontFamily:{},hostWidth:[{selector:()=>":host",property:"width"},{selector:"table",property:"width"}],hostDirection:{property:"direction"},topNavVerticalPadding:[{...H,property:"padding-top"},{...H,property:"padding-bottom"}],topNavHorizointalPadding:[{...H,property:"padding-right"},{...H,property:"padding-left"}],topNavAlignment:{...H,property:"justify-content"},topNavGap:{...H,property:"gap"},topNavSelectorsGap:{...E,property:"gap"},bottomNavVerticalPadding:[{...k,property:"padding-top"},{...k,property:"padding-bottom"}],bottomNavHorizontalPadding:[{...k,property:"padding-right"},{...k,property:"padding-left"}],bottomNavAlignment:{...k,property:"justify-content"},bottomNavGap:{...k,property:"gap"},navMarginBottom:{...H,property:"margin-bottom"},calendarPadding:[{...x,property:"padding-bottom"},{...x,property:"padding-right"},{...x,property:"padding-left"}],navBorderBottomWidth:{...H,property:"border-bottom-width"},navBorderBottomColor:{...H,property:"border-bottom-color"},navBorderBottomStyle:{...H,property:"border-bottom-style"},weekdayFontSize:{...D,property:"font-size"},weekdayFontWeight:{...D,property:"font-weight"},currentDayBorderColor:{...M,property:"border-color"},currentDayBorderWidth:{...M,property:"border-width"},currentDayBorderStyle:{...M,property:"border-style"},dayHeight:{...S,property:"height"},daySize:[{...V,property:"height"},{...V,property:"width"}],dayPadding:{...V,property:"padding"},dayRadius:{...V,property:"border-radius"},dayTextAlign:{...V,property:"text-align"},dayBlockAlign:{...V,property:"margin"},dayTextColor:{...V,property:"color"},dayFontWeight:{...V,property:"font-weight"},dayBackgroundColor:{...V,property:"background-color"},dayCursor:{...V,property:"cursor"},dayFontSize:{...V,property:"font-size"},dayBackgroundColorHover:{selector:()=>".day:hover",property:"background-color"},daySelectedTextdColor:{...$,property:"color"},daySelectedBackgroundColor:{...$,property:"background-color"},dayDisabledTextdColor:{...N,property:"color"},yearInputWidth:{...I,property:"width"},monthInputWidth:{...A,property:"width"},navButtonSize:[{...L,property:"width"},{...L,property:"height"},{...B,property:"width"},{...B,property:"height"}],navButtonCursor:[{...L,property:"cursor"},{...B,property:"cursor"}],navButtonRotation:[{...Y,property:"transform"},{...T,property:"transform"}],navButtonOpacity:[{...L,property:"opacity"},{...B,property:"opacity"}]}}),s.VO,s.tQ)(class extends f{static get observedAttributes(){return[].concat(f.observedAttributes||[],C,w)}preview;timestamp;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <nav class="nav top-nav">\n <div class="nav-prev">\n </div>\n <div class="selectors"></div>\n <div class="nav-next">\n </div>\n </nav>\n <div class="calendar"></div>\n <nav class="nav bottom-nav">\n <descope-button class="cancel-button" variant="link" mode="primary">Cancel</descope-button>\n <descope-button class="submit-button" variant="link" mode="primary" disabled="true">Done</descope-button>\n </nav>\n </div>\n ',(0,g.fz)(`\n :host {\n display: inline-block;\n box-sizing: border-box;\n max-width: 100%;\n user-select: none;\n -webkit-user-select: none;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n [data-toggle-calendar] {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n }\n\n [data-disabled="true"] {\n pointer-events: none;\n }\n\n .calendar .day {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .nav {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n }\n\n .selectors,\n .selectors span {\n display: flex;\n justify-content: center;\n }\n\n descope-button {\n padding: 0;\n ${v.J.cssVarList.horizontalPadding}: 0;\n ${v.J.cssVarList.verticalPadding}: 0;\n ${v.J.cssVarList.outlineWidth}: 0;\n }\n\n .combo-box-item {\n display:flex;\n flex-direction: column;\n }\n\n ${(0,o.Kl)()}\n `,this)}set value(t){if(!t)return;const e=(0,l.Nq)(t).getTime();(0,l.xP)(e)&&e!==this.timestmap&&(this.timestamp=e,this.renderCalendar())}get value(){return this.timestamp?(0,l.Ey)(this.timestamp,p.wJ):""}get isSelectedView(){return y(this.preview,this.timestamp)}get isTodayView(){return y((0,l.Ln)(),this.preview)}get monthNames(){return(t=>{const e=t?.split(",");return h(e,12)?e:p.US})(this.getAttribute("calendar-months"))}get weekdayNames(){return(t=>{const e=t?.split?.(",");return h(e,7)?e:p.mx})(this.getAttribute("calendar-weekdays"))}get hasYearValue(){return!!this.yearInput.value}get hasMonthValue(){return!!this.monthInput.value}get yearsRange(){const t=this.getAttribute("years-range")?.split("-");if(2===t?.length){const[e,n]=t.map(Number);if(e<=n)return[e,n]}const e=(0,l.Nq)().getFullYear();return[e,e+p.V$]}init(){super.init?.(),this.initCalendar(),this.renderCalendar()}initCalendar(){this.calendar=this.shadowRoot.querySelector(".calendar"),this.navPrevEle=this.shadowRoot.querySelector(".nav-prev"),this.navNextEle=this.shadowRoot.querySelector(".nav-next"),this.submitButton=this.shadowRoot.querySelector(".submit-button"),this.cancelButton=this.shadowRoot.querySelector(".cancel-button"),this.initInputs(),this.initNav(),this.addEventListener("day-changed",(()=>this.submitButton.removeAttribute("disabled"))),this.submitButton.shadowRoot.querySelector("vaadin-button").setAttribute("disabled","true")}initInputs(){const t=(()=>{const t=document.createElement("span");return t.innerHTML=`\n <descope-combo-box\n label-type="static"\n bordered="true"\n item-label-path="data-name"\n item-value-path="data-id"\n class="month-input"\n >\n ${u()}\n </descope-combo-box>\n <descope-combo-box\n allow-custom-value="true"\n label-type="static"\n bordered="true"\n item-label-path="data-name"\n item-value-path="data-id"\n class="year-input"\n no-empty-value="true"\n >\n </descope-combo-box>\n `,t})(this.monthNames,this.yearsRange);this.shadowRoot.querySelector(".selectors").appendChild(t),this.monthInput=b(this.shadowRoot.querySelector(".month-input"),this.onMonthChange.bind(this),this.onMonthInputBlur.bind(this)),this.yearInput=b(this.shadowRoot.querySelector(".year-input"),this.onYearChange.bind(this),this.onYearInputBlur.bind(this)),[this.monthInput,this.yearInput].forEach((t=>(0,i.EA)(this,t,{includeAttrs:["disabled","size","st-host-direction"]})))}initNav(){this.navPrevEle.addEventListener("click",this.navPrevMonth.bind(this)),this.navNextEle.addEventListener("click",this.navNextMonth.bind(this)),this.cancelButton.addEventListener("click",this.onCancel.bind(this)),this.submitButton.addEventListener("click",this.onSubmit.bind(this)),[this.navPrevEle,this.navNextEle].forEach((t=>(0,i.EA)(this,t,{includeAttrs:["size"]}))),this.shadowRoot.querySelector(".nav-next").innerHTML=d.ZM,this.shadowRoot.querySelector(".nav-prev").innerHTML=d.i1}onSubmit(){this.isDisabled||this.value&&this.dispatchEvent(new CustomEvent("date-submit",{detail:(0,l.Nq)(this.preview)}))}onCancel(){this.isDisabled||(this.dispatchEvent(new CustomEvent("cancel")),this.dispatchEvent(new CustomEvent("date-cancel")),this.clearSelectedDay())}clearSelectedDay(){this.getSelectedDayEle()?.removeAttribute("data-selected"),this.submitButton.setAttribute("disabled","true"),this.timestamp=""}updateInputs(){if(this.yearInput&&this.monthInput){const t=this.preview||(0,l.Ln)(),e=(0,l.Bl)(t),n=(0,l.tj)(t);this.monthInput.value=n,setTimeout((()=>{this.yearInput.baseElement.value=e}))}}renderCalendar(){const t=(0,l.Nq)(this.preview||(0,l.Ln)()).getTime(),[e,n]=(0,l.Pj)(t);this.calendar&&(this.calendar.innerHTML=((t,e,n)=>{const a=((t,e)=>new Date(t,e,0).getDate())(t,e),r=new Date(t,e-1,1).getDay();let i="<table>";i+=`<thead><tr>${n.reduce(((t,e)=>`${t}<th><span class="weekday">${e}</span></th>`),"")}</tr></thead>`,i+="<tbody>",i+="<tr>";for(let t=0;t<r;t++)i+="<td></td>";let o=r;for(let t=1;t<=a;t++)7===o&&(o=0,i+="</tr><tr>"),i+=`\n <td\n data-date-day="${t}"\n class="day-entry">\n <span class="day" data-date-day=${t}>\n ${t}\n </span>\n </td>\n `,o++;for(;o<7;)i+="<td></td>",o++;return i+="</tr></tbody></table>",i})(e,n,this.weekdayNames.map((t=>t.substring(0,3))))),Array.from(this.calendar?.querySelectorAll(".day-entry .day")||[]).forEach((t=>t.addEventListener("click",this.onDayChange.bind(this)))),this.updateInputs(),this.setSelectedDay(),this.setCurrentDay()}onDayChange(t){if(this.isDisabled)return;const e=(0,l.Nq)(this.preview);e.setDate(Number(t.target.getAttribute("data-date-day"))),this.value=(0,l.Ey)(e.getTime(),p.wJ),this.dispatchEvent(new CustomEvent("day-changed",{detail:e}))}onYearChange(t){if(!t.target.value)return;const e=(0,l.Nq)(this.preview);e.setFullYear(Number(t.target.value.trim())),this.preview=e.getTime(),this.renderCalendar(),this.dispatchEvent(new CustomEvent("year-changed",{detail:e}))}onMonthChange(t){if(!t.target.value)return;const e=(0,l.Nq)(this.preview);e.setMonth(Number(t.target.value)-1),this.preview=e.getTime(),this.renderCalendar(),this.dispatchEvent(new CustomEvent("month-changed",{detail:e}))}onYearInputBlur(t){this.yearInput.baseElement.value=t.target.value||(0,l.Bl)(this.preview)}onMonthInputBlur(t){this.monthInput.baseElement.value=t.target.value||(0,l.tj)(this.preview)}getSelectedDayEle(){const t=(0,l.Nq)(this.timestamp).getDate();return this.calendar?.querySelector(`[data-date-day="${t}"]`)}getCurrentDayEle(){return this.calendar?.querySelector(`[data-date-day="${(0,l._B)()}"]`)}clearSelectedDays(){const t=this.calendar?.querySelectorAll("[data-selected]");t&&t.forEach((t=>t.removeAttribute("data-selected")))}setSelectedDay(){this.clearSelectedDays(),this.value&&this.isSelectedView&&this.getSelectedDayEle().setAttribute("data-selected","true")}setCurrentDay(){if(this.isTodayView){const t=this.getCurrentDayEle(),e=this.getAttribute("calendar-label-today")||p.QF;t.setAttribute("data-current-day","true"),t.setAttribute("title",e)}}navPrevMonth(){if(this.isDisabled)return;const t=(t=>{const e=(0,l.Nq)(t),n=e.getMonth();if(0===n){const t=e.getFullYear();e.setFullYear(t-1),e.setMonth(11)}else e.setMonth(n-1);return e})(this.preview);this.preview=t.getTime(),this.renderCalendar()}navNextMonth(){if(this.isDisabled)return;const t=(t=>{const e=(0,l.Nq)(t),n=e.getMonth();if(11===n){const t=e.getFullYear();e.setFullYear(t+1),e.setMonth(0)}else e.setMonth(n+1);return e})(this.preview);this.preview=t.getTime(),this.renderCalendar()}clearValue(){this.timestamp="",this.value="",this.removeAttribute("preview"),this.submitButton.setAttribute("disabled","true")}onInitialValueChange(t){if(this.value)return;const e=(0,l.Nq)(t).getTime();(0,l.xP)(e)?(this.timestamp=e,this.preview=e):this.clearValue()}onYearsRangeChange(){setTimeout((()=>{this.yearInput&&(this.yearInput.innerHTML=(t=>{const[e,n]=t,a=[];for(let t=e;t<=n;t++)a.push(t);return a})(this.yearsRange).map((t=>c({label:t,dataId:t,dataName:t}))).join(""))}))}onMonthNamesChange(){setTimeout((()=>{this.monthInput&&(this.monthInput.innerHTML=u(this.monthNames))}))}onSubmitLabelChange(t){this.submitButton&&(this.submitButton.textContent=t||p.Tv)}onCancelLabelChange(t){this.cancelButton&&(this.cancelButton.textContent=t||p.lv)}onInitialMonthChange(t){const e=(0,l.Bl)(this.preview);this.preview=(0,l.Nq)(`${e}/${t}/1`).getTime()}onInitialYearChange(t){const e=(0,l.tj)(this.preview);this.preview=(0,l.Nq)(`${t}/${e}/1`).getTime()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(t,e,n),e!==n&&(w.includes(t)?("calendar-label-submit"===t&&this.onSubmitLabelChange(n),"calendar-label-cancel"===t&&this.onCancelLabelChange(n)):(n&&"initial-value"===t&&this.onInitialValueChange(n),n&&"initial-month"===t&&this.onInitialMonthChange(n),n&&"initial-year"===t&&this.onInitialYearChange(n),"years-range"===t&&this.onYearsRangeChange(Number(n)),"calendar-months"===t&&this.onMonthNamesChange(),"calendar-label-today"===t&&this.setCurrentDay(n),"disabled"===t&&setTimeout((()=>{this.cancelButton?.setAttribute("disabled","true"===n)})),this.renderCalendar()))}getValidity(){return this.isRequired&&!this.value?{valueMissing:!0}:{}}});customElements.define(m,q)},98538:(t,e,n)=>{n.d(e,{S:()=>s,T:()=>o});var a=n(88961),r=n(25964),i=n(63200);const o=(0,r.xE)("icon"),s=(0,i.Zz)((0,a.RF)({mappings:{fill:{}}}),a.VO,a.tQ)((0,a.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:o}))}}]);
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[6028],{3393:(t,e,n)=>{n.d(e,{y:()=>o});var a=n(9696),r=n(79365),i=n(81365);const o=(...t)=>(0,a.Zz)(r.XX,r._$,r.yF,r.jd)((0,i.q)(...t))},10767:(t,e,n)=>{n.d(e,{G:()=>a});const a=t=>class extends t{get isLoading(){return"true"===this.getAttribute("loading")}click(){this.isLoading||super.click()}}},19624:(t,e,n)=>{n.d(e,{J:()=>u,T:()=>l});var a=n(63200),r=n(25964),i=n(88961),o=n(98538),s=n(10767);const l=(0,r.xE)("button"),{host:d,label:p,slottedIcon:h}={host:{selector:()=>":host"},label:{selector:"::part(label)"},slottedIcon:{selector:()=>"::slotted(descope-icon)"}};let c;const u=(0,a.Zz)((0,i.RF)({mappings:{hostWidth:{property:"width"},hostHeight:{property:"height"},hostDirection:{...d,property:"direction"},fontSize:{},fontFamily:{},cursor:{},backgroundColor:{},outlineOffset:{},outlineColor:{},outlineStyle:{},outlineWidth:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-right",fallback:"0.875em"},{property:"padding-left",fallback:"0.875em"}],labelTextColor:{property:"color"},iconColor:{selector:()=>"::slotted(*)",property:o.S.cssVarList.fill},labelTextDecoration:{...p,property:"text-decoration"},labelSpacing:{...p,property:"gap"},textAlign:{...p,property:"justify-content",fallback:"center"},iconSize:[{...h,property:"width"},{...h,property:"height"}]}}),s.G,i.VO,i.tQ)((0,i.tz)({slots:["","prefix","label","suffix"],wrappedEleName:"vaadin-button",style:()=>`\n\t\t\t\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n\n\t\t\t\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n\n\t\t\t${c}\n\t\t\tvaadin-button::part(label) { pointer-events: none; }\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${u.cssVarList.outlineWidth}) + var(${u.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width="true"]) {\n width: var(${u.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${u.cssVarList.hostHeight}) - var(${u.cssVarList.outlineWidth}) - var(${u.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square="true"]:not([full-width="true"]) {\n\t\t\t\twidth: calc(var(${u.cssVarList.hostWidth}) - var(${u.cssVarList.outlineWidth}) - var(${u.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:l})),{color:y,fontSize:b}=u.cssVarList;c=`\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading="true"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${y});\n\t\ttop: calc(50% - (var(${b}) / 2));\n\t\tleft: calc(50% - (var(${b}) / 2));\n\t\tborder-width: calc(var(${b}) / 10);\n\t\twidth: var(${b});\n\t\theight: var(${b});\n\t}\n\t:host([disabled="true"]),\n\t:host([loading="true"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading="true"]) ::part(prefix),\n\t:host([loading="true"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`},30576:(t,e,n)=>{n.r(e),n.d(e,{ButtonClass:()=>a.J,componentName:()=>a.T});var a=n(19624);n(83799),customElements.define(a.T,a.J)},49224:(t,e,n)=>{n.d(e,{Bl:()=>p,Et:()=>i,Ey:()=>s,Ln:()=>d,Nq:()=>l,Pj:()=>o,Rm:()=>y,Xs:()=>u,_B:()=>c,tj:()=>h,xP:()=>r});var a=n(77421);const r=t=>!Number.isNaN(Number(t)),i=t=>!!String(t||"").trim()&&!Number.isNaN(Number(t)),o=t=>{const e=l(t);return[e.getFullYear(),e.getMonth()+1,e.getDate()]},s=(t,e)=>{const[n,a,r]=o(t),i={DD:String(r).padStart(2,"0"),MM:String(a).padStart(2,"0"),YYYY:String(n)};return e.replace(/DD|MM|YYYY/g,(t=>i[t]))},l=t=>"number"==typeof t?new Date(t):"string"==typeof t?new Date(t.replace(/-/g,"/")):new Date,d=()=>l().getTime(),p=t=>l(t).getFullYear().toString(),h=t=>(l(t).getMonth()+1).toString(),c=()=>l().getDate(),u=t=>{const e=new CSSStyleSheet;e.insertRule(":host{display:block!important;}"),t?.shadowRoot?.adoptedStyleSheets?.push(e)},y=(t,e)=>{const n=t.trim?.();return n?a.F[e].getDate(n):null}},64101:(t,e,n)=>{n.d(e,{QF:()=>y,SP:()=>a,SZ:()=>b,Tv:()=>c,US:()=>l,V$:()=>o,eT:()=>s,lv:()=>u,mx:()=>d,nr:()=>h,rR:()=>p,ui:()=>r,wJ:()=>i});const a=["MM/DD/YYYY","DD/MM/YYYY","YYYY/MM/DD"],r=a[0],i="YYYY-MM-DD",o=100,s="/",l=["January","February","March","April","May","June","July","August","September","October","November","December"],d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p={MONTH:{id:"month",min:1,max:12,placeholder:"MM"},DAY:{id:"day",min:1,max:31,placeholder:"DD"},YEAR:{id:"year",min:0,max:9999,placeholder:"YYYY"}},h={year:{min:1900,max:2099}},c="Done",u="Cancel",y="Today",b=150},73551:(t,e,n)=>{n.d(e,{$J:()=>c,I4:()=>o,Kl:()=>u,LJ:()=>h,Qv:()=>i,X6:()=>l,cy:()=>a,fu:()=>d,kG:()=>p,lS:()=>s,zm:()=>r});const a=t=>`\n :host {\n padding: calc(var(${t.inputOutlineWidth}) + var(${t.inputOutlineOffset}))\n }\n`,r=t=>`\n ${t} {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n`,i=t=>`\n ${t}::part(input-field) {\n overflow: hidden;\n padding: 0;\n box-shadow: none;\n }\n`,o=t=>`\n ${t} > label,\n ${t}::part(label),\n ${t}::part(required-indicator) {\n cursor: pointer;\n }\n`,s=(t,e="input")=>`\n ${t}[disabled] > ${e}:placeholder-shown,\n\t${t}[readonly] > ${e}:placeholder-shown {\n\t\topacity: 1;\n\t}\n`,l=()=>"\n :host {\n --vaadin-field-default-width: auto;\n box-sizing: border-box;\n }\n",d=t=>`\n ${t}::part(input-field)::after {\n opacity: 0;\n }\n`,p=t=>`\n ${t}::part(input-field)::after {\n background: none;\n }\n`,h=(t,e)=>`\n ${r(t)}\n ${o(t)}\n ${s(t)}\n ${i(t)}\n ${((t,e)=>`\n ${t} input:-webkit-autofill,\n ${t} input:-webkit-autofill::first-line,\n ${t} input:-webkit-autofill:hover,\n ${t} input:-webkit-autofill:active,\n ${t} input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(${e.inputValueTextColor});\n box-shadow: 0 0 0 var(${e.inputHeight}) var(${e.inputBackgroundColor}) inset;\n }\n`)(t,e)}\n ${p(t)}\n ${(t=>`\n ${t}::before {\n\t\theight: unset;\n\t}\n`)(t)}\n ${(t=>`\n ${t} > input {\n -webkit-mask-image: none;\n min-height: 0;\n box-sizing: border-box;\n }\n`)(t)}\n ${(t=>`\n ${t}::part(input-field)::after {\n border: none;\n }\n`)(t)}\n`,c=t=>`\n :host ::part(error-message) {\n direction: ltr;\n }\n :host([required]) ::part(required-indicator) {\n width: 1em;\n display: inline-flex;\n }\n :host([required]) ::part(required-indicator)::after {\n position: static;\n }\n :host([has-label]) ::part(label) {\n padding-right: 0;\n padding-bottom: 0;\n display: flex;\n width: 100%;\n }\n ${t} [slot="label"] {\n max-width: calc(100% - 1em);\n overflow: hidden;\n text-overflow: ellipsis;\n padding-bottom: 0.5em;\n }\n`,u=()=>'\n :host([label-type="floating"]) {\n position: relative;\n }\n :host([label-type="floating"][has-label]) [slot="label"] {\n padding: 0;\n }\n :host([label-type="floating"][has-label]) > ::part(label) {\n z-index: 1;\n padding: 0;\n width: auto;\n }\n '},77421:(t,e,n)=>{n.d(e,{F:()=>s});var a=n(64101),r=n(49224);const i={MM:"(0?[1-9]|1[0-2])",DD:"(0?[1-9]|[12][0-9]|3[01])",YYYY:"([0-9]{4})"},o=t=>{const e=(t=>`^${t.split(a.eT).map((t=>i[t])).join("\\D")}$`)(t),n=(t=>{const e=t.split(a.eT);return t=>{const n={};return e.forEach(((e,a)=>{n[e]=t[a+1]})),[n.YYYY,n.MM,n.DD]}})(t),o=new RegExp(e);return{pattern:e,validate:t=>o.test(t),getDate:t=>((t,e,n)=>{const i=e.exec(t);if(!i)return null;const[o,s,l]=n(i);return(0,r.Nq)([o,s,l].join(a.eT))})(t,o,n)}},s=Object.fromEntries(a.SP.map((t=>[t,o(t)])))},80071:(t,e,n)=>{n.d(e,{ZM:()=>r,i1:()=>i,ki:()=>a});const a='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9 5H15V4.50468C15 4.21404 15.226 4 15.5047 4H16.4953C16.786 4 17 4.22595 17 4.50468V5H18.7568C19.3028 5 19.75 5.44725 19.75 5.99896V7.00104C19.75 7.55734 19.3053 8 18.7568 8H5.24317C4.69717 8 4.25 7.55275 4.25 7.00104V5.99896C4.25 5.44266 4.69466 5 5.24317 5H7V4.50468C7 4.21404 7.22596 4 7.50468 4H8.49532C8.78596 4 9 4.22595 9 4.50468V5ZM5.50468 9H6.49532C6.78596 9 7 9.22596 7 9.50468V10.4953C7 10.786 6.77404 11 6.49532 11H5.50468C5.21404 11 5 10.774 5 10.4953V9.50468C5 9.21404 5.22595 9 5.50468 9ZM8.50468 9H9.49532C9.78596 9 10 9.22596 10 9.50468V10.4953C10 10.786 9.77404 11 9.49532 11H8.50468C8.21404 11 8 10.774 8 10.4953V9.50468C8 9.21404 8.22596 9 8.50468 9ZM11.5047 9H12.4953C12.786 9 13 9.22596 13 9.50468V10.4953C13 10.786 12.774 11 12.4953 11H11.5047C11.214 11 11 10.774 11 10.4953V9.50468C11 9.21404 11.226 9 11.5047 9ZM5.50468 12H6.49532C6.78596 12 7 12.226 7 12.5047V13.4953C7 13.786 6.77404 14 6.49532 14H5.50468C5.21404 14 5 13.774 5 13.4953V12.5047C5 12.214 5.22595 12 5.50468 12ZM8.50468 12H9.49532C9.78596 12 10 12.226 10 12.5047V13.4953C10 13.786 9.77404 14 9.49532 14H8.50468C8.21404 14 8 13.774 8 13.4953V12.5047C8 12.214 8.22596 12 8.50468 12ZM11.5047 12H12.4953C12.786 12 13 12.226 13 12.5047V13.4953C13 13.786 12.774 14 12.4953 14H11.5047C11.214 14 11 13.774 11 13.4953V12.5047C11 12.214 11.226 12 11.5047 12ZM5.50468 15H6.49532C6.78596 15 7 15.226 7 15.5047V16.4953C7 16.786 6.77404 17 6.49532 17H5.50468C5.21404 17 5 16.774 5 16.4953V15.5047C5 15.214 5.22595 15 5.50468 15ZM8.50468 15H9.49532C9.78596 15 10 15.226 10 15.5047V16.4953C10 16.786 9.77404 17 9.49532 17H8.50468C8.21404 17 8 16.774 8 16.4953V15.5047C8 15.214 8.22596 15 8.50468 15ZM11.5047 15H12.4953C12.786 15 13 15.226 13 15.5047V16.4953C13 16.786 12.774 17 12.4953 17H11.5047C11.214 17 11 16.774 11 16.4953V15.5047C11 15.214 11.226 15 11.5047 15ZM14.5047 9H15.4953C15.786 9 16 9.22596 16 9.50468V10.4953C16 10.786 15.774 11 15.4953 11H14.5047C14.214 11 14 10.774 14 10.4953V9.50468C14 9.21404 14.226 9 14.5047 9ZM14.5047 12H15.4953C15.786 12 16 12.226 16 12.5047V13.4953C16 13.786 15.774 14 15.4953 14H14.5047C14.214 14 14 13.774 14 13.4953V12.5047C14 12.214 14.226 12 14.5047 12ZM14.5047 15H15.4953C15.786 15 16 15.226 16 15.5047V16.4953C16 16.786 15.774 17 15.4953 17H14.5047C14.214 17 14 16.774 14 16.4953V15.5047C14 15.214 14.226 15 14.5047 15ZM17.5047 15H18.4953C18.786 15 19 15.226 19 15.5047V16.4953C19 16.786 18.774 17 18.4953 17H17.5047C17.214 17 17 16.774 17 16.4953V15.5047C17 15.214 17.226 15 17.5047 15ZM5.50468 18H6.49532C6.78596 18 7 18.226 7 18.5047V19.4953C7 19.786 6.77404 20 6.49532 20H5.50468C5.21404 20 5 19.774 5 19.4953V18.5047C5 18.214 5.22595 18 5.50468 18ZM8.50468 18H9.49532C9.78596 18 10 18.226 10 18.5047V19.4953C10 19.786 9.77404 20 9.49532 20H8.50468C8.21404 20 8 19.774 8 19.4953V18.5047C8 18.214 8.22596 18 8.50468 18ZM11.5047 18H12.4953C12.786 18 13 18.226 13 18.5047V19.4953C13 19.786 12.774 20 12.4953 20H11.5047C11.214 20 11 19.774 11 19.4953V18.5047C11 18.214 11.226 18 11.5047 18ZM14.5047 18H15.4953C15.786 18 16 18.226 16 18.5047V19.4953C16 19.786 15.774 20 15.4953 20H14.5047C14.214 20 14 19.774 14 19.4953V18.5047C14 18.214 14.226 18 14.5047 18ZM17.5047 18H18.4953C18.786 18 19 18.226 19 18.5047V19.4953C19 19.786 18.774 20 18.4953 20H17.5047C17.214 20 17 19.774 17 19.4953V18.5047C17 18.214 17.226 18 17.5047 18ZM17.5047 12H18.4953C18.786 12 19 12.226 19 12.5047V13.4953C19 13.786 18.774 14 18.4953 14H17.5047C17.214 14 17 13.774 17 13.4953V12.5047C17 12.214 17.226 12 17.5047 12ZM17.5047 9H18.4953C18.786 9 19 9.22596 19 9.50468V10.4953C19 10.786 18.774 11 18.4953 11H17.5047C17.214 11 17 10.774 17 10.4953V9.50468C17 9.21404 17.226 9 17.5047 9Z" fill="#808080"/>\n</svg>\n',r='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.27283 6.78069C8.87912 6.34164 8.91587 5.66655 9.35492 5.27283C9.79397 4.87912 10.4691 4.91587 10.8628 5.35492C10.8628 5.35492 16.0022 10.9543 16.366 11.36C16.7298 11.7657 16.7298 12.2392 16.366 12.6448L10.8628 18.6451C10.4691 19.0841 9.79397 19.1209 9.35492 18.7272C8.91587 18.3334 8.87912 17.6584 9.27283 17.2193L14.1368 12L9.27283 6.78069Z" fill="#808080"/>\n</svg>',i='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.7272 17.2193C15.1209 17.6584 15.0841 18.3334 14.6451 18.7272C14.206 19.1209 13.5309 19.0841 13.1372 18.6451C13.1372 18.6451 7.99776 13.0457 7.63399 12.64C7.27023 12.2343 7.27023 11.7608 7.63399 11.3552L13.1372 5.35492C13.5309 4.91587 14.206 4.87912 14.6451 5.27283C15.0841 5.66655 15.1209 6.34164 14.7272 6.78069L9.86322 12L14.7272 17.2193Z" fill="#808080"/>\n</svg>'},88350:(t,e,n)=>{n.r(e),n.d(e,{CalendarClass:()=>q,componentName:()=>m}),n(27092),n(30576);var a=n(3393),r=n(9696),i=n(97810),o=n(73551),s=n(79365),l=n(49224),d=n(80071),p=n(64101);const h=(t,e)=>Array.isArray(t)&&t.length===e&&t.filter(Boolean).length===e,c=({label:t,dataId:e,dataName:n})=>`\n\t<div class="combo-box-item"\n\t\tdata-id="${e}"\n\t\tdata-name="${n}"\n\t>\n\t\t\t${t}\n\t</div>\n`,u=(t=p.US)=>t.map(((t,e)=>c({label:t,dataId:e+1,dataName:t}))).join(""),y=(t,e)=>{const[n,a]=(0,l.Pj)(e),[r,i]=(0,l.Pj)(t);return r===n&&i===a},b=(t,e,n)=>(t.addEventListener("input",e),t.addEventListener("focusout",n),t);var v=n(19624),g=n(25964);const m=(0,i.xE)("calendar"),C=["initial-value","initial-year","initial-month","years-range","calendar-months","calendar-weekdays","calendar-label-today","st-host-direction","disabled","full-width"],w=["calendar-label-submit","calendar-label-cancel"],f=(0,a.y)({componentName:m,baseSelector:"div"}),{calendar:x,day:V,dayEntry:M,currentDay:S,selectedDay:$,disabledDay:N,weekday:D,topNav:H,topNavSelectors:E,bottomNav:k,navPrev:Y,navNext:L,navPrevRTL:T,navNextRTL:B,yearInput:I,monthInput:A}={calendar:{selector:()=>".calendar"},topNav:{selector:()=>".nav.top-nav"},topNavSelectors:{selector:()=>".nav.top-nav .selectors > span"},bottomNav:{selector:()=>".nav.bottom-nav"},day:{selector:()=>".day"},dayEntry:{selector:()=>".day-entry"},currentDay:{selector:()=>".day-entry[data-current-day] .day"},selectedDay:{selector:()=>".day-entry[data-selected] .day"},disabledDay:{selector:()=>'.day-entry[data-disabled="true"] .day'},weekday:{selector:()=>".weekday"},navPrev:{selector:()=>".nav-prev"},navNext:{selector:()=>".nav-next"},navPrevRTL:{selector:()=>':host([st-host-direction="rtl"]) .nav-prev'},navNextRTL:{selector:()=>':host([st-host-direction="rtl"]) .nav-next'},yearInput:{selector:()=>".year-input"},monthInput:{selector:()=>".month-input"}},q=(0,r.Zz)((0,s.RF)({componentNameOverride:(0,i.xE)("input-wrapper")}),(0,s.RF)({mappings:{fontSize:{},fontFamily:{},hostWidth:[{selector:()=>":host",property:"width"},{selector:"table",property:"width"}],hostDirection:{property:"direction"},topNavVerticalPadding:[{...H,property:"padding-top"},{...H,property:"padding-bottom"}],topNavHorizointalPadding:[{...H,property:"padding-right"},{...H,property:"padding-left"}],topNavAlignment:{...H,property:"justify-content"},topNavGap:{...H,property:"gap"},topNavSelectorsGap:{...E,property:"gap"},bottomNavVerticalPadding:[{...k,property:"padding-top"},{...k,property:"padding-bottom"}],bottomNavHorizontalPadding:[{...k,property:"padding-right"},{...k,property:"padding-left"}],bottomNavAlignment:{...k,property:"justify-content"},bottomNavGap:{...k,property:"gap"},navMarginBottom:{...H,property:"margin-bottom"},calendarPadding:[{...x,property:"padding-bottom"},{...x,property:"padding-right"},{...x,property:"padding-left"}],navBorderBottomWidth:{...H,property:"border-bottom-width"},navBorderBottomColor:{...H,property:"border-bottom-color"},navBorderBottomStyle:{...H,property:"border-bottom-style"},weekdayFontSize:{...D,property:"font-size"},weekdayFontWeight:{...D,property:"font-weight"},currentDayBorderColor:{...S,property:"border-color"},currentDayBorderWidth:{...S,property:"border-width"},currentDayBorderStyle:{...S,property:"border-style"},dayHeight:{...M,property:"height"},daySize:[{...V,property:"height"},{...V,property:"width"}],dayPadding:{...V,property:"padding"},dayRadius:{...V,property:"border-radius"},dayTextAlign:{...V,property:"text-align"},dayBlockAlign:{...V,property:"margin"},dayTextColor:{...V,property:"color"},dayFontWeight:{...V,property:"font-weight"},dayBackgroundColor:{...V,property:"background-color"},dayCursor:{...V,property:"cursor"},dayFontSize:{...V,property:"font-size"},dayBackgroundColorHover:{selector:()=>".day:hover",property:"background-color"},daySelectedTextdColor:{...$,property:"color"},daySelectedBackgroundColor:{...$,property:"background-color"},dayDisabledTextdColor:{...N,property:"color"},yearInputWidth:{...I,property:"width"},monthInputWidth:{...A,property:"width"},navButtonSize:[{...Y,property:"width"},{...Y,property:"height"},{...L,property:"width"},{...L,property:"height"}],navButtonCursor:[{...Y,property:"cursor"},{...L,property:"cursor"}],navButtonRotation:[{...T,property:"transform"},{...B,property:"transform"}],navButtonOpacity:[{...Y,property:"opacity"},{...L,property:"opacity"}]}}),s.VO,s.tQ)(class extends f{static get observedAttributes(){return[].concat(f.observedAttributes||[],C,w)}preview;timestamp;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <nav class="nav top-nav">\n <div class="nav-prev">\n </div>\n <div class="selectors"></div>\n <div class="nav-next">\n </div>\n </nav>\n <div class="calendar"></div>\n <nav class="nav bottom-nav">\n <descope-button class="cancel-button" variant="link" mode="primary">Cancel</descope-button>\n <descope-button class="submit-button" variant="link" mode="primary" disabled="true">Done</descope-button>\n </nav>\n </div>\n ',(0,g.fz)(`\n :host {\n display: inline-block;\n box-sizing: border-box;\n max-width: 100%;\n user-select: none;\n -webkit-user-select: none;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n [data-toggle-calendar] {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n }\n\n [data-disabled="true"] {\n pointer-events: none;\n }\n\n .calendar .day {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .nav {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n }\n\n .selectors,\n .selectors span {\n display: flex;\n justify-content: center;\n }\n\n descope-button {\n padding: 0;\n ${v.J.cssVarList.horizontalPadding}: 0;\n ${v.J.cssVarList.verticalPadding}: 0;\n ${v.J.cssVarList.outlineWidth}: 0;\n }\n\n .combo-box-item {\n display:flex;\n flex-direction: column;\n }\n\n ${(0,o.Kl)()}\n `,this)}set value(t){if(!t)return;const e=(0,l.Nq)(t).getTime();(0,l.xP)(e)&&e!==this.timestmap&&(this.timestamp=e,this.renderCalendar())}get value(){return this.timestamp?(0,l.Ey)(this.timestamp,p.wJ):""}get isSelectedView(){return y(this.preview,this.timestamp)}get isTodayView(){return y((0,l.Ln)(),this.preview)}get monthNames(){return(t=>{const e=t?.split(",");return h(e,12)?e:p.US})(this.getAttribute("calendar-months"))}get weekdayNames(){return(t=>{const e=t?.split?.(",");return h(e,7)?e:p.mx})(this.getAttribute("calendar-weekdays"))}get hasYearValue(){return!!this.yearInput.value}get hasMonthValue(){return!!this.monthInput.value}get yearsRange(){const t=this.getAttribute("years-range")?.split("-");if(2===t?.length){const[e,n]=t.map(Number);if(e<=n)return[e,n]}const e=(0,l.Nq)().getFullYear();return[e,e+p.V$]}init(){super.init?.(),this.initCalendar(),this.renderCalendar()}initCalendar(){this.calendar=this.shadowRoot.querySelector(".calendar"),this.navPrevEle=this.shadowRoot.querySelector(".nav-prev"),this.navNextEle=this.shadowRoot.querySelector(".nav-next"),this.submitButton=this.shadowRoot.querySelector(".submit-button"),this.cancelButton=this.shadowRoot.querySelector(".cancel-button"),this.initInputs(),this.initNav(),this.addEventListener("day-changed",(()=>this.submitButton.removeAttribute("disabled"))),this.submitButton.shadowRoot.querySelector("vaadin-button").setAttribute("disabled","true")}initInputs(){const t=(()=>{const t=document.createElement("span");return t.innerHTML=`\n <descope-combo-box\n label-type="static"\n bordered="true"\n item-label-path="data-name"\n item-value-path="data-id"\n class="month-input"\n >\n ${u()}\n </descope-combo-box>\n <descope-combo-box\n allow-custom-value="true"\n label-type="static"\n bordered="true"\n item-label-path="data-name"\n item-value-path="data-id"\n class="year-input"\n no-empty-value="true"\n >\n </descope-combo-box>\n `,t})(this.monthNames,this.yearsRange);this.shadowRoot.querySelector(".selectors").appendChild(t),this.monthInput=b(this.shadowRoot.querySelector(".month-input"),this.onMonthChange.bind(this),this.onMonthInputBlur.bind(this)),this.yearInput=b(this.shadowRoot.querySelector(".year-input"),this.onYearChange.bind(this),this.onYearInputBlur.bind(this)),[this.monthInput,this.yearInput].forEach((t=>(0,i.EA)(this,t,{includeAttrs:["disabled","size","st-host-direction"]})))}initNav(){this.navPrevEle.addEventListener("click",this.navPrevMonth.bind(this)),this.navNextEle.addEventListener("click",this.navNextMonth.bind(this)),this.cancelButton.addEventListener("click",this.onCancel.bind(this)),this.submitButton.addEventListener("click",this.onSubmit.bind(this)),[this.navPrevEle,this.navNextEle].forEach((t=>(0,i.EA)(this,t,{includeAttrs:["size"]}))),this.shadowRoot.querySelector(".nav-next").innerHTML=d.ZM,this.shadowRoot.querySelector(".nav-prev").innerHTML=d.i1}onSubmit(){this.isDisabled||this.value&&this.dispatchEvent(new CustomEvent("date-submit",{detail:(0,l.Nq)(this.preview)}))}onCancel(){this.isDisabled||(this.dispatchEvent(new CustomEvent("cancel")),this.dispatchEvent(new CustomEvent("date-cancel")),this.clearSelectedDay())}clearSelectedDay(){this.getSelectedDayEle()?.removeAttribute("data-selected"),this.submitButton.setAttribute("disabled","true"),this.timestamp=""}updateInputs(){if(this.yearInput&&this.monthInput){const t=this.preview||(0,l.Ln)(),e=(0,l.Bl)(t),n=(0,l.tj)(t);this.monthInput.value=n,setTimeout((()=>{this.yearInput.baseElement.value=e}))}}renderCalendar(){const t=(0,l.Nq)(this.preview||(0,l.Ln)()).getTime(),[e,n]=(0,l.Pj)(t);this.calendar&&(this.calendar.innerHTML=((t,e,n)=>{const a=((t,e)=>new Date(t,e,0).getDate())(t,e),r=new Date(t,e-1,1).getDay();let i="<table>";i+=`<thead><tr>${n.reduce(((t,e)=>`${t}<th><span class="weekday">${e}</span></th>`),"")}</tr></thead>`,i+="<tbody>",i+="<tr>";for(let t=0;t<r;t++)i+="<td></td>";let o=r;for(let t=1;t<=a;t++)7===o&&(o=0,i+="</tr><tr>"),i+=`\n <td\n data-date-day="${t}"\n class="day-entry">\n <span class="day" data-date-day=${t}>\n ${t}\n </span>\n </td>\n `,o++;for(;o<7;)i+="<td></td>",o++;return i+="</tr></tbody></table>",i})(e,n,this.weekdayNames.map((t=>t.substring(0,3))))),Array.from(this.calendar?.querySelectorAll(".day-entry .day")||[]).forEach((t=>t.addEventListener("click",this.onDayChange.bind(this)))),this.updateInputs(),this.setSelectedDay(),this.setCurrentDay()}onDayChange(t){if(this.isDisabled)return;const e=(0,l.Nq)(this.preview);e.setDate(Number(t.target.getAttribute("data-date-day"))),this.value=(0,l.Ey)(e.getTime(),p.wJ),this.dispatchEvent(new CustomEvent("day-changed",{detail:e}))}onYearChange(t){if(!t.target.value)return;const e=(0,l.Nq)(this.preview);e.setFullYear(Number(t.target.value.trim())),this.preview=e.getTime(),this.renderCalendar(),this.dispatchEvent(new CustomEvent("year-changed",{detail:e}))}onMonthChange(t){if(!t.target.value)return;const e=(0,l.Nq)(this.preview);e.setMonth(Number(t.target.value)-1),this.preview=e.getTime(),this.renderCalendar(),this.dispatchEvent(new CustomEvent("month-changed",{detail:e}))}onYearInputBlur(t){this.yearInput.baseElement.value=t.target.value||(0,l.Bl)(this.preview)}onMonthInputBlur(t){this.monthInput.baseElement.value=t.target.value||(0,l.tj)(this.preview)}getSelectedDayEle(){const t=(0,l.Nq)(this.timestamp).getDate();return this.calendar?.querySelector(`[data-date-day="${t}"]`)}getCurrentDayEle(){return this.calendar?.querySelector(`[data-date-day="${(0,l._B)()}"]`)}clearSelectedDays(){const t=this.calendar?.querySelectorAll("[data-selected]");t&&t.forEach((t=>t.removeAttribute("data-selected")))}setSelectedDay(){this.clearSelectedDays(),this.value&&this.isSelectedView&&this.getSelectedDayEle().setAttribute("data-selected","true")}setCurrentDay(){if(this.isTodayView){const t=this.getCurrentDayEle(),e=this.getAttribute("calendar-label-today")||p.QF;t.setAttribute("data-current-day","true"),t.setAttribute("title",e)}}navPrevMonth(){if(this.isDisabled)return;const t=(t=>{const e=(0,l.Nq)(t),n=e.getMonth();if(0===n){const t=e.getFullYear();e.setFullYear(t-1),e.setMonth(11)}else e.setMonth(n-1);return e})(this.preview);this.preview=t.getTime(),this.renderCalendar()}navNextMonth(){if(this.isDisabled)return;const t=(t=>{const e=(0,l.Nq)(t),n=e.getMonth();if(11===n){const t=e.getFullYear();e.setFullYear(t+1),e.setMonth(0)}else e.setMonth(n+1);return e})(this.preview);this.preview=t.getTime(),this.renderCalendar()}clearValue(){this.timestamp="",this.value="",this.removeAttribute("preview"),this.submitButton.setAttribute("disabled","true")}onInitialValueChange(t){if(this.value)return;const e=(0,l.Nq)(t).getTime();(0,l.xP)(e)?(this.timestamp=e,this.preview=e):this.clearValue()}onYearsRangeChange(){setTimeout((()=>{this.yearInput&&(this.yearInput.innerHTML=(t=>{const[e,n]=t,a=[];for(let t=e;t<=n;t++)a.push(t);return a})(this.yearsRange).map((t=>c({label:t,dataId:t,dataName:t}))).join(""))}))}onMonthNamesChange(){setTimeout((()=>{this.monthInput&&(this.monthInput.innerHTML=u(this.monthNames))}))}onSubmitLabelChange(t){this.submitButton&&(this.submitButton.textContent=t||p.Tv)}onCancelLabelChange(t){this.cancelButton&&(this.cancelButton.textContent=t||p.lv)}onInitialMonthChange(t){const e=(0,l.Bl)(this.preview);this.preview=(0,l.Nq)(`${e}/${t}/1`).getTime()}onInitialYearChange(t){const e=(0,l.tj)(this.preview);this.preview=(0,l.Nq)(`${t}/${e}/1`).getTime()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(t,e,n),e!==n&&(w.includes(t)?("calendar-label-submit"===t&&this.onSubmitLabelChange(n),"calendar-label-cancel"===t&&this.onCancelLabelChange(n)):(n&&"initial-value"===t&&this.onInitialValueChange(n),n&&"initial-month"===t&&this.onInitialMonthChange(n),n&&"initial-year"===t&&this.onInitialYearChange(n),"years-range"===t&&this.onYearsRangeChange(Number(n)),"calendar-months"===t&&this.onMonthNamesChange(),"calendar-label-today"===t&&this.setCurrentDay(n),"disabled"===t&&setTimeout((()=>{this.cancelButton?.setAttribute("disabled","true"===n)})),this.renderCalendar()))}getValidity(){return this.isRequired&&!this.value?{valueMissing:!0}:{}}});customElements.define(m,q)},98538:(t,e,n)=>{n.d(e,{S:()=>s,T:()=>o});var a=n(88961),r=n(25964),i=n(63200);const o=(0,r.xE)("icon"),s=(0,i.Zz)((0,a.RF)({mappings:{fill:{}}}),a.VO,a.tQ)((0,a.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:o}))}}]);
|
2
2
|
//# sourceMappingURL=descope-date-field-descope-calendar-index-js.js.map
|