@sikka/hawa 0.0.5 → 0.0.8
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/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +4 -5
- package/src/blocks/Account/UserProfile.js +57 -7
- package/src/blocks/AuthForms/NewPasswordForm.js +100 -17
- package/src/blocks/AuthForms/ResetPasswordForm.js +61 -5
- package/src/blocks/AuthForms/SignInForm.js +101 -26
- package/src/blocks/AuthForms/SignUpForm.js +113 -32
- package/src/blocks/Payment/ChargeWalletForm.js +53 -0
- package/src/blocks/Payment/CreditCardForm.js +50 -21
- package/src/blocks/Payment/PayWithWallet.js +14 -0
- package/src/blocks/Payment/SelectPayment.js +20 -42
- package/src/blocks/Payment/index.js +2 -0
- package/src/layout/Box.js +9 -10
- package/src/stories/BlocksStories/AuthForm.stories.js +18 -12
- package/src/stories/BlocksStories/PaymentForm.stories.js +15 -40
- package/src/stories/BlocksStories/UserForm.stories.js +41 -0
- package/src/stories/{Introduction.stories.js → Introduction.stories.mdx} +45 -27
- package/src/stories/LayoutStories/Box.stories.js +4 -4
- package/src/stories/{ActionButton.stories.js → UIStories/ActionButton.stories.js} +16 -23
- package/src/stories/UIStories/AdaptiveButton.stories.js +81 -0
- package/src/stories/UIStories/Alert.stories.js +42 -0
- package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
- package/src/stories/UIStories/InputLabel.stories.js +13 -0
- package/src/stories/UIStories/LogoButtons.stories.js +90 -0
- package/src/stories/UIStories/RadioSelector.stories.js +53 -0
- package/src/stories/UIStories/SettingsRow.stories.js +64 -0
- package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
- package/src/themes/HawaProvider.js +107 -11
- package/src/ui/ActionButton.js +12 -11
- package/src/ui/AdaptiveButton.js +43 -159
- package/src/ui/HawaAlert.js +37 -0
- package/src/ui/HawaButton.js +48 -0
- package/src/ui/{Checkbox.js → HawaCheckbox.js} +1 -1
- package/src/ui/HawaInputLabel.js +4 -5
- package/src/ui/HawaLogoButton.js +138 -0
- package/src/ui/HawaRadio.js +73 -0
- package/src/ui/HawaSettingsRow.js +71 -0
- package/src/ui/HawaTextField.js +69 -80
- package/src/ui/HawaTypography.js +28 -0
- package/src/ui/index.js +9 -19
- package/storybook-static/{1.95be85dd.iframe.bundle.js → 0.0d994c92.iframe.bundle.js} +3 -3
- package/storybook-static/{1.95be85dd.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
- package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
- package/storybook-static/{3.d72f7fac.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
- package/storybook-static/{7.ffb0d84b.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
- package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
- package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
- package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.5731dbe3.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt → vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +1 -0
- package/src/stories/AdaptiveButton.stories.js +0 -80
- package/src/stories/Alert.stories.js +0 -41
- package/src/stories/BlocksStories/UserAccount.stories.js +0 -46
- package/src/stories/GlobalVariables.stories.js +0 -44
- package/src/stories/InputLabel.stories.js +0 -92
- package/src/stories/RadioSelector.stories.js +0 -69
- package/src/ui/ApplePayButton.js +0 -94
- package/src/ui/GithubButton.js +0 -91
- package/src/ui/GoogleButton.js +0 -83
- package/src/ui/GooglePayButton.js +0 -94
- package/src/ui/MadaButton.js +0 -94
- package/src/ui/PayPalButton.js +0 -94
- package/src/ui/RadioSelector.js +0 -51
- package/src/ui/STCPayButton.js +0 -94
- package/src/ui/StyledAlert.js +0 -30
- package/src/ui/TwitterButton.js +0 -84
- package/src/ui/VisaMasterButton.js +0 -94
- package/src/ui/WalletButton.js +0 -91
- package/storybook-static/0.54f7e52e.iframe.bundle.js +0 -1
- package/storybook-static/1.95be85dd.iframe.bundle.js.map +0 -1
- package/storybook-static/2.eb601582.iframe.bundle.js +0 -1
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
- package/storybook-static/main.044648aa.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.3e280e98.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js.map +0 -1
package/es/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{createContext as t,useContext as o}from"react";import r from"@mui/material/Button";import n,{jsx as i,jsxs as a,Fragment as l}from"react/jsx-runtime";import{darken as d,styled as c,alpha as u}from"@mui/material/styles";import s from"@mui/material/InputBase";import p from"prop-types";import f from"@mui/material/InputLabel";import h from"@mui/material/utils";function m(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function b(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?m(Object(o),!0).forEach((function(t){g(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):m(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function g(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var y=t({borderRadius:10,primaryColor:"blue",secondaryColor:"grey",primaryActionColor:"grey",secondaryActionColor:"#4cc9f0",layoutColor:"#d3d4d9",textColor:"black",inputColor:"white",lightBackground:"#FBF5F3",darkBackground:"#0F0E0E",margins:10,paddings:10,allBorderRadius:10,actionButton:{primary:{borderRadius:10,backgroundColor:"#f90900",color:"white",margin:10,padding:10},secondary:{borderRadius:10,margin:10,padding:10,backgroundColor:"#FF8811",color:"black"}},layout:{primary:{backgroundColor:"#d3d4d9",color:"black",margin:10,padding:10,borderRadius:10},secondary:{backgroundColor:"#001E3C",color:"white",margin:10,padding:10,borderRadius:10}},inputFields:{primary:{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",borderRadius:10},secondary:{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",borderRadius:10}}}),v=function(e){var t,n=o(y),a=Object.keys(n.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())})),l={};a?l=b(b({},n.actionButton[a]),{},{margin:e.last?0:n.actionButton[a].margin,marginTop:e.last?2*n.actionButton[a].margin:0,"&:hover":{backgroundColor:d(null===(t=n.actionButton[a])||void 0===t?void 0:t.backgroundColor,.1)}}):l={backgroundColor:"black",color:"white",padding:10,marginTop:e.last?20:0};var u=c(r)((function(e){return e.theme,b({},l)}));return i(u,b(b({},e),{},{children:e.text}))},C=function(e){var t=o(y),r={};console.log(Object.keys(t.actionButton));var n=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));return r=n?{margin:15,marginRight:5,marginLeft:5,color:t.layout[n].color}:{margin:15,marginRight:0,marginLeft:0,color:"black"},i(f,{style:r,children:i("div",{style:{fontSize:15},children:e.label})})},k=function(e){var t=o(y),r=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())})),n={};n=r?b(b({},t.inputFields[r]),{},{margin:e.last?0:t.inputFields[r].margin,marginTop:e.last?2*t.inputFields[r].margin:0}):{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"};var d=c(s)((function(e){var t=e.theme;return{"& .MuiInputBase-input":b({backgroundColor:"light"===t.palette.mode?"#fcfcfb":"#2b2b2b",transition:t.transitions.create(["border-color","background-color","box-shadow"]),"&:focus":{boxShadow:"".concat(u(t.palette.primary.main,.25)," 0 0 0 0.2rem"),borderColor:t.palette.primary.main},borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,padding:"10px 12px"},n)}}));return a(l,{children:[e.inputLabel?i(C,{themeType:e.themeType,label:e.inputLabel}):null,i(d,{fullWidth:!0,"aria-label":"dws"})]})};k.propTypes={type:p.oneOf(["text","number"]),helperText:p.string};var x,w=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.layout[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.layout[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"}),i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},T={},j={exports:{}};(x=j).exports=function(e){return e&&e.__esModule?e:{default:e}},x.exports.__esModule=!0,x.exports.default=x.exports;var O={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=h}(O);var L=j.exports;Object.defineProperty(T,"__esModule",{value:!0});var R=T.default=void 0;!function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=B(t);if(o&&o.has(e))return o.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,o&&o.set(e,r)}(e);var P=n;function B(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(B=function(e){return e?o:t})(e)}var S=(0,L(O).default)((0,P.jsx)("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"}),"GitHub");R=T.default=S;var I=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i(R,{}),i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},M={},D=j.exports;Object.defineProperty(M,"__esModule",{value:!0});var z=M.default=void 0;!function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=F(t);if(o&&o.has(e))return o.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,o&&o.set(e,r)}(e);var W=n;function F(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(F=function(e){return e?o:t})(e)}var A=(0,D(O).default)((0,W.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"}),"Twitter");z=M.default=A;var _=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.layout[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.layout[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i(z,{}),i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},G=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},E=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:30})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},U=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:30})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},N=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:30})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},H=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},V=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:30})," ",i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},q={},J=j.exports;Object.defineProperty(q,"__esModule",{value:!0});var K=q.default=void 0,Q=n,X=(0,J(O).default)((0,Q.jsx)("path",{d:"M21 18v1c0 1.1-.9 2-2 2H5c-1.11 0-2-.9-2-2V5c0-1.1.89-2 2-2h14c1.1 0 2 .9 2 2v1h-9c-1.11 0-2 .9-2 2v8c0 1.1.89 2 2 2h9zm-9-2h10V8H12v8zm4-2.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"AccountBalanceWallet");K=q.default=X;var Y=function(e){var t=o(y),n={};console.log(Object.keys(t.actionButton));var l=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));n=l?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:t.actionButton[l].margin,border:e.outlined?"2px solid black":"none",borderRadius:t.actionButton[l].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:t.margins,border:e.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var u=c(r)((function(e){var t=e.theme;return b(b({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},n),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return a(u,{onClick:e.handleClick,children:[i(K,{}),i("div",{style:{width:10}}),i("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]})},Z=function(e){var t=o(y),r={};console.log(Object.keys(t.actionButton));var n=Object.keys(t.actionButton).find((function(t){var o;return t.toLowerCase()===(null===(o=e.themeType)||void 0===o?void 0:o.toLowerCase())}));return r=n?b(b({display:"flex",flexDirection:"column"},t.layout[n]),{},{backgroundColor:e.noColor?"none":t.layout[n].backgroundColor,padding:e.noPadding?0:t.layout[n].padding,margin:e.noMargin?0:t.layout[n].margin,maxWidth:e.maxWidth}):{display:"flex",flexDirection:"column",color:"white",marginTop:e.last?20:0,backgroundColor:e.noColor?"none":"lightGrey",padding:e.noPadding?0:10,margin:e.noMargin?0:10,maxWidth:e.maxWidth,borderRadius:0},i("div",{style:r,children:e.children})},$=function(e){return a(Z,{maxWidth:400,children:[i(C,{type:"text",inputLabel:"First Name"}),i(C,{type:"text",inputLabel:"Last Name"}),i(C,{type:"email",inputLabel:"Email"}),i(C,{type:"password",inputLabel:"Password"}),i(v,{last:!0,text:"Update Account"})]})},ee=function(e){return a(Z,{maxWidth:400,children:[i(k,{type:"text",inputLabel:"First Name"}),i(k,{type:"text",inputLabel:"Last Name"}),i(k,{type:"email",inputLabel:"Email"}),i(k,{type:"password",inputLabel:"Password"}),i(v,{last:!0,text:"Update Account"})]})},te=function(e){return o(y),i(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a(Z,{themeType:e.theme,noMargin:!0,children:[i(k,{themeType:e.theme,type:"password",inputLabel:"Password"}),i(k,{themeType:e.theme,type:"password",inputLabel:"Confirm Password"}),i(v,{themeType:e.theme,last:!0,text:"Reset Password"})]})})},oe=function(e){return i(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a(Z,{themeType:e.theme,noMargin:!0,children:[i(k,{themeType:e.theme,type:"text",inputLabel:"Email"}),i(v,{themeType:e.theme,last:!0,text:"Reset Password"})]})})},re=function(e){return a(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[a(Z,{themeType:e.theme,noMargin:!0,children:[i(k,{themeType:e.theme,type:"text",inputLabel:"Email"}),i(k,{themeType:e.theme,type:"text",inputLabel:"Password"}),i(k,{themeType:e.theme,type:"text",inputLabel:"Confirm Password"}),i(v,{text:"Sign Up",last:!0,themeType:e.theme,onClick:e.handleSignUp})]}),e.viaGoogle&&i(w,{outlined:!0,themeType:e.theme,buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&i(I,{outlined:!0,themeType:e.theme,buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignUp}),e.viaTwitter&&i(_,{outlined:!0,themeType:e.theme,buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})};re.propTypes={theme:p.oneOf(["secondary","primary"])};var ne=function(e){return a(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[a(Z,{themeType:e.theme,noMargin:!0,children:[i(k,{themeType:e.theme,type:"text",inputLabel:"Email"}),i(k,{themeType:e.theme,type:"text",inputLabel:"Password"}),i(v,{last:!0,text:"Sign In",themeType:e.theme,onClick:e.handleSignIn})]}),e.viaGoogle&&i(w,{themeType:e.theme,outlined:!0,buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&i(I,{outlined:!0,themeType:e.theme,buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&i(_,{outlined:!0,themeType:e.theme,buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})},ie=function(e){return i(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a(Z,{themeType:e.theme,noMargin:!0,children:[i("div",{children:"Choose Payment"}),e.viaWallet&&i(Y,{themeType:e.theme,outlined:!0,buttonText:e.walletLabel,handleClick:e.handleWallet}),e.viaCreditCard&&i(G,{themeType:e.theme,outlined:!0,buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&i(E,{themeType:e.theme,outlined:!0,buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&i(U,{themeType:e.theme,outlined:!0,buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&i(N,{themeType:e.theme,outlined:!0,buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&i(V,{themeType:e.theme,outlined:!0,buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&i(H,{themeType:e.theme,outlined:!0,buttonText:e.applePayLabel,handleClick:e.handleApplePay})]})})};k.propTypes={theme:p.oneOf(["secondary","primary"]),viaApplePay:p.bool,viaGooglePay:p.bool,viaSTCPay:p.bool,viaCreditCard:p.bool,viaPayPal:p.bool,handleApplePay:p.func};var ae=function(e){return i(Z,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a(Z,{themeType:e.theme,noMargin:!0,children:[i(k,{themeType:e.theme,type:"text",inputLabel:"Email"}),i(k,{themeType:e.theme,type:"text",inputLabel:"Password"}),i(v,{last:!0,text:"Sign In",themeType:e.theme,onClick:e.handleSignIn})]})})};export{ae as CreditCardForm,te as NewPasswordForm,oe as ResetPasswordForm,ie as SelectPayment,ne as SignInForm,re as SignUpForm,$ as UserProfile,ee as UserSettings};
|
|
1
|
+
import{createContext as e,useContext as r,useState as t}from"react";import o from"@mui/material/Button";import"@mui/material/Tooltip";import a from"prop-types";import{jsx as n,jsxs as i,Fragment as l}from"react/jsx-runtime";import{darken as d,styled as s}from"@mui/material/styles";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import"@mui/material";import"@mui/material/TextField";import u from"@mui/material/Typography";import m from"@mui/icons-material/GitHub";import c from"@mui/icons-material/Twitter";import p from"@mui/icons-material/AccountBalanceWallet";import g from"@mui/material/InputBase";import h from"@mui/material/InputLabel";import{useFormContext as b,Controller as y,useForm as f,FormProvider as w}from"react-hook-form";import v from"@mui/material/Alert";import x from"@mui/material/AlertTitle";import C from"@mui/material/InputAdornment";import k from"@mui/icons-material/HttpsOutlined";import T from"@mui/icons-material/MailOutline";import P from"@mui/icons-material/PermIdentityOutlined";function L(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function S(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?L(Object(t),!0).forEach((function(r){A(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):L(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function A(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function B(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var o,a,n=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(o=t.next()).done)&&(n.push(o.value),!r||n.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw a}}return n}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return O(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return O(e,r)}(e,r)||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,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var W=e({allPrimaryBG:"#f90900",allPrimaryAction:"#138A36",allBorderRadius:10,borderRadius:10,primaryColor:"blue",secondaryColor:"grey",primaryActionColor:"grey",secondaryActionColor:"#4cc9f0",layoutColor:"#d3d4d9",textColor:"black",inputColor:"white",lightBackground:"#FBF5F3",darkBackground:"#0F0E0E",testcolor:"green",margins:10,paddings:10,typography:{fontFamily:["IBMPlex"].join(","),primary:{color:"black"},secondary:{color:"white"}},logoButton:{primary:{borderRadius:10,backgroundColor:"#B20D30",marginTop:10,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",height:50,"&:focus":{borderColor:"#B20D30"}},secondary:{borderRadius:10,backgroundColor:"#f90900",marginTop:10,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",height:50,"&:focus":{borderColor:"green"}}},actionButton:{primary:{borderRadius:10,backgroundColor:"#B20D30",color:"white",margin:10,padding:10,border:"1px solid #ced4da",fontSize:16,height:50,"&:focus":{borderColor:"red"}},secondary:{borderRadius:10,margin:10,padding:10,backgroundColor:"#FF8811",color:"black"}},layout:{primary:{backgroundColor:"#d3d4d9",color:"black",margin:10,padding:10,borderRadius:10},secondary:{backgroundColor:"#001E3C",color:"white",margin:10,padding:10,borderRadius:10}},inputFields:{primary:{backgroundColor:"white",borderRadius:10,"&:focus":{borderColor:"red",borderWidth:1,border:"1px solid black"},"&:hover":{borderColor:"red",borderWidth:1,border:"1px solid black"}},secondary:{backgroundColor:"white",borderRadius:10}},alerts:{primary:{marginBottom:10,padding:10,borderRadius:10},secondary:{marginBottom:10,padding:10,borderRadius:10}},settingsRow:{primary:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"#F5F5F5",margin:0,padding:10,borderRadius:10},secondary:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"blue",margin:0,padding:5,borderRadius:10}},radioSelector:{primary:{padding:10,borderRadius:10},secondary:{padding:10,borderRadius:10}}});a.string,a.bool,a.bool,a.bool;var q=function(e){var t,a=r(W),i=a.hawaTheme,l=a.themeName,u=Object.keys(i.actionButton).find((function(e){return e.toLowerCase()===(null==l?void 0:l.toLowerCase())})),m={};u?m=S(S({},i.actionButton[u]),{},{margin:e.last?0:i.actionButton[u].margin,marginTop:e.last?2*i.actionButton[u].margin:0,"&:hover":{backgroundColor:d(null===(t=i.actionButton[u])||void 0===t?void 0:t.backgroundColor,.1)}}):m={backgroundColor:"black",color:"white",padding:10,marginTop:e.last?20:0,borderRadius:0};var c=s(o)((function(e){return e.theme,S({},m)}));return n(c,S(S({},e),{},{children:e.text}))},E=function(e){var t=r(W),o=t.hawaTheme,a=t.themeName,i={},l=Object.keys(o.layout).find((function(e){return e.toLowerCase()===(null==a?void 0:a.toLowerCase())}));return i=l?S(S({display:"flex",flexDirection:e.horizontal?"row":"column"},o.layout[l]),{},{backgroundColor:e.noColor?"none":o.layout[l].backgroundColor,padding:e.noPadding?0:o.layout[l].padding,margin:e.noMargin?0:o.layout[l].margin,maxWidth:e.maxWidth}):{display:"flex",flexDirection:e.horizontal?"row":"column",color:"white",marginTop:e.last?20:0,backgroundColor:e.noColor?"none":"lightGrey",padding:e.noPadding?0:10,margin:e.noMargin?0:10,maxWidth:e.maxWidth,borderRadius:0},n("div",{style:i,children:e.children})},M=function(e){var t=r(W),o=t.hawaTheme,a=t.themeName,i=Object.keys(o.typography).find((function(e){return e.toLowerCase()===(null==a?void 0:a.toLowerCase())})),l={};l=i?S({},o.typography[i]):{color:"black"};var d=s(u)((function(e){return e.theme,S({},l)}));return n(d,S(S({},e),{},{children:e.children}))};a.oneOf(["text","number","password"]),a.string;var j=function(e){var t,a=r(W),l=a.hawaTheme,u=a.themeName,g={},h=Object.keys(l.logoButton).find((function(e){return e.toLowerCase()===(null==u?void 0:u.toLowerCase())}));g=h?S(S({},l.logoButton[h]),{},{backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}}):{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:10,height:50,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",backgroundColor:"white","&:hover":{backgroundColor:d("#ffffff",.1)}};var b=s(o)((function(e){return e.theme,S({},g)})),y="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":y=n("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":y=n(m,{});break;case"twitter":y=n(c,{});break;case"mada":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":y=n("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":y=n(p,{})}return i(b,S(S({},e),{},{children:[y,n("div",{style:{width:10}}),n("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},F=function(e){var t=r(W),o=t.hawaTheme,a=t.themeName,i={},l=Object.keys(o.actionButton).find((function(e){return e.toLowerCase()===(null==a?void 0:a.toLowerCase())}));return i=l?{margin:15,marginRight:5,marginLeft:5,color:o.layout[l].color}:{margin:15,marginRight:0,marginLeft:0,color:"black"},n(h,{style:i,children:n("div",{style:{fontSize:15},children:e.label})})},I=function(e){var t=b(),o=t.control,a=t.register,d=r(W),m=d.hawaTheme,c=d.themeName,p=Object.keys(m.inputFields).find((function(e){return e.toLowerCase()===(null==c?void 0:c.toLowerCase())})),h={};h=p?S(S({},m.inputFields[p]),{},{margin:e.last?0:m.inputFields[p].margin,marginTop:e.last?2*m.inputFields[p].margin:0}):{backgroundColor:"white"};var f=s(g)((function(r){return S({"& .MuiInputBase-input":{transition:r.theme.transitions.create(["border-color","background-color","box-shadow"])},border:"1px solid #ced4da",fontSize:16,padding:"10px 12px",marginBottom:e.helperText?5:0,paddingLeft:10,paddingRight:10},h)}));return n(y,{render:function(r){var t;return r.field,i(l,{children:[e.inputLabel&&n(F,{label:e.inputLabel}),n(f,S(S({fullWidth:!0,type:null!==(t=e.type)&&void 0!==t?t:"text",defaultValue:e.defaultValue&&"",value:e.value&&""},e),a(e.name))),n(u,{variant:"caption",style:{margin:5,marginBottom:0,color:"red"},children:e.helperText})]})},name:e.name,rules:e.rules,control:o,shouldUnregister:e.shouldUnregister})};I.propTypes={type:a.oneOf(["text","number","password"]),helperText:a.string};var R=function(e){var t=r(W),o=t.hawaTheme,a=t.themeName,l=Object.keys(o.alerts).find((function(e){return e.toLowerCase()===(null==a?void 0:a.toLowerCase())})),d={};d=l?S({},o.alerts[l]):{marginBottom:10};var u=s(v)((function(e){return e.theme,S({},d)}));return i(u,S(S({},e),{},{children:[e.title&&n(x,{children:e.title}),e.text]}))},N=function(e){var r,t,o,a,l=f(),d=l.formState.errors;return l.handleSubmit,n(E,{maxWidth:400,noMargin:!0,children:n(E,{noMargin:!0,noColor:!0,children:n(w,S(S({},l),{},{children:i("form",{children:[n(I,{type:"text",name:"fullName",inputLabel:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(r=d.fullName)||void 0===r?void 0:r.message}),n(I,{type:"text",name:"email",inputLabel:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(t=d.email)||void 0===t?void 0:t.message}),n(I,{type:"password",name:"password",inputLabel:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(o=d.password)||void 0===o?void 0:o.message}),n(I,{type:"password",name:"confirmPassword",inputLabel:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(a=d.confirmPassword)||void 0===a?void 0:a.message}),n(q,{fullWidth:!0,last:!0,text:"Update Account"})]})}))})})},z=function(e){return i(E,{maxWidth:400,children:[n(I,{type:"text",inputLabel:"First Name"}),n(I,{type:"text",inputLabel:"Last Name"}),n(I,{type:"email",inputLabel:"Email"}),n(I,{type:"password",inputLabel:"Password"}),n(q,{last:!0,text:"Update Account"})]})},G=function(e){var r,o,a=B(t(""),2),l=a[0],d=a[1],s=B(t(""),2);s[0],s[1];var u=B(t(!1),2);u[0],u[1];var m=B(t(""),2);m[0],m[1];var c=B(t(!0),2);c[0],c[1];var p=f(),g=p.formState.errors,h=p.handleSubmit;return p.getValues,p.register,p.watch,p.reset,p.setValue,n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:i(E,{noMargin:!0,children:[e.error&&n(R,{text:"This is a new password alert",severity:"error"}),e.passwordChanged?n(M,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):n(w,S(S({},p),{},{children:i("form",{onSubmit:h(e.handleNewPassword),children:[n(I,{name:"password",type:"password",inputLabel:"Choose new password",placeholder:"Enter password",onChange:function(e){return d(e.target.value)},value:l,startAdornment:n(C,{position:"start",children:n(k,{})}),rules:{required:"Password is rquired"},helperText:null===(r=g.password)||void 0===r?void 0:r.message}),n(I,{name:"confirmPassword",type:"password",placeholder:"Confirm Password",inputLabel:"Confirm",startAdornment:n(C,{position:"start",children:n(k,{})}),rules:{required:"Password is rquired"},helperText:null===(o=g.confirmPassword)||void 0===o?void 0:o.message}),n(q,{fullWidth:!0,type:"submit",last:!0,text:"Reset Password"})]})}))]})})},D=function(e){var r,t=f(),o=t.formState.errors,a=t.handleSubmit;return t.getValues,t.register,t.watch,t.reset,t.setValue,n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:i(E,{noMargin:!0,children:[e.error&&n(R,{text:"This is a reset password alert",severity:"error"}),e.sent?n(M,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):n(w,S(S({},t),{},{children:i("form",{onSubmit:a(e.handleResetPassword),children:[n(I,{type:"text",name:"email",inputLabel:"Email",placeholder:"Enter your email",startAdornment:n(C,{position:"start",children:n(T,{})}),rules:{required:"Email is required",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:"Invalid email address"}},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),n(q,{fullWidth:!0,last:!0,type:"submit",text:"Reset Password"})]})}))]})})},V=function(e){var r,t,o,a=f(),l=a.formState.errors,d=a.handleSubmit;return a.getValues,a.register,a.watch,a.reset,a.setValue,i(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[i(E,{noMargin:!0,children:[e.error&&n(R,{text:"This is a sign in alert",severity:"error"}),n(w,S(S({},a),{},{children:i("form",{onSubmit:d(e.handleSignUp),children:[n(I,{name:"fullName",placeholder:"Fulan AlFulani",type:"text",inputLabel:"Full Name",startAdornment:n(C,{position:"start",children:n(P,{})}),rules:{required:"Full name rquired"},helperText:null===(r=l.fullName)||void 0===r?void 0:r.message}),n(I,{type:"text",inputLabel:"Email",placeholder:"Enter your email",name:"email",startAdornment:n(C,{position:"start",children:n(T,{})}),rules:{required:"Email required",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:"Invalid email address"}},helperText:null===(t=l.email)||void 0===t?void 0:t.message}),n(I,{name:"password",placeholder:"Minimum 8 characters",type:"password",inputLabel:"Password",startAdornment:n(C,{position:"start",children:n(k,{})}),rules:{required:"Password rquired",minLength:{value:8,message:"Password too short"}},helperText:null===(o=l.password)||void 0===o?void 0:o.message}),n(q,{fullWidth:!0,type:"submit",text:"Sign Up",last:!0})]})}))]}),i(M,{style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",n("span",{onClick:function(){return console.log("res")},style:{cursor:"pointer",color:"blue",textAlign:"center"},children:"Sign in"})]}),e.viaGoogle&&n(j,{logo:"google",buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&n(j,{logo:"github",buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&n(j,{logo:"twitter",buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})};V.propTypes={theme:a.oneOf(["secondary","primary"])};var U=function(e){var r,t,o=f(),a=o.formState.errors,l=o.handleSubmit;return i(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[i(E,{noMargin:!0,children:[e.error&&n(R,{text:"This is a sign in alert",severity:"error"}),n(w,S(S({},o),{},{children:i("form",{onSubmit:l(e.handleSignIn),children:[n(I,{type:"text",name:"email",inputLabel:"Email",placeholder:"Enter your email",startAdornment:n(C,{position:"start",children:n(T,{})}),rules:{required:"Email is required",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:"Invalid email address"}},helperText:null===(r=a.email)||void 0===r?void 0:r.message}),n(I,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",startAdornment:n(C,{position:"start",children:n(k,{})}),rules:{required:"Password is rquired"},helperText:null===(t=a.password)||void 0===t?void 0:t.message}),n(M,{style:{cursor:"pointer",marginTop:5,width:"max-content",padding:5},onClick:function(){return console.log("res")},children:"Forgot password?"}),n(q,{type:"submit",fullWidth:!0,last:"true",text:"Sign In"})]})}))]}),i(M,{style:{marginTop:5,textAlign:"center",padding:5},children:["New user?"," ",n("span",{onClick:function(){return console.log("res")},style:{cursor:"pointer",color:"blue",textAlign:"center"},children:"Sign up"})]}),e.viaGoogle&&n(j,{logo:"google",buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&n(j,{logo:"github",buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&n(j,{logo:"twitter",buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})},Z=function(e){return n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:i(E,{noMargin:!0,children:[n(M,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&n(j,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&n(j,{logo:"visa/master",buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&n(j,{logo:"mada",buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&n(j,{logo:"stcpay",buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&n(j,{logo:"paypal",buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&n(j,{logo:"googlepay",buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&n(j,{logo:"applepay",buttonText:e.applePayLabel,handleClick:e.handleApplePay})]})})};I.propTypes={theme:a.oneOf(["secondary","primary"]),viaApplePay:a.bool,viaGooglePay:a.bool,viaSTCPay:a.bool,viaCreditCard:a.bool,viaPayPal:a.bool,handleApplePay:a.func};var $=function(e){var r,t,o=f(),a=o.formState.errors,l=o.handleSubmit;return n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:n(E,{noMargin:!0,children:n(w,S(S({},o),{},{children:i("form",{onSubmit:l(e.handle),children:[n(I,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(r=a.password)||void 0===r?void 0:r.message}),n(I,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(t=a.password)||void 0===t?void 0:t.message}),n(q,{last:!0,fullWidth:!0,text:"Sign In",onClick:e.handleSignIn})]})}))})})},H=function(e){var r,o=B(t(0),2),a=o[0],l=o[1],d=f(),s=d.formState.errors,u=d.handleSubmit;return n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:i(E,{noMargin:!0,children:[i(M,{variant:"h2",align:"center",children:[Number(a).toLocaleString("en")," ",n("span",{style:{fontSize:20,letterSpacing:1},children:e.currency})]}),n(w,S(S({},d),{},{children:i("form",{onChange:function(e){e.preventDefault(),l(d.getValues().amount)},style:{marginTop:10},onSubmit:u(e.handleChargeWallet),children:[n(I,{name:"amount",placeholder:"Enter amount",type:"number",value:a,rules:{required:"Password is rquired"},helperText:null===(r=s.amount)||void 0===r?void 0:r.message}),n(q,{last:!0,fullWidth:!0,text:"Charge Wallet",onClick:e.handleSignIn})]})}))]})})},_=function(e){return n(E,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:i(E,{noMargin:!0,children:[n("div",{children:"Wallet Balance"}),n(q,{text:"Pay now"})]})})};export{H as ChargeWalletForm,$ as CreditCardForm,G as NewPasswordForm,_ as PayWithWallet,D as ResetPasswordForm,Z as SelectPayment,U as SignInForm,V as SignUpForm,N as UserProfile,z as UserSettings};
|
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"),o=require("react/jsx-runtime"),r=require("@mui/material/styles"),n=require("@mui/material/InputBase"),i=require("prop-types"),a=require("@mui/material/InputLabel"),l=require("@mui/material/utils");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=d(e),u=d(t),c=d(o),f=d(n),p=d(i),h=d(a),b=d(l);function m(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function g(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?m(Object(o),!0).forEach((function(t){y(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):m(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function y(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var x={borderRadius:10,primaryColor:"blue",secondaryColor:"grey",primaryActionColor:"grey",secondaryActionColor:"#4cc9f0",layoutColor:"#d3d4d9",textColor:"black",inputColor:"white",lightBackground:"#FBF5F3",darkBackground:"#0F0E0E",margins:10,paddings:10,allBorderRadius:10,actionButton:{primary:{borderRadius:10,backgroundColor:"#f90900",color:"white",margin:10,padding:10},secondary:{borderRadius:10,margin:10,padding:10,backgroundColor:"#FF8811",color:"black"}},layout:{primary:{backgroundColor:"#d3d4d9",color:"black",margin:10,padding:10,borderRadius:10},secondary:{backgroundColor:"#001E3C",color:"white",margin:10,padding:10,borderRadius:10}},inputFields:{primary:{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",borderRadius:10},secondary:{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",borderRadius:10}}},v=e.createContext(x),C=function(t){var n,i=e.useContext(v),a=Object.keys(i.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())})),l={};a?l=g(g({},i.actionButton[a]),{},{margin:t.last?0:i.actionButton[a].margin,marginTop:t.last?2*i.actionButton[a].margin:0,"&:hover":{backgroundColor:r.darken(null===(n=i.actionButton[a])||void 0===n?void 0:n.backgroundColor,.1)}}):l={backgroundColor:"black",color:"white",padding:10,marginTop:t.last?20:0};var d=r.styled(u.default)((function(e){return e.theme,g({},l)}));return o.jsx(d,g(g({},t),{},{children:t.text}))},k=function(t){var r=e.useContext(v),n={};console.log(Object.keys(r.actionButton));var i=Object.keys(r.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));return n=i?{margin:15,marginRight:5,marginLeft:5,color:r.layout[i].color}:{margin:15,marginRight:0,marginLeft:0,color:"black"},o.jsx(h.default,{style:n,children:o.jsx("div",{style:{fontSize:15},children:t.label})})},j=function(t){var n=e.useContext(v),i=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())})),a={};a=i?g(g({},n.inputFields[i]),{},{margin:t.last?0:n.inputFields[i].margin,marginTop:t.last?2*n.inputFields[i].margin:0}):{backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"};var l=r.styled(f.default)((function(e){var t=e.theme;return{"& .MuiInputBase-input":g({backgroundColor:"light"===t.palette.mode?"#fcfcfb":"#2b2b2b",transition:t.transitions.create(["border-color","background-color","box-shadow"]),"&:focus":{boxShadow:"".concat(r.alpha(t.palette.primary.main,.25)," 0 0 0 0.2rem"),borderColor:t.palette.primary.main},borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,padding:"10px 12px"},a)}}));return o.jsxs(o.Fragment,{children:[t.inputLabel?o.jsx(k,{themeType:t.themeType,label:t.inputLabel}):null,o.jsx(l,{fullWidth:!0,"aria-label":"dws"})]})};j.propTypes={type:p.default.oneOf(["text","number"]),helperText:p.default.string};var w,T=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.layout[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.layout[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"}),o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},O={},L={exports:{}};(w=L).exports=function(e){return e&&e.__esModule?e:{default:e}},w.exports.__esModule=!0,w.exports.default=w.exports;var P={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=b.default}(P);var R=L.exports;Object.defineProperty(O,"__esModule",{value:!0});var B=O.default=void 0;!function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=M(t);if(o&&o.has(e))return o.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,o&&o.set(e,r)}(s.default);var S=R(P),I=c.default;function M(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(M=function(e){return e?o:t})(e)}var D=(0,S.default)((0,I.jsx)("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"}),"GitHub");B=O.default=D;var z=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx(B,{}),o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},W={},F=L.exports;Object.defineProperty(W,"__esModule",{value:!0});var A=W.default=void 0;!function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=E(t);if(o&&o.has(e))return o.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,o&&o.set(e,r)}(s.default);var _=F(P),G=c.default;function E(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(E=function(e){return e?o:t})(e)}var q=(0,_.default)((0,G.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"}),"Twitter");A=W.default=q;var U=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.layout[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.layout[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx(A,{}),o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},N=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},H=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:30})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},V=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:30})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},J=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:30})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},K=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},Q=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:30})," ",o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},X={},Y=L.exports;Object.defineProperty(X,"__esModule",{value:!0});var Z=X.default=void 0,$=Y(P),ee=c.default,te=(0,$.default)((0,ee.jsx)("path",{d:"M21 18v1c0 1.1-.9 2-2 2H5c-1.11 0-2-.9-2-2V5c0-1.1.89-2 2-2h14c1.1 0 2 .9 2 2v1h-9c-1.11 0-2 .9-2 2v8c0 1.1.89 2 2 2h9zm-9-2h10V8H12v8zm4-2.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"AccountBalanceWallet");Z=X.default=te;var oe=function(t){var n=e.useContext(v),i={};console.log(Object.keys(n.actionButton));var a=Object.keys(n.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));i=a?{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:0,marginTop:n.actionButton[a].margin,border:t.outlined?"2px solid black":"none",borderRadius:n.actionButton[a].borderRadius,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}}:{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:n.margins,border:t.outlined?"2px solid black":"none",borderRadius:0,backgroundColor:"white","&:hover":{backgroundColor:r.darken("#ffffff",.1)}};var l=r.styled(u.default)((function(e){var t=e.theme;return g(g({borderRadius:4,position:"relative",border:"1px solid #ced4da",fontSize:16,height:50},i),{},{"&:focus":{borderColor:t.palette.primary.main}})}));return o.jsxs(l,{onClick:t.handleClick,children:[o.jsx(Z,{}),o.jsx("div",{style:{width:10}}),o.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:t.buttonText})]})},re=function(t){var r=e.useContext(v),n={};console.log(Object.keys(r.actionButton));var i=Object.keys(r.actionButton).find((function(e){var o;return e.toLowerCase()===(null===(o=t.themeType)||void 0===o?void 0:o.toLowerCase())}));return n=i?g(g({display:"flex",flexDirection:"column"},r.layout[i]),{},{backgroundColor:t.noColor?"none":r.layout[i].backgroundColor,padding:t.noPadding?0:r.layout[i].padding,margin:t.noMargin?0:r.layout[i].margin,maxWidth:t.maxWidth}):{display:"flex",flexDirection:"column",color:"white",marginTop:t.last?20:0,backgroundColor:t.noColor?"none":"lightGrey",padding:t.noPadding?0:10,margin:t.noMargin?0:10,maxWidth:t.maxWidth,borderRadius:0},o.jsx("div",{style:n,children:t.children})},ne=function(e){return o.jsxs(re,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[o.jsxs(re,{themeType:e.theme,noMargin:!0,children:[o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Email"}),o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Password"}),o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Confirm Password"}),o.jsx(C,{text:"Sign Up",last:!0,themeType:e.theme,onClick:e.handleSignUp})]}),e.viaGoogle&&o.jsx(T,{outlined:!0,themeType:e.theme,buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&o.jsx(z,{outlined:!0,themeType:e.theme,buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignUp}),e.viaTwitter&&o.jsx(U,{outlined:!0,themeType:e.theme,buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})};ne.propTypes={theme:p.default.oneOf(["secondary","primary"])};j.propTypes={theme:p.default.oneOf(["secondary","primary"]),viaApplePay:p.default.bool,viaGooglePay:p.default.bool,viaSTCPay:p.default.bool,viaCreditCard:p.default.bool,viaPayPal:p.default.bool,handleApplePay:p.default.func};exports.CreditCardForm=function(e){return o.jsx(re,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:o.jsxs(re,{themeType:e.theme,noMargin:!0,children:[o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Email"}),o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Password"}),o.jsx(C,{last:!0,text:"Sign In",themeType:e.theme,onClick:e.handleSignIn})]})})},exports.NewPasswordForm=function(t){return e.useContext(v),o.jsx(re,{themeType:t.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:o.jsxs(re,{themeType:t.theme,noMargin:!0,children:[o.jsx(j,{themeType:t.theme,type:"password",inputLabel:"Password"}),o.jsx(j,{themeType:t.theme,type:"password",inputLabel:"Confirm Password"}),o.jsx(C,{themeType:t.theme,last:!0,text:"Reset Password"})]})})},exports.ResetPasswordForm=function(e){return o.jsx(re,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:o.jsxs(re,{themeType:e.theme,noMargin:!0,children:[o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Email"}),o.jsx(C,{themeType:e.theme,last:!0,text:"Reset Password"})]})})},exports.SelectPayment=function(e){return o.jsx(re,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:o.jsxs(re,{themeType:e.theme,noMargin:!0,children:[o.jsx("div",{children:"Choose Payment"}),e.viaWallet&&o.jsx(oe,{themeType:e.theme,outlined:!0,buttonText:e.walletLabel,handleClick:e.handleWallet}),e.viaCreditCard&&o.jsx(N,{themeType:e.theme,outlined:!0,buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&o.jsx(H,{themeType:e.theme,outlined:!0,buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&o.jsx(V,{themeType:e.theme,outlined:!0,buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&o.jsx(J,{themeType:e.theme,outlined:!0,buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&o.jsx(Q,{themeType:e.theme,outlined:!0,buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&o.jsx(K,{themeType:e.theme,outlined:!0,buttonText:e.applePayLabel,handleClick:e.handleApplePay})]})})},exports.SignInForm=function(e){return o.jsxs(re,{themeType:e.theme,maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[o.jsxs(re,{themeType:e.theme,noMargin:!0,children:[o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Email"}),o.jsx(j,{themeType:e.theme,type:"text",inputLabel:"Password"}),o.jsx(C,{last:!0,text:"Sign In",themeType:e.theme,onClick:e.handleSignIn})]}),e.viaGoogle&&o.jsx(T,{themeType:e.theme,outlined:!0,buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&o.jsx(z,{outlined:!0,themeType:e.theme,buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&o.jsx(U,{outlined:!0,themeType:e.theme,buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})},exports.SignUpForm=ne,exports.UserProfile=function(e){return o.jsxs(re,{maxWidth:400,children:[o.jsx(k,{type:"text",inputLabel:"First Name"}),o.jsx(k,{type:"text",inputLabel:"Last Name"}),o.jsx(k,{type:"email",inputLabel:"Email"}),o.jsx(k,{type:"password",inputLabel:"Password"}),o.jsx(C,{last:!0,text:"Update Account"})]})},exports.UserSettings=function(e){return o.jsxs(re,{maxWidth:400,children:[o.jsx(j,{type:"text",inputLabel:"First Name"}),o.jsx(j,{type:"text",inputLabel:"Last Name"}),o.jsx(j,{type:"email",inputLabel:"Email"}),o.jsx(j,{type:"password",inputLabel:"Password"}),o.jsx(C,{last:!0,text:"Update Account"})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@mui/material/Button");require("@mui/material/Tooltip");var t=require("prop-types"),a=require("react/jsx-runtime"),o=require("@mui/material/styles");require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox"),require("@mui/material"),require("@mui/material/TextField");var n=require("@mui/material/Typography"),i=require("@mui/icons-material/GitHub"),l=require("@mui/icons-material/Twitter"),s=require("@mui/icons-material/AccountBalanceWallet"),d=require("@mui/material/InputBase"),u=require("@mui/material/InputLabel"),c=require("react-hook-form"),m=require("@mui/material/Alert"),p=require("@mui/material/AlertTitle"),g=require("@mui/material/InputAdornment"),h=require("@mui/icons-material/HttpsOutlined"),x=require("@mui/icons-material/MailOutline"),f=require("@mui/icons-material/PermIdentityOutlined");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=b(r),j=b(t),w=b(n),v=b(i),C=b(l),k=b(s),P=b(d),T=b(u),S=b(m),L=b(p),q=b(g),F=b(h),A=b(x),B=b(f);function O(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function W(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?O(Object(t),!0).forEach((function(r){M(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):O(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function M(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function E(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var a,o,n=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(a=t.next()).done)&&(n.push(a.value),!r||n.length!==r);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw o}}return n}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return I(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return I(e,r)}(e,r)||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 I(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}var R={allPrimaryBG:"#f90900",allPrimaryAction:"#138A36",allBorderRadius:10,borderRadius:10,primaryColor:"blue",secondaryColor:"grey",primaryActionColor:"grey",secondaryActionColor:"#4cc9f0",layoutColor:"#d3d4d9",textColor:"black",inputColor:"white",lightBackground:"#FBF5F3",darkBackground:"#0F0E0E",testcolor:"green",margins:10,paddings:10,typography:{fontFamily:["IBMPlex"].join(","),primary:{color:"black"},secondary:{color:"white"}},logoButton:{primary:{borderRadius:10,backgroundColor:"#B20D30",marginTop:10,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",height:50,"&:focus":{borderColor:"#B20D30"}},secondary:{borderRadius:10,backgroundColor:"#f90900",marginTop:10,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",height:50,"&:focus":{borderColor:"green"}}},actionButton:{primary:{borderRadius:10,backgroundColor:"#B20D30",color:"white",margin:10,padding:10,border:"1px solid #ced4da",fontSize:16,height:50,"&:focus":{borderColor:"red"}},secondary:{borderRadius:10,margin:10,padding:10,backgroundColor:"#FF8811",color:"black"}},layout:{primary:{backgroundColor:"#d3d4d9",color:"black",margin:10,padding:10,borderRadius:10},secondary:{backgroundColor:"#001E3C",color:"white",margin:10,padding:10,borderRadius:10}},inputFields:{primary:{backgroundColor:"white",borderRadius:10,"&:focus":{borderColor:"red",borderWidth:1,border:"1px solid black"},"&:hover":{borderColor:"red",borderWidth:1,border:"1px solid black"}},secondary:{backgroundColor:"white",borderRadius:10}},alerts:{primary:{marginBottom:10,padding:10,borderRadius:10},secondary:{marginBottom:10,padding:10,borderRadius:10}},settingsRow:{primary:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"#F5F5F5",margin:0,padding:10,borderRadius:10},secondary:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"blue",margin:0,padding:5,borderRadius:10}},radioSelector:{primary:{padding:10,borderRadius:10},secondary:{padding:10,borderRadius:10}}},N=e.createContext(R);j.default.string,j.default.bool,j.default.bool,j.default.bool;var z=function(r){var t,n=e.useContext(N),i=n.hawaTheme,l=n.themeName,s=Object.keys(i.actionButton).find((function(e){return e.toLowerCase()===(null==l?void 0:l.toLowerCase())})),d={};s?d=W(W({},i.actionButton[s]),{},{margin:r.last?0:i.actionButton[s].margin,marginTop:r.last?2*i.actionButton[s].margin:0,"&:hover":{backgroundColor:o.darken(null===(t=i.actionButton[s])||void 0===t?void 0:t.backgroundColor,.1)}}):d={backgroundColor:"black",color:"white",padding:10,marginTop:r.last?20:0,borderRadius:0};var u=o.styled(y.default)((function(e){return e.theme,W({},d)}));return a.jsx(u,W(W({},r),{},{children:r.text}))},G=function(r){var t=e.useContext(N),o=t.hawaTheme,n=t.themeName,i={},l=Object.keys(o.layout).find((function(e){return e.toLowerCase()===(null==n?void 0:n.toLowerCase())}));return i=l?W(W({display:"flex",flexDirection:r.horizontal?"row":"column"},o.layout[l]),{},{backgroundColor:r.noColor?"none":o.layout[l].backgroundColor,padding:r.noPadding?0:o.layout[l].padding,margin:r.noMargin?0:o.layout[l].margin,maxWidth:r.maxWidth}):{display:"flex",flexDirection:r.horizontal?"row":"column",color:"white",marginTop:r.last?20:0,backgroundColor:r.noColor?"none":"lightGrey",padding:r.noPadding?0:10,margin:r.noMargin?0:10,maxWidth:r.maxWidth,borderRadius:0},a.jsx("div",{style:i,children:r.children})},D=function(r){var t=e.useContext(N),n=t.hawaTheme,i=t.themeName,l=Object.keys(n.typography).find((function(e){return e.toLowerCase()===(null==i?void 0:i.toLowerCase())})),s={};s=l?W({},n.typography[l]):{color:"black"};var d=o.styled(w.default)((function(e){return e.theme,W({},s)}));return a.jsx(d,W(W({},r),{},{children:r.children}))};j.default.oneOf(["text","number","password"]),j.default.string;var U=function(r){var t,n=e.useContext(N),i=n.hawaTheme,l=n.themeName,s={},d=Object.keys(i.logoButton).find((function(e){return e.toLowerCase()===(null==l?void 0:l.toLowerCase())}));s=d?W(W({},i.logoButton[d]),{},{backgroundColor:"white","&:hover":{backgroundColor:o.darken("#ffffff",.1)}}):{cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",marginTop:10,height:50,padding:30,paddingTop:0,paddingBottom:0,border:"1px solid #ced4da",backgroundColor:"white","&:hover":{backgroundColor:o.darken("#ffffff",.1)}};var u=o.styled(y.default)((function(e){return e.theme,W({},s)})),c="";switch(null===(t=r.logo)||void 0===t?void 0:t.toLowerCase()){case"google":c=a.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":c=a.jsx(v.default,{});break;case"twitter":c=a.jsx(C.default,{});break;case"mada":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":c=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":c=a.jsx(k.default,{})}return a.jsxs(u,W(W({},r),{},{children:[c,a.jsx("div",{style:{width:10}}),a.jsx("p",{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:r.buttonText})]}))},V=function(r){var t=e.useContext(N),o=t.hawaTheme,n=t.themeName,i={},l=Object.keys(o.actionButton).find((function(e){return e.toLowerCase()===(null==n?void 0:n.toLowerCase())}));return i=l?{margin:15,marginRight:5,marginLeft:5,color:o.layout[l].color}:{margin:15,marginRight:0,marginLeft:0,color:"black"},a.jsx(T.default,{style:i,children:a.jsx("div",{style:{fontSize:15},children:r.label})})},Z=function(r){var t=c.useFormContext(),n=t.control,i=t.register,l=e.useContext(N),s=l.hawaTheme,d=l.themeName,u=Object.keys(s.inputFields).find((function(e){return e.toLowerCase()===(null==d?void 0:d.toLowerCase())})),m={};m=u?W(W({},s.inputFields[u]),{},{margin:r.last?0:s.inputFields[u].margin,marginTop:r.last?2*s.inputFields[u].margin:0}):{backgroundColor:"white"};var p=o.styled(P.default)((function(e){return W({"& .MuiInputBase-input":{transition:e.theme.transitions.create(["border-color","background-color","box-shadow"])},border:"1px solid #ced4da",fontSize:16,padding:"10px 12px",marginBottom:r.helperText?5:0,paddingLeft:10,paddingRight:10},m)}));return a.jsx(c.Controller,{render:function(e){var t;return e.field,a.jsxs(a.Fragment,{children:[r.inputLabel&&a.jsx(V,{label:r.inputLabel}),a.jsx(p,W(W({fullWidth:!0,type:null!==(t=r.type)&&void 0!==t?t:"text",defaultValue:r.defaultValue&&"",value:r.value&&""},r),i(r.name))),a.jsx(w.default,{variant:"caption",style:{margin:5,marginBottom:0,color:"red"},children:r.helperText})]})},name:r.name,rules:r.rules,control:n,shouldUnregister:r.shouldUnregister})};Z.propTypes={type:j.default.oneOf(["text","number","password"]),helperText:j.default.string};var $=function(r){var t=e.useContext(N),n=t.hawaTheme,i=t.themeName,l=Object.keys(n.alerts).find((function(e){return e.toLowerCase()===(null==i?void 0:i.toLowerCase())})),s={};s=l?W({},n.alerts[l]):{marginBottom:10};var d=o.styled(S.default)((function(e){return e.theme,W({},s)}));return a.jsxs(d,W(W({},r),{},{children:[r.title&&a.jsx(L.default,{children:r.title}),r.text]}))},_=function(e){var r,t,o,n=c.useForm(),i=n.formState.errors,l=n.handleSubmit;return n.getValues,n.register,n.watch,n.reset,n.setValue,a.jsxs(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[a.jsxs(G,{noMargin:!0,children:[e.error&&a.jsx($,{text:"This is a sign in alert",severity:"error"}),a.jsx(c.FormProvider,W(W({},n),{},{children:a.jsxs("form",{onSubmit:l(e.handleSignUp),children:[a.jsx(Z,{name:"fullName",placeholder:"Fulan AlFulani",type:"text",inputLabel:"Full Name",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(B.default,{})}),rules:{required:"Full name rquired"},helperText:null===(r=i.fullName)||void 0===r?void 0:r.message}),a.jsx(Z,{type:"text",inputLabel:"Email",placeholder:"Enter your email",name:"email",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(A.default,{})}),rules:{required:"Email required",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:"Invalid email address"}},helperText:null===(t=i.email)||void 0===t?void 0:t.message}),a.jsx(Z,{name:"password",placeholder:"Minimum 8 characters",type:"password",inputLabel:"Password",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password rquired",minLength:{value:8,message:"Password too short"}},helperText:null===(o=i.password)||void 0===o?void 0:o.message}),a.jsx(z,{fullWidth:!0,type:"submit",text:"Sign Up",last:!0})]})}))]}),a.jsxs(D,{style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a.jsx("span",{onClick:function(){return console.log("res")},style:{cursor:"pointer",color:"blue",textAlign:"center"},children:"Sign in"})]}),e.viaGoogle&&a.jsx(U,{logo:"google",buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(U,{logo:"github",buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(U,{logo:"twitter",buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})};_.propTypes={theme:j.default.oneOf(["secondary","primary"])};Z.propTypes={theme:j.default.oneOf(["secondary","primary"]),viaApplePay:j.default.bool,viaGooglePay:j.default.bool,viaSTCPay:j.default.bool,viaCreditCard:j.default.bool,viaPayPal:j.default.bool,handleApplePay:j.default.func};exports.ChargeWalletForm=function(r){var t,o=E(e.useState(0),2),n=o[0],i=o[1],l=c.useForm(),s=l.formState.errors,d=l.handleSubmit;return a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(G,{noMargin:!0,children:[a.jsxs(D,{variant:"h2",align:"center",children:[Number(n).toLocaleString("en")," ",a.jsx("span",{style:{fontSize:20,letterSpacing:1},children:r.currency})]}),a.jsx(c.FormProvider,W(W({},l),{},{children:a.jsxs("form",{onChange:function(e){e.preventDefault(),i(l.getValues().amount)},style:{marginTop:10},onSubmit:d(r.handleChargeWallet),children:[a.jsx(Z,{name:"amount",placeholder:"Enter amount",type:"number",value:n,rules:{required:"Password is rquired"},helperText:null===(t=s.amount)||void 0===t?void 0:t.message}),a.jsx(z,{last:!0,fullWidth:!0,text:"Charge Wallet",onClick:r.handleSignIn})]})}))]})})},exports.CreditCardForm=function(e){var r,t,o=c.useForm(),n=o.formState.errors,i=o.handleSubmit;return a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsx(G,{noMargin:!0,children:a.jsx(c.FormProvider,W(W({},o),{},{children:a.jsxs("form",{onSubmit:i(e.handle),children:[a.jsx(Z,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a.jsx(Z,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(z,{last:!0,fullWidth:!0,text:"Sign In",onClick:e.handleSignIn})]})}))})})},exports.NewPasswordForm=function(r){var t,o,n=E(e.useState(""),2),i=n[0],l=n[1],s=E(e.useState(""),2);s[0],s[1];var d=E(e.useState(!1),2);d[0],d[1];var u=E(e.useState(""),2);u[0],u[1];var m=E(e.useState(!0),2);m[0],m[1];var p=c.useForm(),g=p.formState.errors,h=p.handleSubmit;return p.getValues,p.register,p.watch,p.reset,p.setValue,a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(G,{noMargin:!0,children:[r.error&&a.jsx($,{text:"This is a new password alert",severity:"error"}),r.passwordChanged?a.jsx(D,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(c.FormProvider,W(W({},p),{},{children:a.jsxs("form",{onSubmit:h(r.handleNewPassword),children:[a.jsx(Z,{name:"password",type:"password",inputLabel:"Choose new password",placeholder:"Enter password",onChange:function(e){return l(e.target.value)},value:i,startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(t=g.password)||void 0===t?void 0:t.message}),a.jsx(Z,{name:"confirmPassword",type:"password",placeholder:"Confirm Password",inputLabel:"Confirm",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(o=g.confirmPassword)||void 0===o?void 0:o.message}),a.jsx(z,{fullWidth:!0,type:"submit",last:!0,text:"Reset Password"})]})}))]})})},exports.PayWithWallet=function(e){return a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(G,{noMargin:!0,children:[a.jsx("div",{children:"Wallet Balance"}),a.jsx(z,{text:"Pay now"})]})})},exports.ResetPasswordForm=function(e){var r,t=c.useForm(),o=t.formState.errors,n=t.handleSubmit;return t.getValues,t.register,t.watch,t.reset,t.setValue,a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(G,{noMargin:!0,children:[e.error&&a.jsx($,{text:"This is a reset password alert",severity:"error"}),e.sent?a.jsx(D,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsx(c.FormProvider,W(W({},t),{},{children:a.jsxs("form",{onSubmit:n(e.handleResetPassword),children:[a.jsx(Z,{type:"text",name:"email",inputLabel:"Email",placeholder:"Enter your email",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(A.default,{})}),rules:{required:"Email is required",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:"Invalid email address"}},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),a.jsx(z,{fullWidth:!0,last:!0,type:"submit",text:"Reset Password"})]})}))]})})},exports.SelectPayment=function(e){return a.jsx(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(G,{noMargin:!0,children:[a.jsx(D,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(U,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(U,{logo:"visa/master",buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&a.jsx(U,{logo:"mada",buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&a.jsx(U,{logo:"stcpay",buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(U,{logo:"paypal",buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(U,{logo:"googlepay",buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(U,{logo:"applepay",buttonText:e.applePayLabel,handleClick:e.handleApplePay})]})})},exports.SignInForm=function(e){var r,t,o=c.useForm(),n=o.formState.errors,i=o.handleSubmit;return a.jsxs(G,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:[a.jsxs(G,{noMargin:!0,children:[e.error&&a.jsx($,{text:"This is a sign in alert",severity:"error"}),a.jsx(c.FormProvider,W(W({},o),{},{children:a.jsxs("form",{onSubmit:i(e.handleSignIn),children:[a.jsx(Z,{type:"text",name:"email",inputLabel:"Email",placeholder:"Enter your email",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(A.default,{})}),rules:{required:"Email is required",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:"Invalid email address"}},helperText:null===(r=n.email)||void 0===r?void 0:r.message}),a.jsx(Z,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",startAdornment:a.jsx(q.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(D,{style:{cursor:"pointer",marginTop:5,width:"max-content",padding:5},onClick:function(){return console.log("res")},children:"Forgot password?"}),a.jsx(z,{type:"submit",fullWidth:!0,last:"true",text:"Sign In"})]})}))]}),a.jsxs(D,{style:{marginTop:5,textAlign:"center",padding:5},children:["New user?"," ",a.jsx("span",{onClick:function(){return console.log("res")},style:{cursor:"pointer",color:"blue",textAlign:"center"},children:"Sign up"})]}),e.viaGoogle&&a.jsx(U,{logo:"google",buttonText:e.googleButtonLabel,handleClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(U,{logo:"github",buttonText:e.githubButtonLabel,handleClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(U,{logo:"twitter",buttonText:e.twitterButtonLabel,handleClick:e.handleTwitterSignIn})]})},exports.SignUpForm=_,exports.UserProfile=function(e){var r,t,o,n,i=c.useForm(),l=i.formState.errors;return i.handleSubmit,a.jsx(G,{maxWidth:400,noMargin:!0,children:a.jsx(G,{noMargin:!0,noColor:!0,children:a.jsx(c.FormProvider,W(W({},i),{},{children:a.jsxs("form",{children:[a.jsx(Z,{type:"text",name:"fullName",inputLabel:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(r=l.fullName)||void 0===r?void 0:r.message}),a.jsx(Z,{type:"text",name:"email",inputLabel:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(t=l.email)||void 0===t?void 0:t.message}),a.jsx(Z,{type:"password",name:"password",inputLabel:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(o=l.password)||void 0===o?void 0:o.message}),a.jsx(Z,{type:"password",name:"confirmPassword",inputLabel:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(n=l.confirmPassword)||void 0===n?void 0:n.message}),a.jsx(z,{fullWidth:!0,last:!0,text:"Update Account"})]})}))})})},exports.UserSettings=function(e){return a.jsxs(G,{maxWidth:400,children:[a.jsx(Z,{type:"text",inputLabel:"First Name"}),a.jsx(Z,{type:"text",inputLabel:"Last Name"}),a.jsx(Z,{type:"email",inputLabel:"Email"}),a.jsx(Z,{type:"password",inputLabel:"Password"}),a.jsx(z,{last:!0,text:"Update Account"})]})};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
22
22
|
"@rollup/plugin-node-resolve": "^11.1.1",
|
|
23
23
|
"@storybook/addon-actions": "^6.4.7",
|
|
24
|
+
"@storybook/addon-docs": "^6.4.19",
|
|
24
25
|
"@storybook/addon-essentials": "^6.4.7",
|
|
25
26
|
"@storybook/addon-links": "^6.4.7",
|
|
26
27
|
"@storybook/addons": "^6.4.19",
|
|
@@ -46,17 +47,15 @@
|
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"@emotion/react": "^11.8.2",
|
|
48
49
|
"@emotion/styled": "^11.8.1",
|
|
50
|
+
"@mui/icons-material": "^5.5.1",
|
|
49
51
|
"@mui/material": "^5.5.1",
|
|
50
52
|
"crypto-js": "^4.1.1",
|
|
51
53
|
"next-scripts": "^0.3.4",
|
|
52
54
|
"prop-types": "^15.7.2",
|
|
53
55
|
"react": "^17.0.1",
|
|
54
56
|
"react-dom": "^17.0.1",
|
|
55
|
-
"react-hook-form": "^7.
|
|
57
|
+
"react-hook-form": "^7.28.0",
|
|
56
58
|
"react-transition-group": "^4.4.2",
|
|
57
59
|
"tinycolor2": "^1.4.2"
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@mui/icons-material": "^5.5.1"
|
|
61
60
|
}
|
|
62
61
|
}
|
|
@@ -1,15 +1,65 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HawaInputLabel, ActionButton } from "../../ui";
|
|
2
|
+
import { HawaInputLabel, ActionButton, HawaTextField } from "../../ui";
|
|
3
3
|
import { Box } from "../../layout";
|
|
4
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
4
5
|
|
|
5
6
|
export const UserProfile = (props) => {
|
|
7
|
+
const methods = useForm();
|
|
8
|
+
const {
|
|
9
|
+
formState: { errors },
|
|
10
|
+
handleSubmit
|
|
11
|
+
} = methods;
|
|
12
|
+
|
|
6
13
|
return (
|
|
7
|
-
<Box maxWidth={400}>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
<Box maxWidth={400} noMargin>
|
|
15
|
+
<Box noMargin noColor>
|
|
16
|
+
<FormProvider {...methods}>
|
|
17
|
+
<form>
|
|
18
|
+
<HawaTextField
|
|
19
|
+
type="text"
|
|
20
|
+
name="fullName"
|
|
21
|
+
inputLabel="Full Name"
|
|
22
|
+
placeholder="Fulan AlFulani"
|
|
23
|
+
rules={{
|
|
24
|
+
required: "Email is required"
|
|
25
|
+
}}
|
|
26
|
+
helperText={errors.fullName?.message}
|
|
27
|
+
/>
|
|
28
|
+
<HawaTextField
|
|
29
|
+
type="text"
|
|
30
|
+
name="email"
|
|
31
|
+
inputLabel="New Email"
|
|
32
|
+
placeholder="Enter your new email"
|
|
33
|
+
rules={{
|
|
34
|
+
required: "Email is required"
|
|
35
|
+
}}
|
|
36
|
+
helperText={errors.email?.message}
|
|
37
|
+
/>
|
|
38
|
+
<HawaTextField
|
|
39
|
+
type="password"
|
|
40
|
+
name="password"
|
|
41
|
+
inputLabel="New password"
|
|
42
|
+
placeholder="Enter your new password"
|
|
43
|
+
rules={{
|
|
44
|
+
required: "Email is required"
|
|
45
|
+
}}
|
|
46
|
+
helperText={errors.password?.message}
|
|
47
|
+
/>
|
|
48
|
+
<HawaTextField
|
|
49
|
+
type="password"
|
|
50
|
+
name="confirmPassword"
|
|
51
|
+
inputLabel="Confirm new password"
|
|
52
|
+
placeholder="Confirm new password"
|
|
53
|
+
rules={{
|
|
54
|
+
required: "Email is required"
|
|
55
|
+
}}
|
|
56
|
+
helperText={errors.confirmPassword?.message}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<ActionButton fullWidth last text="Update Account" />
|
|
60
|
+
</form>
|
|
61
|
+
</FormProvider>
|
|
62
|
+
</Box>
|
|
13
63
|
</Box>
|
|
14
64
|
);
|
|
15
65
|
};
|
|
@@ -1,23 +1,106 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Box } from "../../layout";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
ActionButton,
|
|
5
|
+
HawaTextField,
|
|
6
|
+
HawaAlert,
|
|
7
|
+
HawaTypography
|
|
8
|
+
} from "../../ui";
|
|
9
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
10
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
11
|
+
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
12
|
+
|
|
5
13
|
export const NewPasswordForm = (props) => {
|
|
6
|
-
const
|
|
14
|
+
const [newPassword, setNewPassword] = useState("");
|
|
15
|
+
const [confirmNewPassword, setConfirmNewPassword] = useState("");
|
|
16
|
+
const [error, setError] = useState(false);
|
|
17
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
18
|
+
const [loading, setLoading] = useState(true);
|
|
19
|
+
|
|
20
|
+
const methods = useForm();
|
|
21
|
+
const {
|
|
22
|
+
formState: { errors },
|
|
23
|
+
handleSubmit,
|
|
24
|
+
getValues,
|
|
25
|
+
register,
|
|
26
|
+
watch,
|
|
27
|
+
reset,
|
|
28
|
+
setValue
|
|
29
|
+
} = methods;
|
|
30
|
+
|
|
31
|
+
const handleNewPassword = (e) => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
console.log("submitting fom", e.target);
|
|
34
|
+
// setLoading(true);
|
|
35
|
+
// e.preventDefault();
|
|
36
|
+
// if (newPassword == "" || confirmNewPassword == "") {
|
|
37
|
+
// setLoading(false);
|
|
38
|
+
// return;
|
|
39
|
+
// }
|
|
40
|
+
// if (newPassword != confirmNewPassword) {
|
|
41
|
+
// setError(true);
|
|
42
|
+
// setLoading(false);
|
|
43
|
+
// // setErrorMessage(t("password-no-match"));
|
|
44
|
+
// return;
|
|
45
|
+
// }
|
|
46
|
+
// if (newPassword == confirmNewPassword) {
|
|
47
|
+
// //mutation to reset password here
|
|
48
|
+
// }
|
|
49
|
+
};
|
|
7
50
|
return (
|
|
8
|
-
<Box
|
|
9
|
-
<Box
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
51
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
52
|
+
<Box noMargin>
|
|
53
|
+
{props.error && (
|
|
54
|
+
<HawaAlert text="This is a new password alert" severity="error" />
|
|
55
|
+
)}
|
|
56
|
+
{props.passwordChanged ? (
|
|
57
|
+
<HawaTypography style={{ textAlign: "center", margin: 5 }}>
|
|
58
|
+
Your password has been changed, you'll be redirected to sign in page
|
|
59
|
+
</HawaTypography>
|
|
60
|
+
) : (
|
|
61
|
+
<FormProvider {...methods}>
|
|
62
|
+
<form onSubmit={handleSubmit(props.handleNewPassword)}>
|
|
63
|
+
<HawaTextField
|
|
64
|
+
name="password"
|
|
65
|
+
type="password"
|
|
66
|
+
inputLabel="Choose new password"
|
|
67
|
+
placeholder="Enter password"
|
|
68
|
+
onChange={(e) => setNewPassword(e.target.value)}
|
|
69
|
+
value={newPassword}
|
|
70
|
+
startAdornment={
|
|
71
|
+
<InputAdornment position="start">
|
|
72
|
+
<PasswordIcon />
|
|
73
|
+
</InputAdornment>
|
|
74
|
+
}
|
|
75
|
+
rules={{
|
|
76
|
+
required: "Password is rquired"
|
|
77
|
+
}}
|
|
78
|
+
helperText={errors.password?.message}
|
|
79
|
+
/>
|
|
80
|
+
<HawaTextField
|
|
81
|
+
name="confirmPassword"
|
|
82
|
+
type="password"
|
|
83
|
+
placeholder="Confirm Password"
|
|
84
|
+
inputLabel="Confirm"
|
|
85
|
+
startAdornment={
|
|
86
|
+
<InputAdornment position="start">
|
|
87
|
+
<PasswordIcon />
|
|
88
|
+
</InputAdornment>
|
|
89
|
+
}
|
|
90
|
+
rules={{
|
|
91
|
+
required: "Password is rquired"
|
|
92
|
+
}}
|
|
93
|
+
helperText={errors.confirmPassword?.message}
|
|
94
|
+
/>
|
|
95
|
+
<ActionButton
|
|
96
|
+
fullWidth
|
|
97
|
+
type="submit"
|
|
98
|
+
last
|
|
99
|
+
text="Reset Password"
|
|
100
|
+
/>
|
|
101
|
+
</form>
|
|
102
|
+
</FormProvider>
|
|
103
|
+
)}
|
|
21
104
|
</Box>
|
|
22
105
|
</Box>
|
|
23
106
|
);
|
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
2
3
|
import { Box } from "../../layout";
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
HawaTextField,
|
|
6
|
+
ActionButton,
|
|
7
|
+
HawaAlert,
|
|
8
|
+
HawaTypography
|
|
9
|
+
} from "../../ui";
|
|
10
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
11
|
+
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
12
|
+
|
|
4
13
|
export const ResetPasswordForm = (props) => {
|
|
14
|
+
const methods = useForm();
|
|
15
|
+
const {
|
|
16
|
+
formState: { errors },
|
|
17
|
+
handleSubmit,
|
|
18
|
+
getValues,
|
|
19
|
+
register,
|
|
20
|
+
watch,
|
|
21
|
+
reset,
|
|
22
|
+
setValue
|
|
23
|
+
} = methods;
|
|
5
24
|
return (
|
|
6
|
-
<Box
|
|
7
|
-
<Box
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
26
|
+
<Box noMargin>
|
|
27
|
+
{props.error && (
|
|
28
|
+
<HawaAlert text="This is a reset password alert" severity="error" />
|
|
29
|
+
)}
|
|
30
|
+
{!props.sent ? (
|
|
31
|
+
<FormProvider {...methods}>
|
|
32
|
+
<form onSubmit={handleSubmit(props.handleResetPassword)}>
|
|
33
|
+
<HawaTextField
|
|
34
|
+
type="text"
|
|
35
|
+
name="email"
|
|
36
|
+
inputLabel="Email"
|
|
37
|
+
placeholder="Enter your email"
|
|
38
|
+
startAdornment={
|
|
39
|
+
<InputAdornment position="start">
|
|
40
|
+
<EmailIcon />
|
|
41
|
+
</InputAdornment>
|
|
42
|
+
}
|
|
43
|
+
rules={{
|
|
44
|
+
required: "Email is required",
|
|
45
|
+
pattern: {
|
|
46
|
+
value:
|
|
47
|
+
/^(([^<>()[\]\\.,;:\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,}))$/,
|
|
48
|
+
message: "Invalid email address"
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
helperText={errors.email?.message}
|
|
52
|
+
/>
|
|
53
|
+
<ActionButton
|
|
54
|
+
fullWidth
|
|
55
|
+
last
|
|
56
|
+
type="submit"
|
|
57
|
+
text="Reset Password"
|
|
58
|
+
/>
|
|
59
|
+
</form>
|
|
60
|
+
</FormProvider>
|
|
61
|
+
) : (
|
|
62
|
+
<HawaTypography style={{ textAlign: "center", margin: 5 }}>
|
|
63
|
+
An link was sent to your email to reset the password.
|
|
64
|
+
</HawaTypography>
|
|
65
|
+
)}
|
|
10
66
|
</Box>
|
|
11
67
|
</Box>
|
|
12
68
|
);
|