@cupra/ui-kit 2.0.0-canary.206 → 2.0.0-canary.208
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/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist/cjs/components/ds-toast/ds-toast.cjs +10 -10
- package/dist/cjs/components/ds-toast/utils/ToastManager.cjs +1 -1
- package/dist/cjs/components/ds-toast-message/ds-toast-message.cjs +17 -9
- package/dist/cjs/decorators/customUiKitElement.cjs +1 -1
- package/dist/cjs/utils/IconsManager.cjs +1 -1
- package/dist/cjs/utils/PubSub.cjs +1 -1
- package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist/cjs/utils/version.cjs +1 -1
- package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/esm/components/ds-toast/ds-toast.js +32 -41
- package/dist/esm/components/ds-toast/utils/ToastManager.js +15 -5
- package/dist/esm/components/ds-toast-message/ds-toast-message.js +56 -29
- package/dist/esm/decorators/customUiKitElement.js +1 -1
- package/dist/esm/utils/IconsManager.js +1 -1
- package/dist/esm/utils/PubSub.js +1 -1
- package/dist/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist/esm/utils/version.js +1 -1
- package/dist/types/components/ds-toast/ds-toast.types.d.ts +4 -1
- package/dist/types/components/ds-toast/utils/ToastManager.d.ts +10 -1
- package/dist/types/components/ds-toast-message/ds-toast-message.d.ts +6 -3
- package/dist/types/components/ds-toast-message/ds-toast-message.types.d.ts +4 -1
- package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist-react/cjs/components/ds-toast/ds-toast.cjs +10 -10
- package/dist-react/cjs/components/ds-toast/utils/ToastManager.cjs +1 -1
- package/dist-react/cjs/components/ds-toast-message/ds-toast-message.cjs +17 -9
- package/dist-react/cjs/decorators/customUiKitElement.cjs +1 -1
- package/dist-react/cjs/utils/IconsManager.cjs +1 -1
- package/dist-react/cjs/utils/PubSub.cjs +1 -1
- package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist-react/cjs/utils/version.cjs +1 -1
- package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/esm/components/ds-toast/ds-toast.js +32 -41
- package/dist-react/esm/components/ds-toast/utils/ToastManager.js +15 -5
- package/dist-react/esm/components/ds-toast-message/ds-toast-message.js +56 -29
- package/dist-react/esm/decorators/customUiKitElement.js +1 -1
- package/dist-react/esm/utils/IconsManager.js +1 -1
- package/dist-react/esm/utils/PubSub.js +1 -1
- package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist-react/esm/utils/version.js +1 -1
- package/dist-react/types/components/ds-toast/ds-toast.types.d.ts +4 -1
- package/dist-react/types/components/ds-toast/utils/ToastManager.d.ts +10 -1
- package/dist-react/types/components/ds-toast-message/ds-toast-message.d.ts +6 -3
- package/dist-react/types/components/ds-toast-message/ds-toast-message.types.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const e=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/decorators/provide.cjs"),t=require("./themeContext.cjs");require("../../core/theme.constants.cjs");const n=require("../../utils/PubSub.cjs"),r=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs"),i=require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const s=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),c=require("../../decorators/customUiKitElement.cjs"),l=require("../../utils/booleanConverter.cjs"),u=require("../../styles/source/shared/fonts-config.cjs");var d=class extends i.i{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.loadUnusedStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){if(super.updated(e),e.has(`theme`)){var t,r;n.pubSub.publish(`theme`,this.theme),(t=sessionStorage)==null||t.setItem(`@cupra/ui-kit/theme`,this.theme),typeof FontFace<`u`&&(r=document)!=null&&r.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))})}}loadThemeFonts(){var e;(e=u.fontsConfig[this.theme])==null||e.fonts.forEach(e=>{this.loadThemeFont(e)})}async loadThemeFont({weight:e,name:t,file:n}){if(!this.loadFonts)return Promise.resolve();let r=`${t}-${e}`;if(this.loadedFonts.has(r))return;let i=new FontFace(t,`url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff2') format('woff2'),
|
|
2
2
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff') format('woff'),
|
|
3
3
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.ttf') format('truetype'),
|
|
4
|
-
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.208`;return this.loadUnusedStyles&&this.applyUnusedStyles(e),this.loadStyles?new Promise((t,n)=>{let r=`https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))t();else{let i=`ui-kit-theme-${e}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>t(),o.onerror=()=>n(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a==null||a.remove()}}):Promise.resolve()}applyUnusedStyles(e){let t=`https://ds-assets.cupra.com${e}/styles/${this.theme}/unused-styles.css`;if(document.head.querySelector(`link[href="${t}"]`))return;let n=`ui-kit-unused-styles-${e}`,r=document.getElementById(n),i=document.createElement(`link`);i.id=n,i.rel=`preload`,i.as=`style`,i.href=t,i.onload=()=>{i.rel=`stylesheet`},document.head.appendChild(i),r==null||r.remove()}render(){return this.cssLoaded?r.x`<slot></slot>`:r.E}};s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-fonts`})],d.prototype,`loadFonts`,void 0),s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-styles`})],d.prototype,`loadStyles`,void 0),s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-unused-styles`})],d.prototype,`loadUnusedStyles`,void 0),s.__decorate([e.e({context:t.themeContext}),a.n({type:String})],d.prototype,`theme`,void 0),s.__decorate([o.r()],d.prototype,`cssLoaded`,void 0),s.__decorate([o.r()],d.prototype,`loadedFonts`,void 0),d=s.__decorate([c.customUiKitElement(`ds-theme-provider`)],d);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const e=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const r=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),i=require("../base/UiKitElement.cjs"),a=require("../../decorators/customUiKitElement.cjs"),o=require("../../
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const e=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const r=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),i=require("../base/UiKitElement.cjs"),a=require("../../decorators/customUiKitElement.cjs"),o=require("../../utils/uiKitHtml.cjs"),s=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs");const c=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/if-defined.cjs");const l=require("./utils/ToastManager.cjs");require("../ds-toast-message/ds-toast-message.cjs");const u=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/repeat.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/repeat.cjs");const d=require("./styles/common.styles.cjs");var f,p=(f=class extends i.UiKitElement{constructor(...e){super(...e),this.position=`top-right`,this.toasts=[],this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.unsubscribe=l.toastManager.subscribe(e=>{this.toasts=e})}disconnectedCallback(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),super.disconnectedCallback()}handleAnimationEnd(e){let t=e.target;if(t.classList.contains(`exiting`)&&(e.animationName===`toast-out-left`||e.animationName===`toast-out-right`)){let e=t.getAttribute(`data-id`);e&&l.toastManager.removeToast(e)}}getToastMessageTemplate(t){let n={toast:!0,[t.status]:!0,exiting:t.exiting},r=o.uiKitHtml`<ds-toast-message
|
|
2
|
+
data-id=${t.id}
|
|
3
|
+
title=${c.o(t.title)}
|
|
4
|
+
text=${c.o(t.text)}
|
|
5
|
+
status=${c.o(t.status)}
|
|
6
|
+
.action=${t.action}
|
|
7
|
+
></ds-toast-message>`;return e.x`<div class=${s.e(n)} data-id="${t.id}">${r}</div>`}get containerClasses(){return{"toast-container":!0,[this.position]:!0}}render(){return e.x`
|
|
8
8
|
<div
|
|
9
9
|
part="toast-container"
|
|
10
|
-
class=${
|
|
10
|
+
class=${s.e(this.containerClasses)}
|
|
11
11
|
@animationend=${this.handleAnimationEnd}
|
|
12
12
|
aria-live="polite"
|
|
13
13
|
>
|
|
14
|
-
${
|
|
14
|
+
${u.c(this.toasts,e=>e.id,e=>this.getToastMessageTemplate(e))}
|
|
15
15
|
</div>
|
|
16
|
-
`}},
|
|
16
|
+
`}},f.styles=[d.containerStyles,d.toastStyles],f);r.__decorate([t.n({type:String})],p.prototype,`position`,void 0),r.__decorate([n.r()],p.prototype,`toasts`,void 0),p=r.__decorate([a.customUiKitElement(`ds-toast`)],p);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=1e4,t=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():Math.random().toString(36).substring(2),n=class n{constructor(){this.toasts=[],this.subscribers=[],this.defaultDuration=e,this.handleAddToast=e=>{let{id:n=t(),status:r=`default`,duration:i=this.defaultDuration,...a}=e.detail||{},o={id:n,status:r,...a,exiting:!1};o.timeoutId=window.setTimeout(()=>{this.toasts.find(e=>e.id===n).exiting=!0,this.notifySubscribers()},i),this.toasts=[...this.toasts,o],this.notifySubscribers()},this.handleRemoveToast=e=>{let{id:t
|
|
1
|
+
var e=1e4,t=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():Math.random().toString(36).substring(2),n=class n{constructor(){this.toasts=[],this.subscribers=[],this.defaultDuration=e,this.handleAddToast=e=>{let{id:n=t(),status:r=`default`,duration:i=this.defaultDuration,...a}=e.detail||{},o={id:n,status:r,...a,exiting:!1};o.timeoutId=window.setTimeout(()=>{this.toasts.find(e=>e.id===n).exiting=!0,this.notifySubscribers()},i),this.toasts=[...this.toasts,o],this.notifySubscribers()},this.handleRemoveToast=e=>{let{id:t}=e.detail||{};if(!t)return;let n=this.toasts.find(e=>e.id===t);n&&(n.timeoutId&&window.clearTimeout(n.timeoutId),n.exiting=!0,this.notifySubscribers())},this.handleActionClick=e=>{var t,n;let{id:r}=e.detail||{};if(!r)return;let i=this.toasts.find(e=>e.id===r);i&&((t=i.action)==null||(n=t.callback)==null||n.call(t),window.dispatchEvent(new CustomEvent(`ds-toast:action`,{bubbles:!0,composed:!0,detail:{toastId:r}})))},this.initialize()}initialize(){window.addEventListener(`toast:add`,this.handleAddToast),window.addEventListener(`toast:remove`,this.handleRemoveToast),window.addEventListener(`ds-toast:action-click`,this.handleActionClick)}static getInstance(){return n.instance||(n.instance=new n),n.instance}removeToast(e){let t=this.toasts.find(t=>t.id===e);t!=null&&t.timeoutId&&window.clearTimeout(t.timeoutId),this.toasts=this.toasts.filter(t=>t.id!==e),this.notifySubscribers()}getToasts(){return[...this.toasts]}subscribe(e){return this.subscribers.push(e),()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}notifySubscribers(){let e=this.getToasts();this.subscribers.forEach(t=>t(e))}}.getInstance();exports.toastManager=n;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
const e=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const n=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),r=require("../base/UiKitElement.cjs"),i=require("../../decorators/customUiKitElement.cjs");require("../ds-icon/ds-icon.cjs");const a=require("../../utils/
|
|
1
|
+
const e=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const n=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),r=require("../base/UiKitElement.cjs"),i=require("../../decorators/customUiKitElement.cjs");require("../ds-icon/ds-icon.cjs");const a=require("../../utils/uiKitHtml.cjs"),o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs");const s=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/if-defined.cjs"),require("../ds-icon-button/ds-icon-button.cjs");const c=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.cjs");require("../ds-link-button/ds-link-button.cjs");const l=require("./styles/common.styles.cjs");var u,d=(u=class extends r.UiKitElement{constructor(...e){super(...e),this.status=`default`,this.dataId=``,this.title=``,this.text=``}getIconName(){switch(this.status){case`success`:return`check-mark-circle`;case`error`:return`cross-circle`;case`warning`:return`exclamation-mark-circle`;case`info`:return`info-circle`;default:return`chat-bubble`}}handleClickCloseButton(){let e=new CustomEvent(`toast:remove`,{bubbles:!0,composed:!0,detail:{id:this.dataId}});this.dispatchEvent(e)}handleClickAction(){let e=new CustomEvent(`ds-toast:action-click`,{bubbles:!0,composed:!0,detail:{id:this.dataId}});this.dispatchEvent(e)}get toastMessageClasses(){return{container:!0,[this.status||`default`]:!0}}get iconTemplate(){return a.uiKitHtml`<ds-icon class="icon" icon-name=${s.o(this.getIconName())} size="24"></ds-icon>`}get headerTemplate(){return c.n(this.title||this.text,()=>e.x`
|
|
2
|
+
<div class="header">
|
|
3
|
+
${c.n(this.title,()=>e.x`<div class="title">${this.title}</div>`)}
|
|
4
|
+
${c.n(this.text,()=>e.x`<div class="message">${this.text}</div>`)}
|
|
5
|
+
</div>
|
|
6
|
+
`)}get closeButtonTemplate(){return a.uiKitHtml`<ds-icon-button
|
|
2
7
|
data-aria-label="close-button"
|
|
3
8
|
@click=${this.handleClickCloseButton}
|
|
4
9
|
icon-name="cross"
|
|
5
10
|
variant="naked"
|
|
6
11
|
size="medium"
|
|
7
|
-
></ds-icon-button>`}
|
|
8
|
-
|
|
12
|
+
></ds-icon-button>`}get actionTemplate(){var e;return c.n((e=this.action)==null?void 0:e.text,()=>a.uiKitHtml`<ds-link-button
|
|
13
|
+
html-tag-name="button"
|
|
14
|
+
underline
|
|
15
|
+
icon-name="none"
|
|
16
|
+
@click=${this.handleClickAction}
|
|
17
|
+
>${this.action.text}</ds-link-button
|
|
18
|
+
>`)}render(){return e.x`
|
|
19
|
+
<div class=${o.e(this.toastMessageClasses)}>
|
|
9
20
|
${this.iconTemplate}
|
|
10
21
|
<div class="content">
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
${l.n(this.text,()=>e.x`<div class="message">${this.text}</div>`)}
|
|
14
|
-
</div>
|
|
15
|
-
<slot></slot>
|
|
22
|
+
${this.headerTemplate}
|
|
23
|
+
${this.actionTemplate}
|
|
16
24
|
</div>
|
|
17
25
|
${this.closeButtonTemplate}
|
|
18
26
|
</div>
|
|
19
|
-
`}},
|
|
27
|
+
`}},u.styles=[l.toastMessageStyles],u);n.__decorate([t.n({type:String,reflect:!0})],d.prototype,`status`,void 0),n.__decorate([t.n({type:String,attribute:`data-id`,reflect:!0})],d.prototype,`dataId`,void 0),n.__decorate([t.n({type:String,reflect:!0})],d.prototype,`title`,void 0),n.__decorate([t.n({type:String,reflect:!0})],d.prototype,`text`,void 0),n.__decorate([t.n({attribute:!1})],d.prototype,`action`,void 0),d=n.__decorate([i.customUiKitElement(`ds-toast-message`)],d);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require("../utils/version.cjs");function e(e,t){return function(n){var r,i,a,o;if(!(n!=null&&n.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let s=e;if(!((r=globalThis)==null||(r=r.customElements)==null)&&r.get(s))return;let c=t!=null&&t.skipTagAsComponentName?[]:[e];Array.isArray(t==null?void 0:t.extendComponentNames)&&(c=[...t.extendComponentNames,...c]),(i=globalThis)==null||(i=i.customElements)==null||(a=i.define)==null||a.call(i,s,(o=class extends n{connectedCallback(){var t;(t=n.prototype.connectedCallback)==null||t.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.
|
|
1
|
+
require("../utils/version.cjs");function e(e,t){return function(n){var r,i,a,o;if(!(n!=null&&n.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let s=e;if(!((r=globalThis)==null||(r=r.customElements)==null)&&r.get(s))return;let c=t!=null&&t.skipTagAsComponentName?[]:[e];Array.isArray(t==null?void 0:t.extendComponentNames)&&(c=[...t.extendComponentNames,...c]),(i=globalThis)==null||(i=i.customElements)==null||(a=i.define)==null||a.call(i,s,(o=class extends n{connectedCallback(){var t;(t=n.prototype.connectedCallback)==null||t.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.208`),this.setAttribute(`data-ui-kit-component-name`,e)}},o.componentName=c,o))}}exports.customUiKitElement=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
1
|
+
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.208`),i=globalThis,a=i[r];a||(a=new n,Object.defineProperty(i,r,{value:a,writable:!1,configurable:!1,enumerable:!1}));var o=a;exports.iconsManager=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
1
|
+
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.208`),n=globalThis,r=n[t];r||(r=new e,Object.defineProperty(n,t,{value:r,writable:!1,configurable:!1,enumerable:!1}));var i=r;exports.pubSub=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.208/styles/${n}/components/${t}.css`,i=this.getCachedStyleSheetPromise({url:r});if(i)return i;let a=e(()=>this.fetchStyle({url:r})).then(e=>(e||this.stylePromises.delete(r),e));return this.stylePromises.set(r,a),this.stylePromises.get(r)}}async fetchStyle({url:e}){try{if(typeof fetch>`u`)return;let t=await fetch(e,{cache:`force-cache`});if(t.ok)return t.text()}catch(t){console.error(`Failed to fetch Style Sheet "${e}":`,t)}}getCachedStyleSheetPromise({url:e}){return this.stylePromises.get(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}}.getInstance();exports.stylesRegistry=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.208`,t=`--v${e.replaceAll(`.`,`-`)}`;exports.VERSION=e,exports.VERSION_TAG_SUFFIX=t;
|
|
@@ -53,7 +53,7 @@ var f = class extends a {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
loadThemeStyles() {
|
|
56
|
-
let e = "/2.0.0-canary.
|
|
56
|
+
let e = "/2.0.0-canary.208";
|
|
57
57
|
return this.loadUnusedStyles && this.applyUnusedStyles(e), this.loadStyles ? new Promise((t, n) => {
|
|
58
58
|
let r = `https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;
|
|
59
59
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as e } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
2
2
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.js";
|
|
3
|
-
import { n } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
4
|
-
import { r } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
3
|
+
import { n as t } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
4
|
+
import { r as n } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
5
5
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.js";
|
|
6
|
-
import { __decorate as
|
|
7
|
-
import { UiKitElement as
|
|
8
|
-
import { customUiKitElement as
|
|
9
|
-
import {
|
|
10
|
-
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/
|
|
11
|
-
import { uiKitHtml as c } from "../../utils/uiKitHtml.js";
|
|
12
|
-
import { e as l } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
6
|
+
import { __decorate as r } from "../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.js";
|
|
7
|
+
import { UiKitElement as i } from "../base/UiKitElement.js";
|
|
8
|
+
import { customUiKitElement as a } from "../../decorators/customUiKitElement.js";
|
|
9
|
+
import { uiKitHtml as o } from "../../utils/uiKitHtml.js";
|
|
10
|
+
import { e as s } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
13
11
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.js";
|
|
14
|
-
import { o as
|
|
12
|
+
import { o as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.js";
|
|
15
13
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/if-defined.js";
|
|
16
|
-
import { toastManager as
|
|
14
|
+
import { toastManager as l } from "./utils/ToastManager.js";
|
|
17
15
|
import "../ds-toast-message/ds-toast-message.js";
|
|
18
|
-
import { c as
|
|
16
|
+
import { c as u } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/repeat.js";
|
|
19
17
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/repeat.js";
|
|
20
|
-
import { containerStyles as
|
|
18
|
+
import { containerStyles as d, toastStyles as f } from "./styles/common.styles.js";
|
|
21
19
|
//#region src/components/ds-toast/ds-toast.ts
|
|
22
|
-
var
|
|
20
|
+
var p, m = (p = class extends i {
|
|
23
21
|
constructor(...e) {
|
|
24
22
|
super(...e), this.position = "top-right", this.toasts = [], this.unsubscribe = null;
|
|
25
23
|
}
|
|
26
24
|
connectedCallback() {
|
|
27
|
-
super.connectedCallback(), this.unsubscribe =
|
|
25
|
+
super.connectedCallback(), this.unsubscribe = l.subscribe((e) => {
|
|
28
26
|
this.toasts = e;
|
|
29
27
|
});
|
|
30
28
|
}
|
|
@@ -35,29 +33,22 @@ var h, g = (h = class extends a {
|
|
|
35
33
|
let t = e.target;
|
|
36
34
|
if (t.classList.contains("exiting") && (e.animationName === "toast-out-left" || e.animationName === "toast-out-right")) {
|
|
37
35
|
let e = t.getAttribute("data-id");
|
|
38
|
-
e &&
|
|
36
|
+
e && l.removeToast(e);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
getToastMessageTemplate(
|
|
42
|
-
let
|
|
39
|
+
getToastMessageTemplate(t) {
|
|
40
|
+
let n = {
|
|
43
41
|
toast: !0,
|
|
44
|
-
[
|
|
45
|
-
exiting:
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
data-id=${n.id}
|
|
55
|
-
data-template="false"
|
|
56
|
-
title=${u(n.title)}
|
|
57
|
-
text=${u(n.text)}
|
|
58
|
-
status=${u(n.status)}
|
|
59
|
-
></ds-toast-message>`;
|
|
60
|
-
return t`<div class=${l(r)} data-id="${n.id}">${i}</div>`;
|
|
42
|
+
[t.status]: !0,
|
|
43
|
+
exiting: t.exiting
|
|
44
|
+
}, r = o`<ds-toast-message
|
|
45
|
+
data-id=${t.id}
|
|
46
|
+
title=${c(t.title)}
|
|
47
|
+
text=${c(t.text)}
|
|
48
|
+
status=${c(t.status)}
|
|
49
|
+
.action=${t.action}
|
|
50
|
+
></ds-toast-message>`;
|
|
51
|
+
return e`<div class=${s(n)} data-id="${t.id}">${r}</div>`;
|
|
61
52
|
}
|
|
62
53
|
get containerClasses() {
|
|
63
54
|
return {
|
|
@@ -66,17 +57,17 @@ var h, g = (h = class extends a {
|
|
|
66
57
|
};
|
|
67
58
|
}
|
|
68
59
|
render() {
|
|
69
|
-
return
|
|
60
|
+
return e`
|
|
70
61
|
<div
|
|
71
62
|
part="toast-container"
|
|
72
|
-
class=${
|
|
63
|
+
class=${s(this.containerClasses)}
|
|
73
64
|
@animationend=${this.handleAnimationEnd}
|
|
74
65
|
aria-live="polite"
|
|
75
66
|
>
|
|
76
|
-
${
|
|
67
|
+
${u(this.toasts, (e) => e.id, (e) => this.getToastMessageTemplate(e))}
|
|
77
68
|
</div>
|
|
78
69
|
`;
|
|
79
70
|
}
|
|
80
|
-
},
|
|
81
|
-
|
|
71
|
+
}, p.styles = [d, f], p);
|
|
72
|
+
r([t({ type: String })], m.prototype, "position", void 0), r([n()], m.prototype, "toasts", void 0), m = r([a("ds-toast")], m);
|
|
82
73
|
//#endregion
|
|
@@ -12,14 +12,24 @@ var e = 1e4, t = () => typeof crypto < "u" && typeof crypto.randomUUID == "funct
|
|
|
12
12
|
this.toasts.find((e) => e.id === n).exiting = !0, this.notifySubscribers();
|
|
13
13
|
}, i), this.toasts = [...this.toasts, o], this.notifySubscribers();
|
|
14
14
|
}, this.handleRemoveToast = (e) => {
|
|
15
|
-
let { id: t
|
|
16
|
-
if (!t
|
|
17
|
-
let
|
|
18
|
-
|
|
15
|
+
let { id: t } = e.detail || {};
|
|
16
|
+
if (!t) return;
|
|
17
|
+
let n = this.toasts.find((e) => e.id === t);
|
|
18
|
+
n && (n.timeoutId && window.clearTimeout(n.timeoutId), n.exiting = !0, this.notifySubscribers());
|
|
19
|
+
}, this.handleActionClick = (e) => {
|
|
20
|
+
var t, n;
|
|
21
|
+
let { id: r } = e.detail || {};
|
|
22
|
+
if (!r) return;
|
|
23
|
+
let i = this.toasts.find((e) => e.id === r);
|
|
24
|
+
i && ((t = i.action) == null || (n = t.callback) == null || n.call(t), window.dispatchEvent(new CustomEvent("ds-toast:action", {
|
|
25
|
+
bubbles: !0,
|
|
26
|
+
composed: !0,
|
|
27
|
+
detail: { toastId: r }
|
|
28
|
+
})));
|
|
19
29
|
}, this.initialize();
|
|
20
30
|
}
|
|
21
31
|
initialize() {
|
|
22
|
-
window.addEventListener("toast:add", this.handleAddToast), window.addEventListener("toast:remove", this.handleRemoveToast);
|
|
32
|
+
window.addEventListener("toast:add", this.handleAddToast), window.addEventListener("toast:remove", this.handleRemoveToast), window.addEventListener("ds-toast:action-click", this.handleActionClick);
|
|
23
33
|
}
|
|
24
34
|
static getInstance() {
|
|
25
35
|
return n.instance || (n.instance = new n()), n.instance;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as e } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
2
2
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.js";
|
|
3
|
-
import { n } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
3
|
+
import { n as t } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
4
4
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.js";
|
|
5
|
-
import { __decorate as
|
|
6
|
-
import { UiKitElement as
|
|
7
|
-
import { customUiKitElement as
|
|
5
|
+
import { __decorate as n } from "../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.js";
|
|
6
|
+
import { UiKitElement as r } from "../base/UiKitElement.js";
|
|
7
|
+
import { customUiKitElement as i } from "../../decorators/customUiKitElement.js";
|
|
8
8
|
import "../ds-icon/ds-icon.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { e as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
9
|
+
import { uiKitHtml as a } from "../../utils/uiKitHtml.js";
|
|
10
|
+
import { e as o } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
12
11
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.js";
|
|
13
|
-
import { o as
|
|
12
|
+
import { o as s } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.js";
|
|
14
13
|
import "../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/if-defined.js";
|
|
15
14
|
import "../ds-icon-button/ds-icon-button.js";
|
|
16
|
-
import { n as
|
|
17
|
-
import
|
|
15
|
+
import { n as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.js";
|
|
16
|
+
import "../ds-link-button/ds-link-button.js";
|
|
17
|
+
import { toastMessageStyles as l } from "./styles/common.styles.js";
|
|
18
18
|
//#region src/components/ds-toast-message/ds-toast-message.ts
|
|
19
|
-
var
|
|
19
|
+
var u, d = (u = class extends r {
|
|
20
20
|
constructor(...e) {
|
|
21
|
-
super(...e), this.status = "default", this.dataId = "", this.title = "", this.text = ""
|
|
21
|
+
super(...e), this.status = "default", this.dataId = "", this.title = "", this.text = "";
|
|
22
22
|
}
|
|
23
23
|
getIconName() {
|
|
24
24
|
switch (this.status) {
|
|
@@ -37,6 +37,14 @@ var f, p = (f = class extends i {
|
|
|
37
37
|
});
|
|
38
38
|
this.dispatchEvent(e);
|
|
39
39
|
}
|
|
40
|
+
handleClickAction() {
|
|
41
|
+
let e = new CustomEvent("ds-toast:action-click", {
|
|
42
|
+
bubbles: !0,
|
|
43
|
+
composed: !0,
|
|
44
|
+
detail: { id: this.dataId }
|
|
45
|
+
});
|
|
46
|
+
this.dispatchEvent(e);
|
|
47
|
+
}
|
|
40
48
|
get toastMessageClasses() {
|
|
41
49
|
return {
|
|
42
50
|
container: !0,
|
|
@@ -44,10 +52,18 @@ var f, p = (f = class extends i {
|
|
|
44
52
|
};
|
|
45
53
|
}
|
|
46
54
|
get iconTemplate() {
|
|
47
|
-
return
|
|
55
|
+
return a`<ds-icon class="icon" icon-name=${s(this.getIconName())} size="24"></ds-icon>`;
|
|
56
|
+
}
|
|
57
|
+
get headerTemplate() {
|
|
58
|
+
return c(this.title || this.text, () => e`
|
|
59
|
+
<div class="header">
|
|
60
|
+
${c(this.title, () => e`<div class="title">${this.title}</div>`)}
|
|
61
|
+
${c(this.text, () => e`<div class="message">${this.text}</div>`)}
|
|
62
|
+
</div>
|
|
63
|
+
`);
|
|
48
64
|
}
|
|
49
65
|
get closeButtonTemplate() {
|
|
50
|
-
return
|
|
66
|
+
return a`<ds-icon-button
|
|
51
67
|
data-aria-label="close-button"
|
|
52
68
|
@click=${this.handleClickCloseButton}
|
|
53
69
|
icon-name="cross"
|
|
@@ -55,30 +71,41 @@ var f, p = (f = class extends i {
|
|
|
55
71
|
size="medium"
|
|
56
72
|
></ds-icon-button>`;
|
|
57
73
|
}
|
|
74
|
+
get actionTemplate() {
|
|
75
|
+
var e;
|
|
76
|
+
return c((e = this.action) == null ? void 0 : e.text, () => a`<ds-link-button
|
|
77
|
+
html-tag-name="button"
|
|
78
|
+
underline
|
|
79
|
+
icon-name="none"
|
|
80
|
+
@click=${this.handleClickAction}
|
|
81
|
+
>${this.action.text}</ds-link-button
|
|
82
|
+
>`);
|
|
83
|
+
}
|
|
58
84
|
render() {
|
|
59
|
-
return
|
|
60
|
-
<div class=${
|
|
85
|
+
return e`
|
|
86
|
+
<div class=${o(this.toastMessageClasses)}>
|
|
61
87
|
${this.iconTemplate}
|
|
62
88
|
<div class="content">
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
${u(this.text, () => t`<div class="message">${this.text}</div>`)}
|
|
66
|
-
</div>
|
|
67
|
-
<slot></slot>
|
|
89
|
+
${this.headerTemplate}
|
|
90
|
+
${this.actionTemplate}
|
|
68
91
|
</div>
|
|
69
92
|
${this.closeButtonTemplate}
|
|
70
93
|
</div>
|
|
71
94
|
`;
|
|
72
95
|
}
|
|
73
|
-
},
|
|
74
|
-
|
|
96
|
+
}, u.styles = [l], u);
|
|
97
|
+
n([t({
|
|
98
|
+
type: String,
|
|
99
|
+
reflect: !0
|
|
100
|
+
})], d.prototype, "status", void 0), n([t({
|
|
75
101
|
type: String,
|
|
76
102
|
attribute: "data-id",
|
|
77
103
|
reflect: !0
|
|
78
|
-
})],
|
|
79
|
-
type:
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
})], d.prototype, "dataId", void 0), n([t({
|
|
105
|
+
type: String,
|
|
106
|
+
reflect: !0
|
|
107
|
+
})], d.prototype, "title", void 0), n([t({
|
|
108
|
+
type: String,
|
|
82
109
|
reflect: !0
|
|
83
|
-
})],
|
|
110
|
+
})], d.prototype, "text", void 0), n([t({ attribute: !1 })], d.prototype, "action", void 0), d = n([i("ds-toast-message")], d);
|
|
84
111
|
//#endregion
|
|
@@ -10,7 +10,7 @@ function e(e, t) {
|
|
|
10
10
|
Array.isArray(t == null ? void 0 : t.extendComponentNames) && (c = [...t.extendComponentNames, ...c]), (i = globalThis) == null || (i = i.customElements) == null || (a = i.define) == null || a.call(i, s, (o = class extends n {
|
|
11
11
|
connectedCallback() {
|
|
12
12
|
var t;
|
|
13
|
-
(t = n.prototype.connectedCallback) == null || t.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.
|
|
13
|
+
(t = n.prototype.connectedCallback) == null || t.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.208"), this.setAttribute("data-ui-kit-component-name", e);
|
|
14
14
|
}
|
|
15
15
|
}, o.componentName = c, o));
|
|
16
16
|
};
|
|
@@ -26,7 +26,7 @@ var n = class {
|
|
|
26
26
|
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
27
27
|
}), t.subscribe("theme", this.handleChangeTheme);
|
|
28
28
|
}
|
|
29
|
-
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
29
|
+
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.208"), i = globalThis, a = i[r];
|
|
30
30
|
a || (a = new n(), Object.defineProperty(i, r, {
|
|
31
31
|
value: a,
|
|
32
32
|
writable: !1,
|
package/dist/esm/utils/PubSub.js
CHANGED
|
@@ -18,7 +18,7 @@ var e = class {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
21
|
+
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.208"), n = globalThis, r = n[t];
|
|
22
22
|
r || (r = new e(), Object.defineProperty(n, t, {
|
|
23
23
|
value: r,
|
|
24
24
|
writable: !1,
|
|
@@ -4,7 +4,7 @@ var t = e(20), n = class e {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
this.stylePromises = /* @__PURE__ */ new Map(), this.getStyles = async ({ componentName: e, theme: n }) => {
|
|
6
6
|
if (!n || !e) return;
|
|
7
|
-
let r = `https://ds-assets.cupra.com/2.0.0-canary.
|
|
7
|
+
let r = `https://ds-assets.cupra.com/2.0.0-canary.208/styles/${n}/components/${e}.css`, i = this.getCachedStyleSheetPromise({ url: r });
|
|
8
8
|
if (i) return i;
|
|
9
9
|
let a = t(() => this.fetchStyle({ url: r })).then((e) => (e || this.stylePromises.delete(r), e));
|
|
10
10
|
return this.stylePromises.set(r, a), this.stylePromises.get(r);
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { Toast, ToastManagerSubscriber, ToastOptions } from '../ds-toast.types';
|
|
2
2
|
type AddEvent = CustomEvent<ToastOptions>;
|
|
3
|
-
type RemoveEvent = CustomEvent<
|
|
3
|
+
type RemoveEvent = CustomEvent<Pick<ToastOptions, 'id'>>;
|
|
4
|
+
type ActionClickEvent = CustomEvent<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
type ActionEvent = CustomEvent<{
|
|
8
|
+
toastId: string;
|
|
9
|
+
}>;
|
|
4
10
|
declare global {
|
|
5
11
|
interface WindowEventMap {
|
|
6
12
|
'toast:add': AddEvent;
|
|
7
13
|
'toast:remove': RemoveEvent;
|
|
14
|
+
'ds-toast:action-click': ActionClickEvent;
|
|
15
|
+
'ds-toast:action': ActionEvent;
|
|
8
16
|
}
|
|
9
17
|
}
|
|
10
18
|
export declare const generateId: () => string;
|
|
@@ -18,6 +26,7 @@ declare class ToastManager {
|
|
|
18
26
|
static getInstance(): ToastManager;
|
|
19
27
|
private handleAddToast;
|
|
20
28
|
private handleRemoveToast;
|
|
29
|
+
private handleActionClick;
|
|
21
30
|
removeToast(id: string): void;
|
|
22
31
|
getToasts(): Toast[];
|
|
23
32
|
subscribe(subscriber: ToastManagerSubscriber): () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UiKitElement } from '../base/UiKitElement.ts';
|
|
2
2
|
import '../ds-icon-button/ds-icon-button.ts';
|
|
3
3
|
import '../ds-icon/ds-icon.ts';
|
|
4
|
-
import
|
|
4
|
+
import '../ds-link-button/ds-link-button.ts';
|
|
5
5
|
import type { DsToastMessageAttrs } from './ds-toast-message.types.ts';
|
|
6
6
|
export declare class DsToastMessage extends UiKitElement {
|
|
7
7
|
static styles: import("lit").CSSResult[];
|
|
@@ -9,14 +9,17 @@ export declare class DsToastMessage extends UiKitElement {
|
|
|
9
9
|
dataId: DsToastMessageAttrs['data-id'];
|
|
10
10
|
title: DsToastMessageAttrs['title'];
|
|
11
11
|
text: DsToastMessageAttrs['text'];
|
|
12
|
-
|
|
12
|
+
action: DsToastMessageAttrs['action'];
|
|
13
13
|
private getIconName;
|
|
14
14
|
private handleClickCloseButton;
|
|
15
|
+
private handleClickAction;
|
|
15
16
|
protected get toastMessageClasses(): {
|
|
16
17
|
[x: string]: boolean;
|
|
17
18
|
container: boolean;
|
|
18
19
|
};
|
|
19
20
|
protected get iconTemplate(): import("lit").HTMLTemplateResult;
|
|
21
|
+
protected get headerTemplate(): import("lit").TemplateResult<1>;
|
|
20
22
|
protected get closeButtonTemplate(): import("lit").HTMLTemplateResult;
|
|
21
|
-
|
|
23
|
+
protected get actionTemplate(): import("lit").HTMLTemplateResult;
|
|
24
|
+
render(): import("lit").TemplateResult<1>;
|
|
22
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const e=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/decorators/provide.cjs"),t=require("./themeContext.cjs");require("../../core/theme.constants.cjs");const n=require("../../utils/PubSub.cjs"),r=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs"),i=require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs");const s=require("../../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.cjs"),c=require("../../decorators/customUiKitElement.cjs"),l=require("../../utils/booleanConverter.cjs"),u=require("../../styles/source/shared/fonts-config.cjs");var d=class extends i.i{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.loadUnusedStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){if(super.updated(e),e.has(`theme`)){var t,r;n.pubSub.publish(`theme`,this.theme),(t=sessionStorage)==null||t.setItem(`@cupra/ui-kit/theme`,this.theme),typeof FontFace<`u`&&(r=document)!=null&&r.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))})}}loadThemeFonts(){var e;(e=u.fontsConfig[this.theme])==null||e.fonts.forEach(e=>{this.loadThemeFont(e)})}async loadThemeFont({weight:e,name:t,file:n}){if(!this.loadFonts)return Promise.resolve();let r=`${t}-${e}`;if(this.loadedFonts.has(r))return;let i=new FontFace(t,`url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff2') format('woff2'),
|
|
2
2
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff') format('woff'),
|
|
3
3
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.ttf') format('truetype'),
|
|
4
|
-
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.208`;return this.loadUnusedStyles&&this.applyUnusedStyles(e),this.loadStyles?new Promise((t,n)=>{let r=`https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))t();else{let i=`ui-kit-theme-${e}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>t(),o.onerror=()=>n(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a==null||a.remove()}}):Promise.resolve()}applyUnusedStyles(e){let t=`https://ds-assets.cupra.com${e}/styles/${this.theme}/unused-styles.css`;if(document.head.querySelector(`link[href="${t}"]`))return;let n=`ui-kit-unused-styles-${e}`,r=document.getElementById(n),i=document.createElement(`link`);i.id=n,i.rel=`preload`,i.as=`style`,i.href=t,i.onload=()=>{i.rel=`stylesheet`},document.head.appendChild(i),r==null||r.remove()}render(){return this.cssLoaded?r.x`<slot></slot>`:r.E}};s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-fonts`})],d.prototype,`loadFonts`,void 0),s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-styles`})],d.prototype,`loadStyles`,void 0),s.__decorate([a.n({type:Boolean,converter:l.booleanConverter,attribute:`load-unused-styles`})],d.prototype,`loadUnusedStyles`,void 0),s.__decorate([e.e({context:t.themeContext}),a.n({type:String})],d.prototype,`theme`,void 0),s.__decorate([o.r()],d.prototype,`cssLoaded`,void 0),s.__decorate([o.r()],d.prototype,`loadedFonts`,void 0),d=s.__decorate([c.customUiKitElement(`ds-theme-provider`)],d);
|