@sikka/hawa 0.0.31 → 0.0.32

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.
@@ -53,7 +53,7 @@ export const ResetPasswordForm = (props) => {
53
53
  </form>
54
54
  ) : (
55
55
  <HawaTypography style={{ textAlign: "center", margin: 5 }}>
56
- {props.emailSentText}
56
+ {props.texts.emailSentText}
57
57
  </HawaTypography>
58
58
  )}
59
59
  </Container>
@@ -68,8 +68,12 @@ ResetPasswordForm.propTypes = {
68
68
  emailPlaceholder: PropTypes.string,
69
69
  emailRequiredText: PropTypes.string,
70
70
  emailInvalidText: PropTypes.string,
71
+ emailSentText: PropTypes.string,
71
72
  resetPassword: PropTypes.string
72
73
  }),
73
- emailSentText: PropTypes.string,
74
+ /**
75
+ * a boolean to replace the form with a success message
76
+ */
77
+ sent: PropTypes.bool,
74
78
  handleResetPassword: PropTypes.func
75
79
  };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { HawaTextField, HawaLogoButton } from "../../elements";
2
+ import { HawaTextField, HawaLogoButton, HawaAlert } from "../../elements";
3
3
  import PropTypes from "prop-types";
4
4
  import { Controller, FormProvider, useForm } from "react-hook-form";
5
5
  import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
@@ -10,8 +10,6 @@ import Container from "@mui/material/Container";
10
10
  import Divider from "@mui/material/Divider";
11
11
  import Typography from "@mui/material/Typography";
12
12
  import Button from "@mui/material/Button";
13
- import Alert from "@mui/material/Alert";
14
- import AlertTitle from "@mui/material/AlertTitle";
15
13
 
