@sikka/hawa 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +1 -1
  4. package/src/blocks/AuthForms/NewPasswordForm.js +57 -38
  5. package/src/blocks/AuthForms/ResetPasswordForm.js +36 -39
  6. package/src/blocks/AuthForms/SignInForm.js +71 -58
  7. package/src/blocks/AuthForms/SignUpForm.js +60 -43
  8. package/src/blocks/Pricing/PricingPlans.js +19 -9
  9. package/src/elements/HawaAlert.js +1 -1
  10. package/src/elements/HawaAppBar.js +139 -0
  11. package/src/elements/HawaListItem.js +21 -0
  12. package/src/elements/HawaPricingCard.js +40 -22
  13. package/src/elements/HawaTextField.js +15 -149
  14. package/src/elements/index.js +2 -0
  15. package/src/layout/HawaAppLayout.js +246 -0
  16. package/src/layout/index.js +1 -0
  17. package/src/stories/BlocksStories/Auth/NewPassword.stories.js +2 -1
  18. package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +1 -2
  19. package/src/stories/BlocksStories/Auth/SignUp.stories.js +1 -0
  20. package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +21 -4
  21. package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +23 -5
  22. package/src/stories/LayoutStories/AppBar.stories.js +29 -0
  23. package/src/stories/LayoutStories/AppLayout.stories.js +52 -0
  24. package/storybook-static/iframe.html +1 -1
  25. package/storybook-static/main.66955578.iframe.bundle.js +1 -0
  26. package/storybook-static/vendors~main.b4186832.iframe.bundle.js +76 -0
  27. package/storybook-static/{vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt → vendors~main.b4186832.iframe.bundle.js.LICENSE.txt} +0 -0
  28. package/storybook-static/vendors~main.b4186832.iframe.bundle.js.map +1 -0
  29. package/storybook-static/main.e382d866.iframe.bundle.js +0 -1
  30. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +0 -76
  31. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +0 -1
