@cupra/ui-kit 2.0.0-canary.63 → 2.0.0-canary.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/components/ds-accordion/ds-accordion.cjs +6 -6
  2. package/dist/cjs/components/ds-button/ds-button.cjs +43 -38
  3. package/dist/cjs/components/ds-button/styles/common.styles.cjs +41 -3
  4. package/dist/cjs/components/ds-chips/styles/common.styles.cjs +9 -2
  5. package/dist/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  6. package/dist/cjs/utils/IconsManager.cjs +1 -1
  7. package/dist/cjs/utils/PubSub.cjs +1 -1
  8. package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  9. package/dist/cjs/utils/cssWithTokens.cjs +1 -1
  10. package/dist/cjs/utils/htmlWithTokens.cjs +1 -1
  11. package/dist/esm/components/ds-accordion/ds-accordion.js +4 -4
  12. package/dist/esm/components/ds-button/ds-button.js +90 -79
  13. package/dist/esm/components/ds-button/styles/common.styles.js +42 -4
  14. package/dist/esm/components/ds-chips/styles/common.styles.js +7 -0
  15. package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  16. package/dist/esm/utils/IconsManager.js +1 -1
  17. package/dist/esm/utils/PubSub.js +1 -1
  18. package/dist/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
  19. package/dist/esm/utils/cssWithTokens.js +1 -1
  20. package/dist/esm/utils/htmlWithTokens.js +1 -1
  21. package/dist/types/components/ds-accordion/ds-accordion.d.ts +1 -1
  22. package/dist/types/components/ds-button/ds-button.d.ts +2 -0
  23. package/dist/types/components/ds-button/ds-button.types.d.ts +1 -0
  24. package/dist-react/cjs/components/ds-accordion/ds-accordion.cjs +6 -6
  25. package/dist-react/cjs/components/ds-button/ds-button.cjs +43 -38
  26. package/dist-react/cjs/components/ds-button/styles/common.styles.cjs +41 -3
  27. package/dist-react/cjs/components/ds-chips/styles/common.styles.cjs +9 -2
  28. package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  29. package/dist-react/cjs/utils/IconsManager.cjs +1 -1
  30. package/dist-react/cjs/utils/PubSub.cjs +1 -1
  31. package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  32. package/dist-react/cjs/utils/cssWithTokens.cjs +1 -1
  33. package/dist-react/cjs/utils/htmlWithTokens.cjs +1 -1
  34. package/dist-react/esm/components/ds-accordion/ds-accordion.js +4 -4
  35. package/dist-react/esm/components/ds-button/ds-button.js +90 -79
  36. package/dist-react/esm/components/ds-button/styles/common.styles.js +42 -4
  37. package/dist-react/esm/components/ds-chips/styles/common.styles.js +7 -0
  38. package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  39. package/dist-react/esm/utils/IconsManager.js +1 -1
  40. package/dist-react/esm/utils/PubSub.js +1 -1
  41. package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
  42. package/dist-react/esm/utils/cssWithTokens.js +1 -1
  43. package/dist-react/esm/utils/htmlWithTokens.js +1 -1
  44. package/dist-react/types/components/ds-accordion/ds-accordion.d.ts +1 -1
  45. package/dist-react/types/components/ds-button/ds-button.d.ts +2 -0
  46. package/dist-react/types/components/ds-button/ds-button.types.d.ts +1 -0
  47. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../base/UiKitElement.cjs"),u=require("./styles/common.styles.cjs"),p=require("./theme-config.cjs"),y=require("../../decorators/customUiKitElement.cjs"),h=require("../../utils/booleanConverter.cjs"),g=require("../../utils/htmlWithTokens.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const a=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 i=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),f=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),d=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs");var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(n,e,t,r)=>{for(var o=r>1?void 0:r?b(e,t):e,c=n.length-1,l;c>=0;c--)(l=n[c])&&(o=(r?l(e,t,o):l(o))||o);return r&&o&&v(e,t,o),o};exports.DsAccordion=class extends m.UiKitElement{constructor(){super(...arguments),this.maxHeight=300,this.open=!1,this.mode="light",this.size="medium",this.disabled=!1,this._open=!1}async firstUpdated(e){super.firstUpdated(e),await this.updateComplete,this._open=this.open}get containerClasses(){return{container:!0,disabled:this.disabled,open:this._open,[this.size]:!0,[this.mode]:!!this.mode}}get dividerClasses(){return{divider:!0,[this.mode]:!!this.mode}}get openIconTemplate(){var t;if(!this.theme)return a.nothing;const e=(t=p.themeConfig[this.theme])==null?void 0:t["icon-names"];return this.componentFactory.createIcon({class:"icon open-icon",role:"image","aria-hidden":"true","icon-name":(e==null?void 0:e.open)||"minus"})}get closeIconTemplate(){var t;if(!this.theme)return a.nothing;const e=(t=p.themeConfig[this.theme])==null?void 0:t["icon-names"];return this.componentFactory.createIcon({class:"icon close-icon",role:"image","aria-hidden":"true","icon-name":(e==null?void 0:e.close)||"plus"})}get styleTokens(){return g.htmlWithTokens`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../base/UiKitElement.cjs"),u=require("./styles/common.styles.cjs"),p=require("./theme-config.cjs"),y=require("../../decorators/customUiKitElement.cjs"),d=require("../../utils/booleanConverter.cjs"),g=require("../../utils/htmlWithTokens.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const a=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 i=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),f=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),h=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs");var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(n,e,t,r)=>{for(var o=r>1?void 0:r?b(e,t):e,c=n.length-1,l;c>=0;c--)(l=n[c])&&(o=(r?l(e,t,o):l(o))||o);return r&&o&&v(e,t,o),o};exports.DsAccordion=class extends m.UiKitElement{constructor(){super(...arguments),this.maxHeight=300,this.open=!1,this.mode="light",this.size="medium",this.disabled=!1,this._open=!1}willUpdate(e){super.willUpdate(e),e.has("open")&&(this._open=this.open)}get containerClasses(){return{container:!0,disabled:this.disabled,open:this._open,[this.size]:!0,[this.mode]:!!this.mode}}get dividerClasses(){return{divider:!0,[this.mode]:!!this.mode}}get openIconTemplate(){var t;if(!this.theme)return a.nothing;const e=(t=p.themeConfig[this.theme])==null?void 0:t["icon-names"];return this.componentFactory.createIcon({class:"icon open-icon",role:"image","aria-hidden":"true","icon-name":(e==null?void 0:e.open)||"minus"})}get closeIconTemplate(){var t;if(!this.theme)return a.nothing;const e=(t=p.themeConfig[this.theme])==null?void 0:t["icon-names"];return this.componentFactory.createIcon({class:"icon close-icon",role:"image","aria-hidden":"true","icon-name":(e==null?void 0:e.close)||"plus"})}get styleTokens(){return g.htmlWithTokens`
2
2
  <style>
3
3
  :host{
4
4
  color-scheme: ${this.mode};
5
- pointer-events: ${this.disabled?"none":"visible"};
5
+ pointer-events: ${this.disabled?"none":"auto"};
6
6
  }
7
7
  </style>
8
- `}handleKeyDown(e){this.disabled&&e.preventDefault()}handleToggle(e){this._open=e.newState==="open"}render(){return a.html`
8
+ `}handleKeyDown(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}handleToggle(e){this._open=e.newState==="open"}render(){return a.html`
9
9
  ${this.styleTokens}
10
10
 
11
11
  <details
12
- class=${d.classMap(this.containerClasses)}
12
+ class=${h.classMap(this.containerClasses)}
13
13
  aria-disabled=${!!this.disabled}
14
14
  ?open=${this.open}
15
15
  @keydown=${this.handleKeyDown}
@@ -22,5 +22,5 @@
22
22
  </summary>
23
23
  <slot name="content"></slot>
24
24
  </details>
25
- <div class=${d.classMap(this.dividerClasses)}></div>
26
- `}};exports.DsAccordion.styles=[u.commonStyles];s([i.property({type:Number,attribute:"max-height"})],exports.DsAccordion.prototype,"maxHeight",2);s([i.property({type:Boolean,converter:h.booleanConverter,reflect:!0})],exports.DsAccordion.prototype,"open",2);s([i.property({type:String,reflect:!0})],exports.DsAccordion.prototype,"mode",2);s([i.property({type:String})],exports.DsAccordion.prototype,"size",2);s([i.property({type:Boolean,converter:h.booleanConverter})],exports.DsAccordion.prototype,"disabled",2);s([f.state()],exports.DsAccordion.prototype,"_open",2);exports.DsAccordion=s([y.customUiKitElement("ds-accordion")],exports.DsAccordion);
25
+ <div class=${h.classMap(this.dividerClasses)}></div>
26
+ `}};exports.DsAccordion.styles=[u.commonStyles];s([i.property({type:Number,attribute:"max-height"})],exports.DsAccordion.prototype,"maxHeight",2);s([i.property({type:Boolean,converter:d.booleanConverter,reflect:!0})],exports.DsAccordion.prototype,"open",2);s([i.property({type:String,reflect:!0})],exports.DsAccordion.prototype,"mode",2);s([i.property({type:String})],exports.DsAccordion.prototype,"size",2);s([i.property({type:Boolean,converter:d.booleanConverter})],exports.DsAccordion.prototype,"disabled",2);s([f.state()],exports.DsAccordion.prototype,"_open",2);exports.DsAccordion=s([y.customUiKitElement("ds-accordion")],exports.DsAccordion);
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../base/UiKitElement.cjs"),y=require("../../decorators/customUiKitElement.cjs"),b=require("../../mixins/ViewportMixin.cjs"),n=require("../../utils/booleanConverter.cjs"),g=require("../../utils/htmlWithTokens.cjs"),v=require("../../utils/objectConverter.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 s=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),f=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),$=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/choose.cjs"),u=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),a=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.cjs"),d=require("./styles/common.styles.cjs");var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,t=(p,e,r,l)=>{for(var i=l>1?void 0:l?D(e,r):e,h=p.length-1,c;h>=0;h--)(c=p[h])&&(i=(l?c(e,r,i):c(i))||i);return l&&i&&B(e,r,i),i};exports.DsButton=class extends b.ViewportMixin(m.UiKitElement){constructor(){super(...arguments),this.variant="primary",this.mode="light",this.size="large",this.disabled=!1,this.destructive=!1,this.htmlTagName="button",this.type="button",this.iconPosition="left",this.rounded=!1,this.fullWidth=!1,this.loading=!1}firstUpdated(){this.closestForm=this.closest("form")}get classes(){const e=typeof this.size=="string"?this.size:this.size[this.viewport];return{button:!0,custom:this.htmlTagName==="custom",[e]:!!e,[this.mode]:!!this.mode,[this.variant]:!!this.variant,rounded:this.rounded,disabled:this.disabled||this.loading,destructive:this.destructive,"full-width":this.fullWidth}}handleClick(e){if(this.href||e.preventDefault(),this.closestForm&&this.type==="submit"){const r=new Event("submit",{bubbles:!0,composed:!0,cancelable:!0});this.closestForm.dispatchEvent(r)}}get iconTemplate(){return this.iconName?this.componentFactory.createIcon({class:"icon","icon-name":this.iconName}):o.nothing}get loadingTemplate(){return this.loading?o.html`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../base/UiKitElement.cjs"),y=require("../../decorators/customUiKitElement.cjs"),g=require("../../mixins/ViewportMixin.cjs"),l=require("../../utils/booleanConverter.cjs"),b=require("../../utils/htmlWithTokens.cjs"),v=require("../../utils/objectConverter.cjs");require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.cjs");const e=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 s=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs"),$=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs"),f=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/choose.cjs"),u=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs"),n=require("../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.cjs"),m=require("./styles/common.styles.cjs");var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,t=(p,o,r,a)=>{for(var i=a>1?void 0:a?D(o,r):o,h=p.length-1,c;h>=0;h--)(c=p[h])&&(i=(a?c(o,r,i):c(i))||i);return a&&i&&B(o,r,i),i};exports.DsButton=class extends g.ViewportMixin(d.UiKitElement){constructor(){super(...arguments),this.variant="primary",this.mode="light",this.size="large",this.disabled=!1,this.destructive=!1,this.htmlTagName="button",this.type="button",this.iconPosition="left",this.rounded=!1,this.fullWidth=!1,this.loading=!1}firstUpdated(){this.closestForm=this.closest("form")}get classes(){const o=typeof this.size=="string"?this.size:this.size[this.viewport];return{button:!0,custom:this.htmlTagName==="custom",[o]:!!o,[this.mode]:!!this.mode,[this.variant]:!!this.variant,rounded:this.rounded,disabled:this.disabled||this.loading,destructive:this.destructive,"full-width":this.fullWidth}}handleClick(o){if(this.href||o.preventDefault(),this.closestForm&&this.type==="submit"){const r=new Event("submit",{bubbles:!0,composed:!0,cancelable:!0});this.closestForm.dispatchEvent(r)}}get iconTemplate(){return this.iconName?this.componentFactory.createIcon({class:"icon","icon-name":this.iconName}):e.nothing}get loadingTemplate(){return this.loading?e.html`
2
2
  <span class="loading-dots">
3
3
  <span>.</span>
4
4
  <span>.</span>
5
5
  <span>.</span>
6
6
  </span>
7
- `:o.nothing}get cssTokens(){return g.htmlWithTokens`
7
+ `:e.nothing}get contentTemplate(){return this.loading&&this.textLoading?e.html`${this.textLoading}`:e.html`<slot></slot>`}get cssTokens(){return b.htmlWithTokens`
8
8
  <style>
9
9
  :host{
10
10
  color-scheme: ${this.mode};
@@ -14,43 +14,48 @@
14
14
  :host:has(::slotted(*:disabled)){
15
15
  pointer-events: none;
16
16
  }
17
- </style>`}render(){return o.html`
17
+ </style>`}render(){return e.html`
18
18
  ${this.cssTokens}
19
- ${$.choose(this.htmlTagName||"button",[["button",()=>{var e;return o.html`
20
- <button
21
- aria-label=${(e=this.textContent)==null?void 0:e.replace(/^\s+|\s+$/g,"")}
22
- class=${u.classMap(this.classes)}
23
- type=${this.type}
24
- @click=${this.handleClick}
25
- ?disabled=${this.disabled}
26
- >
27
- ${a.when(this.iconPosition==="left",()=>o.html` ${this.iconTemplate} `)}
28
- <span class="container">
29
- <slot></slot>
30
- ${this.loadingTemplate}
31
- </span>
32
- ${a.when(this.iconPosition==="right",()=>o.html` ${this.iconTemplate} `)}
33
- </button>
34
- `}],["a",()=>{var e;return o.html`
35
- <a
36
- aria-label=${(e=this.textContent)==null?void 0:e.replace(/^\s+|\s+$/g,"")}
37
- class=${u.classMap(this.classes)}
38
- href=${this.href}
39
- rel=${this.rel}
40
- target=${this.target}
41
- @click=${this.handleClick}
42
- ?disabled=${this.disabled}
43
- >
44
- ${a.when(this.iconPosition==="left",()=>o.html`${this.iconTemplate}`)}
45
- <span class="container">
46
- <slot></slot>
47
- ${this.loadingTemplate}
48
- </span>
49
- ${a.when(this.iconPosition==="right",()=>o.html`${this.iconTemplate}`)}
50
- </a>
51
- `}],["custom",()=>o.html`
19
+ ${f.choose(this.htmlTagName||"button",[["button",()=>{var o;return e.html`
52
20
  <div class=${u.classMap(this.classes)}>
53
- <slot></slot>
21
+ <button
22
+ class="inner"
23
+ aria-label=${(o=this.textContent)==null?void 0:o.replace(/^\s+|\s+$/g,"")}
24
+ type=${this.type}
25
+ @click=${this.handleClick}
26
+ ?disabled=${this.disabled}
27
+ >
28
+ ${n.when(this.iconPosition==="left",()=>e.html` ${this.iconTemplate} `)}
29
+ <span class="container">
30
+ ${this.contentTemplate}
31
+ ${this.loadingTemplate}
32
+ </span>
33
+ ${n.when(this.iconPosition==="right",()=>e.html` ${this.iconTemplate} `)}
34
+ </button>
35
+ </div>
36
+ `}],["a",()=>{var o;return e.html`
37
+ <div class=${u.classMap(this.classes)}>
38
+ <a
39
+ class="inner"
40
+ aria-label=${(o=this.textContent)==null?void 0:o.replace(/^\s+|\s+$/g,"")}
41
+ href=${this.href}
42
+ rel=${this.rel}
43
+ target=${this.target}
44
+ @click=${this.handleClick}
45
+ >
46
+ ${n.when(this.iconPosition==="left",()=>e.html`${this.iconTemplate}`)}
47
+ <span class="container">
48
+ ${this.contentTemplate}
49
+ ${this.loadingTemplate}
50
+ </span>
51
+ ${n.when(this.iconPosition==="right",()=>e.html`${this.iconTemplate}`)}
52
+ </a>
53
+ </div>
54
+ `}],["custom",()=>e.html`
55
+ <div class=${u.classMap(this.classes)}>
56
+ ${n.when(this.iconPosition==="left",()=>e.html`${this.iconTemplate}`)}
57
+ ${this.loading&&this.textLoading?e.html`<span class="container">${this.textLoading}${this.loadingTemplate}</span>`:e.html`<slot></slot>${this.loadingTemplate}`}
58
+ ${n.when(this.iconPosition==="right",()=>e.html`${this.iconTemplate}`)}
54
59
  </div>
55
60
  `]])}
56
- `}};exports.DsButton.styles=[d.buttonStyles,d.textStyles,d.loadingDotsStyles];t([s.property({type:String})],exports.DsButton.prototype,"variant",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"mode",2);t([s.property({type:String,converter:v.objectConverter})],exports.DsButton.prototype,"size",2);t([s.property({type:Boolean,converter:n.booleanConverter})],exports.DsButton.prototype,"disabled",2);t([s.property({type:Boolean,converter:n.booleanConverter})],exports.DsButton.prototype,"destructive",2);t([s.property({type:String,attribute:"icon-name"})],exports.DsButton.prototype,"iconName",2);t([s.property({type:String,attribute:"html-tag-name"})],exports.DsButton.prototype,"htmlTagName",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"href",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"rel",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"target",2);t([s.property({type:String})],exports.DsButton.prototype,"type",2);t([s.property({type:String,attribute:"icon-position"})],exports.DsButton.prototype,"iconPosition",2);t([s.property({type:Boolean,converter:n.booleanConverter})],exports.DsButton.prototype,"rounded",2);t([s.property({type:Boolean,converter:n.booleanConverter,attribute:"full-width"})],exports.DsButton.prototype,"fullWidth",2);t([s.property({type:Boolean,converter:n.booleanConverter})],exports.DsButton.prototype,"loading",2);t([f.state()],exports.DsButton.prototype,"closestForm",2);exports.DsButton=t([y.customUiKitElement("ds-button")],exports.DsButton);
61
+ `}};exports.DsButton.styles=[m.buttonStyles,m.textStyles,m.loadingDotsStyles];t([s.property({type:String})],exports.DsButton.prototype,"variant",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"mode",2);t([s.property({type:String,converter:v.objectConverter})],exports.DsButton.prototype,"size",2);t([s.property({type:Boolean,converter:l.booleanConverter})],exports.DsButton.prototype,"disabled",2);t([s.property({type:Boolean,converter:l.booleanConverter})],exports.DsButton.prototype,"destructive",2);t([s.property({type:String,attribute:"icon-name"})],exports.DsButton.prototype,"iconName",2);t([s.property({type:String,attribute:"html-tag-name"})],exports.DsButton.prototype,"htmlTagName",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"href",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"rel",2);t([s.property({type:String,reflect:!0})],exports.DsButton.prototype,"target",2);t([s.property({type:String})],exports.DsButton.prototype,"type",2);t([s.property({type:String,attribute:"icon-position"})],exports.DsButton.prototype,"iconPosition",2);t([s.property({type:Boolean,converter:l.booleanConverter})],exports.DsButton.prototype,"rounded",2);t([s.property({type:Boolean,converter:l.booleanConverter,attribute:"full-width"})],exports.DsButton.prototype,"fullWidth",2);t([s.property({type:Boolean,converter:l.booleanConverter})],exports.DsButton.prototype,"loading",2);t([s.property({type:String,attribute:"text-loading"})],exports.DsButton.prototype,"textLoading",2);t([$.state()],exports.DsButton.prototype,"closestForm",2);exports.DsButton=t([y.customUiKitElement("ds-button")],exports.DsButton);
@@ -1,4 +1,4 @@
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 t=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),i=t.css`
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 t=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),e=t.css`
2
2
  :host {
3
3
  display: contents;
4
4
  }