16
14
  export const SignUpForm = (props) => {
17
15
  const methods = useForm();
@@ -27,11 +25,12 @@ export const SignUpForm = (props) => {
27
25
  variant="auth"
28
26
  style={{ direction: props.lang === "ar" ? "rtl" : "ltr" }}
29
27
  >
30
- {props.error && (
31
- <Alert severity="error" variant="inContainer">
32
- {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
33
- {props.errorText}
34
- </Alert>
28
+ {props.showError && (
29
+ <HawaAlert
30
+ title={props.errorTitle}
31
+ text={props.errorText}
32
+ severity="error"
33
+ />
35
34
  )}
36
35
 
37
36
  <FormProvider {...methods}>
@@ -163,26 +162,6 @@ export const SignUpForm = (props) => {
163
162
  );
164
163
  };
165
164
 
166
- // fullNameLabel: "Full Name",
167
- // fullNamePlaceholder: "Fulan AlFulani",
168
- // fullNameRequiredText: "Full Name is required",
169
- // emailLabel: "Email",
170
- // emailPlaceholder: "Enter your email",
171
- // emailRequiredText: "Email is required",
172
- // emailInvalidText: "Invalid email address",
173
- // passwordLabel: "Password",
174
- // passwordPlaceholder: "Minimum 8 characters",
175
- // passwordRequiredText: "Password is required",
176
- // passwordTooShortText: "Password too short",
177
- // forgotPasswordText: "Forgot password?",
178
- // newUserText: "New user?",
179
- // signUpText: "Sign up",
180
- // signInText: "Sign in",
181
- // existingUserText: "Existing User?",
182
- // googleButtonLabel: "Sign in with Google",
183
- // githubButtonLabel: "Sign in with Github",
184
- // twitterButtonLabel: "Sign in with Twitter"
185
-
186
165
  SignUpForm.propTypes = {
187
166
  /**
188
167
  * An object of all the texts in the blocks
@@ -48,16 +48,15 @@ export const ChargeWalletForm = (props) => {
48
48
  field.onChange(parseFloat(e.target.value));
49
49
  setWalletAmount(e.target.value);
50
50
  }}
51
+ helperText={errors.amount?.message}
51
52
  />
52
53
  )}
54
+ rules={{
55
+ required: props.texts.amountRequired
56
+ }}
53
57
  />
54
58
 
55
- <Button
56
- type="submit"
57
- fullWidth
58
- variant="last"
59
- onClick={props.handleSignIn}
60
- >
59
+ <Button type="submit" fullWidth variant="last">
61
60
  {props.texts.chargeWallet}
62
61
  </Button>
63
62
  </form>
@@ -67,9 +66,20 @@ export const ChargeWalletForm = (props) => {
67
66
  };
68
67
 
69
68
  ChargeWalletForm.propTypes = {
69
+ /**
70
+ * The texts object for all the texts in the block
71
+ */
70
72
  texts: PropTypes.shape({
71
73
  amountLabel: PropTypes.string,
72
- chargeWallet: PropTypes.string
74
+ chargeWallet: PropTypes.string,
75
+ amountRequired: PropTypes.string
73
76
  }),
74
- handleChargeWallet: PropTypes.func
77
+ /**
78
+ * Function called when charge wallet button is clicked
79
+ */
80
+ handleChargeWallet: PropTypes.func,
81
+ /**
82
+ * The currency text under the amount
83
+ */
84
+ currency: PropTypes.string
75
85
  };
@@ -100,6 +100,9 @@ export const ConfirmationPage = (props) => {
100
100
  };
101
101
 
102
102
  ConfirmationPage.propTypes = {
103
+ /**
104
+ * The texts object for all the texts in the block
105
+ */
103
106
  texts: PropTypes.shape({
104
107
  print: PropTypes.string,
105
108
  history: PropTypes.string,
@@ -21,19 +21,12 @@ export const CreditCardForm = (props) => {
21
21
  placeholder="Enter password"
22
22
  type="tel"
23
23
  label="Card Number"
24
- // variant="unscrollable"
25
- // startAdornment={
26
- // <InputAdornment position="start">
27
- // <PasswordIcon />
28
- // </InputAdornment>
29
- // }
30
24
  rules={{
31
25
  required: "Password is rquired"
32
26
  }}
33
27
  helperText={errors.password?.message}
34
28
  />
35
29
 
36
-
37
30
  <Controller
38
31
  control={control}
39
32
  name="cardName"
@@ -44,11 +37,6 @@ export const CreditCardForm = (props) => {
44
37
  placeholder="Enter password"
45
38
  type="password"
46
39
  label="Name On Card"
47
- // startAdornment={
48
- // <InputAdornment position="start">
49
- // <PasswordIcon />
50
- // </InputAdornment>
51
- // }
52
40
  rules={{
53
41
  required: "Password is rquired"
54
42
  }}
@@ -66,11 +54,6 @@ export const CreditCardForm = (props) => {
66
54
  placeholder="Enter password"
67
55
  type="password"
68
56
  label="Expiry Date"
69
- // startAdornment={
70
- // <InputAdornment position="start">
71
- // <PasswordIcon />
72
- // </InputAdornment>
73
- // }
74
57
  rules={{
75
58
  required: "Password is rquired"
76
59
  }}
@@ -88,11 +71,6 @@ export const CreditCardForm = (props) => {
88
71
  placeholder="Enter password"
89
72
  type="password"
90
73
  label="CCV"
91
- // startAdornment={
92
- // <InputAdornment position="start">
93
- // <PasswordIcon />
94
- // </InputAdornment>
95
- // }
96
74
  rules={{
97
75
  required: "Password is rquired"
98
76
  }}
@@ -107,7 +85,6 @@ export const CreditCardForm = (props) => {
107
85
  variant="last"
108
86
  onClick={props.handlePayWithCreditCard}
109
87
  >
110
- {/* {props.texts.signInText} */}
111
88
  {"Pay with Credit Card"}
112
89
  </Button>
113
90
  </form>
@@ -58,6 +58,9 @@ export const PricingPlans = (props) => {
58
58
  };
59
59
 
60
60
  PricingPlans.propTypes = {
61
+ /**
62
+ * An array of the pricing plans
63
+ */
61
64
  plans: PropTypes.arrayOf(
62
65
  PropTypes.shape({
63
66
  title: PropTypes.string,
@@ -4,6 +4,7 @@ import Button from "@mui/material/Button";
4
4
  import Typography from "@mui/material/Typography";
5
5
  import CheckIcon from "@mui/icons-material/CheckCircleOutlined";
6
6
  import PropTypes from "prop-types";
7
+ import Chip from "@mui/material/Chip";
7
8
 
8
9
  export const HawaPricingCard = (props) => {
9
10
  let isArabic = props.lang === "ar";
@@ -24,6 +25,7 @@ export const HawaPricingCard = (props) => {
24
25
  sar: isArabic ? "ريال" : "SAR"
25
26
  };
26
27
  let featuresMapping = isArabic ? props.features_ar : props.features;
28
+ let chipSpacing = isArabic ? { left: 10 } : { right: 10 };
27
29
  return (
28
30
  <Container
29
31
  maxWidth="xs"
@@ -31,6 +33,19 @@ export const HawaPricingCard = (props) => {
31
33
  style={{ direction: isArabic ? "rtl" : "ltr" }}
32
34
  >
33
35
  <Container variant="plan-header">
36
+ {props.discount && (
37
+ <Chip
38
+ label={props.discount}
39
+ variant="standard"
40
+ style={{
41
+ maxWidth: "fit-content",
42
+ position: "absolute",
43
+ bottom: 10,
44
+ ...chipSpacing
45
+ }}
46
+ color="success"
47
+ />
48
+ )}
34
49
  <Typography variant="h3" fontWeight={500}>
35
50
  {isArabic ? props.title_ar : props.title}
36
51
  </Typography>
@@ -144,5 +159,7 @@ HawaPricingCard.propTypes = {
144
159
  subtitle: PropTypes.string,
145
160
  subtitle_ar: PropTypes.string,
146
161
  features: PropTypes.array,
147
- features_ar: PropTypes.array
162
+ features_ar: PropTypes.array,
163
+ currency: PropTypes.oneOf(["sar", "usd"]),
164
+ cycleText: PropTypes.oneOf(["monthly", "3-months", "6-months", "annually"])
148
165
  };
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
5
5
 
6
6
  export const HawaRange = (props) => {
7
7
  return (
8
- <Stack spacing={2} direction="row" alignItems="center">
8
+ <Stack spacing={2} direction="row" alignItems="center" style={props.style}>
9
9
  {props.startElement}
10
10
  <Slider
11
11
  size="small"
@@ -18,9 +18,14 @@ export const HawaRange = (props) => {
18
18
  );
19
19
  };
20
20
  HawaRange.propTypes = {
21
+ /**
22
+ * The element at the side where the range value is 0
23
+ * Can be an icon
24
+ */
21
25
  startElement: PropTypes.element,
26
+ /**
27
+ * The element at the side where the range value is 100
28
+ */
22
29
  endElement: PropTypes.element,
23
- defaultValue: PropTypes.string,
24
- handleChange: PropTypes.func,
25
- location: PropTypes.string
30
+ handleChange: PropTypes.func
26
31
  };
@@ -16,9 +16,13 @@ export const HawaTextField = (props) => {
16
16
  }}
17
17
  >
18
18
  {props.label && <InputLabel>{props.label}</InputLabel>}
19
-
20
19
  {props.helperText && (
21
- <Typography variant="validation">{props.helperText}</Typography>
20
+ <Typography
21
+ style={{ marginBottom: !props.label && 10 }}
22
+ variant="validation"
23
+ >
24
+ {props.helperText}
25
+ </Typography>
22
26
  )}
23
27
  </div>
24
28
  <Input disableUnderline {...props} />
@@ -17,7 +17,9 @@ import Avatar from "@mui/material/Avatar";
17
17
  import Tooltip from "@mui/material/Tooltip";
18
18
  import { HawaPopMenu } from "../elements/HawaPopMenu";
19
19
  // use this to detect size and change things accordingly
20
- // import useMediaQuery from '@mui/material/useMediaQuery';
20
+ import useMediaQuery from "@mui/material/useMediaQuery";
21
+ import { BottomNavigation, BottomNavigationAction } from "@mui/material";
22
+ import { RestoreOutlined } from "@mui/icons-material";
21
23
 
22
24
  const drawerWidth = 240;
23
25
 
@@ -36,7 +38,7 @@ const closedMixin = (theme) => ({
36
38
  duration: theme.transitions.duration.leavingScreen
37
39
  }),
38
40
  overflowX: "hidden",
39
- width: `calc(${theme.spacing(7)} + 1px)`,
41
+ width: `calc(${theme.spacing(8)} + 1px)`,
40
42
  [theme.breakpoints.up("sm")]: {
41
43
  width: `calc(${theme.spacing(8)} + 1px)`
42
44
  }
@@ -89,10 +91,11 @@ const Drawer = styled(MuiDrawer, {
89
91
  export function HawaAppLayout(props) {
90
92
  const theme = useTheme();
91
93
  const [open, setOpen] = React.useState(true);
94
+ const matches = useMediaQuery("(max-width:600px)");
92
95
 
93
96
  const [anchorElNav, setAnchorElNav] = React.useState(null);
94
97
  const [anchorElUser, setAnchorElUser] = React.useState(null);
95
-
98
+ console.log("match is ", matches);
96
99
  const handleOpenNavMenu = (event) => setAnchorElNav(event.currentTarget);
97
100
  const handleOpenUserMenu = (event) => setAnchorElUser(event.currentTarget);
98
101
  const handleCloseNavMenu = () => setAnchorElNav(null);
@@ -102,6 +105,19 @@ export function HawaAppLayout(props) {
102
105
 
103
106
  return (
104
107
  <Box sx={{ display: "flex" }}>
108
+ {matches && (
109
+ <BottomNavigation
110
+ showLabels
111
+ // value={value}
112
+ // onChange={(event, newValue) => {
113
+ // setValue(newValue);
114
+ // }}
115
+ >
116
+ <BottomNavigationAction label="Recents" icon={<RestoreOutlined />} />
117
+ <BottomNavigationAction label="Favorites" icon={<RestoreOutlined />} />
118
+ <BottomNavigationAction label="Nearby" icon={<RestoreOutlined />} />
119
+ </BottomNavigation>
120
+ )}{" "}
105
121
  <AppBar variant="appbar" position="fixed" open={open}>
106
122
  <Toolbar variant="appbar">
107
123
  <IconButton
@@ -345,4 +345,4 @@
345
345
 
346
346
 
347
347
 
348
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.6c796c97.iframe.bundle.js"></script><script src="main.4bd34158.iframe.bundle.js"></script></body></html>
348
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.924b4d3c.iframe.bundle.js"></script><script src="main.c86d0451.iframe.bundle.js"></script></body></html>