@cupra/ui-kit 2.0.0-canary.141 → 2.0.0-canary.143
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-currency/ds-currency.cjs +2 -6
- package/dist/cjs/components/ds-currency/styles/common.styles.cjs +1 -1
- package/dist/cjs/components/ds-rating/ds-rating.cjs +1 -1
- package/dist/cjs/components/ds-slider/ds-slider.cjs +2 -2
- 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/formatNumber/formatNumber.cjs +1 -1
- package/dist/cjs/utils/version.cjs +1 -1
- package/dist/esm/components/ds-currency/ds-currency.js +5 -22
- package/dist/esm/components/ds-currency/styles/common.styles.js +1 -1
- package/dist/esm/components/ds-rating/ds-rating.js +1 -1
- package/dist/esm/components/ds-slider/ds-slider.js +2 -2
- 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/formatNumber/formatNumber.js +19 -11
- package/dist/esm/utils/version.js +1 -1
- package/dist/types/components/ds-avatar/ds-avatar.d.ts +1 -1
- package/dist/types/components/ds-currency/ds-currency.d.ts +0 -2
- package/dist/types/components/ds-currency/ds-currency.types.d.ts +0 -2
- package/dist/types/utils/formatNumber/formatNumber.d.ts +1 -0
- package/dist-react/cjs/components/ds-currency/ds-currency.cjs +2 -6
- package/dist-react/cjs/components/ds-currency/styles/common.styles.cjs +1 -1
- package/dist-react/cjs/components/ds-rating/ds-rating.cjs +1 -1
- package/dist-react/cjs/components/ds-slider/ds-slider.cjs +2 -2
- 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/formatNumber/formatNumber.cjs +1 -1
- package/dist-react/cjs/utils/version.cjs +1 -1
- package/dist-react/esm/components/ds-currency/ds-currency.js +5 -22
- package/dist-react/esm/components/ds-currency/styles/common.styles.js +1 -1
- package/dist-react/esm/components/ds-rating/ds-rating.js +1 -1
- package/dist-react/esm/components/ds-slider/ds-slider.js +2 -2
- 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/formatNumber/formatNumber.js +19 -11
- package/dist-react/esm/utils/version.js +1 -1
- package/dist-react/types/components/ds-avatar/ds-avatar.d.ts +1 -1
- package/dist-react/types/components/ds-currency/ds-currency.d.ts +0 -2
- package/dist-react/types/components/ds-currency/ds-currency.types.d.ts +0 -2
- package/dist-react/types/utils/formatNumber/formatNumber.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`),a=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const o=require(`../../utils/formatNumber/formatNumber.cjs`),s=require(`./styles/common.styles.cjs`);var c=class extends r.UiKitElement{constructor(...e){super(...e),this.currencyDisplay=`symbol`,this.minimumFractionDigits=0,this.maximumFractionDigits=20,this.amountSize=`medium`,this.amountWeight=`medium`,this.
|
|
2
|
-
${r===`left`?e.x`<span class=${a.e(c)}>${n}</span>`:e.E}
|
|
3
|
-
<span class=${a.e(s)}>${i}</span>
|
|
4
|
-
${r===`right`?e.x`<span class=${a.e(c)}>${n}</span>`:e.E}
|
|
5
|
-
`}get periodTemplate(){if(!this.period)return e.E;let t=new Intl.DisplayNames(this.locale,{type:`dateTimeField`});return e.x`<span class=${a.e({period:!0,text:!0,[`size-${this.periodSize}`]:!0,[`weight-${this.periodWeight}`]:!0})}"period">/${t.of(this.period)}</span>`}get noteTemplate(){return this.note?e.x`<span class=${a.e({note:!0,text:!0,[`size-${this.noteSize}`]:!0,[`weight-${this.noteWeight}`]:!0})}>${this.note}</span>`:e.E}render(){let t={container:!0,strikethrough:this.variant===`strikethrough`},n=this.variant===`strikethrough`?e.x`<div class="strikethrough-line"></div>`:e.E;return e.x`<div class=${a.e(t)}>
|
|
1
|
+
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`),a=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const o=require(`../../utils/formatNumber/formatNumber.cjs`),s=require(`./styles/common.styles.cjs`);var c=class extends r.UiKitElement{constructor(...e){super(...e),this.currencyDisplay=`symbol`,this.minimumFractionDigits=0,this.maximumFractionDigits=20,this.amountSize=`medium`,this.amountWeight=`medium`,this.periodSize=`medium`,this.periodWeight=`medium`,this.noteSize=`medium`,this.noteWeight=`medium`,this.variant=`default`}static{this.styles=[s.commonStyles]}get valueTemplate(){let{formattedValue:t}=o.formatNumber({value:this.amountNumber??0,locale:this.locale,style:`currency`,currency:this.currencyCode,localeMatcher:`lookup`,useGrouping:`always`,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,currencyDisplay:this.currencyDisplay}),n=this.amountText||t;return e.x`<span class=${a.e({amount:!0,text:!0,[`size-${this.amountSize}`]:!0,[`weight-${this.amountWeight}`]:!0})}>${n}</span>`}get periodTemplate(){if(!this.period)return e.E;let t=new Intl.DisplayNames(this.locale,{type:`dateTimeField`});return e.x`<span class=${a.e({period:!0,text:!0,[`size-${this.periodSize}`]:!0,[`weight-${this.periodWeight}`]:!0})}"period">/${t.of(this.period)}</span>`}get noteTemplate(){return this.note?e.x`<span class=${a.e({note:!0,text:!0,[`size-${this.noteSize}`]:!0,[`weight-${this.noteWeight}`]:!0})}>${this.note}</span>`:e.E}render(){let t={container:!0,strikethrough:this.variant===`strikethrough`},n=this.variant===`strikethrough`?e.x`<div class="strikethrough-line"></div>`:e.E;return e.x`<div class=${a.e(t)}>
|
|
6
2
|
${this.valueTemplate}${this.periodTemplate}${this.noteTemplate}${n}
|
|
7
|
-
</div>`}};n.__decorate([t.n({type:String})],c.prototype,`locale`,void 0),n.__decorate([t.n({type:String,attribute:`currency-code`})],c.prototype,`currencyCode`,void 0),n.__decorate([t.n({type:String,attribute:`currency-display`})],c.prototype,`currencyDisplay`,void 0),n.__decorate([t.n({type:String,attribute:`amount-text`})],c.prototype,`amountText`,void 0),n.__decorate([t.n({type:Number,attribute:`amount-number`})],c.prototype,`amountNumber`,void 0),n.__decorate([t.n({type:Number,attribute:`minimum-fraction-digits`})],c.prototype,`minimumFractionDigits`,void 0),n.__decorate([t.n({type:Number,attribute:`maximum-fraction-digits`})],c.prototype,`maximumFractionDigits`,void 0),n.__decorate([t.n({type:String})],c.prototype,`period`,void 0),n.__decorate([t.n({type:String})],c.prototype,`note`,void 0),n.__decorate([t.n({type:String,attribute:`thousand-separator`})],c.prototype,`thousandSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`fraction-separator`})],c.prototype,`fractionSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`amount-size`})],c.prototype,`amountSize`,void 0),n.__decorate([t.n({type:String,attribute:`amount-weight`})],c.prototype,`amountWeight`,void 0),n.__decorate([t.n({type:String,attribute:`
|
|
3
|
+
</div>`}};n.__decorate([t.n({type:String})],c.prototype,`locale`,void 0),n.__decorate([t.n({type:String,attribute:`currency-code`})],c.prototype,`currencyCode`,void 0),n.__decorate([t.n({type:String,attribute:`currency-display`})],c.prototype,`currencyDisplay`,void 0),n.__decorate([t.n({type:String,attribute:`amount-text`})],c.prototype,`amountText`,void 0),n.__decorate([t.n({type:Number,attribute:`amount-number`})],c.prototype,`amountNumber`,void 0),n.__decorate([t.n({type:Number,attribute:`minimum-fraction-digits`})],c.prototype,`minimumFractionDigits`,void 0),n.__decorate([t.n({type:Number,attribute:`maximum-fraction-digits`})],c.prototype,`maximumFractionDigits`,void 0),n.__decorate([t.n({type:String})],c.prototype,`period`,void 0),n.__decorate([t.n({type:String})],c.prototype,`note`,void 0),n.__decorate([t.n({type:String,attribute:`thousand-separator`})],c.prototype,`thousandSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`fraction-separator`})],c.prototype,`fractionSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`amount-size`})],c.prototype,`amountSize`,void 0),n.__decorate([t.n({type:String,attribute:`amount-weight`})],c.prototype,`amountWeight`,void 0),n.__decorate([t.n({type:String,attribute:`period-size`})],c.prototype,`periodSize`,void 0),n.__decorate([t.n({type:String,attribute:`period-weight`})],c.prototype,`periodWeight`,void 0),n.__decorate([t.n({type:String,attribute:`note-size`})],c.prototype,`noteSize`,void 0),n.__decorate([t.n({type:String,attribute:`note-weight`})],c.prototype,`noteWeight`,void 0),n.__decorate([t.n({type:String})],c.prototype,`variant`,void 0),c=n.__decorate([i.customUiKitElement(`ds-currency`)],c);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`);require(`../ds-icon/ds-icon.cjs`);const a=require(`../../utils/booleanConverter.cjs`),o=require(`../../utils/uiKitHtml.cjs`),s=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const c=require(`./styles/common.styles.cjs`);var l=class extends r.UiKitElement{constructor(...e){super(...e),this.disabled=!1,this.hideRatingText=!1}static{this.styles=[c.commonStyles]}get displayValue(){if(this.value===void 0||this.value===null||this.value<0)return 0;let e=Math.max(0,Math.min(5,this.value)),t=Math.floor(e),n=Number((e-t).toFixed(2));return t+Math.round(n/.5)*.5}get classes(){return{container:!0,disabled:this.disabled}}getStarIconName(e,t){return t>=e?`star-filled`:t>=e-.5?`half-star-filled`:`star`}get starsTemplate(){let e=this.displayValue,t=[];for(let n=1;n<=5;n++){let r=this.getStarIconName(n,e);
|
|
1
|
+
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`);require(`../ds-icon/ds-icon.cjs`);const a=require(`../../utils/booleanConverter.cjs`),o=require(`../../utils/uiKitHtml.cjs`),s=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const c=require(`./styles/common.styles.cjs`);var l=class extends r.UiKitElement{constructor(...e){super(...e),this.disabled=!1,this.hideRatingText=!1}static{this.styles=[c.commonStyles]}get displayValue(){if(this.value===void 0||this.value===null||this.value<0)return 0;let e=Math.max(0,Math.min(5,this.value)),t=Math.floor(e),n=Number((e-t).toFixed(2));return t+Math.round(n/.5)*.5}get classes(){return{container:!0,disabled:this.disabled}}getStarIconName(e,t){return t>=e?`star-filled`:t>=e-.5?`half-star-filled`:`star`}get starsTemplate(){let e=this.displayValue,t=[];for(let n=1;n<=5;n++){let r=this.getStarIconName(n,e);t.push(o.uiKitHtml`<ds-icon class="star-icon" icon-name=${r} size="16"></ds-icon>`)}return t}render(){let t=this.value!==void 0&&this.value>=0?this.value:0,n=Math.max(0,Math.min(5,t)).toString();return e.x`
|
|
2
2
|
<div class=${s.e(this.classes)} aria-label=${`Rating: ${n} out of 5`} role="img">
|
|
3
3
|
<div class="stars-wrapper">${this.starsTemplate}</div>
|
|
4
4
|
${this.hideRatingText?``:e.x`<span class="rating-text">${n}</span>`}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),n=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`),r=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const i=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),a=require(`../base/UiKitElement.cjs`),o=require(`../../decorators/customUiKitElement.cjs`),s=require(`../../utils/booleanConverter.cjs`),c=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const l=require(`../../mixins/ViewportMixin.cjs`),u=require(`../../utils/objectConverter.cjs`),d=require(`../../utils/formatNumber/formatNumber.cjs`),f=require(`./utils/getStepValue/getStepValue.cjs`),p=require(`./utils/roundToDecimals/roundToDecimals.cjs`),m=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/live.cjs`);const h=require(`./styles/common.styles.cjs`);var g,_=class extends l.ViewportMixin(a.UiKitElement){static{g=this}constructor(...e){super(...e),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);typeof this._valueMax!=`number`||t<=this._valueMin?this.activeThumb=`min`:t>=this._valueMax?this.activeThumb=`max`:t-this._valueMin<this._valueMax-t?this.activeThumb=`min`:this.activeThumb=`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=>{this.disabled||(e?.preventDefault?.(),this.setActiveThumb(e),this.handleMouseMove(e),window?.addEventListener(`mousemove`,this.handleMouseMove),window?.addEventListener(`touchmove`,this.handleMouseMove),window?.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.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});this.handleChange({value:i,role:r}),this.isControlled(r)||(n.value=String(i))},this.onInputBlur=e=>{this.editingField=void 0,e.currentTarget?.classList?.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})}}}static{this.styles=[h.commonStyles,h.trackStyles,h.thumbStyles,h.currentValueStyles,h.rangeValueStyles]}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}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 f.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(){super.disconnectedCallback(),window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.removeEventListener(`pointerup`,this.handlePointerUp),window?.removeEventListener(`keydown`,this.handleKeydown),window?.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){super.firstUpdated(e),window?.addEventListener(`keydown`,this.handleKeydown),window?.addEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=this[e===`min`?`initialValueMin`:`initialValueMax`];if(typeof t!=`number`)return;let{stepValue:n}=this.computeStep({proposedValue:t,role:e});this[e===`min`?`_valueMin`:`_valueMax`]!==n&&this.handleChange({value:n,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){let e=this.renderRoot?.querySelector(`.thumb`);return e?e.offsetWidth/2:0}static{this.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`}trackPosition(e){let t=g.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${g.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){return d.formatNumber({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})}get rangeValuesTemplates(){let{
|
|
1
|
+
require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),n=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`),r=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const i=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),a=require(`../base/UiKitElement.cjs`),o=require(`../../decorators/customUiKitElement.cjs`),s=require(`../../utils/booleanConverter.cjs`),c=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const l=require(`../../mixins/ViewportMixin.cjs`),u=require(`../../utils/objectConverter.cjs`),d=require(`../../utils/formatNumber/formatNumber.cjs`),f=require(`./utils/getStepValue/getStepValue.cjs`),p=require(`./utils/roundToDecimals/roundToDecimals.cjs`),m=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/live.cjs`);const h=require(`./styles/common.styles.cjs`);var g,_=class extends l.ViewportMixin(a.UiKitElement){static{g=this}constructor(...e){super(...e),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);typeof this._valueMax!=`number`||t<=this._valueMin?this.activeThumb=`min`:t>=this._valueMax?this.activeThumb=`max`:t-this._valueMin<this._valueMax-t?this.activeThumb=`min`:this.activeThumb=`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=>{this.disabled||(e?.preventDefault?.(),this.setActiveThumb(e),this.handleMouseMove(e),window?.addEventListener(`mousemove`,this.handleMouseMove),window?.addEventListener(`touchmove`,this.handleMouseMove),window?.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.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});this.handleChange({value:i,role:r}),this.isControlled(r)||(n.value=String(i))},this.onInputBlur=e=>{this.editingField=void 0,e.currentTarget?.classList?.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})}}}static{this.styles=[h.commonStyles,h.trackStyles,h.thumbStyles,h.currentValueStyles,h.rangeValueStyles]}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}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 f.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(){super.disconnectedCallback(),window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.removeEventListener(`pointerup`,this.handlePointerUp),window?.removeEventListener(`keydown`,this.handleKeydown),window?.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){super.firstUpdated(e),window?.addEventListener(`keydown`,this.handleKeydown),window?.addEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=this[e===`min`?`initialValueMin`:`initialValueMax`];if(typeof t!=`number`)return;let{stepValue:n}=this.computeStep({proposedValue:t,role:e});this[e===`min`?`_valueMin`:`_valueMax`]!==n&&this.handleChange({value:n,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){let e=this.renderRoot?.querySelector(`.thumb`);return e?e.offsetWidth/2:0}static{this.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`}trackPosition(e){let t=g.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${g.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){return d.formatNumber({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})}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r,{formattedNumber:o}=this.formatNumber(this.max);return e.x`
|
|
2
2
|
<div class="range-value-text">
|
|
3
3
|
${this.minLabel?e.x`<span class="range-value-label">${this.minLabel}</span>`:e.E}
|
|
4
4
|
${a===`left`?e.x`<span>${i}</span>`:e.E}
|
|
@@ -49,7 +49,7 @@ require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_mod
|
|
|
49
49
|
}
|
|
50
50
|
</style>
|
|
51
51
|
<div class="track-range" role="presentation"></div>
|
|
52
|
-
`}getInputTemplate(t){let n=this.getRoleById(t),r=this.editingField===n,i=n===`min`?this._valueMin:this._valueMax,{
|
|
52
|
+
`}getInputTemplate(t){let n=this.getRoleById(t),r=this.editingField===n,i=n===`min`?this._valueMin:this._valueMax,{formattedNumber:a,unitSymbol:o,unitSymbolPosition:s}=this.formatNumber(i),c=this.unitSymbolPosition??s,l=this.unitSymbol??o,u=l?c===`left`?`${l} ${a}`:`${a} ${l}`:`${a}`,d=r?`number`:`text`,f=r?String(i??``):u,p=t===1?this.inputMinAriaLabel:this.inputMaxAriaLabel,h=this.isRange?t===1?`Start value`:`End value`:`Value`,g=p??h;return e.x`
|
|
53
53
|
<div class="input-wrapper">
|
|
54
54
|
<input
|
|
55
55
|
class="input-value input-value-${t}"
|
|
@@ -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`),n=require(`../../core/theme.constants.cjs`),r=require(`../../utils/PubSub.cjs`),i=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`),a=require(`../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const o=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),s=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const c=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),l=require(`../../decorators/customUiKitElement.cjs`),u=require(`../../utils/booleanConverter.cjs`),d=require(`../../styles/source/shared/fonts-config.cjs`);var f=class extends a.i{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){super.updated(e),e.has(`theme`)&&(r.pubSub.publish(`theme`,this.theme),sessionStorage?.setItem(n.THEME_STORAGE_KEY,this.theme),typeof FontFace<`u`&&document?.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))}))}loadThemeFonts(){d.fontsConfig[this.theme]?.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:`swap`});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(){return this.loadStyles?new Promise((e,t)=>{let n=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`swap`});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(){return this.loadStyles?new Promise((e,t)=>{let n=`/2.0.0-canary.143`,r=`https://ds-assets.cupra.com${n}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))e();else{let i=`ui-kit-theme-${n}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>e(),o.onerror=()=>t(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a?.remove()}}):Promise.resolve()}render(){return this.cssLoaded?i.x`<slot></slot>`:i.E}};c.__decorate([o.n({type:Boolean,converter:u.booleanConverter,attribute:`load-fonts`})],f.prototype,`loadFonts`,void 0),c.__decorate([o.n({type:Boolean,converter:u.booleanConverter,attribute:`load-styles`})],f.prototype,`loadStyles`,void 0),c.__decorate([e.e({context:t.themeContext}),o.n({type:String})],f.prototype,`theme`,void 0),c.__decorate([s.r()],f.prototype,`cssLoaded`,void 0),c.__decorate([s.r()],f.prototype,`loadedFonts`,void 0),f=c.__decorate([l.customUiKitElement(`ds-theme-provider`)],f);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../utils/version.cjs`);function e(e,t){return function(n){if(!n?.prototype)throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let r=e;if(globalThis?.customElements?.get(r))return;let i=t?.skipTagAsComponentName?[]:[e];Array.isArray(t?.extendComponentNames)&&(i=[...t.extendComponentNames,...i]),globalThis?.customElements?.define?.(r,class extends n{static{this.componentName=i}connectedCallback(){n.prototype.connectedCallback?.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.
|
|
1
|
+
require(`../utils/version.cjs`);function e(e,t){return function(n){if(!n?.prototype)throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let r=e;if(globalThis?.customElements?.get(r))return;let i=t?.skipTagAsComponentName?[]:[e];Array.isArray(t?.extendComponentNames)&&(i=[...t.extendComponentNames,...i]),globalThis?.customElements?.define?.(r,class extends n{static{this.componentName=i}connectedCallback(){n.prototype.connectedCallback?.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.143`)}})}}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={})=>{let r=typeof sessionStorage<`u`?sessionStorage?.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&r&&(this.theme=r);let i=this.icons[t];if(i)return await i;let a=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=a,a},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?.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={})=>{let r=typeof sessionStorage<`u`?sessionStorage?.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&r&&(this.theme=r);let i=this.icons[t];if(i)return await i;let a=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=a,a},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?.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.143`),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.143`),n=globalThis,r=n[t];r||(r=new e,Object.defineProperty(n,t,{value:r,writable:!1,configurable:!1,enumerable:!1}));var i=r;exports.pubSub=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require(`../concurrencyLimit.cjs`).concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
var e=require(`../concurrencyLimit.cjs`).concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.143/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||=new t,t.instance}}.getInstance();exports.stylesRegistry=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e({value:e,locale:t,style:n,unit:r,currency:i,localeMatcher:a=`lookup`,minimumIntegerDigits:o=1,minimumFractionDigits:s=0,maximumFractionDigits:c=20,thousandSeparator:l,fractionSeparator:u,useGrouping:d=`auto`,currencyDisplay:f=`symbol`}){let p=``,m
|
|
1
|
+
function e({value:e,locale:t,style:n,unit:r,currency:i,localeMatcher:a=`lookup`,minimumIntegerDigits:o=1,minimumFractionDigits:s=0,maximumFractionDigits:c=20,thousandSeparator:l,fractionSeparator:u,useGrouping:d=`auto`,currencyDisplay:f=`symbol`}){let p=``,m=``,h,g,_=new Intl.NumberFormat(t,{...n&&{style:n},...r&&{unit:r},...i&&{currency:i},currencyDisplay:f,localeMatcher:a,minimumIntegerDigits:o,minimumFractionDigits:s,maximumFractionDigits:c,useGrouping:d}).formatToParts(e??0);return _.forEach((e,t)=>{switch(e.type){case`unit`:case`currency`:case`percentSign`:h=e.value,g=t===0||(_[0].type===`minusSign`||_[0].type===`plusSign`)&&t===1?`left`:`right`,m+=e.value;break;case`group`:{let t=l??e.value;p+=t,m+=t;break}case`decimal`:{let t=u??e.value;p+=t,m+=t;break}case`integer`:case`fraction`:case`plusSign`:case`minusSign`:p+=e.value,m+=e.value;break;case`literal`:m+=e.value;break}}),{formattedNumber:p,formattedValue:m,...h&&{unitSymbol:h},...g&&{unitSymbolPosition:g}}}exports.formatNumber=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`2.0.0-canary.
|
|
1
|
+
var e=`2.0.0-canary.143`,t=`--v${e.replaceAll(`.`,`-`)}`;exports.VERSION=e,exports.VERSION_TAG_SUFFIX=t;
|
|
@@ -12,13 +12,13 @@ import { commonStyles as c } from "./styles/common.styles.js";
|
|
|
12
12
|
//#region src/components/ds-currency/ds-currency.ts
|
|
13
13
|
var l = class extends i {
|
|
14
14
|
constructor(...e) {
|
|
15
|
-
super(...e), this.currencyDisplay = "symbol", this.minimumFractionDigits = 0, this.maximumFractionDigits = 20, this.amountSize = "medium", this.amountWeight = "medium", this.
|
|
15
|
+
super(...e), this.currencyDisplay = "symbol", this.minimumFractionDigits = 0, this.maximumFractionDigits = 20, this.amountSize = "medium", this.amountWeight = "medium", this.periodSize = "medium", this.periodWeight = "medium", this.noteSize = "medium", this.noteWeight = "medium", this.variant = "default";
|
|
16
16
|
}
|
|
17
17
|
static {
|
|
18
18
|
this.styles = [c];
|
|
19
19
|
}
|
|
20
20
|
get valueTemplate() {
|
|
21
|
-
let { formattedValue:
|
|
21
|
+
let { formattedValue: e } = s({
|
|
22
22
|
value: this.amountNumber ?? 0,
|
|
23
23
|
locale: this.locale,
|
|
24
24
|
style: "currency",
|
|
@@ -28,24 +28,13 @@ var l = class extends i {
|
|
|
28
28
|
minimumFractionDigits: this.minimumFractionDigits,
|
|
29
29
|
maximumFractionDigits: this.maximumFractionDigits,
|
|
30
30
|
currencyDisplay: this.currencyDisplay
|
|
31
|
-
}),
|
|
31
|
+
}), n = this.amountText || e;
|
|
32
|
+
return t`<span class=${o({
|
|
32
33
|
amount: !0,
|
|
33
34
|
text: !0,
|
|
34
35
|
[`size-${this.amountSize}`]: !0,
|
|
35
36
|
[`weight-${this.amountWeight}`]: !0
|
|
36
|
-
}
|
|
37
|
-
currency: !0,
|
|
38
|
-
left: i === "left",
|
|
39
|
-
right: i === "right",
|
|
40
|
-
text: !0,
|
|
41
|
-
[`size-${this.currencySize}`]: !0,
|
|
42
|
-
[`weight-${this.currencyWeight}`]: !0
|
|
43
|
-
};
|
|
44
|
-
return t`
|
|
45
|
-
${i === "left" ? t`<span class=${o(l)}>${r}</span>` : e}
|
|
46
|
-
<span class=${o(c)}>${a}</span>
|
|
47
|
-
${i === "right" ? t`<span class=${o(l)}>${r}</span>` : e}
|
|
48
|
-
`;
|
|
37
|
+
})}>${n}</span>`;
|
|
49
38
|
}
|
|
50
39
|
get periodTemplate() {
|
|
51
40
|
if (!this.period) return e;
|
|
@@ -106,12 +95,6 @@ r([n({ type: String })], l.prototype, "locale", void 0), r([n({
|
|
|
106
95
|
type: String,
|
|
107
96
|
attribute: "amount-weight"
|
|
108
97
|
})], l.prototype, "amountWeight", void 0), r([n({
|
|
109
|
-
type: String,
|
|
110
|
-
attribute: "currency-size"
|
|
111
|
-
})], l.prototype, "currencySize", void 0), r([n({
|
|
112
|
-
type: String,
|
|
113
|
-
attribute: "currency-weight"
|
|
114
|
-
})], l.prototype, "currencyWeight", void 0), r([n({
|
|
115
98
|
type: String,
|
|
116
99
|
attribute: "period-size"
|
|
117
100
|
})], l.prototype, "periodSize", void 0), r([n({
|
|
@@ -37,7 +37,7 @@ var l = class extends r {
|
|
|
37
37
|
let e = this.displayValue, t = [];
|
|
38
38
|
for (let n = 1; n <= 5; n++) {
|
|
39
39
|
let r = this.getStarIconName(n, e);
|
|
40
|
-
|
|
40
|
+
t.push(o`<ds-icon class="star-icon" icon-name=${r} size="16"></ds-icon>`);
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
@@ -189,7 +189,7 @@ var x, S = class extends u(o) {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
get rangeValuesTemplates() {
|
|
192
|
-
let {
|
|
192
|
+
let { formattedNumber: n, unitSymbol: r, unitSymbolPosition: i } = this.formatNumber(this.min), a = this.unitSymbol ?? r, o = this.unitSymbolPosition ?? i, { formattedNumber: s } = this.formatNumber(this.max);
|
|
193
193
|
return t`
|
|
194
194
|
<div class="range-value-text">
|
|
195
195
|
${this.minLabel ? t`<span class="range-value-label">${this.minLabel}</span>` : e}
|
|
@@ -260,7 +260,7 @@ var x, S = class extends u(o) {
|
|
|
260
260
|
`;
|
|
261
261
|
}
|
|
262
262
|
getInputTemplate(e) {
|
|
263
|
-
let n = this.getRoleById(e), r = this.editingField === n, i = n === "min" ? this._valueMin : this._valueMax, {
|
|
263
|
+
let n = this.getRoleById(e), r = this.editingField === n, i = n === "min" ? this._valueMin : this._valueMax, { formattedNumber: a, unitSymbol: o, unitSymbolPosition: s } = this.formatNumber(i), c = this.unitSymbolPosition ?? s, l = this.unitSymbol ?? o, u = l ? c === "left" ? `${l} ${a}` : `${a} ${l}` : `${a}`, d = r ? "number" : "text", f = r ? String(i ?? "") : u, p = e === 1 ? this.inputMinAriaLabel : this.inputMaxAriaLabel, m = this.isRange ? e === 1 ? "Start value" : "End value" : "Value", g = p ?? m;
|
|
264
264
|
return t`
|
|
265
265
|
<div class="input-wrapper">
|
|
266
266
|
<input
|
|
@@ -50,7 +50,7 @@ var p = class extends o {
|
|
|
50
50
|
}
|
|
51
51
|
loadThemeStyles() {
|
|
52
52
|
return this.loadStyles ? new Promise((e, t) => {
|
|
53
|
-
let n = "/2.0.0-canary.
|
|
53
|
+
let n = "/2.0.0-canary.143", r = `https://ds-assets.cupra.com${n}/styles/${this.theme}/theme.css`;
|
|
54
54
|
if (document.head.querySelector(`link[href="${r}"]`)) e();
|
|
55
55
|
else {
|
|
56
56
|
let i = `ui-kit-theme-${n}`, a = document.getElementById(i), o = document.createElement("link");
|
|
@@ -11,7 +11,7 @@ function e(e, t) {
|
|
|
11
11
|
this.componentName = i;
|
|
12
12
|
}
|
|
13
13
|
connectedCallback() {
|
|
14
|
-
n.prototype.connectedCallback?.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.
|
|
14
|
+
n.prototype.connectedCallback?.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.143");
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
};
|
|
@@ -25,7 +25,7 @@ var n = class {
|
|
|
25
25
|
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
26
26
|
}), t.subscribe("theme", this.handleChangeTheme);
|
|
27
27
|
}
|
|
28
|
-
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
28
|
+
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.143"), i = globalThis, a = i[r];
|
|
29
29
|
a || (a = new n(), Object.defineProperty(i, r, {
|
|
30
30
|
value: a,
|
|
31
31
|
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.143"), 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.143/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,6 +1,6 @@
|
|
|
1
1
|
//#region src/utils/formatNumber/formatNumber.ts
|
|
2
2
|
function e({ value: e, locale: t, style: n, unit: r, currency: i, localeMatcher: a = "lookup", minimumIntegerDigits: o = 1, minimumFractionDigits: s = 0, maximumFractionDigits: c = 20, thousandSeparator: l, fractionSeparator: u, useGrouping: d = "auto", currencyDisplay: f = "symbol" }) {
|
|
3
|
-
let p = "", m, h, g = new Intl.NumberFormat(t, {
|
|
3
|
+
let p = "", m = "", h, g, _ = new Intl.NumberFormat(t, {
|
|
4
4
|
...n && { style: n },
|
|
5
5
|
...r && { unit: r },
|
|
6
6
|
...i && { currency: i },
|
|
@@ -11,30 +11,38 @@ function e({ value: e, locale: t, style: n, unit: r, currency: i, localeMatcher:
|
|
|
11
11
|
maximumFractionDigits: c,
|
|
12
12
|
useGrouping: d
|
|
13
13
|
}).formatToParts(e ?? 0);
|
|
14
|
-
return
|
|
14
|
+
return _.forEach((e, t) => {
|
|
15
15
|
switch (e.type) {
|
|
16
16
|
case "unit":
|
|
17
17
|
case "currency":
|
|
18
18
|
case "percentSign":
|
|
19
|
-
|
|
19
|
+
h = e.value, g = t === 0 || (_[0].type === "minusSign" || _[0].type === "plusSign") && t === 1 ? "left" : "right", m += e.value;
|
|
20
20
|
break;
|
|
21
|
-
case "group":
|
|
22
|
-
|
|
21
|
+
case "group": {
|
|
22
|
+
let t = l ?? e.value;
|
|
23
|
+
p += t, m += t;
|
|
23
24
|
break;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
}
|
|
26
|
+
case "decimal": {
|
|
27
|
+
let t = u ?? e.value;
|
|
28
|
+
p += t, m += t;
|
|
26
29
|
break;
|
|
30
|
+
}
|
|
27
31
|
case "integer":
|
|
28
32
|
case "fraction":
|
|
29
33
|
case "plusSign":
|
|
30
34
|
case "minusSign":
|
|
31
|
-
p += e.value;
|
|
35
|
+
p += e.value, m += e.value;
|
|
36
|
+
break;
|
|
37
|
+
case "literal":
|
|
38
|
+
m += e.value;
|
|
32
39
|
break;
|
|
33
40
|
}
|
|
34
41
|
}), {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...h && {
|
|
42
|
+
formattedNumber: p,
|
|
43
|
+
formattedValue: m,
|
|
44
|
+
...h && { unitSymbol: h },
|
|
45
|
+
...g && { unitSymbolPosition: g }
|
|
38
46
|
};
|
|
39
47
|
}
|
|
40
48
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UiKitElement } from '../base/UiKitElement.ts';
|
|
2
2
|
import '../ds-icon/ds-icon.ts';
|
|
3
|
-
import { DsAvatarAttrs } from './ds-avatar.types.ts';
|
|
3
|
+
import type { DsAvatarAttrs } from './ds-avatar.types.ts';
|
|
4
4
|
export declare class DsAvatar extends UiKitElement {
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
size: DsAvatarAttrs['size'];
|
|
@@ -16,8 +16,6 @@ export declare class DsCurrency extends UiKitElement {
|
|
|
16
16
|
fractionSeparator: DsCurrencyAttrs['fraction-separator'];
|
|
17
17
|
amountSize: DsCurrencyAttrs['amount-size'];
|
|
18
18
|
amountWeight: DsCurrencyAttrs['amount-weight'];
|
|
19
|
-
currencySize: DsCurrencyAttrs['currency-size'];
|
|
20
|
-
currencyWeight: DsCurrencyAttrs['currency-weight'];
|
|
21
19
|
periodSize: DsCurrencyAttrs['period-size'];
|
|
22
20
|
periodWeight: DsCurrencyAttrs['period-weight'];
|
|
23
21
|
noteSize: DsCurrencyAttrs['note-size'];
|
|
@@ -24,8 +24,6 @@ export type DsCurrencyAttrs = CommonAttrs & Amount & {
|
|
|
24
24
|
note?: string;
|
|
25
25
|
'amount-size'?: FontSize;
|
|
26
26
|
'amount-weight'?: FontWeight;
|
|
27
|
-
'currency-size'?: FontSize;
|
|
28
|
-
'currency-weight'?: FontWeight;
|
|
29
27
|
'period-size'?: FontSize;
|
|
30
28
|
'period-weight'?: FontWeight;
|
|
31
29
|
'note-size'?: FontSize;
|
|
@@ -236,6 +236,7 @@ export type FormatNumberProps = UnitStyle & {
|
|
|
236
236
|
currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name';
|
|
237
237
|
};
|
|
238
238
|
export type FormatedNumber = {
|
|
239
|
+
formattedNumber: string;
|
|
239
240
|
formattedValue: string;
|
|
240
241
|
unitSymbol?: string;
|
|
241
242
|
unitSymbolPosition?: 'left' | 'right';
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`),a=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const o=require(`../../utils/formatNumber/formatNumber.cjs`),s=require(`./styles/common.styles.cjs`);var c=class extends r.UiKitElement{constructor(...e){super(...e),this.currencyDisplay=`symbol`,this.minimumFractionDigits=0,this.maximumFractionDigits=20,this.amountSize=`medium`,this.amountWeight=`medium`,this.
|
|
2
|
-
${r===`left`?e.x`<span class=${a.e(c)}>${n}</span>`:e.E}
|
|
3
|
-
<span class=${a.e(s)}>${i}</span>
|
|
4
|
-
${r===`right`?e.x`<span class=${a.e(c)}>${n}</span>`:e.E}
|
|
5
|
-
`}get periodTemplate(){if(!this.period)return e.E;let t=new Intl.DisplayNames(this.locale,{type:`dateTimeField`});return e.x`<span class=${a.e({period:!0,text:!0,[`size-${this.periodSize}`]:!0,[`weight-${this.periodWeight}`]:!0})}"period">/${t.of(this.period)}</span>`}get noteTemplate(){return this.note?e.x`<span class=${a.e({note:!0,text:!0,[`size-${this.noteSize}`]:!0,[`weight-${this.noteWeight}`]:!0})}>${this.note}</span>`:e.E}render(){let t={container:!0,strikethrough:this.variant===`strikethrough`},n=this.variant===`strikethrough`?e.x`<div class="strikethrough-line"></div>`:e.E;return e.x`<div class=${a.e(t)}>
|
|
1
|
+
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`),a=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const o=require(`../../utils/formatNumber/formatNumber.cjs`),s=require(`./styles/common.styles.cjs`);var c=class extends r.UiKitElement{constructor(...e){super(...e),this.currencyDisplay=`symbol`,this.minimumFractionDigits=0,this.maximumFractionDigits=20,this.amountSize=`medium`,this.amountWeight=`medium`,this.periodSize=`medium`,this.periodWeight=`medium`,this.noteSize=`medium`,this.noteWeight=`medium`,this.variant=`default`}static{this.styles=[s.commonStyles]}get valueTemplate(){let{formattedValue:t}=o.formatNumber({value:this.amountNumber??0,locale:this.locale,style:`currency`,currency:this.currencyCode,localeMatcher:`lookup`,useGrouping:`always`,minimumFractionDigits:this.minimumFractionDigits,maximumFractionDigits:this.maximumFractionDigits,currencyDisplay:this.currencyDisplay}),n=this.amountText||t;return e.x`<span class=${a.e({amount:!0,text:!0,[`size-${this.amountSize}`]:!0,[`weight-${this.amountWeight}`]:!0})}>${n}</span>`}get periodTemplate(){if(!this.period)return e.E;let t=new Intl.DisplayNames(this.locale,{type:`dateTimeField`});return e.x`<span class=${a.e({period:!0,text:!0,[`size-${this.periodSize}`]:!0,[`weight-${this.periodWeight}`]:!0})}"period">/${t.of(this.period)}</span>`}get noteTemplate(){return this.note?e.x`<span class=${a.e({note:!0,text:!0,[`size-${this.noteSize}`]:!0,[`weight-${this.noteWeight}`]:!0})}>${this.note}</span>`:e.E}render(){let t={container:!0,strikethrough:this.variant===`strikethrough`},n=this.variant===`strikethrough`?e.x`<div class="strikethrough-line"></div>`:e.E;return e.x`<div class=${a.e(t)}>
|
|
6
2
|
${this.valueTemplate}${this.periodTemplate}${this.noteTemplate}${n}
|
|
7
|
-
</div>`}};n.__decorate([t.n({type:String})],c.prototype,`locale`,void 0),n.__decorate([t.n({type:String,attribute:`currency-code`})],c.prototype,`currencyCode`,void 0),n.__decorate([t.n({type:String,attribute:`currency-display`})],c.prototype,`currencyDisplay`,void 0),n.__decorate([t.n({type:String,attribute:`amount-text`})],c.prototype,`amountText`,void 0),n.__decorate([t.n({type:Number,attribute:`amount-number`})],c.prototype,`amountNumber`,void 0),n.__decorate([t.n({type:Number,attribute:`minimum-fraction-digits`})],c.prototype,`minimumFractionDigits`,void 0),n.__decorate([t.n({type:Number,attribute:`maximum-fraction-digits`})],c.prototype,`maximumFractionDigits`,void 0),n.__decorate([t.n({type:String})],c.prototype,`period`,void 0),n.__decorate([t.n({type:String})],c.prototype,`note`,void 0),n.__decorate([t.n({type:String,attribute:`thousand-separator`})],c.prototype,`thousandSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`fraction-separator`})],c.prototype,`fractionSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`amount-size`})],c.prototype,`amountSize`,void 0),n.__decorate([t.n({type:String,attribute:`amount-weight`})],c.prototype,`amountWeight`,void 0),n.__decorate([t.n({type:String,attribute:`
|
|
3
|
+
</div>`}};n.__decorate([t.n({type:String})],c.prototype,`locale`,void 0),n.__decorate([t.n({type:String,attribute:`currency-code`})],c.prototype,`currencyCode`,void 0),n.__decorate([t.n({type:String,attribute:`currency-display`})],c.prototype,`currencyDisplay`,void 0),n.__decorate([t.n({type:String,attribute:`amount-text`})],c.prototype,`amountText`,void 0),n.__decorate([t.n({type:Number,attribute:`amount-number`})],c.prototype,`amountNumber`,void 0),n.__decorate([t.n({type:Number,attribute:`minimum-fraction-digits`})],c.prototype,`minimumFractionDigits`,void 0),n.__decorate([t.n({type:Number,attribute:`maximum-fraction-digits`})],c.prototype,`maximumFractionDigits`,void 0),n.__decorate([t.n({type:String})],c.prototype,`period`,void 0),n.__decorate([t.n({type:String})],c.prototype,`note`,void 0),n.__decorate([t.n({type:String,attribute:`thousand-separator`})],c.prototype,`thousandSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`fraction-separator`})],c.prototype,`fractionSeparator`,void 0),n.__decorate([t.n({type:String,attribute:`amount-size`})],c.prototype,`amountSize`,void 0),n.__decorate([t.n({type:String,attribute:`amount-weight`})],c.prototype,`amountWeight`,void 0),n.__decorate([t.n({type:String,attribute:`period-size`})],c.prototype,`periodSize`,void 0),n.__decorate([t.n({type:String,attribute:`period-weight`})],c.prototype,`periodWeight`,void 0),n.__decorate([t.n({type:String,attribute:`note-size`})],c.prototype,`noteSize`,void 0),n.__decorate([t.n({type:String,attribute:`note-weight`})],c.prototype,`noteWeight`,void 0),n.__decorate([t.n({type:String})],c.prototype,`variant`,void 0),c=n.__decorate([i.customUiKitElement(`ds-currency`)],c);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`);require(`../ds-icon/ds-icon.cjs`);const a=require(`../../utils/booleanConverter.cjs`),o=require(`../../utils/uiKitHtml.cjs`),s=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const c=require(`./styles/common.styles.cjs`);var l=class extends r.UiKitElement{constructor(...e){super(...e),this.disabled=!1,this.hideRatingText=!1}static{this.styles=[c.commonStyles]}get displayValue(){if(this.value===void 0||this.value===null||this.value<0)return 0;let e=Math.max(0,Math.min(5,this.value)),t=Math.floor(e),n=Number((e-t).toFixed(2));return t+Math.round(n/.5)*.5}get classes(){return{container:!0,disabled:this.disabled}}getStarIconName(e,t){return t>=e?`star-filled`:t>=e-.5?`half-star-filled`:`star`}get starsTemplate(){let e=this.displayValue,t=[];for(let n=1;n<=5;n++){let r=this.getStarIconName(n,e);
|
|
1
|
+
const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const n=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),r=require(`../base/UiKitElement.cjs`),i=require(`../../decorators/customUiKitElement.cjs`);require(`../ds-icon/ds-icon.cjs`);const a=require(`../../utils/booleanConverter.cjs`),o=require(`../../utils/uiKitHtml.cjs`),s=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const c=require(`./styles/common.styles.cjs`);var l=class extends r.UiKitElement{constructor(...e){super(...e),this.disabled=!1,this.hideRatingText=!1}static{this.styles=[c.commonStyles]}get displayValue(){if(this.value===void 0||this.value===null||this.value<0)return 0;let e=Math.max(0,Math.min(5,this.value)),t=Math.floor(e),n=Number((e-t).toFixed(2));return t+Math.round(n/.5)*.5}get classes(){return{container:!0,disabled:this.disabled}}getStarIconName(e,t){return t>=e?`star-filled`:t>=e-.5?`half-star-filled`:`star`}get starsTemplate(){let e=this.displayValue,t=[];for(let n=1;n<=5;n++){let r=this.getStarIconName(n,e);t.push(o.uiKitHtml`<ds-icon class="star-icon" icon-name=${r} size="16"></ds-icon>`)}return t}render(){let t=this.value!==void 0&&this.value>=0?this.value:0,n=Math.max(0,Math.min(5,t)).toString();return e.x`
|
|
2
2
|
<div class=${s.e(this.classes)} aria-label=${`Rating: ${n} out of 5`} role="img">
|
|
3
3
|
<div class="stars-wrapper">${this.starsTemplate}</div>
|
|
4
4
|
${this.hideRatingText?``:e.x`<span class="rating-text">${n}</span>`}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),n=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`),r=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const i=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),a=require(`../base/UiKitElement.cjs`),o=require(`../../decorators/customUiKitElement.cjs`),s=require(`../../utils/booleanConverter.cjs`),c=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const l=require(`../../mixins/ViewportMixin.cjs`),u=require(`../../utils/objectConverter.cjs`),d=require(`../../utils/formatNumber/formatNumber.cjs`),f=require(`./utils/getStepValue/getStepValue.cjs`),p=require(`./utils/roundToDecimals/roundToDecimals.cjs`),m=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/live.cjs`);const h=require(`./styles/common.styles.cjs`);var g,_=class extends l.ViewportMixin(a.UiKitElement){static{g=this}constructor(...e){super(...e),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);typeof this._valueMax!=`number`||t<=this._valueMin?this.activeThumb=`min`:t>=this._valueMax?this.activeThumb=`max`:t-this._valueMin<this._valueMax-t?this.activeThumb=`min`:this.activeThumb=`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=>{this.disabled||(e?.preventDefault?.(),this.setActiveThumb(e),this.handleMouseMove(e),window?.addEventListener(`mousemove`,this.handleMouseMove),window?.addEventListener(`touchmove`,this.handleMouseMove),window?.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.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});this.handleChange({value:i,role:r}),this.isControlled(r)||(n.value=String(i))},this.onInputBlur=e=>{this.editingField=void 0,e.currentTarget?.classList?.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})}}}static{this.styles=[h.commonStyles,h.trackStyles,h.thumbStyles,h.currentValueStyles,h.rangeValueStyles]}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}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 f.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(){super.disconnectedCallback(),window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.removeEventListener(`pointerup`,this.handlePointerUp),window?.removeEventListener(`keydown`,this.handleKeydown),window?.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){super.firstUpdated(e),window?.addEventListener(`keydown`,this.handleKeydown),window?.addEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=this[e===`min`?`initialValueMin`:`initialValueMax`];if(typeof t!=`number`)return;let{stepValue:n}=this.computeStep({proposedValue:t,role:e});this[e===`min`?`_valueMin`:`_valueMax`]!==n&&this.handleChange({value:n,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){let e=this.renderRoot?.querySelector(`.thumb`);return e?e.offsetWidth/2:0}static{this.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`}trackPosition(e){let t=g.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${g.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){return d.formatNumber({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})}get rangeValuesTemplates(){let{
|
|
1
|
+
require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const t=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),n=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`),r=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const i=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),a=require(`../base/UiKitElement.cjs`),o=require(`../../decorators/customUiKitElement.cjs`),s=require(`../../utils/booleanConverter.cjs`),c=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/class-map.cjs`);const l=require(`../../mixins/ViewportMixin.cjs`),u=require(`../../utils/objectConverter.cjs`),d=require(`../../utils/formatNumber/formatNumber.cjs`),f=require(`./utils/getStepValue/getStepValue.cjs`),p=require(`./utils/roundToDecimals/roundToDecimals.cjs`),m=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/directives/live.cjs`);const h=require(`./styles/common.styles.cjs`);var g,_=class extends l.ViewportMixin(a.UiKitElement){static{g=this}constructor(...e){super(...e),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);typeof this._valueMax!=`number`||t<=this._valueMin?this.activeThumb=`min`:t>=this._valueMax?this.activeThumb=`max`:t-this._valueMin<this._valueMax-t?this.activeThumb=`min`:this.activeThumb=`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=>{this.disabled||(e?.preventDefault?.(),this.setActiveThumb(e),this.handleMouseMove(e),window?.addEventListener(`mousemove`,this.handleMouseMove),window?.addEventListener(`touchmove`,this.handleMouseMove),window?.addEventListener(`pointerup`,this.handlePointerUp))},this.handlePointerUp=()=>{window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.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});this.handleChange({value:i,role:r}),this.isControlled(r)||(n.value=String(i))},this.onInputBlur=e=>{this.editingField=void 0,e.currentTarget?.classList?.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})}}}static{this.styles=[h.commonStyles,h.trackStyles,h.thumbStyles,h.currentValueStyles,h.rangeValueStyles]}get isRange(){return typeof this.initialValueMax==`number`||typeof this.valueMax==`number`}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 f.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(){super.disconnectedCallback(),window?.removeEventListener(`mousemove`,this.handleMouseMove),window?.removeEventListener(`touchmove`,this.handleMouseMove),window?.removeEventListener(`pointerup`,this.handlePointerUp),window?.removeEventListener(`keydown`,this.handleKeydown),window?.removeEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.removeEventListener(`pointerdown`,this.handlePointerOrMouseDown)}firstUpdated(e){super.firstUpdated(e),window?.addEventListener(`keydown`,this.handleKeydown),window?.addEventListener(`mousedown`,this.handlePointerOrMouseDown),window?.addEventListener(`pointerdown`,this.handlePointerOrMouseDown)}applyInitialValues(){[`min`,`max`].forEach(e=>{if(this.isControlled(e))return;let t=this[e===`min`?`initialValueMin`:`initialValueMax`];if(typeof t!=`number`)return;let{stepValue:n}=this.computeStep({proposedValue:t,role:e});this[e===`min`?`_valueMin`:`_valueMax`]!==n&&this.handleChange({value:n,role:e})})}getTrackPct(e){let t=this.max-this.min;return t===0?0:(e-this.min)/t*100}get thumbRadius(){let e=this.renderRoot?.querySelector(`.thumb`);return e?e.offsetWidth/2:0}static{this.THUMB_RADIUS_CSS_VAR=`var(--ui-kit-private-slider-thumb-radius, 0px)`}trackPosition(e){let t=g.THUMB_RADIUS_CSS_VAR;return`calc(${t} + (100% - ${t} * 2) * ${e/100})`}trackWidth(e){return`calc((100% - ${g.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){return d.formatNumber({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})}get rangeValuesTemplates(){let{formattedNumber:t,unitSymbol:n,unitSymbolPosition:r}=this.formatNumber(this.min),i=this.unitSymbol??n,a=this.unitSymbolPosition??r,{formattedNumber:o}=this.formatNumber(this.max);return e.x`
|
|
2
2
|
<div class="range-value-text">
|
|
3
3
|
${this.minLabel?e.x`<span class="range-value-label">${this.minLabel}</span>`:e.E}
|
|
4
4
|
${a===`left`?e.x`<span>${i}</span>`:e.E}
|
|
@@ -49,7 +49,7 @@ require(`../ds-theme-provider/themeContext.cjs`);const e=require(`../../node_mod
|
|
|
49
49
|
}
|
|
50
50
|
</style>
|
|
51
51
|
<div class="track-range" role="presentation"></div>
|
|
52
|
-
`}getInputTemplate(t){let n=this.getRoleById(t),r=this.editingField===n,i=n===`min`?this._valueMin:this._valueMax,{
|
|
52
|
+
`}getInputTemplate(t){let n=this.getRoleById(t),r=this.editingField===n,i=n===`min`?this._valueMin:this._valueMax,{formattedNumber:a,unitSymbol:o,unitSymbolPosition:s}=this.formatNumber(i),c=this.unitSymbolPosition??s,l=this.unitSymbol??o,u=l?c===`left`?`${l} ${a}`:`${a} ${l}`:`${a}`,d=r?`number`:`text`,f=r?String(i??``):u,p=t===1?this.inputMinAriaLabel:this.inputMaxAriaLabel,h=this.isRange?t===1?`Start value`:`End value`:`Value`,g=p??h;return e.x`
|
|
53
53
|
<div class="input-wrapper">
|
|
54
54
|
<input
|
|
55
55
|
class="input-value input-value-${t}"
|
|
@@ -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`),n=require(`../../core/theme.constants.cjs`),r=require(`../../utils/PubSub.cjs`),i=require(`../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.cjs`),a=require(`../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/index.cjs`);const o=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.cjs`),s=require(`../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.cjs`);require(`../../node_modules/.pnpm/lit@3.3.1/node_modules/lit/decorators.cjs`);const c=require(`../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.cjs`),l=require(`../../decorators/customUiKitElement.cjs`),u=require(`../../utils/booleanConverter.cjs`),d=require(`../../styles/source/shared/fonts-config.cjs`);var f=class extends a.i{constructor(...e){super(...e),this.loadFonts=!0,this.loadStyles=!0,this.cssLoaded=!1,this.loadedFonts=new Set}updated(e){super.updated(e),e.has(`theme`)&&(r.pubSub.publish(`theme`,this.theme),sessionStorage?.setItem(n.THEME_STORAGE_KEY,this.theme),typeof FontFace<`u`&&document?.fonts&&this.loadThemeFonts(),this.loadThemeStyles().then(()=>{this.cssLoaded=!0,this.dispatchEvent(new CustomEvent(`ui-kit:ready`,{bubbles:!0,composed:!0}))}))}loadThemeFonts(){d.fontsConfig[this.theme]?.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:`swap`});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(){return this.loadStyles?new Promise((e,t)=>{let n=`/2.0.0-canary.
|
|
4
|
+
url('https://ds-assets.cupra.com/fonts/${this.theme}/${n}.otf') format('opentype')`,{style:`normal`,weight:e,display:`swap`});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(){return this.loadStyles?new Promise((e,t)=>{let n=`/2.0.0-canary.143`,r=`https://ds-assets.cupra.com${n}/styles/${this.theme}/theme.css`;if(document.head.querySelector(`link[href="${r}"]`))e();else{let i=`ui-kit-theme-${n}`,a=document.getElementById(i),o=document.createElement(`link`);o.id=i,o.rel=`stylesheet`,o.href=r,o.onload=()=>e(),o.onerror=()=>t(Error(`Failed to load theme CSS: ${r}`)),document.head.appendChild(o),a?.remove()}}):Promise.resolve()}render(){return this.cssLoaded?i.x`<slot></slot>`:i.E}};c.__decorate([o.n({type:Boolean,converter:u.booleanConverter,attribute:`load-fonts`})],f.prototype,`loadFonts`,void 0),c.__decorate([o.n({type:Boolean,converter:u.booleanConverter,attribute:`load-styles`})],f.prototype,`loadStyles`,void 0),c.__decorate([e.e({context:t.themeContext}),o.n({type:String})],f.prototype,`theme`,void 0),c.__decorate([s.r()],f.prototype,`cssLoaded`,void 0),c.__decorate([s.r()],f.prototype,`loadedFonts`,void 0),f=c.__decorate([l.customUiKitElement(`ds-theme-provider`)],f);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../utils/version.cjs`);function t(t,n){return function(r){if(!r?.prototype)throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let i=`${t}${e.VERSION_TAG_SUFFIX}`;if(globalThis?.customElements?.get(i))return;let a=n?.skipTagAsComponentName?[]:[t];Array.isArray(n?.extendComponentNames)&&(a=[...n.extendComponentNames,...a]),globalThis?.customElements?.define?.(i,class extends r{static{this.componentName=a}connectedCallback(){r.prototype.connectedCallback?.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){if(!r?.prototype)throw TypeError(`@customUiKitElement requires a class that extends HTMLElement.`);let i=`${t}${e.VERSION_TAG_SUFFIX}`;if(globalThis?.customElements?.get(i))return;let a=n?.skipTagAsComponentName?[]:[t];Array.isArray(n?.extendComponentNames)&&(a=[...n.extendComponentNames,...a]),globalThis?.customElements?.define?.(i,class extends r{static{this.componentName=a}connectedCallback(){r.prototype.connectedCallback?.call(this),this.setAttribute(`data-ui-kit-version`,`2.0.0-canary.143`)}})}}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={})=>{let r=typeof sessionStorage<`u`?sessionStorage?.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&r&&(this.theme=r);let i=this.icons[t];if(i)return await i;let a=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=a,a},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?.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={})=>{let r=typeof sessionStorage<`u`?sessionStorage?.getItem(e.THEME_STORAGE_KEY):null;!this.theme&&r&&(this.theme=r);let i=this.icons[t];if(i)return await i;let a=this.loadIcon(t,n).catch(e=>{throw delete this.icons[t],e});return this.icons[t]=a,a},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?.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.143`),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.143`),n=globalThis,r=n[t];r||(r=new e,Object.defineProperty(n,t,{value:r,writable:!1,configurable:!1,enumerable:!1}));var i=r;exports.pubSub=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require(`../concurrencyLimit.cjs`).concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.
|
|
1
|
+
var e=require(`../concurrencyLimit.cjs`).concurrencyLimit(20),t=class t{constructor(){this.stylePromises=new Map,this.getStyles=async({componentName:t,theme:n})=>{if(!n||!t)return;let r=`https://ds-assets.cupra.com/2.0.0-canary.143/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||=new t,t.instance}}.getInstance();exports.stylesRegistry=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e({value:e,locale:t,style:n,unit:r,currency:i,localeMatcher:a=`lookup`,minimumIntegerDigits:o=1,minimumFractionDigits:s=0,maximumFractionDigits:c=20,thousandSeparator:l,fractionSeparator:u,useGrouping:d=`auto`,currencyDisplay:f=`symbol`}){let p=``,m
|
|
1
|
+
function e({value:e,locale:t,style:n,unit:r,currency:i,localeMatcher:a=`lookup`,minimumIntegerDigits:o=1,minimumFractionDigits:s=0,maximumFractionDigits:c=20,thousandSeparator:l,fractionSeparator:u,useGrouping:d=`auto`,currencyDisplay:f=`symbol`}){let p=``,m=``,h,g,_=new Intl.NumberFormat(t,{...n&&{style:n},...r&&{unit:r},...i&&{currency:i},currencyDisplay:f,localeMatcher:a,minimumIntegerDigits:o,minimumFractionDigits:s,maximumFractionDigits:c,useGrouping:d}).formatToParts(e??0);return _.forEach((e,t)=>{switch(e.type){case`unit`:case`currency`:case`percentSign`:h=e.value,g=t===0||(_[0].type===`minusSign`||_[0].type===`plusSign`)&&t===1?`left`:`right`,m+=e.value;break;case`group`:{let t=l??e.value;p+=t,m+=t;break}case`decimal`:{let t=u??e.value;p+=t,m+=t;break}case`integer`:case`fraction`:case`plusSign`:case`minusSign`:p+=e.value,m+=e.value;break;case`literal`:m+=e.value;break}}),{formattedNumber:p,formattedValue:m,...h&&{unitSymbol:h},...g&&{unitSymbolPosition:g}}}exports.formatNumber=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`2.0.0-canary.
|
|
1
|
+
var e=`2.0.0-canary.143`,t=`--v${e.replaceAll(`.`,`-`)}`;exports.VERSION=e,exports.VERSION_TAG_SUFFIX=t;
|
|
@@ -12,13 +12,13 @@ import { commonStyles as c } from "./styles/common.styles.js";
|
|
|
12
12
|
//#region src/components/ds-currency/ds-currency.ts
|
|
13
13
|
var l = class extends i {
|
|
14
14
|
constructor(...e) {
|
|
15
|
-
super(...e), this.currencyDisplay = "symbol", this.minimumFractionDigits = 0, this.maximumFractionDigits = 20, this.amountSize = "medium", this.amountWeight = "medium", this.
|
|
15
|
+
super(...e), this.currencyDisplay = "symbol", this.minimumFractionDigits = 0, this.maximumFractionDigits = 20, this.amountSize = "medium", this.amountWeight = "medium", this.periodSize = "medium", this.periodWeight = "medium", this.noteSize = "medium", this.noteWeight = "medium", this.variant = "default";
|
|
16
16
|
}
|
|
17
17
|
static {
|
|
18
18
|
this.styles = [c];
|
|
19
19
|
}
|
|
20
20
|
get valueTemplate() {
|
|
21
|
-
let { formattedValue:
|
|
21
|
+
let { formattedValue: e } = s({
|
|
22
22
|
value: this.amountNumber ?? 0,
|
|
23
23
|
locale: this.locale,
|
|
24
24
|
style: "currency",
|
|
@@ -28,24 +28,13 @@ var l = class extends i {
|
|
|
28
28
|
minimumFractionDigits: this.minimumFractionDigits,
|
|
29
29
|
maximumFractionDigits: this.maximumFractionDigits,
|
|
30
30
|
currencyDisplay: this.currencyDisplay
|
|
31
|
-
}),
|
|
31
|
+
}), n = this.amountText || e;
|
|
32
|
+
return t`<span class=${o({
|
|
32
33
|
amount: !0,
|
|
33
34
|
text: !0,
|
|
34
35
|
[`size-${this.amountSize}`]: !0,
|
|
35
36
|
[`weight-${this.amountWeight}`]: !0
|
|
36
|
-
}
|
|
37
|
-
currency: !0,
|
|
38
|
-
left: i === "left",
|
|
39
|
-
right: i === "right",
|
|
40
|
-
text: !0,
|
|
41
|
-
[`size-${this.currencySize}`]: !0,
|
|
42
|
-
[`weight-${this.currencyWeight}`]: !0
|
|
43
|
-
};
|
|
44
|
-
return t`
|
|
45
|
-
${i === "left" ? t`<span class=${o(l)}>${r}</span>` : e}
|
|
46
|
-
<span class=${o(c)}>${a}</span>
|
|
47
|
-
${i === "right" ? t`<span class=${o(l)}>${r}</span>` : e}
|
|
48
|
-
`;
|
|
37
|
+
})}>${n}</span>`;
|
|
49
38
|
}
|
|
50
39
|
get periodTemplate() {
|
|
51
40
|
if (!this.period) return e;
|
|
@@ -106,12 +95,6 @@ r([n({ type: String })], l.prototype, "locale", void 0), r([n({
|
|
|
106
95
|
type: String,
|
|
107
96
|
attribute: "amount-weight"
|
|
108
97
|
})], l.prototype, "amountWeight", void 0), r([n({
|
|
109
|
-
type: String,
|
|
110
|
-
attribute: "currency-size"
|
|
111
|
-
})], l.prototype, "currencySize", void 0), r([n({
|
|
112
|
-
type: String,
|
|
113
|
-
attribute: "currency-weight"
|
|
114
|
-
})], l.prototype, "currencyWeight", void 0), r([n({
|
|
115
98
|
type: String,
|
|
116
99
|
attribute: "period-size"
|
|
117
100
|
})], l.prototype, "periodSize", void 0), r([n({
|
|
@@ -37,7 +37,7 @@ var l = class extends r {
|
|
|
37
37
|
let e = this.displayValue, t = [];
|
|
38
38
|
for (let n = 1; n <= 5; n++) {
|
|
39
39
|
let r = this.getStarIconName(n, e);
|
|
40
|
-
|
|
40
|
+
t.push(o`<ds-icon class="star-icon" icon-name=${r} size="16"></ds-icon>`);
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
@@ -189,7 +189,7 @@ var x, S = class extends u(o) {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
get rangeValuesTemplates() {
|
|
192
|
-
let {
|
|
192
|
+
let { formattedNumber: n, unitSymbol: r, unitSymbolPosition: i } = this.formatNumber(this.min), a = this.unitSymbol ?? r, o = this.unitSymbolPosition ?? i, { formattedNumber: s } = this.formatNumber(this.max);
|
|
193
193
|
return t`
|
|
194
194
|
<div class="range-value-text">
|
|
195
195
|
${this.minLabel ? t`<span class="range-value-label">${this.minLabel}</span>` : e}
|
|
@@ -260,7 +260,7 @@ var x, S = class extends u(o) {
|
|
|
260
260
|
`;
|
|
261
261
|
}
|
|
262
262
|
getInputTemplate(e) {
|
|
263
|
-
let n = this.getRoleById(e), r = this.editingField === n, i = n === "min" ? this._valueMin : this._valueMax, {
|
|
263
|
+
let n = this.getRoleById(e), r = this.editingField === n, i = n === "min" ? this._valueMin : this._valueMax, { formattedNumber: a, unitSymbol: o, unitSymbolPosition: s } = this.formatNumber(i), c = this.unitSymbolPosition ?? s, l = this.unitSymbol ?? o, u = l ? c === "left" ? `${l} ${a}` : `${a} ${l}` : `${a}`, d = r ? "number" : "text", f = r ? String(i ?? "") : u, p = e === 1 ? this.inputMinAriaLabel : this.inputMaxAriaLabel, m = this.isRange ? e === 1 ? "Start value" : "End value" : "Value", g = p ?? m;
|
|
264
264
|
return t`
|
|
265
265
|
<div class="input-wrapper">
|
|
266
266
|
<input
|
|
@@ -50,7 +50,7 @@ var p = class extends o {
|
|
|
50
50
|
}
|
|
51
51
|
loadThemeStyles() {
|
|
52
52
|
return this.loadStyles ? new Promise((e, t) => {
|
|
53
|
-
let n = "/2.0.0-canary.
|
|
53
|
+
let n = "/2.0.0-canary.143", r = `https://ds-assets.cupra.com${n}/styles/${this.theme}/theme.css`;
|
|
54
54
|
if (document.head.querySelector(`link[href="${r}"]`)) e();
|
|
55
55
|
else {
|
|
56
56
|
let i = `ui-kit-theme-${n}`, a = document.getElementById(i), o = document.createElement("link");
|
|
@@ -11,7 +11,7 @@ function t(t, n) {
|
|
|
11
11
|
this.componentName = a;
|
|
12
12
|
}
|
|
13
13
|
connectedCallback() {
|
|
14
|
-
r.prototype.connectedCallback?.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.
|
|
14
|
+
r.prototype.connectedCallback?.call(this), this.setAttribute("data-ui-kit-version", "2.0.0-canary.143");
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
};
|
|
@@ -25,7 +25,7 @@ var n = class {
|
|
|
25
25
|
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
26
26
|
}), t.subscribe("theme", this.handleChangeTheme);
|
|
27
27
|
}
|
|
28
|
-
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.
|
|
28
|
+
}, r = Symbol.for("@cupra/ui-kit/icons-manager/2.0.0-canary.143"), i = globalThis, a = i[r];
|
|
29
29
|
a || (a = new n(), Object.defineProperty(i, r, {
|
|
30
30
|
value: a,
|
|
31
31
|
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.143"), 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.143/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,6 +1,6 @@
|
|
|
1
1
|
//#region src/utils/formatNumber/formatNumber.ts
|
|
2
2
|
function e({ value: e, locale: t, style: n, unit: r, currency: i, localeMatcher: a = "lookup", minimumIntegerDigits: o = 1, minimumFractionDigits: s = 0, maximumFractionDigits: c = 20, thousandSeparator: l, fractionSeparator: u, useGrouping: d = "auto", currencyDisplay: f = "symbol" }) {
|
|
3
|
-
let p = "", m, h, g = new Intl.NumberFormat(t, {
|
|
3
|
+
let p = "", m = "", h, g, _ = new Intl.NumberFormat(t, {
|
|
4
4
|
...n && { style: n },
|
|
5
5
|
...r && { unit: r },
|
|
6
6
|
...i && { currency: i },
|
|
@@ -11,30 +11,38 @@ function e({ value: e, locale: t, style: n, unit: r, currency: i, localeMatcher:
|
|
|
11
11
|
maximumFractionDigits: c,
|
|
12
12
|
useGrouping: d
|
|
13
13
|
}).formatToParts(e ?? 0);
|
|
14
|
-
return
|
|
14
|
+
return _.forEach((e, t) => {
|
|
15
15
|
switch (e.type) {
|
|
16
16
|
case "unit":
|
|
17
17
|
case "currency":
|
|
18
18
|
case "percentSign":
|
|
19
|
-
|
|
19
|
+
h = e.value, g = t === 0 || (_[0].type === "minusSign" || _[0].type === "plusSign") && t === 1 ? "left" : "right", m += e.value;
|
|
20
20
|
break;
|
|
21
|
-
case "group":
|
|
22
|
-
|
|
21
|
+
case "group": {
|
|
22
|
+
let t = l ?? e.value;
|
|
23
|
+
p += t, m += t;
|
|
23
24
|
break;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
}
|
|
26
|
+
case "decimal": {
|
|
27
|
+
let t = u ?? e.value;
|
|
28
|
+
p += t, m += t;
|
|
26
29
|
break;
|
|
30
|
+
}
|
|
27
31
|
case "integer":
|
|
28
32
|
case "fraction":
|
|
29
33
|
case "plusSign":
|
|
30
34
|
case "minusSign":
|
|
31
|
-
p += e.value;
|
|
35
|
+
p += e.value, m += e.value;
|
|
36
|
+
break;
|
|
37
|
+
case "literal":
|
|
38
|
+
m += e.value;
|
|
32
39
|
break;
|
|
33
40
|
}
|
|
34
41
|
}), {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...h && {
|
|
42
|
+
formattedNumber: p,
|
|
43
|
+
formattedValue: m,
|
|
44
|
+
...h && { unitSymbol: h },
|
|
45
|
+
...g && { unitSymbolPosition: g }
|
|
38
46
|
};
|
|
39
47
|
}
|
|
40
48
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UiKitElement } from '../base/UiKitElement.ts';
|
|
2
2
|
import '../ds-icon/ds-icon.ts';
|
|
3
|
-
import { DsAvatarAttrs } from './ds-avatar.types.ts';
|
|
3
|
+
import type { DsAvatarAttrs } from './ds-avatar.types.ts';
|
|
4
4
|
export declare class DsAvatar extends UiKitElement {
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
size: DsAvatarAttrs['size'];
|
|
@@ -16,8 +16,6 @@ export declare class DsCurrency extends UiKitElement {
|
|
|
16
16
|
fractionSeparator: DsCurrencyAttrs['fraction-separator'];
|
|
17
17
|
amountSize: DsCurrencyAttrs['amount-size'];
|
|
18
18
|
amountWeight: DsCurrencyAttrs['amount-weight'];
|
|
19
|
-
currencySize: DsCurrencyAttrs['currency-size'];
|
|
20
|
-
currencyWeight: DsCurrencyAttrs['currency-weight'];
|
|
21
19
|
periodSize: DsCurrencyAttrs['period-size'];
|
|
22
20
|
periodWeight: DsCurrencyAttrs['period-weight'];
|
|
23
21
|
noteSize: DsCurrencyAttrs['note-size'];
|
|
@@ -24,8 +24,6 @@ export type DsCurrencyAttrs = CommonAttrs & Amount & {
|
|
|
24
24
|
note?: string;
|
|
25
25
|
'amount-size'?: FontSize;
|
|
26
26
|
'amount-weight'?: FontWeight;
|
|
27
|
-
'currency-size'?: FontSize;
|
|
28
|
-
'currency-weight'?: FontWeight;
|
|
29
27
|
'period-size'?: FontSize;
|
|
30
28
|
'period-weight'?: FontWeight;
|
|
31
29
|
'note-size'?: FontSize;
|
|
@@ -236,6 +236,7 @@ export type FormatNumberProps = UnitStyle & {
|
|
|
236
236
|
currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name';
|
|
237
237
|
};
|
|
238
238
|
export type FormatedNumber = {
|
|
239
|
+
formattedNumber: string;
|
|
239
240
|
formattedValue: string;
|
|
240
241
|
unitSymbol?: string;
|
|
241
242
|
unitSymbolPosition?: 'left' | 'right';
|