@sikka/hawa 0.0.23 → 0.0.26

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.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { HawaTextField } from "../../elements";
3
- import { FormProvider, useForm } from "react-hook-form";
3
+ import { Controller, FormProvider, useForm } from "react-hook-form";
4
4
  import Button from "@mui/material/Button";
5
5
  import Container from "@mui/material/Container";
6
6
 
@@ -8,59 +8,109 @@ export const CreditCardForm = (props) => {
8
8
  const methods = useForm();
9
9
  const {
10
10
  formState: { errors },
11
- handleSubmit
11
+ handleSubmit,
12
+ control
12
13
  } = methods;
13
14
 
14
15
  return (
15
16
  <Container maxWidth="xs">
16
- <FormProvider {...methods}>
17
- <form onSubmit={handleSubmit(props.handle)}>
18
- <HawaTextField
19
- fullWidth
20
- name="password"
21
- placeholder="Enter password"
22
- type="tel"
23
- label="Card Number"
24
- // variant="unscrollable"
25
- // startAdornment={
26
- // <InputAdornment position="start">
27
- // <PasswordIcon />
28
- // </InputAdornment>
29
- // }
30
- rules={{
31
- required: "Password is rquired"
32
- }}
33
- helperText={errors.password?.message}
34
- />
17
+ <form onSubmit={handleSubmit(props.handle)}>
18
+ <HawaTextField
19
+ fullWidth
20
+ name="password"
21
+ placeholder="Enter password"
22
+ type="tel"
23
+ label="Card Number"
24
+ // variant="unscrollable"
25
+ // startAdornment={
26
+ // <InputAdornment position="start">
27
+ // <PasswordIcon />
28
+ // </InputAdornment>
29
+ // }
30
+ rules={{
31
+ required: "Password is rquired"
32
+ }}
33
+ helperText={errors.password?.message}
34
+ />
35
35
 
36
- <HawaTextField
37
- fullWidth
38
- name="password"
39
- placeholder="Enter password"
40
- type="password"
41
- label="Name On Card"
42
- // startAdornment={
43
- // <InputAdornment position="start">
44
- // <PasswordIcon />
45
- // </InputAdornment>
46
- // }
47
- rules={{
48
- required: "Password is rquired"
49
- }}
50
- helperText={errors.password?.message}
51
- />
36
+
37
+ <Controller
38
+ control={control}
39
+ name="cardName"
40
+ render={({ field }) => (
41
+ <HawaTextField
42
+ fullWidth
43
+ name="password"
44
+ placeholder="Enter password"
45
+ type="password"
46
+ label="Name On Card"
47
+ // startAdornment={
48
+ // <InputAdornment position="start">
49
+ // <PasswordIcon />
50
+ // </InputAdornment>
51
+ // }
52
+ rules={{
53
+ required: "Password is rquired"
54
+ }}
55
+ helperText={errors.password?.message}
56
+ />
57
+ )}
58
+ />
59
+ <Controller
60
+ control={control}
61
+ name="cardName"
62
+ render={({ field }) => (
63
+ <HawaTextField
64
+ fullWidth
65
+ name="password"
66
+ placeholder="Enter password"
67
+ type="password"
68
+ label="Expiry Date"
69
+ // startAdornment={
70
+ // <InputAdornment position="start">
71
+ // <PasswordIcon />
72
+ // </InputAdornment>
73
+ // }
74
+ rules={{
75
+ required: "Password is rquired"
76
+ }}
77
+ helperText={errors.password?.message}
78
+ />
79
+ )}
80
+ />
81
+ <Controller
82
+ control={control}
83
+ name="cardName"
84
+ render={({ field }) => (
85
+ <HawaTextField
86
+ fullWidth
87
+ name="password"
88
+ placeholder="Enter password"
89
+ type="password"
90
+ label="CCV"
91
+ // startAdornment={
92
+ // <InputAdornment position="start">
93
+ // <PasswordIcon />
94
+ // </InputAdornment>
95
+ // }
96
+ rules={{
97
+ required: "Password is rquired"
98
+ }}
99
+ helperText={errors.password?.message}
100
+ />
101
+ )}
102
+ />
52
103
 
53
- <Button
54
- type="submit"
55
- fullWidth
56
- variant="last"
57
- onClick={props.handlePayWithCreditCard}
58
- >
59
- {/* {props.texts.signInText} */}
60
- {"Pay with Credit Card"}
61
- </Button>
62
- </form>
63
- </FormProvider>
104
+ <Button
105
+ type="submit"
106
+ fullWidth
107
+ variant="last"
108
+ onClick={props.handlePayWithCreditCard}
109
+ >
110
+ {/* {props.texts.signInText} */}
111
+ {"Pay with Credit Card"}
112
+ </Button>
113
+ </form>
64
114
  </Container>
65
115
  );
66
116
  };