@@ -18,7 +18,45 @@
18
18
  .button.full-width {
19
19
  width: 100%;
20
20
  }
21
- `,o=t.css`
21
+
22
+ .inner,
23
+ .custom ::slotted(*) {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 100%;
28
+ height: 100%;
29
+ gap: var(--ui-kit-button-gap, 0);
30
+ padding: 0;
31
+ margin: 0;
32
+ background: transparent;
33
+ border: none;
34
+ color: inherit;
35
+ font: inherit;
36
+ text-transform: inherit;
37
+ letter-spacing: inherit;
38
+ text-decoration: none;
39
+ cursor: inherit;
40
+ outline: none;
41
+ box-sizing: border-box;
42
+ }
43
+
44
+ .custom ::slotted(*) {
45
+ width: auto;
46
+ flex: 1;
47
+ min-width: 0;
48
+ }
49
+
50
+ .custom ::slotted(*:disabled),
51
+ .custom.disabled ::slotted(*) {
52
+ pointer-events: none;
53
+ cursor: default;
54
+ }
55
+
56
+ .custom ::slotted(*:focus-visible) {
57
+ outline: none;
58
+ }
59
+ `,i=t.css`
22
60
  .naked.container {
23
61
  display: inline-flex;
24
62
  }
@@ -104,4 +142,4 @@
104
142
  opacity: 1;
