@descope/web-components-ui 3.22.2 → 3.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +21 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/9582.js +1 -1
- package/dist/umd/9582.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.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-enriched-text.js +1 -1
- package/dist/umd/descope-enriched-text.js.map +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js.map +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js.map +1 -1
- package/dist/umd/descope-password-index-js.js +1 -1
- package/dist/umd/descope-password-index-js.js.map +1 -1
- package/dist/umd/descope-tooltip.js +1 -1
- package/dist/umd/descope-tooltip.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +42 -42
- package/src/components/descope-password/PasswordClass.js +14 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descope-enriched-text.js","mappings":"0PAiBO,MAAAA,GAAsB,EAAAC,EAAAC,IAAgB,iBAE7C,MAAAC,WAA2B,EAAAC,EAAAC,IAAe,CAC1CL,gBACAM,aAAA,iBAEAC,GAEAC,GAEA,WAAAC,GACAC,QAEAC,KAAAC,aAAA,CAAwBC,KAAA,SAAcC,UAAA,2CAIlC,EAAAb,EAAAc,IACJ,6iBAkCAJ,MAGAA,MAAAK,KAEI,EAAAf,EAAAgB,IAAeN,KA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I,KAAAwI,cAAA,WAEA,EAGA,MAAAf,KAAQA,GAAO,CACfA,KAAA,CAAU/C,SAAA,cAGHqE,GAAkB,EAAAf,EAAA3D,KACvB,EAAA4D,EAAA1D,IAAgB,CAClBC,SAAA,CACAC,UAAA,IAAmBgD,EAAA9C,SAAA,SACnBG,cAAA,IAAuB2C,EAAA9C,SAAA,aACvBI,SAAA,GACAI,UAAA,EAAoBR,SAAA,UACpBS,eAAA,CAAwBT,SAAA,eACxBqE,kBAAA,CAA2BrE,SAAA,kBAC3BsE,WAAA,GACA5D,UAAA,GACA6D,cAAA,GACAlE,WAAA,GACAmE,UAAA,GACAlE,WAAA,GACAmE,YAAA,GACAC,YAAA,GACAC,YAAA,OAGE,EAAArB,EAAArC,IAAY,CAAGC,SAAA,EAAaC,KAAA,aAAAC,MAAA,WAC5BkC,EAAAjC,GACAiC,EAAAhC,GAtBuB,CAuBzBsC,wFCjFAhC,eAAAC,OAAsB+C,EAAA7C,EAAe6C,EAAAzB","sources":["webpack://@descope/web-components-ui/../components/descope-enriched-text/src/component/EnrichedTextClass.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-link/src/component/LinkClass.js","webpack://@descope/web-components-ui/../components/descope-link/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/TextClass.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/index.js"],"sourcesContent":["import MarkdownIt from 'markdown-it';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\n} 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 {\n getComponentName,\n injectStyle,\n observeChildren,\n} from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('enriched-text');\n\nclass EnrichedText extends createBaseClass({\n componentName,\n baseSelector: ':host > div',\n}) {\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 // Stop propagation on link clicks to prevent parent handlers from firing\n this.contentNode?.addEventListener('click', (e) => {\n if (e.target instanceof HTMLAnchorElement) {\n e.stopPropagation();\n }\n });\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 =\n this.processor.renderer.rules.link_open || defaultLinkRenderer;\n\n const defaultStrongRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origEmRenderer =\n 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, {\n html: true,\n breaks: true,\n });\n } catch {\n console.warn('Not parsing invalid markdown token');\n }\n\n this.contentNode.innerHTML = html;\n this.contentNode.firstChild?.setAttribute('part', 'content');\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: {\n selector: () => ':host',\n property: 'display',\n fallback: 'inline-block',\n },\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: {\n selector: 'a:hover',\n property: 'text-decoration',\n },\n minHeight: {},\n minWidth: {},\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('link') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\n draggableMixin,\n componentNameValidationMixin,\n)(EnrichedText);\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 {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\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\nconst observedAttrs = ['href', 'readonly'];\n\nclass RawLink extends createBaseClass({\n componentName,\n baseSelector: ':host a',\n}) {\n static get observedAttributes() {\n return observedAttrs.concat(super.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<div>\n\t\t\t<descope-text part=\"wrapper\">\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 :host([ellipsis=\"true\"]) descope-text {\n display: inline-flex;\n }\n :host([ellipsis=\"true\"]) descope-text::part(text-wrapper) {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n `,\n this,\n );\n\n this.anchor = this.shadowRoot.querySelector('a');\n\n forwardAttrs(this, this.anchor, {\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 this.anchor.addEventListener('click', (e) => {\n if (this.readOnly) {\n e.preventDefault();\n }\n });\n }\n\n get readOnly() {\n return this.getAttribute('readonly') === 'true';\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: {\n ...link,\n property: 'text-decoration',\n fallback: 'none',\n },\n textColor: [\n { ...anchor, property: 'color' },\n { ...text, property: TextClass.cssVarList.textColor },\n ],\n cursor: anchor,\n },\n }),\n stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\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","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\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 `\n :host {\n display: inline-block;\n line-height: 1em;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n `,\n this,\n );\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: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n fontSize: {},\n textColor: [{ property: 'color' }],\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 stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawText);\n","import { componentName, TextClass } from './TextClass';\n\ncustomElements.define(componentName, TextClass);\n\nexport { TextClass, componentName };\n"],"names":["componentName","_descope_ui_common_components_helpers__WEBPACK_IMPORTED_MODULE_6__","xE","EnrichedText","_descope_ui_common_base_classes__WEBPACK_IMPORTED_MODULE_4__","qu","baseSelector","origLinkRenderer","origEmRenderer","constructor","super","this","attachShadow","mode","innerHTML","fz","initProcessor","Ge","parseChildren","bind","contentNode","addEventListener","e","target","HTMLAnchorElement","stopPropagation","observedAttributes","attributeChangedCallback","attrName","oldValue","newValue","onReadOnlyChange","customUnderlineRenderer","processor","renderer","rules","em_open","tokens","idx","options","env","self","markup","tag","em_close","customizeLinkRenderer","linkTargetBlank","link_open","attrSet","disableCustomRules","disable","_consts__WEBPACK_IMPORTED_MODULE_3__","M","updateProcessorRules","storeOrigRenderers","_","renderToken","markdown_it__WEBPACK_IMPORTED_MODULE_0__","A","html","getAttribute","shadowRoot","querySelector","_helpers__WEBPACK_IMPORTED_MODULE_5__","G","trim","isConnected","setAttribute","removeAttribute","parse","references","undefined","render","breaks","console","warn","firstChild","isReadOnly","EnrichedTextClass","_descope_ui_common_utils__WEBPACK_IMPORTED_MODULE_2__","Zz","_descope_ui_common_components_mixins__WEBPACK_IMPORTED_MODULE_1__","RF","mappings","hostWidth","selector","property","hostDisplay","fallback","hostDirection","fontSize","fontFamily","fontWeight","fontWeightBold","textColor","textLineHeight","textAlign","linkColor","linkTextDecoration","linkHoverTextDecoration","minHeight","minWidth","componentNameOverride","DM","triggers","attr","value","VO","tQ","disableRules","decodeHTML","textArea","document","createElement","customElements","define","_EnrichedTextClass__WEBPACK_IMPORTED_MODULE_1__","T","m","_descope_ui_common_components_helpers__WEBPACK_IMPORTED_MODULE_2__","observedAttrs","RawLink","_descope_ui_common_base_classes__WEBPACK_IMPORTED_MODULE_3__","concat","anchor","EA","includeAttrs","mapAttrs","tooltip","readOnly","preventDefault","selectors","host","link","wrapper","text","_descope_ui_descope_text_class__WEBPACK_IMPORTED_MODULE_4__","s","LinkClass","_descope_ui_common_utils__WEBPACK_IMPORTED_MODULE_1__","_descope_ui_common_components_mixins__WEBPACK_IMPORTED_MODULE_0__","textDecoration","cssVarList","cursor","_LinkClass__WEBPACK_IMPORTED_MODULE_0__","J","RawText","hideWhenEmpty","init","hasChildren","childNodes","length","style","display","TextClass","textLetterSpacing","textShadow","textTransform","fontStyle","borderWidth","borderStyle","borderColor","_TextClass__WEBPACK_IMPORTED_MODULE_0__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"descope-enriched-text.js","mappings":"0PAiBO,MAAAA,GAAsB,EAAAC,EAAAC,IAAgB,iBAE7C,MAAAC,WAA2B,EAAAC,EAAAC,IAAe,CAC1CL,gBACAM,aAAA,iBAEAC,GAEAC,GAEA,WAAAC,GACAC,QAEAC,KAAAC,aAAA,CAAwBC,KAAA,SAAcC,UAAA,2CAIlC,EAAAb,EAAAc,IACJ,6iBAkCAJ,MAGAA,MAAAK,KAEI,EAAAf,EAAAgB,IAAeN,KAAAA,MAAAO,EAAAC,KAAAR,OAGnBA,KAAAS,aAAAC,iBAAA,QAAAC,IACAA,EAAAC,kBAAAC,mBACAF,EAAAG,oBAKAd,KAAAS,aAAAC,iBAAA,UAAAC,IACA,UAAAA,EAAAI,KAAAJ,EAAAC,kBAAAC,mBACAF,EAAAG,mBAGA,CAEA,6BAAAE,GACA,sCACA,CAEA,wBAAAC,CAAAC,EAAAC,EAAAC,GACArB,MAAAkB,2BAAAC,EAAAC,EAAAC,GAEAA,IAAAD,IACA,aAAAD,GACAlB,KAAAqB,iBAAA,SAAAD,GAGA,sBAAAF,GACAlB,MAAAK,IAGA,CAGA,uBAAAiB,GACAtB,KAAAuB,UAAAC,SAAAC,MAAAC,QAAA,CACAC,EACAC,EACAC,EACAC,EACAC,KAEA,MAAAJ,EAAAC,GAAAI,SAAAL,EAAAC,GAAAK,IAAA,KACAjC,MAAAH,EAAA8B,EAAAC,EAAAC,EAAAC,EAAAC,IAEA/B,KAAAuB,UAAAC,SAAAC,MAAAS,SAAA,CACAP,EACAC,EACAC,EACAC,EACAC,KAEA,MAAAJ,EAAAC,GAAAI,SAAAL,EAAAC,GAAAK,IAAA,KACAjC,MAAAH,EAAA8B,EAAAC,EAAAC,EAAAC,EAAAC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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-link/src/component/LinkClass.js","webpack://@descope/web-components-ui/../components/descope-link/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/TextClass.js","webpack://@descope/web-components-ui/../components/descope-text/src/component/index.js"],"sourcesContent":["import MarkdownIt from 'markdown-it';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\n} 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 {\n getComponentName,\n injectStyle,\n observeChildren,\n} from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('enriched-text');\n\nclass EnrichedText extends createBaseClass({\n componentName,\n baseSelector: ':host > div',\n}) {\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 // Stop propagation on link clicks to prevent parent handlers from firing\n this.contentNode?.addEventListener('click', (e) => {\n if (e.target instanceof HTMLAnchorElement) {\n e.stopPropagation();\n }\n });\n\n // The SDK submits the form (and prevents link activation) on any Enter that reaches the flow root\n this.contentNode?.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' && e.target instanceof HTMLAnchorElement) {\n e.stopPropagation();\n }\n });\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 = (\n tokens,\n idx,\n options,\n env,\n self,\n ) => {\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 =\n this.processor.renderer.rules.link_open || defaultLinkRenderer;\n\n const defaultStrongRenderer = (tokens, idx, options, _, self) =>\n self.renderToken(tokens, idx, options);\n this.#origEmRenderer =\n 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, {\n html: true,\n breaks: true,\n });\n } catch {\n console.warn('Not parsing invalid markdown token');\n }\n\n this.contentNode.innerHTML = html;\n this.contentNode.firstChild?.setAttribute('part', 'content');\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: {\n selector: () => ':host',\n property: 'display',\n fallback: 'inline-block',\n },\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: {\n selector: 'a:hover',\n property: 'text-decoration',\n },\n minHeight: {},\n minWidth: {},\n },\n }),\n createStyleMixin({ componentNameOverride: getComponentName('link') }),\n createStyleMixin({ componentNameOverride: getComponentName('text') }),\n stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\n draggableMixin,\n componentNameValidationMixin,\n)(EnrichedText);\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 {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\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\nconst observedAttrs = ['href', 'readonly'];\n\nclass RawLink extends createBaseClass({\n componentName,\n baseSelector: ':host a',\n}) {\n static get observedAttributes() {\n return observedAttrs.concat(super.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<div>\n\t\t\t<descope-text part=\"wrapper\">\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 :host([ellipsis=\"true\"]) descope-text {\n display: inline-flex;\n }\n :host([ellipsis=\"true\"]) descope-text::part(text-wrapper) {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n `,\n this,\n );\n\n this.anchor = this.shadowRoot.querySelector('a');\n\n forwardAttrs(this, this.anchor, {\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 this.anchor.addEventListener('click', (e) => {\n if (this.readOnly) {\n e.preventDefault();\n }\n });\n }\n\n get readOnly() {\n return this.getAttribute('readonly') === 'true';\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: {\n ...link,\n property: 'text-decoration',\n fallback: 'none',\n },\n textColor: [\n { ...anchor, property: 'color' },\n { ...text, property: TextClass.cssVarList.textColor },\n ],\n cursor: anchor,\n },\n }),\n stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\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","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n stretchMixin,\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 `\n :host {\n display: inline-block;\n line-height: 1em;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n `,\n this,\n );\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: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n fontSize: {},\n textColor: [{ property: 'color' }],\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 stretchMixin({ triggers: [{ attr: 'full-width', value: 'true' }] }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawText);\n","import { componentName, TextClass } from './TextClass';\n\ncustomElements.define(componentName, TextClass);\n\nexport { TextClass, componentName };\n"],"names":["componentName","_descope_ui_common_components_helpers__WEBPACK_IMPORTED_MODULE_6__","xE","EnrichedText","_descope_ui_common_base_classes__WEBPACK_IMPORTED_MODULE_4__","qu","baseSelector","origLinkRenderer","origEmRenderer","constructor","super","this","attachShadow","mode","innerHTML","fz","initProcessor","Ge","parseChildren","bind","contentNode","addEventListener","e","target","HTMLAnchorElement","stopPropagation","key","observedAttributes","attributeChangedCallback","attrName","oldValue","newValue","onReadOnlyChange","customUnderlineRenderer","processor","renderer","rules","em_open","tokens","idx","options","env","self","markup","tag","em_close","customizeLinkRenderer","linkTargetBlank","link_open","attrSet","disableCustomRules","disable","_consts__WEBPACK_IMPORTED_MODULE_3__","M","updateProcessorRules","storeOrigRenderers","_","renderToken","markdown_it__WEBPACK_IMPORTED_MODULE_0__","A","html","getAttribute","shadowRoot","querySelector","_helpers__WEBPACK_IMPORTED_MODULE_5__","G","trim","isConnected","setAttribute","removeAttribute","parse","references","undefined","render","breaks","console","warn","firstChild","isReadOnly","EnrichedTextClass","_descope_ui_common_utils__WEBPACK_IMPORTED_MODULE_2__","Zz","_descope_ui_common_components_mixins__WEBPACK_IMPORTED_MODULE_1__","RF","mappings","hostWidth","selector","property","hostDisplay","fallback","hostDirection","fontSize","fontFamily","fontWeight","fontWeightBold","textColor","textLineHeight","textAlign","linkColor","linkTextDecoration","linkHoverTextDecoration","minHeight","minWidth","componentNameOverride","DM","triggers","attr","value","VO","tQ","disableRules","decodeHTML","textArea","document","createElement","customElements","define","_EnrichedTextClass__WEBPACK_IMPORTED_MODULE_1__","T","m","_descope_ui_common_components_helpers__WEBPACK_IMPORTED_MODULE_2__","observedAttrs","RawLink","_descope_ui_common_base_classes__WEBPACK_IMPORTED_MODULE_3__","concat","anchor","EA","includeAttrs","mapAttrs","tooltip","readOnly","preventDefault","selectors","host","link","wrapper","text","_descope_ui_descope_text_class__WEBPACK_IMPORTED_MODULE_4__","s","LinkClass","_descope_ui_common_utils__WEBPACK_IMPORTED_MODULE_1__","_descope_ui_common_components_mixins__WEBPACK_IMPORTED_MODULE_0__","textDecoration","cssVarList","cursor","_LinkClass__WEBPACK_IMPORTED_MODULE_0__","J","RawText","hideWhenEmpty","init","hasChildren","childNodes","length","style","display","TextClass","textLetterSpacing","textShadow","textTransform","fontStyle","borderWidth","borderStyle","borderColor","_TextClass__WEBPACK_IMPORTED_MODULE_0__"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[8603],{3393(t,e,i){i.d(e,{y:()=>n});var r=i(9696),s=i(79365),o=i(81365);const n=(...t)=>(0,r.Zz)(s.XX,s._$,s.yF,s.jd)((0,o.q)(...t))},87455(t,e,i){i.d(e,{M:()=>m,T:()=>d});var r=i(97810),s=i(9696),o=i(79365),n=i(8877),a=i(5810),l=i(73551),p=i(10777);const d=(0,r.xE)("new-password"),c=p.w.cssVarList,{host:h,label:u,internalInputsWrapper:g,errorMessage:b,helperText:y,passwordInput:w,policyPreview:v}={host:{selector:()=>":host"},label:{selector:"::part(label)"},internalInputsWrapper:{selector:"descope-new-password-internal .wrapper"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},passwordInput:{selector:"descope-password"},policyPreview:{selector:"descope-policy-validation"}},m=(0,s.Zz)((0,o.RF)({mappings:{fontSize:[h,{},{selector:a.M.componentName,property:a.M.cssVarList.fontSize}],fontFamily:[u,b,y],labelFontSize:{...u,property:"font-size"},labelFontWeight:{...u,property:"font-weight"},inputValueFontWeight:{...w,property:a.M.cssVarList.inputValueFontWeight},inputPlaceholderFontWeight:{...w,property:a.M.cssVarList.inputPlaceholderFontWeight},helperTextFontWeight:{...y,property:"font-weight"},errorMessageFontWeight:{...b,property:"font-weight"},labelTextColor:{...u,property:"color"},errorMessageTextColor:{...b,property:"color"},errorMessageIcon:{...b,property:"background-image"},errorMessageIconSize:{...b,property:"background-size"},errorMessageIconPadding:{...b,property:"padding-inline-start"},errorMessageIconRepeat:{...b,property:"background-repeat"},errorMessageIconPosition:{...b,property:"background-position"},errorMessageFontSize:{...b,property:"font-size"},hostWidth:{...h,property:"width"},hostMinWidth:{...h,property:"min-width"},hostDirection:[{...h,property:"direction"},{...w,property:a.M.cssVarList.hostDirection}],inputsRequiredIndicator:{...h,property:"content"},spaceBetweenInputs:{...g,property:"gap"},policyPreviewBackgroundColor:{...v,property:c.backgroundColor},policyPreviewPadding:{...v,property:c.padding},valueInputHeight:{...w,property:a.M.cssVarList.valueInputHeight},valueInputMarginBottom:{...w,property:a.M.cssVarList.valueInputMarginBottom}}}),o.VO,(0,o.OZ)({proxyProps:["value","selectionStart"]}),t=>class extends t{init(){super.init?.();const t=document.createElement("template"),e=this.getAttribute("external-input");t.innerHTML=`\n\t\t\t<${n.T}\n\t\t\t\tname="new-password"\n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n external-input="${e}"\n\t\t\t>\n </${n.T}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(n.T),"true"===this.getAttribute("external-input")&&this.initExternalInput(),(0,r.EA)(this,this.inputElement,{includeAttrs:["password-label","password-placeholder","confirm-label","confirm-placeholder","full-width","size","bordered","label","has-confirm","invalid","readonly","disabled","draggable","has-validation","policy-label","active-policies","available-policies","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email","label-type","manual-visibility-toggle"]})}createSlottedExternalInput(t,e){const i=t.querySelector("input"),r=document.createElement("slot"),s=i.getAttribute("slot");r.setAttribute("name",e),r.setAttribute("slot",s),t.appendChild(r),i.setAttribute("slot",e),i.setAttribute("name",this.getAttribute("name")),i.setAttribute("data-hidden-input","true"),this.appendChild(i)}initExternalInput(){this.passwordInput=this.inputElement.querySelector('[data-id="password"]'),this.confirmInput=this.inputElement.querySelector('[data-id="confirm"]'),this.createSlottedExternalInput(this.passwordInput,"external-password-input"),this.createSlottedExternalInput(this.confirmInput,"external-confirm-input")}})((0,o.tz)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t\tmax-width: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t}\n :host ::part(error-message) {\n direction: ltr;\n }\n\t\t${(0,l.cy)(a.M.cssVarList)}\n\t\tvaadin-text-field {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t\tvaadin-text-field::part(input-field) {\n\t\t\tmin-height: 0;\n\t\t\tbackground: transparent;\n\t\t\tbox-shadow: none;\n\t\t\tpadding: 0;\n\t\t}\n\t\tvaadin-text-field::part(input-field)::after {\n\t\t\tbackground: transparent;\n\t\t\topacity: 0;\n\t\t}\n\t\tdescope-new-password-internal {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t\twidth: 100%;\n\t\t\tpadding: 0;\n\t\t}\n\t\tdescope-new-password-internal > .wrapper {\n -webkit-mask-image: none;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t}\n\t\tdescope-password {\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t}\n\t\tdescope-new-password-internal vaadin-password-field::before {\n\t\t\theight: initial;\n\t\t}\n descope-policy-validation {\n margin-top: 8px;\n display: flex;\n }\n .hidden {\n display: none;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:d}))},8877(t,e,i){i.d(e,{T:()=>r});const r=(0,i(97810).xE)("new-password-internal")},78844(t,e,i){var r=i(25964),s=i(3393),o=i(97810),n=i(87455),a=i(8877);const l=/^password-/,p=/^confirm-/,d=(t,e)=>t.replace(e,""),c=["password-label","password-placeholder"],h=["confirm-label","confirm-placeholder"],u=["has-validation","policy-label","available-policies","active-policies","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email","manual-visibility-toggle"],g=["has-confirm","disabled","bordered","size","full-width","maxlength","invalid","readonly","draggable","autocomplete","label-type","manual-visibility-toggle"],b=[].concat(g,c,h,u),y=(0,s.y)({componentName:a.T,baseSelector:"div"});customElements.define(a.T,class extends y{static get observedAttributes(){return[].concat(y.observedAttributes||[],b)}constructor(){super(),this.innerHTML='\n\t\t\t<div class="wrapper"></div>\n\t\t',this.wrapperEle=this.querySelector(".wrapper")}get value(){return this.passwordInput?.value||""}set value(t){t!==this.value&&(this.passwordInput.value=t)}get hasConfirm(){return"true"===this.getAttribute("has-confirm")}onHasConfirmChange(t){this.confirmInput.classList.toggle("hidden",!t)}onHasValidationChange(t){this.policyPanel.classList.toggle("hidden",!t)}get hasValidation(){return"true"===this.getAttribute("has-validation")}getValidity(){if(this.isRequired&&!this.value)return{valueMissing:!0};if(this.value&&!this.policyPanel.isValid)return{typeMismatch:!0};if(this.hasConfirm&&this.confirmInput&&this.value!==this.confirmInput.value)return{patternMismatch:!0};const t=this.getAttribute("minlength"),e=parseInt(t,10)||0;return this.value.length>=e?{}:{tooShort:!0}}init(){this.addEventListener("focus",t=>{t.isTrusted&&this.passwordInput.focus()}),super.init?.(),this.renderInputs(this.hasConfirm,this.hasValidation)}renderInputs(){const t="true"===this.getAttribute("external-input"),e=`\n <div class="password-input-container">\n <descope-password\n autocomplete="new-password"\n manual-visibility-toggle="true"\n data-id="password"\n external-input="${t}"\n ></descope-password>\n <descope-policy-validation></descope-policy-validation>\n </div>\n <descope-password\n autocomplete="new-password"\n manual-visibility-toggle="true"\n external-input="${t}"\n data-id="confirm"\n ></descope-password>\n `;this.wrapperEle.innerHTML=e,this.passwordInput=this.querySelector('[data-id="password"]'),this.confirmInput=this.querySelector('[data-id="confirm"]'),this.policyPanel=this.querySelector("descope-policy-validation"),this.passwordStrength=this.querySelector("descope-password-strength"),this.inputs=[this.passwordInput,this.confirmInput],this.initInputs(),this.passwordInput.addEventListener("input",t=>{this.passwordStrength?.addEventListener("score-changed",({detail:t})=>{this.policyPanel.setAttribute("data-password-policy-actual-passwordstrength",t)},{once:!0}),this.passwordStrength?.setAttribute("value",t.target.value),this.policyPanel.setAttribute("value",t.target.value)}),(0,o.EA)(this,this.policyPanel,{includeAttrs:u,mapAttrs:{"policy-label":"label","available-policies":"data"}})}handleIndicatorStyle(){this.inputs.forEach(t=>{(0,r.fz)(`\n\t\t\t\t:host ::part(required-indicator)::after {\n\t\t\t\t\tcontent: var(${n.M.cssVarList.inputsRequiredIndicator});\n width: 1em;\n text-align: center;\n\t\t\t\t}\n :host ::part(required-indicator) {\n display: inline-flex;\n }\n\t\t\t\t`,t)})}get isInvalid(){return this.hasAttribute("invalid")&&"false"!==this.getAttribute("invalid")}handleInputsInvalidAttribute(){this.inputs.forEach(t=>{t&&(0,o.mx)(t,e=>{if(e.includes("invalid")){const e=t.getAttribute("invalid"),i=this.getAttribute("invalid");this.isInvalid&&i!==e&&t.setAttribute("invalid","true")}},{})})}initInputs(){this.handleIndicatorStyle(),this.handleInputsInvalidAttribute(),this.handleFocusEventsDispatching(this.inputs)}async togglePasswordStrength(){this.activePolicies.includes("passwordstrength")?this.passwordStrength||(await Promise.all([i.e(8961),i.e(3241)]).then(i.bind(i,13241)),this.passwordStrength=document.createElement("descope-password-strength"),this.passwordStrength.setAttribute("options","Very weak,Weak,Average,Strong,Very strong"),this.passwordStrength.setAttribute("value",this.passwordInput.value||""),this.passwordStrength.setAttribute("st-host-direction",this.getAttribute("st-host-direction")),this.passwordStrength.setAttribute("full-width","true"),this.querySelector(".password-input-container").insertBefore(this.passwordStrength,this.policyPanel)):this.passwordStrength&&(this.passwordStrength.remove(),this.passwordStrength=null)}get activePolicies(){return(this.getAttribute("active-policies")||"").split(",")}toggleBooleanAttribute(t,e,i){null===i?t?.removeAttribute(e):t?.setAttribute(e,i)}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&("has-validation"===t?this.onHasValidationChange("true"===i):"has-confirm"===t?this.onHasConfirmChange("true"===i):g.includes(t)?this.inputs.forEach(e=>this.toggleBooleanAttribute(e,t,i)):c.includes(t)?this.toggleBooleanAttribute(this.passwordInput,d(t,l),i):h.includes(t)&&this.toggleBooleanAttribute(this.confirmInput,d(t,p),i),"active-policies"===t&&this.togglePasswordStrength())}})},5810(t,e,i){i.d(e,{M:()=>m,T:()=>l});var r=i(79365),s=i(9696),o=i(97810),n=i(16616),a=i(73551);const l=(0,o.xE)("password"),{host:p,inputField:d,inputElement:c,inputElementPlaceholder:h,revealButtonContainer:u,revealButtonIcon:g,label:b,requiredIndicator:y,errorMessage:w,helperText:v}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"> input"},inputElementPlaceholder:{selector:()=>":host input:placeholder-shown"},revealButtonContainer:{selector:"::part(reveal-button)"},revealButtonIcon:{selector:"::part(reveal-button)::before"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},m=(0,s.Zz)((0,r.RF)({mappings:{hostWidth:{...p,property:"width"},hostMinWidth:{...p,property:"min-width"},hostDirection:{...p,property:"direction"},fontSize:[{},p],fontFamily:[b,d,w,v],inputHeight:{...d,property:"height"},inputHorizontalPadding:[{...c,property:"padding-left"},{...c,property:"padding-right"}],inputBackgroundColor:{...d,property:"background-color"},inputBorderStyle:{...d,property:"border-style"},inputBorderWidth:{...d,property:"border-width"},inputBorderColor:{...d,property:"border-color"},inputBorderRadius:{...d,property:"border-radius"},inputOutlineColor:{...d,property:"outline-color"},inputOutlineStyle:{...d,property:"outline-style"},inputOutlineOffset:{...d,property:"outline-offset"},inputOutlineWidth:{...d,property:"outline-width"},labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},inputValueFontWeight:[{...c,property:"font-weight"},{selector:()=>":host ::slotted(input)",property:"font-weight"}],inputPlaceholderFontWeight:[{...h,property:"font-weight"},{selector:()=>":host ::slotted(input:placeholder-shown)",property:"font-weight"}],helperTextFontWeight:{...v,property:"font-weight"},errorMessageFontWeight:{...w,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...b,property:"-webkit-text-fill-color"},{...y,property:"color"},{...y,property:"-webkit-text-fill-color"}],labelRequiredIndicator:{...y,property:"content"},errorMessageTextColor:{...w,property:"color"},errorMessageIcon:{...w,property:"background-image"},errorMessageIconSize:{...w,property:"background-size"},errorMessageIconPadding:{...w,property:"padding-inline-start"},errorMessageIconRepeat:{...w,property:"background-repeat"},errorMessageIconPosition:{...w,property:"background-position"},errorMessageFontSize:{...w,property:"font-size"},inputPlaceholderTextColor:[{...h,property:"color"},{selector:()=>":host ::slotted(input:placeholder-shown)",property:"color"}],inputValueTextColor:[{...c,property:"color"},{selector:()=>":host ::slotted(input)",property:"color"}],revealButtonOffset:[{...u,property:"margin-right"},{...u,property:"margin-left"}],revealButtonSize:{...u,property:"font-size"},revealButtonColor:{...g,property:"color"},labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:[{selector:"> input:placeholder-shown",property:"opacity"},{...c,property:"opacity"}],inputVerticalAlignment:{...d,property:"align-items"},valueInputHeight:{...c,property:"height"}}}),r.VO,(0,r.RV)({inputType:"password",inputName:"password",includeAttrs:["disabled","readonly","pattern","type","autocomplete"],noBlurDispatch:!0}),(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,n.A,t=>class extends t{static get observedAttributes(){return["manual-visibility-toggle"]}get manualToggleVisibility(){return"true"===this.getAttribute("manual-visibility-toggle")}init(){super.init?.(),this.handleCaretOnVisibilityChange(),this.origSetPasswordVisible=this.baseElement._setPasswordVisible,this.origSetFocused=this.baseElement._setFocused,this.baseElement._setFocused=this.setFocus.bind(this),this.initExternalInput()}initExternalInput(){const t=this.createExternalInput();t&&this.handlePasswordVisibility(t)}get caretPosition(){return this.value?.length||0}handleCaretOnVisibilityChange(){const t=this.baseElement._togglePasswordVisibility.bind(this.baseElement);this.baseElement._togglePasswordVisibility=()=>{setTimeout(()=>(t(),this.inputElement.setSelectionRange(this.caretPosition,this.caretPosition),!1))}}setFocus(t){this.manualToggleVisibility&&(this.baseElement._setPasswordVisible=()=>{}),this.origSetFocused.call(this.baseElement,t),this.baseElement._setPasswordVisible=this.origSetPasswordVisible.bind(this.baseElement)}resetPasswordVisibilityToggle(){this.baseElement._setPasswordVisible=this.origSetPasswordVisible,this.baseElement._setFocused=this.origSetFocus}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i)}handlePasswordVisibility(t){const e=this.baseElement.__boundRevealButtonMouseDown;this.baseElement.querySelector("vaadin-password-field-button").removeEventListener("mousedown",e),this.baseElement._passwordVisibleChanged=()=>{},this.baseElement._togglePasswordVisibility=()=>{"password"===t.getAttribute("type")?this.showPasswordVisibility(t):this.hidePasswordVisibility(t)}}showPasswordVisibility(t){t.setAttribute("type","text"),this.setAttribute("password-visible","true")}hidePasswordVisibility(t){t.setAttribute("type","password"),this.setAttribute("password-visible","false")}})((0,r.tz)({slots:["","suffix"],wrappedEleName:"vaadin-password-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tmin-width: 10em;\n box-sizing: border-box;\n position: relative;\n\t\t\t}\n\t\t\t${(0,a.cy)(m.cssVarList)}\n\t\t\t${(0,a.I4)("vaadin-password-field")}\n ${(0,a.$J)("vaadin-password-field")}\n\n\t\t\tvaadin-password-field {\n\t\t\t\twidth: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t\tvaadin-password-field > input {\n -webkit-mask-image: none;\n\t\t\t\tbox-sizing: border-box;\n opacity: 1;\n\t\t\t}\n\t\t\tvaadin-password-field::part(input-field) {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t\tvaadin-password-field[focus-ring]::part(input-field) {\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n :host ::slotted(input) {\n\t\t\t\tmin-height: 0;\n }\n :host([readonly]) ::slotted(input:placeholder-shown) {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tvaadin-password-field::before {\n\t\t\t\theight: initial;\n\t\t\t}\n\t\t\tvaadin-password-field::part(input-field)::after {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tvaadin-password-field-button {\n\t\t\t\tcursor: pointer;\n\t\t\t}\n\t\t\t:host([readonly]) vaadin-password-field-button {\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\tvaadin-password-field-button[focus-ring] {\n\t\t\t\tbox-shadow: 0 0 0 2px var(${m.cssVarList.inputOutlineColor});\n\t\t\t}\n\n ${(0,a.Kl)()}\n\n ::part(reveal-button) {\n align-self: center;\n }\n\n vaadin-password-field[external-input="true"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:l}))},16616(t,e,i){i.d(e,{A:()=>r});const r=t=>class extends t{get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}init(){super.init?.();const t=this.querySelector("input");t?.addEventListener("mousedown",e=>{if(this.isDraggable&&this.isReadOnly){t.setAttribute("inert","true");const i=e.target,r=i.getAttribute("type");i.setAttribute("type","text"),setTimeout(()=>{i.focus()});const s=e=>{i.setAttribute("type",r),t.removeAttribute("inert"),this.removeEventListener("mouseup",s),this.removeEventListener("dragend",s)};this.addEventListener("dragend",s,{once:!0}),this.addEventListener("mouseup",s,{once:!0})}})}}},10777(t,e,i){i.d(e,{T:()=>p,w:()=>v});var r=i(25964),s=i(79365),o=i(81365),n=i(9696),a=i(97810),l=i(88191);const p=(0,a.xE)("policy-validation"),d=["data","active-policies","overrides","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-actual-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email"],c=["label","value",...d];class h extends((0,o.q)({componentName:p,baseSelector:":host > div"})){#t;#e=[];#i;static get observedAttributes(){return c}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <div class="label"></div>\n <ul></ul>\n </div>\n\t\t',(0,r.fz)("\n :host > div {\n width: 100%;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n }\n .label {\n max-width: 100%;\n text-wrap: wrap;\n overflow-wrap: break-word;\n }\n .hide-label .label {\n display: none;\n }\n ul {\n display: flex;\n flex-direction: column;\n padding: 0;\n margin: 0;\n }\n ul, li {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li::before {\n display: inline-block;\n width: 1em;\n text-align: center;\n }\n ",this),this.panel=this.shadowRoot.querySelector(":host > div"),this.label=this.shadowRoot.querySelector(".label"),this.list=this.shadowRoot.querySelector("ul")}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback?.(t,e,i),e!==i){if("label"===t&&this.updateLabel(i),d.includes(t)){if("data"===t)try{this.availablePolicies=JSON.parse(i)}catch{console.error("Failed to set available policies")}if("active-policies"===t&&(this.#e=(i||"").split(",")),"data-password-policy-value-minlength"===t){const t=Number(i);!Number.isNaN(t)&&t>0&&(this.#i={...this.#i,minlength:{value:`${t}`}})}if("data-password-policy-value-passwordstrength"===t){const t=parseInt(i);!Number.isNaN(t)&&t>=0&&(this.#i={...this.#i,passwordstrength:{...this.#i?.passwordstrength,expected:t}})}if("data-password-policy-actual-passwordstrength"===t){const t=Number(i);!Number.isNaN(t)&&t>=0&&(this.#i={...this.#i,passwordstrength:{...this.#i?.passwordstrength,actual:t}})}if("data-password-policy-value-disallowedchars"===t)if(i)this.#i={...this.#i,disallowedchars:{...this.#i?.disallowedchars,value:i}};else if(this.#i?.disallowedchars){const{disallowedchars:t,...e}=this.#i;this.#i=e}if("data-password-policy-value-email"===t)if(i)this.#i={...this.#i,disallowemail:{...this.#i?.disallowemail,expected:i}};else if(this.#i?.disallowemail){const{disallowemail:t,...e}=this.#i;this.#i=e}}this.renderItems(this.#t,this.#e,this.#i)}}get availablePolicies(){return this.#t||[]}set availablePolicies(t){this.#t=t}get value(){return this.getAttribute("value")||""}getStrengthScore(){return this.value.length}compareValues(t,e,i){switch(t.toUpperCase()){case"GTE":return i>=e;case"GT":return i>e;case"LTE":return i<=e;case"LT":return i<e;case"EQ":return i===e;case"NEQ":return i!==e;default:throw new Error(`Invalid comparison type: ${t}`)}}validate(){let t=this.#t;return this.#i&&(t=this.#t.map(t=>{const e=this.#i[t.id];return e?{...t,data:e}:t})),this.#e.reduce((e,i)=>{const r=t.find(t=>t.id===i);if(!r)return e;const{pattern:s,message:o,data:n,compare:a}=r,p="string"==typeof a?a.toUpperCase():a;if(!s&&!a||!o)return e;const d={message:(0,l.z)(o,n),id:i};if(s){const t=new RegExp((0,l.z)(s,n));d.valid=t.test(this.value)}else if("STR_NEQ_CI"===p){const t=(n?.expected??"").toLowerCase(),e=(this.value??"").toLowerCase();if(t&&e){const i=t.indexOf("@"),r=i>0?t.slice(0,i):t;d.valid=e!==t&&e!==r}else d.valid=!0}else a&&(d.valid=this.compareValues(p,n?.expected??-1,n?.actual??-1));return e.push(d),e},[])}get isValid(){return!this.validate().some(({valid:t})=>!1===t)}buildValidationItem({valid:t,message:e}){const i=this.value?t:"none",r=document.createElement("li");r.className="item",r.dataset.valid=i;const s=document.createElement("span");return s.className="message",s.textContent=e??"",r.appendChild(s),r}renderItems(t,e){t&&e.length&&this.list.replaceChildren(...this.validate().map(this.buildValidationItem.bind(this)))}updateLabel(t){t?(this.label.textContent=t,this.classList.remove("hide-label")):(this.classList.add("hide-label"),this.label.textContent="")}}const{host:u,item:g,symbolDefault:b,symbolSuccess:y,symbolError:w}={host:{selector:()=>":host > div"},item:{selector:()=>".item"},symbolDefault:{selector:()=>'.item[data-valid="none"]::before'},symbolSuccess:{selector:()=>'.item[data-valid="true"]::before'},symbolError:{selector:()=>'.item[data-valid="false"]::before'}},v=(0,n.Zz)((0,s.RF)({componentNameOverride:(0,a.xE)("input-wrapper")}),(0,s.RF)({mappings:{hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},padding:{},borderWidth:{...u,property:"border-width"},borderStyle:{...u,property:"border-style"},borderColor:{...u,property:"border-color"},borderRadius:{...u,property:"border-radius"},backgroundColor:{...u,property:"background-color"},textColor:{property:"color"},labelMargin:{...u,property:"gap"},itemsSpacing:{...g,property:"line-height"},itemSymbolSuccessColor:{...y,property:"color"},itemSymbolErrorColor:{...w,property:"color"},itemSymbolDefault:{...b,property:"content"},itemSymbolSuccess:{...y,property:"content"},itemSymbolError:{...w,property:"content"}}}),s.VO,s.tQ)(h)},88191(t,e,i){i.d(e,{z:()=>r});const r=(t,e)=>t.replace(/{{(\w+)+}}/g,(t,i)=>e?.[i]||t)}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[8603],{3393(t,e,i){i.d(e,{y:()=>n});var r=i(9696),s=i(79365),o=i(81365);const n=(...t)=>(0,r.Zz)(s.XX,s._$,s.yF,s.jd)((0,o.q)(...t))},87455(t,e,i){i.d(e,{M:()=>m,T:()=>d});var r=i(97810),s=i(9696),o=i(79365),n=i(8877),a=i(5810),l=i(73551),p=i(10777);const d=(0,r.xE)("new-password"),c=p.w.cssVarList,{host:h,label:u,internalInputsWrapper:g,errorMessage:b,helperText:y,passwordInput:w,policyPreview:v}={host:{selector:()=>":host"},label:{selector:"::part(label)"},internalInputsWrapper:{selector:"descope-new-password-internal .wrapper"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},passwordInput:{selector:"descope-password"},policyPreview:{selector:"descope-policy-validation"}},m=(0,s.Zz)((0,o.RF)({mappings:{fontSize:[h,{},{selector:a.M.componentName,property:a.M.cssVarList.fontSize}],fontFamily:[u,b,y],labelFontSize:{...u,property:"font-size"},labelFontWeight:{...u,property:"font-weight"},inputValueFontWeight:{...w,property:a.M.cssVarList.inputValueFontWeight},inputPlaceholderFontWeight:{...w,property:a.M.cssVarList.inputPlaceholderFontWeight},helperTextFontWeight:{...y,property:"font-weight"},errorMessageFontWeight:{...b,property:"font-weight"},labelTextColor:{...u,property:"color"},errorMessageTextColor:{...b,property:"color"},errorMessageIcon:{...b,property:"background-image"},errorMessageIconSize:{...b,property:"background-size"},errorMessageIconPadding:{...b,property:"padding-inline-start"},errorMessageIconRepeat:{...b,property:"background-repeat"},errorMessageIconPosition:{...b,property:"background-position"},errorMessageFontSize:{...b,property:"font-size"},hostWidth:{...h,property:"width"},hostMinWidth:{...h,property:"min-width"},hostDirection:[{...h,property:"direction"},{...w,property:a.M.cssVarList.hostDirection}],inputsRequiredIndicator:{...h,property:"content"},spaceBetweenInputs:{...g,property:"gap"},policyPreviewBackgroundColor:{...v,property:c.backgroundColor},policyPreviewPadding:{...v,property:c.padding},valueInputHeight:{...w,property:a.M.cssVarList.valueInputHeight},valueInputMarginBottom:{...w,property:a.M.cssVarList.valueInputMarginBottom}}}),o.VO,(0,o.OZ)({proxyProps:["value","selectionStart"]}),t=>class extends t{init(){super.init?.();const t=document.createElement("template"),e=this.getAttribute("external-input");t.innerHTML=`\n\t\t\t<${n.T}\n\t\t\t\tname="new-password"\n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n external-input="${e}"\n\t\t\t>\n </${n.T}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(n.T),"true"===this.getAttribute("external-input")&&this.initExternalInput(),(0,r.EA)(this,this.inputElement,{includeAttrs:["password-label","password-placeholder","confirm-label","confirm-placeholder","full-width","size","bordered","label","has-confirm","invalid","readonly","disabled","draggable","has-validation","policy-label","active-policies","available-policies","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email","label-type","manual-visibility-toggle"]})}createSlottedExternalInput(t,e){const i=t.querySelector("input"),r=document.createElement("slot"),s=i.getAttribute("slot");r.setAttribute("name",e),r.setAttribute("slot",s),t.appendChild(r),i.setAttribute("slot",e),i.setAttribute("name",this.getAttribute("name")),i.setAttribute("data-hidden-input","true"),this.appendChild(i)}initExternalInput(){this.passwordInput=this.inputElement.querySelector('[data-id="password"]'),this.confirmInput=this.inputElement.querySelector('[data-id="confirm"]'),this.createSlottedExternalInput(this.passwordInput,"external-password-input"),this.createSlottedExternalInput(this.confirmInput,"external-confirm-input")}})((0,o.tz)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t\tmax-width: 100%;\n\t\t\tbox-sizing: border-box;\n\t\t}\n :host ::part(error-message) {\n direction: ltr;\n }\n\t\t${(0,l.cy)(a.M.cssVarList)}\n\t\tvaadin-text-field {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t\tvaadin-text-field::part(input-field) {\n\t\t\tmin-height: 0;\n\t\t\tbackground: transparent;\n\t\t\tbox-shadow: none;\n\t\t\tpadding: 0;\n\t\t}\n\t\tvaadin-text-field::part(input-field)::after {\n\t\t\tbackground: transparent;\n\t\t\topacity: 0;\n\t\t}\n\t\tdescope-new-password-internal {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t\twidth: 100%;\n\t\t\tpadding: 0;\n\t\t}\n\t\tdescope-new-password-internal > .wrapper {\n -webkit-mask-image: none;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t}\n\t\tdescope-password {\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t}\n\t\tdescope-new-password-internal vaadin-password-field::before {\n\t\t\theight: initial;\n\t\t}\n descope-policy-validation {\n margin-top: 8px;\n display: flex;\n }\n .hidden {\n display: none;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:d}))},8877(t,e,i){i.d(e,{T:()=>r});const r=(0,i(97810).xE)("new-password-internal")},78844(t,e,i){var r=i(25964),s=i(3393),o=i(97810),n=i(87455),a=i(8877);const l=/^password-/,p=/^confirm-/,d=(t,e)=>t.replace(e,""),c=["password-label","password-placeholder"],h=["confirm-label","confirm-placeholder"],u=["has-validation","policy-label","available-policies","active-policies","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email","manual-visibility-toggle"],g=["has-confirm","disabled","bordered","size","full-width","maxlength","invalid","readonly","draggable","autocomplete","label-type","manual-visibility-toggle"],b=[].concat(g,c,h,u),y=(0,s.y)({componentName:a.T,baseSelector:"div"});customElements.define(a.T,class extends y{static get observedAttributes(){return[].concat(y.observedAttributes||[],b)}constructor(){super(),this.innerHTML='\n\t\t\t<div class="wrapper"></div>\n\t\t',this.wrapperEle=this.querySelector(".wrapper")}get value(){return this.passwordInput?.value||""}set value(t){t!==this.value&&(this.passwordInput.value=t)}get hasConfirm(){return"true"===this.getAttribute("has-confirm")}onHasConfirmChange(t){this.confirmInput.classList.toggle("hidden",!t)}onHasValidationChange(t){this.policyPanel.classList.toggle("hidden",!t)}get hasValidation(){return"true"===this.getAttribute("has-validation")}getValidity(){if(this.isRequired&&!this.value)return{valueMissing:!0};if(this.value&&!this.policyPanel.isValid)return{typeMismatch:!0};if(this.hasConfirm&&this.confirmInput&&this.value!==this.confirmInput.value)return{patternMismatch:!0};const t=this.getAttribute("minlength"),e=parseInt(t,10)||0;return this.value.length>=e?{}:{tooShort:!0}}init(){this.addEventListener("focus",t=>{t.isTrusted&&this.passwordInput.focus()}),super.init?.(),this.renderInputs(this.hasConfirm,this.hasValidation)}renderInputs(){const t="true"===this.getAttribute("external-input"),e=`\n <div class="password-input-container">\n <descope-password\n autocomplete="new-password"\n manual-visibility-toggle="true"\n data-id="password"\n external-input="${t}"\n ></descope-password>\n <descope-policy-validation></descope-policy-validation>\n </div>\n <descope-password\n autocomplete="new-password"\n manual-visibility-toggle="true"\n external-input="${t}"\n data-id="confirm"\n ></descope-password>\n `;this.wrapperEle.innerHTML=e,this.passwordInput=this.querySelector('[data-id="password"]'),this.confirmInput=this.querySelector('[data-id="confirm"]'),this.policyPanel=this.querySelector("descope-policy-validation"),this.passwordStrength=this.querySelector("descope-password-strength"),this.inputs=[this.passwordInput,this.confirmInput],this.initInputs(),this.passwordInput.addEventListener("input",t=>{this.passwordStrength?.addEventListener("score-changed",({detail:t})=>{this.policyPanel.setAttribute("data-password-policy-actual-passwordstrength",t)},{once:!0}),this.passwordStrength?.setAttribute("value",t.target.value),this.policyPanel.setAttribute("value",t.target.value)}),(0,o.EA)(this,this.policyPanel,{includeAttrs:u,mapAttrs:{"policy-label":"label","available-policies":"data"}})}handleIndicatorStyle(){this.inputs.forEach(t=>{(0,r.fz)(`\n\t\t\t\t:host ::part(required-indicator)::after {\n\t\t\t\t\tcontent: var(${n.M.cssVarList.inputsRequiredIndicator});\n width: 1em;\n text-align: center;\n\t\t\t\t}\n :host ::part(required-indicator) {\n display: inline-flex;\n }\n\t\t\t\t`,t)})}get isInvalid(){return this.hasAttribute("invalid")&&"false"!==this.getAttribute("invalid")}handleInputsInvalidAttribute(){this.inputs.forEach(t=>{t&&(0,o.mx)(t,e=>{if(e.includes("invalid")){const e=t.getAttribute("invalid"),i=this.getAttribute("invalid");this.isInvalid&&i!==e&&t.setAttribute("invalid","true")}},{})})}initInputs(){this.handleIndicatorStyle(),this.handleInputsInvalidAttribute(),this.handleFocusEventsDispatching(this.inputs)}async togglePasswordStrength(){this.activePolicies.includes("passwordstrength")?this.passwordStrength||(await Promise.all([i.e(8961),i.e(3241)]).then(i.bind(i,13241)),this.passwordStrength=document.createElement("descope-password-strength"),this.passwordStrength.setAttribute("options","Very weak,Weak,Average,Strong,Very strong"),this.passwordStrength.setAttribute("value",this.passwordInput.value||""),this.passwordStrength.setAttribute("st-host-direction",this.getAttribute("st-host-direction")),this.passwordStrength.setAttribute("full-width","true"),this.querySelector(".password-input-container").insertBefore(this.passwordStrength,this.policyPanel)):this.passwordStrength&&(this.passwordStrength.remove(),this.passwordStrength=null)}get activePolicies(){return(this.getAttribute("active-policies")||"").split(",")}toggleBooleanAttribute(t,e,i){null===i?t?.removeAttribute(e):t?.setAttribute(e,i)}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&("has-validation"===t?this.onHasValidationChange("true"===i):"has-confirm"===t?this.onHasConfirmChange("true"===i):g.includes(t)?this.inputs.forEach(e=>this.toggleBooleanAttribute(e,t,i)):c.includes(t)?this.toggleBooleanAttribute(this.passwordInput,d(t,l),i):h.includes(t)&&this.toggleBooleanAttribute(this.confirmInput,d(t,p),i),"active-policies"===t&&this.togglePasswordStrength())}})},5810(t,e,i){i.d(e,{M:()=>m,T:()=>l});var r=i(79365),s=i(9696),o=i(97810),n=i(16616),a=i(73551);const l=(0,o.xE)("password"),{host:p,inputField:d,inputElement:c,inputElementPlaceholder:h,revealButtonContainer:u,revealButtonIcon:g,label:b,requiredIndicator:y,errorMessage:w,helperText:v}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"> input"},inputElementPlaceholder:{selector:()=>":host input:placeholder-shown"},revealButtonContainer:{selector:"::part(reveal-button)"},revealButtonIcon:{selector:"::part(reveal-button)::before"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},m=(0,s.Zz)((0,r.RF)({mappings:{hostWidth:{...p,property:"width"},hostMinWidth:{...p,property:"min-width"},hostDirection:{...p,property:"direction"},fontSize:[{},p],fontFamily:[b,d,w,v],inputHeight:{...d,property:"height"},inputHorizontalPadding:[{...c,property:"padding-left"},{...c,property:"padding-right"}],inputBackgroundColor:{...d,property:"background-color"},inputBorderStyle:{...d,property:"border-style"},inputBorderWidth:{...d,property:"border-width"},inputBorderColor:{...d,property:"border-color"},inputBorderRadius:{...d,property:"border-radius"},inputOutlineColor:{...d,property:"outline-color"},inputOutlineStyle:{...d,property:"outline-style"},inputOutlineOffset:{...d,property:"outline-offset"},inputOutlineWidth:{...d,property:"outline-width"},labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},inputValueFontWeight:[{...c,property:"font-weight"},{selector:()=>":host ::slotted(input)",property:"font-weight"}],inputPlaceholderFontWeight:[{...h,property:"font-weight"},{selector:()=>":host ::slotted(input:placeholder-shown)",property:"font-weight"}],helperTextFontWeight:{...v,property:"font-weight"},errorMessageFontWeight:{...w,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...b,property:"-webkit-text-fill-color"},{...y,property:"color"},{...y,property:"-webkit-text-fill-color"}],labelRequiredIndicator:{...y,property:"content"},errorMessageTextColor:{...w,property:"color"},errorMessageIcon:{...w,property:"background-image"},errorMessageIconSize:{...w,property:"background-size"},errorMessageIconPadding:{...w,property:"padding-inline-start"},errorMessageIconRepeat:{...w,property:"background-repeat"},errorMessageIconPosition:{...w,property:"background-position"},errorMessageFontSize:{...w,property:"font-size"},inputPlaceholderTextColor:[{...h,property:"color"},{selector:()=>":host ::slotted(input:placeholder-shown)",property:"color"}],inputValueTextColor:[{...c,property:"color"},{selector:()=>":host ::slotted(input)",property:"color"}],revealButtonOffset:[{...u,property:"margin-right"},{...u,property:"margin-left"}],revealButtonSize:{...u,property:"font-size"},revealButtonColor:{...g,property:"color"},labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:[{selector:"> input:placeholder-shown",property:"opacity"},{...c,property:"opacity"}],inputVerticalAlignment:{...d,property:"align-items"},valueInputHeight:{...c,property:"height"}}}),r.VO,(0,r.RV)({inputType:"password",inputName:"password",includeAttrs:["disabled","readonly","pattern","type","autocomplete"],noBlurDispatch:!0}),(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,n.A,t=>class extends t{static get observedAttributes(){return["manual-visibility-toggle"]}get manualToggleVisibility(){return"true"===this.getAttribute("manual-visibility-toggle")}init(){super.init?.(),this.handleCaretOnVisibilityChange(),this.origSetPasswordVisible=this.baseElement._setPasswordVisible,this.origSetFocused=this.baseElement._setFocused,this.baseElement._setFocused=this.setFocus.bind(this),this.initExternalInput(),this.stopRevealButtonEnterPropagation()}stopRevealButtonEnterPropagation(){this.revealButton.addEventListener("keydown",t=>{"Enter"===t.key&&t.stopPropagation()})}get revealButton(){return this.baseElement.querySelector("vaadin-password-field-button")}initExternalInput(){const t=this.createExternalInput();t&&this.handlePasswordVisibility(t)}get caretPosition(){return this.value?.length||0}handleCaretOnVisibilityChange(){const t=this.baseElement._togglePasswordVisibility.bind(this.baseElement);this.baseElement._togglePasswordVisibility=()=>{setTimeout(()=>(t(),this.inputElement.setSelectionRange(this.caretPosition,this.caretPosition),!1))}}setFocus(t){this.manualToggleVisibility&&(this.baseElement._setPasswordVisible=()=>{}),this.origSetFocused.call(this.baseElement,t),this.baseElement._setPasswordVisible=this.origSetPasswordVisible.bind(this.baseElement)}resetPasswordVisibilityToggle(){this.baseElement._setPasswordVisible=this.origSetPasswordVisible,this.baseElement._setFocused=this.origSetFocus}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i)}handlePasswordVisibility(t){const e=this.baseElement.__boundRevealButtonMouseDown;this.revealButton.removeEventListener("mousedown",e),this.baseElement._passwordVisibleChanged=()=>{},this.baseElement._togglePasswordVisibility=()=>{"password"===t.getAttribute("type")?this.showPasswordVisibility(t):this.hidePasswordVisibility(t)}}showPasswordVisibility(t){t.setAttribute("type","text"),this.setAttribute("password-visible","true")}hidePasswordVisibility(t){t.setAttribute("type","password"),this.setAttribute("password-visible","false")}})((0,r.tz)({slots:["","suffix"],wrappedEleName:"vaadin-password-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tmin-width: 10em;\n box-sizing: border-box;\n position: relative;\n\t\t\t}\n\t\t\t${(0,a.cy)(m.cssVarList)}\n\t\t\t${(0,a.I4)("vaadin-password-field")}\n ${(0,a.$J)("vaadin-password-field")}\n\n\t\t\tvaadin-password-field {\n\t\t\t\twidth: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t\tvaadin-password-field > input {\n -webkit-mask-image: none;\n\t\t\t\tbox-sizing: border-box;\n opacity: 1;\n\t\t\t}\n\t\t\tvaadin-password-field::part(input-field) {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t\tvaadin-password-field[focus-ring]::part(input-field) {\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n :host ::slotted(input) {\n\t\t\t\tmin-height: 0;\n }\n :host([readonly]) ::slotted(input:placeholder-shown) {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tvaadin-password-field::before {\n\t\t\t\theight: initial;\n\t\t\t}\n\t\t\tvaadin-password-field::part(input-field)::after {\n\t\t\t\topacity: 0;\n\t\t\t}\n\t\t\tvaadin-password-field-button {\n\t\t\t\tcursor: pointer;\n\t\t\t}\n\t\t\t:host([readonly]) vaadin-password-field-button {\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\tvaadin-password-field-button[focus-ring] {\n\t\t\t\tbox-shadow: 0 0 0 2px var(${m.cssVarList.inputOutlineColor});\n\t\t\t}\n\n ${(0,a.Kl)()}\n\n ::part(reveal-button) {\n align-self: center;\n }\n\n vaadin-password-field[external-input="true"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:l}))},16616(t,e,i){i.d(e,{A:()=>r});const r=t=>class extends t{get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}init(){super.init?.();const t=this.querySelector("input");t?.addEventListener("mousedown",e=>{if(this.isDraggable&&this.isReadOnly){t.setAttribute("inert","true");const i=e.target,r=i.getAttribute("type");i.setAttribute("type","text"),setTimeout(()=>{i.focus()});const s=e=>{i.setAttribute("type",r),t.removeAttribute("inert"),this.removeEventListener("mouseup",s),this.removeEventListener("dragend",s)};this.addEventListener("dragend",s,{once:!0}),this.addEventListener("mouseup",s,{once:!0})}})}}},10777(t,e,i){i.d(e,{T:()=>p,w:()=>v});var r=i(25964),s=i(79365),o=i(81365),n=i(9696),a=i(97810),l=i(88191);const p=(0,a.xE)("policy-validation"),d=["data","active-policies","overrides","data-password-policy-value-minlength","data-password-policy-value-passwordstrength","data-password-policy-actual-passwordstrength","data-password-policy-value-disallowedchars","data-password-policy-value-email"],c=["label","value",...d];class h extends((0,o.q)({componentName:p,baseSelector:":host > div"})){#t;#e=[];#i;static get observedAttributes(){return c}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div>\n <div class="label"></div>\n <ul></ul>\n </div>\n\t\t',(0,r.fz)("\n :host > div {\n width: 100%;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n }\n .label {\n max-width: 100%;\n text-wrap: wrap;\n overflow-wrap: break-word;\n }\n .hide-label .label {\n display: none;\n }\n ul {\n display: flex;\n flex-direction: column;\n padding: 0;\n margin: 0;\n }\n ul, li {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li::before {\n display: inline-block;\n width: 1em;\n text-align: center;\n }\n ",this),this.panel=this.shadowRoot.querySelector(":host > div"),this.label=this.shadowRoot.querySelector(".label"),this.list=this.shadowRoot.querySelector("ul")}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback?.(t,e,i),e!==i){if("label"===t&&this.updateLabel(i),d.includes(t)){if("data"===t)try{this.availablePolicies=JSON.parse(i)}catch{console.error("Failed to set available policies")}if("active-policies"===t&&(this.#e=(i||"").split(",")),"data-password-policy-value-minlength"===t){const t=Number(i);!Number.isNaN(t)&&t>0&&(this.#i={...this.#i,minlength:{value:`${t}`}})}if("data-password-policy-value-passwordstrength"===t){const t=parseInt(i);!Number.isNaN(t)&&t>=0&&(this.#i={...this.#i,passwordstrength:{...this.#i?.passwordstrength,expected:t}})}if("data-password-policy-actual-passwordstrength"===t){const t=Number(i);!Number.isNaN(t)&&t>=0&&(this.#i={...this.#i,passwordstrength:{...this.#i?.passwordstrength,actual:t}})}if("data-password-policy-value-disallowedchars"===t)if(i)this.#i={...this.#i,disallowedchars:{...this.#i?.disallowedchars,value:i}};else if(this.#i?.disallowedchars){const{disallowedchars:t,...e}=this.#i;this.#i=e}if("data-password-policy-value-email"===t)if(i)this.#i={...this.#i,disallowemail:{...this.#i?.disallowemail,expected:i}};else if(this.#i?.disallowemail){const{disallowemail:t,...e}=this.#i;this.#i=e}}this.renderItems(this.#t,this.#e,this.#i)}}get availablePolicies(){return this.#t||[]}set availablePolicies(t){this.#t=t}get value(){return this.getAttribute("value")||""}getStrengthScore(){return this.value.length}compareValues(t,e,i){switch(t.toUpperCase()){case"GTE":return i>=e;case"GT":return i>e;case"LTE":return i<=e;case"LT":return i<e;case"EQ":return i===e;case"NEQ":return i!==e;default:throw new Error(`Invalid comparison type: ${t}`)}}validate(){let t=this.#t;return this.#i&&(t=this.#t.map(t=>{const e=this.#i[t.id];return e?{...t,data:e}:t})),this.#e.reduce((e,i)=>{const r=t.find(t=>t.id===i);if(!r)return e;const{pattern:s,message:o,data:n,compare:a}=r,p="string"==typeof a?a.toUpperCase():a;if(!s&&!a||!o)return e;const d={message:(0,l.z)(o,n),id:i};if(s){const t=new RegExp((0,l.z)(s,n));d.valid=t.test(this.value)}else if("STR_NEQ_CI"===p){const t=(n?.expected??"").toLowerCase(),e=(this.value??"").toLowerCase();if(t&&e){const i=t.indexOf("@"),r=i>0?t.slice(0,i):t;d.valid=e!==t&&e!==r}else d.valid=!0}else a&&(d.valid=this.compareValues(p,n?.expected??-1,n?.actual??-1));return e.push(d),e},[])}get isValid(){return!this.validate().some(({valid:t})=>!1===t)}buildValidationItem({valid:t,message:e}){const i=this.value?t:"none",r=document.createElement("li");r.className="item",r.dataset.valid=i;const s=document.createElement("span");return s.className="message",s.textContent=e??"",r.appendChild(s),r}renderItems(t,e){t&&e.length&&this.list.replaceChildren(...this.validate().map(this.buildValidationItem.bind(this)))}updateLabel(t){t?(this.label.textContent=t,this.classList.remove("hide-label")):(this.classList.add("hide-label"),this.label.textContent="")}}const{host:u,item:g,symbolDefault:b,symbolSuccess:y,symbolError:w}={host:{selector:()=>":host > div"},item:{selector:()=>".item"},symbolDefault:{selector:()=>'.item[data-valid="none"]::before'},symbolSuccess:{selector:()=>'.item[data-valid="true"]::before'},symbolError:{selector:()=>'.item[data-valid="false"]::before'}},v=(0,n.Zz)((0,s.RF)({componentNameOverride:(0,a.xE)("input-wrapper")}),(0,s.RF)({mappings:{hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},padding:{},borderWidth:{...u,property:"border-width"},borderStyle:{...u,property:"border-style"},borderColor:{...u,property:"border-color"},borderRadius:{...u,property:"border-radius"},backgroundColor:{...u,property:"background-color"},textColor:{property:"color"},labelMargin:{...u,property:"gap"},itemsSpacing:{...g,property:"line-height"},itemSymbolSuccessColor:{...y,property:"color"},itemSymbolErrorColor:{...w,property:"color"},itemSymbolDefault:{...b,property:"content"},itemSymbolSuccess:{...y,property:"content"},itemSymbolError:{...w,property:"content"}}}),s.VO,s.tQ)(h)},88191(t,e,i){i.d(e,{z:()=>r});const r=(t,e)=>t.replace(/{{(\w+)+}}/g,(t,i)=>e?.[i]||t)}}]);
|
|
2
2
|
//# sourceMappingURL=descope-new-password-descope-new-password-internal-index-js.js.map
|