@@ -0,0 +1,246 @@
1
+ import React from "react";
2
+ import { styled, useTheme } from "@mui/material/styles";
3
+ import Box from "@mui/material/Box";
4
+ import MuiDrawer from "@mui/material/Drawer";
5
+ import MuiAppBar from "@mui/material/AppBar";
6
+ import Toolbar from "@mui/material/Toolbar";
7
+ import List from "@mui/material/List";
8
+ // import CssBaseline from "@mui/material/CssBaseline";
9
+ import Typography from "@mui/material/Typography";
10
+ import Divider from "@mui/material/Divider";
11
+ import IconButton from "@mui/material/IconButton";
12
+ import MenuIcon from "@mui/icons-material/Menu";
13
+ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
14
+ import ChevronRightIcon from "@mui/icons-material/ChevronRight";
15
+ import ListItemButton from "@mui/material/ListItemButton";
16
+ import ListItemIcon from "@mui/material/ListItemIcon";
17
+ import ListItemText from "@mui/material/ListItemText";
18
+ import InboxIcon from "@mui/icons-material/MoveToInbox";
19
+ import MailIcon from "@mui/icons-material/Mail";
20
+ import { HawaListItem } from "../elements";
21
+ import Menu from "@mui/material/Menu";
22
+ import Container from "@mui/material/Container";
23
+ import Avatar from "@mui/material/Avatar";
24
+ import Button from "@mui/material/Button";
25
+ import Tooltip from "@mui/material/Tooltip";
26
+ import MenuItem from "@mui/material/MenuItem";
27
+
28
+ const drawerWidth = 240;
29
+
30
+ const openedMixin = (theme) => ({
31
+ width: drawerWidth,
32
+ transition: theme.transitions.create("width", {
33
+ easing: theme.transitions.easing.sharp,
34
+ duration: theme.transitions.duration.enteringScreen
35
+ }),
36
+ overflowX: "hidden"
37
+ });
38
+
39
+ const closedMixin = (theme) => ({
40
+ transition: theme.transitions.create("width", {
41
+ easing: theme.transitions.easing.sharp,
42
+ duration: theme.transitions.duration.leavingScreen
43
+ }),
44
+ overflowX: "hidden",
45
+ width: `calc(${theme.spacing(7)} + 1px)`,
46
+ [theme.breakpoints.up("sm")]: {
47
+ width: `calc(${theme.spacing(8)} + 1px)`
48
+ }
49
+ });
50
+
51
+ const DrawerHeader = styled("div")(({ theme }) => ({
52
+ display: "flex",
53
+ alignItems: "center",
54
+ justifyContent: "flex-end",
55
+ padding: theme.spacing(0, 1),
56
+ // necessary for content to be below app bar
57
+ ...theme.mixins.toolbar
58
+ }));
59
+
60
+ const AppBar = styled(MuiAppBar, {
61
+ shouldForwardProp: (prop) => prop !== "open"
62
+ })(({ theme, open }) => ({
63
+ zIndex: theme.zIndex.drawer + 1,
64
+ transition: theme.transitions.create(["width", "margin"], {
65
+ easing: theme.transitions.easing.sharp,
66
+ duration: theme.transitions.duration.leavingScreen
67
+ }),
68
+ ...(open && {
69
+ marginLeft: drawerWidth,
70
+ width: `calc(100% - ${drawerWidth}px)`,
71
+ transition: theme.transitions.create(["width", "margin"], {
72
+ easing: theme.transitions.easing.sharp,
73
+ duration: theme.transitions.duration.enteringScreen
74
+ })
75
+ })
76
+ }));
77
+
78
+ const Drawer = styled(MuiDrawer, {
79
+ shouldForwardProp: (prop) => prop !== "open"
80
+ })(({ theme, open }) => ({
81
+ width: drawerWidth,
82
+ flexShrink: 0,
83
+ whiteSpace: "nowrap",
84
+ boxSizing: "border-box",
85
+ ...(open && {
86
+ ...openedMixin(theme),
87
+ "& .MuiDrawer-paper": openedMixin(theme)
88
+ }),
89
+ ...(!open && {
90
+ ...closedMixin(theme),
91
+ "& .MuiDrawer-paper": closedMixin(theme)
92
+ })
93
+ }));
94
+
95
+ export function HawaAppLayout(props) {
96
+ const theme = useTheme();
97
+ const [open, setOpen] = React.useState(true);
98
+
99
+ const [anchorElNav, setAnchorElNav] = React.useState(null);
100
+ const [anchorElUser, setAnchorElUser] = React.useState(null);
101
+
102
+ const handleOpenNavMenu = (event) => {
103
+ setAnchorElNav(event.currentTarget);
104
+ };
105
+ const handleOpenUserMenu = (event) => {
106
+ setAnchorElUser(event.currentTarget);
107
+ };
108
+
109
+ const handleCloseNavMenu = () => {
110
+ setAnchorElNav(null);
111
+ };
112
+
113
+ const handleCloseUserMenu = () => {
114
+ setAnchorElUser(null);
115
+ };
116
+
117
+ const handleDrawerOpen = () => {
118
+ setOpen(true);
119
+ };
120
+
121
+ const handleDrawerClose = () => {
122
+ setOpen(false);
123
+ };
124
+
125
+ return (
126
+ <Box sx={{ display: "flex" }}>
127
+ {/* <CssBaseline /> */}
128
+ <AppBar variant="appbar" position="fixed" open={open}>
129
+ <Toolbar variant="appbar">
130
+ <IconButton
131
+ color="inherit"
132
+ aria-label="open drawer"
133
+ onClick={handleDrawerOpen}
134
+ edge="start"
135
+ sx={{
136
+ marginRight: 5,
137
+ ...(open && { display: "none" })
138
+ }}
139
+ >
140
+ <MenuIcon />
141
+ </IconButton>
142
+
143
+ <div
144
+ style={{
145
+ // backgroundColor: "red",
146
+ display: "flex",
147
+ flexDirection: "row",
148
+ justifyContent: "space-between",
149
+ alignItems: "center",
150
+ width: "100%",
151
+ margin: 0
152
+ }}
153
+ >
154
+ <Typography variant="h6" noWrap component="div">
155
+ Page name here
156
+ </Typography>
157
+
158
+ <Box>
159
+ <Tooltip title="Open settings">
160
+ <IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
161
+ <Avatar alt="Remy Sharp" src="/static/images/avatar/2.jpg" />
162
+ </IconButton>
163
+ </Tooltip>
164
+ <Menu
165
+ sx={{ mt: "45px" }}
166
+ id="menu-appbar"
167
+ anchorEl={anchorElUser}
168
+ anchorOrigin={{
169
+ vertical: "top",
170
+ horizontal: "right"
171
+ }}
172
+ keepMounted
173
+ transformOrigin={{
174
+ vertical: "top",
175
+ horizontal: "right"
176
+ }}
177
+ open={Boolean(anchorElUser)}
178
+ onClose={handleCloseUserMenu}
179
+ >
180
+ {[2, 3, 4].map((setting) => (
181
+ <MenuItem key={setting} onClick={handleCloseUserMenu}>
182
+ <Typography textAlign="center">{setting}</Typography>
183
+ </MenuItem>
184
+ ))}
185
+ </Menu>
186
+ </Box>
187
+ </div>
188
+ </Toolbar>
189
+ </AppBar>
190
+ <Drawer variant="permanent" open={open}>
191
+ <DrawerHeader>
192
+ {props.logo}
193
+ <IconButton onClick={handleDrawerClose}>
194
+ {theme.direction === "rtl" ? (
195
+ <ChevronRightIcon />
196
+ ) : (
197
+ <ChevronLeftIcon />
198
+ )}
199
+ </IconButton>
200
+ </DrawerHeader>
201
+ <Divider />
202
+ <List>
203
+ {props.pages.map((t) => {
204
+ return (
205
+ <HawaListItem
206
+ open={open}
207
+ text={t.text}
208
+ selected={props.pageName.toLowerCase() === t.text}
209
+ // icon={<ChevronLeftIcon />}
210
+ icon={t.icon}
211
+ />
212
+ );
213
+ })}
214
+ </List>
215
+ <Divider />
216
+ <List>
217
+ {["All mail", "Trash", "Spam"].map((text, index) => (
218
+ <ListItemButton
219
+ key={text}
220
+ sx={{
221
+ minHeight: 48,
222
+ justifyContent: open ? "initial" : "center",
223
+ px: 2.5
224
+ }}
225
+ >
226
+ <ListItemIcon
227
+ sx={{
228
+ minWidth: 0,
229
+ mr: open ? 3 : "auto",
230
+ justifyContent: "center"
231
+ }}
232
+ >
233
+ {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
234
+ </ListItemIcon>
235
+ <ListItemText primary={text} sx={{ opacity: open ? 1 : 0 }} />
236
+ </ListItemButton>
237
+ ))}
238
+ </List>
239
+ </Drawer>
240
+ <Box sx={{ flexGrow: 1, p: 3 }}>
241
+ <DrawerHeader />
242
+ {props.children}
243
+ </Box>
244
+ </Box>
245
+ );
246
+ }
@@ -1 +1,2 @@
1
1
  export * from "./Box";
2
+ export * from "./HawaAppLayout";
@@ -5,7 +5,6 @@ export default {
5
5
  title: "Blocks/Auth/New Password",
6
6
  component: [NewPasswordForm],
7
7
  argTypes: {
8
-
9
8
  showError: {
10
9
  default: false,
11
10
  control: "boolean",
@@ -41,6 +40,8 @@ const NewPasswordTemplate = (args) => {
41
40
  passwordLabel: "Choose new password",
42
41
  confirmPasswordPlaceholder: "Confirm password",
43
42
  confirmPasswordLabel: "Confirm",
43
+ confirmPasswordRequiredText: "Confirmation is required",
44
+ passwordMatchError: "Password doesn't match",
44
45
  forgotPasswordText: "Forgot password?",
45
46
  newUserText: "New user?",
46
47
  signUpText: "Sign up",
@@ -5,7 +5,6 @@ export default {
5
5
  title: "Blocks/Auth/Reset Password",
6
6
  component: [ResetPasswordForm],
7
7
  argTypes: {
8
-
9
8
  showError: {
10
9
  default: false,
11
10
  control: "boolean",
@@ -48,7 +47,7 @@ const ResetPasswordTemplate = (args) => {
48
47
  twitterButtonLabel: "Sign in with Twitter"
49
48
  }}
50
49
  {...args}
51
- handleResetPassword={() => console.log("resetting password")}
50
+ handleResetPassword={(e) => console.log("resetting password,", e)}
52
51
  />
53
52
  );
54
53
  };
@@ -51,6 +51,7 @@ const SignUpTemplate = (args) => {
51
51
  texts={{
52
52
  fullNameLabel: "Full Name",
53
53
  fullNamePlaceholder: "Fulan AlFulani",
54
+ fullNameRequiredText: "Full Name is required",
54
55
  emailLabel: "Email",
55
56
  emailPlaceholder: "Enter your email",
56
57
  emailRequiredText: "Email is required",
@@ -4,7 +4,15 @@ import { PricingPlans } from "../../../blocks/Pricing/PricingPlans";
4
4
  export default {
5
5
  title: "Blocks/Pricing/In Billing",
6
6
  component: [PricingPlans],
7
- argTypes: {}
7
+ argTypes: {
8
+ lang: {
9
+ options: ["ar", "en"],
10
+ control: { type: "select" }
11
+ }
12
+ },
13
+ args: {
14
+ lang: "ar"
15
+ }
8
16
  };
9
17
 
10
18
  export const InBilling = (args) => {
@@ -14,31 +22,40 @@ export const InBilling = (args) => {
14
22
  plans={[
15
23
  {
16
24
  title: "Free",
25
+ title_ar: "تجريبي",
17
26
  subtitle: "For everyone",
27
+ subtitle_ar: "للعرب",
18
28
  price: 0,
19
29
  currency: "SAR",
20
30
  cycleText: "Monthly",
21
31
  buttonText: "Select Plan",
22
- features: ["one", "two", "three"]
32
+ features: ["one", "two", "three"],
33
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
23
34
  },
24
35
  {
25
36
  title: "Intro",
37
+ title_ar: "تجريبي",
26
38
  subtitle: "For beginners",
39
+ subtitle_ar: "للعرب",
27
40
  selectedPlan: true,
28
41
  price: 10,
29
42
  currency: "SAR",
30
43
  cycleText: "Monthly",
31
44
  buttonText: "Current Plan",
32
- features: ["one", "two", "three"]
45
+ features: ["one", "two", "three"],
46
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
33
47
  },
34
48
  {
35
49
  title: "Pro",
50
+ title_ar: "تجريبي",
36
51
  subtitle: "For professionals",
52
+ subtitle_ar: "للعرب",
37
53
  price: 30,
38
54
  currency: "SAR",
39
55
  cycleText: "Monthly",
40
56
  buttonText: "Select Plan",
41
- features: ["one", "two", "three"]
57
+ features: ["one", "two", "three"],
58
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
42
59
  }
43
60
  ]}
44
61
  />
@@ -4,7 +4,15 @@ import { PricingPlans } from "../../../blocks/Pricing/PricingPlans";
4
4
  export default {
5
5
  title: "Blocks/Pricing/In Landing",
6
6
  component: [PricingPlans],
7
- argTypes: {}
7
+ argTypes: {
8
+ lang: {
9
+ options: ["ar", "en"],
10
+ control: { type: "select" }
11
+ }
12
+ },
13
+ args: {
14
+ lang: "ar"
15
+ }
8
16
  };
9
17
 
10
18
  export const InLanding = (args) => {
@@ -14,30 +22,40 @@ export const InLanding = (args) => {
14
22
  plans={[
15
23
  {
16
24
  title: "Free",
25
+ title_ar: "تجريبي",
17
26
  subtitle: "For everyone",
27
+ subtitle_ar: "للعرب",
18
28
  price: 0,
19
29
  currency: "SAR",
20
30
  cycleText: "Monthly",
21
31
  buttonText: "Select Plan",
22
- features: ["one", "two", "three"]
32
+ features: ["one", "two", "three"],
33
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
23
34
  },
24
35
  {
25
36
  title: "Intro",
37
+ title_ar: "تجريبي",
26
38
  subtitle: "For beginners",
39
+ subtitle_ar: "للعرب",
40
+ selectedPlan: false,
27
41
  price: 10,
28
42
  currency: "SAR",
29
43
  cycleText: "Monthly",
30
- buttonText: "Select Plan",
31
- features: ["one", "two", "three"]
44
+ buttonText: "Current Plan",
45
+ features: ["one", "two", "three"],
46
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
32
47
  },
33
48
  {
34
49
  title: "Pro",
50
+ title_ar: "تجريبي",
35
51
  subtitle: "For professionals",
52
+ subtitle_ar: "للعرب",
36
53
  price: 30,
37
54
  currency: "SAR",
38
55
  cycleText: "Monthly",
39
56
  buttonText: "Select Plan",
40
- features: ["one", "two", "three"]
57
+ features: ["one", "two", "three"],
58
+ features_ar: ["واحد", "اثنين", "ثلاثة"]
41
59
  }
42
60
  ]}
43
61
  />
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { HawaAppBar } from "../../elements";
3
+
4
+ const Template = (args) => {
5
+ return <HawaAppBar />;
6
+ };
7
+ export default {
8
+ title: "Layout/AppBar",
9
+ component: [HawaAppBar],
10
+ parameters: {
11
+ backgrounds: {
12
+ default: "light"
13
+ // values: [
14
+ // { name: "light", value: theme.lightBackground },
15
+ // { name: "dark", value: theme.darkBackground }
16
+ // ]
17
+ }
18
+ }
19
+ };
20
+
21
+ export const Normal = Template.bind({});
22
+ Normal.args = {
23
+ size: "large",
24
+ showText: true,
25
+ buttonLabel: "test",
26
+ // padding: theme.paddings,
27
+ textColor: "#000000",
28
+ buttonColor: "#f9f9f9"
29
+ };
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { HawaAppLayout } from "../../layout";
3
+
4
+ const Template = (args) => {
5
+ return (
6
+ <HawaAppLayout
7
+ pageName="page1"
8
+ pages={[
9
+ { text: "page1", icon: "fdd" },
10
+ { text: "page2", icon: "huhu" },
11
+ { text: "page3", icon: "test" }
12
+ ]}
13
+ // pages={[
14
+ // <HawaListItem text="dd" />,
15
+ // <HawaListItem text="dd" />,
16
+ // <HawaListItem text="dd" />
17
+ // ]}
18
+ logo={
19
+ <img
20
+ height={40}
21
+ style={{ zIndex: 30, width: "100%" }}
22
+ src="https://xakher-images.s3.ap-southeast-1.amazonaws.com/sikka-logo.svg"
23
+ />
24
+ }
25
+ >
26
+ the rest of the app here
27
+ </HawaAppLayout>
28
+ );
29
+ };
30
+ export default {
31
+ title: "Layout/AppLayout",
32
+ component: [HawaAppLayout],
33
+ parameters: {
34
+ backgrounds: {
35
+ default: "light"
36
+ // values: [
37
+ // { name: "light", value: theme.lightBackground },
38
+ // { name: "dark", value: theme.darkBackground }
39
+ // ]
40
+ }
41
+ }
42
+ };
43
+
44
+ export const Normal = Template.bind({});
45
+ Normal.args = {
46
+ size: "large",
47
+ showText: true,
48
+ buttonLabel: "test",
49
+ // padding: theme.paddings,
50
+ textColor: "#000000",
51
+ buttonColor: "#f9f9f9"
52
+ };
@@ -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.f1ebae9b.iframe.bundle.js"></script><script src="vendors~main.5eab66d3.iframe.bundle.js"></script><script src="main.e382d866.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.f1ebae9b.iframe.bundle.js"></script><script src="vendors~main.b4186832.iframe.bundle.js"></script><script src="main.66955578.iframe.bundle.js"></script></body></html>