@sikka/hawa 0.0.14 → 0.0.15

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.
Files changed (31) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +1 -1
  4. package/src/blocks/AuthForms/NewPasswordForm.js +57 -38
  5. package/src/blocks/AuthForms/ResetPasswordForm.js +36 -39
  6. package/src/blocks/AuthForms/SignInForm.js +71 -58
  7. package/src/blocks/AuthForms/SignUpForm.js +60 -43
  8. package/src/blocks/Pricing/PricingPlans.js +19 -9
  9. package/src/elements/HawaAlert.js +1 -1
  10. package/src/elements/HawaAppBar.js +139 -0
  11. package/src/elements/HawaListItem.js +21 -0
  12. package/src/elements/HawaPricingCard.js +40 -22
  13. package/src/elements/HawaTextField.js +15 -149
  14. package/src/elements/index.js +2 -0
  15. package/src/layout/HawaAppLayout.js +246 -0
  16. package/src/layout/index.js +1 -0
  17. package/src/stories/BlocksStories/Auth/NewPassword.stories.js +2 -1
  18. package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +1 -2
  19. package/src/stories/BlocksStories/Auth/SignUp.stories.js +1 -0
  20. package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +21 -4
  21. package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +23 -5
  22. package/src/stories/LayoutStories/AppBar.stories.js +29 -0
  23. package/src/stories/LayoutStories/AppLayout.stories.js +52 -0
  24. package/storybook-static/iframe.html +1 -1
  25. package/storybook-static/main.66955578.iframe.bundle.js +1 -0
  26. package/storybook-static/vendors~main.b4186832.iframe.bundle.js +76 -0
  27. package/storybook-static/{vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt → vendors~main.b4186832.iframe.bundle.js.LICENSE.txt} +0 -0
  28. package/storybook-static/vendors~main.b4186832.iframe.bundle.js.map +1 -0
  29. package/storybook-static/main.e382d866.iframe.bundle.js +0 -1
  30. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +0 -76
  31. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +0 -1