@@ -4,7 +4,7 @@ import AlertTitle from "@mui/material/AlertTitle";
4
4
 
5
5
  export const HawaAlert = (props) => {
6
6
  return (
7
- <Alert severity={props.severity}>
7
+ <Alert severity={props.severity} icon={props.hideIcon}>
8
8
  {props.title && <AlertTitle>{props.title}</AlertTitle>}
9
9
  {props.text}
10
10
  </Alert>
@@ -1,47 +1,6 @@
1
1
  import React from "react";
2
- // import { ThemeProvider } from "../themes/HawaProvider";
3
- // import { styled, darken } from "@mui/material/styles";
4
2
  import Button from "@mui/material/Button";
5
3
 
6
4
  export const HawaButton = (props) => {
7
- // let buttonStyle = {};
8
- // let currentTheme = Object.keys(hawaTheme.actionButton).find(
9
- // (tName) => tName.toLowerCase() === themeName?.toLowerCase()
10
- // );
11
- // if (currentTheme) {
12
- // buttonStyle = {
13
- // ...hawaTheme.actionButton[currentTheme],
14
- // // marginTop: theme.actionButton[currentTheme].margin,
15
- // border: props.outlined ? "2px solid black" : "none",
16
- // // borderRadius: theme.actionButton[currentTheme].borderRadius,
17
- // backgroundColor: "white",
18
- // // height: 50,
19
- // "&:hover": {
20
- // backgroundColor: darken("#ffffff", 0.1)
21
- // }
22
- // };
23
- // } else {
24
- // // Default theme
25
- // buttonStyle = {
26
- // cursor: "pointer",
27
- // display: "flex",
28
- // flexDirection: "row",
29
- // alignItems: "center",
30
- // justifyContent: "center",
31
- // marginTop: hawaTheme.actionButton[currentTheme]?.margin,
32
- // border: props.outlined ? "2px solid black" : "none",
33
- // borderRadius: 0,
34
- // //backgroundColor: "white",
35
- // backgroundColor: "red",
36
- // "&:hover": {
37
- // backgroundColor: darken("#ffffff", 0.1)
38
- // }
39
- // };
40
- // }
41
- // const StyledButton = styled(Button)(({ theme }) => {
42
- // return {
43
- // ...buttonStyle
44
- // };
45
- // });
46
5
  return <Button {...props}>{props.children}</Button>;
47
6
  };
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import FormControlLabel from "@mui/material/FormControlLabel";
3
3
  import Checkbox from "@mui/material/Checkbox";
4
- // import PropTypes from "prop-types";
5
4
 
6
5
  export const HawaCheckbox = (props) => {
7
6
  console.log("props : ", props);
@@ -1,30 +1,8 @@
1
1
  import InputLabel from "@mui/material/InputLabel";
2
2
 
3
3
  export const HawaInputLabel = (props) => {
4
- // let labelStyle = {};
5
-
6
- // let currentTheme = Object.keys(hawaTheme.actionButton).find(
7
- // (tName) => tName.toLowerCase() === themeName?.toLowerCase()
8
- // );
9
- // if (currentTheme) {
10
- // labelStyle = {
11
- // margin: 15,
12
- // marginRight: 5,
13
- // marginLeft: 5,
14
- // color: hawaTheme?.layout[currentTheme].color
15
- // };
16
- // } else {
17
- // labelStyle = {
18
- // margin: 15,
19
- // marginRight: 0,
20
- // marginLeft: 0,
21
- // color: "black"
22
- // };
23
- // }
24
4
  return (
25
- <InputLabel
26
- // style={labelStyle}
27
- >
5
+ <InputLabel>
28
6
  <div style={{ fontSize: 15 }}>{props.label}</div>
29
7
  </InputLabel>
30
8
  );
@@ -0,0 +1,56 @@
1
+ import React from "react";
2
+ import Container from "@mui/material/Container";
3
+ import Button from "@mui/material/Button";
4
+
5
+ export const HawaItemCard = (props) => {
6
+ let isArabic = props.lang === "ar";
7
+ const handleParentClick = (e) => {
8
+ e.stopPropagation();
9
+ props.onCardClick();
10
+ };
11
+ return (
12
+ <Container
13
+ onClick={handleParentClick}
14
+ maxWidth="xs"
15
+ variant="card-container"
16
+ dataValue="parent"
17
+ // variant={props.selectedPlan ? "selected-plan-card" : "plan-card"}
18
+ style={{ direction: isArabic ? "rtl" : "ltr" }}
19
+ >
20
+ {props.header && (
21
+ <Container style={{ zIndex: 20 }} variant="card-header">
22
+ {props.headerActions && (
23
+ <div
24
+ style={{
25
+ margin: 0,
26
+ marginRight: -20,
27
+ marginLeft: -20,
28
+ marginBottom: -20,
29
+ // backgroundColor: "red",
30
+ display: "flex",
31
+ paddingTop: 5,
32
+ paddingLeft: 5,
33
+ paddingRight: 5,
34
+ justifyContent: "flex-end"
35
+ }}
36
+ >
37
+ {props.headerActions}
38
+ </div>
39
+ )}
40
+ {props.header}
41
+ </Container>
42
+ )}
43
+ {props.content && (
44
+ <Container style={{ zIndex: 20 }} variant="card-content">
45
+ {props.content}
46
+ </Container>
47
+ )}
48
+
49
+ {props.actions && (
50
+ <Container style={{ zIndex: 20 }} variant="card-actions">
51
+ {props.actions}
52
+ </Container>
53
+ )}
54
+ </Container>
55
+ );
56
+ };
@@ -8,7 +8,6 @@ const useStyles = makeStyles((theme) => ({
8
8
  },
9
9
  panel: {
10
10
  backgroundColor: "var(--lightGrey)",
11
- // borderRadius: "var(--borderR)",
12
11
  height: "100%",
13
12
  width: "100%",
14
13
  padding: 10
@@ -1,7 +1,9 @@
1
1
  export * from "./AdaptiveButton";
2
2
  export * from "./ActionButton";
3
+ export * from "./OfflineBanner";
3
4
  export * from "./HawaCheckbox";
4
5
  export * from "./HawaRadio";
6
+ export * from "./HawaItemCard";
5
7
  export * from "./HawaPricingCard";
6
8
  export * from "./HawaSettingsRow";
7
9
  export * from "./HawaLogoButton";
@@ -12,4 +14,3 @@ export * from "./HawaInputLabel";
12
14
  export * from "./HawaTypography";
13
15
  export * from "./HawaAlert";
14
16
  export * from "./HawaTable";
15
- export * from "./OfflineBanner";
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from "./blocks/Account";
2
2
  export * from "./blocks/AuthForms";
3
3
  export * from "./blocks/Payment";
4
+ export * from "./elements";
5
+ export * from "./layout";
package/src/layout/Box.js CHANGED
@@ -1,41 +1,5 @@
1
1
  import React from "react";
2
2
 
3
3
  export const Box = (props) => {
4
- // let boxStyle = {};
5
-
6
- // let currentTheme = Object.keys(hawaTheme.layout).find(
7
- // (tName) => tName.toLowerCase() === themeName?.toLowerCase()
8
- // );
9
- // if (currentTheme) {
10
- // boxStyle = {
11
- // display: "flex",
12
- // flexDirection: props.horizontal ? "row" : "column",
13
- // ...hawaTheme?.layout[currentTheme],
14
- // backgroundColor: props.noColor
15
- // ? "none"
16
- // : hawaTheme.layout[currentTheme].backgroundColor,
17
- // padding: props.noPadding ? 0 : hawaTheme?.layout[currentTheme].padding,
18
- // margin: props.noMargin ? 0 : hawaTheme?.layout[currentTheme].margin,
19
- // maxWidth: props.maxWidth
20
- // };
21
- // } else {
22
- // boxStyle = {
23
- // display: "flex",
24
- // flexDirection: props.horizontal ? "row" : "column",
25
- // color: "white",
26
- // marginTop: props.last ? 10 * 2 : 0,
27
- // backgroundColor: props.noColor ? "none" : "lightGrey",
28
- // padding: props.noPadding ? 0 : 10,
29
- // margin: props.noMargin ? 0 : 10,
30
- // maxWidth: props.maxWidth,
31
- // };
32
- // }
33
-
34
- return (
35
- <div
36
- // style={boxStyle}
37
- >
38
- {props.children}
39
- </div>
40
- );
4
+ return <div>{props.children}</div>;
41
5
  };