@wisemen/vue-core-design-system 1.20.0 → 1.20.1

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/index.cjs CHANGED
@@ -973,7 +973,7 @@ Example: <UIConfigProvider :file-upload-adapter="myAdapter"><UIBaseFileUploadRoo
973
973
  read-only:cursor-default
974
974
  disabled:cursor-not-allowed disabled:text-disabled
975
975
  disabled:placeholder:text-fg-disabled-subtle
976
- `,leftControl:`pl-xs`,rightControl:`pr-xs`},variants:{hasControls:{true:{input:`text-center`}}}}),bA=(0,f.defineComponent)({inheritAttrs:!1,__name:`NumberField`,props:(0,f.mergeModels)((0,f.mergeDefaults)({hasControls:{type:Boolean},formatOptions:{},max:{},min:{},showControls:{type:Boolean},step:{},id:{},isReadonly:{type:Boolean},isRequired:{type:Boolean},name:{},class:{},style:{},isDisabled:{type:Boolean},disabledReason:{},autocomplete:{},isErrorMessageHidden:{type:Boolean},isHorizontal:{type:Boolean},isLabelHidden:{type:Boolean},errorMessage:{},for:{},helpText:{},hideErrorMessage:{type:Boolean},hint:{},label:{},isLoading:{type:Boolean},iconLeft:{},iconRight:{},placeholder:{}},{...ry,...iy,...ay,...oy,hasControls:!1,formatOptions:null,max:null,min:null,step:1}),{modelValue:{required:!0},modelModifiers:{}}),emits:(0,f.mergeModels)([`blur`],[`update:modelValue`]),setup(e,{emit:t}){let n=e,r=t,i=/[\s.,`]/g,a=/[\s.,`](?=\d+$)/,o=/[.,]/g,s=/\D/g,c=(0,f.useModel)(e,`modelValue`),l=(0,f.computed)(()=>n.hasControls||n.showControls===!0),u=(0,f.computed)(()=>yA({hasControls:l.value})),d=(0,f.ref)(c.value),p=(0,f.ref)(!1);(0,f.watch)(()=>c.value,e=>{p.value||(d.value=e)});let m=(0,f.useAttrs)(),_=(0,g.useI18n)(),v=n.id??(0,f.useId)(),{isError:y,ariaBusy:b,ariaDescribedBy:x,ariaInvalid:S}=ty(v,n),C=Y(),w=(0,f.computed)(()=>ne(C.numberFormat.value));function T(e,t){let n=new Intl.NumberFormat(t).format(12345.6),r=n.match(i)?.[0],o=n.match(a)?.[0],s=e;return r&&(s=s.replaceAll(r,``)),o&&(s=s.replace(o,`.`)),Number(s)}function E(e){p.value=!0;let t=e.target.value;if(t===``){c.value=null;return}let n=D(t);Number.isNaN(n)||(c.value=n)}function ee(){d.value=c.value,p.value=!1}function D(e){o.lastIndex=0;let t=[...e.matchAll(o)];if(t.length===0)return Number(e);let n=t.map(e=>e[0]),r=[...new Set(n)];if(r.length===2){let t=n.at(-1),i=r.find(e=>e!==t);return Number(e.replaceAll(i,``).replace(t,`.`))}let i=r[0];if(t.length>1)return Number(e.replaceAll(i,``));if(e.startsWith(`0${i}`))return Number(e.replace(i,`.`));let a=e.slice(e.lastIndexOf(i)+1).replace(s,``);return a.length<=2?Number(e.replace(i,`.`)):a.length>=4?Number(e.replaceAll(i,``)):T(e,w.value)}function te(e){d.value=c.value,p.value=!1,r(`blur`,e)}return(0,f.watch)(d,()=>{c.value=d.value??null}),(e,t)=>((0,f.openBlock)(),(0,f.createBlock)(Ay,{"error-message":n.errorMessage,"is-disabled":n.isDisabled,"is-required":n.isRequired,"disabled-reason":n.disabledReason,hint:n.hint,label:n.label,class:(0,f.normalizeClass)(n.class),style:(0,f.normalizeStyle)(n.style),for:(0,f.unref)(v),"help-text":n.helpText,"hide-error-message":n.hideErrorMessage,"is-error-message-hidden":n.isErrorMessageHidden},{"label-left":(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`label-left`)]),"label-right":(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`label-right`)]),default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldRoot),(0,f.mergeProps)((0,f.unref)(m),{id:(0,f.unref)(v),modelValue:d.value,"onUpdate:modelValue":t[1]||=e=>d.value=e,readonly:n.isReadonly,required:n.isRequired,"disable-wheel-change":!0,disabled:n.isDisabled||n.isReadonly,"format-options":n.formatOptions??void 0,step:n.step,"step-snapping":!0,"as-child":!1,locale:w.value,name:n.name??void 0,max:n.max??void 0,min:n.min??void 0}),{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Sy,{"icon-left":n.iconLeft,"icon-right":n.iconRight,"is-loading":n.isLoading,"is-error":(0,f.unref)(y),"is-disabled":n.isDisabled,"is-readonly":n.isReadonly},{left:(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`left`,{},()=>[l.value?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(L),{key:0,class:(0,f.normalizeClass)(u.value.leftControl()),align:`center`},{default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldDecrement),{"as-child":!0},{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Z,{"is-tooltip-disabled":!0,"is-disabled":n.isDisabled||n.isReadonly||n.min===d.value,icon:(0,f.unref)(rr),label:(0,f.unref)(_).t(`component.number_field.decrement`),variant:`tertiary`,size:`xs`},null,8,[`is-disabled`,`icon`,`label`])]),_:1})]),_:1},8,[`class`])):(0,f.createCommentVNode)(``,!0)])]),right:(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`right`,{},()=>[l.value?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(L),{key:0,class:(0,f.normalizeClass)(u.value.rightControl()),align:`center`},{default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldIncrement),{"as-child":!0},{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Z,{"is-tooltip-disabled":!0,"is-disabled":n.isDisabled||n.isReadonly||n.max===d.value,icon:(0,f.unref)(sr),label:(0,f.unref)(_).t(`component.number_field.increment`),variant:`tertiary`,size:`xs`},null,8,[`is-disabled`,`icon`,`label`])]),_:1})]),_:1},8,[`class`])):(0,f.createCommentVNode)(``,!0)])]),default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldInput),{"aria-describedby":(0,f.unref)(x),"aria-required":n.isRequired,autocomplete:n.autocomplete??void 0,"aria-busy":(0,f.unref)(b),"aria-invalid":(0,f.unref)(S),placeholder:n.placeholder??void 0,class:(0,f.normalizeClass)(u.value.input()),"data-field-wrapper":``,onInput:E,onKeydown:(0,f.withKeys)(ee,[`enter`]),onFocus:t[0]||=(0,f.withModifiers)(()=>{},[`prevent`]),onBlur:te},null,8,[`aria-describedby`,`aria-required`,`autocomplete`,`aria-busy`,`aria-invalid`,`placeholder`,`class`])]),_:3},8,[`icon-left`,`icon-right`,`is-loading`,`is-error`,`is-disabled`,`is-readonly`])]),_:3},16,[`id`,`modelValue`,`readonly`,`required`,`disabled`,`format-options`,`step`,`locale`,`name`,`max`,`min`])]),_:3},8,[`error-message`,`is-disabled`,`is-required`,`disabled-reason`,`hint`,`label`,`class`,`style`,`for`,`help-text`,`hide-error-message`,`is-error-message-hidden`]))}}),xA={AC:`40123`,AD:`312345`,AE:`501234567`,AF:`701234567`,AG:`2684641234`,AI:`2642351234`,AL:`672123456`,AM:`77123456`,AO:`923123456`,AR:`91123456789`,AS:`6847331234`,AT:`664123456`,AU:`412345678`,AW:`5601234`,AX:`412345678`,AZ:`401234567`,BA:`61123456`,BB:`2462501234`,BD:`1812345678`,BE:`450001234`,BF:`70123456`,BG:`43012345`,BH:`36001234`,BI:`79561234`,BJ:`0195123456`,BL:`690001234`,BM:`4413701234`,BN:`7123456`,BO:`71234567`,BQ:`3181234`,BR:`11961234567`,BS:`2423591234`,BT:`17123456`,BW:`71123456`,BY:`294911911`,BZ:`6221234`,CA:`5062345678`,CC:`412345678`,CD:`991234567`,CF:`70012345`,CG:`061234567`,CH:`781234567`,CI:`0123456789`,CK:`71234`,CL:`221234567`,CM:`671234567`,CN:`13123456789`,CO:`3211234567`,CR:`83123456`,CU:`51234567`,CV:`9911234`,CW:`95181234`,CX:`412345678`,CY:`96123456`,CZ:`601123456`,DE:`15123456789`,DJ:`77831001`,DK:`34412345`,DM:`7672251234`,DO:`8092345678`,DZ:`551234567`,EC:`991234567`,EE:`51234567`,EG:`1001234567`,EH:`650123456`,ER:`7123456`,ES:`612345678`,ET:`911234567`,FI:`412345678`,FJ:`7012345`,FK:`51234`,FM:`3501234`,FO:`211234`,FR:`612345678`,GA:`06031234`,GB:`7400123456`,GD:`4734031234`,GE:`555123456`,GF:`694201234`,GG:`7781123456`,GH:`231234567`,GI:`57123456`,GL:`221234`,GM:`3012345`,GN:`601123456`,GP:`690001234`,GQ:`222123456`,GR:`6912345678`,GT:`51234567`,GU:`6713001234`,GW:`955012345`,GY:`6091234`,HK:`51234567`,HN:`91234567`,HR:`921234567`,HT:`34101234`,HU:`201234567`,ID:`812345678`,IE:`850123456`,IL:`502345678`,IM:`7924123456`,IN:`8123456789`,IO:`3801234`,IQ:`7912345678`,IR:`9123456789`,IS:`6111234`,IT:`3123456789`,JE:`7797712345`,JM:`8762101234`,JO:`790123456`,JP:`9012345678`,KE:`712123456`,KG:`700123456`,KH:`91234567`,KI:`72001234`,KM:`3212345`,KN:`8697652917`,KP:`1921234567`,KR:`1020000000`,KW:`50012345`,KY:`3453231234`,KZ:`7710009998`,LA:`2023123456`,LB:`71123456`,LC:`7582845678`,LI:`660234567`,LK:`712345678`,LR:`770123456`,LS:`50123456`,LT:`61234567`,LU:`628123456`,LV:`21234567`,LY:`912345678`,MA:`650123456`,MC:`612345678`,MD:`62112345`,ME:`60123456`,MF:`690001234`,MG:`321234567`,MH:`2351234`,MK:`72345678`,ML:`65012345`,MM:`92123456`,MN:`88123456`,MO:`66123456`,MP:`6702345678`,MQ:`696201234`,MR:`22123456`,MS:`6644923456`,MT:`96961234`,MU:`52512345`,MV:`7712345`,MW:`991234567`,MX:`2221234567`,MY:`123456789`,MZ:`821234567`,NA:`811234567`,NC:`751234`,NE:`93123456`,NF:`381234`,NG:`8021234567`,NI:`81234567`,NL:`612345678`,NO:`40612345`,NP:`9841234567`,NR:`5551234`,NU:`8884012`,NZ:`211234567`,OM:`92123456`,PA:`61234567`,PE:`912345678`,PF:`87123456`,PG:`70123456`,PH:`9051234567`,PK:`3012345678`,PL:`512345678`,PM:`551234`,PR:`7872345678`,PS:`599123456`,PT:`912345678`,PW:`6201234`,PY:`961456789`,QA:`33123456`,RE:`692123456`,RO:`712034567`,RS:`601234567`,RU:`9123456789`,RW:`720123456`,SA:`512345678`,SB:`7421234`,SC:`2510123`,SD:`911231234`,SE:`701234567`,SG:`81234567`,SH:`51234`,SI:`31234567`,SJ:`41234567`,SK:`912123456`,SL:`25123456`,SM:`66661212`,SN:`701234567`,SO:`71123456`,SR:`7412345`,SS:`977123456`,ST:`9812345`,SV:`70123456`,SX:`7215205678`,SY:`944567890`,SZ:`76123456`,TA:`8999`,TC:`6492311234`,TD:`63012345`,TG:`90112345`,TH:`812345678`,TJ:`917123456`,TK:`7290`,TL:`77212345`,TM:`66123456`,TN:`20123456`,TO:`7715123`,TR:`5012345678`,TT:`8682911234`,TV:`901234`,TW:`912345678`,TZ:`621234567`,UA:`501234567`,UG:`712345678`,US:`2015550123`,UY:`94231234`,UZ:`912345678`,VA:`3123456789`,VC:`7844301234`,VE:`4121234567`,VG:`2843001234`,VI:`3406421234`,VN:`912345678`,VU:`5912345`,WF:`821234`,WS:`7212345`,XK:`43201234`,YE:`712345678`,YT:`639012345`,ZA:`711234567`,ZM:`955123456`,ZW:`712345678`},SA=H({slots:{countryFlag:`
976
+ `,leftControl:`pl-xs`,rightControl:`pr-xs`},variants:{hasControls:{true:{input:`text-center`}}}}),bA=(0,f.defineComponent)({inheritAttrs:!1,__name:`NumberField`,props:(0,f.mergeModels)((0,f.mergeDefaults)({hasControls:{type:Boolean},formatOptions:{},max:{},min:{},showControls:{type:Boolean},step:{},id:{},isReadonly:{type:Boolean},isRequired:{type:Boolean},name:{},class:{},style:{},isDisabled:{type:Boolean},disabledReason:{},autocomplete:{},isErrorMessageHidden:{type:Boolean},isHorizontal:{type:Boolean},isLabelHidden:{type:Boolean},errorMessage:{},for:{},helpText:{},hideErrorMessage:{type:Boolean},hint:{},label:{},isLoading:{type:Boolean},iconLeft:{},iconRight:{},placeholder:{}},{...ry,...iy,...ay,...oy,hasControls:!1,formatOptions:null,max:null,min:null,step:1}),{modelValue:{required:!0},modelModifiers:{}}),emits:(0,f.mergeModels)([`blur`],[`update:modelValue`]),setup(e,{emit:t}){let n=e,r=t,i=/[\s.,`]/g,a=/[\s.,`](?=\d+$)/,o=/[.,]/g,s=/\D/g,c=new Set([`currency`,`literal`,`percentSign`,`unit`]),l=(0,f.useModel)(e,`modelValue`),u=(0,f.computed)(()=>n.hasControls||n.showControls===!0),d=(0,f.computed)(()=>yA({hasControls:u.value})),p=(0,f.ref)(l.value),m=(0,f.ref)(!1);(0,f.watch)(()=>l.value,e=>{m.value||(p.value=e)});let _=(0,f.useAttrs)(),v=(0,g.useI18n)(),y=n.id??(0,f.useId)(),{isError:b,ariaBusy:x,ariaDescribedBy:S,ariaInvalid:C}=ty(y,n),w=Y(),T=(0,f.computed)(()=>ne(w.numberFormat.value));function E(e,t){let n=new Intl.NumberFormat(t).format(12345.6),r=n.match(i)?.[0],o=n.match(a)?.[0],s=e;return r&&(s=s.replaceAll(r,``)),o&&(s=s.replace(o,`.`)),Number(s)}function ee(e,t,n){if(!n||n.style===`decimal`||!n.style)return e;let r=new Intl.NumberFormat(t,n).formatToParts(12345.6),i=e;for(let e of r)c.has(e.type)&&e.value.trim()!==``&&(i=i.replaceAll(e.value,``));return i.trim()}function D(e){m.value=!0;let t=e.target.value;if(t===``){l.value=null;return}let r=ee(t,T.value,n.formatOptions);if(r===``)return;let i=O(r);Number.isNaN(i)||(n.formatOptions?.style===`percent`&&(i/=100),l.value=i)}function te(){p.value=l.value,m.value=!1}function O(e){o.lastIndex=0;let t=[...e.matchAll(o)];if(t.length===0)return Number(e);let n=t.map(e=>e[0]),r=[...new Set(n)];if(r.length===2){let t=n.at(-1),i=r.find(e=>e!==t);return Number(e.replaceAll(i,``).replace(t,`.`))}let i=r[0];if(t.length>1)return Number(e.replaceAll(i,``));if(e.startsWith(`0${i}`))return Number(e.replace(i,`.`));let a=e.slice(e.lastIndexOf(i)+1).replace(s,``);return a.length<=2?Number(e.replace(i,`.`)):a.length>=4?Number(e.replaceAll(i,``)):E(e,T.value)}function k(e){p.value=l.value,m.value=!1,r(`blur`,e)}return(0,f.watch)(p,()=>{l.value=p.value??null}),(e,t)=>((0,f.openBlock)(),(0,f.createBlock)(Ay,{"error-message":n.errorMessage,"is-disabled":n.isDisabled,"is-required":n.isRequired,"disabled-reason":n.disabledReason,hint:n.hint,label:n.label,class:(0,f.normalizeClass)(n.class),style:(0,f.normalizeStyle)(n.style),for:(0,f.unref)(y),"help-text":n.helpText,"hide-error-message":n.hideErrorMessage,"is-error-message-hidden":n.isErrorMessageHidden},{"label-left":(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`label-left`)]),"label-right":(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`label-right`)]),default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldRoot),(0,f.mergeProps)((0,f.unref)(_),{id:(0,f.unref)(y),modelValue:p.value,"onUpdate:modelValue":t[1]||=e=>p.value=e,readonly:n.isReadonly,required:n.isRequired,"disable-wheel-change":!0,disabled:n.isDisabled||n.isReadonly,"format-options":n.formatOptions??void 0,step:n.step,"step-snapping":!0,"as-child":!1,locale:T.value,name:n.name??void 0,max:n.max??void 0,min:n.min??void 0}),{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Sy,{"icon-left":n.iconLeft,"icon-right":n.iconRight,"is-loading":n.isLoading,"is-error":(0,f.unref)(b),"is-disabled":n.isDisabled,"is-readonly":n.isReadonly},{left:(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`left`,{},()=>[u.value?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(L),{key:0,class:(0,f.normalizeClass)(d.value.leftControl()),align:`center`},{default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldDecrement),{"as-child":!0},{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Z,{"is-tooltip-disabled":!0,"is-disabled":n.isDisabled||n.isReadonly||n.min===p.value,icon:(0,f.unref)(rr),label:(0,f.unref)(v).t(`component.number_field.decrement`),variant:`tertiary`,size:`xs`},null,8,[`is-disabled`,`icon`,`label`])]),_:1})]),_:1},8,[`class`])):(0,f.createCommentVNode)(``,!0)])]),right:(0,f.withCtx)(()=>[(0,f.renderSlot)(e.$slots,`right`,{},()=>[u.value?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(L),{key:0,class:(0,f.normalizeClass)(d.value.rightControl()),align:`center`},{default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldIncrement),{"as-child":!0},{default:(0,f.withCtx)(()=>[(0,f.createVNode)(Z,{"is-tooltip-disabled":!0,"is-disabled":n.isDisabled||n.isReadonly||n.max===p.value,icon:(0,f.unref)(sr),label:(0,f.unref)(v).t(`component.number_field.increment`),variant:`tertiary`,size:`xs`},null,8,[`is-disabled`,`icon`,`label`])]),_:1})]),_:1},8,[`class`])):(0,f.createCommentVNode)(``,!0)])]),default:(0,f.withCtx)(()=>[(0,f.createVNode)((0,f.unref)(h.NumberFieldInput),{"aria-describedby":(0,f.unref)(S),"aria-required":n.isRequired,autocomplete:n.autocomplete??void 0,"aria-busy":(0,f.unref)(x),"aria-invalid":(0,f.unref)(C),placeholder:n.placeholder??void 0,class:(0,f.normalizeClass)(d.value.input()),"data-field-wrapper":``,onInput:D,onKeydown:(0,f.withKeys)(te,[`enter`]),onFocus:t[0]||=(0,f.withModifiers)(()=>{},[`prevent`]),onBlur:k},null,8,[`aria-describedby`,`aria-required`,`autocomplete`,`aria-busy`,`aria-invalid`,`placeholder`,`class`])]),_:3},8,[`icon-left`,`icon-right`,`is-loading`,`is-error`,`is-disabled`,`is-readonly`])]),_:3},16,[`id`,`modelValue`,`readonly`,`required`,`disabled`,`format-options`,`step`,`locale`,`name`,`max`,`min`])]),_:3},8,[`error-message`,`is-disabled`,`is-required`,`disabled-reason`,`hint`,`label`,`class`,`style`,`for`,`help-text`,`hide-error-message`,`is-error-message-hidden`]))}}),xA={AC:`40123`,AD:`312345`,AE:`501234567`,AF:`701234567`,AG:`2684641234`,AI:`2642351234`,AL:`672123456`,AM:`77123456`,AO:`923123456`,AR:`91123456789`,AS:`6847331234`,AT:`664123456`,AU:`412345678`,AW:`5601234`,AX:`412345678`,AZ:`401234567`,BA:`61123456`,BB:`2462501234`,BD:`1812345678`,BE:`450001234`,BF:`70123456`,BG:`43012345`,BH:`36001234`,BI:`79561234`,BJ:`0195123456`,BL:`690001234`,BM:`4413701234`,BN:`7123456`,BO:`71234567`,BQ:`3181234`,BR:`11961234567`,BS:`2423591234`,BT:`17123456`,BW:`71123456`,BY:`294911911`,BZ:`6221234`,CA:`5062345678`,CC:`412345678`,CD:`991234567`,CF:`70012345`,CG:`061234567`,CH:`781234567`,CI:`0123456789`,CK:`71234`,CL:`221234567`,CM:`671234567`,CN:`13123456789`,CO:`3211234567`,CR:`83123456`,CU:`51234567`,CV:`9911234`,CW:`95181234`,CX:`412345678`,CY:`96123456`,CZ:`601123456`,DE:`15123456789`,DJ:`77831001`,DK:`34412345`,DM:`7672251234`,DO:`8092345678`,DZ:`551234567`,EC:`991234567`,EE:`51234567`,EG:`1001234567`,EH:`650123456`,ER:`7123456`,ES:`612345678`,ET:`911234567`,FI:`412345678`,FJ:`7012345`,FK:`51234`,FM:`3501234`,FO:`211234`,FR:`612345678`,GA:`06031234`,GB:`7400123456`,GD:`4734031234`,GE:`555123456`,GF:`694201234`,GG:`7781123456`,GH:`231234567`,GI:`57123456`,GL:`221234`,GM:`3012345`,GN:`601123456`,GP:`690001234`,GQ:`222123456`,GR:`6912345678`,GT:`51234567`,GU:`6713001234`,GW:`955012345`,GY:`6091234`,HK:`51234567`,HN:`91234567`,HR:`921234567`,HT:`34101234`,HU:`201234567`,ID:`812345678`,IE:`850123456`,IL:`502345678`,IM:`7924123456`,IN:`8123456789`,IO:`3801234`,IQ:`7912345678`,IR:`9123456789`,IS:`6111234`,IT:`3123456789`,JE:`7797712345`,JM:`8762101234`,JO:`790123456`,JP:`9012345678`,KE:`712123456`,KG:`700123456`,KH:`91234567`,KI:`72001234`,KM:`3212345`,KN:`8697652917`,KP:`1921234567`,KR:`1020000000`,KW:`50012345`,KY:`3453231234`,KZ:`7710009998`,LA:`2023123456`,LB:`71123456`,LC:`7582845678`,LI:`660234567`,LK:`712345678`,LR:`770123456`,LS:`50123456`,LT:`61234567`,LU:`628123456`,LV:`21234567`,LY:`912345678`,MA:`650123456`,MC:`612345678`,MD:`62112345`,ME:`60123456`,MF:`690001234`,MG:`321234567`,MH:`2351234`,MK:`72345678`,ML:`65012345`,MM:`92123456`,MN:`88123456`,MO:`66123456`,MP:`6702345678`,MQ:`696201234`,MR:`22123456`,MS:`6644923456`,MT:`96961234`,MU:`52512345`,MV:`7712345`,MW:`991234567`,MX:`2221234567`,MY:`123456789`,MZ:`821234567`,NA:`811234567`,NC:`751234`,NE:`93123456`,NF:`381234`,NG:`8021234567`,NI:`81234567`,NL:`612345678`,NO:`40612345`,NP:`9841234567`,NR:`5551234`,NU:`8884012`,NZ:`211234567`,OM:`92123456`,PA:`61234567`,PE:`912345678`,PF:`87123456`,PG:`70123456`,PH:`9051234567`,PK:`3012345678`,PL:`512345678`,PM:`551234`,PR:`7872345678`,PS:`599123456`,PT:`912345678`,PW:`6201234`,PY:`961456789`,QA:`33123456`,RE:`692123456`,RO:`712034567`,RS:`601234567`,RU:`9123456789`,RW:`720123456`,SA:`512345678`,SB:`7421234`,SC:`2510123`,SD:`911231234`,SE:`701234567`,SG:`81234567`,SH:`51234`,SI:`31234567`,SJ:`41234567`,SK:`912123456`,SL:`25123456`,SM:`66661212`,SN:`701234567`,SO:`71123456`,SR:`7412345`,SS:`977123456`,ST:`9812345`,SV:`70123456`,SX:`7215205678`,SY:`944567890`,SZ:`76123456`,TA:`8999`,TC:`6492311234`,TD:`63012345`,TG:`90112345`,TH:`812345678`,TJ:`917123456`,TK:`7290`,TL:`77212345`,TM:`66123456`,TN:`20123456`,TO:`7715123`,TR:`5012345678`,TT:`8682911234`,TV:`901234`,TW:`912345678`,TZ:`621234567`,UA:`501234567`,UG:`712345678`,US:`2015550123`,UY:`94231234`,UZ:`912345678`,VA:`3123456789`,VC:`7844301234`,VE:`4121234567`,VG:`2843001234`,VI:`3406421234`,VN:`912345678`,VU:`5912345`,WF:`821234`,WS:`7212345`,XK:`43201234`,YE:`712345678`,YT:`639012345`,ZA:`711234567`,ZM:`955123456`,ZW:`712345678`},SA=H({slots:{countryFlag:`
977
977
  block h-3.5 w-5 shrink-0 overflow-hidden rounded-xxs
978
978
  [&>svg]:size-full [&>svg]:object-cover
979
979
  `,countryTrigger:`
package/dist/index.js CHANGED
@@ -34020,29 +34020,42 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34020
34020
  }),