package/es/index.es.js CHANGED
@@ -1 +1 @@
1
- import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as a,jsxs as l,Fragment as i}from"react/jsx-runtime";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import n from"@mui/material/Container";import{Typography as o,Container as s,Button as d}from"@mui/material";import"@mui/icons-material/CheckCircleOutlined";import u from"@mui/material/Typography";import m from"@mui/material/Input";import p from"@mui/material/InputLabel";import c from"@mui/icons-material/GitHub";import h from"@mui/icons-material/Twitter";import g from"@mui/icons-material/AccountBalanceWallet";import b from"@mui/material/Alert";import f from"@mui/material/AlertTitle";import{useForm as x,FormProvider as y}from"react-hook-form";import v from"@mui/material/InputAdornment";import w from"@mui/icons-material/HttpsOutlined";import T from"@mui/icons-material/MailOutline";import P from"@mui/icons-material/PermIdentityOutlined";function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){o=!0,l=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw l}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}r.string,r.bool;var q=function(e){return a(u,S(S({},e),{},{children:e.children}))},L=function(e){return l(i,{children:[a(p,{children:e.label}),a(m,S({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var O=function(e){var r,i="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":i=a("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":i=a(c,{});break;case"twitter":i=a(h,{});break;case"mada":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":i=a(g,{})}return l(t,S(S({},e),{},{variant:"withLogo",children:[i,a("div",{style:{width:10}}),a(o,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},I=function(e){return l(b,{children:[e.title&&a(f,{children:e.title}),e.text]})},N=function(e){var r,i,o,s,d=x(),u=d.formState.errors;return a(n,{maxWidth:"sm",children:a(y,S(S({},d),{},{children:l("form",{children:[a(L,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(r=u.fullName)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a(L,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(i=u.email)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(o=u.password)||void 0===o?void 0:o.message}),a(L,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(s=u.confirmPassword)||void 0===s?void 0:s.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},j=function(e){return l(s,{maxWidth:"sm",children:[e.children,a(d,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})},E=function(r){var i,o,s=W(e(""),2),d=s[0],u=s[1],m=x(),p=m.formState.errors,c=m.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[r.error&&a(I,{text:"This is a new password alert",severity:"error"}),r.passwordChanged?a(q,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(y,S(S({},m),{},{children:l("form",{onSubmit:c(r.handleNewPassword),children:[a(L,{fullWidth:!0,name:"password",type:"password",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,onChange:function(e){return u(e.target.value)},value:d,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:r.texts.passwordRequiredText},helperText:null===(i=p.password)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:r.texts.confirmPasswordPlaceholder,label:r.texts.confirmPasswordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:"Password is rquired"},helperText:null===(o=p.confirmPassword)||void 0===o?void 0:o.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},z=function(e){var r,i=x(),o=i.formState.errors,s=i.handleSubmit;return i.getValues,i.register,i.watch,i.reset,i.setValue,l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(Alert,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a(q,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a(y,S(S({},i),{},{children:l("form",{onSubmit:s(e.handleResetPassword),children:[a(L,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},G=function(e){var r,i,o,s=x(),d=s.formState.errors,m=s.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(b,{severity:"error",children:[e.errorTitle&&a(f,{children:e.errorTitle}),e.errorText]}),a(y,S(S({},s),{},{children:l("form",{onSubmit:m(e.handleSignUp),children:[a(L,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a(v,{position:"start",children:a(P,{})}),helperText:null===(r=d.fullName)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a(v,{position:"start",children:a(T,{})}),rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(i=d.email)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(o=d.password)||void 0===o?void 0:o.message}),a(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(O,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(O,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(O,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};G.propTypes={theme:r.oneOf(["secondary","primary"])};var R=function(e){var r,i,o=x(),s=o.formState.errors,d=o.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(b,{severity:"error",children:[e.errorTitle&&a(f,{children:e.errorTitle}),e.errorText]}),a(y,S(S({},o),{},{children:l("form",{onSubmit:d(e.handleSignIn),children:[a(L,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),rules:{required:e.texts.emailRequired,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(r=s.email)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(i=s.password)||void 0===i?void 0:i.message}),a(u,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),l(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(O,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(O,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(O,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},B=function(e){return l(s,{maxWidth:"xs",children:[a(q,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(O,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(O,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(O,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(O,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(O,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(O,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(O,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};L.propTypes={theme:r.oneOf(["secondary","primary"]),viaApplePay:r.bool,viaGooglePay:r.bool,viaSTCPay:r.bool,viaCreditCard:r.bool,viaPayPal:r.bool,handleApplePay:r.func};var U=function(e){var t,r,i=x(),n=i.formState.errors,o=i.handleSubmit;return a(s,{maxWidth:"xs",children:a(y,S(S({},i),{},{children:l("form",{onSubmit:o(e.handle),children:[a(L,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(L,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a(d,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},D=function(r){var i,o=W(e(0),2),s=o[0],d=o[1],m=x(),p=m.formState.errors,c=m.handleSubmit;return l(n,{maxWidth:"xs",children:[l(u,{align:"center",variant:"h1",children:[Number(s).toLocaleString("en")||"0",a(u,{children:r.currency||"SAR"})]}),a(y,S(S({},m),{},{children:l("form",{onChange:function(e){e.preventDefault(),d(m.getValues().amount)},style:{marginTop:10},onSubmit:c(r.handleChargeWallet),children:[a(L,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:s,rules:{required:"Password is rquired"},helperText:null===(i=p.amount)||void 0===i?void 0:i.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},F=function(e){return l(s,{maxWidth:"xs",children:[a(o,{align:"center",children:"Wallet Balance"}),l(o,{align:"center",variant:"h1",children:[e.walletBalance||"0",a(o,{children:e.currency||"SAR"})]}),a(d,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})};export{D as ChargeWalletForm,U as CreditCardForm,E as NewPasswordForm,F as PayWithWallet,z as ResetPasswordForm,B as SelectPayment,R as SignInForm,G as SignUpForm,N as UserProfileForm,j as UserSettingsForm};
1
+ import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as a,jsxs as i,Fragment as l}from"react/jsx-runtime";import{Typography as n,Container as o,Button as s}from"@mui/material";import"@mui/icons-material/MoveToInbox";import d from"@mui/material/AppBar";import"@mui/material/Box";import"@mui/material/Toolbar";import"@mui/material/IconButton";import u from"@mui/material/Typography";import"@mui/material/Menu";import"@mui/icons-material/Menu";import m from"@mui/material/Container";import"@mui/material/Avatar";import"@mui/material/MenuItem";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import"@mui/icons-material/CheckCircleOutlined";import c from"@mui/material/Input";import p from"@mui/material/InputLabel";import h from"@mui/icons-material/GitHub";import g from"@mui/icons-material/Twitter";import f from"@mui/icons-material/AccountBalanceWallet";import v from"@mui/material/Alert";import x from"@mui/material/AlertTitle";import{useForm as b,FormProvider as y,Controller as w}from"react-hook-form";import T from"@mui/material/InputAdornment";import P from"@mui/icons-material/HttpsOutlined";import S from"@mui/icons-material/MailOutline";import C from"@mui/icons-material/PermIdentityOutlined";import{styled as k}from"@mui/material/styles";import W from"@mui/material/Drawer";import"@mui/material/List";import"@mui/material/Divider";import"@mui/icons-material/ChevronLeft";import"@mui/icons-material/ChevronRight";import"@mui/material/ListItemButton";import"@mui/material/ListItemIcon";import"@mui/material/ListItemText";import"@mui/icons-material/Mail";function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,i,l=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(l.push(a.value),!t||l.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw i}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}r.string,r.bool;var j=function(e){return a(u,L(L({},e),{},{children:e.children}))},z=function(e){return i(l,{children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a(p,{children:e.label}),e.helperText&&a(n,{variant:"validation",children:e.helperText})]}),a(c,L({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var N=function(e){var r,l="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":l=a("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":l=a(h,{});break;case"twitter":l=a(g,{});break;case"mada":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":l=a(f,{})}return i(t,L(L({},e),{},{variant:"withLogo",children:[l,a("div",{style:{width:10}}),a(n,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},E=function(e){return i(v,L(L({},e),{},{children:[e.title&&a(x,{children:e.title}),e.text]}))},B=function(e){var r,l,n,o,s=b(),d=s.formState.errors;return a(m,{maxWidth:"sm",children:a(y,L(L({},s),{},{children:i("form",{children:[a(z,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(r=d.fullName)||void 0===r?void 0:r.message}),a(z,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a(z,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(l=d.email)||void 0===l?void 0:l.message}),a(z,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(n=d.password)||void 0===n?void 0:n.message}),a(z,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(o=d.confirmPassword)||void 0===o?void 0:o.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},R=function(e){return i(o,{maxWidth:"sm",children:[e.children,a(s,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})},G=function(r){var l=I(e(""),2);l[0],l[1];var n=I(e(""),2);n[0],n[1];var o=I(e(!1),2),s=o[0],d=o[1],u=b(),c=u.formState.errors,p=u.handleSubmit,h=u.control;return i(m,{maxWidth:"xs",variant:"auth",children:[s&&a(E,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?a(j,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(y,L(L({},u),{},{children:i("form",{onSubmit:p((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():d(!0)})),children:[a(w,{control:h,name:"password",render:function(e){var t,i,l=e.field;return a(z,L({fullWidth:!0,type:"password",value:null!==(t=l.value)&&void 0!==t?t:"",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,helperText:null===(i=c.password)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(P,{})})},l))},rules:{required:r.texts.passwordRequiredText}}),a(w,{control:h,name:"confirmPassword",render:function(e){var t,i,l=e.field;return a(z,L({fullWidth:!0,type:"password",value:null!==(t=l.value)&&void 0!==t?t:"",label:r.texts.confirmPasswordLabel,placeholder:r.texts.confirmPasswordPlaceholder,helperText:null===(i=c.confirmPassword)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(P,{})})},l))},rules:{required:r.texts.confirmPasswordRequiredText}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},M=function(e){var r,l=b(),n=l.formState.errors,o=l.handleSubmit;l.register;var s=l.control;return i(m,{maxWidth:"xs",variant:"auth",children:[e.error&&i(Alert,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a(j,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):i("form",{onSubmit:o(e.handleResetPassword),children:[console.log("eror ",null===(r=n.email)||void 0===r?void 0:r.message),a(w,{control:s,name:"email",render:function(t){var r,i,l=t.field;return a(z,L({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=n.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})},l))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},D=function(e){var r=b(),l=r.formState.errors,n=r.handleSubmit,o=r.control;return i(m,{maxWidth:"xs",variant:"auth",children:[e.error&&i(v,{severity:"error",children:[e.errorTitle&&a(x,{children:e.errorTitle}),e.errorText]}),a(y,L(L({},r),{},{children:i("form",{onSubmit:n(e.handleSignUp),children:[a(w,{control:o,name:"fullName",render:function(t){var r,i,n=t.field;return a(z,{fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=l.fullName)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(C,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a(w,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(z,{fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(w,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(z,L({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=l.password)||void 0===n?void 0:n.message,startAdornment:a(T,{position:"start",children:a(P,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),i(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(N,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(N,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(N,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};D.propTypes={theme:r.oneOf(["secondary","primary"])};var U=function(e){var r=b(),l=r.formState.errors,n=r.handleSubmit;r.register;var o=r.control;return i(m,{maxWidth:"xs",variant:"auth",children:[e.error&&i(v,{severity:"error",children:[e.errorTitle&&a(x,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:n(e.handleSignIn),children:[a(w,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(z,L({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(w,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(z,L({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=l.password)||void 0===n?void 0:n.message,startAdornment:a(T,{position:"start",children:a(P,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(u,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),i(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(N,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(N,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(N,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},F=function(e){return i(o,{maxWidth:"xs",children:[a(j,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(N,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(N,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(N,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(N,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(N,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(N,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(N,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};z.propTypes={theme:r.oneOf(["secondary","primary"]),viaApplePay:r.bool,viaGooglePay:r.bool,viaSTCPay:r.bool,viaCreditCard:r.bool,viaPayPal:r.bool,handleApplePay:r.func};var Z=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},$=function(e){return q({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})};k("div")((function(e){var t=e.theme;return L({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),k(d,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return L({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),k(W,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return L(L({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&L(L({},Z(t)),{},{"& .MuiDrawer-paper":Z(t)})),!r&&L(L({},$(t)),{},{"& .MuiDrawer-paper":$(t)}))}));var V=function(e){var t,r,l=b(),n=l.formState.errors,d=l.handleSubmit;return a(o,{maxWidth:"xs",children:a(y,L(L({},l),{},{children:i("form",{onSubmit:d(e.handle),children:[a(z,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(z,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},H=function(r){var l,n=I(e(0),2),o=n[0],s=n[1],d=b(),c=d.formState.errors,p=d.handleSubmit;return i(m,{maxWidth:"xs",children:[i(u,{align:"center",variant:"h1",children:[Number(o).toLocaleString("en")||"0",a(u,{children:r.currency||"SAR"})]}),a(y,L(L({},d),{},{children:i("form",{onChange:function(e){e.preventDefault(),s(d.getValues().amount)},style:{marginTop:10},onSubmit:p(r.handleChargeWallet),children:[a(z,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:o,rules:{required:"Password is rquired"},helperText:null===(l=c.amount)||void 0===l?void 0:l.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},X=function(e){return i(o,{maxWidth:"xs",children:[a(n,{align:"center",children:"Wallet Balance"}),i(n,{align:"center",variant:"h1",children:[e.walletBalance||"0",a(n,{children:e.currency||"SAR"})]}),a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})};export{H as ChargeWalletForm,V as CreditCardForm,G as NewPasswordForm,X as PayWithWallet,M as ResetPasswordForm,F as SelectPayment,U as SignInForm,D as SignUpForm,B as UserProfileForm,R as UserSettingsForm};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),a=require("react/jsx-runtime");require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox");var l=require("@mui/material/Container"),s=require("@mui/material");require("@mui/icons-material/CheckCircleOutlined");var i=require("@mui/material/Typography"),n=require("@mui/material/Input"),o=require("@mui/material/InputLabel"),d=require("@mui/icons-material/GitHub"),u=require("@mui/icons-material/Twitter"),m=require("@mui/icons-material/AccountBalanceWallet"),c=require("@mui/material/Alert"),h=require("@mui/material/AlertTitle"),x=require("react-hook-form"),p=require("@mui/material/InputAdornment"),f=require("@mui/icons-material/HttpsOutlined"),g=require("@mui/icons-material/MailOutline"),b=require("@mui/icons-material/PermIdentityOutlined");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=y(t),v=y(r),w=y(l),T=y(i),P=y(n),C=y(o),S=y(d),q=y(u),k=y(m),W=y(c),A=y(h),L=y(p),F=y(f),O=y(g),I=y(b);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,s=[],i=!0,n=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(s.push(a.value),!t||s.length!==t);i=!0);}catch(e){n=!0,l=e}finally{try{i||null==r.return||r.return()}finally{if(n)throw l}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}v.default.string,v.default.bool;var R=function(e){return a.jsx(T.default,E(E({},e),{},{children:e.children}))},U=function(e){return a.jsxs(a.Fragment,{children:[a.jsx(C.default,{children:e.label}),a.jsx(P.default,E({disableUnderline:!0},e))]})};v.default.oneOf(["text","number","password"]),v.default.string;var D=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=a.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=a.jsx(S.default,{});break;case"twitter":r=a.jsx(q.default,{});break;case"mada":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=a.jsx(k.default,{})}return a.jsxs(j.default,E(E({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(s.Typography,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},M=function(e){return a.jsxs(W.default,{children:[e.title&&a.jsx(A.default,{children:e.title}),e.text]})},Z=function(e){var t,r,l,s=x.useForm(),i=s.formState.errors,n=s.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(W.default,{severity:"error",children:[e.errorTitle&&a.jsx(A.default,{children:e.errorTitle}),e.errorText]}),a.jsx(x.FormProvider,E(E({},s),{},{children:a.jsxs("form",{onSubmit:n(e.handleSignUp),children:[a.jsx(U,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(I.default,{})}),helperText:null===(t=i.fullName)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.default,{})}),rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(r=i.email)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(l=i.password)||void 0===l?void 0:l.message}),a.jsx(j.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(T.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};Z.propTypes={theme:v.default.oneOf(["secondary","primary"])};U.propTypes={theme:v.default.oneOf(["secondary","primary"]),viaApplePay:v.default.bool,viaGooglePay:v.default.bool,viaSTCPay:v.default.bool,viaCreditCard:v.default.bool,viaPayPal:v.default.bool,handleApplePay:v.default.func};exports.ChargeWalletForm=function(t){var r,l=G(e.useState(0),2),s=l[0],i=l[1],n=x.useForm(),o=n.formState.errors,d=n.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",children:[a.jsxs(T.default,{align:"center",variant:"h1",children:[Number(s).toLocaleString("en")||"0",a.jsx(T.default,{children:t.currency||"SAR"})]}),a.jsx(x.FormProvider,E(E({},n),{},{children:a.jsxs("form",{onChange:function(e){e.preventDefault(),i(n.getValues().amount)},style:{marginTop:10},onSubmit:d(t.handleChargeWallet),children:[a.jsx(U,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:s,rules:{required:"Password is rquired"},helperText:null===(r=o.amount)||void 0===r?void 0:r.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CreditCardForm=function(e){var t,r,l=x.useForm(),i=l.formState.errors,n=l.handleSubmit;return a.jsx(s.Container,{maxWidth:"xs",children:a.jsx(x.FormProvider,E(E({},l),{},{children:a.jsxs("form",{onSubmit:n(e.handle),children:[a.jsx(U,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=i.password)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=i.password)||void 0===r?void 0:r.message}),a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r,l,s=G(e.useState(""),2),i=s[0],n=s[1],o=x.useForm(),d=o.formState.errors,u=o.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[t.error&&a.jsx(M,{text:"This is a new password alert",severity:"error"}),t.passwordChanged?a.jsx(R,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(x.FormProvider,E(E({},o),{},{children:a.jsxs("form",{onSubmit:u(t.handleNewPassword),children:[a.jsx(U,{fullWidth:!0,name:"password",type:"password",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,onChange:function(e){return n(e.target.value)},value:i,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:t.texts.passwordRequiredText},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:t.texts.confirmPasswordPlaceholder,label:t.texts.confirmPasswordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(l=d.confirmPassword)||void 0===l?void 0:l.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return a.jsxs(s.Container,{maxWidth:"xs",children:[a.jsx(s.Typography,{align:"center",children:"Wallet Balance"}),a.jsxs(s.Typography,{align:"center",variant:"h1",children:[e.walletBalance||"0",a.jsx(s.Typography,{children:e.currency||"SAR"})]}),a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=x.useForm(),l=r.formState.errors,s=r.handleSubmit;return r.getValues,r.register,r.watch,r.reset,r.setValue,a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(Alert,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a.jsx(R,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsx(x.FormProvider,E(E({},r),{},{children:a.jsxs("form",{onSubmit:s(e.handleResetPassword),children:[a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.default,{})}),rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(t=l.email)||void 0===t?void 0:t.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},exports.SelectPayment=function(e){return a.jsxs(s.Container,{maxWidth:"xs",children:[a.jsx(R,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(D,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(D,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(D,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(D,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(D,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(D,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(D,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t,r,l=x.useForm(),s=l.formState.errors,i=l.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(W.default,{severity:"error",children:[e.errorTitle&&a.jsx(A.default,{children:e.errorTitle}),e.errorText]}),a.jsx(x.FormProvider,E(E({},l),{},{children:a.jsxs("form",{onSubmit:i(e.handleSignIn),children:[a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.default,{})}),rules:{required:e.texts.emailRequired,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}},helperText:null===(t=s.email)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(r=s.password)||void 0===r?void 0:r.message}),a.jsx(T.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),a.jsxs(T.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=Z,exports.UserProfileForm=function(e){var t,r,l,s,i=x.useForm(),n=i.formState.errors;return a.jsx(w.default,{maxWidth:"sm",children:a.jsx(x.FormProvider,E(E({},i),{},{children:a.jsxs("form",{children:[a.jsx(U,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(t=n.fullName)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(r=n.email)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(l=n.password)||void 0===l?void 0:l.message}),a.jsx(U,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(s=n.confirmPassword)||void 0===s?void 0:s.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return a.jsxs(s.Container,{maxWidth:"sm",children:[e.children,a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),a=require("react/jsx-runtime"),i=require("@mui/material");require("@mui/icons-material/MoveToInbox");var l=require("@mui/material/AppBar");require("@mui/material/Box"),require("@mui/material/Toolbar"),require("@mui/material/IconButton");var n=require("@mui/material/Typography");require("@mui/material/Menu"),require("@mui/icons-material/Menu");var s=require("@mui/material/Container");require("@mui/material/Avatar"),require("@mui/material/MenuItem"),require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox"),require("@mui/icons-material/CheckCircleOutlined");var o=require("@mui/material/Input"),u=require("@mui/material/InputLabel"),d=require("@mui/icons-material/GitHub"),m=require("@mui/icons-material/Twitter"),c=require("@mui/icons-material/AccountBalanceWallet"),p=require("@mui/material/Alert"),x=require("@mui/material/AlertTitle"),h=require("react-hook-form"),f=require("@mui/material/InputAdornment"),g=require("@mui/icons-material/HttpsOutlined"),v=require("@mui/icons-material/MailOutline"),b=require("@mui/icons-material/PermIdentityOutlined"),y=require("@mui/material/styles"),j=require("@mui/material/Drawer");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@mui/material/List"),require("@mui/material/Divider"),require("@mui/icons-material/ChevronLeft"),require("@mui/icons-material/ChevronRight"),require("@mui/material/ListItemButton"),require("@mui/material/ListItemIcon"),require("@mui/material/ListItemText"),require("@mui/icons-material/Mail");var T=w(t),q=w(r),P=w(l),C=w(n),S=w(s),k=w(o),W=w(u),A=w(d),L=w(m),I=w(c),F=w(p),O=w(x),N=w(f),z=w(g),B=w(v),E=w(b),R=w(j);function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach((function(t){U(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function U(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,i,l=[],n=!0,s=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(l.push(a.value),!t||l.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{n||null==r.return||r.return()}finally{if(s)throw i}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}q.default.string,q.default.bool;var $=function(e){return a.jsx(C.default,G(G({},e),{},{children:e.children}))},_=function(e){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a.jsx(W.default,{children:e.label}),e.helperText&&a.jsx(i.Typography,{variant:"validation",children:e.helperText})]}),a.jsx(k.default,G({disableUnderline:!0},e))]})};q.default.oneOf(["text","number","password"]),q.default.string;var V=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=a.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=a.jsx(A.default,{});break;case"twitter":r=a.jsx(L.default,{});break;case"mada":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=a.jsx(I.default,{})}return a.jsxs(T.default,G(G({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(i.Typography,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},H=function(e){return a.jsxs(F.default,G(G({},e),{},{children:[e.title&&a.jsx(O.default,{children:e.title}),e.text]}))},X=function(e){var t=h.useForm(),r=t.formState.errors,i=t.handleSubmit,l=t.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(F.default,{severity:"error",children:[e.errorTitle&&a.jsx(O.default,{children:e.errorTitle}),e.errorText]}),a.jsx(h.FormProvider,G(G({},t),{},{children:a.jsxs("form",{onSubmit:i(e.handleSignUp),children:[a.jsx(h.Controller,{control:l,name:"fullName",render:function(t){var i,l,n=t.field;return a.jsx(_,{fullWidth:!0,type:"text",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(l=r.fullName)||void 0===l?void 0:l.message,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(E.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a.jsx(h.Controller,{control:l,name:"email",render:function(t){var i,l,n=t.field;return a.jsx(_,{fullWidth:!0,type:"text",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.emailLabel,helperText:null===(l=r.email)||void 0===l?void 0:l.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(B.default,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(h.Controller,{control:l,name:"password",render:function(t){var i,l,n,s=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",defaultValue:null!==(i=s.value)&&void 0!==i?i:"",value:null!==(l=s.value)&&void 0!==l?l:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(z.default,{})})},s))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(T.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(C.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(V,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(V,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(V,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};X.propTypes={theme:q.default.oneOf(["secondary","primary"])};_.propTypes={theme:q.default.oneOf(["secondary","primary"]),viaApplePay:q.default.bool,viaGooglePay:q.default.bool,viaSTCPay:q.default.bool,viaCreditCard:q.default.bool,viaPayPal:q.default.bool,handleApplePay:q.default.func};var Y=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},J=function(e){return U({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})};y.styled("div")((function(e){var t=e.theme;return G({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),y.styled(P.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return G({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),y.styled(R.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return G(G({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&G(G({},Y(t)),{},{"& .MuiDrawer-paper":Y(t)})),!r&&G(G({},J(t)),{},{"& .MuiDrawer-paper":J(t)}))}));exports.ChargeWalletForm=function(t){var r,i=D(e.useState(0),2),l=i[0],n=i[1],s=h.useForm(),o=s.formState.errors,u=s.handleSubmit;return a.jsxs(S.default,{maxWidth:"xs",children:[a.jsxs(C.default,{align:"center",variant:"h1",children:[Number(l).toLocaleString("en")||"0",a.jsx(C.default,{children:t.currency||"SAR"})]}),a.jsx(h.FormProvider,G(G({},s),{},{children:a.jsxs("form",{onChange:function(e){e.preventDefault(),n(s.getValues().amount)},style:{marginTop:10},onSubmit:u(t.handleChargeWallet),children:[a.jsx(_,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:l,rules:{required:"Password is rquired"},helperText:null===(r=o.amount)||void 0===r?void 0:r.message}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CreditCardForm=function(e){var t,r,l=h.useForm(),n=l.formState.errors,s=l.handleSubmit;return a.jsx(i.Container,{maxWidth:"xs",children:a.jsx(h.FormProvider,G(G({},l),{},{children:a.jsxs("form",{onSubmit:s(e.handle),children:[a.jsx(_,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(_,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a.jsx(i.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r=D(e.useState(""),2);r[0],r[1];var i=D(e.useState(""),2);i[0],i[1];var l=D(e.useState(!1),2),n=l[0],s=l[1],o=h.useForm(),u=o.formState.errors,d=o.handleSubmit,m=o.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[n&&a.jsx(H,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?a.jsx($,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(h.FormProvider,G(G({},o),{},{children:a.jsxs("form",{onSubmit:d((function(e){console.log("handling subb",e),e.password===e.confirmPassword?t.handleNewPassword():s(!0)})),children:[a.jsx(h.Controller,{control:m,name:"password",render:function(e){var r,i,l=e.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(r=l.value)&&void 0!==r?r:"",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,helperText:null===(i=u.password)||void 0===i?void 0:i.message,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(z.default,{})})},l))},rules:{required:t.texts.passwordRequiredText}}),a.jsx(h.Controller,{control:m,name:"confirmPassword",render:function(e){var r,i,l=e.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(r=l.value)&&void 0!==r?r:"",label:t.texts.confirmPasswordLabel,placeholder:t.texts.confirmPasswordPlaceholder,helperText:null===(i=u.confirmPassword)||void 0===i?void 0:i.message,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(z.default,{})})},l))},rules:{required:t.texts.confirmPasswordRequiredText}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return a.jsxs(i.Container,{maxWidth:"xs",children:[a.jsx(i.Typography,{align:"center",children:"Wallet Balance"}),a.jsxs(i.Typography,{align:"center",variant:"h1",children:[e.walletBalance||"0",a.jsx(i.Typography,{children:e.currency||"SAR"})]}),a.jsx(i.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=h.useForm(),i=r.formState.errors,l=r.handleSubmit;r.register;var n=r.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(Alert,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a.jsx($,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsxs("form",{onSubmit:l(e.handleResetPassword),children:[console.log("eror ",null===(t=i.email)||void 0===t?void 0:t.message),a.jsx(h.Controller,{control:n,name:"email",render:function(t){var r,l,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(l=i.email)||void 0===l?void 0:l.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(B.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},exports.SelectPayment=function(e){return a.jsxs(i.Container,{maxWidth:"xs",children:[a.jsx($,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(V,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(V,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(V,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(V,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(V,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(V,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(V,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=h.useForm(),r=t.formState.errors,i=t.handleSubmit;t.register;var l=t.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(F.default,{severity:"error",children:[e.errorTitle&&a.jsx(O.default,{children:e.errorTitle}),e.errorText]}),a.jsxs("form",{onSubmit:i(e.handleSignIn),children:[a.jsx(h.Controller,{control:l,name:"email",render:function(t){var i,l,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.emailLabel,helperText:null===(l=r.email)||void 0===l?void 0:l.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(B.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(h.Controller,{control:l,name:"password",render:function(t){var i,l,n,s=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",defaultValue:null!==(i=s.value)&&void 0!==i?i:"",value:null!==(l=s.value)&&void 0!==l?l:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:a.jsx(N.default,{position:"start",children:a.jsx(z.default,{})})},s))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(C.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),a.jsxs(C.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(V,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(V,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(V,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=X,exports.UserProfileForm=function(e){var t,r,i,l,n=h.useForm(),s=n.formState.errors;return a.jsx(S.default,{maxWidth:"sm",children:a.jsx(h.FormProvider,G(G({},n),{},{children:a.jsxs("form",{children:[a.jsx(_,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(t=s.fullName)||void 0===t?void 0:t.message}),a.jsx(_,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a.jsx(_,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(r=s.email)||void 0===r?void 0:r.message}),a.jsx(_,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(i=s.password)||void 0===i?void 0:i.message}),a.jsx(_,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(l=s.confirmPassword)||void 0===l?void 0:l.message}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return a.jsxs(i.Container,{maxWidth:"sm",children:[e.children,a.jsx(i.Button,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -1,30 +1,35 @@
1
1
  import React, { useState } from "react";
2
- import { Box } from "../../layout";
3
- import {
4
- ActionButton,
5
- HawaTextField,
6
- HawaAlert,
7
- HawaTypography
8
- } from "../../elements";
9
- import { FormProvider, useForm } from "react-hook-form";
2
+ import { HawaTextField, HawaAlert, HawaTypography } from "../../elements";
3
+ import { Controller, FormProvider, useForm } from "react-hook-form";
10
4
  import InputAdornment from "@mui/material/InputAdornment";
11
5
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
12
6
  import Container from "@mui/material/Container";
13
7
  import Button from "@mui/material/Button";
14
- import Alert from "@mui/material/Alert";
15
8
 
16
9
  export const NewPasswordForm = (props) => {
17
10
  const [newPassword, setNewPassword] = useState("");
11
+ const [confirmPassword, setConfirmPassword] = useState("");
12
+ const [matchError, setMatchError] = useState(false);
18
13
  const methods = useForm();
19
14
  const {
20
15
  formState: { errors },
21
- handleSubmit
16
+ handleSubmit,
17
+ control
22
18
  } = methods;
23
19
 
20
+ const handleSubmission = (e) => {
21
+ console.log("handling subb", e);
22
+ if (e.password === e.confirmPassword) {
23
+ props.handleNewPassword();
24
+ } else {
25
+ setMatchError(true);
26
+ }
27
+ };
28
+
24
29
  return (
25
30
  <Container maxWidth="xs" variant="auth">
26
- {props.error && (
27
- <HawaAlert text="This is a new password alert" severity="error" />
31
+ {matchError && (
32
+ <HawaAlert text={props.texts.passwordMatchError} severity="error" />
28
33
  )}
29
34
  {props.passwordChanged ? (
30
35
  <HawaTypography style={{ textAlign: "center", margin: 5 }}>
@@ -32,40 +37,54 @@ export const NewPasswordForm = (props) => {
32
37
  </HawaTypography>
33
38
  ) : (
34
39
  <FormProvider {...methods}>
35
- <form onSubmit={handleSubmit(props.handleNewPassword)}>
36
- <HawaTextField
37
- fullWidth
40
+ <form onSubmit={handleSubmit(handleSubmission)}>
41
+ <Controller
42
+ control={control}
38
43
  name="password"
39
- type="password"
40
- label={props.texts.passwordLabel}
41
- placeholder={props.texts.passwordPlaceholder}
42
- onChange={(e) => setNewPassword(e.target.value)}
43
- value={newPassword}
44
- startAdornment={
45
- <InputAdornment position="start">
46
- <PasswordIcon />
47
- </InputAdornment>
48
- }
44
+ render={({ field }) => (
45
+ <HawaTextField
46
+ fullWidth
47
+ type="password"
48
+ value={field.value ?? ""}
49
+ label={props.texts.passwordLabel}
50
+ placeholder={props.texts.passwordPlaceholder}
51
+ // onChange={(e) => setNewPassword(e.target.value)}
52
+ helperText={errors.password?.message}
53
+ startAdornment={
54
+ <InputAdornment position="start">
55
+ <PasswordIcon />
56
+ </InputAdornment>
57
+ }
58
+ {...field}
59
+ />
60
+ )}
49
61
  rules={{
50
62
  required: props.texts.passwordRequiredText
51
63
  }}
52
- helperText={errors.password?.message}
53
64
  />
54
- <HawaTextField
55
- fullWidth
65
+ <Controller
66
+ control={control}
56
67
  name="confirmPassword"
57
- type="password"
58
- placeholder={props.texts.confirmPasswordPlaceholder}
59
- label={props.texts.confirmPasswordLabel}
60
- startAdornment={
61
- <InputAdornment position="start">
62
- <PasswordIcon />
63
- </InputAdornment>
64
- }
68
+ render={({ field }) => (
69
+ <HawaTextField
70
+ fullWidth
71
+ type="password"
72
+ value={field.value ?? ""}
73
+ label={props.texts.confirmPasswordLabel}
74
+ placeholder={props.texts.confirmPasswordPlaceholder}
75
+ // onChange={(e) => setConfirmPassword(e.target.value)}
76
+ helperText={errors.confirmPassword?.message}
77
+ startAdornment={
78
+ <InputAdornment position="start">
79
+ <PasswordIcon />
80
+ </InputAdornment>
81
+ }
82
+ {...field}
83
+ />
84
+ )}
65
85
  rules={{
66
- required: "Password is rquired"
86
+ required: props.texts.confirmPasswordRequiredText
67
87
  }}
68
- helperText={errors.confirmPassword?.message}
69
88
  />
70
89
 
71
90
  <Button type="submit" fullWidth variant="last">
@@ -1,12 +1,6 @@
1
1
  import React from "react";
2
- import { FormProvider, useForm } from "react-hook-form";
3
- import { Box } from "../../layout";
4
- import {
5
- HawaTextField,
6
- ActionButton,
7
- HawaAlert,
8
- HawaTypography
9
- } from "../../elements";
2
+ import { Controller, useForm } from "react-hook-form";
3
+ import { HawaTextField, HawaTypography } from "../../elements";
10
4
  import InputAdornment from "@mui/material/InputAdornment";
11
5
  import EmailIcon from "@mui/icons-material/MailOutline";
12
6
  import Container from "@mui/material/Container";
@@ -17,11 +11,8 @@ export const ResetPasswordForm = (props) => {
17
11
  const {
18
12
  formState: { errors },
19
13
  handleSubmit,
20
- getValues,
21
14
  register,
22
- watch,
23
- reset,
24
- setValue
15
+ control
25
16
  } = methods;
26
17
  return (
27
18
  <Container maxWidth="xs" variant="auth">
@@ -32,34 +23,40 @@ export const ResetPasswordForm = (props) => {
32
23
  </Alert>
33
24
  )}
34
25
  {!props.sent ? (
35
- <FormProvider {...methods}>
36
- <form onSubmit={handleSubmit(props.handleResetPassword)}>
37
- <HawaTextField
38
- fullWidth
39
- type="text"
40
- name="email"
41
- label={props.texts.emailLabel}
42
- placeholder={props.texts.emailPlaceholder}
43
- startAdornment={
44
- <InputAdornment position="start">
45
- <EmailIcon />
46
- </InputAdornment>
47
- }
48
- rules={{
49
- required: props.texts.emailRequiredText,
50
- pattern: {
51
- value:
52
- /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
53
- message: props.texts.emailInvalidText
26
+ <form onSubmit={handleSubmit(props.handleResetPassword)}>
27
+ {console.log("eror ", errors.email?.message)}
28
+ <Controller
29
+ control={control}
30
+ name="email"
31
+ render={({ field }) => (
32
+ <HawaTextField
33
+ fullWidth
34
+ type="text"
35
+ value={field.value ?? ""}
36
+ label={props.texts.emailLabel}
37
+ helperText={errors.email?.message}
38
+ placeholder={props.texts.emailPlaceholder}
39
+ startAdornment={
40
+ <InputAdornment position="start">
41
+ <EmailIcon />
42
+ </InputAdornment>
54
43
  }
55
- }}
56
- helperText={errors.email?.message}
57
- />
58
- <Button type="submit" fullWidth variant="last">
59
- {props.texts.resetPassword}
60
- </Button>
61
- </form>
62
- </FormProvider>
44
+ {...field}
45
+ />
46
+ )}
47
+ rules={{
48
+ required: props.texts.emailRequiredText,
49
+ pattern: {
50
+ value:
51
+ /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
52
+ message: props.texts.emailInvalidText
53
+ }
54
+ }}
55
+ />
56
+ <Button type="submit" fullWidth variant="last">
57
+ {props.texts.resetPassword}
58
+ </Button>
59
+ </form>
63
60
  ) : (
64
61
  <HawaTypography style={{ textAlign: "center", margin: 5 }}>
65
62
  An link was sent to your email to reset the password.
@@ -1,6 +1,6 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import { HawaTextField, HawaLogoButton } from "../../elements";
3
- import { FormProvider, useForm } from "react-hook-form";
3
+ import { Controller, FormProvider, useForm } from "react-hook-form";
4
4
  import InputAdornment from "@mui/material/InputAdornment";
5
5
  import EmailIcon from "@mui/icons-material/MailOutline";
6
6
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
@@ -14,7 +14,9 @@ export const SignInForm = (props) => {
14
14
  const methods = useForm();
15
15
  const {
16
16
  formState: { errors },
17
- handleSubmit
17
+ handleSubmit,
18
+ register,
19
+ control
18
20
  } = methods;
19
21
 
20
22
  return (
@@ -25,63 +27,74 @@ export const SignInForm = (props) => {
25
27
  {props.errorText}
26
28
  </Alert>
27
29
  )}
28
- <FormProvider {...methods}>
29
- <form onSubmit={handleSubmit(props.handleSignIn)}>
30
- <HawaTextField
31
- fullWidth
32
- type="text"
33
- name="email"
34
- label={props.texts.emailLabel}
35
- placeholder={props.texts.emailPlaceholder}
36
- startAdornment={
37
- <InputAdornment position="start">
38
- <EmailIcon />
39
- </InputAdornment>
40
- }
41
- rules={{
42
- required: props.texts.emailRequired,
43
- pattern: {
44
- value:
45
- /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
46
- message: props.texts.emailInvalidText
30
+ <form onSubmit={handleSubmit(props.handleSignIn)}>
31
+ <Controller
32
+ control={control}
33
+ name="email"
34
+ render={({ field }) => (
35
+ <HawaTextField
36
+ fullWidth
37
+ type="text"
38
+ value={field.value ?? ""}
39
+ label={props.texts.emailLabel}
40
+ helperText={errors.email?.message}
41
+ placeholder={props.texts.emailPlaceholder}
42
+ startAdornment={
43
+ <InputAdornment position="start">
44
+ <EmailIcon />
45
+ </InputAdornment>
47
46
  }
48
- }}
49
- helperText={errors.email?.message}
50
- />
51
-
52
- <HawaTextField
53
- fullWidth
54
- name="password"
55
- placeholder={props.texts.passwordPlaceholder}
56
- type="password"
57
- label={props.texts.passwordLabel}
58
- startAdornment={
59
- <InputAdornment position="start">
60
- <PasswordIcon />
61
- </InputAdornment>
47
+ {...field}
48
+ />
49
+ )}
50
+ rules={{
51
+ required: props.texts.emailRequiredText,
52
+ pattern: {
53
+ value:
54
+ /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
55
+ message: props.texts.emailInvalidText
62
56
  }
63
- rules={{
64
- required: props.texts.passwordRequired
65
- }}
66
- helperText={errors.password?.message}
67
- />
68
- <Typography
69
- style={{
70
- cursor: "pointer",
71
- marginTop: 5,
72
- width: "max-content",
73
- fontSize: 15,
74
- padding: 5
75
- }}
76
- onClick={props.handleForgotPassword}
77
- >
78
- {props.texts.forgotPasswordText}
79
- </Typography>
80
- <Button type="submit" fullWidth variant="last">
81
- {props.texts.signInText}
82
- </Button>
83
- </form>
84
- </FormProvider>
57
+ }}
58
+ />
59
+
60
+ <Controller
61
+ control={control}
62
+ name="password"
63
+ render={({ field }) => (
64
+ <HawaTextField
65
+ fullWidth
66
+ type="password"
67
+ defaultValue={field.value ?? ""}
68
+ value={field.value ?? ""}
69
+ label={props.texts.passwordLabel}
70
+ placeholder={props.texts.passwordPlaceholder}
71
+ helperText={errors.password?.message}
72
+ startAdornment={
73
+ <InputAdornment position="start">
74
+ <PasswordIcon />
75
+ </InputAdornment>
76
+ }
77
+ {...field}
78
+ />
79
+ )}
80
+ rules={{ required: props.texts.passwordRequiredText }}
81
+ />
82
+ <Typography
83
+ style={{
84
+ cursor: "pointer",
85
+ marginTop: 5,
86
+ width: "max-content",
87
+ fontSize: 15,
88
+ padding: 5
89
+ }}
90
+ onClick={props.handleForgotPassword}
91
+ >
92
+ {props.texts.forgotPasswordText}
93
+ </Typography>
94
+ <Button type="submit" fullWidth variant="last">
95
+ {props.texts.signInText}
96
+ </Button>
97
+ </form>
85
98
  <Typography
86
99
  variant="subtitle2"
87
100
  style={{ marginTop: 5, textAlign: "center", padding: 5 }}