@feathery/react 2.10.0 → 2.10.2
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/elements/fields/PinInputField/index.d.ts.map +1 -1
- package/dist/{fthry_FormControl.BwSdgi3f.js → fthry_FormControl.C2sjhEzb.js} +1 -1
- package/dist/{fthry_InlineTooltip.BWLVOgEs.js → fthry_InlineTooltip.D3ql8FWM.js} +2 -2
- package/dist/{fthry_Overlay.CZqJb3I8.js → fthry_Overlay.DbZkArak.js} +1 -1
- package/dist/{fthry_PaymentMethodField.BO9Jr1U3.js → fthry_PaymentMethodField.BhLtxbEG.js} +4 -4
- package/dist/{fthry_Placeholder.m9Eifo85.js → fthry_Placeholder.D--QJBfo.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.BQAYW-W8.js → fthry_ShowEyeIcon.vbB0k1vK.js} +1 -1
- package/dist/{fthry_index.2uwCDpVl.js → fthry_index.Bomh9E7U.js} +5 -5
- package/dist/{fthry_index.bTFBX6dC.js → fthry_index.BpR5pWDe.js} +2 -1
- package/dist/{fthry_index.DRsjXsud.js → fthry_index.CD3L6j5k.js} +25 -25
- package/dist/{fthry_index.fxhhGagR.js → fthry_index.CXusjhnW.js} +6 -6
- package/dist/{fthry_index.DN428cTv.js → fthry_index.Ck-jcoGh.js} +6 -6
- package/dist/{fthry_index.BUxTuCfH.js → fthry_index.DIaqeAZB.js} +5 -5
- package/dist/{fthry_index.CDCRkwc_.js → fthry_index.DKHyEocy.js} +3 -3
- package/dist/{fthry_index.DaWNZyDe.js → fthry_index.DRGn3xJq.js} +1 -1
- package/dist/{fthry_index.5qG4ulsU.js → fthry_index.DU-a7EER.js} +4 -4
- package/dist/{fthry_index.C1G1KJIA.js → fthry_index.Dld9PhZQ.js} +6 -6
- package/dist/{fthry_index.AqI_C_pX.js → fthry_index.DpuBuOuM.js} +4 -4
- package/dist/{fthry_index.CwGsVCEf.js → fthry_index.DqmuNuhO.js} +5 -5
- package/dist/{fthry_index.K3XIlNY_.js → fthry_index.NOBBVLWn.js} +5 -5
- package/dist/{fthry_index.CC67duTy.js → fthry_index.Oze7LJyi.js} +1 -1
- package/dist/{fthry_index.DY1H0FZX.js → fthry_index.Vmi8oQXX.js} +1 -1
- package/dist/{fthry_index.BCmdfNek.js → fthry_index.bxDkC7nK.js} +4 -4
- package/dist/{fthry_index.ChDUaU-K.js → fthry_index.d5OMu2Uy.js} +2 -2
- package/dist/{fthry_index.CvyIgiAl.js → fthry_index.hPkfTJfS.js} +3 -3
- package/dist/{fthry_index.vwP3t4_P.js → fthry_index.iO7MztGj.js} +8 -8
- package/dist/{fthry_index.CVHvCy2E.js → fthry_index.pdtpNBTz.js} +2 -2
- package/dist/{fthry_index.DP38N-hs.js → fthry_index.pu1gi_cn.js} +1 -1
- package/dist/{fthry_index.D2WClrU8.js → fthry_index.stBpNqH_.js} +1 -1
- package/dist/{fthry_index.uGpnVqQg.js → fthry_index.ym3JocRL.js} +1 -1
- package/dist/{fthry_input.ChkCfmV5.js → fthry_input.UYq5Ho5B.js} +1 -1
- package/dist/{fthry_script.5EO6pWp3.js → fthry_script.BR3Dmyed.js} +1 -1
- package/dist/{fthry_styles.D7HaOzvB.js → fthry_styles.C7An_o6l.js} +1 -1
- package/dist/{fthry_useElementSize.deRvWMaV.js → fthry_useElementSize.epUu_1x2.js} +1 -1
- package/dist/{fthry_useSalesforceSync.tAT2z0nY.js → fthry_useSalesforceSync.DnsZdGYM.js} +1 -1
- package/dist/{fthry_webfontloader.D8SZTatz.js → fthry_webfontloader.C6c59KYI.js} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/umd/{PinInputField.6fdd9051bfd06f954be2.js → PinInputField.b1aee0ef9d3c9f9a1933.js} +1 -1
- package/umd/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[861],{6705:(e,t,n)=>{n.r(t),n.d(t,{default:()=>B});var o=n(5944),r=n(7294),i=n(426),a="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function c(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function l(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function u(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var s={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":a?173:189,"=":a?61:187,";":a?59:186,"'":222,"[":219,"]":221,"\\":220},f={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},d={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},p={16:!1,18:!1,17:!1,91:!1},v={},y=1;y<20;y++)s["f".concat(y)]=111+y;var h=[],g=!1,m="all",b=[],k=function(e){return s[e.toLowerCase()]||f[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function w(e){m=e||"all"}function O(){return m||"all"}var E=function(e){var t=e.key,n=e.scope,o=e.method,r=e.splitKey,i=void 0===r?"+":r;u(t).forEach((function(e){var t=e.split(i),r=t.length,a=t[r-1],c="*"===a?"*":k(a);if(v[c]){n||(n=O());var u=r>1?l(f,t):[];v[c]=v[c].filter((function(e){return!((!o||e.method===o)&&e.scope===n&&function(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i<n.length;i++)-1===o.indexOf(n[i])&&(r=!1);return r}(e.mods,u))}))}}))};function C(e,t,n,o){var r;if(t.element===o&&(t.scope===n||"all"===t.scope)){for(var i in r=t.mods.length>0,p)Object.prototype.hasOwnProperty.call(p,i)&&(!p[i]&&t.mods.indexOf(+i)>-1||p[i]&&-1===t.mods.indexOf(+i))&&(r=!1);(0!==t.mods.length||p[16]||p[18]||p[17]||p[91])&&!r&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function x(e,t){var n=v["*"],o=e.keyCode||e.which||e.charCode;if(K.filter.call(this,e)){if(93!==o&&224!==o||(o=91),-1===h.indexOf(o)&&229!==o&&h.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=d[t];e[t]&&-1===h.indexOf(n)?h.push(n):!e[t]&&h.indexOf(n)>-1?h.splice(h.indexOf(n),1):"metaKey"===t&&e[t]&&3===h.length&&(e.ctrlKey||e.shiftKey||e.altKey||(h=h.slice(h.indexOf(n))))})),o in p){for(var r in p[o]=!0,f)f[r]===o&&(K[r]=!0);if(!n)return}for(var i in p)Object.prototype.hasOwnProperty.call(p,i)&&(p[i]=e[d[i]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===h.indexOf(17)&&h.push(17),-1===h.indexOf(18)&&h.push(18),p[17]=!0,p[18]=!0);var a=O();if(n)for(var c=0;c<n.length;c++)n[c].scope===a&&("keydown"===e.type&&n[c].keydown||"keyup"===e.type&&n[c].keyup)&&C(e,n[c],a,t);if(o in v)for(var l=0;l<v[o].length;l++)if(("keydown"===e.type&&v[o][l].keydown||"keyup"===e.type&&v[o][l].keyup)&&v[o][l].key){for(var u=v[o][l],s=u.splitKey,y=u.key.split(s),g=[],m=0;m<y.length;m++)g.push(k(y[m]));g.sort().join("")===h.sort().join("")&&C(e,u,a,t)}}}function K(e,t,n){h=[];var o=u(e),r=[],i="all",a=document,s=0,d=!1,y=!0,m="+",w=!1;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(d=t.keyup),void 0!==t.keydown&&(y=t.keydown),void 0!==t.capture&&(w=t.capture),"string"==typeof t.splitKey&&(m=t.splitKey)),"string"==typeof t&&(i=t);s<o.length;s++)r=[],(e=o[s].split(m)).length>1&&(r=l(f,e)),(e="*"===(e=e[e.length-1])?"*":k(e))in v||(v[e]=[]),v[e].push({keyup:d,keydown:y,scope:i,mods:r,shortcut:o[s],method:n,key:o[s],splitKey:m,element:a});void 0!==a&&!function(e){return b.indexOf(e)>-1}(a)&&window&&(b.push(a),c(a,"keydown",(function(e){x(e,a)}),w),g||(g=!0,c(window,"focus",(function(){h=[]}),w)),c(a,"keyup",(function(e){x(e,a),function(e){var t=e.keyCode||e.which||e.charCode,n=h.indexOf(t);if(n>=0&&h.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&h.splice(0,h.length),93!==t&&224!==t||(t=91),t in p)for(var o in p[t]=!1,f)f[o]===t&&(K[o]=!1)}(e)}),w))}var S={setScope:w,getScope:O,deleteScope:function(e,t){var n,o;for(var r in e||(e=O()),v)if(Object.prototype.hasOwnProperty.call(v,r))for(n=v[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;O()===e&&w(t||"all")},getPressedKeyCodes:function(){return h.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=k(e)),-1!==h.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName,o=!0;return!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly)||(o=!1),o},trigger:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(v).forEach((function(n){var o=v[n].find((function(n){return n.scope===t&&n.shortcut===e}));o&&o.method&&o.method()}))},unbind:function(e){if(e){if(Array.isArray(e))e.forEach((function(e){e.key&&E(e)}));else if("object"==typeof e)e.key&&E(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=n[0],i=n[1];"function"==typeof r&&(i=r,r=""),E({key:e,scope:r,method:i,splitKey:"+"})}}else Object.keys(v).forEach((function(e){return delete v[e]}))},keyMap:s,modifier:f,modifierMap:d};for(var P in S)Object.prototype.hasOwnProperty.call(S,P)&&(K[P]=S[P]);if("undefined"!=typeof window){var T=window.hotkeys;K.noConflict=function(e){return e&&window.hotkeys===K&&(window.hotkeys=T),K},window.hotkeys=K}K.filter=function(){return!0};var _=function(e,t){var n=e.target,o=n&&n.tagName;return Boolean(o&&t&&t.includes(o))};K.isPressed;var A=n(6867),j=n(9479),I=function(){return I=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},I.apply(this,arguments)},D=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a};function N(e){var t=e.index,n=e.focus,i=e.value,a=e.onChange,c=e.onEnter,l=e.onInput,u=e.paste,s=e.onPaste,f=e.onFocus,d=e.onBlur,p=e.element,v=e.responsiveStyles,y=e.inlineError,h=e.changeCodeAtFocus,g=e.focusPrevInput,m=e.focusNextInput,b=e.isFocused,k=e.disabled,w=e.autoComplete,O=(0,r.useRef)(null);(0,r.useEffect)((function(){var e=O.current;e&&n&&(e.focus(),e.select(),u&&(e.selectionStart=e.selectionEnd))}),[n,O]);var E=(0,A.Z)({element:p,error:y,breakpoint:v.getMobileBreakpoint()}),C=E.borderStyles,x=E.customBorder;return function(e,t,n,o){n instanceof Array&&(o=n,n=void 0);var i=n||{},a=i.enableOnTags,c=i.filter,l=i.keyup,u=i.keydown,s=i.filterPreventDefault,f=void 0===s||s,d=i.enabled,p=void 0===d||d,v=i.enableOnContentEditable,y=void 0!==v&&v,h=(0,r.useRef)(null),g=(0,r.useCallback)((function(e,n){var o;return c&&!c(e)?!f:!!(_(e,["INPUT","TEXTAREA","SELECT"])&&!_(e,a)||null!=(o=e.target)&&o.isContentEditable&&!y)||(null===h.current||document.activeElement===h.current)&&(t(e,n),!0)}),o?[h,a,c].concat(o):[h,a,c]);(0,r.useEffect)((function(){if(p)return l&&!0!==u&&(n.keydown=!1),K(e,n||{},g),function(){return K.unbind(e,g)};K.unbind(e,g)}),[g,e,p])}("enter, backspace, delete, left, right, space",(function(e,t){if(b)switch(t.key){case"enter":e.preventDefault(),n&&c(e);break;case"backspace":e.preventDefault(),h(""),g();break;case"delete":e.preventDefault(),h("");break;case"left":e.preventDefault(),g();break;case"right":e.preventDefault(),m();break;case"space":e.preventDefault()}}),{enableOnTags:["INPUT"]}),(0,o.BX)("div",I({css:I(I(I({position:"relative",display:"flex",alignItems:"center",marginLeft:0===t?0:"8px"},v.getTarget("sub-fc")),k?v.getTarget("disabled"):{}),{"&:hover":(0,j.wL)(k?{}:I(I({},v.getTarget("hover")),C.hover)),"&&":n?I(I({},v.getTarget("active")),C.active):{}})},{children:[x,(0,o.tZ)("input",{id:"".concat(p.servar.key,"-").concat(t),name:p.servar.key,"aria-label":"".concat(0===t?"Please enter verification code. ":"","Digit ").concat(t+1),css:I({position:"relative",textAlign:"center",outline:"none",border:"none",background:"none",height:"100%",width:"100%"},v.getTarget("field")),autoComplete:"on"===w?"one-time-code":"new-password",inputMode:"numeric",disabled:k,ref:O,value:i||"",onChange:a,onInput:l,onPaste:s,onFocus:f,onBlur:d})]}))}var F=function(e){return e.toString().split("")};function L(e){var t=e.element,n=e.responsiveStyles,a=e.autoFocus,c=e.onChange,l=e.onEnter,u=e.value,s=e.disabled,f=e.autoComplete,d=e.inlineError,p=D((0,r.useState)(a?0:-1),2),v=p[0],y=p[1],h=D((0,r.useState)(!1),2),g=h[0],m=h[1],b=D((0,r.useState)(F(u)),2),k=b[0],w=b[1];(0,r.useEffect)((function(){u!==k&&w(F(u))}),[u]);var O,E,C=function(e){w(e),c(e.filter(Boolean).join(""))},x=t.servar.max_length,K=function(e){y(Math.max(Math.min(x-1,e),0))},S=function(){K(v+1)},P=function(){K(v-1)},T=function(e){var t=JSON.parse(JSON.stringify(k));t[v]=e[0],C(t)},_=function(e){if(!e.some((function(e){return isNaN(parseInt(e,10))}))){for(var t=JSON.parse(JSON.stringify(k)),n=v,o=0;o<x;++o)o>=v&&e.length>0&&(t[o]=e.shift(),n++);y(n),K(n),C(t)}};O=function(e){var t=e.slice(0,x-v).split("");_(t),v+t.length>=x&&m(!0)},E=(0,r.useRef)(O),(0,r.useEffect)((function(){E.current=O}),[O]),(0,r.useEffect)((function(){if("OTPCredential"in(0,j.Kv)()){var e=new AbortController;return navigator.credentials.get({otp:{transport:["sms"]},signal:e.signal}).then((function(e){E.current(e.code)})).catch((function(e){console.log(e)})),function(){e.abort()}}console.log("WebOTP API not supported")}),[]);var A=function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain").slice(0,x-v).split(""),n=t.length;_(t),v+n>=x&&m(!0)},L=function(e){var t=e.target.value;_(t.split(""))},B=function(e){(function(e){return(0,i.e9)(e,10)&&1===e.trim().length})(e.target.value)&&S()};return(0,o.tZ)("div",I({css:I({display:"flex",flexDirection:"row"},n.getTarget("fc"))},{children:function(){for(var e=[],r=function(r){var i=r===x-1;e.push((0,o.tZ)(N,{index:r,focus:v===r,value:k[r],onChange:L,onEnter:i?l:function(){},onInput:B,paste:g,onPaste:A,onFocus:function(e){y(r),m(!1),e.target.select()},onBlur:function(){return y(-1)},element:t,responsiveStyles:n,inlineError:d,changeCodeAtFocus:T,focusPrevInput:P,focusNextInput:S,isFocused:v>-1,disabled:s,autoComplete:f},"".concat(t.servar.key,"-").concat(r)))},i=0;i<x;i++)r(i);return e}()}))}const B=function(e){var t=e.element,n=e.responsiveStyles,r=e.fieldLabel,i=e.inlineError,a=e.autoFocus,c=void 0!==a&&a,l=e.fieldVal,u=void 0===l?"":l,s=e.editMode,f=e.onChange,d=void 0===f?function(){}:f,p=e.onEnter,v=void 0===p?function(){}:p,y=e.elementProps,h=void 0===y?{}:y,g=e.disabled,m=void 0!==g&&g,b=e.autoComplete,k=e.children;return(0,o.BX)("div",I({style:{display:"flex",position:"relative",pointerEvents:s?"none":"auto"}},h,{children:[k,r,(0,o.tZ)(L,{autoFocus:c,value:u,responsiveStyles:n,element:t,onChange:d,onEnter:v,inlineError:i,disabled:m,autoComplete:b})]}))}}}]);
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[861],{6705:(e,t,n)=>{n.r(t),n.d(t,{default:()=>B});var o=n(5944),r=n(7294),i=n(426),a="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function c(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function l(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function u(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var s={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":a?173:189,"=":a?61:187,";":a?59:186,"'":222,"[":219,"]":221,"\\":220},f={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},d={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},p={16:!1,18:!1,17:!1,91:!1},v={},y=1;y<20;y++)s["f".concat(y)]=111+y;var h=[],g=!1,m="all",b=[],k=function(e){return s[e.toLowerCase()]||f[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function w(e){m=e||"all"}function O(){return m||"all"}var E=function(e){var t=e.key,n=e.scope,o=e.method,r=e.splitKey,i=void 0===r?"+":r;u(t).forEach((function(e){var t=e.split(i),r=t.length,a=t[r-1],c="*"===a?"*":k(a);if(v[c]){n||(n=O());var u=r>1?l(f,t):[];v[c]=v[c].filter((function(e){return!((!o||e.method===o)&&e.scope===n&&function(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i<n.length;i++)-1===o.indexOf(n[i])&&(r=!1);return r}(e.mods,u))}))}}))};function C(e,t,n,o){var r;if(t.element===o&&(t.scope===n||"all"===t.scope)){for(var i in r=t.mods.length>0,p)Object.prototype.hasOwnProperty.call(p,i)&&(!p[i]&&t.mods.indexOf(+i)>-1||p[i]&&-1===t.mods.indexOf(+i))&&(r=!1);(0!==t.mods.length||p[16]||p[18]||p[17]||p[91])&&!r&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function x(e,t){var n=v["*"],o=e.keyCode||e.which||e.charCode;if(K.filter.call(this,e)){if(93!==o&&224!==o||(o=91),-1===h.indexOf(o)&&229!==o&&h.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=d[t];e[t]&&-1===h.indexOf(n)?h.push(n):!e[t]&&h.indexOf(n)>-1?h.splice(h.indexOf(n),1):"metaKey"===t&&e[t]&&3===h.length&&(e.ctrlKey||e.shiftKey||e.altKey||(h=h.slice(h.indexOf(n))))})),o in p){for(var r in p[o]=!0,f)f[r]===o&&(K[r]=!0);if(!n)return}for(var i in p)Object.prototype.hasOwnProperty.call(p,i)&&(p[i]=e[d[i]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===h.indexOf(17)&&h.push(17),-1===h.indexOf(18)&&h.push(18),p[17]=!0,p[18]=!0);var a=O();if(n)for(var c=0;c<n.length;c++)n[c].scope===a&&("keydown"===e.type&&n[c].keydown||"keyup"===e.type&&n[c].keyup)&&C(e,n[c],a,t);if(o in v)for(var l=0;l<v[o].length;l++)if(("keydown"===e.type&&v[o][l].keydown||"keyup"===e.type&&v[o][l].keyup)&&v[o][l].key){for(var u=v[o][l],s=u.splitKey,y=u.key.split(s),g=[],m=0;m<y.length;m++)g.push(k(y[m]));g.sort().join("")===h.sort().join("")&&C(e,u,a,t)}}}function K(e,t,n){h=[];var o=u(e),r=[],i="all",a=document,s=0,d=!1,y=!0,m="+",w=!1;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(d=t.keyup),void 0!==t.keydown&&(y=t.keydown),void 0!==t.capture&&(w=t.capture),"string"==typeof t.splitKey&&(m=t.splitKey)),"string"==typeof t&&(i=t);s<o.length;s++)r=[],(e=o[s].split(m)).length>1&&(r=l(f,e)),(e="*"===(e=e[e.length-1])?"*":k(e))in v||(v[e]=[]),v[e].push({keyup:d,keydown:y,scope:i,mods:r,shortcut:o[s],method:n,key:o[s],splitKey:m,element:a});void 0!==a&&!function(e){return b.indexOf(e)>-1}(a)&&window&&(b.push(a),c(a,"keydown",(function(e){x(e,a)}),w),g||(g=!0,c(window,"focus",(function(){h=[]}),w)),c(a,"keyup",(function(e){x(e,a),function(e){var t=e.keyCode||e.which||e.charCode,n=h.indexOf(t);if(n>=0&&h.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&h.splice(0,h.length),93!==t&&224!==t||(t=91),t in p)for(var o in p[t]=!1,f)f[o]===t&&(K[o]=!1)}(e)}),w))}var S={setScope:w,getScope:O,deleteScope:function(e,t){var n,o;for(var r in e||(e=O()),v)if(Object.prototype.hasOwnProperty.call(v,r))for(n=v[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;O()===e&&w(t||"all")},getPressedKeyCodes:function(){return h.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=k(e)),-1!==h.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName,o=!0;return!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly)||(o=!1),o},trigger:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(v).forEach((function(n){var o=v[n].find((function(n){return n.scope===t&&n.shortcut===e}));o&&o.method&&o.method()}))},unbind:function(e){if(e){if(Array.isArray(e))e.forEach((function(e){e.key&&E(e)}));else if("object"==typeof e)e.key&&E(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=n[0],i=n[1];"function"==typeof r&&(i=r,r=""),E({key:e,scope:r,method:i,splitKey:"+"})}}else Object.keys(v).forEach((function(e){return delete v[e]}))},keyMap:s,modifier:f,modifierMap:d};for(var P in S)Object.prototype.hasOwnProperty.call(S,P)&&(K[P]=S[P]);if("undefined"!=typeof window){var T=window.hotkeys;K.noConflict=function(e){return e&&window.hotkeys===K&&(window.hotkeys=T),K},window.hotkeys=K}K.filter=function(){return!0};var _=function(e,t){var n=e.target,o=n&&n.tagName;return Boolean(o&&t&&t.includes(o))};K.isPressed;var A=n(6867),j=n(9479),D=function(){return D=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},D.apply(this,arguments)},I=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a};function N(e){var t=e.index,n=e.focus,i=e.value,a=e.onChange,c=e.onEnter,l=e.onInput,u=e.paste,s=e.onPaste,f=e.onFocus,d=e.onBlur,p=e.element,v=e.responsiveStyles,y=e.inlineError,h=e.changeCodeAtFocus,g=e.focusPrevInput,m=e.focusNextInput,b=e.isFocused,k=e.disabled,w=e.autoComplete,O=(0,r.useRef)(null);(0,r.useEffect)((function(){var e=O.current;e&&n&&(e.focus(),e.select(),u&&(e.selectionStart=e.selectionEnd))}),[n,O]);var E=(0,A.Z)({element:p,error:y,breakpoint:v.getMobileBreakpoint()}),C=E.borderStyles,x=E.customBorder;return function(e,t,n,o){n instanceof Array&&(o=n,n=void 0);var i=n||{},a=i.enableOnTags,c=i.filter,l=i.keyup,u=i.keydown,s=i.filterPreventDefault,f=void 0===s||s,d=i.enabled,p=void 0===d||d,v=i.enableOnContentEditable,y=void 0!==v&&v,h=(0,r.useRef)(null),g=(0,r.useCallback)((function(e,n){var o;return c&&!c(e)?!f:!!(_(e,["INPUT","TEXTAREA","SELECT"])&&!_(e,a)||null!=(o=e.target)&&o.isContentEditable&&!y)||(null===h.current||document.activeElement===h.current)&&(t(e,n),!0)}),o?[h,a,c].concat(o):[h,a,c]);(0,r.useEffect)((function(){if(p)return l&&!0!==u&&(n.keydown=!1),K(e,n||{},g),function(){return K.unbind(e,g)};K.unbind(e,g)}),[g,e,p])}("enter, backspace, delete, left, right, space",(function(e,t){if(b)switch(t.key){case"enter":e.preventDefault(),n&&c(e);break;case"backspace":e.preventDefault(),h(""),g();break;case"delete":e.preventDefault(),h("");break;case"left":e.preventDefault(),g();break;case"right":e.preventDefault(),m();break;case"space":e.preventDefault()}}),{enableOnTags:["INPUT"]}),(0,o.BX)("div",D({css:D(D(D({position:"relative",display:"flex",alignItems:"center",marginLeft:0===t?0:"8px"},v.getTarget("sub-fc")),k?v.getTarget("disabled"):{}),{"&:hover":(0,j.wL)(k?{}:D(D({},v.getTarget("hover")),C.hover)),"&&":n?D(D({},v.getTarget("active")),C.active):{}})},{children:[x,(0,o.tZ)("input",{id:"".concat(p.servar.key,"-").concat(t),name:p.servar.key,"aria-label":"".concat(0===t?"Please enter verification code. ":"","Digit ").concat(t+1),css:D({position:"relative",textAlign:"center",outline:"none",border:"none",background:"none",height:"100%",width:"100%"},v.getTarget("field")),autoComplete:"on"===w?"one-time-code":"new-password",inputMode:"numeric",disabled:k,ref:O,value:i||"",onChange:a,onInput:l,onPaste:s,onFocus:f,onBlur:d})]}))}var F=function(e){return e.toString().split("")};function L(e){var t=e.element,n=e.responsiveStyles,a=e.autoFocus,c=e.onChange,l=e.onEnter,u=e.value,s=e.disabled,f=e.autoComplete,d=e.inlineError,p=I((0,r.useState)(a?0:-1),2),v=p[0],y=p[1],h=I((0,r.useState)(!1),2),g=h[0],m=h[1],b=I((0,r.useState)(F(u)),2),k=b[0],w=b[1];(0,r.useEffect)((function(){u!==k&&w(F(u))}),[u]);var O,E,C=function(e){w(e),c(e.filter(Boolean).join(""))},x=t.servar.max_length,K=function(e){y(Math.max(Math.min(x-1,e),0))},S=function(){K(v+1)},P=function(){K(v-1)},T=function(e){var t=JSON.parse(JSON.stringify(k));t[v]=e[0],C(t)},_=function(e){if(!e.some((function(e){return isNaN(parseInt(e,10))}))){for(var t=JSON.parse(JSON.stringify(k)),n=v,o=0;o<x;++o)o>=v&&e.length>0&&(t[o]=e.shift(),n++);y(n),K(n),C(t)}};O=function(e){var t=e.slice(0,x-v).split("");_(t),v+t.length>=x&&m(!0)},E=(0,r.useRef)(O),(0,r.useEffect)((function(){E.current=O}),[O]),(0,r.useEffect)((function(){if("OTPCredential"in(0,j.Kv)()){var e=new AbortController;return navigator.credentials.get({otp:{transport:["sms"]},signal:e.signal}).then((function(e){E.current(e.code)})).catch((function(e){console.log(e)})),function(){e.abort()}}console.log("WebOTP API not supported")}),[]);var A=function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain").slice(0,x-v).split(""),n=t.length;_(t),v+n>=x&&m(!0)},L=function(e){var t=e.target.value;_(t.split(""))},B=function(e){(function(e){return(0,i.e9)(e,10)&&1===e.trim().length})(e.target.value)&&S()};return(0,o.tZ)("div",D({css:D({display:"flex",flexDirection:"row"},n.getTarget("fc"))},{children:function(){for(var e=[],r=function(r){var i=r===x-1;e.push((0,o.tZ)(N,{index:r,focus:v===r,value:k[r],onChange:L,onEnter:i?l:function(){},onInput:B,paste:g,onPaste:A,onFocus:function(e){y(r),m(!1),e.target.select()},onBlur:function(){return y(-1)},element:t,responsiveStyles:n,inlineError:d,changeCodeAtFocus:T,focusPrevInput:P,focusNextInput:S,isFocused:v>-1,disabled:s,autoComplete:f},"".concat(t.servar.key,"-").concat(r)))},i=0;i<x;i++)r(i);return e}()}))}const B=function(e){var t=e.element,n=e.responsiveStyles,r=e.fieldLabel,i=e.inlineError,a=e.autoFocus,c=void 0!==a&&a,l=e.fieldVal,u=void 0===l?"":l,s=e.editMode,f=e.onChange,d=void 0===f?function(){}:f,p=e.onEnter,v=void 0===p?function(){}:p,y=e.elementProps,h=void 0===y?{}:y,g=e.disabled,m=void 0!==g&&g,b=e.autoComplete,k=e.children;return(0,o.BX)("div",D({style:{display:"flex",position:"relative",flexDirection:"column",pointerEvents:s?"none":"auto"}},h,{children:[k,r,(0,o.tZ)(L,{autoFocus:c,value:u,responsiveStyles:n,element:t,onChange:d,onEnter:v,inlineError:i,disabled:m,autoComplete:b})]}))}}}]);
|