@cupra/ui-kit 2.0.0-canary.225 → 2.0.0-canary.227
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-secondary-navigation/styles/common.styles.cjs +1 -1
- package/dist/cjs/components/ds-slider/ds-slider.cjs +2 -2
- package/dist/cjs/components/ds-slider/utils/getStepValue/getStepValue.cjs +1 -1
- package/dist/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist/cjs/decorators/customUiKitElement.cjs +1 -1
- package/dist/cjs/utils/IconsManager.cjs +1 -1
- package/dist/cjs/utils/PubSub.cjs +1 -1
- package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist/cjs/utils/version.cjs +1 -1
- package/dist/esm/components/ds-secondary-navigation/styles/common.styles.js +1 -1
- package/dist/esm/components/ds-slider/ds-slider.js +8 -3
- package/dist/esm/components/ds-slider/utils/getStepValue/getStepValue.js +27 -27
- package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/esm/decorators/customUiKitElement.js +1 -1
- package/dist/esm/utils/IconsManager.js +1 -1
- package/dist/esm/utils/PubSub.js +1 -1
- package/dist/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist/esm/utils/version.js +1 -1
- package/dist/types/components/ds-logo/ds-logo.types.d.ts +5 -2
- package/dist/types/components/ds-slider/ds-slider.d.ts +1 -0
- package/dist/types/components/ds-slider/ds-slider.types.d.ts +1 -0
- package/dist/types/components/ds-slider/utils/getStepValue/getStepValue.d.ts +1 -0
- package/dist-react/cjs/components/ds-secondary-navigation/styles/common.styles.cjs +1 -1
- package/dist-react/cjs/components/ds-slider/ds-slider.cjs +2 -2
- package/dist-react/cjs/components/ds-slider/utils/getStepValue/getStepValue.cjs +1 -1
- package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist-react/cjs/decorators/customUiKitElement.cjs +1 -1
- package/dist-react/cjs/utils/IconsManager.cjs +1 -1
- package/dist-react/cjs/utils/PubSub.cjs +1 -1
- package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist-react/cjs/utils/version.cjs +1 -1
- package/dist-react/esm/components/ds-secondary-navigation/styles/common.styles.js +1 -1
- package/dist-react/esm/components/ds-slider/ds-slider.js +8 -3
- package/dist-react/esm/components/ds-slider/utils/getStepValue/getStepValue.js +27 -27
- package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/esm/decorators/customUiKitElement.js +1 -1
- package/dist-react/esm/utils/IconsManager.js +1 -1
- package/dist-react/esm/utils/PubSub.js +1 -1
- package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist-react/esm/utils/version.js +1 -1
- package/dist-react/types/components/ds-logo/ds-logo.types.d.ts +5 -2
- package/dist-react/types/components/ds-slider/ds-slider.d.ts +1 -0
- package/dist-react/types/components/ds-slider/ds-slider.types.d.ts +1 -0
- package/dist-react/types/components/ds-slider/utils/getStepValue/getStepValue.d.ts +1 -0
- package/package.json +1 -1
|
@@ -246,7 +246,7 @@ const e=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_mo
|
|
|
246
246
|
flex-direction: column;
|
|
247
247
|
gap: var(--ds-spacing-m-1);
|
|
248
248
|
align-self: stretch;
|
|
249
|
-
border-radius: var(--ds-border-radius-
|
|
249
|
+
border-radius: var(--ds-border-radius-s);
|
|
250
250
|
border: var(--ds-border-width-m) solid var(--ds-color-border-default);
|
|
251
251
|
max-height: 75dvh;
|
|
252
252
|
overflow-y: scroll;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/query.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const i=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),a=require("../base/UiKitElement.cjs"),o=require("../../decorators/customUiKitElement.cjs"),s=require("../../utils/booleanConverter.cjs"),c=require("../../utils/uiKitHtml.cjs"),l=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/class-map.cjs");const u=require("../../mixins/ViewportMixin.cjs"),d=require("../../utils/objectConverter.cjs"),f=require("../../utils/formatNumber/formatNumber.cjs");require("../ds-text-input/ds-text-input.cjs");const p=require("./utils/roundToDecimals/roundToDecimals.cjs"),m=require("./utils/getStepValue/getStepValue.cjs"),h=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/live.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/live.cjs");const g=require("./styles/common.styles.cjs");var _=class extends u.ViewportMixin(a.UiKitElement){constructor(...e){super(...e),this.variant=`primary`,this.min=0,this.max=100,this.minLabel=``,this.maxLabel=``,this.step=1,this.initialValueMin=0,this.mode=`light`,this.locale=void 0,this.localeMatcher=`lookup`,this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size=`medium`,this.disabled=!1,this.keyboardMode=!1,this._initialValuesApplied=!1,this.getNewValue=e=>{let{width:t,left:n}=this.track.getBoundingClientRect(),r=this.thumbRadius,i=e.type.indexOf(`mouse`)===-1?e.touches[0].clientX:e.clientX,a=t-r*2,o=Math.min(Math.max(0,i-n-r),a),s=a>0?o*100/a:0;return this.min+s*(this.max-this.min)/100},this.setActiveThumb=e=>{let t=this.getNewValue(e);this.activeThumb=typeof this._valueMax!=`number`||t<=this._valueMin?`min`:t>=this._valueMax?`max`:t-this._valueMin<this._valueMax-t?`min`:`max`},this.handleMouseMove=e=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{let t=this.getNewValue(e),n=this.activeThumb??`min`,{stepValue:r}=this.computeStep({proposedValue:t,role:n});this.handleChange({value:r,role:n})})},this.handleMouseDown=e=>{var t,n,r,i;this.disabled||(e==null||(t=e.preventDefault)==null||t.call(e),this.setActiveThumb(e),this.handleMouseMove(e),(n=window)==null||n.addEventListener(`mousemove`,this.handleMouseMove),(r=window)==null||r.addEventListener(`touchmove`,this.handleMouseMove),(i=window)==null||i.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{var e,t,n;(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t);this.editingField=r,n.type=`number`,n.step=String(this.step??1);let i=r===`min`?this._valueMin:this._valueMax;n.value=String(i??``),this.keyboardMode&&n.classList.add(`focus-visible`)},this.commitInputValue=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t),{stepValue:i}=this.computeStep({proposedValue:Number(n.value),role:r}),a=p.roundToDecimals({value:i,fractionDigits:this.maximumFractionDigits});this.handleChange({value:a,role:r}),this.isControlled(r)||(n.value=String(a))},this.onInputBlur=e=>{var t;this.editingField=void 0;let n=e.currentTarget;n==null||(t=n.classList)==null||t.remove(`focus-visible`)},this.onInputKeyDown=(e,t)=>{e.key===`Enter`&&(e.preventDefault(),this.commitInputValue(e,t))},this.onThumbKeyDown=(e,t)=>{if(!this.disabled&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){e.preventDefault();let n=this.step??1,r=e.key===`ArrowLeft`?-n:n,i=this.getRoleById(t),a=i===`min`?this._valueMin:this._valueMax,{stepValue:o}=this.computeStep({proposedValue:a+r,role:i});this.handleChange({value:o,role:i})}}}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}get sliderSizeToTextInputSize(){var e;return(typeof this.size==`string`?this.size:(e=this.size)==null?void 0:e[this.viewport])===`large`?`large`:`medium`}isControlled(e){return typeof(e===`min`?this.valueMin:this.valueMax)==`number`}getRoleById(e){return e===1?`min`:`max`}get currentValues(){return{1:this._valueMin,...typeof this._valueMax==`number`?{2:this._valueMax}:{}}}computeStep({proposedValue:e,role:t}){return m.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:t,currentValues:this.currentValues})}willUpdate(e){super.willUpdate(e),typeof this.valueMin==`number`&&(this._valueMin=this.valueMin),typeof this.valueMax==`number`&&(this._valueMax=this.valueMax),this._initialValuesApplied||(this._initialValuesApplied=!0,this.applyInitialValues())}disconnectedCallback(){var e,t,n,r,i,a;super.disconnectedCallback(),(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp),(r=window)==null||r.removeEventListener(`keydown`,this.handleKeydown),(i=window)==null||i.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),(a=window)==null||a.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){var t,n,r;super.firstUpdated(e),(t=window)==null||t.addEventListener(`keydown`,this.handleKeydown),(n=window)==null||n.addEventListener(`mousedown`,this.handlePointerOrMouseDown),(r=window)==null||r.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=e===`min`?`initialValueMin`:`initialValueMax`,n=this[t];if(typeof n!=`number`)return;let{stepValue:r}=this.computeStep({proposedValue:n,role:e}),i=e===`min`?`_valueMin`:`_valueMax`;this[i]!==r&&this.handleChange({value:r,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){var e;let t=(e=this.renderRoot)==null?void 0:e.querySelector(`.thumb`);return t?t.offsetWidth/2:0}trackPosition(e){let t=v.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${v.THUMB_RADIUS_CSS_VAR} * 2) * ${e/100})`}handleChange({value:e,role:t}){let n=p.roundToDecimals({value:e,fractionDigits:this.maximumFractionDigits}),r=t===`min`?`_valueMin`:`_valueMax`;this[r]!==n&&(this.isControlled(t)||(this[r]=n),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0,detail:{role:t,value:n}})))}formatNumber(e){let t={value:e,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return f.formatNumber(t)}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r??(i?`right`:void 0),{formattedNumber:o}=this.formatNumber(this.max);return e.html`
|
|
1
|
+
require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/query.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const i=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),a=require("../base/UiKitElement.cjs"),o=require("../../decorators/customUiKitElement.cjs"),s=require("../../utils/booleanConverter.cjs"),c=require("../../utils/uiKitHtml.cjs"),l=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/class-map.cjs");const u=require("../../mixins/ViewportMixin.cjs"),d=require("../../utils/objectConverter.cjs"),f=require("../../utils/formatNumber/formatNumber.cjs");require("../ds-text-input/ds-text-input.cjs");const p=require("./utils/roundToDecimals/roundToDecimals.cjs"),m=require("./utils/getStepValue/getStepValue.cjs"),h=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/live.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/live.cjs");const g=require("./styles/common.styles.cjs");var _=class extends u.ViewportMixin(a.UiKitElement){constructor(...e){super(...e),this.variant=`primary`,this.min=0,this.max=100,this.minLabel=``,this.maxLabel=``,this.step=1,this.initialValueMin=0,this.mode=`light`,this.locale=void 0,this.localeMatcher=`lookup`,this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size=`medium`,this.disabled=!1,this.allowThumbOverlap=!1,this.keyboardMode=!1,this._initialValuesApplied=!1,this.getNewValue=e=>{let{width:t,left:n}=this.track.getBoundingClientRect(),r=this.thumbRadius,i=e.type.indexOf(`mouse`)===-1?e.touches[0].clientX:e.clientX,a=t-r*2,o=Math.min(Math.max(0,i-n-r),a),s=a>0?o*100/a:0;return this.min+s*(this.max-this.min)/100},this.setActiveThumb=e=>{let t=this.getNewValue(e);this.activeThumb=typeof this._valueMax!=`number`||t<=this._valueMin?`min`:t>=this._valueMax?`max`:t-this._valueMin<this._valueMax-t?`min`:`max`},this.handleMouseMove=e=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{let t=this.getNewValue(e),n=this.activeThumb??`min`,{stepValue:r}=this.computeStep({proposedValue:t,role:n});this.handleChange({value:r,role:n})})},this.handleMouseDown=e=>{var t,n,r,i;this.disabled||(e==null||(t=e.preventDefault)==null||t.call(e),this.setActiveThumb(e),this.handleMouseMove(e),(n=window)==null||n.addEventListener(`mousemove`,this.handleMouseMove),(r=window)==null||r.addEventListener(`touchmove`,this.handleMouseMove),(i=window)==null||i.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{var e,t,n;(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t);this.editingField=r,n.type=`number`,n.step=String(this.step??1);let i=r===`min`?this._valueMin:this._valueMax;n.value=String(i??``),this.keyboardMode&&n.classList.add(`focus-visible`)},this.commitInputValue=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t),{stepValue:i}=this.computeStep({proposedValue:Number(n.value),role:r}),a=p.roundToDecimals({value:i,fractionDigits:this.maximumFractionDigits});this.handleChange({value:a,role:r}),this.isControlled(r)||(n.value=String(a))},this.onInputBlur=e=>{var t;this.editingField=void 0;let n=e.currentTarget;n==null||(t=n.classList)==null||t.remove(`focus-visible`)},this.onInputKeyDown=(e,t)=>{e.key===`Enter`&&(e.preventDefault(),this.commitInputValue(e,t))},this.onThumbKeyDown=(e,t)=>{if(!this.disabled&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){e.preventDefault();let n=this.step??1,r=e.key===`ArrowLeft`?-n:n,i=this.getRoleById(t),a=i===`min`?this._valueMin:this._valueMax,{stepValue:o}=this.computeStep({proposedValue:a+r,role:i});this.handleChange({value:o,role:i})}}}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}get sliderSizeToTextInputSize(){var e;return(typeof this.size==`string`?this.size:(e=this.size)==null?void 0:e[this.viewport])===`large`?`large`:`medium`}isControlled(e){return typeof(e===`min`?this.valueMin:this.valueMax)==`number`}getRoleById(e){return e===1?`min`:`max`}get currentValues(){return{1:this._valueMin,...typeof this._valueMax==`number`?{2:this._valueMax}:{}}}computeStep({proposedValue:e,role:t}){return m.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:t,currentValues:this.currentValues,allowOverlap:this.allowThumbOverlap})}willUpdate(e){super.willUpdate(e),typeof this.valueMin==`number`&&(this._valueMin=this.valueMin),typeof this.valueMax==`number`&&(this._valueMax=this.valueMax),this._initialValuesApplied||(this._initialValuesApplied=!0,this.applyInitialValues())}disconnectedCallback(){var e,t,n,r,i,a;super.disconnectedCallback(),(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp),(r=window)==null||r.removeEventListener(`keydown`,this.handleKeydown),(i=window)==null||i.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),(a=window)==null||a.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){var t,n,r;super.firstUpdated(e),(t=window)==null||t.addEventListener(`keydown`,this.handleKeydown),(n=window)==null||n.addEventListener(`mousedown`,this.handlePointerOrMouseDown),(r=window)==null||r.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=e===`min`?`initialValueMin`:`initialValueMax`,n=this[t];if(typeof n!=`number`)return;let{stepValue:r}=this.computeStep({proposedValue:n,role:e}),i=e===`min`?`_valueMin`:`_valueMax`;this[i]!==r&&this.handleChange({value:r,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){var e;let t=(e=this.renderRoot)==null?void 0:e.querySelector(`.thumb`);return t?t.offsetWidth/2:0}trackPosition(e){let t=v.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${v.THUMB_RADIUS_CSS_VAR} * 2) * ${e/100})`}handleChange({value:e,role:t}){let n=p.roundToDecimals({value:e,fractionDigits:this.maximumFractionDigits}),r=t===`min`?`_valueMin`:`_valueMax`;this[r]!==n&&(this.isControlled(t)||(this[r]=n),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0,detail:{role:t,value:n}})))}formatNumber(e){let t={value:e,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return f.formatNumber(t)}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r??(i?`right`:void 0),{formattedNumber:o}=this.formatNumber(this.max);return e.html`
|
|
2
2
|
<div class="range-value-text">
|
|
3
3
|
${this.minLabel?e.html`<span class="range-value-label">${this.minLabel}</span>`:e.nothing}
|
|
4
4
|
${a===`left`?e.html`<span>${i}</span>`:e.nothing}
|
|
@@ -119,4 +119,4 @@ require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_mod
|
|
|
119
119
|
<div class="range-value-container">${this.rangeValuesTemplates}</div>
|
|
120
120
|
${t?e.nothing:this.inputsTemplate}
|
|
121
121
|
</div>
|
|
122
|
-
`}},v=_,y=(_.styles=[g.commonStyles,g.trackStyles,g.thumbStyles,g.currentValueStyles,g.rangeValueStyles,g.inputResetStyles],_.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`,_);i.default([t.property({type:String})],y.prototype,`variant`,void 0),i.default([t.property({type:Number})],y.prototype,`min`,void 0),i.default([t.property({type:Number})],y.prototype,`max`,void 0),i.default([t.property({type:String,attribute:`min-label`})],y.prototype,`minLabel`,void 0),i.default([t.property({type:String,attribute:`max-label`})],y.prototype,`maxLabel`,void 0),i.default([t.property({type:Number})],y.prototype,`step`,void 0),i.default([t.property({type:Number,attribute:`initial-value-min`})],y.prototype,`initialValueMin`,void 0),i.default([t.property({type:Number,attribute:`initial-value-max`})],y.prototype,`initialValueMax`,void 0),i.default([t.property({type:Number,attribute:`value-min`})],y.prototype,`valueMin`,void 0),i.default([t.property({type:Number,attribute:`value-max`})],y.prototype,`valueMax`,void 0),i.default([t.property({type:String,reflect:!0})],y.prototype,`mode`,void 0),i.default([t.property({type:String,attribute:`locale`})],y.prototype,`locale`,void 0),i.default([t.property({type:String,attribute:`locale-matcher`})],y.prototype,`localeMatcher`,void 0),i.default([t.property({type:String,attribute:`unit-symbol`})],y.prototype,`unitSymbol`,void 0),i.default([t.property({type:String,attribute:`unit-symbol-position`})],y.prototype,`unitSymbolPosition`,void 0),i.default([t.property({type:String,attribute:`unit-style`})],y.prototype,`unitStyle`,void 0),i.default([t.property({type:String,attribute:`currency`})],y.prototype,`currency`,void 0),i.default([t.property({type:String,attribute:`unit`})],y.prototype,`unit`,void 0),i.default([t.property({type:String,attribute:`use-grouping`,converter:e=>e===`auto`?`auto`:typeof e==`boolean`?e:e===`true`||e===``||e!==`false`})],y.prototype,`useGrouping`,void 0),i.default([t.property({type:Number,attribute:`minimum-integer-digits`})],y.prototype,`minimumIntegerDigits`,void 0),i.default([t.property({type:Number,attribute:`minimum-fraction-digits`})],y.prototype,`minimumFractionDigits`,void 0),i.default([t.property({type:Number,attribute:`maximum-fraction-digits`})],y.prototype,`maximumFractionDigits`,void 0),i.default([t.property({type:String,attribute:`thousand-separator`})],y.prototype,`thousandSeparator`,void 0),i.default([t.property({type:String,attribute:`fraction-separator`})],y.prototype,`fractionSeparator`,void 0),i.default([t.property({type:String,converter:d.objectConverter})],y.prototype,`size`,void 0),i.default([t.property({type:Boolean,converter:s.booleanConverter})],y.prototype,`disabled`,void 0),i.default([t.property({type:String,attribute:`input-min-aria-label`})],y.prototype,`inputMinAriaLabel`,void 0),i.default([t.property({type:String,attribute:`input-max-aria-label`})],y.prototype,`inputMaxAriaLabel`,void 0),i.default([r.query(`.track`)],y.prototype,`track`,void 0),i.default([n.state()],y.prototype,`_valueMin`,void 0),i.default([n.state()],y.prototype,`_valueMax`,void 0),i.default([n.state()],y.prototype,`editingField`,void 0),y=v=i.default([o.customUiKitElement(`ds-slider`)],y),Object.defineProperty(exports,"DsSlider",{enumerable:!0,get:function(){return y}});
|
|
122
|
+
`}},v=_,y=(_.styles=[g.commonStyles,g.trackStyles,g.thumbStyles,g.currentValueStyles,g.rangeValueStyles,g.inputResetStyles],_.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`,_);i.default([t.property({type:String})],y.prototype,`variant`,void 0),i.default([t.property({type:Number})],y.prototype,`min`,void 0),i.default([t.property({type:Number})],y.prototype,`max`,void 0),i.default([t.property({type:String,attribute:`min-label`})],y.prototype,`minLabel`,void 0),i.default([t.property({type:String,attribute:`max-label`})],y.prototype,`maxLabel`,void 0),i.default([t.property({type:Number})],y.prototype,`step`,void 0),i.default([t.property({type:Number,attribute:`initial-value-min`})],y.prototype,`initialValueMin`,void 0),i.default([t.property({type:Number,attribute:`initial-value-max`})],y.prototype,`initialValueMax`,void 0),i.default([t.property({type:Number,attribute:`value-min`})],y.prototype,`valueMin`,void 0),i.default([t.property({type:Number,attribute:`value-max`})],y.prototype,`valueMax`,void 0),i.default([t.property({type:String,reflect:!0})],y.prototype,`mode`,void 0),i.default([t.property({type:String,attribute:`locale`})],y.prototype,`locale`,void 0),i.default([t.property({type:String,attribute:`locale-matcher`})],y.prototype,`localeMatcher`,void 0),i.default([t.property({type:String,attribute:`unit-symbol`})],y.prototype,`unitSymbol`,void 0),i.default([t.property({type:String,attribute:`unit-symbol-position`})],y.prototype,`unitSymbolPosition`,void 0),i.default([t.property({type:String,attribute:`unit-style`})],y.prototype,`unitStyle`,void 0),i.default([t.property({type:String,attribute:`currency`})],y.prototype,`currency`,void 0),i.default([t.property({type:String,attribute:`unit`})],y.prototype,`unit`,void 0),i.default([t.property({type:String,attribute:`use-grouping`,converter:e=>e===`auto`?`auto`:typeof e==`boolean`?e:e===`true`||e===``||e!==`false`})],y.prototype,`useGrouping`,void 0),i.default([t.property({type:Number,attribute:`minimum-integer-digits`})],y.prototype,`minimumIntegerDigits`,void 0),i.default([t.property({type:Number,attribute:`minimum-fraction-digits`})],y.prototype,`minimumFractionDigits`,void 0),i.default([t.property({type:Number,attribute:`maximum-fraction-digits`})],y.prototype,`maximumFractionDigits`,void 0),i.default([t.property({type:String,attribute:`thousand-separator`})],y.prototype,`thousandSeparator`,void 0),i.default([t.property({type:String,attribute:`fraction-separator`})],y.prototype,`fractionSeparator`,void 0),i.default([t.property({type:String,converter:d.objectConverter})],y.prototype,`size`,void 0),i.default([t.property({type:Boolean,converter:s.booleanConverter})],y.prototype,`disabled`,void 0),i.default([t.property({type:String,attribute:`input-min-aria-label`})],y.prototype,`inputMinAriaLabel`,void 0),i.default([t.property({type:String,attribute:`input-max-aria-label`})],y.prototype,`inputMaxAriaLabel`,void 0),i.default([t.property({type:Boolean,attribute:`allow-thumb-overlap`,converter:s.booleanConverter})],y.prototype,`allowThumbOverlap`,void 0),i.default([r.query(`.track`)],y.prototype,`track`,void 0),i.default([n.state()],y.prototype,`_valueMin`,void 0),i.default([n.state()],y.prototype,`_valueMax`,void 0),i.default([n.state()],y.prototype,`editingField`,void 0),y=v=i.default([o.customUiKitElement(`ds-slider`)],y),Object.defineProperty(exports,"DsSlider",{enumerable:!0,get:function(){return y}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../roundToDecimals/roundToDecimals.cjs");var t=2**-52*4,n=(e,t,n)=>Math.min(Math.max(e,t),n),r=e=>{var t;let[n,r=`0`]=e.toString().split(`e`),i=((t=n.split(`.`)[1])==null?void 0:t.length)??0;return Math.max(0,i-Number(r))},i=({step:i=1,min:a=0,max:o=100,proposedValue:s,role:c,currentValues:l})=>{let
|
|
1
|
+
const e=require("../roundToDecimals/roundToDecimals.cjs");var t=2**-52*4,n=(e,t,n)=>Math.min(Math.max(e,t),n),r=e=>{var t;let[n,r=`0`]=e.toString().split(`e`),i=((t=n.split(`.`)[1])==null?void 0:t.length)??0;return Math.max(0,i-Number(r))},i=({step:i=1,min:a=0,max:o=100,proposedValue:s,role:c,currentValues:l,allowOverlap:u=!1})=>{let d=c===`min`?1:2,f=a,p=o;if(!Number.isFinite(s))return{stepValue:l[String(d)],minLimit:f,maxLimit:p};let m=Math.max(r(a),r(i)),h=t=>e.roundToDecimals({value:a+Math.max(0,t)*i,fractionDigits:m}),g=(e,n)=>Math.abs(e-n)<=t*Math.max(Math.abs(a),Math.abs(i),Math.abs(e),Math.abs(n));for(let[e,t]of Object.entries(l)){if(Number(e)<d&&t>=f){if(f=t,i===0||u)continue;let e=Math.round((t-a)/i),n=h(e);f=n>t&&!g(n,t)?n:h(e+1)}if(Number(e)>d&&t<=p){if(p=t,i===0||u)continue;let e=Math.round((t-a)/i),n=h(e);p=n<t&&!g(n,t)?n:h(e-1)}f=n(f,a,o),p=n(p,a,o)}if(i===0||s<=f||s>=p)return{stepValue:Math.max(f,Math.min(p,s)),minLimit:f,maxLimit:p};let _=e.roundToDecimals({value:f+Math.round((s-f)/i)*i,fractionDigits:Math.max(m,r(f))});return{stepValue:n(s-_>p-s?p:_,f,p),minLimit:f,maxLimit:p}};exports.getStepValue=i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const e=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/decorators/provide.cjs"),t=require("./themeContext.cjs");require("../../core/theme.constants.cjs");const n=require("../../utils/PubSub.cjs"),r=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs"),i=require("../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const s=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),c=require("../../decorators/customUiKitElement.cjs"),l=require("../../utils/booleanConverter.cjs"),u=require("../../styles/source/shared/fonts-config.cjs");var d=class extends i.LitElement{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.loadUnusedStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){if(super.updated(e),e.has(`theme`)){var t,r;n.pubSub.publish(`theme`,this.theme),(t=sessionStorage)==null||t.setItem(`@cupra/ui-kit/theme`,this.theme),typeof FontFace<`u`&&(r=document)!=null&&r.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))})}}loadThemeFonts(){var e;(e=u.fontsConfig[this.theme])==null||e.fonts.forEach(e=>{this.loadThemeFont(e)})}async loadThemeFont({weight:e,name:t,file:n}){if(!this.loadFonts)return Promise.resolve();let r=`${t}-${e}`;if(this.loadedFonts.has(r))return;let i=new FontFace(t,`url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff2') format('woff2'),
|
|
2
2
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff') format('woff'),
|
|
3
3
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.ttf') format('truetype'),
|
|
4
|
-
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.227`;return this.loadUnusedStyles&&this.applyUnusedStyles(e),this.loadStyles?new Promise((t,n)=>{let r=`https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))t();else{let i=`ui-kit-theme-${e}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>t(),o.onerror=()=>n(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a==null||a.remove()}}):Promise.resolve()}applyUnusedStyles(e){let t=`https://ds-assets.cupra.com${e}/styles/${this.theme}/unused-styles.css`;if(document.head.querySelector(`link[href="${t}"]`))return;let n=`ui-kit-unused-styles-${e}`,r=document.getElementById(n),i=document.createElement(`link`);i.id=n,i.rel=`preload`,i.as=`style`,i.href=t,i.onload=()=>{i.rel=`stylesheet`},document.head.appendChild(i),r==null||r.remove()}render(){return this.cssLoaded?r.html`<slot></slot>`:r.nothing}};s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-fonts`})],d.prototype,`loadFonts`,void 0),s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-styles`})],d.prototype,`loadStyles`,void 0),s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-unused-styles`})],d.prototype,`loadUnusedStyles`,void 0),s.default([e.provide({context:t.themeContext}),a.property({type:String})],d.prototype,`theme`,void 0),s.default([o.state()],d.prototype,`cssLoaded`,void 0),s.default([o.state()],d.prototype,`loadedFonts`,void 0),d=s.default([c.customUiKitElement(`ds-theme-provider`)],d),Object.defineProperty(exports,"DsThemeProvider",{enumerable:!0,get:function(){return d}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require("../utils/version.cjs");function e(e,t){return function(n){var r,i,a,o;if(!(n!=null&&n.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let s=e;if((r=globalThis)!=null&&(r=r.customElements)!=null&&r.get(s))return;let c=t!=null&&t.skipTagAsComponentName?[]:[e];Array.isArray(t==null?void 0:t.extendComponentNames)&&(c=[...t.extendComponentNames,...c]),(i=globalThis)==null||(i=i.customElements)==null||(a=i.define)==null||a.call(i,s,(o=class extends n{connectedCallback(){var t;(t=n.prototype.connectedCallback)==null||t.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.
|
|
1
|
+
require("../utils/version.cjs");function e(e,t){return function(n){var r,i,a,o;if(!(n!=null&&n.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let s=e;if((r=globalThis)!=null&&(r=r.customElements)!=null&&r.get(s))return;let c=t!=null&&t.skipTagAsComponentName?[]:[e];Array.isArray(t==null?void 0:t.extendComponentNames)&&(c=[...t.extendComponentNames,...c]),(i=globalThis)==null||(i=i.customElements)==null||(a=i.define)==null||a.call(i,s,(o=class extends n{connectedCallback(){var t;(t=n.prototype.connectedCallback)==null||t.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.227`),this.setAttribute(`data-ui-kit-component-name`,e)}},o.componentName=c,o))}}exports.customUiKitElement=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
1
|
+
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.227`),i=globalThis,a=i[r];a||(a=new n,Object.defineProperty(i,r,{value:a,writable:!1,configurable:!1,enumerable:!1}));var o=a;exports.iconsManager=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
1
|
+
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.227`),n=globalThis,r=n[t];r||(r=new e,Object.defineProperty(n,t,{value:r,writable:!1,configurable:!1,enumerable:!1}));var i=r;exports.PubSub=e,exports.pubSub=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.227/styles/${n}/components/${t}.css`,i=this.getCachedStyleSheetPromise({url:r});if(i)return i;let a=e(()=>this.fetchStyle({url:r})).then(e=>(e||this.stylePromises.delete(r),e));return this.stylePromises.set(r,a),this.stylePromises.get(r)}}async fetchStyle({url:e}){try{if(typeof fetch>`u`)return;let t=await fetch(e,{cache:`force-cache`});if(t.ok)return t.text()}catch(t){console.error(`Failed to fetch Style Sheet "${e}":`,t)}}getCachedStyleSheetPromise({url:e}){return this.stylePromises.get(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}}.getInstance();exports.stylesRegistry=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.227`,t=`--v${e.replaceAll(`.`,`-`)}`;exports.VERSION=e,exports.VERSION_TAG_SUFFIX=t;
|
|
@@ -249,7 +249,7 @@ var t = e`
|
|
|
249
249
|
flex-direction: column;
|
|
250
250
|
gap: var(--ds-spacing-m-1);
|
|
251
251
|
align-self: stretch;
|
|
252
|
-
border-radius: var(--ds-border-radius-
|
|
252
|
+
border-radius: var(--ds-border-radius-s);
|
|
253
253
|
border: var(--ds-border-width-m) solid var(--ds-color-border-default);
|
|
254
254
|
max-height: 75dvh;
|
|
255
255
|
overflow-y: scroll;
|
|
@@ -24,7 +24,7 @@ import { commonStyles as _, currentValueStyles as v, inputResetStyles as y, rang
|
|
|
24
24
|
//#region src/components/ds-slider/ds-slider.ts
|
|
25
25
|
var C = class extends d(o) {
|
|
26
26
|
constructor(...e) {
|
|
27
|
-
super(...e), this.variant = "primary", this.min = 0, this.max = 100, this.minLabel = "", this.maxLabel = "", this.step = 1, this.initialValueMin = 0, this.mode = "light", this.locale = void 0, this.localeMatcher = "lookup", this.useGrouping = !0, this.minimumIntegerDigits = 1, this.minimumFractionDigits = 0, this.maximumFractionDigits = 3, this.size = "medium", this.disabled = !1, this.keyboardMode = !1, this._initialValuesApplied = !1, this.getNewValue = (e) => {
|
|
27
|
+
super(...e), this.variant = "primary", this.min = 0, this.max = 100, this.minLabel = "", this.maxLabel = "", this.step = 1, this.initialValueMin = 0, this.mode = "light", this.locale = void 0, this.localeMatcher = "lookup", this.useGrouping = !0, this.minimumIntegerDigits = 1, this.minimumFractionDigits = 0, this.maximumFractionDigits = 3, this.size = "medium", this.disabled = !1, this.allowThumbOverlap = !1, this.keyboardMode = !1, this._initialValuesApplied = !1, this.getNewValue = (e) => {
|
|
28
28
|
let { width: t, left: n } = this.track.getBoundingClientRect(), r = this.thumbRadius, i = e.type.indexOf("mouse") === -1 ? e.touches[0].clientX : e.clientX, a = t - r * 2, o = Math.min(Math.max(0, i - n - r), a), s = a > 0 ? o * 100 / a : 0;
|
|
29
29
|
return this.min + s * (this.max - this.min) / 100;
|
|
30
30
|
}, this.setActiveThumb = (e) => {
|
|
@@ -115,7 +115,8 @@ var C = class extends d(o) {
|
|
|
115
115
|
max: this.max,
|
|
116
116
|
proposedValue: e,
|
|
117
117
|
role: t,
|
|
118
|
-
currentValues: this.currentValues
|
|
118
|
+
currentValues: this.currentValues,
|
|
119
|
+
allowOverlap: this.allowThumbOverlap
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
willUpdate(e) {
|
|
@@ -445,6 +446,10 @@ a([n({ type: String })], T.prototype, "variant", void 0), a([n({ type: Number })
|
|
|
445
446
|
})], T.prototype, "inputMinAriaLabel", void 0), a([n({
|
|
446
447
|
type: String,
|
|
447
448
|
attribute: "input-max-aria-label"
|
|
448
|
-
})], T.prototype, "inputMaxAriaLabel", void 0), a([
|
|
449
|
+
})], T.prototype, "inputMaxAriaLabel", void 0), a([n({
|
|
450
|
+
type: Boolean,
|
|
451
|
+
attribute: "allow-thumb-overlap",
|
|
452
|
+
converter: c
|
|
453
|
+
})], T.prototype, "allowThumbOverlap", void 0), a([i(".track")], T.prototype, "track", void 0), a([r()], T.prototype, "_valueMin", void 0), a([r()], T.prototype, "_valueMax", void 0), a([r()], T.prototype, "editingField", void 0), T = w = a([s("ds-slider")], T);
|
|
449
454
|
//#endregion
|
|
450
455
|
export { T as DsSlider };
|
|
@@ -4,43 +4,43 @@ var t = 2 ** -52 * 4, n = (e, t, n) => Math.min(Math.max(e, t), n), r = (e) => {
|
|
|
4
4
|
var t;
|
|
5
5
|
let [n, r = "0"] = e.toString().split("e"), i = ((t = n.split(".")[1]) == null ? void 0 : t.length) ?? 0;
|
|
6
6
|
return Math.max(0, i - Number(r));
|
|
7
|
-
}, i = ({ step: i = 1, min: a = 0, max: o = 100, proposedValue: s, role: c, currentValues: l }) => {
|
|
8
|
-
let
|
|
7
|
+
}, i = ({ step: i = 1, min: a = 0, max: o = 100, proposedValue: s, role: c, currentValues: l, allowOverlap: u = !1 }) => {
|
|
8
|
+
let d = c === "min" ? 1 : 2, f = a, p = o;
|
|
9
9
|
if (!Number.isFinite(s)) return {
|
|
10
|
-
stepValue: l[String(
|
|
11
|
-
minLimit:
|
|
12
|
-
maxLimit:
|
|
10
|
+
stepValue: l[String(d)],
|
|
11
|
+
minLimit: f,
|
|
12
|
+
maxLimit: p
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let m = Math.max(r(a), r(i)), h = (t) => e({
|
|
15
15
|
value: a + Math.max(0, t) * i,
|
|
16
|
-
fractionDigits:
|
|
17
|
-
}),
|
|
16
|
+
fractionDigits: m
|
|
17
|
+
}), g = (e, n) => Math.abs(e - n) <= t * Math.max(Math.abs(a), Math.abs(i), Math.abs(e), Math.abs(n));
|
|
18
18
|
for (let [e, t] of Object.entries(l)) {
|
|
19
|
-
if (Number(e) <
|
|
20
|
-
if (
|
|
21
|
-
let e = Math.round((t - a) / i), n =
|
|
22
|
-
|
|
19
|
+
if (Number(e) < d && t >= f) {
|
|
20
|
+
if (f = t, i === 0 || u) continue;
|
|
21
|
+
let e = Math.round((t - a) / i), n = h(e);
|
|
22
|
+
f = n > t && !g(n, t) ? n : h(e + 1);
|
|
23
23
|
}
|
|
24
|
-
if (Number(e) >
|
|
25
|
-
if (
|
|
26
|
-
let e = Math.round((t - a) / i), n =
|
|
27
|
-
|
|
24
|
+
if (Number(e) > d && t <= p) {
|
|
25
|
+
if (p = t, i === 0 || u) continue;
|
|
26
|
+
let e = Math.round((t - a) / i), n = h(e);
|
|
27
|
+
p = n < t && !g(n, t) ? n : h(e - 1);
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
f = n(f, a, o), p = n(p, a, o);
|
|
30
30
|
}
|
|
31
|
-
if (i === 0 || s <=
|
|
32
|
-
stepValue: Math.max(
|
|
33
|
-
minLimit:
|
|
34
|
-
maxLimit:
|
|
31
|
+
if (i === 0 || s <= f || s >= p) return {
|
|
32
|
+
stepValue: Math.max(f, Math.min(p, s)),
|
|
33
|
+
minLimit: f,
|
|
34
|
+
maxLimit: p
|
|
35
35
|
};
|
|
36
|
-
let
|
|
37
|
-
value:
|
|
38
|
-
fractionDigits: Math.max(
|
|
36
|
+
let _ = e({
|
|
37
|
+
value: f + Math.round((s - f) / i) * i,
|
|
38
|
+
fractionDigits: Math.max(m, r(f))
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
stepValue: n(s -
|
|
42
|
-
minLimit:
|
|
43
|
-
maxLimit:
|
|
41
|
+
stepValue: n(s - _ > p - s ? p : _, f, p),
|
|
42
|
+
minLimit: f,
|
|
43
|
+
maxLimit: p
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -53,7 +53,7 @@ var f = class extends a {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
loadThemeStyles() {
|
|
56
|
-
let e = "/2.0.0-canary.
|
|
56
|
+
let e = "/2.0.0-canary.227";
|
|
57
57
|
return this.loadUnusedStyles && this.applyUnusedStyles(e), this.loadStyles ? new Promise((t, n) => {
|
|
58
58
|
let r = `https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;
|
|
59
59
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
@@ -10,7 +10,7 @@ function e(e, t) {
|
|
|
10
10
|
Array.isArray(t == null ? void 0 : t.extendComponentNames) && (c = [...t.extendComponentNames, ...c]), (i = globalThis) == null || (i = i.customElements) == null || (a = i.define) == null || a.call(i, s, (o = class extends n {
|
|
11
11
|
connectedCallback() {
|
|
12
12
|
var t;
|
|
13
|
-
(t = n.prototype.connectedCallback) == null || t.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.
|
|
13
|
+
(t = n.prototype.connectedCallback) == null || t.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.227"), this.setAttribute("data-ui-kit-component-name", e);
|
|
14
14
|
}
|
|
15
15
|
}, o.componentName = c, o));
|
|
16
16
|
};
|
|
@@ -26,7 +26,7 @@ var n = class {
|
|
|
26
26
|
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
27
27
|
}), t.subscribe("theme", this.handleChangeTheme);
|
|
28
28
|
}
|
|
29
|
-
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
29
|
+
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.227"), i = globalThis, a = i[r];
|
|
30
30
|
a || (a = new n(), Object.defineProperty(i, r, {
|
|
31
31
|
value: a,
|
|
32
32
|
writable: !1,
|
package/dist/esm/utils/PubSub.js
CHANGED
|
@@ -18,7 +18,7 @@ var e = class {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
21
|
+
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.227"), n = globalThis, r = n[t];
|
|
22
22
|
r || (r = new e(), Object.defineProperty(n, t, {
|
|
23
23
|
value: r,
|
|
24
24
|
writable: !1,
|
|
@@ -4,7 +4,7 @@ var t = e(20), n = class e {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
this.stylePromises = /* @__PURE__ */ new Map(), this.getStyles = async ({ componentName: e, theme: n }) => {
|
|
6
6
|
if (!n || !e) return;
|
|
7
|
-
let r = `https://ds-assets.cupra.com/2.0.0-canary.
|
|
7
|
+
let r = `https://ds-assets.cupra.com/2.0.0-canary.227/styles/${n}/components/${e}.css`, i = this.getCachedStyleSheetPromise({ url: r });
|
|
8
8
|
if (i) return i;
|
|
9
9
|
let a = t(() => this.fetchStyle({ url: r })).then((e) => (e || this.stylePromises.delete(r), e));
|
|
10
10
|
return this.stylePromises.set(r, a), this.stylePromises.get(r);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { CommonAttrs } from '../../types/types';
|
|
2
|
+
type Size = 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall' | 'xxsmall';
|
|
3
|
+
type Mode = 'dark' | 'light';
|
|
2
4
|
export type DsLogoAttrs = {
|
|
3
|
-
size?:
|
|
4
|
-
mode?:
|
|
5
|
+
size?: Size;
|
|
6
|
+
mode?: Mode;
|
|
5
7
|
} & CommonAttrs;
|
|
8
|
+
export {};
|
|
@@ -33,6 +33,7 @@ export declare class DsSlider extends DsSlider_base {
|
|
|
33
33
|
disabled: DsSliderAttrs['disabled'];
|
|
34
34
|
inputMinAriaLabel: DsSliderAttrs['input-min-aria-label'];
|
|
35
35
|
inputMaxAriaLabel: DsSliderAttrs['input-max-aria-label'];
|
|
36
|
+
allowThumbOverlap: DsSliderAttrs['allow-thumb-overlap'];
|
|
36
37
|
protected track: HTMLInputElement;
|
|
37
38
|
protected _valueMin: number;
|
|
38
39
|
protected _valueMax: number;
|
|
@@ -246,7 +246,7 @@ const e=require("../../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_mo
|
|
|
246
246
|
flex-direction: column;
|
|
247
247
|
gap: var(--ds-spacing-m-1);
|
|
248
248
|
align-self: stretch;
|
|
249
|
-
border-radius: var(--ds-border-radius-
|
|
249
|
+
border-radius: var(--ds-border-radius-s);
|
|
250
250
|
border: var(--ds-border-width-m) solid var(--ds-color-border-default);
|
|
251
251
|
max-height: 75dvh;
|
|
252
252
|
overflow-y: scroll;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/query.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const i=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),a=require("../base/UiKitElement.cjs"),o=require("../../decorators/customUiKitElement.cjs"),s=require("../../utils/booleanConverter.cjs"),c=require("../../utils/uiKitHtml.cjs"),l=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/class-map.cjs");const u=require("../../mixins/ViewportMixin.cjs"),d=require("../../utils/objectConverter.cjs"),f=require("../../utils/formatNumber/formatNumber.cjs");require("../ds-text-input/ds-text-input.cjs");const p=require("./utils/roundToDecimals/roundToDecimals.cjs"),m=require("./utils/getStepValue/getStepValue.cjs"),h=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/live.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/live.cjs");const g=require("./styles/common.styles.cjs");var _=class extends u.ViewportMixin(a.UiKitElement){constructor(...e){super(...e),this.variant=`primary`,this.min=0,this.max=100,this.minLabel=``,this.maxLabel=``,this.step=1,this.initialValueMin=0,this.mode=`light`,this.locale=void 0,this.localeMatcher=`lookup`,this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size=`medium`,this.disabled=!1,this.keyboardMode=!1,this._initialValuesApplied=!1,this.getNewValue=e=>{let{width:t,left:n}=this.track.getBoundingClientRect(),r=this.thumbRadius,i=e.type.indexOf(`mouse`)===-1?e.touches[0].clientX:e.clientX,a=t-r*2,o=Math.min(Math.max(0,i-n-r),a),s=a>0?o*100/a:0;return this.min+s*(this.max-this.min)/100},this.setActiveThumb=e=>{let t=this.getNewValue(e);this.activeThumb=typeof this._valueMax!=`number`||t<=this._valueMin?`min`:t>=this._valueMax?`max`:t-this._valueMin<this._valueMax-t?`min`:`max`},this.handleMouseMove=e=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{let t=this.getNewValue(e),n=this.activeThumb??`min`,{stepValue:r}=this.computeStep({proposedValue:t,role:n});this.handleChange({value:r,role:n})})},this.handleMouseDown=e=>{var t,n,r,i;this.disabled||(e==null||(t=e.preventDefault)==null||t.call(e),this.setActiveThumb(e),this.handleMouseMove(e),(n=window)==null||n.addEventListener(`mousemove`,this.handleMouseMove),(r=window)==null||r.addEventListener(`touchmove`,this.handleMouseMove),(i=window)==null||i.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{var e,t,n;(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t);this.editingField=r,n.type=`number`,n.step=String(this.step??1);let i=r===`min`?this._valueMin:this._valueMax;n.value=String(i??``),this.keyboardMode&&n.classList.add(`focus-visible`)},this.commitInputValue=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t),{stepValue:i}=this.computeStep({proposedValue:Number(n.value),role:r}),a=p.roundToDecimals({value:i,fractionDigits:this.maximumFractionDigits});this.handleChange({value:a,role:r}),this.isControlled(r)||(n.value=String(a))},this.onInputBlur=e=>{var t;this.editingField=void 0;let n=e.currentTarget;n==null||(t=n.classList)==null||t.remove(`focus-visible`)},this.onInputKeyDown=(e,t)=>{e.key===`Enter`&&(e.preventDefault(),this.commitInputValue(e,t))},this.onThumbKeyDown=(e,t)=>{if(!this.disabled&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){e.preventDefault();let n=this.step??1,r=e.key===`ArrowLeft`?-n:n,i=this.getRoleById(t),a=i===`min`?this._valueMin:this._valueMax,{stepValue:o}=this.computeStep({proposedValue:a+r,role:i});this.handleChange({value:o,role:i})}}}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}get sliderSizeToTextInputSize(){var e;return(typeof this.size==`string`?this.size:(e=this.size)==null?void 0:e[this.viewport])===`large`?`large`:`medium`}isControlled(e){return typeof(e===`min`?this.valueMin:this.valueMax)==`number`}getRoleById(e){return e===1?`min`:`max`}get currentValues(){return{1:this._valueMin,...typeof this._valueMax==`number`?{2:this._valueMax}:{}}}computeStep({proposedValue:e,role:t}){return m.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:t,currentValues:this.currentValues})}willUpdate(e){super.willUpdate(e),typeof this.valueMin==`number`&&(this._valueMin=this.valueMin),typeof this.valueMax==`number`&&(this._valueMax=this.valueMax),this._initialValuesApplied||(this._initialValuesApplied=!0,this.applyInitialValues())}disconnectedCallback(){var e,t,n,r,i,a;super.disconnectedCallback(),(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp),(r=window)==null||r.removeEventListener(`keydown`,this.handleKeydown),(i=window)==null||i.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),(a=window)==null||a.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){var t,n,r;super.firstUpdated(e),(t=window)==null||t.addEventListener(`keydown`,this.handleKeydown),(n=window)==null||n.addEventListener(`mousedown`,this.handlePointerOrMouseDown),(r=window)==null||r.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=e===`min`?`initialValueMin`:`initialValueMax`,n=this[t];if(typeof n!=`number`)return;let{stepValue:r}=this.computeStep({proposedValue:n,role:e}),i=e===`min`?`_valueMin`:`_valueMax`;this[i]!==r&&this.handleChange({value:r,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){var e;let t=(e=this.renderRoot)==null?void 0:e.querySelector(`.thumb`);return t?t.offsetWidth/2:0}trackPosition(e){let t=v.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${v.THUMB_RADIUS_CSS_VAR} * 2) * ${e/100})`}handleChange({value:e,role:t}){let n=p.roundToDecimals({value:e,fractionDigits:this.maximumFractionDigits}),r=t===`min`?`_valueMin`:`_valueMax`;this[r]!==n&&(this.isControlled(t)||(this[r]=n),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0,detail:{role:t,value:n}})))}formatNumber(e){let t={value:e,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return f.formatNumber(t)}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r??(i?`right`:void 0),{formattedNumber:o}=this.formatNumber(this.max);return e.html`
|
|
1
|
+
require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const t=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),n=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),r=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/query.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const i=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),a=require("../base/UiKitElement.cjs"),o=require("../../decorators/customUiKitElement.cjs"),s=require("../../utils/booleanConverter.cjs"),c=require("../../utils/uiKitHtml.cjs"),l=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/class-map.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/class-map.cjs");const u=require("../../mixins/ViewportMixin.cjs"),d=require("../../utils/objectConverter.cjs"),f=require("../../utils/formatNumber/formatNumber.cjs");require("../ds-text-input/ds-text-input.cjs");const p=require("./utils/roundToDecimals/roundToDecimals.cjs"),m=require("./utils/getStepValue/getStepValue.cjs"),h=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/live.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/directives/live.cjs");const g=require("./styles/common.styles.cjs");var _=class extends u.ViewportMixin(a.UiKitElement){constructor(...e){super(...e),this.variant=`primary`,this.min=0,this.max=100,this.minLabel=``,this.maxLabel=``,this.step=1,this.initialValueMin=0,this.mode=`light`,this.locale=void 0,this.localeMatcher=`lookup`,this.useGrouping=!0,this.minimumIntegerDigits=1,this.minimumFractionDigits=0,this.maximumFractionDigits=3,this.size=`medium`,this.disabled=!1,this.allowThumbOverlap=!1,this.keyboardMode=!1,this._initialValuesApplied=!1,this.getNewValue=e=>{let{width:t,left:n}=this.track.getBoundingClientRect(),r=this.thumbRadius,i=e.type.indexOf(`mouse`)===-1?e.touches[0].clientX:e.clientX,a=t-r*2,o=Math.min(Math.max(0,i-n-r),a),s=a>0?o*100/a:0;return this.min+s*(this.max-this.min)/100},this.setActiveThumb=e=>{let t=this.getNewValue(e);this.activeThumb=typeof this._valueMax!=`number`||t<=this._valueMin?`min`:t>=this._valueMax?`max`:t-this._valueMin<this._valueMax-t?`min`:`max`},this.handleMouseMove=e=>{this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest),this.animationFrameRequest=requestAnimationFrame(()=>{let t=this.getNewValue(e),n=this.activeThumb??`min`,{stepValue:r}=this.computeStep({proposedValue:t,role:n});this.handleChange({value:r,role:n})})},this.handleMouseDown=e=>{var t,n,r,i;this.disabled||(e==null||(t=e.preventDefault)==null||t.call(e),this.setActiveThumb(e),this.handleMouseMove(e),(n=window)==null||n.addEventListener(`mousemove`,this.handleMouseMove),(r=window)==null||r.addEventListener(`touchmove`,this.handleMouseMove),(i=window)==null||i.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{var e,t,n;(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp)},this.handleKeydown=()=>{this.keyboardMode=!0},this.handlePointerOrMouseDown=()=>{this.keyboardMode=!1},this.onInputFocus=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t);this.editingField=r,n.type=`number`,n.step=String(this.step??1);let i=r===`min`?this._valueMin:this._valueMax;n.value=String(i??``),this.keyboardMode&&n.classList.add(`focus-visible`)},this.commitInputValue=(e,t)=>{let n=e.currentTarget,r=this.getRoleById(t),{stepValue:i}=this.computeStep({proposedValue:Number(n.value),role:r}),a=p.roundToDecimals({value:i,fractionDigits:this.maximumFractionDigits});this.handleChange({value:a,role:r}),this.isControlled(r)||(n.value=String(a))},this.onInputBlur=e=>{var t;this.editingField=void 0;let n=e.currentTarget;n==null||(t=n.classList)==null||t.remove(`focus-visible`)},this.onInputKeyDown=(e,t)=>{e.key===`Enter`&&(e.preventDefault(),this.commitInputValue(e,t))},this.onThumbKeyDown=(e,t)=>{if(!this.disabled&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){e.preventDefault();let n=this.step??1,r=e.key===`ArrowLeft`?-n:n,i=this.getRoleById(t),a=i===`min`?this._valueMin:this._valueMax,{stepValue:o}=this.computeStep({proposedValue:a+r,role:i});this.handleChange({value:o,role:i})}}}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}get sliderSizeToTextInputSize(){var e;return(typeof this.size==`string`?this.size:(e=this.size)==null?void 0:e[this.viewport])===`large`?`large`:`medium`}isControlled(e){return typeof(e===`min`?this.valueMin:this.valueMax)==`number`}getRoleById(e){return e===1?`min`:`max`}get currentValues(){return{1:this._valueMin,...typeof this._valueMax==`number`?{2:this._valueMax}:{}}}computeStep({proposedValue:e,role:t}){return m.getStepValue({step:this.step,min:this.min,max:this.max,proposedValue:e,role:t,currentValues:this.currentValues,allowOverlap:this.allowThumbOverlap})}willUpdate(e){super.willUpdate(e),typeof this.valueMin==`number`&&(this._valueMin=this.valueMin),typeof this.valueMax==`number`&&(this._valueMax=this.valueMax),this._initialValuesApplied||(this._initialValuesApplied=!0,this.applyInitialValues())}disconnectedCallback(){var e,t,n,r,i,a;super.disconnectedCallback(),(e=window)==null||e.removeEventListener(`mousemove`,this.handleMouseMove),(t=window)==null||t.removeEventListener(`touchmove`,this.handleMouseMove),(n=window)==null||n.removeEventListener(`pointerup`,this.handlePointerUp),(r=window)==null||r.removeEventListener(`keydown`,this.handleKeydown),(i=window)==null||i.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),(a=window)==null||a.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){var t,n,r;super.firstUpdated(e),(t=window)==null||t.addEventListener(`keydown`,this.handleKeydown),(n=window)==null||n.addEventListener(`mousedown`,this.handlePointerOrMouseDown),(r=window)==null||r.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=e===`min`?`initialValueMin`:`initialValueMax`,n=this[t];if(typeof n!=`number`)return;let{stepValue:r}=this.computeStep({proposedValue:n,role:e}),i=e===`min`?`_valueMin`:`_valueMax`;this[i]!==r&&this.handleChange({value:r,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){var e;let t=(e=this.renderRoot)==null?void 0:e.querySelector(`.thumb`);return t?t.offsetWidth/2:0}trackPosition(e){let t=v.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${v.THUMB_RADIUS_CSS_VAR} * 2) * ${e/100})`}handleChange({value:e,role:t}){let n=p.roundToDecimals({value:e,fractionDigits:this.maximumFractionDigits}),r=t===`min`?`_valueMin`:`_valueMax`;this[r]!==n&&(this.isControlled(t)||(this[r]=n),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0,detail:{role:t,value:n}})))}formatNumber(e){let t={value:e,locale:this.locale,...this.unitStyle&&{style:this.unitStyle},...this.currency&&{currency:this.currency},...this.unit&&{unit:this.unit},localeMatcher:this.localeMatcher,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,thousandSeparator:this.thousandSeparator,fractionSeparator:this.fractionSeparator,useGrouping:this.useGrouping};return f.formatNumber(t)}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r??(i?`right`:void 0),{formattedNumber:o}=this.formatNumber(this.max);return e.html`
|
|
2
2
|
<div class="range-value-text">
|
|
3
3
|
${this.minLabel?e.html`<span class="range-value-label">${this.minLabel}</span>`:e.nothing}
|
|
4
4
|
${a===`left`?e.html`<span>${i}</span>`:e.nothing}
|
|
@@ -119,4 +119,4 @@ require("../ds-theme-provider/themeContext.cjs");const e=require("../../node_mod
|
|
|
119
119
|
<div class="range-value-container">${this.rangeValuesTemplates}</div>
|
|
120
120
|
${t?e.nothing:this.inputsTemplate}
|
|
121
121
|
</div>
|
|
122
|
-
`}},v=_,y=(_.styles=[g.commonStyles,g.trackStyles,g.thumbStyles,g.currentValueStyles,g.rangeValueStyles,g.inputResetStyles],_.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`,_);i.default([t.property({type:String})],y.prototype,`variant`,void 0),i.default([t.property({type:Number})],y.prototype,`min`,void 0),i.default([t.property({type:Number})],y.prototype,`max`,void 0),i.default([t.property({type:String,attribute:`min-label`})],y.prototype,`minLabel`,void 0),i.default([t.property({type:String,attribute:`max-label`})],y.prototype,`maxLabel`,void 0),i.default([t.property({type:Number})],y.prototype,`step`,void 0),i.default([t.property({type:Number,attribute:`initial-value-min`})],y.prototype,`initialValueMin`,void 0),i.default([t.property({type:Number,attribute:`initial-value-max`})],y.prototype,`initialValueMax`,void 0),i.default([t.property({type:Number,attribute:`value-min`})],y.prototype,`valueMin`,void 0),i.default([t.property({type:Number,attribute:`value-max`})],y.prototype,`valueMax`,void 0),i.default([t.property({type:String,reflect:!0})],y.prototype,`mode`,void 0),i.default([t.property({type:String,attribute:`locale`})],y.prototype,`locale`,void 0),i.default([t.property({type:String,attribute:`locale-matcher`})],y.prototype,`localeMatcher`,void 0),i.default([t.property({type:String,attribute:`unit-symbol`})],y.prototype,`unitSymbol`,void 0),i.default([t.property({type:String,attribute:`unit-symbol-position`})],y.prototype,`unitSymbolPosition`,void 0),i.default([t.property({type:String,attribute:`unit-style`})],y.prototype,`unitStyle`,void 0),i.default([t.property({type:String,attribute:`currency`})],y.prototype,`currency`,void 0),i.default([t.property({type:String,attribute:`unit`})],y.prototype,`unit`,void 0),i.default([t.property({type:String,attribute:`use-grouping`,converter:e=>e===`auto`?`auto`:typeof e==`boolean`?e:e===`true`||e===``||e!==`false`})],y.prototype,`useGrouping`,void 0),i.default([t.property({type:Number,attribute:`minimum-integer-digits`})],y.prototype,`minimumIntegerDigits`,void 0),i.default([t.property({type:Number,attribute:`minimum-fraction-digits`})],y.prototype,`minimumFractionDigits`,void 0),i.default([t.property({type:Number,attribute:`maximum-fraction-digits`})],y.prototype,`maximumFractionDigits`,void 0),i.default([t.property({type:String,attribute:`thousand-separator`})],y.prototype,`thousandSeparator`,void 0),i.default([t.property({type:String,attribute:`fraction-separator`})],y.prototype,`fractionSeparator`,void 0),i.default([t.property({type:String,converter:d.objectConverter})],y.prototype,`size`,void 0),i.default([t.property({type:Boolean,converter:s.booleanConverter})],y.prototype,`disabled`,void 0),i.default([t.property({type:String,attribute:`input-min-aria-label`})],y.prototype,`inputMinAriaLabel`,void 0),i.default([t.property({type:String,attribute:`input-max-aria-label`})],y.prototype,`inputMaxAriaLabel`,void 0),i.default([r.query(`.track`)],y.prototype,`track`,void 0),i.default([n.state()],y.prototype,`_valueMin`,void 0),i.default([n.state()],y.prototype,`_valueMax`,void 0),i.default([n.state()],y.prototype,`editingField`,void 0),y=v=i.default([o.customUiKitElement(`ds-slider`)],y),Object.defineProperty(exports,"DsSlider",{enumerable:!0,get:function(){return y}});
|
|
122
|
+
`}},v=_,y=(_.styles=[g.commonStyles,g.trackStyles,g.thumbStyles,g.currentValueStyles,g.rangeValueStyles,g.inputResetStyles],_.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`,_);i.default([t.property({type:String})],y.prototype,`variant`,void 0),i.default([t.property({type:Number})],y.prototype,`min`,void 0),i.default([t.property({type:Number})],y.prototype,`max`,void 0),i.default([t.property({type:String,attribute:`min-label`})],y.prototype,`minLabel`,void 0),i.default([t.property({type:String,attribute:`max-label`})],y.prototype,`maxLabel`,void 0),i.default([t.property({type:Number})],y.prototype,`step`,void 0),i.default([t.property({type:Number,attribute:`initial-value-min`})],y.prototype,`initialValueMin`,void 0),i.default([t.property({type:Number,attribute:`initial-value-max`})],y.prototype,`initialValueMax`,void 0),i.default([t.property({type:Number,attribute:`value-min`})],y.prototype,`valueMin`,void 0),i.default([t.property({type:Number,attribute:`value-max`})],y.prototype,`valueMax`,void 0),i.default([t.property({type:String,reflect:!0})],y.prototype,`mode`,void 0),i.default([t.property({type:String,attribute:`locale`})],y.prototype,`locale`,void 0),i.default([t.property({type:String,attribute:`locale-matcher`})],y.prototype,`localeMatcher`,void 0),i.default([t.property({type:String,attribute:`unit-symbol`})],y.prototype,`unitSymbol`,void 0),i.default([t.property({type:String,attribute:`unit-symbol-position`})],y.prototype,`unitSymbolPosition`,void 0),i.default([t.property({type:String,attribute:`unit-style`})],y.prototype,`unitStyle`,void 0),i.default([t.property({type:String,attribute:`currency`})],y.prototype,`currency`,void 0),i.default([t.property({type:String,attribute:`unit`})],y.prototype,`unit`,void 0),i.default([t.property({type:String,attribute:`use-grouping`,converter:e=>e===`auto`?`auto`:typeof e==`boolean`?e:e===`true`||e===``||e!==`false`})],y.prototype,`useGrouping`,void 0),i.default([t.property({type:Number,attribute:`minimum-integer-digits`})],y.prototype,`minimumIntegerDigits`,void 0),i.default([t.property({type:Number,attribute:`minimum-fraction-digits`})],y.prototype,`minimumFractionDigits`,void 0),i.default([t.property({type:Number,attribute:`maximum-fraction-digits`})],y.prototype,`maximumFractionDigits`,void 0),i.default([t.property({type:String,attribute:`thousand-separator`})],y.prototype,`thousandSeparator`,void 0),i.default([t.property({type:String,attribute:`fraction-separator`})],y.prototype,`fractionSeparator`,void 0),i.default([t.property({type:String,converter:d.objectConverter})],y.prototype,`size`,void 0),i.default([t.property({type:Boolean,converter:s.booleanConverter})],y.prototype,`disabled`,void 0),i.default([t.property({type:String,attribute:`input-min-aria-label`})],y.prototype,`inputMinAriaLabel`,void 0),i.default([t.property({type:String,attribute:`input-max-aria-label`})],y.prototype,`inputMaxAriaLabel`,void 0),i.default([t.property({type:Boolean,attribute:`allow-thumb-overlap`,converter:s.booleanConverter})],y.prototype,`allowThumbOverlap`,void 0),i.default([r.query(`.track`)],y.prototype,`track`,void 0),i.default([n.state()],y.prototype,`_valueMin`,void 0),i.default([n.state()],y.prototype,`_valueMax`,void 0),i.default([n.state()],y.prototype,`editingField`,void 0),y=v=i.default([o.customUiKitElement(`ds-slider`)],y),Object.defineProperty(exports,"DsSlider",{enumerable:!0,get:function(){return y}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../roundToDecimals/roundToDecimals.cjs");var t=2**-52*4,n=(e,t,n)=>Math.min(Math.max(e,t),n),r=e=>{var t;let[n,r=`0`]=e.toString().split(`e`),i=((t=n.split(`.`)[1])==null?void 0:t.length)??0;return Math.max(0,i-Number(r))},i=({step:i=1,min:a=0,max:o=100,proposedValue:s,role:c,currentValues:l})=>{let
|
|
1
|
+
const e=require("../roundToDecimals/roundToDecimals.cjs");var t=2**-52*4,n=(e,t,n)=>Math.min(Math.max(e,t),n),r=e=>{var t;let[n,r=`0`]=e.toString().split(`e`),i=((t=n.split(`.`)[1])==null?void 0:t.length)??0;return Math.max(0,i-Number(r))},i=({step:i=1,min:a=0,max:o=100,proposedValue:s,role:c,currentValues:l,allowOverlap:u=!1})=>{let d=c===`min`?1:2,f=a,p=o;if(!Number.isFinite(s))return{stepValue:l[String(d)],minLimit:f,maxLimit:p};let m=Math.max(r(a),r(i)),h=t=>e.roundToDecimals({value:a+Math.max(0,t)*i,fractionDigits:m}),g=(e,n)=>Math.abs(e-n)<=t*Math.max(Math.abs(a),Math.abs(i),Math.abs(e),Math.abs(n));for(let[e,t]of Object.entries(l)){if(Number(e)<d&&t>=f){if(f=t,i===0||u)continue;let e=Math.round((t-a)/i),n=h(e);f=n>t&&!g(n,t)?n:h(e+1)}if(Number(e)>d&&t<=p){if(p=t,i===0||u)continue;let e=Math.round((t-a)/i),n=h(e);p=n<t&&!g(n,t)?n:h(e-1)}f=n(f,a,o),p=n(p,a,o)}if(i===0||s<=f||s>=p)return{stepValue:Math.max(f,Math.min(p,s)),minLimit:f,maxLimit:p};let _=e.roundToDecimals({value:f+Math.round((s-f)/i)*i,fractionDigits:Math.max(m,r(f))});return{stepValue:n(s-_>p-s?p:_,f,p),minLimit:f,maxLimit:p}};exports.getStepValue=i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const e=require("../../node_modules/.pnpm/@lit_context@1.1.6/node_modules/@lit/context/lib/decorators/provide.cjs"),t=require("./themeContext.cjs");require("../../core/theme.constants.cjs");const n=require("../../utils/PubSub.cjs"),r=require("../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.cjs"),i=require("../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/index.cjs");const a=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs");require("../../node_modules/.pnpm/lit@3.3.3/node_modules/lit/decorators.cjs");const s=require("../../_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/decorate.cjs"),c=require("../../decorators/customUiKitElement.cjs"),l=require("../../utils/booleanConverter.cjs"),u=require("../../styles/source/shared/fonts-config.cjs");var d=class extends i.LitElement{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.loadUnusedStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){if(super.updated(e),e.has(`theme`)){var t,r;n.pubSub.publish(`theme`,this.theme),(t=sessionStorage)==null||t.setItem(`@cupra/ui-kit/theme`,this.theme),typeof FontFace<`u`&&(r=document)!=null&&r.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))})}}loadThemeFonts(){var e;(e=u.fontsConfig[this.theme])==null||e.fonts.forEach(e=>{this.loadThemeFont(e)})}async loadThemeFont({weight:e,name:t,file:n}){if(!this.loadFonts)return Promise.resolve();let r=`${t}-${e}`;if(this.loadedFonts.has(r))return;let i=new FontFace(t,`url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff2') format('woff2'),
|
|
2
2
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.woff') format('woff'),
|
|
3
3
|
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.ttf') format('truetype'),
|
|
4
|
-
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`optional`});try{await i.load(),document.fonts.add(i),this.loadedFonts.add(r)}catch(n){console.error(`Error loading "${t}" font with "${e}" weight:`,n)}}loadThemeStyles(){let e=`/2.0.0-canary.227`;return this.loadUnusedStyles&&this.applyUnusedStyles(e),this.loadStyles?new Promise((t,n)=>{let r=`https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))t();else{let i=`ui-kit-theme-${e}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>t(),o.onerror=()=>n(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a==null||a.remove()}}):Promise.resolve()}applyUnusedStyles(e){let t=`https://ds-assets.cupra.com${e}/styles/${this.theme}/unused-styles.css`;if(document.head.querySelector(`link[href="${t}"]`))return;let n=`ui-kit-unused-styles-${e}`,r=document.getElementById(n),i=document.createElement(`link`);i.id=n,i.rel=`preload`,i.as=`style`,i.href=t,i.onload=()=>{i.rel=`stylesheet`},document.head.appendChild(i),r==null||r.remove()}render(){return this.cssLoaded?r.html`<slot></slot>`:r.nothing}};s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-fonts`})],d.prototype,`loadFonts`,void 0),s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-styles`})],d.prototype,`loadStyles`,void 0),s.default([a.property({type:Boolean,converter:l.booleanConverter,attribute:`load-unused-styles`})],d.prototype,`loadUnusedStyles`,void 0),s.default([e.provide({context:t.themeContext}),a.property({type:String})],d.prototype,`theme`,void 0),s.default([o.state()],d.prototype,`cssLoaded`,void 0),s.default([o.state()],d.prototype,`loadedFonts`,void 0),d=s.default([c.customUiKitElement(`ds-theme-provider`)],d),Object.defineProperty(exports,"DsThemeProvider",{enumerable:!0,get:function(){return d}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../utils/version.cjs");function t(t,n){return function(r){var i,a,o,s;if(!(r!=null&&r.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let c=`${t}${e.VERSION_TAG_SUFFIX}`;if((i=globalThis)!=null&&(i=i.customElements)!=null&&i.get(c))return;let l=n!=null&&n.skipTagAsComponentName?[]:[t];Array.isArray(n==null?void 0:n.extendComponentNames)&&(l=[...n.extendComponentNames,...l]),(a=globalThis)==null||(a=a.customElements)==null||(o=a.define)==null||o.call(a,c,(s=class extends r{connectedCallback(){var e;(e=r.prototype.connectedCallback)==null||e.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.
|
|
1
|
+
const e=require("../utils/version.cjs");function t(t,n){return function(r){var i,a,o,s;if(!(r!=null&&r.prototype))throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let c=`${t}${e.VERSION_TAG_SUFFIX}`;if((i=globalThis)!=null&&(i=i.customElements)!=null&&i.get(c))return;let l=n!=null&&n.skipTagAsComponentName?[]:[t];Array.isArray(n==null?void 0:n.extendComponentNames)&&(l=[...n.extendComponentNames,...l]),(a=globalThis)==null||(a=a.customElements)==null||(o=a.define)==null||o.call(a,c,(s=class extends r{connectedCallback(){var e;(e=r.prototype.connectedCallback)==null||e.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.227`),this.setAttribute(`data-ui-kit-component-name`,t)}},s.componentName=l,s))}}exports.customUiKitElement=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
1
|
+
const e=require("../core/theme.constants.cjs"),t=require("./PubSub.cjs");var n=class{constructor(){this.icons={},this.handleChangeTheme=e=>{if(this.theme===e)return;this.theme=e;let t=Object.keys(this.icons);this.icons={},t.forEach(e=>this.fetchIcon(e))},this.fetchIcon=async(t,n={})=>{var r;let i=typeof sessionStorage<`u`?(r=sessionStorage)==null?void 0:r.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&i&&(this.theme=i);let a=this.icons[t];if(a)return await a;let o=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=o,o},this.loadIcon=(e,{cache:t=`force-cache`,...n})=>!this.theme||typeof fetch>`u`?Promise.resolve(`<svg class="ds-icon"></svg>`):fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`,{cache:t,...n}).then(e=>e.text()).catch(t=>{if((t==null?void 0:t.name)===`AbortError`)throw t;return console.error(`Failed to fetch icon "${e}":`,t),``}),t.pubSub.subscribe(`theme`,this.handleChangeTheme)}},r=Symbol.for(`@cupra/ui-kit/icons-manager/2.0.0-canary.227`),i=globalThis,a=i[r];a||(a=new n,Object.defineProperty(i,r,{value:a,writable:!1,configurable:!1,enumerable:!1}));var o=a;exports.iconsManager=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
1
|
+
var e=class{constructor(){this.subscribers={},this.lastPublishedData={}}subscribe(e,t){return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),this.lastPublishedData[e]}unsubscribe(e,t){this.subscribers[e]&&(this.subscribers[e]=this.subscribers[e].filter(e=>e!==t))}publish(e,t){this.lastPublishedData[e]=t,this.subscribers[e]&&this.subscribers[e].forEach(n=>{try{n(t)}catch(t){console.error(`Error in subscriber for event "${e}":`,t)}})}},t=Symbol.for(`@cupra/ui-kit/pubsub/2.0.0-canary.227`),n=globalThis,r=n[t];r||(r=new e,Object.defineProperty(n,t,{value:r,writable:!1,configurable:!1,enumerable:!1}));var i=r;exports.PubSub=e,exports.pubSub=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
var e=require("../concurrencyLimit.cjs").concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.227/styles/${n}/components/${t}.css`,i=this.getCachedStyleSheetPromise({url:r});if(i)return i;let a=e(()=>this.fetchStyle({url:r})).then(e=>(e||this.stylePromises.delete(r),e));return this.stylePromises.set(r,a),this.stylePromises.get(r)}}async fetchStyle({url:e}){try{if(typeof fetch>`u`)return;let t=await fetch(e,{cache:`force-cache`});if(t.ok)return t.text()}catch(t){console.error(`Failed to fetch Style Sheet "${e}":`,t)}}getCachedStyleSheetPromise({url:e}){return this.stylePromises.get(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}}.getInstance();exports.stylesRegistry=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`2.0.0-canary.227`,t=`--v${e.replaceAll(`.`,`-`)}`;exports.VERSION=e,exports.VERSION_TAG_SUFFIX=t;
|
|
@@ -249,7 +249,7 @@ var t = e`
|
|
|
249
249
|
flex-direction: column;
|
|
250
250
|
gap: var(--ds-spacing-m-1);
|
|
251
251
|
align-self: stretch;
|
|
252
|
-
border-radius: var(--ds-border-radius-
|
|
252
|
+
border-radius: var(--ds-border-radius-s);
|
|
253
253
|
border: var(--ds-border-width-m) solid var(--ds-color-border-default);
|
|
254
254
|
max-height: 75dvh;
|
|
255
255
|
overflow-y: scroll;
|
|
@@ -24,7 +24,7 @@ import { commonStyles as _, currentValueStyles as v, inputResetStyles as y, rang
|
|
|
24
24
|
//#region src/components/ds-slider/ds-slider.ts
|
|
25
25
|
var C = class extends d(o) {
|
|
26
26
|
constructor(...e) {
|
|
27
|
-
super(...e), this.variant = "primary", this.min = 0, this.max = 100, this.minLabel = "", this.maxLabel = "", this.step = 1, this.initialValueMin = 0, this.mode = "light", this.locale = void 0, this.localeMatcher = "lookup", this.useGrouping = !0, this.minimumIntegerDigits = 1, this.minimumFractionDigits = 0, this.maximumFractionDigits = 3, this.size = "medium", this.disabled = !1, this.keyboardMode = !1, this._initialValuesApplied = !1, this.getNewValue = (e) => {
|
|
27
|
+
super(...e), this.variant = "primary", this.min = 0, this.max = 100, this.minLabel = "", this.maxLabel = "", this.step = 1, this.initialValueMin = 0, this.mode = "light", this.locale = void 0, this.localeMatcher = "lookup", this.useGrouping = !0, this.minimumIntegerDigits = 1, this.minimumFractionDigits = 0, this.maximumFractionDigits = 3, this.size = "medium", this.disabled = !1, this.allowThumbOverlap = !1, this.keyboardMode = !1, this._initialValuesApplied = !1, this.getNewValue = (e) => {
|
|
28
28
|
let { width: t, left: n } = this.track.getBoundingClientRect(), r = this.thumbRadius, i = e.type.indexOf("mouse") === -1 ? e.touches[0].clientX : e.clientX, a = t - r * 2, o = Math.min(Math.max(0, i - n - r), a), s = a > 0 ? o * 100 / a : 0;
|
|
29
29
|
return this.min + s * (this.max - this.min) / 100;
|
|
30
30
|
}, this.setActiveThumb = (e) => {
|
|
@@ -115,7 +115,8 @@ var C = class extends d(o) {
|
|
|
115
115
|
max: this.max,
|
|
116
116
|
proposedValue: e,
|
|
117
117
|
role: t,
|
|
118
|
-
currentValues: this.currentValues
|
|
118
|
+
currentValues: this.currentValues,
|
|
119
|
+
allowOverlap: this.allowThumbOverlap
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
willUpdate(e) {
|
|
@@ -445,6 +446,10 @@ a([n({ type: String })], T.prototype, "variant", void 0), a([n({ type: Number })
|
|
|
445
446
|
})], T.prototype, "inputMinAriaLabel", void 0), a([n({
|
|
446
447
|
type: String,
|
|
447
448
|
attribute: "input-max-aria-label"
|
|
448
|
-
})], T.prototype, "inputMaxAriaLabel", void 0), a([
|
|
449
|
+
})], T.prototype, "inputMaxAriaLabel", void 0), a([n({
|
|
450
|
+
type: Boolean,
|
|
451
|
+
attribute: "allow-thumb-overlap",
|
|
452
|
+
converter: c
|
|
453
|
+
})], T.prototype, "allowThumbOverlap", void 0), a([i(".track")], T.prototype, "track", void 0), a([r()], T.prototype, "_valueMin", void 0), a([r()], T.prototype, "_valueMax", void 0), a([r()], T.prototype, "editingField", void 0), T = w = a([s("ds-slider")], T);
|
|
449
454
|
//#endregion
|
|
450
455
|
export { T as DsSlider };
|
|
@@ -4,43 +4,43 @@ var t = 2 ** -52 * 4, n = (e, t, n) => Math.min(Math.max(e, t), n), r = (e) => {
|
|
|
4
4
|
var t;
|
|
5
5
|
let [n, r = "0"] = e.toString().split("e"), i = ((t = n.split(".")[1]) == null ? void 0 : t.length) ?? 0;
|
|
6
6
|
return Math.max(0, i - Number(r));
|
|
7
|
-
}, i = ({ step: i = 1, min: a = 0, max: o = 100, proposedValue: s, role: c, currentValues: l }) => {
|
|
8
|
-
let
|
|
7
|
+
}, i = ({ step: i = 1, min: a = 0, max: o = 100, proposedValue: s, role: c, currentValues: l, allowOverlap: u = !1 }) => {
|
|
8
|
+
let d = c === "min" ? 1 : 2, f = a, p = o;
|
|
9
9
|
if (!Number.isFinite(s)) return {
|
|
10
|
-
stepValue: l[String(
|
|
11
|
-
minLimit:
|
|
12
|
-
maxLimit:
|
|
10
|
+
stepValue: l[String(d)],
|
|
11
|
+
minLimit: f,
|
|
12
|
+
maxLimit: p
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let m = Math.max(r(a), r(i)), h = (t) => e({
|
|
15
15
|
value: a + Math.max(0, t) * i,
|
|
16
|
-
fractionDigits:
|
|
17
|
-
}),
|
|
16
|
+
fractionDigits: m
|
|
17
|
+
}), g = (e, n) => Math.abs(e - n) <= t * Math.max(Math.abs(a), Math.abs(i), Math.abs(e), Math.abs(n));
|
|
18
18
|
for (let [e, t] of Object.entries(l)) {
|
|
19
|
-
if (Number(e) <
|
|
20
|
-
if (
|
|
21
|
-
let e = Math.round((t - a) / i), n =
|
|
22
|
-
|
|
19
|
+
if (Number(e) < d && t >= f) {
|
|
20
|
+
if (f = t, i === 0 || u) continue;
|
|
21
|
+
let e = Math.round((t - a) / i), n = h(e);
|
|
22
|
+
f = n > t && !g(n, t) ? n : h(e + 1);
|
|
23
23
|
}
|
|
24
|
-
if (Number(e) >
|
|
25
|
-
if (
|
|
26
|
-
let e = Math.round((t - a) / i), n =
|
|
27
|
-
|
|
24
|
+
if (Number(e) > d && t <= p) {
|
|
25
|
+
if (p = t, i === 0 || u) continue;
|
|
26
|
+
let e = Math.round((t - a) / i), n = h(e);
|
|
27
|
+
p = n < t && !g(n, t) ? n : h(e - 1);
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
f = n(f, a, o), p = n(p, a, o);
|
|
30
30
|
}
|
|
31
|
-
if (i === 0 || s <=
|
|
32
|
-
stepValue: Math.max(
|
|
33
|
-
minLimit:
|
|
34
|
-
maxLimit:
|
|
31
|
+
if (i === 0 || s <= f || s >= p) return {
|
|
32
|
+
stepValue: Math.max(f, Math.min(p, s)),
|
|
33
|
+
minLimit: f,
|
|
34
|
+
maxLimit: p
|
|
35
35
|
};
|
|
36
|
-
let
|
|
37
|
-
value:
|
|
38
|
-
fractionDigits: Math.max(
|
|
36
|
+
let _ = e({
|
|
37
|
+
value: f + Math.round((s - f) / i) * i,
|
|
38
|
+
fractionDigits: Math.max(m, r(f))
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
stepValue: n(s -
|
|
42
|
-
minLimit:
|
|
43
|
-
maxLimit:
|
|
41
|
+
stepValue: n(s - _ > p - s ? p : _, f, p),
|
|
42
|
+
minLimit: f,
|
|
43
|
+
maxLimit: p
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -53,7 +53,7 @@ var f = class extends a {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
loadThemeStyles() {
|
|
56
|
-
let e = "/2.0.0-canary.
|
|
56
|
+
let e = "/2.0.0-canary.227";
|
|
57
57
|
return this.loadUnusedStyles && this.applyUnusedStyles(e), this.loadStyles ? new Promise((t, n) => {
|
|
58
58
|
let r = `https://ds-assets.cupra.com${e}/styles/${this.theme}/theme.css`;
|
|
59
59
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
@@ -10,7 +10,7 @@ function t(t, n) {
|
|
|
10
10
|
Array.isArray(n == null ? void 0 : n.extendComponentNames) && (l = [...n.extendComponentNames, ...l]), (a = globalThis) == null || (a = a.customElements) == null || (o = a.define) == null || o.call(a, c, (s = class extends r {
|
|
11
11
|
connectedCallback() {
|
|
12
12
|
var e;
|
|
13
|
-
(e = r.prototype.connectedCallback) == null || e.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.
|
|
13
|
+
(e = r.prototype.connectedCallback) == null || e.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.227"), this.setAttribute("data-ui-kit-component-name", t);
|
|
14
14
|
}
|
|
15
15
|
}, s.componentName = l, s));
|
|
16
16
|
};
|
|
@@ -26,7 +26,7 @@ var n = class {
|
|
|
26
26
|
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
27
27
|
}), t.subscribe("theme", this.handleChangeTheme);
|
|
28
28
|
}
|
|
29
|
-
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
29
|
+
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.227"), i = globalThis, a = i[r];
|
|
30
30
|
a || (a = new n(), Object.defineProperty(i, r, {
|
|
31
31
|
value: a,
|
|
32
32
|
writable: !1,
|
|
@@ -18,7 +18,7 @@ var e = class {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.
|
|
21
|
+
}, t = Symbol.for("@cupra/ui-kit/pubsub/2.0.0-canary.227"), n = globalThis, r = n[t];
|
|
22
22
|
r || (r = new e(), Object.defineProperty(n, t, {
|
|
23
23
|
value: r,
|
|
24
24
|
writable: !1,
|
|
@@ -4,7 +4,7 @@ var t = e(20), n = class e {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
this.stylePromises = /* @__PURE__ */ new Map(), this.getStyles = async ({ componentName: e, theme: n }) => {
|
|
6
6
|
if (!n || !e) return;
|
|
7
|
-
let r = `https://ds-assets.cupra.com/2.0.0-canary.
|
|
7
|
+
let r = `https://ds-assets.cupra.com/2.0.0-canary.227/styles/${n}/components/${e}.css`, i = this.getCachedStyleSheetPromise({ url: r });
|
|
8
8
|
if (i) return i;
|
|
9
9
|
let a = t(() => this.fetchStyle({ url: r })).then((e) => (e || this.stylePromises.delete(r), e));
|
|
10
10
|
return this.stylePromises.set(r, a), this.stylePromises.get(r);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { CommonAttrs } from '../../types/types';
|
|
2
|
+
type Size = 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall' | 'xxsmall';
|
|
3
|
+
type Mode = 'dark' | 'light';
|
|
2
4
|
export type DsLogoAttrs = {
|
|
3
|
-
size?:
|
|
4
|
-
mode?:
|
|
5
|
+
size?: Size;
|
|
6
|
+
mode?: Mode;
|
|
5
7
|
} & CommonAttrs;
|
|
8
|
+
export {};
|
|
@@ -33,6 +33,7 @@ export declare class DsSlider extends DsSlider_base {
|
|
|
33
33
|
disabled: DsSliderAttrs['disabled'];
|
|
34
34
|
inputMinAriaLabel: DsSliderAttrs['input-min-aria-label'];
|
|
35
35
|
inputMaxAriaLabel: DsSliderAttrs['input-max-aria-label'];
|
|
36
|
+
allowThumbOverlap: DsSliderAttrs['allow-thumb-overlap'];
|
|
36
37
|
protected track: HTMLInputElement;
|
|
37
38
|
protected _valueMin: number;
|
|
38
39
|
protected _valueMax: number;
|