@sikka/hawa 0.0.8 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +3 -2
  4. package/src/blocks/Account/UserProfile.js +55 -50
  5. package/src/blocks/Account/UserSettings.js +0 -1
  6. package/src/blocks/AuthForms/NewPasswordForm.js +57 -85
  7. package/src/blocks/AuthForms/ResetPasswordForm.js +43 -42
  8. package/src/blocks/AuthForms/SignInForm.js +92 -95
  9. package/src/blocks/AuthForms/SignUpForm.js +105 -104
  10. package/src/blocks/Payment/PaymentMethod.js +0 -1
  11. package/src/blocks/Payment/SelectPayment.js +53 -54
  12. package/src/index.js +0 -1
  13. package/src/layout/Box.js +36 -33
  14. package/src/stories/BlocksStories/AuthForm.stories.js +105 -39
  15. package/src/stories/BlocksStories/PaymentForm.stories.js +20 -35
  16. package/src/stories/BlocksStories/UserForm.stories.js +2 -16
  17. package/src/stories/LayoutStories/Box.stories.js +4 -10
  18. package/src/stories/UIStories/ActionButton.stories.js +1 -6
  19. package/src/stories/UIStories/AdaptiveButton.stories.js +1 -6
  20. package/src/stories/UIStories/Alert.stories.js +2 -3
  21. package/src/stories/UIStories/LogoButtons.stories.js +2 -6
  22. package/src/stories/UIStories/RadioSelector.stories.js +0 -3
  23. package/src/stories/UIStories/SettingsRow.stories.js +3 -16
  24. package/src/themes/HawaProvider.js +187 -178
  25. package/src/themes/QawaimTheme.js +199 -0
  26. package/src/ui/ActionButton.js +32 -35
  27. package/src/ui/AdaptiveButton.js +3 -8
  28. package/src/ui/HawaAlert.js +22 -24
  29. package/src/ui/HawaButton.js +43 -44
  30. package/src/ui/HawaInputLabel.js +22 -23
  31. package/src/ui/HawaLogoButton.js +7 -45
  32. package/src/ui/HawaRadio.js +25 -34
  33. package/src/ui/HawaSettingsRow.js +1 -27
  34. package/src/ui/HawaTextArea.js +1 -1
  35. package/src/ui/HawaTextField.js +146 -93
  36. package/src/ui/HawaTypography.js +19 -21
  37. package/src/ui/Row.js +1 -1
  38. package/src/ui/StyledTooltip.js +1 -1
  39. package/src/ui/TabPanel.js +1 -1
  40. package/storybook-static/8.1bf48ea7.iframe.bundle.js +1 -0
  41. package/storybook-static/iframe.html +1 -1
  42. package/storybook-static/main.b00949db.iframe.bundle.js +1 -0
  43. package/storybook-static/{runtime~main.cfefe972.iframe.bundle.js → runtime~main.f1ebae9b.iframe.bundle.js} +1 -1
  44. package/storybook-static/vendors~main.f8d30727.iframe.bundle.js +76 -0
  45. package/storybook-static/{vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt → vendors~main.f8d30727.iframe.bundle.js.LICENSE.txt} +0 -0
  46. package/storybook-static/vendors~main.f8d30727.iframe.bundle.js.map +1 -0
  47. package/src/stories/HawaProvider.stories.js +0 -22
  48. package/storybook-static/8.c4cb6081.iframe.bundle.js +0 -1
  49. package/storybook-static/main.5731dbe3.iframe.bundle.js +0 -1
  50. package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +0 -76
  51. package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +0 -1
@@ -1,17 +1,12 @@
1
1
  import React from "react";
2
- import {
3
- HawaTextField,
4
- ActionButton,
5
- HawaAlert,
6
- HawaTypography,
7
- HawaLogoButton
8
- } from "../../ui";
9
- import { Box } from "../../layout";
2
+ import { HawaTextField, HawaTypography, HawaLogoButton } from "../../ui";
10
3
  import { FormProvider, useForm } from "react-hook-form";
11
-
12
4
  import InputAdornment from "@mui/material/InputAdornment";
13
5
  import EmailIcon from "@mui/icons-material/MailOutline";
14
6
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
7
+ import Container from "@mui/material/Container";
8
+ import Button from "@mui/material/Button";
9
+ import Alert from "@mui/material/Alert";
15
10
 
