@fiscozen/input 3.4.4 → 3.5.0
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/CHANGELOG.md +19 -0
- package/dist/input.js +428 -433
- package/dist/input.umd.cjs +1 -1
- package/dist/src/FzCurrencyInput.vue.d.ts +5 -360
- package/dist/src/FzInput.vue.d.ts +26 -61
- package/dist/src/index.d.ts +4 -0
- package/dist/src/types.d.ts +97 -54
- package/dist/src/useCurrencyInput.d.ts +59 -0
- package/dist/src/useInputStyle.d.ts +9 -2
- package/dist/src/utils.d.ts +14 -0
- package/package.json +3 -3
- package/src/FzCurrencyInput.vue +21 -747
- package/src/FzInput.vue +226 -27
- package/src/__tests__/FzCurrencyInput.spec.ts +81 -0
- package/src/__tests__/FzInput.spec.ts +743 -1
- package/src/index.ts +4 -0
- package/src/types.ts +111 -54
- package/src/useCurrencyInput.ts +537 -0
- package/src/useInputStyle.ts +12 -2
- package/src/utils.ts +29 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/input.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@fiscozen/alert`),require(`@fiscozen/icons`),require(`@fiscozen/button`),require(`@fiscozen/composables`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@fiscozen/alert`,`@fiscozen/icons`,`@fiscozen/button`,`@fiscozen/composables`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FzInput={},e.Vue,e._fiscozen_alert,e._fiscozen_icons,e._fiscozen_button,e._fiscozen_composables))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e,n,r,i,a){let o={backoffice:`h-32`,frontoffice:`h-44`},s=(0,t.computed)(()=>{let t=i.value;return[e.variant?.value===`normal`?o[t]:o.frontoffice,v()]}),c=(0,t.computed)(()=>[`font-normal text-base mb-0`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-grey-500`]),l={backoffice:`text-base`,frontoffice:`text-base`},u=(0,t.computed)(()=>e.variant?.value===`floating-label`?!r.value&&!a.value:!0),d=(0,t.computed)(()=>{let t=i.value;return e.variant?.value===`floating-label`?[l[t]]:[]}),f=(0,t.computed)(()=>[`font-normal text-base`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-grey-500`]),p=(0,t.computed)(()=>[`font-normal text-base`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-core-black`]),m=e=>!!e.error?.value,h=e=>!!e.disabled?.value||!!e.readonly?.value,g=e=>!!e.highlighted?.value,_=e=>!!e.aiReasoning?.value,v=()=>{switch(!0){case m(e):return`border-semantic-error-200 has-[:focus]:border-semantic-error-300 bg-core-white text-core-black cursor-text`;case h(e):return`bg-grey-100 border-grey-100 text-grey-300 cursor-not-allowed`;case g(e):return`bg-semantic-warning-50 border-semantic-warning-200 ring-2 ring-semantic-warning-100 text-core-black cursor-text`;case _(e):return`bg-purple-50 border-purple-600 ring-2 ring-purple-200 text-core-black cursor-text`;default:return`border-grey-200 has-[:focus]:border-blue-600 bg-core-white text-core-black cursor-text`}};return{staticContainerClass:`flex justify-between w-full items-center pl-[10px] pr-[10px] rounded border-1 border-solid gap-8 text-left relative outline-none`,computedContainerClass:s,computedLabelClass:c,staticInputClass:`peer w-full bg-transparent border-0 outline-none focus:outline-none cursor-[inherit] focus:ring-0 truncate placeholder:text-grey-300 disabled:text-grey-300 read-only:text-grey-300 font-normal text-base`,computedInputClass:d,computedHelpClass:f,computedErrorClass:p,showNormalPlaceholder:u}}var s={sm:`backoffice`,md:`backoffice`,lg:`frontoffice`},c=0;function l(e){return`${e}-${Date.now()-16e11}-${++c}`}function u(){return l(`fz-input`)}var d=[`id`,`for`],f=[`tabindex`],p={class:`flex flex-col justify-around min-w-0 grow`},m={key:0,class:`text-xs text-grey-300 grow-0 overflow-hidden text-ellipsis whitespace-nowrap`},h=[`type`,`required`,`disabled`,`readonly`,`placeholder`,`pattern`,`name`,`maxlength`,`autocomplete`,`aria-required`,`aria-invalid`,`aria-disabled`,`aria-labelledby`,`aria-describedby`,`aria-description`,`id`],g={class:`flex items-center gap-4`},_=[`id`],v=(0,t.defineComponent)({inheritAttrs:!1,__name:`FzInput`,props:(0,t.mergeModels)({id:{},label:{},environment:{default:`frontoffice`},size:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{type:Boolean,default:!1},leftIcon:{},leftIconVariant:{},leftIconButtonVariant:{},leftIconAriaLabel:{},rightIcon:{},rightIconClass:{},rightIconSize:{},rightIconVariant:{},rightIconButton:{type:Boolean},rightIconButtonVariant:{default:`invisible`},rightIconAriaLabel:{},secondRightIcon:{},secondRightIconClass:{},secondRightIconVariant:{},secondRightIconButton:{type:Boolean},secondRightIconButtonVariant:{default:`invisible`},secondRightIconAriaLabel:{},type:{default:`text`},valid:{type:Boolean},variant:{default:`normal`},pattern:{},name:{},readonly:{type:Boolean},highlighted:{type:Boolean,default:!1},highlightedDescription:{default:`Campo in evidenza`},aiReasoning:{type:Boolean,default:!1},aiReasoningDescription:{default:`Suggerito dall'intelligenza artificiale`},disableEmphasisReset:{type:Boolean,default:!1},maxlength:{},autocomplete:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearAriaLabel:{default:`Cancella`},leftIconClass:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`fzinput:left-icon-click`,`fzinput:right-icon-click`,`fzinput:second-right-icon-click`,`update:highlighted`,`update:aiReasoning`,`fzinput:clear`],[`update:modelValue`]),setup(e,{expose:a,emit:c}){let l=e,v=(0,t.useAttrs)(),y=(0,t.computed)(()=>{let{class:e,id:t,...n}=v;return n}),b=(0,t.computed)(()=>v.class);(0,t.watch)(()=>l.size,e=>{if(e!==void 0){let t=s[e];l.environment&&l.environment!==t?console.warn(`[FzInput] Both "size" and "environment" props are provided. "environment=${l.environment}" will be used and "size=${e}" will be ignored. Please remove the deprecated "size" prop.`):console.warn(`[FzInput] The "size" prop is deprecated and will be removed in a future version. Please use environment="${t}" instead of size="${e}".`)}},{immediate:!0}),(0,t.watch)(()=>l.rightIconSize,e=>{e!==void 0&&console.warn(`[FzInput] The "rightIconSize" prop is deprecated and will be removed in a future version. Icons now have a fixed size of "md". The provided value "${e}" will be ignored.`)},{immediate:!0});let x=(0,t.computed)(()=>l.environment?l.environment:l.size?s[l.size]:`frontoffice`),S=(0,t.useModel)(e,`modelValue`),C=(0,t.ref)(null),w=(0,t.ref)(null),T=u(),E=(0,t.computed)(()=>l.id||T),D=(0,t.ref)(!1),O=(0,t.ref)(l.highlighted),k=(0,t.ref)(l.aiReasoning);(0,t.watch)(()=>l.highlighted,e=>{O.value=e}),(0,t.watch)(()=>l.aiReasoning,e=>{k.value=e});let A=()=>{l.disableEmphasisReset||(O.value&&(O.value=!1,V(`update:highlighted`,!1)),k.value&&(k.value=!1,V(`update:aiReasoning`,!1)))},{staticContainerClass:j,computedContainerClass:M,computedLabelClass:N,staticInputClass:P,computedInputClass:F,computedHelpClass:I,showNormalPlaceholder:L}=o({...(0,t.toRefs)(l),highlighted:O,aiReasoning:k},C,S,x,D);(0,t.useSlots)();let R=(0,t.useSlots)(),z=(0,t.computed)(()=>{let e=!!l.label,t=!!R.label;if(e&&!t)return`${E.value}-label`}),B=(0,t.computed)(()=>{let e=[];return l.error&&R.errorMessage&&e.push(`${E.value}-error`),!l.error&&R.helpText&&e.push(`${E.value}-help`),e.length>0?e.join(` `):void 0}),V=c,H=()=>{!l.disabled&&!l.readonly&&w.value&&w.value.focus()},U=e=>{(e.key===`Enter`||e.key===` `)&&(e.target===e.currentTarget||e.target===C.value)&&(e.preventDefault(),H())},W=(e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),X.value||V(t===`fzinput:left-icon-click`?`fzinput:left-icon-click`:t===`fzinput:right-icon-click`?`fzinput:right-icon-click`:`fzinput:second-right-icon-click`))},G=()=>{X.value||V(`fzinput:left-icon-click`)},K=()=>{X.value||V(`fzinput:right-icon-click`)},q=()=>{X.value||V(`fzinput:second-right-icon-click`)},J=(0,t.computed)(()=>!!l.leftIcon),Y=(0,t.computed)(()=>J.value&&!!l.leftIconAriaLabel),X=(0,t.computed)(()=>!!l.disabled||!!l.readonly),Z=(0,t.computed)(()=>X.value||l.error?`text-grey-300`:`text-purple-600`),ee=(0,t.computed)(()=>{if(!(X.value||l.error)){if(O.value)return l.highlightedDescription;if(k.value)return l.aiReasoningDescription}}),te=(0,t.computed)(()=>!!l.rightIcon&&!l.rightIconButton),Q=(0,t.computed)(()=>te.value&&!!l.rightIconAriaLabel),ne=(0,t.computed)(()=>!!l.secondRightIcon&&!l.secondRightIconButton),$=(0,t.computed)(()=>ne.value&&!!l.secondRightIconAriaLabel),re=(0,t.computed)(()=>l.clearable&&!!S.value&&!X.value),ie=()=>{S.value=``,V(`fzinput:clear`),w.value?.focus()};return a({inputRef:w,containerRef:C}),(a,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`fz-input text-core-black w-full flex flex-col gap-8`,b.value])},[(0,t.renderSlot)(a.$slots,`label`,{},()=>[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,id:`${E.value}-label`,class:(0,t.normalizeClass)((0,t.unref)(N)),for:E.value},(0,t.toDisplayString)(e.label)+(0,t.toDisplayString)(e.required?` *`:``),11,d)):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([(0,t.unref)(j),(0,t.unref)(M)]),ref_key:`containerRef`,ref:C,tabindex:X.value?void 0:0,onClick:H,onKeydown:U},[(0,t.renderSlot)(a.$slots,`left-icon`,{},()=>[e.leftIcon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:0,name:e.leftIcon,size:`md`,variant:e.leftIconVariant,role:Y.value?`button`:void 0,"aria-label":Y.value?e.leftIconAriaLabel:void 0,"aria-disabled":Y.value&&X.value?`true`:void 0,tabindex:Y.value&&!X.value?0:void 0,class:(0,t.normalizeClass)(e.leftIconClass),onClick:(0,t.withModifiers)(G,[`stop`]),onKeydown:o[0]||=e=>Y.value?e=>W(e,`fzinput:left-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):k.value&&!O.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:1,name:`sparkles`,variant:`fas`,size:`md`,"aria-hidden":`true`,class:(0,t.normalizeClass)(Z.value)},null,8,[`class`])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,p,[(0,t.unref)(L)?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,m,(0,t.toDisplayString)(e.placeholder),1)),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({type:e.type,required:e.required,disabled:e.disabled,readonly:e.readonly,placeholder:(0,t.unref)(L)?e.placeholder:``,"onUpdate:modelValue":o[1]||=e=>S.value=e,ref_key:`inputRef`,ref:w,class:[(0,t.unref)(P),(0,t.unref)(F)],pattern:e.pattern,name:e.name,maxlength:e.maxlength,autocomplete:e.autocomplete?`on`:`off`,"aria-required":e.required?`true`:`false`,"aria-invalid":e.error?`true`:`false`,"aria-disabled":X.value?`true`:`false`,"aria-labelledby":z.value,"aria-describedby":B.value,"aria-description":ee.value},y.value,{id:E.value,onInput:A,onBlur:o[2]||=e=>{D.value=!1,a.$emit(`blur`,e)},onFocus:o[3]||=e=>{D.value=!0,a.$emit(`focus`,e)}}),null,16,h),[[t.vModelDynamic,S.value]])]),(0,t.createElementVNode)(`div`,g,[re.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:0,iconName:`xmark`,size:`md`,variant:`invisible`,ariaLabel:e.clearAriaLabel,onClick:(0,t.withModifiers)(ie,[`stop`])},null,8,[`ariaLabel`])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(a.$slots,`right-icon`,{},()=>[e.secondRightIcon&&!e.secondRightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:0,name:e.secondRightIcon,size:`md`,variant:e.secondRightIconVariant,role:$.value?`button`:void 0,"aria-label":$.value?e.secondRightIconAriaLabel:void 0,"aria-disabled":$.value&&X.value?`true`:void 0,tabindex:$.value&&!X.value?0:void 0,class:(0,t.normalizeClass)(e.secondRightIconClass),onClick:(0,t.withModifiers)(q,[`stop`]),onKeydown:o[4]||=e=>$.value?e=>W(e,`fzinput:second-right-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):(0,t.createCommentVNode)(``,!0),e.secondRightIcon&&e.secondRightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:1,iconName:e.secondRightIcon,size:`md`,iconVariant:e.secondRightIconVariant,variant:X.value?`invisible`:e.secondRightIconButtonVariant,onClick:(0,t.withModifiers)(q,[`stop`]),class:(0,t.normalizeClass)([{"bg-grey-100 !text-grey-300":X.value},e.secondRightIconClass])},null,8,[`iconName`,`iconVariant`,`variant`,`class`])):(0,t.createCommentVNode)(``,!0),e.rightIcon&&!e.rightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:2,name:e.rightIcon,size:`md`,variant:e.rightIconVariant,role:Q.value?`button`:void 0,"aria-label":Q.value?e.rightIconAriaLabel:void 0,"aria-disabled":Q.value&&X.value?`true`:void 0,tabindex:Q.value&&!X.value?0:void 0,class:(0,t.normalizeClass)(e.rightIconClass),onClick:(0,t.withModifiers)(K,[`stop`]),onKeydown:o[5]||=e=>Q.value?e=>W(e,`fzinput:right-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):(0,t.createCommentVNode)(``,!0),e.rightIcon&&e.rightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:3,iconName:e.rightIcon,size:`md`,iconVariant:e.rightIconVariant,variant:X.value?`invisible`:e.rightIconButtonVariant,onClick:(0,t.withModifiers)(K,[`stop`]),class:(0,t.normalizeClass)([{"bg-grey-100 !text-grey-300":X.value},e.rightIconClass])},null,8,[`iconName`,`iconVariant`,`variant`,`class`])):(0,t.createCommentVNode)(``,!0),e.valid?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:4,name:`check`,size:`md`,class:`text-semantic-success`,"aria-hidden":`true`})):(0,t.createCommentVNode)(``,!0)])])],42,f),e.error&&a.$slots.errorMessage?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.FzAlert),{key:0,id:`${E.value}-error`,role:`alert`,tone:`error`,variant:`text`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(a.$slots,`errorMessage`)]),_:3},8,[`id`])):a.$slots.helpText?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,id:`${E.value}-help`,class:(0,t.normalizeClass)([(0,t.unref)(I)])},[(0,t.renderSlot)(a.$slots,`helpText`)],10,_)):(0,t.createCommentVNode)(``,!0)],2))}}),y={class:`flex items-center gap-4`},b={class:`flex flex-col justify-between items-center`};e.FzCurrencyInput=(0,t.defineComponent)({__name:`FzCurrencyInput`,props:(0,t.mergeModels)({modelValue:{},nullOnEmpty:{type:Boolean},zeroOnEmpty:{type:Boolean},minimumFractionDigits:{default:2},maximumFractionDigits:{default:2},min:{default:-1/0},max:{default:1/0},step:{default:1},forceStep:{type:Boolean},stepUpAriaLabel:{},stepDownAriaLabel:{},id:{},label:{},environment:{},size:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{type:Boolean},leftIcon:{},leftIconVariant:{},leftIconButtonVariant:{},leftIconAriaLabel:{},valid:{type:Boolean},variant:{},pattern:{},name:{},readonly:{type:Boolean},highlighted:{type:Boolean},highlightedDescription:{},aiReasoning:{type:Boolean},aiReasoningDescription:{},disableEmphasisReset:{type:Boolean},maxlength:{},autocomplete:{type:Boolean},clearable:{type:Boolean},clearAriaLabel:{},leftIconClass:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`fzcurrencyinput:clear`],[`update:modelValue`]),setup(e,{expose:n,emit:i}){let o=(0,t.ref)(),s=(0,t.ref)(),c=(0,t.computed)(()=>o.value?.containerRef),l=(0,t.computed)(()=>o.value?.inputRef),u=(0,t.ref)(!1),d=e,f=i,p=(0,t.useModel)(e,`modelValue`),m=!1,h=()=>{if(d.nullOnEmpty)return null;if(d.zeroOnEmpty)return 0},g=(e,t)=>e?t?``:(0,a.format)(0,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0}):``,_=(0,t.computed)(()=>d.stepUpAriaLabel?d.stepUpAriaLabel:`Incrementa di ${d.step}`),x=(0,t.computed)(()=>d.stepDownAriaLabel?d.stepDownAriaLabel:`Decrementa di ${d.step}`),S=(0,t.computed)(()=>d.readonly||d.disabled),C=e=>{let t=e.replace(/[^0-9.,-]/g,``),n=t.startsWith(`-`);t=t.replace(/-/g,``),t=t.replace(/\./g,`,`);let r=t.indexOf(`,`);if(r!==-1){let e=t.substring(0,r),n=t.substring(r+1).replace(/,/g,``);t=e+`,`+n}return n?`-`+t:t},w=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey||[`Backspace`,`Delete`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Home`,`End`].includes(e.key))){if(e.key===`-`){let t=e.target,n=t.selectionStart??0,r=(t.selectionEnd??0)-n,i=t.value.length;n!==0&&r!==i&&e.preventDefault();return}/^[0-9.,]$/.test(e.key)||e.preventDefault()}},T=e=>{if(d.readonly||d.disabled)return;e.preventDefault();let t=e.clipboardData?.getData(`text`)||``;if(!t)return;let n=(0,a.parse)(t);if(!isNaN(n)&&isFinite(n)){let e=(0,a.truncateDecimals)(n,d.maximumFractionDigits);m=!0,p.value=e,m=!1,s.value=C(String(e))}},E=e=>{if(!e){let e=h();m=!0,p.value=e,m=!1,s.value=``;return}let t=C(e);s.value=t;let n=(0,a.parse)(t);if(!isNaN(n)&&isFinite(n)){let e=(0,a.truncateDecimals)(n,d.maximumFractionDigits);m=!0,p.value=e,m=!1}else m=!0,p.value=h(),m=!1},D=()=>{if(d.readonly||d.disabled)return;u.value=!1;let e=k(p.value);if(e==null){let e=h();p.value!==e&&(m=!0,p.value=e,m=!1),s.value=g(e===0,!1);return}let t=e;d.forceStep&&(t=(0,a.roundTo)(d.step,t)),t=(0,a.clamp)(d.min,t,d.max),t!==e&&(m=!0,p.value=t,m=!1),s.value=(0,a.format)(t,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0})},O=()=>{if(d.readonly||d.disabled)return;u.value=!0;let e=k(p.value);e!==void 0&&(s.value=(0,a.format)(e,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0}).replace(/\./g,``))},k=e=>{if(e==null||e===``)return e===null?null:void 0;if(typeof e==`number`)return e;if(typeof e==`string`){console.warn(`[FzCurrencyInput] String values in v-model are deprecated. Please use number instead. Received: "${e}". This will be parsed to a number for retrocompatibility, but string support may be removed in a future version.`);let t=(0,a.parse)(e);return isNaN(t)?void 0:t}},A=()=>{if(d.readonly||d.disabled)return;let e=k(p.value),t=(0,a.truncateDecimals)((e??0)+d.step,d.maximumFractionDigits),n=(0,a.clamp)(d.min,t,d.max);m=!0,p.value=n,m=!1,s.value=(0,a.format)(n,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0})},j=()=>{if(d.readonly||d.disabled)return;let e=k(p.value),t=(0,a.truncateDecimals)((e??0)-d.step,d.maximumFractionDigits),n=(0,a.clamp)(d.min,t,d.max);m=!0,p.value=n,m=!1,s.value=(0,a.format)(n,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0})};return(0,t.onMounted)(()=>{let e=p.value;if(e==null){let t=h();e!==t&&(m=!0,p.value=t,m=!1),s.value=g(t===0,!1);return}if(typeof e==`number`){let t=(0,a.truncateDecimals)(e,d.maximumFractionDigits);d.forceStep&&(t=(0,a.roundTo)(d.step,t)),t=(0,a.clamp)(d.min,t,d.max),t!==e&&(m=!0,p.value=t,m=!1),s.value=(0,a.format)(t,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0});return}if(typeof e==`string`){let t=k(e);if(t!=null){let e=(0,a.truncateDecimals)(t,d.maximumFractionDigits);d.forceStep&&(e=(0,a.roundTo)(d.step,e)),e=(0,a.clamp)(d.min,e,d.max),m=!0,p.value=e,m=!1,s.value=(0,a.format)(e,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0})}else{let e=h();m=!0,p.value=e,m=!1,s.value=g(e===0,!1)}return}}),(0,t.watch)(()=>p.value,e=>{if(!m){if(e==null){let t=h();e!==t&&(m=!0,p.value=t,m=!1),s.value=g(t===0,u.value);return}if(typeof e==`number`){let t=(0,a.truncateDecimals)(e,d.maximumFractionDigits);d.forceStep&&(t=(0,a.roundTo)(d.step,t)),u.value||(t=(0,a.clamp)(d.min,t,d.max)),t!==e&&(m=!0,p.value=t,m=!1),u.value||(s.value=(0,a.format)(t,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0}));return}if(typeof e==`string`){let t=k(e);if(t!=null){let e=(0,a.truncateDecimals)(t,d.maximumFractionDigits);d.forceStep&&(e=(0,a.roundTo)(d.step,e)),u.value||(e=(0,a.clamp)(d.min,e,d.max)),m=!0,p.value=e,m=!1,u.value||(s.value=(0,a.format)(e,{minimumFractionDigits:d.minimumFractionDigits,maximumFractionDigits:d.maximumFractionDigits,roundDecimals:!1,useGrouping:!0}))}else{let e=h();m=!0,p.value=e,m=!1,s.value=g(e===0,u.value)}return}}}),n({inputRef:l,containerRef:c}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(v,(0,t.mergeProps)({ref_key:`fzInputRef`,ref:o},d,{modelValue:s.value,type:`text`,"onUpdate:modelValue":E,onKeydown:w,onFocus:O,onBlur:D,onPaste:T,"onFzinput:clear":n[2]||=e=>f(`fzcurrencyinput:clear`)}),(0,t.createSlots)({"right-icon":(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,y,[d.valid?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:0,name:`check`,size:`md`,class:`text-semantic-success`,"aria-hidden":`true`})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,b,[(0,t.createVNode)((0,t.unref)(r.FzIcon),{name:`angle-up`,size:`xs`,role:`button`,"aria-label":_.value,"aria-disabled":S.value?`true`:void 0,tabindex:S.value?void 0:`0`,class:`fz__currencyinput__arrowup cursor-pointer`,onClick:A,onKeydown:n[0]||=e=>{(e.key===`Enter`||e.key===` `)&&!S.value&&(e.preventDefault(),A())}},null,8,[`aria-label`,`aria-disabled`,`tabindex`]),(0,t.createVNode)((0,t.unref)(r.FzIcon),{name:`angle-down`,size:`xs`,role:`button`,"aria-label":x.value,"aria-disabled":S.value?`true`:void 0,tabindex:S.value?void 0:`0`,class:`fz__currencyinput__arrowdown cursor-pointer`,onClick:j,onKeydown:n[1]||=e=>{(e.key===`Enter`||e.key===` `)&&!S.value&&(e.preventDefault(),j())}},null,8,[`aria-label`,`aria-disabled`,`tabindex`])])])]),_:2},[e.$slots.label?{name:`label`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`label`)]),key:`0`}:void 0,e.$slots[`left-icon`]?{name:`left-icon`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`left-icon`)]),key:`1`}:void 0,e.$slots.helpText?{name:`helpText`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`helpText`)]),key:`2`}:void 0,e.$slots.errorMessage?{name:`errorMessage`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`errorMessage`)]),key:`3`}:void 0]),1040,[`modelValue`]))}}),e.FzInput=v,e.sizeToEnvironmentMapping=s});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@fiscozen/alert`),require(`@fiscozen/icons`),require(`@fiscozen/button`),require(`@fiscozen/composables`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@fiscozen/alert`,`@fiscozen/icons`,`@fiscozen/button`,`@fiscozen/composables`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FzInput={},e.Vue,e._fiscozen_alert,e._fiscozen_icons,e._fiscozen_button,e._fiscozen_composables))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e,n,r,i,a){let o={backoffice:`h-32`,frontoffice:`h-44`},s=(0,t.computed)(()=>{let t=i.value;return[e.variant?.value===`normal`?o[t]:o.frontoffice,v()]}),c=(0,t.computed)(()=>[`font-normal text-base mb-0`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-grey-500`]),l={backoffice:`text-base`,frontoffice:`text-base`},u=(0,t.computed)(()=>e.variant?.value===`floating-label`?!r.value&&!a.value:!0),d=(0,t.computed)(()=>{let t=i.value;return e.variant?.value===`floating-label`?[l[t]]:[]}),f=(0,t.computed)(()=>[`font-normal text-base`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-grey-500`]),p=(0,t.computed)(()=>[`font-normal text-base`,e.disabled?.value||e.readonly?.value?`text-grey-300`:`text-core-black`]),m=e=>!!e.error?.value,h=e=>!!e.disabled?.value||!!e.readonly?.value,g=e=>!!e.highlighted?.value,_=e=>!!e.aiReasoning?.value,v=()=>{switch(!0){case m(e):return`border-semantic-error-200 has-[:focus]:border-semantic-error-300 bg-core-white text-core-black cursor-text`;case h(e):return`bg-grey-100 border-grey-100 text-grey-300 cursor-not-allowed`;case g(e):return`bg-semantic-warning-50 border-semantic-warning-200 ring-2 ring-semantic-warning-100 text-core-black cursor-text`;case _(e):return`bg-purple-50 border-purple-600 ring-2 ring-purple-200 text-core-black cursor-text`;default:return`border-grey-200 has-[:focus]:border-blue-600 bg-core-white text-core-black cursor-text`}};return{staticContainerClass:`flex justify-between w-full items-center pl-[10px] pr-[10px] rounded border-1 border-solid gap-8 text-left relative outline-none`,computedContainerClass:s,computedLabelClass:c,staticInputClass:`peer w-full bg-transparent border-0 outline-none focus:outline-none cursor-[inherit] focus:ring-0 truncate placeholder:text-grey-300 disabled:text-grey-300 read-only:text-grey-300 font-normal text-base`,computedInputClass:d,computedHelpClass:f,computedErrorClass:p,showNormalPlaceholder:u}}var s=/^-?\d+(\.\d+)?([eE][-+]?\d+)?$/,c=e=>s.test(e),l=e=>{let t=(0,a.parse)(e);return isNaN(t)||!isFinite(t)?null:t},u={sm:`backoffice`,md:`backoffice`,lg:`frontoffice`},d=0;function f(e){return`${e}-${Date.now()-16e11}-${++d}`}function p(){return f(`fz-input`)}function m(e){let{props:n,model:r,enabled:i}=e,o=(0,t.ref)(),s=(0,t.ref)(!1),c=!1,u=()=>n.min??-1/0,d=()=>n.max??1/0,f=()=>n.step??1,p=()=>n.minimumFractionDigits??2,m=()=>n.maximumFractionDigits??2,h=e=>{c=!0,r.value=e,c=!1},g=e=>(0,a.format)(e,{minimumFractionDigits:p(),maximumFractionDigits:m(),roundDecimals:!1,useGrouping:!0}),_=()=>{if(n.nullOnEmpty)return null;if(n.zeroOnEmpty)return 0},v=(e,t)=>e?t?``:g(0):``,y=e=>{let t=e.replace(/[^0-9.,-]/g,``),n=t.startsWith(`-`);t=t.replace(/-/g,``),t=t.replace(/\./g,`,`);let r=t.indexOf(`,`);if(r!==-1){let e=t.substring(0,r),n=t.substring(r+1).replace(/,/g,``);t=e+`,`+n}return n?`-`+t:t},b=e=>{if(e==null||e===``)return e===null?null:void 0;if(typeof e==`number`)return e;if(typeof e==`string`){console.warn(`[FzCurrencyInput] String values in v-model are deprecated. Please use number instead. Received: "${e}". This will be parsed to a number for retrocompatibility, but string support may be removed in a future version.`);let t=(0,a.parse)(e);return isNaN(t)?void 0:t}},x=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey||[`Backspace`,`Delete`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Home`,`End`].includes(e.key))){if(e.key===`-`){let t=e.target,n=t.selectionStart??0,r=(t.selectionEnd??0)-n,i=t.value.length;n!==0&&r!==i&&e.preventDefault();return}/^[0-9.,]$/.test(e.key)||e.preventDefault()}},S=e=>{if(n.readonly||n.disabled)return;e.preventDefault();let t=e.clipboardData?.getData(`text`)||``;if(!t)return;let r=l(t);if(r!==null){let e=(0,a.truncateDecimals)(r,m());h(e),o.value=y(String(e))}},C=e=>{if(!e){h(_()),o.value=``;return}let t=y(e);o.value=t;let n=(0,a.parse)(t);h(!isNaN(n)&&isFinite(n)?(0,a.truncateDecimals)(n,m()):_())},w=()=>{if(n.readonly||n.disabled)return;s.value=!1;let e=b(r.value);if(e==null){let e=_();r.value!==e&&h(e),o.value=v(e===0,!1);return}let t=e;n.forceStep&&(t=(0,a.roundTo)(f(),t)),t=(0,a.clamp)(u(),t,d()),t!==e&&h(t),o.value=g(t)},T=()=>{if(n.readonly||n.disabled)return;s.value=!0;let e=b(r.value);e!==void 0&&(o.value=g(e).replace(/\./g,``))},E=e=>{if(n.readonly||n.disabled)return;let t=b(r.value),i=(0,a.truncateDecimals)((t??0)+e*f(),m()),s=(0,a.clamp)(u(),i,d());h(s),o.value=g(s)},D=(e,t)=>{if(e==null){let n=_();e!==n&&h(n),o.value=v(n===0,t);return}let r=b(e);if(r==null){let e=_();h(e),o.value=v(e===0,t);return}let i=(0,a.truncateDecimals)(r,m());n.forceStep&&(i=(0,a.roundTo)(f(),i)),t||(i=(0,a.clamp)(u(),i,d())),i!==e&&h(i),t||(o.value=g(i))};return(0,t.onMounted)(()=>{i.value&&D(r.value,!1)}),(0,t.watch)(i,e=>{e&&D(r.value,!1)}),(0,t.watch)(()=>r.value,e=>{!i.value||c||D(e,s.value)}),{displayValue:o,handleDisplayUpdate:C,handleKeydown:x,handlePaste:S,handleFocus:T,handleBlur:w,stepBy:E}}var h=[`id`,`for`],g=[`tabindex`],_={class:`flex flex-col justify-around min-w-0 grow`},v={key:0,class:`text-xs text-grey-300 grow-0 overflow-hidden text-ellipsis whitespace-nowrap`},y=[`type`,`required`,`disabled`,`readonly`,`placeholder`,`pattern`,`name`,`maxlength`,`min`,`max`,`step`,`autocomplete`,`aria-required`,`aria-invalid`,`aria-disabled`,`aria-labelledby`,`aria-describedby`,`aria-description`,`id`],b={class:`flex items-center gap-4`},x={key:1,class:`flex flex-col justify-between items-center`},S=[`id`],C=`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`,w=(0,t.defineComponent)({inheritAttrs:!1,__name:`FzInput`,props:(0,t.mergeModels)({id:{},label:{},environment:{default:`frontoffice`},size:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{type:Boolean,default:!1},leftIcon:{},leftIconVariant:{},leftIconButtonVariant:{},leftIconAriaLabel:{},rightIcon:{},rightIconClass:{},rightIconSize:{},rightIconVariant:{},rightIconButton:{type:Boolean},rightIconButtonVariant:{default:`invisible`},rightIconAriaLabel:{},secondRightIcon:{},secondRightIconClass:{},secondRightIconVariant:{},secondRightIconButton:{type:Boolean},secondRightIconButtonVariant:{default:`invisible`},secondRightIconAriaLabel:{},type:{},valid:{type:Boolean},variant:{default:`normal`},pattern:{},name:{},readonly:{type:Boolean},highlighted:{type:Boolean,default:!1},highlightedDescription:{default:`Campo in evidenza`},aiReasoning:{type:Boolean,default:!1},aiReasoningDescription:{default:`Suggerito dall'intelligenza artificiale`},disableEmphasisReset:{type:Boolean,default:!1},maxlength:{},autocomplete:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearAriaLabel:{default:`Cancella`},leftIconClass:{},min:{},max:{},step:{default:1},forceStep:{type:Boolean},minimumFractionDigits:{default:2},maximumFractionDigits:{default:2},nullOnEmpty:{type:Boolean},zeroOnEmpty:{type:Boolean},stepUpAriaLabel:{},stepDownAriaLabel:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`fzinput:left-icon-click`,`fzinput:right-icon-click`,`fzinput:second-right-icon-click`,`update:highlighted`,`update:aiReasoning`,`fzinput:clear`],[`update:modelValue`]),setup(e,{expose:a,emit:s}){let d=e,f=(0,t.useAttrs)(),w=(0,t.computed)(()=>{let{class:e,id:t,...n}=f;return n}),T=(0,t.computed)(()=>f.class);(0,t.watch)(()=>d.size,e=>{if(e!==void 0){let t=u[e];d.environment&&d.environment!==t?console.warn(`[FzInput] Both "size" and "environment" props are provided. "environment=${d.environment}" will be used and "size=${e}" will be ignored. Please remove the deprecated "size" prop.`):console.warn(`[FzInput] The "size" prop is deprecated and will be removed in a future version. Please use environment="${t}" instead of size="${e}".`)}},{immediate:!0}),(0,t.watch)(()=>d.rightIconSize,e=>{e!==void 0&&console.warn(`[FzInput] The "rightIconSize" prop is deprecated and will be removed in a future version. Icons now have a fixed size of "md". The provided value "${e}" will be ignored.`)},{immediate:!0});let E=(0,t.computed)(()=>d.environment?d.environment:d.size?u[d.size]:`frontoffice`),D=(0,t.useModel)(e,`modelValue`),O=(0,t.ref)(null),k=(0,t.ref)(null),ee=p(),A=(0,t.computed)(()=>d.id||ee),j=(0,t.ref)(!1),M=D,N=(0,t.computed)(()=>d.type??`text`),P=(0,t.computed)(()=>N.value===`currency`),F=(0,t.computed)(()=>N.value===`number`),te=(0,t.computed)(()=>P.value?`text`:N.value),I=m({props:d,model:M,enabled:P}),L=(0,t.computed)({get:()=>P.value?I.displayValue.value:M.value,set:e=>{P.value?I.handleDisplayUpdate(e):M.value=e}}),R=(0,t.ref)(d.highlighted),z=(0,t.ref)(d.aiReasoning);(0,t.watch)(()=>d.highlighted,e=>{R.value=e}),(0,t.watch)(()=>d.aiReasoning,e=>{z.value=e});let ne=()=>{d.disableEmphasisReset||(R.value&&(R.value=!1,H(`update:highlighted`,!1)),z.value&&(z.value=!1,H(`update:aiReasoning`,!1)))},{staticContainerClass:re,computedContainerClass:ie,computedLabelClass:ae,staticInputClass:oe,computedInputClass:se,computedHelpClass:ce,showNormalPlaceholder:B}=o({...(0,t.toRefs)(d),highlighted:R,aiReasoning:z},O,L,E,j);(0,t.useSlots)();let V=(0,t.useSlots)(),le=(0,t.computed)(()=>{let e=!!d.label,t=!!V.label;if(e&&!t)return`${A.value}-label`}),ue=(0,t.computed)(()=>{let e=[];return d.error&&V.errorMessage&&e.push(`${A.value}-error`),!d.error&&V.helpText&&e.push(`${A.value}-help`),e.length>0?e.join(` `):void 0}),H=s,U=()=>{!d.disabled&&!d.readonly&&k.value&&k.value.focus()},de=e=>{(e.key===`Enter`||e.key===` `)&&(e.target===e.currentTarget||e.target===O.value)&&(e.preventDefault(),U())},W=(e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),J.value||H(t===`fzinput:left-icon-click`?`fzinput:left-icon-click`:t===`fzinput:right-icon-click`?`fzinput:right-icon-click`:`fzinput:second-right-icon-click`))},fe=()=>{J.value||H(`fzinput:left-icon-click`)},G=()=>{J.value||H(`fzinput:right-icon-click`)},K=()=>{J.value||H(`fzinput:second-right-icon-click`)},pe=(0,t.computed)(()=>!!d.leftIcon),q=(0,t.computed)(()=>pe.value&&!!d.leftIconAriaLabel),J=(0,t.computed)(()=>!!d.disabled||!!d.readonly),me=(0,t.computed)(()=>J.value||d.error?`text-grey-300`:`text-purple-600`),he=(0,t.computed)(()=>{if(!(J.value||d.error)){if(R.value)return d.highlightedDescription;if(z.value)return d.aiReasoningDescription}}),ge=(0,t.computed)(()=>!!d.rightIcon&&!d.rightIconButton),Y=(0,t.computed)(()=>ge.value&&!!d.rightIconAriaLabel),_e=(0,t.computed)(()=>!!d.secondRightIcon&&!d.secondRightIconButton),X=(0,t.computed)(()=>_e.value&&!!d.secondRightIconAriaLabel),ve=(0,t.computed)(()=>d.clearable&&!!L.value&&!J.value),ye=()=>{L.value=``,H(`fzinput:clear`),k.value?.focus()},be=e=>{j.value=!0,P.value&&I.handleFocus(),H(`focus`,e)},xe=e=>{j.value=!1,P.value&&I.handleBlur(),H(`blur`,e)},Se=e=>{P.value&&I.handleKeydown(e)},Z=e=>{if(d.readonly||d.disabled)return;let t=e.clipboardData?.getData(`text`)||``;if(!t||c(t))return;e.preventDefault();let n=l(t);n!==null&&(M.value=String(n))},Ce=e=>{P.value?I.handlePaste(e):F.value&&Z(e)},we=(0,t.computed)(()=>P.value||F.value),Te=(0,t.computed)(()=>d.stepUpAriaLabel||`Incrementa di ${d.step}`),Ee=(0,t.computed)(()=>d.stepDownAriaLabel||`Decrementa di ${d.step}`),De=e=>{let t=k.value;if(t){try{e===1?t.stepUp():t.stepDown()}catch{return}t.dispatchEvent(new Event(`input`,{bubbles:!0}))}},Q=e=>{J.value||(P.value?I.stepBy(e):F.value&&De(e))},$=(e,t)=>{(e.key===`Enter`||e.key===` `)&&!J.value&&(e.preventDefault(),Q(t))};return a({inputRef:k,containerRef:O}),(a,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`fz-input text-core-black w-full flex flex-col gap-8`,T.value])},[(0,t.renderSlot)(a.$slots,`label`,{},()=>[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,id:`${A.value}-label`,class:(0,t.normalizeClass)((0,t.unref)(ae)),for:A.value},(0,t.toDisplayString)(e.label)+(0,t.toDisplayString)(e.required?` *`:``),11,h)):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([(0,t.unref)(re),(0,t.unref)(ie)]),ref_key:`containerRef`,ref:O,tabindex:J.value?void 0:0,onClick:U,onKeydown:de},[(0,t.renderSlot)(a.$slots,`left-icon`,{},()=>[e.leftIcon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:0,name:e.leftIcon,size:`md`,variant:e.leftIconVariant,role:q.value?`button`:void 0,"aria-label":q.value?e.leftIconAriaLabel:void 0,"aria-disabled":q.value&&J.value?`true`:void 0,tabindex:q.value&&!J.value?0:void 0,class:(0,t.normalizeClass)(e.leftIconClass),onClick:(0,t.withModifiers)(fe,[`stop`]),onKeydown:o[0]||=e=>q.value?e=>W(e,`fzinput:left-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):z.value&&!R.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:1,name:`sparkles`,variant:`fas`,size:`md`,"aria-hidden":`true`,class:(0,t.normalizeClass)(me.value)},null,8,[`class`])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,_,[(0,t.unref)(B)?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,v,(0,t.toDisplayString)(e.placeholder),1)),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({type:te.value,required:e.required,disabled:e.disabled,readonly:e.readonly,placeholder:(0,t.unref)(B)?e.placeholder:``,"onUpdate:modelValue":o[1]||=e=>L.value=e,ref_key:`inputRef`,ref:k,class:[(0,t.unref)(oe),(0,t.unref)(se),F.value?C:``],pattern:e.pattern,name:e.name,maxlength:e.maxlength,min:F.value?e.min:void 0,max:F.value?e.max:void 0,step:F.value?e.step:void 0,autocomplete:e.autocomplete?`on`:`off`,"aria-required":e.required?`true`:`false`,"aria-invalid":e.error?`true`:`false`,"aria-disabled":J.value?`true`:`false`,"aria-labelledby":le.value,"aria-describedby":ue.value,"aria-description":he.value},w.value,{id:A.value,onInput:ne,onKeydown:Se,onPaste:Ce,onBlur:xe,onFocus:be}),null,16,y),[[t.vModelDynamic,L.value]])]),(0,t.createElementVNode)(`div`,b,[ve.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:0,iconName:`xmark`,size:`md`,variant:`invisible`,ariaLabel:e.clearAriaLabel,onClick:(0,t.withModifiers)(ye,[`stop`])},null,8,[`ariaLabel`])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(a.$slots,`right-icon`,{},()=>[e.secondRightIcon&&!e.secondRightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:0,name:e.secondRightIcon,size:`md`,variant:e.secondRightIconVariant,role:X.value?`button`:void 0,"aria-label":X.value?e.secondRightIconAriaLabel:void 0,"aria-disabled":X.value&&J.value?`true`:void 0,tabindex:X.value&&!J.value?0:void 0,class:(0,t.normalizeClass)(e.secondRightIconClass),onClick:(0,t.withModifiers)(K,[`stop`]),onKeydown:o[2]||=e=>X.value?e=>W(e,`fzinput:second-right-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):(0,t.createCommentVNode)(``,!0),e.secondRightIcon&&e.secondRightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:1,iconName:e.secondRightIcon,size:`md`,iconVariant:e.secondRightIconVariant,variant:J.value?`invisible`:e.secondRightIconButtonVariant,onClick:(0,t.withModifiers)(K,[`stop`]),class:(0,t.normalizeClass)([{"bg-grey-100 !text-grey-300":J.value},e.secondRightIconClass])},null,8,[`iconName`,`iconVariant`,`variant`,`class`])):(0,t.createCommentVNode)(``,!0),e.rightIcon&&!e.rightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:2,name:e.rightIcon,size:`md`,variant:e.rightIconVariant,role:Y.value?`button`:void 0,"aria-label":Y.value?e.rightIconAriaLabel:void 0,"aria-disabled":Y.value&&J.value?`true`:void 0,tabindex:Y.value&&!J.value?0:void 0,class:(0,t.normalizeClass)(e.rightIconClass),onClick:(0,t.withModifiers)(G,[`stop`]),onKeydown:o[3]||=e=>Y.value?e=>W(e,`fzinput:right-icon-click`):void 0},null,8,[`name`,`variant`,`role`,`aria-label`,`aria-disabled`,`tabindex`,`class`])):(0,t.createCommentVNode)(``,!0),e.rightIcon&&e.rightIconButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(i.FzIconButton),{key:3,iconName:e.rightIcon,size:`md`,iconVariant:e.rightIconVariant,variant:J.value?`invisible`:e.rightIconButtonVariant,onClick:(0,t.withModifiers)(G,[`stop`]),class:(0,t.normalizeClass)([{"bg-grey-100 !text-grey-300":J.value},e.rightIconClass])},null,8,[`iconName`,`iconVariant`,`variant`,`class`])):(0,t.createCommentVNode)(``,!0),e.valid?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(r.FzIcon),{key:4,name:`check`,size:`md`,class:`text-semantic-success`,"aria-hidden":`true`})):(0,t.createCommentVNode)(``,!0)]),we.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,x,[(0,t.createVNode)((0,t.unref)(r.FzIcon),{name:`angle-up`,size:`xs`,role:`button`,"aria-label":Te.value,"aria-disabled":J.value?`true`:void 0,tabindex:J.value?void 0:`0`,class:`fz__input__arrowup fz__currencyinput__arrowup cursor-pointer`,onClick:o[4]||=e=>Q(1),onKeydown:o[5]||=e=>$(e,1)},null,8,[`aria-label`,`aria-disabled`,`tabindex`]),(0,t.createVNode)((0,t.unref)(r.FzIcon),{name:`angle-down`,size:`xs`,role:`button`,"aria-label":Ee.value,"aria-disabled":J.value?`true`:void 0,tabindex:J.value?void 0:`0`,class:`fz__input__arrowdown fz__currencyinput__arrowdown cursor-pointer`,onClick:o[6]||=e=>Q(-1),onKeydown:o[7]||=e=>$(e,-1)},null,8,[`aria-label`,`aria-disabled`,`tabindex`])])):(0,t.createCommentVNode)(``,!0)])],42,g),e.error&&a.$slots.errorMessage?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.FzAlert),{key:0,id:`${A.value}-error`,role:`alert`,tone:`error`,variant:`text`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(a.$slots,`errorMessage`)]),_:3},8,[`id`])):a.$slots.helpText?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,id:`${A.value}-help`,class:(0,t.normalizeClass)([(0,t.unref)(ce)])},[(0,t.renderSlot)(a.$slots,`helpText`)],10,S)):(0,t.createCommentVNode)(``,!0)],2))}});e.FzCurrencyInput=(0,t.defineComponent)({__name:`FzCurrencyInput`,props:(0,t.mergeModels)({modelValue:{},id:{},label:{},environment:{},size:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{type:Boolean},leftIcon:{},leftIconVariant:{},leftIconButtonVariant:{},leftIconAriaLabel:{},valid:{type:Boolean},variant:{},pattern:{},name:{},readonly:{type:Boolean},highlighted:{type:Boolean},highlightedDescription:{},aiReasoning:{type:Boolean},aiReasoningDescription:{},disableEmphasisReset:{type:Boolean},maxlength:{},autocomplete:{type:Boolean},clearable:{type:Boolean},clearAriaLabel:{},leftIconClass:{},min:{},max:{},step:{},forceStep:{type:Boolean},minimumFractionDigits:{},maximumFractionDigits:{},nullOnEmpty:{type:Boolean},zeroOnEmpty:{type:Boolean},stepUpAriaLabel:{},stepDownAriaLabel:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`fzcurrencyinput:clear`],[`update:modelValue`]),setup(e,{expose:n,emit:r}){let i=(0,t.ref)(null),a=(0,t.computed)(()=>i.value?.containerRef),o=(0,t.computed)(()=>i.value?.inputRef),s=e,c=r,l=(0,t.useModel)(e,`modelValue`),u=(0,t.computed)({get:()=>l.value,set:e=>{l.value=e}});return n({inputRef:o,containerRef:a}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(w,(0,t.mergeProps)({ref_key:`fzInputRef`,ref:i},s,{type:`currency`,modelValue:u.value,"onUpdate:modelValue":n[0]||=e=>u.value=e,"onFzinput:clear":n[1]||=e=>c(`fzcurrencyinput:clear`)}),(0,t.createSlots)({_:2},[e.$slots.label?{name:`label`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`label`)]),key:`0`}:void 0,e.$slots[`left-icon`]?{name:`left-icon`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`left-icon`)]),key:`1`}:void 0,e.$slots.helpText?{name:`helpText`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`helpText`)]),key:`2`}:void 0,e.$slots.errorMessage?{name:`errorMessage`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`errorMessage`)]),key:`3`}:void 0]),1040,[`modelValue`]))}}),e.FzInput=w,e.sizeToEnvironmentMapping=u});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { nextTick } from 'vue';
|
|
2
1
|
import { FzCurrencyInputProps } from './types';
|
|
3
2
|
type __VLS_Props = FzCurrencyInputProps;
|
|
4
3
|
type __VLS_PublicProps = {
|
|
@@ -13,184 +12,10 @@ declare function __VLS_template(): {
|
|
|
13
12
|
errorMessage?(_: {}): any;
|
|
14
13
|
};
|
|
15
14
|
refs: {
|
|
16
|
-
fzInputRef: ({
|
|
17
|
-
$: import('vue').ComponentInternalInstance;
|
|
18
|
-
$data: {};
|
|
19
|
-
$props: {
|
|
20
|
-
readonly modelValue?: string | undefined;
|
|
21
|
-
readonly id?: string | undefined;
|
|
22
|
-
readonly label?: string | undefined;
|
|
23
|
-
readonly environment?: import('./types').InputEnvironment | undefined;
|
|
24
|
-
readonly size?: "sm" | "md" | "lg" | undefined;
|
|
25
|
-
readonly placeholder?: string | undefined;
|
|
26
|
-
readonly required?: boolean | undefined;
|
|
27
|
-
readonly disabled?: boolean | undefined;
|
|
28
|
-
readonly error?: boolean | undefined;
|
|
29
|
-
readonly leftIcon?: string | undefined;
|
|
30
|
-
readonly leftIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
31
|
-
readonly leftIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
32
|
-
readonly leftIconAriaLabel?: string | undefined;
|
|
33
|
-
readonly rightIcon?: string | undefined;
|
|
34
|
-
readonly rightIconClass?: string | undefined;
|
|
35
|
-
readonly rightIconSize?: import('@fiscozen/icons').IconSize | undefined;
|
|
36
|
-
readonly rightIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
37
|
-
readonly rightIconButton?: boolean | undefined;
|
|
38
|
-
readonly rightIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
39
|
-
readonly rightIconAriaLabel?: string | undefined;
|
|
40
|
-
readonly secondRightIcon?: string | undefined;
|
|
41
|
-
readonly secondRightIconClass?: string | undefined;
|
|
42
|
-
readonly secondRightIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
43
|
-
readonly secondRightIconButton?: boolean | undefined;
|
|
44
|
-
readonly secondRightIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
45
|
-
readonly secondRightIconAriaLabel?: string | undefined;
|
|
46
|
-
readonly type?: "text" | "password" | "email" | "number" | "tel" | "url" | undefined;
|
|
47
|
-
readonly valid?: boolean | undefined;
|
|
48
|
-
readonly variant?: "normal" | "floating-label" | undefined;
|
|
49
|
-
readonly pattern?: string | undefined;
|
|
50
|
-
readonly name?: string | undefined;
|
|
51
|
-
readonly readonly?: boolean | undefined;
|
|
52
|
-
readonly highlighted?: boolean | undefined;
|
|
53
|
-
readonly highlightedDescription?: string | undefined;
|
|
54
|
-
readonly aiReasoning?: boolean | undefined;
|
|
55
|
-
readonly aiReasoningDescription?: string | undefined;
|
|
56
|
-
readonly disableEmphasisReset?: boolean | undefined;
|
|
57
|
-
readonly maxlength?: number | undefined;
|
|
58
|
-
readonly autocomplete?: boolean | undefined;
|
|
59
|
-
readonly clearable?: boolean | undefined;
|
|
60
|
-
readonly clearAriaLabel?: string | undefined;
|
|
61
|
-
readonly leftIconClass?: string | undefined;
|
|
62
|
-
readonly onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
63
|
-
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
64
|
-
readonly "onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
65
|
-
readonly "onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
66
|
-
readonly "onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
67
|
-
readonly "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
68
|
-
readonly "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
69
|
-
readonly "onFzinput:clear"?: (() => any) | undefined;
|
|
70
|
-
readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
71
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
72
|
-
$attrs: {
|
|
73
|
-
[x: string]: unknown;
|
|
74
|
-
};
|
|
75
|
-
$refs: {
|
|
76
|
-
[x: string]: unknown;
|
|
77
|
-
} & {
|
|
78
|
-
containerRef: HTMLDivElement;
|
|
79
|
-
inputRef: HTMLInputElement;
|
|
80
|
-
};
|
|
81
|
-
$slots: Readonly<{
|
|
82
|
-
[name: string]: import('vue').Slot<any> | undefined;
|
|
83
|
-
}>;
|
|
84
|
-
$root: import('vue').ComponentPublicInstance | null;
|
|
85
|
-
$parent: import('vue').ComponentPublicInstance | null;
|
|
86
|
-
$host: Element | null;
|
|
87
|
-
$emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "fzinput:clear") => void) & ((event: "update:modelValue", value: string) => void);
|
|
88
|
-
$el: any;
|
|
89
|
-
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
90
|
-
modelValue?: string;
|
|
91
|
-
} & import('./types').FzInputProps> & Readonly<{
|
|
92
|
-
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
93
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
94
|
-
"onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
95
|
-
"onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
96
|
-
"onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
97
|
-
"onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
98
|
-
"onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
99
|
-
"onFzinput:clear"?: (() => any) | undefined;
|
|
100
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
101
|
-
}>, {
|
|
102
|
-
inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
103
|
-
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
104
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
105
|
-
focus: (event: FocusEvent) => any;
|
|
106
|
-
blur: (event: FocusEvent) => any;
|
|
107
|
-
"fzinput:left-icon-click": () => any;
|
|
108
|
-
"fzinput:right-icon-click": () => any;
|
|
109
|
-
"fzinput:second-right-icon-click": () => any;
|
|
110
|
-
"update:highlighted": (value: boolean) => any;
|
|
111
|
-
"update:aiReasoning": (value: boolean) => any;
|
|
112
|
-
"fzinput:clear": () => any;
|
|
113
|
-
"update:modelValue": (value: string) => any;
|
|
114
|
-
}, string, {
|
|
115
|
-
variant: "normal" | "floating-label";
|
|
116
|
-
type: "text" | "password" | "email" | "number" | "tel" | "url";
|
|
117
|
-
environment: import('./types').InputEnvironment;
|
|
118
|
-
rightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
119
|
-
secondRightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
120
|
-
error: boolean;
|
|
121
|
-
highlighted: boolean;
|
|
122
|
-
highlightedDescription: string;
|
|
123
|
-
aiReasoning: boolean;
|
|
124
|
-
aiReasoningDescription: string;
|
|
125
|
-
disableEmphasisReset: boolean;
|
|
126
|
-
autocomplete: boolean;
|
|
127
|
-
clearable: boolean;
|
|
128
|
-
clearAriaLabel: string;
|
|
129
|
-
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
130
|
-
beforeCreate?: (() => void) | (() => void)[];
|
|
131
|
-
created?: (() => void) | (() => void)[];
|
|
132
|
-
beforeMount?: (() => void) | (() => void)[];
|
|
133
|
-
mounted?: (() => void) | (() => void)[];
|
|
134
|
-
beforeUpdate?: (() => void) | (() => void)[];
|
|
135
|
-
updated?: (() => void) | (() => void)[];
|
|
136
|
-
activated?: (() => void) | (() => void)[];
|
|
137
|
-
deactivated?: (() => void) | (() => void)[];
|
|
138
|
-
beforeDestroy?: (() => void) | (() => void)[];
|
|
139
|
-
beforeUnmount?: (() => void) | (() => void)[];
|
|
140
|
-
destroyed?: (() => void) | (() => void)[];
|
|
141
|
-
unmounted?: (() => void) | (() => void)[];
|
|
142
|
-
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
143
|
-
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
144
|
-
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
145
|
-
};
|
|
146
|
-
$forceUpdate: () => void;
|
|
147
|
-
$nextTick: typeof nextTick;
|
|
148
|
-
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
149
|
-
} & Readonly<{
|
|
150
|
-
variant: "normal" | "floating-label";
|
|
151
|
-
type: "text" | "password" | "email" | "number" | "tel" | "url";
|
|
152
|
-
environment: import('./types').InputEnvironment;
|
|
153
|
-
rightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
154
|
-
secondRightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
155
|
-
error: boolean;
|
|
156
|
-
highlighted: boolean;
|
|
157
|
-
highlightedDescription: string;
|
|
158
|
-
aiReasoning: boolean;
|
|
159
|
-
aiReasoningDescription: string;
|
|
160
|
-
disableEmphasisReset: boolean;
|
|
161
|
-
autocomplete: boolean;
|
|
162
|
-
clearable: boolean;
|
|
163
|
-
clearAriaLabel: string;
|
|
164
|
-
}> & Omit<Readonly<{
|
|
165
|
-
modelValue?: string;
|
|
166
|
-
} & import('./types').FzInputProps> & Readonly<{
|
|
167
|
-
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
168
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
169
|
-
"onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
170
|
-
"onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
171
|
-
"onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
172
|
-
"onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
173
|
-
"onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
174
|
-
"onFzinput:clear"?: (() => any) | undefined;
|
|
175
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
176
|
-
}>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete" | "clearable" | "clearAriaLabel")> & import('vue').ShallowUnwrapRef<{
|
|
15
|
+
fzInputRef: import('vue').ShallowUnwrapRef<{
|
|
177
16
|
inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
178
17
|
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
179
|
-
}>
|
|
180
|
-
$slots: Readonly<{
|
|
181
|
-
label?: () => unknown;
|
|
182
|
-
"left-icon"?: () => unknown;
|
|
183
|
-
"right-icon"?: () => unknown;
|
|
184
|
-
errorMessage?: () => unknown;
|
|
185
|
-
helpText?: () => unknown;
|
|
186
|
-
}> & {
|
|
187
|
-
label?: () => unknown;
|
|
188
|
-
"left-icon"?: () => unknown;
|
|
189
|
-
"right-icon"?: () => unknown;
|
|
190
|
-
errorMessage?: () => unknown;
|
|
191
|
-
helpText?: () => unknown;
|
|
192
|
-
};
|
|
193
|
-
}) | null;
|
|
18
|
+
}> | null;
|
|
194
19
|
};
|
|
195
20
|
rootEl: any;
|
|
196
21
|
};
|
|
@@ -204,191 +29,11 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
204
29
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
205
30
|
"onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
|
|
206
31
|
"onFzcurrencyinput:clear"?: (() => any) | undefined;
|
|
207
|
-
}>, {
|
|
208
|
-
|
|
209
|
-
maximumFractionDigits: number;
|
|
210
|
-
min: number;
|
|
211
|
-
max: number;
|
|
212
|
-
step: number;
|
|
213
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
214
|
-
fzInputRef: ({
|
|
215
|
-
$: import('vue').ComponentInternalInstance;
|
|
216
|
-
$data: {};
|
|
217
|
-
$props: {
|
|
218
|
-
readonly modelValue?: string | undefined;
|
|
219
|
-
readonly id?: string | undefined;
|
|
220
|
-
readonly label?: string | undefined;
|
|
221
|
-
readonly environment?: import('./types').InputEnvironment | undefined;
|
|
222
|
-
readonly size?: "sm" | "md" | "lg" | undefined;
|
|
223
|
-
readonly placeholder?: string | undefined;
|
|
224
|
-
readonly required?: boolean | undefined;
|
|
225
|
-
readonly disabled?: boolean | undefined;
|
|
226
|
-
readonly error?: boolean | undefined;
|
|
227
|
-
readonly leftIcon?: string | undefined;
|
|
228
|
-
readonly leftIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
229
|
-
readonly leftIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
230
|
-
readonly leftIconAriaLabel?: string | undefined;
|
|
231
|
-
readonly rightIcon?: string | undefined;
|
|
232
|
-
readonly rightIconClass?: string | undefined;
|
|
233
|
-
readonly rightIconSize?: import('@fiscozen/icons').IconSize | undefined;
|
|
234
|
-
readonly rightIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
235
|
-
readonly rightIconButton?: boolean | undefined;
|
|
236
|
-
readonly rightIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
237
|
-
readonly rightIconAriaLabel?: string | undefined;
|
|
238
|
-
readonly secondRightIcon?: string | undefined;
|
|
239
|
-
readonly secondRightIconClass?: string | undefined;
|
|
240
|
-
readonly secondRightIconVariant?: import('@fiscozen/icons').IconVariant | undefined;
|
|
241
|
-
readonly secondRightIconButton?: boolean | undefined;
|
|
242
|
-
readonly secondRightIconButtonVariant?: import('@fiscozen/button').IconButtonVariant | undefined;
|
|
243
|
-
readonly secondRightIconAriaLabel?: string | undefined;
|
|
244
|
-
readonly type?: "text" | "password" | "email" | "number" | "tel" | "url" | undefined;
|
|
245
|
-
readonly valid?: boolean | undefined;
|
|
246
|
-
readonly variant?: "normal" | "floating-label" | undefined;
|
|
247
|
-
readonly pattern?: string | undefined;
|
|
248
|
-
readonly name?: string | undefined;
|
|
249
|
-
readonly readonly?: boolean | undefined;
|
|
250
|
-
readonly highlighted?: boolean | undefined;
|
|
251
|
-
readonly highlightedDescription?: string | undefined;
|
|
252
|
-
readonly aiReasoning?: boolean | undefined;
|
|
253
|
-
readonly aiReasoningDescription?: string | undefined;
|
|
254
|
-
readonly disableEmphasisReset?: boolean | undefined;
|
|
255
|
-
readonly maxlength?: number | undefined;
|
|
256
|
-
readonly autocomplete?: boolean | undefined;
|
|
257
|
-
readonly clearable?: boolean | undefined;
|
|
258
|
-
readonly clearAriaLabel?: string | undefined;
|
|
259
|
-
readonly leftIconClass?: string | undefined;
|
|
260
|
-
readonly onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
261
|
-
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
262
|
-
readonly "onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
263
|
-
readonly "onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
264
|
-
readonly "onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
265
|
-
readonly "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
266
|
-
readonly "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
267
|
-
readonly "onFzinput:clear"?: (() => any) | undefined;
|
|
268
|
-
readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
269
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
270
|
-
$attrs: {
|
|
271
|
-
[x: string]: unknown;
|
|
272
|
-
};
|
|
273
|
-
$refs: {
|
|
274
|
-
[x: string]: unknown;
|
|
275
|
-
} & {
|
|
276
|
-
containerRef: HTMLDivElement;
|
|
277
|
-
inputRef: HTMLInputElement;
|
|
278
|
-
};
|
|
279
|
-
$slots: Readonly<{
|
|
280
|
-
[name: string]: import('vue').Slot<any> | undefined;
|
|
281
|
-
}>;
|
|
282
|
-
$root: import('vue').ComponentPublicInstance | null;
|
|
283
|
-
$parent: import('vue').ComponentPublicInstance | null;
|
|
284
|
-
$host: Element | null;
|
|
285
|
-
$emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "fzinput:clear") => void) & ((event: "update:modelValue", value: string) => void);
|
|
286
|
-
$el: any;
|
|
287
|
-
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
288
|
-
modelValue?: string;
|
|
289
|
-
} & import('./types').FzInputProps> & Readonly<{
|
|
290
|
-
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
291
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
292
|
-
"onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
293
|
-
"onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
294
|
-
"onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
295
|
-
"onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
296
|
-
"onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
297
|
-
"onFzinput:clear"?: (() => any) | undefined;
|
|
298
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
299
|
-
}>, {
|
|
300
|
-
inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
301
|
-
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
302
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
303
|
-
focus: (event: FocusEvent) => any;
|
|
304
|
-
blur: (event: FocusEvent) => any;
|
|
305
|
-
"fzinput:left-icon-click": () => any;
|
|
306
|
-
"fzinput:right-icon-click": () => any;
|
|
307
|
-
"fzinput:second-right-icon-click": () => any;
|
|
308
|
-
"update:highlighted": (value: boolean) => any;
|
|
309
|
-
"update:aiReasoning": (value: boolean) => any;
|
|
310
|
-
"fzinput:clear": () => any;
|
|
311
|
-
"update:modelValue": (value: string) => any;
|
|
312
|
-
}, string, {
|
|
313
|
-
variant: "normal" | "floating-label";
|
|
314
|
-
type: "text" | "password" | "email" | "number" | "tel" | "url";
|
|
315
|
-
environment: import('./types').InputEnvironment;
|
|
316
|
-
rightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
317
|
-
secondRightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
318
|
-
error: boolean;
|
|
319
|
-
highlighted: boolean;
|
|
320
|
-
highlightedDescription: string;
|
|
321
|
-
aiReasoning: boolean;
|
|
322
|
-
aiReasoningDescription: string;
|
|
323
|
-
disableEmphasisReset: boolean;
|
|
324
|
-
autocomplete: boolean;
|
|
325
|
-
clearable: boolean;
|
|
326
|
-
clearAriaLabel: string;
|
|
327
|
-
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
328
|
-
beforeCreate?: (() => void) | (() => void)[];
|
|
329
|
-
created?: (() => void) | (() => void)[];
|
|
330
|
-
beforeMount?: (() => void) | (() => void)[];
|
|
331
|
-
mounted?: (() => void) | (() => void)[];
|
|
332
|
-
beforeUpdate?: (() => void) | (() => void)[];
|
|
333
|
-
updated?: (() => void) | (() => void)[];
|
|
334
|
-
activated?: (() => void) | (() => void)[];
|
|
335
|
-
deactivated?: (() => void) | (() => void)[];
|
|
336
|
-
beforeDestroy?: (() => void) | (() => void)[];
|
|
337
|
-
beforeUnmount?: (() => void) | (() => void)[];
|
|
338
|
-
destroyed?: (() => void) | (() => void)[];
|
|
339
|
-
unmounted?: (() => void) | (() => void)[];
|
|
340
|
-
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
341
|
-
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
342
|
-
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
343
|
-
};
|
|
344
|
-
$forceUpdate: () => void;
|
|
345
|
-
$nextTick: typeof nextTick;
|
|
346
|
-
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
347
|
-
} & Readonly<{
|
|
348
|
-
variant: "normal" | "floating-label";
|
|
349
|
-
type: "text" | "password" | "email" | "number" | "tel" | "url";
|
|
350
|
-
environment: import('./types').InputEnvironment;
|
|
351
|
-
rightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
352
|
-
secondRightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
353
|
-
error: boolean;
|
|
354
|
-
highlighted: boolean;
|
|
355
|
-
highlightedDescription: string;
|
|
356
|
-
aiReasoning: boolean;
|
|
357
|
-
aiReasoningDescription: string;
|
|
358
|
-
disableEmphasisReset: boolean;
|
|
359
|
-
autocomplete: boolean;
|
|
360
|
-
clearable: boolean;
|
|
361
|
-
clearAriaLabel: string;
|
|
362
|
-
}> & Omit<Readonly<{
|
|
363
|
-
modelValue?: string;
|
|
364
|
-
} & import('./types').FzInputProps> & Readonly<{
|
|
365
|
-
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
366
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
367
|
-
"onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
368
|
-
"onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
369
|
-
"onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
370
|
-
"onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
371
|
-
"onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
372
|
-
"onFzinput:clear"?: (() => any) | undefined;
|
|
373
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
374
|
-
}>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete" | "clearable" | "clearAriaLabel")> & import('vue').ShallowUnwrapRef<{
|
|
32
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
33
|
+
fzInputRef: import('vue').ShallowUnwrapRef<{
|
|
375
34
|
inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
376
35
|
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
377
|
-
}>
|
|
378
|
-
$slots: Readonly<{
|
|
379
|
-
label?: () => unknown;
|
|
380
|
-
"left-icon"?: () => unknown;
|
|
381
|
-
"right-icon"?: () => unknown;
|
|
382
|
-
errorMessage?: () => unknown;
|
|
383
|
-
helpText?: () => unknown;
|
|
384
|
-
}> & {
|
|
385
|
-
label?: () => unknown;
|
|
386
|
-
"left-icon"?: () => unknown;
|
|
387
|
-
"right-icon"?: () => unknown;
|
|
388
|
-
errorMessage?: () => unknown;
|
|
389
|
-
helpText?: () => unknown;
|
|
390
|
-
};
|
|
391
|
-
}) | null;
|
|
36
|
+
}> | null;
|
|
392
37
|
}, any>;
|
|
393
38
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
394
39
|
export default _default;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { FzInputProps,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { FzInputProps, FzInputModelValue, FzInputType } from './types';
|
|
3
|
+
declare const _default: <TType extends FzInputType = "text">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
6
|
+
readonly onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
7
|
+
readonly "onUpdate:modelValue"?: ((value: FzInputModelValue<TType>) => any) | undefined;
|
|
8
|
+
readonly "onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
9
|
+
readonly "onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
10
|
+
readonly "onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
11
|
+
readonly "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
12
|
+
readonly "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
13
|
+
readonly "onFzinput:clear"?: (() => any) | undefined;
|
|
14
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onUpdate:modelValue" | "onFzinput:left-icon-click" | "onFzinput:right-icon-click" | "onFzinput:second-right-icon-click" | "onUpdate:highlighted" | "onUpdate:aiReasoning" | "onFzinput:clear"> & ({
|
|
15
|
+
modelValue?: FzInputModelValue<TType>;
|
|
16
|
+
} & FzInputProps<TType>) & Partial<{}>> & import('vue').PublicProps;
|
|
17
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
18
|
+
inputRef: Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
19
|
+
containerRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
20
|
+
}>): void;
|
|
21
|
+
attrs: any;
|
|
9
22
|
slots: Readonly<{
|
|
10
23
|
label?: () => unknown;
|
|
11
24
|
"left-icon"?: () => unknown;
|
|
@@ -19,59 +32,11 @@ declare function __VLS_template(): {
|
|
|
19
32
|
errorMessage?: () => unknown;
|
|
20
33
|
helpText?: () => unknown;
|
|
21
34
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
rootEl: any;
|
|
35
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "fzinput:left-icon-click") => void) & ((evt: "fzinput:right-icon-click") => void) & ((evt: "fzinput:second-right-icon-click") => void) & ((evt: "update:highlighted", value: boolean) => void) & ((evt: "update:aiReasoning", value: boolean) => void) & ((evt: "fzinput:clear") => void)) & ((evt: "update:modelValue", value: FzInputModelValue<TType>) => void);
|
|
36
|
+
}>) => import('vue').VNode & {
|
|
37
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
27
38
|
};
|
|
28
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
|
-
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
30
|
-
inputRef: Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
31
|
-
containerRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
32
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
33
|
-
focus: (event: FocusEvent) => any;
|
|
34
|
-
blur: (event: FocusEvent) => any;
|
|
35
|
-
"fzinput:left-icon-click": () => any;
|
|
36
|
-
"fzinput:right-icon-click": () => any;
|
|
37
|
-
"fzinput:second-right-icon-click": () => any;
|
|
38
|
-
"update:highlighted": (value: boolean) => any;
|
|
39
|
-
"update:aiReasoning": (value: boolean) => any;
|
|
40
|
-
"fzinput:clear": () => any;
|
|
41
|
-
"update:modelValue": (value: string) => any;
|
|
42
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
43
|
-
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
44
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
45
|
-
"onFzinput:left-icon-click"?: (() => any) | undefined;
|
|
46
|
-
"onFzinput:right-icon-click"?: (() => any) | undefined;
|
|
47
|
-
"onFzinput:second-right-icon-click"?: (() => any) | undefined;
|
|
48
|
-
"onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
|
|
49
|
-
"onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
|
|
50
|
-
"onFzinput:clear"?: (() => any) | undefined;
|
|
51
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
52
|
-
}>, {
|
|
53
|
-
variant: "normal" | "floating-label";
|
|
54
|
-
type: "text" | "password" | "email" | "number" | "tel" | "url";
|
|
55
|
-
environment: InputEnvironment;
|
|
56
|
-
rightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
57
|
-
secondRightIconButtonVariant: import('@fiscozen/button').IconButtonVariant;
|
|
58
|
-
error: boolean;
|
|
59
|
-
highlighted: boolean;
|
|
60
|
-
highlightedDescription: string;
|
|
61
|
-
aiReasoning: boolean;
|
|
62
|
-
aiReasoningDescription: string;
|
|
63
|
-
disableEmphasisReset: boolean;
|
|
64
|
-
autocomplete: boolean;
|
|
65
|
-
clearable: boolean;
|
|
66
|
-
clearAriaLabel: string;
|
|
67
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
68
|
-
containerRef: HTMLDivElement;
|
|
69
|
-
inputRef: HTMLInputElement;
|
|
70
|
-
}, any>;
|
|
71
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
72
39
|
export default _default;
|
|
73
|
-
type
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
};
|
|
40
|
+
type __VLS_PrettifyLocal<T> = {
|
|
41
|
+
[K in keyof T]: T[K];
|
|
42
|
+
} & {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { default as FzInput } from './FzInput.vue';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `<FzInput type="currency">` instead. This wrapper is kept
|
|
4
|
+
* for backwards compatibility until the migration of all consumers is complete.
|
|
5
|
+
*/
|
|
2
6
|
export { default as FzCurrencyInput } from './FzCurrencyInput.vue';
|
|
3
7
|
export type * from './types';
|
|
4
8
|
export { sizeToEnvironmentMapping } from './utils';
|