105
143
  }
106
144
  }
107
- `;exports.buttonStyles=i;exports.loadingDotsStyles=n;exports.textStyles=o;
145
+ `;exports.buttonStyles=e;exports.loadingDotsStyles=n;exports.textStyles=i;
@@ -1,4 +1,4 @@
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 t=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),e=t.css`
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 o=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.cjs"),t=o.css`
2
2
  .container {
3
3
  display: inline-flex;
4
4
  position: relative;
@@ -37,11 +37,18 @@
37
37
  }
38
38
 
39
39
  .scroll-button {
40
+ display: none;
40
41
  position: absolute;
41
42
  top: 0;
42
43
  z-index: 2;
43
44
  }
44
45
 
46
+ @media (min-width: 768px) {
47
+ .scroll-button {
48
+ display: block;
49
+ }
50
+ }
51
+
45
52
  .scroll-button.left {
46
53
  left: 0;
47
54
  }
@@ -49,4 +56,4 @@
49
56
  .scroll-button.right {
50
57
  right: 0;
51
58
  }
52
- `;exports.commonStyles=e;
59
+ `;exports.commonStyles=t;
@@ -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.63",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);
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.64",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.63"),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
+ "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.64"),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.63"),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
+ "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.64"),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.63/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
+ "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.64/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-63"),n=e.unsafeCSS(s);return e.css`${n}`}exports.cssWithTokens=i;
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-64"),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-63"),n=o.unsafeHTML(r);return i.html`${n}`}exports.htmlWithTokens=a;
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-64"),n=o.unsafeHTML(r);return i.html`${n}`}exports.htmlWithTokens=a;
@@ -19,8 +19,8 @@ let o = class extends u {
19
19
  constructor() {
20
20
  super(...arguments), this.maxHeight = 300, this.open = !1, this.mode = "light", this.size = "medium", this.disabled = !1, this._open = !1;
21
21
  }
22
- async firstUpdated(e) {
23
- super.firstUpdated(e), await this.updateComplete, this._open = this.open;
22
+ willUpdate(e) {
23
+ super.willUpdate(e), e.has("open") && (this._open = this.open);
24
24
  }
25
25
  get containerClasses() {
26
26
  return {
@@ -64,13 +64,13 @@ let o = class extends u {
64
64
  <style>
65
65
  :host{
66
66
  color-scheme: ${this.mode};
67
- pointer-events: ${this.disabled ? "none" : "visible"};
67
+ pointer-events: ${this.disabled ? "none" : "auto"};
68
68
  }
69
69
  </style>
70
70
  `;
71
71
  }
72
72
  handleKeyDown(e) {
73
- this.disabled && e.preventDefault();
73
+ this.disabled && (e.preventDefault(), e.stopPropagation());
74
74
  }
75
75
  handleToggle(e) {
76
76
  this._open = e.newState === "open";
@@ -1,24 +1,24 @@
1
- import { UiKitElement as f } from "../base/UiKitElement.js";
2
- import { customUiKitElement as y } from "../../decorators/customUiKitElement.js";
3
- import { ViewportMixin as g } from "../../mixins/ViewportMixin.js";
4
- import { booleanConverter as a } from "../../utils/booleanConverter.js";
5
- import { htmlWithTokens as b } from "../../utils/htmlWithTokens.js";
6
- import { objectConverter as v } from "../../utils/objectConverter.js";
1
+ import { UiKitElement as g } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as f } from "../../decorators/customUiKitElement.js";
3
+ import { ViewportMixin as y } from "../../mixins/ViewportMixin.js";
4
+ import { booleanConverter as l } from "../../utils/booleanConverter.js";
5
+ import { htmlWithTokens as $ } from "../../utils/htmlWithTokens.js";
6
+ import { objectConverter as b } from "../../utils/objectConverter.js";
7
7
  import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
8
- import { nothing as u, html as o } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
8
+ import { nothing as u, html as s } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
9
9
  import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
10
- import { property as s } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
11
- import { state as $ } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
10
+ import { property as i } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
11
+ import { state as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
12
12
  import { choose as T } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/choose.js";
13
13
  import { classMap as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
14
- import { when as p } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.js";
15
- import { buttonStyles as S, textStyles as P, loadingDotsStyles as w } from "./styles/common.styles.js";
16
- var C = Object.defineProperty, x = Object.getOwnPropertyDescriptor, e = (i, n, h, l) => {
17
- for (var r = l > 1 ? void 0 : l ? x(n, h) : n, c = i.length - 1, m; c >= 0; c--)
18
- (m = i[c]) && (r = (l ? m(n, h, r) : m(r)) || r);
19
- return l && r && C(n, h, r), r;
14
+ import { when as a } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.js";
15
+ import { buttonStyles as S, textStyles as x, loadingDotsStyles as P } from "./styles/common.styles.js";
16
+ var w = Object.defineProperty, C = Object.getOwnPropertyDescriptor, e = (o, r, h, p) => {
17
+ for (var n = p > 1 ? void 0 : p ? C(r, h) : r, c = o.length - 1, m; c >= 0; c--)
18
+ (m = o[c]) && (n = (p ? m(r, h, n) : m(n)) || n);
19
+ return p && n && w(r, h, n), n;
20
20
  };
21
- let t = class extends g(f) {
21
+ let t = class extends y(g) {
22
22
  constructor() {
23
23
  super(...arguments), this.variant = "primary", this.mode = "light", this.size = "large", this.disabled = !1, this.destructive = !1, this.htmlTagName = "button", this.type = "button", this.iconPosition = "left", this.rounded = !1, this.fullWidth = !1, this.loading = !1;
24
24
  }
@@ -26,11 +26,11 @@ let t = class extends g(f) {
26
26
  this.closestForm = this.closest("form");
27
27
  }
28
28
  get classes() {
29
- const i = typeof this.size == "string" ? this.size : this.size[this.viewport];
29
+ const o = typeof this.size == "string" ? this.size : this.size[this.viewport];
30
30
  return {
31
31
  button: !0,
32
32
  custom: this.htmlTagName === "custom",
33
- [i]: !!i,
33
+ [o]: !!o,
34
34
  [this.mode]: !!this.mode,
35
35
  [this.variant]: !!this.variant,
36
36
  rounded: this.rounded,
@@ -39,14 +39,14 @@ let t = class extends g(f) {
39
39
  "full-width": this.fullWidth
40
40
  };
41
41
  }
42
- handleClick(i) {
43
- if (this.href || i.preventDefault(), this.closestForm && this.type === "submit") {
44
- const n = new Event("submit", {
42
+ handleClick(o) {
43
+ if (this.href || o.preventDefault(), this.closestForm && this.type === "submit") {
44
+ const r = new Event("submit", {
45
45
  bubbles: !0,
46
46
  composed: !0,
47
47
  cancelable: !0
48
48
  });
49
- this.closestForm.dispatchEvent(n);
49
+ this.closestForm.dispatchEvent(r);
50
50
  }
51
51
  }
52
52
  get iconTemplate() {
@@ -56,7 +56,7 @@ let t = class extends g(f) {
56
56
  }) : u;
57
57
  }
58
58
  get loadingTemplate() {
59
- return this.loading ? o`
59
+ return this.loading ? s`
60
60
  <span class="loading-dots">
61
61
  <span>.</span>
62
62
  <span>.</span>
@@ -64,8 +64,11 @@ let t = class extends g(f) {
64
64
  </span>
65
65
  ` : u;
66
66
  }
67
+ get contentTemplate() {
68
+ return this.loading && this.textLoading ? s`${this.textLoading}` : s`<slot></slot>`;
69
+ }
67
70
  get cssTokens() {
68
- return b`
71
+ return $`
69
72
  <style>
70
73
  :host{
71
74
  color-scheme: ${this.mode};
@@ -78,60 +81,65 @@ let t = class extends g(f) {
78
81
  </style>`;
79
82
  }
80
83
  render() {
81
- return o`
84
+ return s`
82
85
  ${this.cssTokens}
83
86
  ${T(this.htmlTagName || "button", [
84
87
  [
85
88
  "button",
86
89
  () => {
87
- var i;
88
- return o`
89
- <button
90
- aria-label=${(i = this.textContent) == null ? void 0 : i.replace(/^\s+|\s+$/g, "")}
91
- class=${d(this.classes)}
92
- type=${this.type}
93
- @click=${this.handleClick}
94
- ?disabled=${this.disabled}
95
- >
96
- ${p(this.iconPosition === "left", () => o` ${this.iconTemplate} `)}
97
- <span class="container">
98
- <slot></slot>
99
- ${this.loadingTemplate}
100
- </span>
101
- ${p(this.iconPosition === "right", () => o` ${this.iconTemplate} `)}
102
- </button>
90
+ var o;
91
+ return s`
92
+ <div class=${d(this.classes)}>
93
+ <button
94
+ class="inner"
95
+ aria-label=${(o = this.textContent) == null ? void 0 : o.replace(/^\s+|\s+$/g, "")}
96
+ type=${this.type}
97
+ @click=${this.handleClick}
98
+ ?disabled=${this.disabled}
99
+ >
100
+ ${a(this.iconPosition === "left", () => s` ${this.iconTemplate} `)}
101
+ <span class="container">
102
+ ${this.contentTemplate}
103
+ ${this.loadingTemplate}
104
+ </span>
105
+ ${a(this.iconPosition === "right", () => s` ${this.iconTemplate} `)}
106
+ </button>
107
+ </div>
103
108
  `;
104
109
  }
105
110
  ],
106
111
  [
107
112
  "a",
108
113
  () => {
109
- var i;
110
- return o`
111
- <a
112
- aria-label=${(i = this.textContent) == null ? void 0 : i.replace(/^\s+|\s+$/g, "")}
113
- class=${d(this.classes)}
114
- href=${this.href}
115
- rel=${this.rel}
116
- target=${this.target}
117
- @click=${this.handleClick}
118
- ?disabled=${this.disabled}
119
- >
120
- ${p(this.iconPosition === "left", () => o`${this.iconTemplate}`)}
121
- <span class="container">
122
- <slot></slot>
123
- ${this.loadingTemplate}
124
- </span>
125
- ${p(this.iconPosition === "right", () => o`${this.iconTemplate}`)}
126
- </a>
114
+ var o;
115
+ return s`
116
+ <div class=${d(this.classes)}>
117
+ <a
118
+ class="inner"
119
+ aria-label=${(o = this.textContent) == null ? void 0 : o.replace(/^\s+|\s+$/g, "")}
120
+ href=${this.href}
121
+ rel=${this.rel}
122
+ target=${this.target}
123
+ @click=${this.handleClick}
124
+ >
125
+ ${a(this.iconPosition === "left", () => s`${this.iconTemplate}`)}
126
+ <span class="container">
127
+ ${this.contentTemplate}
128
+ ${this.loadingTemplate}
129
+ </span>
130
+ ${a(this.iconPosition === "right", () => s`${this.iconTemplate}`)}
131
+ </a>
132
+ </div>
127
133
  `;
128
134
  }
129
135
  ],
130
136
  [
131
137
  "custom",
132
- () => o`
138
+ () => s`
133
139
  <div class=${d(this.classes)}>
134
- <slot></slot>
140
+ ${a(this.iconPosition === "left", () => s`${this.iconTemplate}`)}
141
+ ${this.loading && this.textLoading ? s`<span class="container">${this.textLoading}${this.loadingTemplate}</span>` : s`<slot></slot>${this.loadingTemplate}`}
142
+ ${a(this.iconPosition === "right", () => s`${this.iconTemplate}`)}
135
143
  </div>
136
144
  `
137
145
  ]
@@ -139,57 +147,60 @@ let t = class extends g(f) {
139
147
  `;
140
148
  }
141
149
  };
142
- t.styles = [S, P, w];
150
+ t.styles = [S, x, P];
143
151
  e([
144
- s({ type: String })
152
+ i({ type: String })
145
153
  ], t.prototype, "variant", 2);
146
154
  e([
147
- s({ type: String, reflect: !0 })
155
+ i({ type: String, reflect: !0 })
148
156
  ], t.prototype, "mode", 2);
149
157
  e([
150
- s({ type: String, converter: v })
158
+ i({ type: String, converter: b })
151
159
  ], t.prototype, "size", 2);
152
160
  e([
153
- s({ type: Boolean, converter: a })
161
+ i({ type: Boolean, converter: l })
154
162
  ], t.prototype, "disabled", 2);
155
163
  e([
156
- s({ type: Boolean, converter: a })
164
+ i({ type: Boolean, converter: l })
157
165
  ], t.prototype, "destructive", 2);
158
166
  e([
159
- s({ type: String, attribute: "icon-name" })
167
+ i({ type: String, attribute: "icon-name" })
160
168
  ], t.prototype, "iconName", 2);
161
169
  e([
162
- s({ type: String, attribute: "html-tag-name" })
170
+ i({ type: String, attribute: "html-tag-name" })
163
171
  ], t.prototype, "htmlTagName", 2);
164
172
  e([
165
- s({ type: String, reflect: !0 })
173
+ i({ type: String, reflect: !0 })
166
174
  ], t.prototype, "href", 2);
167
175
  e([
168
- s({ type: String, reflect: !0 })
176
+ i({ type: String, reflect: !0 })
169
177
  ], t.prototype, "rel", 2);
170
178
  e([
171
- s({ type: String, reflect: !0 })
179
+ i({ type: String, reflect: !0 })
172
180
  ], t.prototype, "target", 2);
173
181
  e([
174
- s({ type: String })
182
+ i({ type: String })
175
183
  ], t.prototype, "type", 2);
176
184
  e([
177
- s({ type: String, attribute: "icon-position" })
185
+ i({ type: String, attribute: "icon-position" })
178
186
  ], t.prototype, "iconPosition", 2);
179
187
  e([
180
- s({ type: Boolean, converter: a })
188
+ i({ type: Boolean, converter: l })
181
189
  ], t.prototype, "rounded", 2);
182
190
  e([
183
- s({ type: Boolean, converter: a, attribute: "full-width" })
191
+ i({ type: Boolean, converter: l, attribute: "full-width" })
184
192
  ], t.prototype, "fullWidth", 2);
185
193
  e([
186
- s({ type: Boolean, converter: a })
194
+ i({ type: Boolean, converter: l })
187
195
  ], t.prototype, "loading", 2);
188
196
  e([
189
- $()
197
+ i({ type: String, attribute: "text-loading" })
198
+ ], t.prototype, "textLoading", 2);
199
+ e([
200
+ v()
190
201
  ], t.prototype, "closestForm", 2);
191
202
  t = e([
192
- y("ds-button")
203
+ f("ds-button")
193
204
  ], t);
194
205
  export {
195
206
  t as DsButton