16
11
  export const SignInForm = (props) => {
17
12
  const methods = useForm();
@@ -21,69 +16,69 @@ export const SignInForm = (props) => {
21
16
  } = methods;
22
17
 
23
18
  return (
24
- <Box maxWidth={400} noColor noMargin noPadding>
25
- <Box noMargin>
26
- {props.error && (
27
- <HawaAlert text="This is a sign in alert" severity="error" />
28
- )}
29
- <FormProvider {...methods}>
30
- <form onSubmit={handleSubmit(props.handleSignIn)}>
31
- <HawaTextField
32
- type="text"
33
- name="email"
34
- inputLabel="Email"
35
- placeholder="Enter your email"
36
- startAdornment={
37
- <InputAdornment position="start">
38
- <EmailIcon />
39
- </InputAdornment>
19
+ <Container maxWidth="xs" variant="auth">
20
+ {props.error && (
21
+ <Alert severity="error">
22
+ {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
23
+ {props.errorText}
24
+ </Alert>
25
+ )}
26
+ <FormProvider {...methods}>
27
+ <form onSubmit={handleSubmit(props.handleSignIn)}>
28
+ <HawaTextField
29
+ fullWidth
30
+ type="text"
31
+ name="email"
32
+ label={props.texts.emailLabel}
33
+ placeholder={props.texts.emailPlaceholder}
34
+ startAdornment={
35
+ <InputAdornment position="start">
36
+ <EmailIcon />
37
+ </InputAdornment>
38
+ }
39
+ rules={{
40
+ required: props.texts.emailRequired,
41
+ pattern: {
42
+ value:
43
+ /^(([^<>()[\]\\.,;:\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,}))$/,
44
+ message: props.texts.emailInvalidText
40
45
  }
41
- rules={{
42
- required: "Email is required",
43
- pattern: {
44
- value:
45
- /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
46
- message: "Invalid email address"
47
- }
48
- }}
49
- helperText={errors.email?.message}
50
- />
46
+ }}
47
+ helperText={errors.email?.message}
48
+ />
51
49
 
52
- <HawaTextField
53
- name="password"
54
- placeholder="Enter password"
55
- type="password"
56
- inputLabel="Password"
57
- startAdornment={
58
- <InputAdornment position="start">
59
- <PasswordIcon />
60
- </InputAdornment>
61
- }
62
- rules={{
63
- required: "Password is rquired"
64
- }}
65
- helperText={errors.password?.message}
66
- />
67
- <HawaTypography
68
- style={{
69
- cursor: "pointer",
70
- marginTop: 5,
71
- width: "max-content",
72
- padding: 5
73
- }}
74
- onClick={() => console.log("res")}
75
- >
76
- Forgot password?
77
- </HawaTypography>
78
- <ActionButton
79
- type="submit"
80
- fullWidth
81
- last={"true"}
82
- text={"Sign In"}
83
- />
84
- </form>
85
- </FormProvider>
86
- </Box>
50
+ <HawaTextField
51
+ fullWidth
52
+ name="password"
53
+ placeholder={props.texts.passwordPlaceholder}
54
+ type="password"
55
+ label={props.texts.passwordLabel}
56
+ startAdornment={
57
+ <InputAdornment position="start">
58
+ <PasswordIcon />
59
+ </InputAdornment>
60
+ }
61
+ rules={{
62
+ required: props.texts.passwordRequired
63
+ }}
64
+ helperText={errors.password?.message}
65
+ />
66
+ <HawaTypography
67
+ style={{
68
+ cursor: "pointer",
69
+ marginTop: 5,
70
+ width: "max-content",
71
+ padding: 5
72
+ }}
73
+ onClick={props.handleForgotPassword}
74
+ >
75
+ {props.texts.forgotPasswordText}
76
+ </HawaTypography>
77
+ <Button type="submit" fullWidth variant="last">
78
+ {props.texts.signInText}
79
+ </Button>
80
+ </form>
81
+ </FormProvider>
87
82
  <HawaTypography
88
83
  style={{
89
84
  marginTop: 5,
@@ -92,39 +87,41 @@ export const SignInForm = (props) => {
92
87
  padding: 5
93
88
  }}
94
89
  >
95
- New user?{" "}
90
+ {props.texts.newUserText}{" "}
96
91
  <span
97
- onClick={() => console.log("res")}
92
+ onClick={props.handleRouteToSignUp}
98
93
  style={{
99
94
  cursor: "pointer",
100
95
  color: "blue",
101
96
  textAlign: "center"
102
97
  }}
103
98
  >
104
- Sign up
99
+ {props.texts.signUpText}
105
100
  </span>
106
101
  </HawaTypography>
107
- {props.viaGoogle && (
108
- <HawaLogoButton
109
- logo="google"
110
- buttonText={props.googleButtonLabel}
111
- handleClick={props.handleGoogleSignIn}
112
- />
113
- )}
114
- {props.viaGithub && (
115
- <HawaLogoButton
116
- logo="github"
117
- buttonText={props.githubButtonLabel}
118
- handleClick={props.handleGithubSignIn}
119
- />
120
- )}
121
- {props.viaTwitter && (
122
- <HawaLogoButton
123
- logo="twitter"
124
- buttonText={props.twitterButtonLabel}
125
- handleClick={props.handleTwitterSignIn}
126
- />
127
- )}
128
- </Box>
102
+ <div style={{ display: "flex", flexDirection: "column" }}>
103
+ {props.viaGoogle && (
104
+ <HawaLogoButton
105
+ logo="google"
106
+ buttonText={props.texts.googleButtonLabel}
107
+ onClick={props.handleGoogleSignIn}
108
+ />
109
+ )}
110
+ {props.viaGithub && (
111
+ <HawaLogoButton
112
+ logo="github"
113
+ buttonText={props.texts.githubButtonLabel}
114
+ onClick={props.handleGithubSignIn}
115
+ />
116
+ )}
117
+ {props.viaTwitter && (
118
+ <HawaLogoButton
119
+ logo="twitter"
120
+ buttonText={props.texts.twitterButtonLabel}
121
+ onClick={props.handleTwitterSignIn}
122
+ />
123
+ )}
124
+ </div>
125
+ </Container>
129
126
  );
130
127
  };
@@ -1,142 +1,143 @@
1
1
  import React from "react";
2
- import { Box } from "../../layout";
3
- import {
4
- HawaTextField,
5
- ActionButton,
6
- HawaAlert,
7
- HawaTypography,
8
- HawaLogoButton
9
- } from "../../ui";
2
+ import { HawaTextField, HawaLogoButton } from "../../ui";
10
3
  import PropTypes from "prop-types";
11
4
  import { FormProvider, useForm } from "react-hook-form";
12
-
13
5
  import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
14
6
  import InputAdornment from "@mui/material/InputAdornment";
15
7
  import EmailIcon from "@mui/icons-material/MailOutline";
16
8
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
9
+ import Container from "@mui/material/Container";
10
+ import Typography from "@mui/material/Typography";
11
+ import Button from "@mui/material/Button";
12
+ import Alert from "@mui/material/Alert";
17
13
 
18
14
  export const SignUpForm = (props) => {
19
15
  const methods = useForm();
20
16
  const {
21
17
  formState: { errors },
22
- handleSubmit,
23
- getValues,
24
- register,
25
- watch,
26
- reset,
27
- setValue
18
+ handleSubmit
28
19
  } = methods;
29
20
 
30
21
  return (
31
- <Box maxWidth={400} noColor noMargin noPadding>
32
- <Box noMargin>
33
- {props.error && (
22
+ <Container maxWidth="xs" variant="auth">
23
+ {props.error && (
24
+ <Alert severity="error">
25
+ {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
26
+ {props.errorText}
27
+ </Alert>
28
+ )}
29
+ {/* {props.error && (
34
30
  <HawaAlert text="This is a sign in alert" severity="error" />
35
- )}
36
- <FormProvider {...methods}>
37
- <form onSubmit={handleSubmit(props.handleSignUp)}>
38
- <HawaTextField
39
- name="fullName"
40
- placeholder="Fulan AlFulani"
41
- type="text"
42
- inputLabel="Full Name"
43
- startAdornment={
44
- <InputAdornment position="start">
45
- <PersonIcon />
46
- </InputAdornment>
47
- }
48
- rules={{
49
- required: "Full name rquired"
50
- }}
51
- helperText={errors.fullName?.message}
52
- />
31
+ )} */}
32
+ <FormProvider {...methods}>
33
+ <form onSubmit={handleSubmit(props.handleSignUp)}>
34
+ <HawaTextField
35
+ fullWidth
36
+ type="text"
37
+ label={props.texts.fullNameLabel}
38
+ name="fullName"
39
+ placeholder={props.texts.fullNamePlaceholder}
40
+ inputLabel={props.texts.fullNameLabel}
41
+ startAdornment={
42
+ <InputAdornment position="start">
43
+ <PersonIcon />
44
+ </InputAdornment>
45
+ }
46
+ helperText={errors.fullName?.message}
47
+ />
53
48
 
54
- <HawaTextField
55
- type="text"
56
- inputLabel="Email"
57
- placeholder="Enter your email"
58
- name="email"
59
- startAdornment={
60
- <InputAdornment position="start">
61
- <EmailIcon />
62
- </InputAdornment>
49
+ <HawaTextField
50
+ fullWidth
51
+ type="text"
52
+ label={props.texts.emailLabel}
53
+ placeholder={props.texts.emailPlaceholder}
54
+ name="email"
55
+ startAdornment={
56
+ <InputAdornment position="start">
57
+ <EmailIcon />
58
+ </InputAdornment>
59
+ }
60
+ rules={{
61
+ required: props.texts.emailRequiredText,
62
+ pattern: {
63
+ value:
64
+ /^(([^<>()[\]\\.,;:\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,}))$/,
65
+ message: props.texts.emailInvalidText
63
66
  }
64
- rules={{
65
- required: "Email required",
66
- pattern: {
67
- value:
68
- /^(([^<>()[\]\\.,;:\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,}))$/,
69
- message: "Invalid email address"
70
- }
71
- }}
72
- helperText={errors.email?.message}
73
- />
74
- <HawaTextField
75
- name="password"
76
- placeholder="Minimum 8 characters"
77
- type="password"
78
- inputLabel="Password"
79
- startAdornment={
80
- <InputAdornment position="start">
81
- <PasswordIcon />
82
- </InputAdornment>
67
+ }}
68
+ helperText={errors.email?.message}
69
+ />
70
+ <HawaTextField
71
+ fullWidth
72
+ name="password"
73
+ placeholder={props.texts.passwordPlaceholder}
74
+ type="password"
75
+ label={props.texts.passwordLabel}
76
+ startAdornment={
77
+ <InputAdornment position="start">
78
+ <PasswordIcon />
79
+ </InputAdornment>
80
+ }
81
+ rules={{
82
+ required: props.texts.passwordRequiredText,
83
+ minLength: {
84
+ value: 8,
85
+ message: props.texts.passwordTooShortText
83
86
  }
84
- rules={{
85
- required: "Password rquired",
86
- minLength: {
87
- value: 8,
88
- message: "Password too short"
89
- }
90
- }}
91
- helperText={errors.password?.message}
92
- />
87
+ }}
88
+ helperText={errors.password?.message}
89
+ />
90
+
91
+ <Button fullWidth variant="last" type="submit">
92
+ {props.texts.signUpText}
93
+ </Button>
94
+ </form>
95
+ </FormProvider>
93
96
 
94
- <ActionButton fullWidth type="submit" text="Sign Up" last />
95
- </form>
96
- </FormProvider>
97
- </Box>
98
- <HawaTypography
97
+ <Typography
98
+ variant="subtitle2"
99
99
  style={{
100
100
  marginTop: 5,
101
- // width: "max-content",
102
101
  textAlign: "center",
103
102
  padding: 5
104
103
  }}
105
104
  >
106
105
  Existing user?{" "}
107
106
  <span
108
- onClick={() => console.log("res")}
107
+ onClick={props.handleRouteToSignIn}
109
108
  style={{
110
109
  cursor: "pointer",
111
110
  color: "blue",
112
111
  textAlign: "center"
113
112
  }}
114
113
  >
115
- Sign in
114
+ {props.texts.signInText}
116
115
  </span>
117
- </HawaTypography>
118
- {props.viaGoogle && (
119
- <HawaLogoButton
120
- logo="google"
121
- buttonText={props.googleButtonLabel}
122
- handleClick={props.handleGoogleSignIn}
123
- />
124
- )}
125
- {props.viaGithub && (
126
- <HawaLogoButton
127
- logo="github"
128
- buttonText={props.githubButtonLabel}
129
- handleClick={props.handleGithubSignIn}
130
- />
131
- )}
132
- {props.viaTwitter && (
133
- <HawaLogoButton
134
- logo="twitter"
135
- buttonText={props.twitterButtonLabel}
136
- handleClick={props.handleTwitterSignIn}
137
- />
138
- )}
139
- </Box>
116
+ </Typography>
117
+ <div style={{ display: "flex", flexDirection: "column" }}>
118
+ {props.viaGoogle && (
119
+ <HawaLogoButton
120
+ logo="google"
121
+ buttonText={props.texts.googleButtonLabel}
122
+ onClick={props.handleGoogleSignUp}
123
+ />
124
+ )}
125
+ {props.viaGithub && (
126
+ <HawaLogoButton
127
+ logo="github"
128
+ buttonText={props.texts.githubButtonLabel}
129
+ onClick={props.handleGithubSignUp}
130
+ />
131
+ )}
132
+ {props.viaTwitter && (
133
+ <HawaLogoButton
134
+ logo="twitter"
135
+ buttonText={props.texts.twitterButtonLabel}
136
+ onClick={props.handleTwitterSignUp}
137
+ />
138
+ )}
139
+ </div>
140
+ </Container>
140
141
  );
141
142
  };
142
143
 
@@ -78,7 +78,6 @@ const PaymentMethodButton = (props) => {
78
78
  padding: 20,
79
79
  width: "90%",
80
80
  margin: 10,
81
- borderRadius: "var(--borderR)"
82
81
  }}
83
82
  onClick={(e) => props.handlePaymentMethod(e, props.methodCode)}
84
83
  >
@@ -2,63 +2,62 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { Box } from "../../layout";
4
4
  import { HawaTextField, HawaTypography, HawaLogoButton } from "../../ui";
5
+ import { Container } from "@mui/material";
5
6
 
6
7
  export const SelectPayment = (props) => {
7
8
  return (
8
- <Box maxWidth={400} noColor noMargin noPadding>
9
- <Box noMargin>
10
- <HawaTypography align="center">Choose Payment Method</HawaTypography>
11
- {props.viaWallet && (
12
- <HawaLogoButton
13
- logo="wallet"
14
- buttonText={props.walletLabel}
15
- onClick={props.handleWallet}
16
- />
17
- )}
18
- {props.viaCreditCard && (
19
- <HawaLogoButton
20
- logo="visa/master"
21
- buttonText={props.visaMasterLabel}
22
- handleClick={props.handleCreditCard}
23
- />
24
- )}
25
- {props.viaMada && (
26
- <HawaLogoButton
27
- logo="mada"
28
- buttonText={props.madaLabel}
29
- handleClick={props.handleMada}
30
- />
31
- )}
32
- {props.viaSTCPay && (
33
- <HawaLogoButton
34
- logo="stcpay"
35
- buttonText={props.stcPayLabel}
36
- handleClick={props.handleSTCPay}
37
- />
38
- )}
39
- {props.viaPayPal && (
40
- <HawaLogoButton
41
- logo="paypal"
42
- buttonText={props.paypalLabel}
43
- handleClick={props.handlePayPal}
44
- />
45
- )}
46
- {props.viaGooglePay && (
47
- <HawaLogoButton
48
- logo="googlepay"
49
- buttonText={props.googlePayLabel}
50
- handleClick={props.handleGooglePay}
51
- />
52
- )}
53
- {props.viaApplePay && (
54
- <HawaLogoButton
55
- logo="applepay"
56
- buttonText={props.applePayLabel}
57
- handleClick={props.handleApplePay}
58
- />
59
- )}
60
- </Box>
61
- </Box>
9
+ <Container maxWidth="xs" >
10
+ <HawaTypography align="center">Choose Payment Method</HawaTypography>
11
+ {props.viaWallet && (
12
+ <HawaLogoButton
13
+ logo="wallet"
14
+ buttonText={props.walletLabel}
15
+ onClick={props.handleWallet}
16
+ />
17
+ )}
18
+ {props.viaCreditCard && (
19
+ <HawaLogoButton
20
+ logo="visa/master"
21
+ buttonText={props.visaMasterLabel}
22
+ handleClick={props.handleCreditCard}
23
+ />
24
+ )}
25
+ {props.viaMada && (
26
+ <HawaLogoButton
27
+ logo="mada"
28
+ buttonText={props.madaLabel}
29
+ handleClick={props.handleMada}
30
+ />
31
+ )}
32
+ {props.viaSTCPay && (
33
+ <HawaLogoButton
34
+ logo="stcpay"
35
+ buttonText={props.stcPayLabel}
36
+ handleClick={props.handleSTCPay}
37
+ />
38
+ )}
39
+ {props.viaPayPal && (
40
+ <HawaLogoButton
41
+ logo="paypal"
42
+ buttonText={props.paypalLabel}
43
+ handleClick={props.handlePayPal}
44
+ />
45
+ )}
46
+ {props.viaGooglePay && (
47
+ <HawaLogoButton
48
+ logo="googlepay"
49
+ buttonText={props.googlePayLabel}
50
+ handleClick={props.handleGooglePay}
51
+ />
52
+ )}
53
+ {props.viaApplePay && (
54
+ <HawaLogoButton
55
+ logo="applepay"
56
+ buttonText={props.applePayLabel}
57
+ handleClick={props.handleApplePay}
58
+ />
59
+ )}
60
+ </Container>
62
61
  );
63
62
  };
64
63
 
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./blocks/Account";
2
2
  export * from "./blocks/AuthForms";
3
3
  export * from "./blocks/Payment";
4
- //export * from "./components/Hawa";