@temboplus/frontend-react-core 0.1.3-beta.0 → 0.1.3-beta.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/InfoCircleOutlined-B7d2aRfV.js +7 -0
- package/dist/InfoCircleOutlined-B7d2aRfV.js.map +1 -0
- package/dist/InfoCircleOutlined-DYs90hdV.js +7 -0
- package/dist/InfoCircleOutlined-DYs90hdV.js.map +1 -0
- package/dist/ZoomOutOutlined-BL6A5RSq.js +2 -0
- package/dist/ZoomOutOutlined-BL6A5RSq.js.map +1 -0
- package/dist/ZoomOutOutlined-BY_CCwq7.js +2 -0
- package/dist/ZoomOutOutlined-BY_CCwq7.js.map +1 -0
- package/dist/alerts/index.cjs.js +2 -0
- package/dist/alerts/index.cjs.js.map +1 -0
- package/dist/alerts/index.d.ts +1 -0
- package/dist/alerts/index.js +2 -0
- package/dist/alerts/index.js.map +1 -0
- package/dist/dialogs/index.cjs.js +2 -0
- package/dist/dialogs/index.cjs.js.map +1 -0
- package/dist/dialogs/index.d.ts +1 -0
- package/dist/dialogs/index.js +2 -0
- package/dist/dialogs/index.js.map +1 -0
- package/dist/features/alerts/alert.d.ts +12 -0
- package/dist/features/alerts/alert.js +95 -0
- package/dist/features/alerts/index.d.ts +1 -0
- package/dist/features/alerts/index.js +1 -0
- package/dist/features/dialogs/index.d.ts +1 -0
- package/dist/features/dialogs/index.js +1 -0
- package/dist/features/dialogs/modal-provider.d.ts +3 -0
- package/dist/features/dialogs/modal-provider.js +6 -0
- package/dist/features/dialogs/tembo-confirm.d.ts +63 -0
- package/dist/features/dialogs/tembo-confirm.js +111 -0
- package/dist/features/input-validation/account-name-validator.d.ts +13 -0
- package/dist/features/input-validation/account-name-validator.js +28 -0
- package/dist/features/input-validation/account-number-validator.d.ts +13 -0
- package/dist/features/input-validation/account-number-validator.js +65 -0
- package/dist/{antd-validators.d.ts → features/input-validation/amount-validator.d.ts} +1 -62
- package/dist/features/input-validation/amount-validator.js +100 -0
- package/dist/features/input-validation/index.d.ts +5 -0
- package/dist/features/input-validation/index.js +5 -0
- package/dist/features/input-validation/phone-number-validator.d.ts +25 -0
- package/dist/features/input-validation/phone-number-validator.js +79 -0
- package/dist/features/input-validation/swift-code-validator.d.ts +13 -0
- package/dist/features/input-validation/swift-code-validator.js +38 -0
- package/dist/features/notifications/index.d.ts +3 -0
- package/dist/features/notifications/index.js +3 -0
- package/dist/features/notifications/tembo-notify.d.ts +124 -0
- package/dist/features/notifications/tembo-notify.js +149 -0
- package/dist/features/notifications/toast-config.d.ts +15 -0
- package/dist/features/notifications/toast-config.js +53 -0
- package/dist/features/notifications/toast-container.d.ts +9 -0
- package/dist/features/notifications/toast-container.js +18 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/notifications/index.cjs.js +2 -0
- package/dist/notifications/index.cjs.js.map +1 -0
- package/dist/notifications/index.d.ts +1 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/providers.d.ts +37 -0
- package/dist/providers.js +32 -0
- package/dist/tembo-notify-C-QGduBt.js +2 -0
- package/dist/tembo-notify-C-QGduBt.js.map +1 -0
- package/dist/tembo-notify-D-uOV3t0.js +2 -0
- package/dist/tembo-notify-D-uOV3t0.js.map +1 -0
- package/dist/theme/colors.d.ts +246 -0
- package/dist/theme/colors.js +138 -0
- package/dist/theme/constants.d.ts +143 -0
- package/dist/theme/constants.js +82 -0
- package/dist/theme/index.cjs.js +2 -0
- package/dist/theme/index.cjs.js.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme-provider.d.ts +87 -0
- package/dist/theme/theme-provider.js +398 -0
- package/dist/theme-provider-D_oV1J_K.js +11 -0
- package/dist/theme-provider-D_oV1J_K.js.map +1 -0
- package/dist/theme-provider-Dqvy24OD.js +11 -0
- package/dist/theme-provider-Dqvy24OD.js.map +1 -0
- package/dist/validation/index.cjs.js +2 -0
- package/dist/validation/index.cjs.js.map +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +31 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../theme-provider-Dqvy24OD.js"),r=require("antd");require("lodash");var o=require("../InfoCircleOutlined-B7d2aRfV.js");require("react");const{Text:t}=r.Typography;exports.TemboAlert=({type:n="info",message:s,description:i,icon:c,showIcon:x=!0,style:l})=>{const{colors:a,constants:d}=e.useTemboTheme(),u=(e=>{switch(e){case"success":return{background:a.success.bg,border:a.success.main,iconColor:a.success.main,textColor:a.success.text};case"warning":return{background:a.warning.bg,border:a.warning.main,iconColor:a.warning.main,textColor:a.warning.text};case"error":return{background:a.error.bg,border:a.error.main,iconColor:a.error.main,textColor:a.error.text};default:return{background:a.info.bg,border:a.info.main,iconColor:a.info.main,textColor:a.info.text}}})(n),g=c||(r=>{switch(r){case"success":return e.jsxRuntimeExports.jsx(o.RefIcon$2,{});case"warning":return e.jsxRuntimeExports.jsx(o.RefIcon,{});case"error":return e.jsxRuntimeExports.jsx(o.RefIcon$3,{});default:return e.jsxRuntimeExports.jsx(o.RefIcon$1,{})}})(n),p=x?22:0;return e.jsxRuntimeExports.jsx("div",{style:Object.assign({width:"100%",padding:"12px 16px",backgroundColor:u.background,borderRadius:d.radius.sm,borderLeft:`3px solid ${u.border}`},l),children:e.jsxRuntimeExports.jsxs(r.Space,{direction:"vertical",size:s?6:0,style:{width:"100%"},children:[s&&e.jsxRuntimeExports.jsxs(r.Flex,{gap:8,align:"center",children:[x&&e.jsxRuntimeExports.jsx("div",{style:{color:u.iconColor,fontSize:14,lineHeight:1},children:g}),"string"==typeof s?e.jsxRuntimeExports.jsx(t,{strong:!0,style:{fontSize:13,color:u.textColor,lineHeight:1.4},children:s}):s]}),i&&e.jsxRuntimeExports.jsxs(r.Flex,{gap:8,align:"flex-start",children:[!s&&x&&e.jsxRuntimeExports.jsx("div",{style:{color:u.iconColor,fontSize:14,lineHeight:1,marginTop:1},children:g}),"string"==typeof i?e.jsxRuntimeExports.jsx(t,{style:{fontSize:12,color:a.text.secondary,lineHeight:1.5,paddingLeft:s&&x?p:0},children:i}):e.jsxRuntimeExports.jsx("div",{style:{fontSize:12,color:a.text.secondary,lineHeight:1.5,paddingLeft:s&&x?p:0},children:i})]})]})})};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/features/alerts/alert.tsx"],"sourcesContent":[null],"names":["Text","Typography","type","message","title","description","icon","showIcon","style","colors","constants","useTemboTheme","alertColors","alertType","background","success","bg","border","main","iconColor","textColor","text","warning","error","info","getAlertColors","alertIcon","_jsx","CheckCircleOutlined","ExclamationCircleOutlined","CloseCircleOutlined","InfoCircleOutlined","getDefaultIcon","iconWidth","Object","assign","width","padding","backgroundColor","borderRadius","radius","sm","borderLeft","_jsxs","Space","direction","size","children","Flex","gap","align","color","fontSize","lineHeight","strong","marginTop","secondary","paddingLeft"],"mappings":"oKAUA,MAAMA,KAAEA,GAASC,EAAAA,8BAaoC,EACjDC,OAAO,OACPC,QAASC,EACTC,cACAC,OACAC,YAAW,EACXC,YAEA,MAAMC,OAAEA,EAAMC,UAAEA,GAAcC,kBAkDxBC,EAhDiB,CAACC,IACpB,OAAQA,GACJ,IAAK,UACD,MAAO,CACHC,WAAYL,EAAOM,QAAQC,GAC3BC,OAAQR,EAAOM,QAAQG,KACvBC,UAAWV,EAAOM,QAAQG,KAC1BE,UAAWX,EAAOM,QAAQM,MAElC,IAAK,UACD,MAAO,CACHP,WAAYL,EAAOa,QAAQN,GAC3BC,OAAQR,EAAOa,QAAQJ,KACvBC,UAAWV,EAAOa,QA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C,SAAU,GACVD,MAAOvC,EAAYQ,UACnBiC,WAAY,KACfN,SAEA3C,IAINA,KAiEEC,GACGsC,EAAAA,kBAAAA,KAACK,OAAI,CAACC,IAAK,EAAGC,MAAM,aAAYH,SAAA,EAC1B3C,GAASG,GACPoB,EAAAA,kBAAAA,IAAA,MAAA,CACInB,MAAO,CACH2C,MAAOvC,EAAYO,UACnBiC,SAAU,GACVC,WAAY,EACZE,UAAW,GACdR,SAEArB,IAxEE,iBAAhBrB,EAEHsB,EAAAA,kBAAAA,IAAC3B,EAAI,CACDQ,MAAO,CACH4C,SAAU,GACVD,MAAO1C,EAAOY,KAAKmC,UACnBH,WAAY,IACZI,YAAarD,GAASG,EAAW0B,EAAY,GAChDc,SAEA1C,IAOTsB,EAAAA,kBAAAA,IAAA,MAAA,CACInB,MAAO,CACH4C,SAAU,GACVD,MAAO1C,EAAOY,KAAKmC,UACnBH,WAAY,IACZI,YAAarD,GAASG,EAAW0B,EAAY,GAChDc,SAEA1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../features/alerts";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{u as r,j as e}from"../theme-provider-D_oV1J_K.js";import{Typography as o,Space as n,Flex as t}from"antd";import"lodash";import{a as i,c as s,R as c,b as a}from"../InfoCircleOutlined-DYs90hdV.js";import"react";const{Text:l}=o,d=({type:o="info",message:d,description:g,icon:x,showIcon:u=!0,style:f})=>{const{colors:h,constants:m}=r(),p=(r=>{switch(r){case"success":return{background:h.success.bg,border:h.success.main,iconColor:h.success.main,textColor:h.success.text};case"warning":return{background:h.warning.bg,border:h.warning.main,iconColor:h.warning.main,textColor:h.warning.text};case"error":return{background:h.error.bg,border:h.error.main,iconColor:h.error.main,textColor:h.error.text};default:return{background:h.info.bg,border:h.info.main,iconColor:h.info.main,textColor:h.info.text}}})(o),b=x||(r=>{switch(r){case"success":return e.jsx(a,{});case"warning":return e.jsx(c,{});case"error":return e.jsx(s,{});default:return e.jsx(i,{})}})(o),j=u?22:0;return e.jsx("div",{style:Object.assign({width:"100%",padding:"12px 16px",backgroundColor:p.background,borderRadius:m.radius.sm,borderLeft:`3px solid ${p.border}`},f),children:e.jsxs(n,{direction:"vertical",size:d?6:0,style:{width:"100%"},children:[d&&e.jsxs(t,{gap:8,align:"center",children:[u&&e.jsx("div",{style:{color:p.iconColor,fontSize:14,lineHeight:1},children:b}),"string"==typeof d?e.jsx(l,{strong:!0,style:{fontSize:13,color:p.textColor,lineHeight:1.4},children:d}):d]}),g&&e.jsxs(t,{gap:8,align:"flex-start",children:[!d&&u&&e.jsx("div",{style:{color:p.iconColor,fontSize:14,lineHeight:1,marginTop:1},children:b}),"string"==typeof g?e.jsx(l,{style:{fontSize:12,color:h.text.secondary,lineHeight:1.5,paddingLeft:d&&u?j:0},children:g}):e.jsx("div",{style:{fontSize:12,color:h.text.secondary,lineHeight:1.5,paddingLeft:d&&u?j:0},children:g})]})]})})};export{d as TemboAlert};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/features/alerts/alert.tsx"],"sourcesContent":[null],"names":["Text","Typography","TemboAlert","type","message","title","description","icon","showIcon","style","colors","constants","useTemboTheme","alertColors","alertType","background","success","bg","border","main","iconColor","textColor","text","warning","error","info","getAlertColors","alertIcon","_jsx","CheckCircleOutlined","ExclamationCircleOutlined","CloseCircleOutlined","InfoCircleOutlined","getDefaultIcon","iconWidth","Object","assign","width","padding","backgroundColor","borderRadius","radius","sm","borderLeft","_jsxs","Space","direction","size","children","Flex","gap","align","color","fontSize","lineHeight","strong","marginTop","secondary","paddingLeft"],"mappings":"wNAUA,MAAMA,KAAEA,GAASC,EAaJC,EAAwC,EACjDC,OAAO,OACPC,QAASC,EACTC,cACAC,OACAC,YAAW,EACXC,YAEA,MAAMC,OAAEA,EAAMC,UAAEA,GAAcC,IAkDxBC,EAhDiB,CAACC,IACpB,OAAQA,GACJ,IAA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vC,EAAYO,UACnBiC,SAAU,GACVC,WAAY,GACfN,SAEArB,IAvEJ,iBAAVtB,EAEHuB,EAAAA,IAAC5B,GACGuD,QAAM,EACN9C,MAAO,CACH4C,SAAU,GACVD,MAAOvC,EAAYQ,UACnBiC,WAAY,KACfN,SAEA3C,IAINA,KAiEEC,GACGsC,EAAAA,KAACK,EAAI,CAACC,IAAK,EAAGC,MAAM,aAAYH,SAAA,EAC1B3C,GAASG,GACPoB,EAAAA,IAAA,MAAA,CACInB,MAAO,CACH2C,MAAOvC,EAAYO,UACnBiC,SAAU,GACVC,WAAY,EACZE,UAAW,GACdR,SAEArB,IAxEE,iBAAhBrB,EAEHsB,EAAAA,IAAC5B,EAAI,CACDS,MAAO,CACH4C,SAAU,GACVD,MAAO1C,EAAOY,KAAKmC,UACnBH,WAAY,IACZI,YAAarD,GAASG,EAAW0B,EAAY,GAChDc,SAEA1C,IAOTsB,EAAAA,IAAA,MAAA,CACInB,MAAO,CACH4C,SAAU,GACVD,MAAO1C,EAAOY,KAAKmC,UACnBH,WAAY,IACZI,YAAarD,GAASG,EAAW0B,EAAY,GAChDc,SAEA1C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../theme-provider-Dqvy24OD.js"),s=require("antd"),t=require("@ebay/nice-modal-react");require("lodash");var n=require("../InfoCircleOutlined-B7d2aRfV.js"),o=require("../ZoomOutOutlined-BY_CCwq7.js");function r(e){return e&&e.__esModule?e:{default:e}}require("react");var i=r(t);const c=i.default.create(n=>{var o,r,i;const c=t.useModal();return e.jsxRuntimeExports.jsx(s.Modal,{open:c.visible,title:n.title,onOk:async()=>{n.onOk&&await n.onOk(),c.resolve(!0),c.remove()},onCancel:()=>{n.onCancel&&n.onCancel(),c.resolve(!1),c.remove()},okText:null!==(o=n.okText)&&void 0!==o?o:"OK",cancelText:null!==(r=n.cancelText)&&void 0!==r?r:"Cancel",okButtonProps:{danger:n.okDanger,type:null!==(i=n.okType)&&void 0!==i?i:"primary"},centered:!0,destroyOnClose:!0,children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[n.icon&&e.jsxRuntimeExports.jsx("div",{style:{fontSize:22,marginTop:2},children:n.icon}),e.jsxRuntimeExports.jsx("div",{style:{flex:1},children:n.content})]})})});const a=()=>{const{colors:s}=e.useTemboTheme();return e.jsxRuntimeExports.jsx(n.RefIcon,{style:{color:s.error.main}})},l=()=>{const{colors:s}=e.useTemboTheme();return e.jsxRuntimeExports.jsx(o.RefIcon,{style:{color:s.warning.main}})},u=()=>{const{colors:s}=e.useTemboTheme();return e.jsxRuntimeExports.jsx(n.RefIcon$1,{style:{color:s.info.main}})},x=()=>{const{colors:s}=e.useTemboTheme();return e.jsxRuntimeExports.jsx(n.RefIcon$2,{style:{color:s.success.main}})},m=()=>{const{colors:s}=e.useTemboTheme();return e.jsxRuntimeExports.jsx(o.RefIcon$1,{style:{color:s.primary.main}})};exports.ConfirmDialog=c,exports.TemboConfirm=class{static async danger(s){return i.default.show(c,Object.assign(Object.assign({},s),{icon:e.jsxRuntimeExports.jsx(a,{}),okDanger:!0,okType:"primary"}))}static async warning(s){return i.default.show(c,Object.assign(Object.assign({},s),{icon:e.jsxRuntimeExports.jsx(l,{})}))}static async info(s){return i.default.show(c,Object.assign(Object.assign({},s),{icon:e.jsxRuntimeExports.jsx(u,{})}))}static async success(s){return i.default.show(c,Object.assign(Object.assign({},s),{icon:e.jsxRuntimeExports.jsx(x,{})}))}static async confirm(s){return i.default.show(c,Object.assign(Object.assign({},s),{icon:e.jsxRuntimeExports.jsx(m,{})}))}};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/features/dialogs/tembo-confirm.tsx"],"sourcesContent":[null],"names":["ConfirmDialog","NiceModal","create","props","modal","useModal","_jsx","Modal","open","visible","title","onOk","async","resolve","remove","onCancel","okText","_a","cancelText","_b","okButtonProps","danger","okDanger","type","_c","okType","centered","destroyOnClose","children","_jsxs","style","display","gap","alignItems","icon","fontSize","marginTop","flex","content","DangerIcon","colors","useTemboTheme","ExclamationCircleOutlined","color","error","main","WarningIcon","WarningOutlined","warning","InfoIcon","InfoCircleOutlined","info","SuccessIcon","CheckCircleOutlined","success","QuestionIcon","QuestionCircleOutlined","primary","show","Object","assign","confirm"],"mappings":"kTA0BO,MAAMA,EAAgBC,EAAAA,QAAUC,OAA4BC,cAC/D,MAAMC,EAAQC,EAAAA,WAkBd,OACIC,EAAAA,kBAAAA,IAACC,EAAAA,OACGC,KAAMJ,EAAMK,QACZC,MAAOP,EAAMO,MACbC,KApBSC,UACTT,EAAMQ,YACAR,EAAMQ,OAEhBP,EAAMS,SAAQ,GACdT,EAAMU,UAgBFC,SAba,KACbZ,EAAMY,UACNZ,EAAMY,WAEVX,EAAMS,SAAQ,GACdT,EAAMU,UASFE,eAAQC,EAAAd,EAAMa,sBAAU,KACxBE,mBAAYC,EAAAhB,EAAMe,0BAAc,SAChCE,cAAe,CACXC,OAAQlB,EAAMmB,SACdC,aAAMC,EAAArB,EAAMsB,sBAAU,WAE1BC,UAAQ,EACRC,gBAAc,EAAAC,SAEdC,EAAAA,kBAAAA,KAAA,MAAA,CAAKC,MAAO,CAAEC,QAAS,OAAQC,IAAK,GAAIC,WAAY,cAAcL,SAAA,CAC7DzB,EAAM+B,MACH5B,EAAAA,kBAAAA,IAAA,MAAA,CAAKwB,MAAO,CAAEK,SAAU,GAAIC,UAAW,GAAGR,SACrCzB,EAAM+B,OAGf5B,EAAAA,kBAAAA,IAAA,MAAA,CAAKwB,MAAO,CAAEO,KAAM,GAAGT,SAClBzB,EAAMmC,iBA0F3B,MAAMC,EAAuB,KACzB,MAAMC,OAAEA,GAAWC,kBACnB,OAAOnC,EAAAA,kBAAAA,IAACoC,UAAyB,CAACZ,MAAO,CAAEa,MAAOH,EAAOI,MAAMC,SAG7DC,EAAwB,KAC1B,MAAMN,OAAE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D,GACjB,OAAOF,EAAAA,QAAUyD,KAAK1D,EAAa2D,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAC5BzD,GAAK,CACR+B,KAAM5B,EAAAA,kBAAAA,IAACiD,EAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../features/dialogs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as s,u as n}from"../theme-provider-D_oV1J_K.js";import{Modal as o}from"antd";import e,{useModal as t}from"@ebay/nice-modal-react";import"lodash";import{R as r,a as c,b as a}from"../InfoCircleOutlined-DYs90hdV.js";import{R as i,a as l}from"../ZoomOutOutlined-BL6A5RSq.js";import"react";const j=e.create(n=>{var e,r,c;const a=t();return s.jsx(o,{open:a.visible,title:n.title,onOk:async()=>{n.onOk&&await n.onOk(),a.resolve(!0),a.remove()},onCancel:()=>{n.onCancel&&n.onCancel(),a.resolve(!1),a.remove()},okText:null!==(e=n.okText)&&void 0!==e?e:"OK",cancelText:null!==(r=n.cancelText)&&void 0!==r?r:"Cancel",okButtonProps:{danger:n.okDanger,type:null!==(c=n.okType)&&void 0!==c?c:"primary"},centered:!0,destroyOnClose:!0,children:s.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[n.icon&&s.jsx("div",{style:{fontSize:22,marginTop:2},children:n.icon}),s.jsx("div",{style:{flex:1},children:n.content})]})})});class m{static async danger(n){return e.show(j,Object.assign(Object.assign({},n),{icon:s.jsx(y,{}),okDanger:!0,okType:"primary"}))}static async warning(n){return e.show(j,Object.assign(Object.assign({},n),{icon:s.jsx(x,{})}))}static async info(n){return e.show(j,Object.assign(Object.assign({},n),{icon:s.jsx(d,{})}))}static async success(n){return e.show(j,Object.assign(Object.assign({},n),{icon:s.jsx(u,{})}))}static async confirm(n){return e.show(j,Object.assign(Object.assign({},n),{icon:s.jsx(p,{})}))}}const y=()=>{const{colors:o}=n();return s.jsx(r,{style:{color:o.error.main}})},x=()=>{const{colors:o}=n();return s.jsx(i,{style:{color:o.warning.main}})},d=()=>{const{colors:o}=n();return s.jsx(c,{style:{color:o.info.main}})},u=()=>{const{colors:o}=n();return s.jsx(a,{style:{color:o.success.main}})},p=()=>{const{colors:o}=n();return s.jsx(l,{style:{color:o.primary.main}})};export{j as ConfirmDialog,m as TemboConfirm};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/features/dialogs/tembo-confirm.tsx"],"sourcesContent":[null],"names":["ConfirmDialog","NiceModal","create","props","modal","useModal","_jsx","Modal","open","visible","title","onOk","async","resolve","remove","onCancel","okText","_a","cancelText","_b","okButtonProps","danger","okDanger","type","_c","okType","centered","destroyOnClose","children","_jsxs","style","display","gap","alignItems","icon","fontSize","marginTop","flex","content","TemboConfirm","show","Object","assign","DangerIcon","warning","WarningIcon","info","InfoIcon","success","SuccessIcon","confirm","QuestionIcon","colors","useTemboTheme","ExclamationCircleOutlined","color","error","main","WarningOutlined","InfoCircleOutlined","CheckCircleOutlined","QuestionCircleOutlined","primary"],"mappings":"sSA0BO,MAAMA,EAAgBC,EAAUC,OAA4BC,cAC/D,MAAMC,EAAQC,IAkBd,OACIC,EAAAA,IAACC,GACGC,KAAMJ,EAAMK,QACZC,MAAOP,EAAMO,MACbC,KApBSC,UACTT,EAAMQ,YACAR,EAAMQ,OAEhBP,EAAMS,SAAQ,GACdT,EAAMU,UAgBFC,SAba,KACbZ,EAAMY,UACNZ,EAAMY,WAEVX,EAAMS,SAAQ,GACdT,EAAMU,UASFE,eAAQC,EAAAd,EAAMa,sBAAU,KACxBE,mBAAYC,EAAAhB,EAAMe,0BAAc,SAChCE,cAAe,CACXC,OAAQlB,EAAMmB,SACdC,aAAMC,EAAArB,EAAMsB,sBAAU,WAE1BC,UAAQ,EACRC,gBAAc,EAAAC,SAEdC,EAAAA,KAAA,MAAA,CAAKC,MAAO,CAAEC,QAAS,OAAQC,IAAK,GAAIC,WAAY,cAAcL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OH,EAAOR,QAAQa,SAGrDV,EAAqB,KACvB,MAAMK,OAAEA,GAAWC,IACnB,OAAO/C,EAAAA,IAACqD,EAAkB,CAAC7B,MAAO,CAAEyB,MAAOH,EAAON,KAAKW,SAGrDR,EAAwB,KAC1B,MAAMG,OAAEA,GAAWC,IACnB,OAAO/C,EAAAA,IAACsD,EAAmB,CAAC9B,MAAO,CAAEyB,MAAOH,EAAOJ,QAAQS,SAGzDN,EAAyB,KAC3B,MAAMC,OAAEA,GAAWC,IACnB,OAAO/C,EAAAA,IAACuD,EAAsB,CAAC/B,MAAO,CAAEyB,MAAOH,EAAOU,QAAQL"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TemboAlertType = 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
interface TemboAlertProps {
|
|
4
|
+
type?: TemboAlertType;
|
|
5
|
+
message: string | React.ReactNode;
|
|
6
|
+
description?: string | React.ReactNode;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
showIcon?: boolean;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export declare const TemboAlert: React.FC<TemboAlertProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Space, Flex, Typography } from 'antd';
|
|
3
|
+
import { InfoCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
|
|
4
|
+
import { useTemboTheme } from '../../theme/index.js';
|
|
5
|
+
const { Text } = Typography;
|
|
6
|
+
export const TemboAlert = ({ type = 'info', message: title, description, icon, showIcon = true, style, }) => {
|
|
7
|
+
const { colors, constants } = useTemboTheme();
|
|
8
|
+
const getAlertColors = (alertType) => {
|
|
9
|
+
switch (alertType) {
|
|
10
|
+
case 'success':
|
|
11
|
+
return {
|
|
12
|
+
background: colors.success.bg,
|
|
13
|
+
border: colors.success.main,
|
|
14
|
+
iconColor: colors.success.main,
|
|
15
|
+
textColor: colors.success.text,
|
|
16
|
+
};
|
|
17
|
+
case 'warning':
|
|
18
|
+
return {
|
|
19
|
+
background: colors.warning.bg,
|
|
20
|
+
border: colors.warning.main,
|
|
21
|
+
iconColor: colors.warning.main,
|
|
22
|
+
textColor: colors.warning.text,
|
|
23
|
+
};
|
|
24
|
+
case 'error':
|
|
25
|
+
return {
|
|
26
|
+
background: colors.error.bg,
|
|
27
|
+
border: colors.error.main,
|
|
28
|
+
iconColor: colors.error.main,
|
|
29
|
+
textColor: colors.error.text,
|
|
30
|
+
};
|
|
31
|
+
case 'info':
|
|
32
|
+
default:
|
|
33
|
+
return {
|
|
34
|
+
background: colors.info.bg,
|
|
35
|
+
border: colors.info.main,
|
|
36
|
+
iconColor: colors.info.main,
|
|
37
|
+
textColor: colors.info.text,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getDefaultIcon = (alertType) => {
|
|
42
|
+
switch (alertType) {
|
|
43
|
+
case 'success':
|
|
44
|
+
return _jsx(CheckCircleOutlined, {});
|
|
45
|
+
case 'warning':
|
|
46
|
+
return _jsx(ExclamationCircleOutlined, {});
|
|
47
|
+
case 'error':
|
|
48
|
+
return _jsx(CloseCircleOutlined, {});
|
|
49
|
+
case 'info':
|
|
50
|
+
default:
|
|
51
|
+
return _jsx(InfoCircleOutlined, {});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const alertColors = getAlertColors(type);
|
|
55
|
+
const alertIcon = icon || getDefaultIcon(type);
|
|
56
|
+
// Calculate icon width for alignment (icon + gap)
|
|
57
|
+
const iconWidth = showIcon ? 14 + 8 : 0; // icon size + gap
|
|
58
|
+
const renderTitle = () => {
|
|
59
|
+
if (typeof title === 'string') {
|
|
60
|
+
return (_jsx(Text, { strong: true, style: {
|
|
61
|
+
fontSize: 13,
|
|
62
|
+
color: alertColors.textColor,
|
|
63
|
+
lineHeight: 1.4,
|
|
64
|
+
}, children: title }));
|
|
65
|
+
}
|
|
66
|
+
return title;
|
|
67
|
+
};
|
|
68
|
+
const renderDescription = () => {
|
|
69
|
+
if (typeof description === 'string') {
|
|
70
|
+
return (_jsx(Text, { style: {
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
color: colors.text.secondary,
|
|
73
|
+
lineHeight: 1.5,
|
|
74
|
+
paddingLeft: title && showIcon ? iconWidth : 0,
|
|
75
|
+
}, children: description }));
|
|
76
|
+
}
|
|
77
|
+
// For React nodes, wrap in a div with appropriate styling
|
|
78
|
+
return (_jsx("div", { style: {
|
|
79
|
+
fontSize: 12,
|
|
80
|
+
color: colors.text.secondary,
|
|
81
|
+
lineHeight: 1.5,
|
|
82
|
+
paddingLeft: title && showIcon ? iconWidth : 0,
|
|
83
|
+
}, children: description }));
|
|
84
|
+
};
|
|
85
|
+
return (_jsx("div", { style: Object.assign({ width: '100%', padding: '12px 16px', backgroundColor: alertColors.background, borderRadius: constants.radius.sm, borderLeft: `3px solid ${alertColors.border}` }, style), children: _jsxs(Space, { direction: "vertical", size: title ? 6 : 0, style: { width: '100%' }, children: [title && (_jsxs(Flex, { gap: 8, align: "center", children: [showIcon && (_jsx("div", { style: {
|
|
86
|
+
color: alertColors.iconColor,
|
|
87
|
+
fontSize: 14,
|
|
88
|
+
lineHeight: 1,
|
|
89
|
+
}, children: alertIcon })), renderTitle()] })), description && (_jsxs(Flex, { gap: 8, align: "flex-start", children: [!title && showIcon && (_jsx("div", { style: {
|
|
90
|
+
color: alertColors.iconColor,
|
|
91
|
+
fontSize: 14,
|
|
92
|
+
lineHeight: 1,
|
|
93
|
+
marginTop: 1,
|
|
94
|
+
}, children: alertIcon })), renderDescription()] }))] }) }));
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./alert.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./alert.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tembo-confirm.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tembo-confirm.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface ConfirmDialogProps {
|
|
2
|
+
title: string;
|
|
3
|
+
content: React.ReactNode;
|
|
4
|
+
okText?: string;
|
|
5
|
+
cancelText?: string;
|
|
6
|
+
okType?: 'default' | 'primary' | 'dashed' | 'link' | 'text';
|
|
7
|
+
okDanger?: boolean;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
onOk?: () => void | Promise<void>;
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base confirmation dialog using NiceModal
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConfirmDialog: import("react").FC<ConfirmDialogProps & import("@ebay/nice-modal-react").NiceModalHocProps>;
|
|
16
|
+
/**
|
|
17
|
+
* TemboConfirm - Unified confirmation dialog system
|
|
18
|
+
*
|
|
19
|
+
* Provides consistent, theme-aligned confirmation dialogs using NiceModal.
|
|
20
|
+
* Uses theme colors at invocation time to ensure proper theming.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Danger confirmation
|
|
25
|
+
* const confirmed = await TemboConfirm.danger({
|
|
26
|
+
* title: 'Delete Payment',
|
|
27
|
+
* content: 'This action cannot be undone.',
|
|
28
|
+
* okText: 'Yes, Delete',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* if (confirmed) {
|
|
32
|
+
* // proceed with deletion
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // Warning confirmation
|
|
36
|
+
* await TemboConfirm.warning({
|
|
37
|
+
* title: 'Unsaved Changes',
|
|
38
|
+
* content: 'You have unsaved changes. Continue?',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class TemboConfirm {
|
|
43
|
+
/**
|
|
44
|
+
* Show a danger/destructive confirmation dialog (red OK button)
|
|
45
|
+
*/
|
|
46
|
+
static danger(props: Omit<ConfirmDialogProps, 'icon' | 'okDanger'>): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Show a warning confirmation dialog (orange icon)
|
|
49
|
+
*/
|
|
50
|
+
static warning(props: Omit<ConfirmDialogProps, 'icon'>): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Show an info confirmation dialog (blue icon)
|
|
53
|
+
*/
|
|
54
|
+
static info(props: Omit<ConfirmDialogProps, 'icon'>): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Show a success confirmation dialog (green icon)
|
|
57
|
+
*/
|
|
58
|
+
static success(props: Omit<ConfirmDialogProps, 'icon'>): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Show a generic question dialog
|
|
61
|
+
*/
|
|
62
|
+
static confirm(props: Omit<ConfirmDialogProps, 'icon'>): Promise<boolean>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from 'antd';
|
|
3
|
+
import NiceModal, { useModal } from '@ebay/nice-modal-react';
|
|
4
|
+
import { ExclamationCircleOutlined, QuestionCircleOutlined, InfoCircleOutlined, WarningOutlined, CheckCircleOutlined, } from '@ant-design/icons';
|
|
5
|
+
import { useTemboTheme } from '../../theme/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Base confirmation dialog using NiceModal
|
|
8
|
+
*/
|
|
9
|
+
export const ConfirmDialog = NiceModal.create((props) => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const modal = useModal();
|
|
12
|
+
const handleOk = async () => {
|
|
13
|
+
if (props.onOk) {
|
|
14
|
+
await props.onOk();
|
|
15
|
+
}
|
|
16
|
+
modal.resolve(true);
|
|
17
|
+
modal.remove();
|
|
18
|
+
};
|
|
19
|
+
const handleCancel = () => {
|
|
20
|
+
if (props.onCancel) {
|
|
21
|
+
props.onCancel();
|
|
22
|
+
}
|
|
23
|
+
modal.resolve(false);
|
|
24
|
+
modal.remove();
|
|
25
|
+
};
|
|
26
|
+
return (_jsx(Modal, { open: modal.visible, title: props.title, onOk: handleOk, onCancel: handleCancel, okText: (_a = props.okText) !== null && _a !== void 0 ? _a : 'OK', cancelText: (_b = props.cancelText) !== null && _b !== void 0 ? _b : 'Cancel', okButtonProps: {
|
|
27
|
+
danger: props.okDanger,
|
|
28
|
+
type: (_c = props.okType) !== null && _c !== void 0 ? _c : 'primary',
|
|
29
|
+
}, centered: true, destroyOnClose: true, children: _jsxs("div", { style: { display: 'flex', gap: 12, alignItems: 'flex-start' }, children: [props.icon && (_jsx("div", { style: { fontSize: 22, marginTop: 2 }, children: props.icon })), _jsx("div", { style: { flex: 1 }, children: props.content })] }) }));
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* TemboConfirm - Unified confirmation dialog system
|
|
33
|
+
*
|
|
34
|
+
* Provides consistent, theme-aligned confirmation dialogs using NiceModal.
|
|
35
|
+
* Uses theme colors at invocation time to ensure proper theming.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Danger confirmation
|
|
40
|
+
* const confirmed = await TemboConfirm.danger({
|
|
41
|
+
* title: 'Delete Payment',
|
|
42
|
+
* content: 'This action cannot be undone.',
|
|
43
|
+
* okText: 'Yes, Delete',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* if (confirmed) {
|
|
47
|
+
* // proceed with deletion
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* // Warning confirmation
|
|
51
|
+
* await TemboConfirm.warning({
|
|
52
|
+
* title: 'Unsaved Changes',
|
|
53
|
+
* content: 'You have unsaved changes. Continue?',
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export class TemboConfirm {
|
|
58
|
+
/**
|
|
59
|
+
* Show a danger/destructive confirmation dialog (red OK button)
|
|
60
|
+
*/
|
|
61
|
+
static async danger(props) {
|
|
62
|
+
// We need to get colors from context, but static methods can't use hooks
|
|
63
|
+
// Solution: Accept colors as optional param or use a wrapper component
|
|
64
|
+
return NiceModal.show(ConfirmDialog, Object.assign(Object.assign({}, props), { icon: _jsx(DangerIcon, {}), okDanger: true, okType: 'primary' }));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Show a warning confirmation dialog (orange icon)
|
|
68
|
+
*/
|
|
69
|
+
static async warning(props) {
|
|
70
|
+
return NiceModal.show(ConfirmDialog, Object.assign(Object.assign({}, props), { icon: _jsx(WarningIcon, {}) }));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Show an info confirmation dialog (blue icon)
|
|
74
|
+
*/
|
|
75
|
+
static async info(props) {
|
|
76
|
+
return NiceModal.show(ConfirmDialog, Object.assign(Object.assign({}, props), { icon: _jsx(InfoIcon, {}) }));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Show a success confirmation dialog (green icon)
|
|
80
|
+
*/
|
|
81
|
+
static async success(props) {
|
|
82
|
+
return NiceModal.show(ConfirmDialog, Object.assign(Object.assign({}, props), { icon: _jsx(SuccessIcon, {}) }));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Show a generic question dialog
|
|
86
|
+
*/
|
|
87
|
+
static async confirm(props) {
|
|
88
|
+
return NiceModal.show(ConfirmDialog, Object.assign(Object.assign({}, props), { icon: _jsx(QuestionIcon, {}) }));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Icon wrapper components that use the theme hook
|
|
92
|
+
const DangerIcon = () => {
|
|
93
|
+
const { colors } = useTemboTheme();
|
|
94
|
+
return _jsx(ExclamationCircleOutlined, { style: { color: colors.error.main } });
|
|
95
|
+
};
|
|
96
|
+
const WarningIcon = () => {
|
|
97
|
+
const { colors } = useTemboTheme();
|
|
98
|
+
return _jsx(WarningOutlined, { style: { color: colors.warning.main } });
|
|
99
|
+
};
|
|
100
|
+
const InfoIcon = () => {
|
|
101
|
+
const { colors } = useTemboTheme();
|
|
102
|
+
return _jsx(InfoCircleOutlined, { style: { color: colors.info.main } });
|
|
103
|
+
};
|
|
104
|
+
const SuccessIcon = () => {
|
|
105
|
+
const { colors } = useTemboTheme();
|
|
106
|
+
return _jsx(CheckCircleOutlined, { style: { color: colors.success.main } });
|
|
107
|
+
};
|
|
108
|
+
const QuestionIcon = () => {
|
|
109
|
+
const { colors } = useTemboTheme();
|
|
110
|
+
return _jsx(QuestionCircleOutlined, { style: { color: colors.primary.main } });
|
|
111
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator for account name field using existing BankValidation.
|
|
3
|
+
* Ensures the account name meets the criteria defined in your validation utils.
|
|
4
|
+
*
|
|
5
|
+
* @param rule - The rule object for validation
|
|
6
|
+
* @param value - The value to validate
|
|
7
|
+
* @returns Promise resolving to trimmed account name or rejecting with error
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In form rules
|
|
11
|
+
* rules: [{ required: true, validator: ACCOUNT_NAME_VALIDATOR }]
|
|
12
|
+
*/
|
|
13
|
+
export declare const ACCOUNT_NAME_VALIDATOR: (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BankValidation } from "@temboplus/frontend-core";
|
|
2
|
+
/**
|
|
3
|
+
* Validator for account name field using existing BankValidation.
|
|
4
|
+
* Ensures the account name meets the criteria defined in your validation utils.
|
|
5
|
+
*
|
|
6
|
+
* @param rule - The rule object for validation
|
|
7
|
+
* @param value - The value to validate
|
|
8
|
+
* @returns Promise resolving to trimmed account name or rejecting with error
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // In form rules
|
|
12
|
+
* rules: [{ required: true, validator: ACCOUNT_NAME_VALIDATOR }]
|
|
13
|
+
*/
|
|
14
|
+
export const ACCOUNT_NAME_VALIDATOR = (rule, value) => {
|
|
15
|
+
const accountNameString = value === null || value === void 0 ? void 0 : value.toString().trim();
|
|
16
|
+
// If field is empty/undefined/null
|
|
17
|
+
if (!accountNameString) {
|
|
18
|
+
if (rule.required) {
|
|
19
|
+
return Promise.reject(new Error("Account name is required."));
|
|
20
|
+
}
|
|
21
|
+
return Promise.resolve(undefined);
|
|
22
|
+
}
|
|
23
|
+
const isValid = BankValidation.validateAccountName(accountNameString);
|
|
24
|
+
if (isValid) {
|
|
25
|
+
return Promise.resolve(accountNameString);
|
|
26
|
+
}
|
|
27
|
+
return Promise.reject(new Error("Invalid account name. Please enter a valid full name with at least two words (e.g., 'John Smith', 'Anna-Marie Johnson')."));
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ISO2CountryCode } from "@temboplus/frontend-core";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a validator for bank account numbers specific to a country.
|
|
4
|
+
* Uses BankValidation.validateAccountNumber() for validation.
|
|
5
|
+
*
|
|
6
|
+
* @param countryCode - The ISO2 country code for validation context
|
|
7
|
+
* @returns Validator function for AntD form rules
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In form rules
|
|
11
|
+
* rules: [{ required: true, validator: ACCOUNT_NUMBER_VALIDATOR('KE') }]
|
|
12
|
+
*/
|
|
13
|
+
export declare const ACCOUNT_NUMBER_VALIDATOR: (countryCode?: ISO2CountryCode) => (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { BankValidation, Country } from "@temboplus/frontend-core";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a validator for bank account numbers specific to a country.
|
|
4
|
+
* Uses BankValidation.validateAccountNumber() for validation.
|
|
5
|
+
*
|
|
6
|
+
* @param countryCode - The ISO2 country code for validation context
|
|
7
|
+
* @returns Validator function for AntD form rules
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In form rules
|
|
11
|
+
* rules: [{ required: true, validator: ACCOUNT_NUMBER_VALIDATOR('KE') }]
|
|
12
|
+
*/
|
|
13
|
+
export const ACCOUNT_NUMBER_VALIDATOR = (countryCode) => {
|
|
14
|
+
return (rule, value) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const accountNumberString = value === null || value === void 0 ? void 0 : value.toString().trim();
|
|
17
|
+
// If field is empty/undefined/null
|
|
18
|
+
if (!accountNumberString) {
|
|
19
|
+
if (rule.required) {
|
|
20
|
+
return Promise.reject(new Error("Account number is required."));
|
|
21
|
+
}
|
|
22
|
+
return Promise.resolve(undefined);
|
|
23
|
+
}
|
|
24
|
+
// Remove spaces for validation but keep original format for display
|
|
25
|
+
const normalizedAccountNumber = removeSpaces(accountNumberString);
|
|
26
|
+
if (countryCode) {
|
|
27
|
+
const isValid = BankValidation.validateAccountNumber(normalizedAccountNumber, countryCode);
|
|
28
|
+
if (isValid) {
|
|
29
|
+
return Promise.resolve(normalizedAccountNumber);
|
|
30
|
+
}
|
|
31
|
+
const countryName = (_a = Country.from(countryCode)) === null || _a === void 0 ? void 0 : _a.name;
|
|
32
|
+
const formatHint = getAccountNumberFormatHint(countryCode);
|
|
33
|
+
return Promise.reject(new Error(`Invalid ${countryName} account number format. ${formatHint}`));
|
|
34
|
+
}
|
|
35
|
+
const isValid = BankValidation.validateAccountNumberForAnyCountry(normalizedAccountNumber);
|
|
36
|
+
if (isValid) {
|
|
37
|
+
return Promise.resolve(normalizedAccountNumber);
|
|
38
|
+
}
|
|
39
|
+
return Promise.reject(new Error(`Invalid account number format`));
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
// ==================== UTILITY FUNCTIONS ====================
|
|
43
|
+
/**
|
|
44
|
+
* Removes all whitespace characters from the given string.
|
|
45
|
+
*
|
|
46
|
+
* @param input - The input string from which spaces should be removed
|
|
47
|
+
* @returns A new string with all whitespace characters removed
|
|
48
|
+
*/
|
|
49
|
+
function removeSpaces(input) {
|
|
50
|
+
return input.replace(/\s+/g, "");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets account number format hint based on country.
|
|
54
|
+
*
|
|
55
|
+
* @param countryCode - The ISO2 country code
|
|
56
|
+
* @returns Format hint string for the specific country
|
|
57
|
+
*/
|
|
58
|
+
function getAccountNumberFormatHint(countryCode) {
|
|
59
|
+
const formatHints = {
|
|
60
|
+
TZ: "Account number should be 9-19 characters long.",
|
|
61
|
+
KE: "Account number should be 10, 12, or 15 alphanumeric characters.",
|
|
62
|
+
// Add more country-specific hints as needed
|
|
63
|
+
};
|
|
64
|
+
return formatHints[countryCode] || "Please enter a valid account number.";
|
|
65
|
+
}
|
|
@@ -1,65 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* Creates a validator for general phone numbers that validates format and country.
|
|
4
|
-
* Uses PhoneNumberFactory.canCreate() for validation.
|
|
5
|
-
*
|
|
6
|
-
* @param countryCode - The ISO2 country code for validation context
|
|
7
|
-
* @returns Validator function for AntD form rules
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* // In form rules
|
|
11
|
-
* rules: [{ required: true, validator: PHONE_NUMBER_VALIDATOR('TZ') }]
|
|
12
|
-
*/
|
|
13
|
-
export declare const PHONE_NUMBER_VALIDATOR: (countryCode?: ISO2CountryCode) => (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a validator for mobile phone numbers eligible for payout operations.
|
|
16
|
-
* Uses PhoneNumberFactory.checkPayoutEligibility() for validation.
|
|
17
|
-
*
|
|
18
|
-
* @param countryCode - The ISO2 country code for validation context
|
|
19
|
-
* @returns Validator function for AntD form rules
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // In form rules
|
|
23
|
-
* rules: [{ required: true, validator: MOBILE_PHONE_VALIDATOR('TZ') }]
|
|
24
|
-
*/
|
|
25
|
-
export declare const MOBILE_PHONE_VALIDATOR: (countryCode?: ISO2CountryCode) => (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Validator for account name field using existing BankValidation.
|
|
28
|
-
* Ensures the account name meets the criteria defined in your validation utils.
|
|
29
|
-
*
|
|
30
|
-
* @param rule - The rule object for validation
|
|
31
|
-
* @param value - The value to validate
|
|
32
|
-
* @returns Promise resolving to trimmed account name or rejecting with error
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* // In form rules
|
|
36
|
-
* rules: [{ required: true, validator: ACCOUNT_NAME_VALIDATOR }]
|
|
37
|
-
*/
|
|
38
|
-
export declare const ACCOUNT_NAME_VALIDATOR: (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
39
|
-
/**
|
|
40
|
-
* Creates a validator for SWIFT/BIC codes specific to a country.
|
|
41
|
-
* Uses BankValidation.validateSwiftCode() for validation.
|
|
42
|
-
*
|
|
43
|
-
* @param countryCode - The ISO2 country code for validation context
|
|
44
|
-
* @returns Validator function for AntD form rules
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* // In form rules
|
|
48
|
-
* rules: [{ required: true, validator: SWIFT_CODE_VALIDATOR('TZ') }]
|
|
49
|
-
*/
|
|
50
|
-
export declare const SWIFT_CODE_VALIDATOR: (countryCode?: ISO2CountryCode) => (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
51
|
-
/**
|
|
52
|
-
* Creates a validator for bank account numbers specific to a country.
|
|
53
|
-
* Uses BankValidation.validateAccountNumber() for validation.
|
|
54
|
-
*
|
|
55
|
-
* @param countryCode - The ISO2 country code for validation context
|
|
56
|
-
* @returns Validator function for AntD form rules
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* // In form rules
|
|
60
|
-
* rules: [{ required: true, validator: ACCOUNT_NUMBER_VALIDATOR('KE') }]
|
|
61
|
-
*/
|
|
62
|
-
export declare const ACCOUNT_NUMBER_VALIDATOR: (countryCode?: ISO2CountryCode) => (rule: any, value: string | null | undefined) => Promise<string | undefined>;
|
|
1
|
+
import { CurrencyCode } from "@temboplus/frontend-core";
|
|
63
2
|
/**
|
|
64
3
|
* Configuration options for amount validation
|
|
65
4
|
*/
|