34021
34021
  emits: /*@__PURE__*/ C(["blur"], ["update:modelValue"]),
34022
34022
  setup(e, { emit: t }) {
34023
- let n = e, r = t, i = /[\s.,`]/g, a = /[\s.,`](?=\d+$)/, l = /[.,]/g, u = /\D/g, d = z(e, "modelValue"), f = o(() => n.hasControls || n.showControls === !0), p = o(() => JP({ hasControls: f.value })), h = M(d.value), g = M(!1);
34024
- B(() => d.value, (e) => {
34025
- g.value || (h.value = e);
34023
+ let n = e, r = t, i = /[\s.,`]/g, a = /[\s.,`](?=\d+$)/, l = /[.,]/g, u = /\D/g, d = /* @__PURE__ */ new Set([
34024
+ "currency",
34025
+ "literal",
34026
+ "percentSign",
34027
+ "unit"
34028
+ ]), f = z(e, "modelValue"), p = o(() => n.hasControls || n.showControls === !0), h = o(() => JP({ hasControls: p.value })), g = M(f.value), _ = M(!1);
34029
+ B(() => f.value, (e) => {
34030
+ _.value || (g.value = e);
34026
34031
  });
34027
- let _ = se(), v = H(), y = n.id ?? ce(), { isError: b, ariaBusy: x, ariaDescribedBy: S, ariaInvalid: C } = OC(y, n), T = T_(), ee = o(() => gi(T.numberFormat.value));
34028
- function O(e, t) {
34032
+ let v = se(), y = H(), b = n.id ?? ce(), { isError: x, ariaBusy: S, ariaDescribedBy: C, ariaInvalid: T } = OC(b, n), ee = T_(), O = o(() => gi(ee.numberFormat.value));
34033
+ function k(e, t) {
34029
34034
  let n = new Intl.NumberFormat(t).format(12345.6), r = n.match(i)?.[0], o = n.match(a)?.[0], s = e;
34030
34035
  return r && (s = s.replaceAll(r, "")), o && (s = s.replace(o, ".")), Number(s);
34031
34036
  }
34032
- function k(e) {
34033
- g.value = !0;
34037
+ function te(e, t, n) {
34038
+ if (!n || n.style === "decimal" || !n.style) return e;
34039
+ let r = new Intl.NumberFormat(t, n).formatToParts(12345.6), i = e;
34040
+ for (let e of r) d.has(e.type) && e.value.trim() !== "" && (i = i.replaceAll(e.value, ""));
34041
+ return i.trim();
34042
+ }
34043
+ function ne(e) {
34044
+ _.value = !0;
34034
34045
  let t = e.target.value;
34035
34046
  if (t === "") {
34036
- d.value = null;
34047
+ f.value = null;
34037
34048
  return;
34038
34049
  }
34039
- let n = ne(t);
34040
- Number.isNaN(n) || (d.value = n);
34050
+ let r = te(t, O.value, n.formatOptions);
34051
+ if (r === "") return;
34052
+ let i = N(r);
34053
+ Number.isNaN(i) || (n.formatOptions?.style === "percent" && (i /= 100), f.value = i);
34041
34054
  }
34042
- function te() {
34043
- h.value = d.value, g.value = !1;
34055
+ function j() {
34056
+ g.value = f.value, _.value = !1;
34044
34057
  }
34045
- function ne(e) {
34058
+ function N(e) {
34046
34059
  l.lastIndex = 0;
34047
34060
  let t = [...e.matchAll(l)];
34048
34061
  if (t.length === 0) return Number(e);
@@ -34055,13 +34068,13 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34055
34068
  if (t.length > 1) return Number(e.replaceAll(i, ""));
34056
34069
  if (e.startsWith(`0${i}`)) return Number(e.replace(i, "."));
34057
34070
  let a = e.slice(e.lastIndexOf(i) + 1).replace(u, "");
34058
- return a.length <= 2 ? Number(e.replace(i, ".")) : a.length >= 4 ? Number(e.replaceAll(i, "")) : O(e, ee.value);
34071
+ return a.length <= 2 ? Number(e.replace(i, ".")) : a.length >= 4 ? Number(e.replaceAll(i, "")) : k(e, O.value);
34059
34072
  }
34060
- function j(e) {
34061
- h.value = d.value, g.value = !1, r("blur", e);
34073
+ function F(e) {
34074
+ g.value = f.value, _.value = !1, r("blur", e);
34062
34075
  }
34063
- return B(h, () => {
34064
- d.value = h.value ?? null;
34076
+ return B(g, () => {
34077
+ f.value = g.value ?? null;
34065
34078
  }), (e, t) => (A(), s(iw, {
34066
34079
  "error-message": n.errorMessage,
34067
34080
  "is-disabled": n.isDisabled,
@@ -34071,17 +34084,17 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34071
34084
  label: n.label,
34072
34085
  class: E(n.class),
34073
34086
  style: D(n.style),
34074
- for: R(y),
34087
+ for: R(b),
34075
34088
  "help-text": n.helpText,
34076
34089
  "hide-error-message": n.hideErrorMessage,
34077
34090
  "is-error-message-hidden": n.isErrorMessageHidden
34078
34091
  }, {
34079
34092
  "label-left": V(() => [P(e.$slots, "label-left")]),
34080
34093
  "label-right": V(() => [P(e.$slots, "label-right")]),
34081
- default: V(() => [m(R(Yn), w(R(_), {
34082
- id: R(y),
34083
- modelValue: h.value,
34084
- "onUpdate:modelValue": t[1] ||= (e) => h.value = e,
34094
+ default: V(() => [m(R(Yn), w(R(v), {
34095
+ id: R(b),
34096
+ modelValue: g.value,
34097
+ "onUpdate:modelValue": t[1] ||= (e) => g.value = e,
34085
34098
  readonly: n.isReadonly,
34086
34099
  required: n.isRequired,
34087
34100
  "disable-wheel-change": !0,
@@ -34090,7 +34103,7 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34090
34103
  step: n.step,
34091
34104
  "step-snapping": !0,
34092
34105
  "as-child": !1,
34093
- locale: ee.value,
34106
+ locale: O.value,
34094
34107
  name: n.name ?? void 0,
34095
34108
  max: n.max ?? void 0,
34096
34109
  min: n.min ?? void 0
@@ -34099,21 +34112,21 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34099
34112
  "icon-left": n.iconLeft,
34100
34113
  "icon-right": n.iconRight,
34101
34114
  "is-loading": n.isLoading,
34102
- "is-error": R(b),
34115
+ "is-error": R(x),
34103
34116
  "is-disabled": n.isDisabled,
34104
34117
  "is-readonly": n.isReadonly
34105
34118
  }, {
34106
- left: V(() => [P(e.$slots, "left", {}, () => [f.value ? (A(), s(R(q), {
34119
+ left: V(() => [P(e.$slots, "left", {}, () => [p.value ? (A(), s(R(q), {
34107
34120
  key: 0,
34108
- class: E(p.value.leftControl()),
34121
+ class: E(h.value.leftControl()),
34109
34122
  align: "center"
34110
34123
  }, {
34111
34124
  default: V(() => [m(R(Kn), { "as-child": !0 }, {
34112
34125
  default: V(() => [m(MS, {
34113
34126
  "is-tooltip-disabled": !0,
34114
- "is-disabled": n.isDisabled || n.isReadonly || n.min === h.value,
34127
+ "is-disabled": n.isDisabled || n.isReadonly || n.min === g.value,
34115
34128
  icon: R(Ss),
34116
- label: R(v).t("component.number_field.decrement"),
34129
+ label: R(y).t("component.number_field.decrement"),
34117
34130
  variant: "tertiary",
34118
34131
  size: "xs"
34119
34132
  }, null, 8, [
@@ -34125,17 +34138,17 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34125
34138
  })]),
34126
34139
  _: 1
34127
34140
  }, 8, ["class"])) : c("", !0)])]),
34128
- right: V(() => [P(e.$slots, "right", {}, () => [f.value ? (A(), s(R(q), {
34141
+ right: V(() => [P(e.$slots, "right", {}, () => [p.value ? (A(), s(R(q), {
34129
34142
  key: 0,
34130
- class: E(p.value.rightControl()),
34143
+ class: E(h.value.rightControl()),
34131
34144
  align: "center"
34132
34145
  }, {
34133
34146
  default: V(() => [m(R(qn), { "as-child": !0 }, {
34134
34147
  default: V(() => [m(MS, {
34135
34148
  "is-tooltip-disabled": !0,
34136
- "is-disabled": n.isDisabled || n.isReadonly || n.max === h.value,
34149
+ "is-disabled": n.isDisabled || n.isReadonly || n.max === g.value,
34137
34150
  icon: R(Es),
34138
- label: R(v).t("component.number_field.increment"),
34151
+ label: R(y).t("component.number_field.increment"),
34139
34152
  variant: "tertiary",
34140
34153
  size: "xs"
34141
34154
  }, null, 8, [
@@ -34148,18 +34161,18 @@ var KP = /*#__PURE__*/ wu(UP, [["render", GP]]), qP = /* @__PURE__ */ h({
34148
34161
  _: 1
34149
34162
  }, 8, ["class"])) : c("", !0)])]),
34150
34163
  default: V(() => [m(R(Jn), {
34151
- "aria-describedby": R(S),
34164
+ "aria-describedby": R(C),
34152
34165
  "aria-required": n.isRequired,
34153
34166
  autocomplete: n.autocomplete ?? void 0,
34154
- "aria-busy": R(x),
34155
- "aria-invalid": R(C),
34167
+ "aria-busy": R(S),
34168
+ "aria-invalid": R(T),
34156
34169
  placeholder: n.placeholder ?? void 0,
34157
- class: E(p.value.input()),
34170
+ class: E(h.value.input()),
34158
34171
  "data-field-wrapper": "",
34159
- onInput: k,
34160
- onKeydown: me(te, ["enter"]),
34172
+ onInput: ne,
34173
+ onKeydown: me(j, ["enter"]),
34161
34174
  onFocus: t[0] ||= he(() => {}, ["prevent"]),
34162
- onBlur: j
34175
+ onBlur: F
34163
34176
  }, null, 8, [
34164
34177
  "aria-describedby",
34165
34178
  "aria-required",
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
@@ -109,3 +109,4 @@ export declare const Default: Story;
109
109
  export declare const WithControls: Story;
110
110
  export declare const AllStates: Story;
111
111
  export declare const FormExample: Story;
112
+ export declare const UnitFormatting: Story;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "type": "module",
7
- "version": "1.20.0",
7
+ "version": "1.20.1",
8
8
  "license": "SEE LICENSE IN LICENSE.md",
9
9
  "repository": {
10
10
  "type": "git",
@@ -48,9 +48,9 @@
48
48
  "vue-router": "^4.6.4",
49
49
  "vue-sonner": "2.0.9",
50
50
  "zod": "4.3.5",
51
- "formango": "^3.2.6",
51
+ "@wisemen/vue-core-actions": "^0.2.4",
52
52
  "@wisemen/vue-core-dates": "^1.1.1",
53
- "@wisemen/vue-core-actions": "^0.2.4"
53
+ "formango": "^3.2.6"
54
54
  },
55
55
  "dependencies": {
56
56
  "@tailwindcss/vite": "4.1.18",
@@ -65,9 +65,9 @@
65
65
  "vue-component-meta": "3.2.6",
66
66
  "vue-component-type-helpers": "3.3.0",
67
67
  "vue-sonner": "2.0.9",
68
- "@wisemen/vue-core-api-utils": "2.0.6",
69
- "@wisemen/vue-core-dates": "1.1.1",
70
68
  "@wisemen/vue-core-icons": "0.0.4",
69
+ "@wisemen/vue-core-dates": "1.1.1",
70
+ "@wisemen/vue-core-api-utils": "2.0.6",
71
71
  "@wisemen/vue-core-utils": "0.1.2"
72
72
  },
73
73
  "devDependencies": {