@cupra/ui-kit 2.0.0-canary.85 → 2.0.0-canary.87
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-checkbox/ds-checkbox.cjs +2 -2
- package/dist/cjs/components/ds-dialog/ds-dialog.cjs +14 -21
- package/dist/cjs/components/ds-dialog/styles/common.styles.cjs +11 -21
- package/dist/cjs/components/ds-theme-provider/ds-theme-provider.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/cssWithTokens.cjs +1 -1
- package/dist/cjs/utils/htmlWithTokens.cjs +1 -1
- package/dist/esm/components/ds-checkbox/ds-checkbox.js +63 -54
- package/dist/esm/components/ds-dialog/ds-dialog.js +88 -87
- package/dist/esm/components/ds-dialog/styles/common.styles.js +12 -22
- package/dist/esm/components/ds-theme-provider/ds-theme-provider.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/cssWithTokens.js +1 -1
- package/dist/esm/utils/htmlWithTokens.js +1 -1
- package/dist/types/components/ds-checkbox/ds-checkbox.d.ts +3 -0
- package/dist/types/components/ds-dialog/ds-dialog.d.ts +7 -4
- package/dist/types/components/ds-theme-provider/themeContext.d.ts +1 -1
- package/dist-react/cjs/components/ds-checkbox/ds-checkbox.cjs +2 -2
- package/dist-react/cjs/components/ds-dialog/ds-dialog.cjs +14 -21
- package/dist-react/cjs/components/ds-dialog/styles/common.styles.cjs +11 -21
- package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.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/cssWithTokens.cjs +1 -1
- package/dist-react/cjs/utils/htmlWithTokens.cjs +1 -1
- package/dist-react/esm/components/ds-checkbox/ds-checkbox.js +63 -54
- package/dist-react/esm/components/ds-dialog/ds-dialog.js +88 -87
- package/dist-react/esm/components/ds-dialog/styles/common.styles.js +12 -22
- package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.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/cssWithTokens.js +1 -1
- package/dist-react/esm/utils/htmlWithTokens.js +1 -1
- package/dist-react/types/components/ds-checkbox/ds-checkbox.d.ts +3 -0
- package/dist-react/types/components/ds-dialog/ds-dialog.d.ts +7 -4
- package/dist-react/types/components/ds-theme-provider/themeContext.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),l=require("../ds-checkbox-group/ds-checkbox-group.cjs"),b=require("../../decorators/customUiKitElement.cjs"),x=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/controllers/context-consumer.cjs"),m=require("../../mixins/FormAssociatedMixin.cjs"),c=require("../../utils/booleanConverter.cjs"),y=require("../../utils/htmlWithTokens.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),d=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),k=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),v=require("./styles/common.styles.cjs");var C=Object.defineProperty,f=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),l=require("../ds-checkbox-group/ds-checkbox-group.cjs"),b=require("../../decorators/customUiKitElement.cjs"),x=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/controllers/context-consumer.cjs"),m=require("../../mixins/FormAssociatedMixin.cjs"),c=require("../../utils/booleanConverter.cjs"),y=require("../../utils/htmlWithTokens.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),d=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),k=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),v=require("./styles/common.styles.cjs");var C=Object.defineProperty,f=Object.getOwnPropertyDescriptor,t=(h,e,s,n)=>{for(var i=n>1?void 0:n?f(e,s):e,a=h.length-1,p;a>=0;a--)(p=h[a])&&(i=(n?p(e,s,i):p(i))||i);return n&&i&&C(e,s,i),i};exports.DsCheckbox=class extends m.FormAssociatedMixin(u.UiKitElement){constructor(){super(...arguments),this.inputPlacement="left",this.checked=!1,this.required=!1,this._disabled=!1,this.mode="light",this._size="medium",this.helperText="",this.infoText="",this._forcedError="",this.invalidError="",this.indeterminate=!1}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.createContextConsumers([{context:l.checkboxGroupDisabledContext,callback:e=>{this.disabledGroup=e}},{context:l.checkboxGroupErrorContext,callback:e=>{this.errorGroup=e}},{context:l.checkboxGroupSizeContext,callback:e=>{this.sizeGroup=e}}])})}createContextConsumers(e){e.forEach(({context:s,callback:n})=>{new x.ContextConsumer(this,{context:s,callback:n,subscribe:!0})})}get disabled(){return this.disabledGroup??this._disabled}set disabled(e){this._disabled=e}get size(){return this.sizeGroup||this._size}set size(e){this._size=e}get forcedError(){return this._forcedError}set forcedError(e){this._forcedError=e}get error(){return this.errorGroup??!!this._forcedError}handleChange(e){const s=e.target;this.checked=s.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.value}}))}get classes(){return{container:!0,[this.inputPlacement]:!!this.inputPlacement,[this.mode]:!!this.mode,[this.size]:!!this.size,disabled:this.disabled,checked:this.checked,error:this.error}}get iconTemplate(){if(!this.checked)return o.nothing;const e=this.indeterminate?"minus":"check";return this.componentFactory.createIcon({class:"icon","icon-name":e})}get styleTokens(){return y.htmlWithTokens`
|
|
2
2
|
<style>
|
|
3
3
|
:host{
|
|
4
4
|
color-scheme: ${this.mode};
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
</label>
|
|
37
37
|
</div>
|
|
38
|
-
`}};exports.DsCheckbox.styles=[v.commonStyles];
|
|
38
|
+
`}};exports.DsCheckbox.styles=[v.commonStyles];t([r.property({type:String})],exports.DsCheckbox.prototype,"name",2);t([r.property({type:String})],exports.DsCheckbox.prototype,"value",2);t([r.property({type:String,attribute:"input-placement"})],exports.DsCheckbox.prototype,"inputPlacement",2);t([r.property({type:Boolean,converter:c.booleanConverter,reflect:!0})],exports.DsCheckbox.prototype,"checked",2);t([r.property({type:Boolean,converter:c.booleanConverter})],exports.DsCheckbox.prototype,"required",2);t([r.property({type:Boolean,converter:c.booleanConverter,attribute:"disabled"})],exports.DsCheckbox.prototype,"_disabled",2);t([r.property({type:String,reflect:!0})],exports.DsCheckbox.prototype,"mode",2);t([r.property({type:String,attribute:"size"})],exports.DsCheckbox.prototype,"_size",2);t([r.property({type:String,attribute:"helper-text"})],exports.DsCheckbox.prototype,"helperText",2);t([r.property({type:String,attribute:"info-text"})],exports.DsCheckbox.prototype,"infoText",2);t([r.property({type:String,attribute:"forced-error"})],exports.DsCheckbox.prototype,"_forcedError",2);t([r.property({type:String,attribute:"invalid-error"})],exports.DsCheckbox.prototype,"invalidError",2);t([r.property({type:Boolean,converter:c.booleanConverter})],exports.DsCheckbox.prototype,"indeterminate",2);t([d.state()],exports.DsCheckbox.prototype,"disabledGroup",2);t([d.state()],exports.DsCheckbox.prototype,"errorGroup",2);t([d.state()],exports.DsCheckbox.prototype,"sizeGroup",2);exports.DsCheckbox=t([b.customUiKitElement("ds-checkbox")],exports.DsCheckbox);
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),v=require("../../decorators/customUiKitElement.cjs"),h=require("../../utils/booleanConverter.cjs"),
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
?
|
|
12
|
-
data-testid="ds-dialog-container"
|
|
13
|
-
class=${d.classMap(this.dialogClasses)}
|
|
14
|
-
aria-modal="true"
|
|
15
|
-
aria-label=${this.dataAriaLabel||i.nothing}
|
|
16
|
-
aria-description=${this.dataAriaDescription||i.nothing}
|
|
17
|
-
>
|
|
18
|
-
${this.lockClose?i.nothing:i.html`<slot name="close-button" @click=${this.handleCloseButtonClick}></slot>`}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../base/UiKitElement.cjs"),v=require("../../decorators/customUiKitElement.cjs"),h=require("../../utils/booleanConverter.cjs"),g=require("../../utils/debounce.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const o=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const l=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),p=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),d=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs"),D=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),b=require("./styles/common.styles.cjs");var C=Object.defineProperty,y=Object.getOwnPropertyDescriptor,s=(n,e,t,a)=>{for(var i=a>1?void 0:a?y(e,t):e,r=n.length-1,c;r>=0;r--)(c=n[r])&&(i=(a?c(e,t,i):c(i))||i);return a&&i&&C(e,t,i),i};exports.DsDialog=class extends u.UiKitElement{constructor(){super(...arguments),this.lockClose=!1,this.lockScroll=!0,this.open=!1,this.size="medium",this.hasBeenOpened=!1,this.hasScroll=!1,this.debouncedCheckScroll=g.debounce({func:()=>this.checkScroll()}),this.handleCloseButtonClick=()=>{this.handleClose("button")},this.handleDialogClick=e=>{e.target===this.nativeDialog&&this.handleClose("backdrop")},this.handleCancel=e=>{e.preventDefault(),this.lockClose||this.handleClose("escape")},this.handleHostClick=e=>{e.stopPropagation()}}async updated(e){super.updated(e),!this.hasBeenOpened&&e.has("open")&&this.open&&(this.hasBeenOpened=!0),e.has("open")&&(this.handleResizeObserver(),this.syncNativeDialogState()),e.has("open")&&this.open&&(await this.updateComplete,this.requestUpdate())}syncNativeDialogState(){this.nativeDialog&&(this.open?this.openNativeDialog():this.closeNativeDialog())}openNativeDialog(){var e,t;this.nativeDialog.open||(t=(e=this.nativeDialog).showModal)==null||t.call(e)}closeNativeDialog(){var e,t;this.nativeDialog.open&&((t=(e=this.nativeDialog).close)==null||t.call(e))}async handleResizeObserver(){var e;(e=this.resizeObserver)==null||e.disconnect(),this.content&&(this.resizeObserver.observe(this.content),await new Promise(requestAnimationFrame),this.checkScroll())}get panelClasses(){return{panel:!0,"with-scroll":this.open&&this.hasScroll,[this.size]:!!this.size}}dispatchCloseEvents(e){const t=`ds-dialog:close-${e}`;this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("ds-dialog:close",{bubbles:!0,composed:!0}))}handleClose(e){this.lockClose||(this.open=!1,this.dispatchCloseEvents(e))}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(this.debouncedCheckScroll),this.handleResizeObserver(),this.addEventListener("click",this.handleHostClick)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),this.removeEventListener("click",this.handleHostClick)}checkScroll(){var e,t;this.hasScroll=((e=this.content)==null?void 0:e.scrollHeight)>((t=this.content)==null?void 0:t.clientHeight)}render(){return!this.hasBeenOpened&&!this.open?o.nothing:o.html`
|
|
2
|
+
<dialog
|
|
3
|
+
class="dialog"
|
|
4
|
+
data-testid="ds-dialog-container"
|
|
5
|
+
aria-label=${this.dataAriaLabel||o.nothing}
|
|
6
|
+
aria-description=${this.dataAriaDescription||o.nothing}
|
|
7
|
+
@cancel=${this.handleCancel}
|
|
8
|
+
@click=${this.handleDialogClick}
|
|
9
|
+
>
|
|
10
|
+
<div class=${D.classMap(this.panelClasses)}>
|
|
11
|
+
${this.lockClose?o.nothing:o.html`<slot name="close-button" @click=${this.handleCloseButtonClick}></slot>`}
|
|
19
12
|
<div class="content-container">
|
|
20
13
|
<div tabindex="0" class="content ds-scroll">
|
|
21
14
|
<slot @slotchange=${this.handleResizeObserver}></slot>
|
|
22
15
|
</div>
|
|
23
16
|
<slot name="footer"></slot>
|
|
24
17
|
</div>
|
|
25
|
-
</
|
|
26
|
-
</
|
|
27
|
-
`}};exports.DsDialog.styles=[
|
|
18
|
+
</div>
|
|
19
|
+
</dialog>
|
|
20
|
+
`}};exports.DsDialog.styles=[b.commonStyles];s([l.property({type:Boolean,converter:h.booleanConverter,attribute:"lock-close"})],exports.DsDialog.prototype,"lockClose",2);s([l.property({type:Boolean,converter:h.booleanConverter,attribute:"lock-scroll"})],exports.DsDialog.prototype,"lockScroll",2);s([l.property({type:Boolean,converter:h.booleanConverter})],exports.DsDialog.prototype,"open",2);s([l.property({type:String})],exports.DsDialog.prototype,"size",2);s([l.property({type:String,attribute:"data-aria-label"})],exports.DsDialog.prototype,"dataAriaLabel",2);s([l.property({type:String,attribute:"data-aria-description"})],exports.DsDialog.prototype,"dataAriaDescription",2);s([p.state()],exports.DsDialog.prototype,"hasBeenOpened",2);s([p.state()],exports.DsDialog.prototype,"hasScroll",2);s([d.query(".content")],exports.DsDialog.prototype,"content",2);s([d.query("dialog")],exports.DsDialog.prototype,"nativeDialog",2);exports.DsDialog=s([v.customUiKitElement("ds-dialog")],exports.DsDialog);
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../utils/cssQueries.cjs");require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");require("../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const e=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../utils/cssQueries.cjs");require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");require("../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const e=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),r=e.css`
|
|
2
2
|
:host {
|
|
3
|
-
|
|
3
|
+
display: contents;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
position: fixed;
|
|
13
|
-
top: 0;
|
|
14
|
-
left: 0;
|
|
6
|
+
.dialog[open] {
|
|
7
|
+
max-width: none;
|
|
8
|
+
max-height: none;
|
|
9
|
+
border: none;
|
|
10
|
+
background: transparent;
|
|
11
|
+
overflow: visible;
|
|
15
12
|
width: 100dvw;
|
|
16
13
|
height: 100dvh;
|
|
14
|
+
box-sizing: border-box;
|
|
17
15
|
display: flex;
|
|
18
16
|
justify-content: center;
|
|
19
17
|
align-items: center;
|
|
20
|
-
z-index: var(--ds-z-index-modal);
|
|
21
|
-
transition:
|
|
22
|
-
opacity 0.3s cubic-bezier(0, 0, 0.2, 1),
|
|
23
|
-
display 0.3s cubic-bezier(0, 0, 0.2, 1) allow-discrete;
|
|
24
|
-
opacity: 1;
|
|
25
|
-
@starting-style {
|
|
26
|
-
opacity: 0;
|
|
27
|
-
}
|
|
28
18
|
}
|
|
29
19
|
|
|
30
|
-
.
|
|
20
|
+
.panel {
|
|
31
21
|
padding: 0;
|
|
32
22
|
position: relative;
|
|
33
23
|
}
|
|
@@ -69,4 +59,4 @@
|
|
|
69
59
|
width: 8px;
|
|
70
60
|
}
|
|
71
61
|
}
|
|
72
|
-
`;exports.commonStyles=
|
|
62
|
+
`;exports.commonStyles=r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../core/theme.constants.cjs"),p=require("../../decorators/customUiKitElement.cjs"),f=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/decorators/provide.cjs"),y=require("../../utils/PubSub.cjs"),m=require("../../utils/booleanConverter.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const l=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs"),v=require("../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs"),h=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),u=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),$=require("../../styles/source/shared/fonts-config.cjs"),T=require("./themeContext.cjs");var b=Object.defineProperty,P=Object.getOwnPropertyDescriptor,d=(a,e,s,o)=>{for(var t=o>1?void 0:o?P(e,s):e,r=a.length-1,n;r>=0;r--)(n=a[r])&&(t=(o?n(e,s,t):n(t))||t);return o&&t&&b(e,s,t),t};exports.DsThemeProvider=class extends v.LitElement{constructor(){super(...arguments),this.loadFonts=!0,this.loadStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){super.updated(e),e.has("theme")&&(y.pubSub.publish("theme",this.theme),sessionStorage==null||sessionStorage.setItem(c.THEME_STORAGE_KEY,this.theme),typeof FontFace<"u"&&(document!=null&&document.fonts)&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent("ui-kit:ready",{bubbles:!0,composed:!0}))}))}loadThemeFonts(){var e;(e=$.fontsConfig[this.theme])==null||e.fonts.forEach(s=>{this.loadThemeFont(s)})}async loadThemeFont({weight:e,name:s,file:o}){if(!this.loadFonts)return Promise.resolve();const t=`${s}-${e}`;if(this.loadedFonts.has(t))return;const r=new FontFace(s,`url('https://ds-assets.cupra.com/fonts/${this.theme}/${o}.woff2') format('woff2'),
|
|
2
2
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${o}.woff') format('woff'),
|
|
3
3
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${o}.ttf') format('truetype'),
|
|
4
|
-
url('https://ds-assets.cupra.com/fonts/${this.theme}/${o}.otf') format('opentype')`,{style:"normal",weight:e,display:"swap"});try{await r.load(),document.fonts.add(r),this.loadedFonts.add(t)}catch(n){console.error(`Error loading "${s}" font with "${e}" weight:`,n)}}loadThemeStyles(){return this.loadStyles?new Promise((e,s)=>{const o="/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${o}.otf') format('opentype')`,{style:"normal",weight:e,display:"swap"});try{await r.load(),document.fonts.add(r),this.loadedFonts.add(t)}catch(n){console.error(`Error loading "${s}" font with "${e}" weight:`,n)}}loadThemeStyles(){return this.loadStyles?new Promise((e,s)=>{const o="/2.0.0-canary.87",t=`https://ds-assets.cupra.com${o}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${t}"]`))e();else{const r=`ui-kit-theme-${o}`,n=document.getElementById(r),i=document.createElement("link");i.id=r,i.rel="stylesheet",i.href=t,i.onload=()=>e(),i.onerror=()=>s(new Error(`Failed to load theme CSS: ${t}`)),document.head.appendChild(i),n==null||n.remove()}}):Promise.resolve()}render(){return this.cssLoaded?l.html`<slot></slot>`:l.nothing}};d([h.property({type:Boolean,converter:m.booleanConverter,attribute:"load-fonts"})],exports.DsThemeProvider.prototype,"loadFonts",2);d([h.property({type:Boolean,converter:m.booleanConverter,attribute:"load-styles"})],exports.DsThemeProvider.prototype,"loadStyles",2);d([f.provide({context:T.themeContext}),h.property({type:String})],exports.DsThemeProvider.prototype,"theme",2);d([u.state()],exports.DsThemeProvider.prototype,"cssLoaded",2);d([u.state()],exports.DsThemeProvider.prototype,"loadedFonts",2);exports.DsThemeProvider=d([p.customUiKitElement("ds-theme-provider")],exports.DsThemeProvider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../core/theme.constants.cjs"),l=require("./PubSub.cjs");class u{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;const n=Object.keys(this.icons);this.icons={},n.forEach(s=>this.fetchIcon(s))},this.fetchIcon=async(e,n={})=>{const s=typeof sessionStorage<"u"?sessionStorage==null?void 0:sessionStorage.getItem(r.THEME_STORAGE_KEY):null;!this.theme&&s&&(this.theme=s);const t=this.icons[e];if(t)return await t;const i=this.loadIcon(e,n).catch(a=>{throw delete this.icons[e],a});return this.icons[e]=i,i},this.loadIcon=(e,{cache:n="force-cache",...s})=>!this.theme||typeof fetch>"u"?Promise.resolve('<svg class="ds-icon"></svg>'):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:n,...s}).then(t=>t.text()).catch(t=>{if((t==null?void 0:t.name)==="AbortError")throw t;return console.error(`Failed to fetch icon "${e}":`,t),""}),l.pubSub.subscribe("theme",this.handleChangeTheme)}}const o=Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../core/theme.constants.cjs"),l=require("./PubSub.cjs");class u{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;const n=Object.keys(this.icons);this.icons={},n.forEach(s=>this.fetchIcon(s))},this.fetchIcon=async(e,n={})=>{const s=typeof sessionStorage<"u"?sessionStorage==null?void 0:sessionStorage.getItem(r.THEME_STORAGE_KEY):null;!this.theme&&s&&(this.theme=s);const t=this.icons[e];if(t)return await t;const i=this.loadIcon(e,n).catch(a=>{throw delete this.icons[e],a});return this.icons[e]=i,i},this.loadIcon=(e,{cache:n="force-cache",...s})=>!this.theme||typeof fetch>"u"?Promise.resolve('<svg class="ds-icon"></svg>'):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:n,...s}).then(t=>t.text()).catch(t=>{if((t==null?void 0:t.name)==="AbortError")throw t;return console.error(`Failed to fetch icon "${e}":`,t),""}),l.pubSub.subscribe("theme",this.handleChangeTheme)}}const o=Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.87"),h=globalThis;let c=h[o];c||(c=new u,Object.defineProperty(h,o,{value:c,writable:!1,configurable:!1,enumerable:!1}));const f=c;exports.iconsManager=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class u{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(s,r){return this.subscribers[s]||(this.subscribers[s]=[]),this.subscribers[s].push(r),this.lastPublishedData[s]}unsubscribe(s,r){this.subscribers[s]&&(this.subscribers[s]=this.subscribers[s].filter(i=>i!==r))}publish(s,r){this.lastPublishedData[s]=r,this.subscribers[s]&&this.subscribers[s].forEach(i=>{try{i(r)}catch(c){console.error(`Error in subscriber for event "${s}":`,c)}})}}const t=Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class u{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(s,r){return this.subscribers[s]||(this.subscribers[s]=[]),this.subscribers[s].push(r),this.lastPublishedData[s]}unsubscribe(s,r){this.subscribers[s]&&(this.subscribers[s]=this.subscribers[s].filter(i=>i!==r))}publish(s,r){this.lastPublishedData[s]=r,this.subscribers[s]&&this.subscribers[s].forEach(i=>{try{i(r)}catch(c){console.error(`Error in subscriber for event "${s}":`,c)}})}}const t=Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.87"),e=globalThis;let b=e[t];b||(b=new u,Object.defineProperty(e,t,{value:b,writable:!1,configurable:!1,enumerable:!1}));const l=b;exports.PubSub=u;exports.pubSub=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../concurrencyLimit.cjs"),a=o.concurrencyLimit(20);class s{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:e,theme:t})=>{if(!t||!e)return;const c=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../concurrencyLimit.cjs"),a=o.concurrencyLimit(20);class s{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:e,theme:t})=>{if(!t||!e)return;const c=`https://ds-assets.cupra.com/2.0.0-canary.87/styles/${t}/components/${e}.css`,r=this.getCachedStyleSheetPromise({url:c});if(r)return r;const i=a(()=>this.fetchStyle({url:c})).then(n=>(n||this.stylePromises.delete(c),n));return this.stylePromises.set(c,i),this.stylePromises.get(c)}}async fetchStyle({url:e}){try{if(typeof fetch>"u")return;const 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 s.instance||(s.instance=new s),s.instance}}const h=s.getInstance();exports.stylesRegistry=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const e=require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs");function i(r,...t){const s=String.raw({raw:r},...t).replace(/(--private-[\w-]+)(?=\s*[):,])/g,"$1-v2-0-0-canary-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const e=require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs");function i(r,...t){const s=String.raw({raw:r},...t).replace(/(--private-[\w-]+)(?=\s*[):,])/g,"$1-v2-0-0-canary-87"),n=e.unsafeCSS(s);return e.css`${n}`}exports.cssWithTokens=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const i=require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const o=require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.cjs");function a(e,...t){const r=String.raw({raw:e},...t).replace(/(--private-[\w-]+)(?=\s*[):,])/g,"$1-v2-0-0-canary-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const i=require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs");require("../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs");const o=require("../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.cjs");function a(e,...t){const r=String.raw({raw:e},...t).replace(/(--private-[\w-]+)(?=\s*[):,])/g,"$1-v2-0-0-canary-87"),n=o.unsafeHTML(r);return i.html`${n}`}exports.htmlWithTokens=a;
|
|
@@ -11,13 +11,13 @@ import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-
|
|
|
11
11
|
import { property as i } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
12
12
|
import { state as m } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
13
13
|
import { classMap as E } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
14
|
-
import { commonStyles as
|
|
15
|
-
var
|
|
16
|
-
for (var s = p > 1 ? void 0 : p ?
|
|
17
|
-
(d =
|
|
18
|
-
return p && s &&
|
|
14
|
+
import { commonStyles as _ } from "./styles/common.styles.js";
|
|
15
|
+
var $ = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (e, o, n, p) => {
|
|
16
|
+
for (var s = p > 1 ? void 0 : p ? C(o, n) : o, l = e.length - 1, d; l >= 0; l--)
|
|
17
|
+
(d = e[l]) && (s = (p ? d(o, n, s) : d(s)) || s);
|
|
18
|
+
return p && s && $(o, n, s), s;
|
|
19
19
|
};
|
|
20
|
-
let
|
|
20
|
+
let t = class extends k(u) {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments), this.inputPlacement = "left", this.checked = !1, this.required = !1, this._disabled = !1, this.mode = "light", this._size = "medium", this.helperText = "", this.infoText = "", this._forcedError = "", this.invalidError = "", this.indeterminate = !1;
|
|
23
23
|
}
|
|
@@ -26,28 +26,28 @@ let e = class extends k(u) {
|
|
|
26
26
|
this.createContextConsumers([
|
|
27
27
|
{
|
|
28
28
|
context: b,
|
|
29
|
-
callback: (
|
|
30
|
-
this.disabledGroup =
|
|
29
|
+
callback: (e) => {
|
|
30
|
+
this.disabledGroup = e;
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
context: f,
|
|
35
|
-
callback: (
|
|
36
|
-
this.errorGroup =
|
|
35
|
+
callback: (e) => {
|
|
36
|
+
this.errorGroup = e;
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
context: v,
|
|
41
|
-
callback: (
|
|
42
|
-
this.sizeGroup =
|
|
41
|
+
callback: (e) => {
|
|
42
|
+
this.sizeGroup = e;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
]);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
createContextConsumers(
|
|
50
|
-
|
|
49
|
+
createContextConsumers(e) {
|
|
50
|
+
e.forEach(({ context: o, callback: n }) => {
|
|
51
51
|
new x(this, {
|
|
52
52
|
context: o,
|
|
53
53
|
callback: n,
|
|
@@ -58,17 +58,26 @@ let e = class extends k(u) {
|
|
|
58
58
|
get disabled() {
|
|
59
59
|
return this.disabledGroup ?? this._disabled;
|
|
60
60
|
}
|
|
61
|
+
set disabled(e) {
|
|
62
|
+
this._disabled = e;
|
|
63
|
+
}
|
|
61
64
|
get size() {
|
|
62
65
|
return this.sizeGroup || this._size;
|
|
63
66
|
}
|
|
67
|
+
set size(e) {
|
|
68
|
+
this._size = e;
|
|
69
|
+
}
|
|
64
70
|
get forcedError() {
|
|
65
71
|
return this._forcedError;
|
|
66
72
|
}
|
|
73
|
+
set forcedError(e) {
|
|
74
|
+
this._forcedError = e;
|
|
75
|
+
}
|
|
67
76
|
get error() {
|
|
68
77
|
return this.errorGroup ?? !!this._forcedError;
|
|
69
78
|
}
|
|
70
|
-
handleChange(
|
|
71
|
-
const o =
|
|
79
|
+
handleChange(e) {
|
|
80
|
+
const o = e.target;
|
|
72
81
|
this.checked = o.checked, this.dispatchEvent(
|
|
73
82
|
new CustomEvent("change", {
|
|
74
83
|
bubbles: !0,
|
|
@@ -93,10 +102,10 @@ let e = class extends k(u) {
|
|
|
93
102
|
}
|
|
94
103
|
get iconTemplate() {
|
|
95
104
|
if (!this.checked) return c;
|
|
96
|
-
const
|
|
105
|
+
const e = this.indeterminate ? "minus" : "check";
|
|
97
106
|
return this.componentFactory.createIcon({
|
|
98
107
|
class: "icon",
|
|
99
|
-
"icon-name":
|
|
108
|
+
"icon-name": e
|
|
100
109
|
});
|
|
101
110
|
}
|
|
102
111
|
get styleTokens() {
|
|
@@ -143,58 +152,58 @@ let e = class extends k(u) {
|
|
|
143
152
|
`;
|
|
144
153
|
}
|
|
145
154
|
};
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
t.styles = [_];
|
|
156
|
+
r([
|
|
148
157
|
i({ type: String })
|
|
149
|
-
],
|
|
150
|
-
|
|
158
|
+
], t.prototype, "name", 2);
|
|
159
|
+
r([
|
|
151
160
|
i({ type: String })
|
|
152
|
-
],
|
|
153
|
-
|
|
161
|
+
], t.prototype, "value", 2);
|
|
162
|
+
r([
|
|
154
163
|
i({ type: String, attribute: "input-placement" })
|
|
155
|
-
],
|
|
156
|
-
|
|
164
|
+
], t.prototype, "inputPlacement", 2);
|
|
165
|
+
r([
|
|
157
166
|
i({ type: Boolean, converter: h, reflect: !0 })
|
|
158
|
-
],
|
|
159
|
-
|
|
167
|
+
], t.prototype, "checked", 2);
|
|
168
|
+
r([
|
|
160
169
|
i({ type: Boolean, converter: h })
|
|
161
|
-
],
|
|
162
|
-
|
|
170
|
+
], t.prototype, "required", 2);
|
|
171
|
+
r([
|
|
163
172
|
i({ type: Boolean, converter: h, attribute: "disabled" })
|
|
164
|
-
],
|
|
165
|
-
|
|
173
|
+
], t.prototype, "_disabled", 2);
|
|
174
|
+
r([
|
|
166
175
|
i({ type: String, reflect: !0 })
|
|
167
|
-
],
|
|
168
|
-
|
|
176
|
+
], t.prototype, "mode", 2);
|
|
177
|
+
r([
|
|
169
178
|
i({ type: String, attribute: "size" })
|
|
170
|
-
],
|
|
171
|
-
|
|
179
|
+
], t.prototype, "_size", 2);
|
|
180
|
+
r([
|
|
172
181
|
i({ type: String, attribute: "helper-text" })
|
|
173
|
-
],
|
|
174
|
-
|
|
182
|
+
], t.prototype, "helperText", 2);
|
|
183
|
+
r([
|
|
175
184
|
i({ type: String, attribute: "info-text" })
|
|
176
|
-
],
|
|
177
|
-
|
|
185
|
+
], t.prototype, "infoText", 2);
|
|
186
|
+
r([
|
|
178
187
|
i({ type: String, attribute: "forced-error" })
|
|
179
|
-
],
|
|
180
|
-
|
|
188
|
+
], t.prototype, "_forcedError", 2);
|
|
189
|
+
r([
|
|
181
190
|
i({ type: String, attribute: "invalid-error" })
|
|
182
|
-
],
|
|
183
|
-
|
|
191
|
+
], t.prototype, "invalidError", 2);
|
|
192
|
+
r([
|
|
184
193
|
i({ type: Boolean, converter: h })
|
|
185
|
-
],
|
|
186
|
-
|
|
194
|
+
], t.prototype, "indeterminate", 2);
|
|
195
|
+
r([
|
|
187
196
|
m()
|
|
188
|
-
],
|
|
189
|
-
|
|
197
|
+
], t.prototype, "disabledGroup", 2);
|
|
198
|
+
r([
|
|
190
199
|
m()
|
|
191
|
-
],
|
|
192
|
-
|
|
200
|
+
], t.prototype, "errorGroup", 2);
|
|
201
|
+
r([
|
|
193
202
|
m()
|
|
194
|
-
],
|
|
195
|
-
|
|
203
|
+
], t.prototype, "sizeGroup", 2);
|
|
204
|
+
t = r([
|
|
196
205
|
y("ds-checkbox")
|
|
197
|
-
],
|
|
206
|
+
], t);
|
|
198
207
|
export {
|
|
199
|
-
|
|
208
|
+
t as DsCheckbox
|
|
200
209
|
};
|
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
import { UiKitElement as
|
|
1
|
+
import { UiKitElement as m } from "../base/UiKitElement.js";
|
|
2
2
|
import { customUiKitElement as b } from "../../decorators/customUiKitElement.js";
|
|
3
|
-
import { booleanConverter as
|
|
4
|
-
import { debounce as
|
|
3
|
+
import { booleanConverter as p } from "../../utils/booleanConverter.js";
|
|
4
|
+
import { debounce as f } from "../../utils/debounce.js";
|
|
5
5
|
import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
|
|
6
|
-
import { nothing as
|
|
6
|
+
import { nothing as n, html as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
7
7
|
import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
8
|
-
import { property as
|
|
9
|
-
import { state as
|
|
10
|
-
import { query as
|
|
11
|
-
import { classMap as
|
|
12
|
-
import { commonStyles as
|
|
13
|
-
var k = Object.defineProperty,
|
|
14
|
-
for (var
|
|
15
|
-
(h = e[c]) && (
|
|
16
|
-
return
|
|
8
|
+
import { property as a } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
9
|
+
import { state as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
10
|
+
import { query as u } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.js";
|
|
11
|
+
import { classMap as C } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
12
|
+
import { commonStyles as g } from "./styles/common.styles.js";
|
|
13
|
+
var k = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (e, t, r, l) => {
|
|
14
|
+
for (var o = l > 1 ? void 0 : l ? y(t, r) : t, c = e.length - 1, h; c >= 0; c--)
|
|
15
|
+
(h = e[c]) && (o = (l ? h(t, r, o) : h(o)) || o);
|
|
16
|
+
return l && o && k(t, r, o), o;
|
|
17
17
|
};
|
|
18
|
-
let
|
|
18
|
+
let s = class extends m {
|
|
19
19
|
constructor() {
|
|
20
|
-
super(...arguments), this.lockClose = !1, this.lockScroll = !0, this.open = !1, this.size = "medium", this.hasBeenOpened = !1, this.hasScroll = !1, this.debouncedCheckScroll =
|
|
20
|
+
super(...arguments), this.lockClose = !1, this.lockScroll = !0, this.open = !1, this.size = "medium", this.hasBeenOpened = !1, this.hasScroll = !1, this.debouncedCheckScroll = f({ func: () => this.checkScroll() }), this.handleCloseButtonClick = () => {
|
|
21
21
|
this.handleClose("button");
|
|
22
|
-
}, this.
|
|
23
|
-
this.handleClose("backdrop");
|
|
22
|
+
}, this.handleDialogClick = (e) => {
|
|
23
|
+
e.target === this.nativeDialog && this.handleClose("backdrop");
|
|
24
|
+
}, this.handleCancel = (e) => {
|
|
25
|
+
e.preventDefault(), this.lockClose || this.handleClose("escape");
|
|
24
26
|
}, this.handleHostClick = (e) => {
|
|
25
27
|
e.stopPropagation();
|
|
26
|
-
}, this.handleKeyDown = (e) => {
|
|
27
|
-
this.open && e.key === "Escape" && this.handleClose("escape");
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
async updated(e) {
|
|
31
|
-
super.updated(e), !this.hasBeenOpened && e.has("open") && this.open && (this.hasBeenOpened = !0), e.has("open") && this.handleResizeObserver(), e.has("open") && this.open && (await this.updateComplete, this.requestUpdate());
|
|
31
|
+
super.updated(e), !this.hasBeenOpened && e.has("open") && this.open && (this.hasBeenOpened = !0), e.has("open") && (this.handleResizeObserver(), this.syncNativeDialogState()), e.has("open") && this.open && (await this.updateComplete, this.requestUpdate());
|
|
32
|
+
}
|
|
33
|
+
syncNativeDialogState() {
|
|
34
|
+
this.nativeDialog && (this.open ? this.openNativeDialog() : this.closeNativeDialog());
|
|
35
|
+
}
|
|
36
|
+
openNativeDialog() {
|
|
37
|
+
var e, t;
|
|
38
|
+
this.nativeDialog.open || (t = (e = this.nativeDialog).showModal) == null || t.call(e);
|
|
39
|
+
}
|
|
40
|
+
closeNativeDialog() {
|
|
41
|
+
var e, t;
|
|
42
|
+
this.nativeDialog.open && ((t = (e = this.nativeDialog).close) == null || t.call(e));
|
|
32
43
|
}
|
|
33
44
|
async handleResizeObserver() {
|
|
34
45
|
var e;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
get containerClasses() {
|
|
38
|
-
return {
|
|
39
|
-
container: !0,
|
|
40
|
-
close: !this.open,
|
|
41
|
-
"with-scroll": this.open && this.hasScroll
|
|
42
|
-
};
|
|
46
|
+
(e = this.resizeObserver) == null || e.disconnect(), this.content && (this.resizeObserver.observe(this.content), await new Promise(requestAnimationFrame), this.checkScroll());
|
|
43
47
|
}
|
|
44
|
-
get
|
|
48
|
+
get panelClasses() {
|
|
45
49
|
return {
|
|
46
|
-
|
|
50
|
+
panel: !0,
|
|
51
|
+
"with-scroll": this.open && this.hasScroll,
|
|
47
52
|
[this.size]: !!this.size
|
|
48
53
|
};
|
|
49
54
|
}
|
|
50
55
|
dispatchCloseEvents(e) {
|
|
51
|
-
const
|
|
56
|
+
const t = `ds-dialog:close-${e}`;
|
|
52
57
|
this.dispatchEvent(
|
|
53
|
-
new Event(
|
|
58
|
+
new Event(t, {
|
|
54
59
|
bubbles: !0,
|
|
55
60
|
composed: !0
|
|
56
61
|
})
|
|
@@ -65,77 +70,73 @@ let t = class extends v {
|
|
|
65
70
|
this.lockClose || (this.open = !1, this.dispatchCloseEvents(e));
|
|
66
71
|
}
|
|
67
72
|
connectedCallback() {
|
|
68
|
-
super.connectedCallback(),
|
|
73
|
+
super.connectedCallback(), this.resizeObserver = new ResizeObserver(this.debouncedCheckScroll), this.handleResizeObserver(), this.addEventListener("click", this.handleHostClick);
|
|
69
74
|
}
|
|
70
75
|
disconnectedCallback() {
|
|
71
76
|
var e;
|
|
72
|
-
super.disconnectedCallback(),
|
|
77
|
+
super.disconnectedCallback(), (e = this.resizeObserver) == null || e.disconnect(), this.removeEventListener("click", this.handleHostClick);
|
|
73
78
|
}
|
|
74
79
|
checkScroll() {
|
|
75
|
-
var e,
|
|
76
|
-
this.hasScroll = ((e = this.content) == null ? void 0 : e.scrollHeight) > ((
|
|
80
|
+
var e, t;
|
|
81
|
+
this.hasScroll = ((e = this.content) == null ? void 0 : e.scrollHeight) > ((t = this.content) == null ? void 0 : t.clientHeight);
|
|
77
82
|
}
|
|
78
83
|
render() {
|
|
79
|
-
return !this.hasBeenOpened && !this.open ?
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
?
|
|
90
|
-
data-testid="ds-dialog-container"
|
|
91
|
-
class=${u(this.dialogClasses)}
|
|
92
|
-
aria-modal="true"
|
|
93
|
-
aria-label=${this.dataAriaLabel || r}
|
|
94
|
-
aria-description=${this.dataAriaDescription || r}
|
|
95
|
-
>
|
|
96
|
-
${this.lockClose ? r : p`<slot name="close-button" @click=${this.handleCloseButtonClick}></slot>`}
|
|
84
|
+
return !this.hasBeenOpened && !this.open ? n : d`
|
|
85
|
+
<dialog
|
|
86
|
+
class="dialog"
|
|
87
|
+
data-testid="ds-dialog-container"
|
|
88
|
+
aria-label=${this.dataAriaLabel || n}
|
|
89
|
+
aria-description=${this.dataAriaDescription || n}
|
|
90
|
+
@cancel=${this.handleCancel}
|
|
91
|
+
@click=${this.handleDialogClick}
|
|
92
|
+
>
|
|
93
|
+
<div class=${C(this.panelClasses)}>
|
|
94
|
+
${this.lockClose ? n : d`<slot name="close-button" @click=${this.handleCloseButtonClick}></slot>`}
|
|
97
95
|
<div class="content-container">
|
|
98
96
|
<div tabindex="0" class="content ds-scroll">
|
|
99
97
|
<slot @slotchange=${this.handleResizeObserver}></slot>
|
|
100
98
|
</div>
|
|
101
99
|
<slot name="footer"></slot>
|
|
102
100
|
</div>
|
|
103
|
-
</
|
|
104
|
-
</
|
|
101
|
+
</div>
|
|
102
|
+
</dialog>
|
|
105
103
|
`;
|
|
106
104
|
}
|
|
107
105
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
],
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
],
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
],
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
],
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
],
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
],
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
],
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
],
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
],
|
|
136
|
-
|
|
106
|
+
s.styles = [g];
|
|
107
|
+
i([
|
|
108
|
+
a({ type: Boolean, converter: p, attribute: "lock-close" })
|
|
109
|
+
], s.prototype, "lockClose", 2);
|
|
110
|
+
i([
|
|
111
|
+
a({ type: Boolean, converter: p, attribute: "lock-scroll" })
|
|
112
|
+
], s.prototype, "lockScroll", 2);
|
|
113
|
+
i([
|
|
114
|
+
a({ type: Boolean, converter: p })
|
|
115
|
+
], s.prototype, "open", 2);
|
|
116
|
+
i([
|
|
117
|
+
a({ type: String })
|
|
118
|
+
], s.prototype, "size", 2);
|
|
119
|
+
i([
|
|
120
|
+
a({ type: String, attribute: "data-aria-label" })
|
|
121
|
+
], s.prototype, "dataAriaLabel", 2);
|
|
122
|
+
i([
|
|
123
|
+
a({ type: String, attribute: "data-aria-description" })
|
|
124
|
+
], s.prototype, "dataAriaDescription", 2);
|
|
125
|
+
i([
|
|
126
|
+
v()
|
|
127
|
+
], s.prototype, "hasBeenOpened", 2);
|
|
128
|
+
i([
|
|
129
|
+
v()
|
|
130
|
+
], s.prototype, "hasScroll", 2);
|
|
131
|
+
i([
|
|
132
|
+
u(".content")
|
|
133
|
+
], s.prototype, "content", 2);
|
|
134
|
+
i([
|
|
135
|
+
u("dialog")
|
|
136
|
+
], s.prototype, "nativeDialog", 2);
|
|
137
|
+
s = i([
|
|
137
138
|
b("ds-dialog")
|
|
138
|
-
],
|
|
139
|
+
], s);
|
|
139
140
|
export {
|
|
140
|
-
|
|
141
|
+
s as DsDialog
|
|
141
142
|
};
|