@sikka/hawa 0.0.11 → 0.0.12

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 (33) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +3 -3
  4. package/src/blocks/Account/{UserProfile.js → UserProfileForm.js} +14 -4
  5. package/src/blocks/Account/UserSettingsForm.js +17 -0
  6. package/src/blocks/Account/index.js +2 -2
  7. package/src/blocks/AuthForms/SignInForm.js +9 -5
  8. package/src/blocks/AuthForms/SignUpForm.js +1 -0
  9. package/src/blocks/Payment/ChargeWalletForm.js +40 -37
  10. package/src/blocks/Payment/CreditCardForm.js +49 -44
  11. package/src/blocks/Payment/PayWithWallet.js +16 -6
  12. package/src/blocks/Payment/SelectPayment.js +7 -8
  13. package/src/stories/BlocksStories/Account/UserProfile.stories.js +21 -0
  14. package/src/stories/BlocksStories/Account/UserSettings.stories.js +21 -0
  15. package/src/stories/BlocksStories/Auth/NewPassword.stories.js +60 -0
  16. package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +59 -0
  17. package/src/stories/BlocksStories/Auth/SignIn.stories.js +89 -0
  18. package/src/stories/BlocksStories/Auth/SignUp.stories.js +90 -0
  19. package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +30 -0
  20. package/src/stories/BlocksStories/Payment/PayWithCreditCard.stories.js +37 -0
  21. package/src/stories/BlocksStories/Payment/PayWithWallet.stories.js +17 -0
  22. package/src/stories/BlocksStories/{PaymentForm.stories.js → Payment/PaymentSelection.stories.js} +12 -23
  23. package/src/stories/LayoutStories/Box.stories.js +6 -11
  24. package/src/stories/UIStories/LogoButtons.stories.js +49 -62
  25. package/src/stories/UIStories/RadioSelector.stories.js +15 -41
  26. package/src/ui/HawaRadio.js +19 -53
  27. package/storybook-static/iframe.html +1 -1
  28. package/storybook-static/index.html +1 -1
  29. package/storybook-static/main.a9a16923.iframe.bundle.js +1 -0
  30. package/src/blocks/Account/UserSettings.js +0 -14
  31. package/src/stories/BlocksStories/AuthForm.stories.js +0 -171
  32. package/src/stories/BlocksStories/UserForm.stories.js +0 -27
  33. package/storybook-static/main.b00949db.iframe.bundle.js +0 -1
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { UserSettingsForm } from "../../../blocks/Account";
3
+
4
+ export default {
5
+ title: "Blocks/Account/User Settings",
6
+ component: UserSettingsForm,
7
+ argTypes: {
8
+ theme: {
9
+ options: ["primary", "secondary", "default"],
10
+ control: { type: "select" }
11
+ }
12
+ }
13
+ };
14
+
15
+ export const UserSettings = (args) => {
16
+ return <UserSettingsForm {...args} />;
17
+ };
18
+ UserSettings.args = {
19
+ theme: "primary",
20
+ title: "red"
21
+ };
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import { NewPasswordForm } from "../../../blocks/AuthForms";
3
+
4
+ export default {
5
+ title: "Blocks/Auth/New Password",
6
+ component: [NewPasswordForm],
7
+ argTypes: {
8
+
9
+ showError: {
10
+ default: false,
11
+ control: "boolean",
12
+ description: "Display the error when auth fails",
13
+ table: { defaultValue: { summary: true } }
14
+ },
15
+ errorTitle: {
16
+ default: " ",
17
+ control: "text",
18
+ description: "The error text for the auth failure",
19
+ table: { defaultValue: { summary: "" } }
20
+ },
21
+ errorText: {
22
+ default: "Something went wrong",
23
+ control: "text",
24
+ description: "The error text for the auth failure",
25
+ table: { defaultValue: { summary: "Something went wrong" } }
26
+ }
27
+ }
28
+ };
29
+
30
+ const NewPasswordTemplate = (args) => {
31
+ return (
32
+ <NewPasswordForm
33
+ {...args}
34
+ texts={{
35
+ emailLabel: "Email",
36
+ emailPlaceholder: "Enter your email",
37
+ emailRequiredText: "Email is required",
38
+ passwordPlaceholder: "Enter password",
39
+ updatePassword: "Update Password",
40
+ passwordRequiredText: "Password is required",
41
+ passwordLabel: "Choose new password",
42
+ confirmPasswordPlaceholder: "Confirm password",
43
+ confirmPasswordLabel: "Confirm",
44
+ forgotPasswordText: "Forgot password?",
45
+ newUserText: "New user?",
46
+ signUpText: "Sign up",
47
+ signInText: "Sign in",
48
+ googleButtonLabel: "Sign in with Google",
49
+ githubButtonLabel: "Sign in with Github",
50
+ twitterButtonLabel: "Sign in with Twitter"
51
+ }}
52
+ error={args.showError}
53
+ />
54
+ );
55
+ };
56
+ export const NewPassword = NewPasswordTemplate.bind({});
57
+ NewPassword.args = {
58
+ showError: false,
59
+ passwordChanged: false
60
+ };
@@ -0,0 +1,59 @@
1
+ import React from "react";
2
+ import { ResetPasswordForm } from "../../../blocks/AuthForms";
3
+
4
+ export default {
5
+ title: "Blocks/Auth/Reset Password",
6
+ component: [ResetPasswordForm],
7
+ argTypes: {
8
+
9
+ showError: {
10
+ default: false,
11
+ control: "boolean",
12
+ description: "Display the error when auth fails",
13
+ table: { defaultValue: { summary: true } }
14
+ },
15
+ errorTitle: {
16
+ default: " ",
17
+ control: "text",
18
+ description: "The error text for the auth failure",
19
+ table: { defaultValue: { summary: "" } }
20
+ },
21
+ errorText: {
22
+ default: "Something went wrong",
23
+ control: "text",
24
+ description: "The error text for the auth failure",
25
+ table: { defaultValue: { summary: "Something went wrong" } }
26
+ }
27
+ }
28
+ };
29
+
30
+ const ResetPasswordTemplate = (args) => {
31
+ return (
32
+ <ResetPasswordForm
33
+ error={args.showError}
34
+ texts={{
35
+ emailLabel: "Email",
36
+ emailPlaceholder: "Enter your email",
37
+ emailRequiredText: "Email is required",
38
+ emailInvalidText: "Invalid email address",
39
+ passwordLabel: "Password",
40
+ resetPassword: "Reset Password",
41
+ passwordRequiredText: "Password is required",
42
+ forgotPasswordText: "Forgot password?",
43
+ newUserText: "New user?",
44
+ signUpText: "Sign up",
45
+ signInText: "Sign in",
46
+ googleButtonLabel: "Sign in with Google",
47
+ githubButtonLabel: "Sign in with Github",
48
+ twitterButtonLabel: "Sign in with Twitter"
49
+ }}
50
+ {...args}
51
+ handleResetPassword={() => console.log("resetting password")}
52
+ />
53
+ );
54
+ };
55
+ export const ResetPassword = ResetPasswordTemplate.bind({});
56
+ ResetPassword.args = {
57
+ showError: false,
58
+ sent: false
59
+ };
@@ -0,0 +1,89 @@
1
+ import React from "react";
2
+ import { SignInForm } from "../../../blocks/AuthForms";
3
+
4
+ export default {
5
+ title: "Blocks/Auth/Sign In",
6
+ component: [SignInForm],
7
+ argTypes: {
8
+ viaGoogle: {
9
+ default: true,
10
+ control: "boolean",
11
+ description: "Display the sign in via Google button",
12
+ table: { defaultValue: { summary: true } }
13
+ },
14
+ viaTwitter: {
15
+ default: true,
16
+ control: "boolean",
17
+ description: "Display the sign in via Twitter button",
18
+ table: { defaultValue: { summary: true } }
19
+ },
20
+ viaGithub: {
21
+ default: true,
22
+ control: "boolean",
23
+ description: "Display the sign in via Github button",
24
+ table: { defaultValue: { summary: true } }
25
+ },
26
+ showError: {
27
+ default: false,
28
+ control: "boolean",
29
+ description: "Display the error when auth fails",
30
+ table: { defaultValue: { summary: true } }
31
+ },
32
+ errorTitle: {
33
+ default: " ",
34
+ control: "text",
35
+ description: "The error text for the auth failure",
36
+ table: { defaultValue: { summary: "" } }
37
+ },
38
+ errorText: {
39
+ default: "Something went wrong",
40
+ control: "text",
41
+ description: "The error text for the auth failure",
42
+ table: { defaultValue: { summary: "Something went wrong" } }
43
+ }
44
+ }
45
+ };
46
+
47
+ const SignInTemplate = (args) => {
48
+ return (
49
+ <SignInForm
50
+ {...args}
51
+ error={args.showError}
52
+ texts={{
53
+ emailLabel: "Email",
54
+ emailPlaceholder: "Enter your email",
55
+ emailRequiredText: "Email is required",
56
+ emailInvalidText: "Invalid email address",
57
+ passwordLabel: "Password",
58
+ passwordPlaceholder: "Enter password",
59
+ passwordRequiredText: "Password is required",
60
+ forgotPasswordText: "Forgot password?",
61
+ newUserText: "New user?",
62
+ signUpText: "Sign up",
63
+ signInText: "Sign in",
64
+ googleButtonLabel: "Sign in with Google",
65
+ githubButtonLabel: "Sign in with Github",
66
+ twitterButtonLabel: "Sign in with Twitter"
67
+ }}
68
+ handleSignIn={(e) => console.log("singing in via email", e)}
69
+ handleForgotPassword={() => console.log("user forgot password")}
70
+ handleGoogleSignIn={() => console.log("signing in via google")}
71
+ handleGithubSignIn={() => console.log("signing in via github")}
72
+ handleTwitterSignIn={() => console.log("signing in via Twitter")}
73
+ handleRouteToSignUp={() => console.log("switching to sign up")}
74
+ viaGoogle={args.viaGoogle}
75
+ viaGithub={args.viaGithub}
76
+ viaTwitter={args.viaTwitter}
77
+ />
78
+ );
79
+ };
80
+
81
+ export const SignIn = SignInTemplate.bind({});
82
+ SignIn.args = {
83
+ viaGoogle: true,
84
+ viaGithub: true,
85
+ viaTwitter: true,
86
+ showError: false,
87
+ errorTitle: "Error",
88
+ errorText: "Something went wrong"
89
+ };
@@ -0,0 +1,90 @@
1
+ import React from "react";
2
+ import { SignUpForm } from "../../../blocks/AuthForms";
3
+
4
+ export default {
5
+ title: "Blocks/Auth/Sign Up",
6
+ component: [SignUpForm],
7
+ argTypes: {
8
+ viaGoogle: {
9
+ default: true,
10
+ control: "boolean",
11
+ description: "Display the sign in via Google button",
12
+ table: { defaultValue: { summary: true } }
13
+ },
14
+ viaTwitter: {
15
+ default: true,
16
+ control: "boolean",
17
+ description: "Display the sign in via Twitter button",
18
+ table: { defaultValue: { summary: true } }
19
+ },
20
+ viaGithub: {
21
+ default: true,
22
+ control: "boolean",
23
+ description: "Display the sign in via Github button",
24
+ table: { defaultValue: { summary: true } }
25
+ },
26
+ showError: {
27
+ default: false,
28
+ control: "boolean",
29
+ description: "Display the error when auth fails",
30
+ table: { defaultValue: { summary: true } }
31
+ },
32
+ errorTitle: {
33
+ default: " ",
34
+ control: "text",
35
+ description: "The error text for the auth failure",
36
+ table: { defaultValue: { summary: "" } }
37
+ },
38
+ errorText: {
39
+ default: "Something went wrong",
40
+ control: "text",
41
+ description: "The error text for the auth failure",
42
+ table: { defaultValue: { summary: "Something went wrong" } }
43
+ }
44
+ }
45
+ };
46
+
47
+ const SignUpTemplate = (args) => {
48
+ return (
49
+ <SignUpForm
50
+ {...args}
51
+ texts={{
52
+ fullNameLabel: "Full Name",
53
+ fullNamePlaceholder: "Fulan AlFulani",
54
+ emailLabel: "Email",
55
+ emailPlaceholder: "Enter your email",
56
+ emailRequiredText: "Email is required",
57
+ emailInvalidText: "Invalid email address",
58
+ passwordLabel: "Password",
59
+ passwordPlaceholder: "Minimum 8 characters",
60
+ passwordRequiredText: "Password is required",
61
+ passwordTooShortText: "Password too short",
62
+ forgotPasswordText: "Forgot password?",
63
+ newUserText: "New user?",
64
+ signUpText: "Sign up",
65
+ signInText: "Sign in",
66
+ googleButtonLabel: "Sign in with Google",
67
+ githubButtonLabel: "Sign in with Github",
68
+ twitterButtonLabel: "Sign in with Twitter"
69
+ }}
70
+ error={args.showError}
71
+ viaGoogle={args.viaGoogle}
72
+ viaGithub={args.viaGithub}
73
+ viaTwitter={args.viaTwitter}
74
+ handleSignUp={() => console.log("singing up via email")}
75
+ handleGoogleSignUp={() => console.log("signing up via google")}
76
+ handleGithubSignUp={() => console.log("signing up via github")}
77
+ handleTwitterSignUp={() => console.log("signing up via Twitter")}
78
+ handleRouteToSignIn={() => console.log("switching to sign in")}
79
+ />
80
+ );
81
+ };
82
+ export const SignUp = SignUpTemplate.bind({});
83
+ SignUp.args = {
84
+ viaGoogle: true,
85
+ viaGithub: true,
86
+ viaTwitter: true,
87
+ showError: false,
88
+ errorTitle: "Error",
89
+ errorText: "Something went wrong"
90
+ };
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { ChargeWalletForm } from "../../../blocks/Payment";
3
+
4
+ export default {
5
+ title: "Blocks/Payment/Charge Wallet",
6
+ component: [ChargeWalletForm],
7
+ argTypes: {
8
+ viaWallet: { control: "boolean" },
9
+ viaApplePay: { control: "boolean" },
10
+ viaGooglePay: { control: "boolean" },
11
+ viaSTCPay: { control: "boolean" },
12
+ viaCreditCard: { control: "boolean" },
13
+ viaPayPal: { control: "boolean" }
14
+ },
15
+ args: {
16
+ viaWallet: true,
17
+ viaMada: true,
18
+ viaApplePay: true,
19
+ viaGooglePay: true,
20
+ viaSTCPay: true,
21
+ viaCreditCard: true,
22
+ viaPayPal: true
23
+ }
24
+ };
25
+
26
+ export const ChargeWallet = (args) => {
27
+ return <ChargeWalletForm {...args} />;
28
+ };
29
+
30
+ ChargeWallet.args = { currency: "SAR" };
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { CreditCardForm } from "../../../blocks/Payment";
3
+
4
+ export default {
5
+ title: "Blocks/Payment/Pay Via Credit Card",
6
+ component: [CreditCardForm],
7
+ argTypes: {
8
+ theme: {
9
+ options: ["primary", "secondary", "default"],
10
+ control: { type: "select" }
11
+ },
12
+ viaWallet: { control: "boolean" },
13
+ viaApplePay: { control: "boolean" },
14
+ viaGooglePay: { control: "boolean" },
15
+ viaSTCPay: { control: "boolean" },
16
+ viaCreditCard: { control: "boolean" },
17
+ viaPayPal: { control: "boolean" }
18
+ },
19
+ args: {
20
+ theme: "primary",
21
+ viaWallet: true,
22
+ viaMada: true,
23
+ viaApplePay: true,
24
+ viaGooglePay: true,
25
+ viaSTCPay: true,
26
+ viaCreditCard: true,
27
+ viaPayPal: true
28
+ }
29
+ };
30
+
31
+ export const PayViaCreditCard = (args) => {
32
+ return <CreditCardForm theme={args.theme} />;
33
+ };
34
+
35
+ PayViaCreditCard.args = {
36
+ theme: "secondary"
37
+ };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { PayWithWallet } from "../../../blocks/Payment";
3
+
4
+ export default {
5
+ title: "Blocks/Payment/Pay Via Wallet",
6
+ component: [PayWithWallet],
7
+ argTypes: {
8
+ walletBalance: { control: "number" }
9
+ },
10
+ args: {
11
+ walletBalance: 20
12
+ }
13
+ };
14
+
15
+ export const PayViaWallet = (args) => {
16
+ return <PayWithWallet {...args} />;
17
+ };
@@ -1,14 +1,9 @@
1
1
  import React from "react";
2
- import {
3
- SelectPayment,
4
- CreditCardForm,
5
- ChargeWalletForm,
6
- PayWithWallet
7
- } from "../../blocks/Payment";
2
+ import { SelectPayment } from "../../../blocks/Payment";
8
3
 
9
4
  export default {
10
- title: "Blocks/PaymentBlocks",
11
- component: [SelectPayment, CreditCardForm],
5
+ title: "Blocks/Payment/Payment Selection",
6
+ component: [SelectPayment],
12
7
  argTypes: {
13
8
  theme: {
14
9
  options: ["primary", "secondary", "default"],
@@ -33,7 +28,7 @@ export default {
33
28
  }
34
29
  };
35
30
 
36
- export const PaymentSelection = (args) => {
31
+ const PaymentSelectionTemplate = (args) => {
37
32
  return (
38
33
  <SelectPayment
39
34
  {...args}
@@ -54,18 +49,12 @@ export const PaymentSelection = (args) => {
54
49
  />
55
50
  );
56
51
  };
57
-
58
- export const PayViaWallet = (args) => {
59
- return <PayWithWallet theme={args.theme} />;
60
- };
61
- export const PayViaCreditCard = (args) => {
62
- return <CreditCardForm />;
63
- };
64
-
65
- export const ChargeWallet = (args) => {
66
- return <ChargeWalletForm currency="SAR" />;
67
- };
68
-
69
- ChargeWallet.args = {
70
- theme: "secondary"
52
+ export const PaymentSelection = PaymentSelectionTemplate.bind({});
53
+ PaymentSelection.args = {
54
+ viaGoogle: true,
55
+ viaGithub: true,
56
+ viaTwitter: true,
57
+ showError: false,
58
+ errorTitle: "Error",
59
+ errorText: "Something went wrong"
71
60
  };
@@ -19,11 +19,11 @@ export default {
19
19
  component: <Box />,
20
20
  parameters: {
21
21
  backgrounds: {
22
- default: "light",
23
- values: [
24
- { name: "light", value: theme.lightBackground },
25
- { name: "dark", value: theme.darkBackground }
26
- ]
22
+ default: "light"
23
+ // values: [
24
+ // { name: "light", value: theme.lightBackground },
25
+ // { name: "dark", value: theme.darkBackground }
26
+ // ]
27
27
  }
28
28
  }
29
29
  };
@@ -41,10 +41,5 @@ export const Compact = Template.bind({});
41
41
  Compact.args = {
42
42
  size: "small",
43
43
  showText: true,
44
- buttonLabel: "test",
45
- theme: {
46
- // paddings: theme.paddings / 2,
47
- textColor: "#000000",
48
- buttonColor: "#f9f9f9"
49
- }
44
+ buttonLabel: "test"
50
45
  };
@@ -1,86 +1,73 @@
1
+ import { Container } from "@mui/material";
1
2
  import React from "react";
2
3
  import { ActionButton, HawaLogoButton } from "../../ui";
3
4
 
4
5
  export default {
5
6
  title: "Elements/Buttons/LogoButtons",
6
- component: ActionButton,
7
+ component: HawaLogoButton,
7
8
  argTypes: {
8
- theme: {
9
- options: ["primary", "secondary", "default"],
10
- control: { type: "select" }
9
+ buttonLabel: {
10
+ control: "text",
11
+ description: "The text next to the logo"
11
12
  },
12
- buttonLabel: { control: "text" },
13
- logo: { control: "text" }
14
- },
15
- args: {
16
- buttonLabel: "test",
17
- logo: "google",
18
- theme: "primary"
13
+ logo: {
14
+ control: "select",
15
+ options: [
16
+ "google",
17
+ "twitter",
18
+ "github",
19
+ "paypal",
20
+ "applepay",
21
+ "googlepay",
22
+ "stcpay",
23
+ "mada",
24
+ "visa/master"
25
+ ],
26
+ description: "a brand name that will display the logo accordingly",
27
+ table: {
28
+ type: {
29
+ summary: "Examples",
30
+ detail: "google, twitter, github, paypal, applepay, googlepay"
31
+ }
32
+ }
33
+ }
19
34
  }
20
35
  };
21
36
 
22
37
  const Template = (args) => {
23
- return <HawaLogoButton logo={args.logo} buttonText={args.buttonLabel} />;
38
+ return (
39
+ <Container maxWidth="xs" variant="plain">
40
+ <HawaLogoButton logo={args.logo} buttonText={args.buttonLabel} />
41
+ </Container>
42
+ );
24
43
  };
25
44
 
26
45
  export const Google = Template.bind({});
27
- Google.args = {
28
- buttonLabel: "Sign in via Google",
29
- logo: "google",
30
- theme: "primary"
31
- };
46
+ Google.args = { buttonLabel: "Sign in via Google", logo: "google" };
32
47
 
33
48
  export const Twitter = Template.bind({});
34
- Twitter.args = {
35
- buttonLabel: "Sign in via Twitter",
36
- logo: "twitter",
37
- theme: "primary"
38
- };
49
+ Twitter.args = { buttonLabel: "Sign in via Twitter", logo: "twitter" };
50
+
39
51
  export const Github = Template.bind({});
40
- Github.args = {
41
- buttonLabel: "Sign in via Github",
42
- logo: "github",
43
- theme: "primary"
44
- };
52
+ Github.args = { buttonLabel: "Sign in via Github", logo: "github" };
53
+
45
54
  export const WalletPay = Template.bind({});
46
- WalletPay.args = {
47
- buttonLabel: "Pay with Wallet",
48
- logo: "wallet",
49
- theme: "primary"
50
- };
55
+ WalletPay.args = { buttonLabel: "Pay with Wallet", logo: "wallet" };
56
+
51
57
  export const GooglePay = Template.bind({});
52
- GooglePay.args = {
53
- buttonLabel: "Google Pay",
54
- logo: "googlepay",
55
- theme: "primary"
56
- };
58
+ GooglePay.args = { buttonLabel: "Google Pay", logo: "googlepay" };
59
+
57
60
  export const ApplePay = Template.bind({});
58
- ApplePay.args = {
59
- buttonLabel: "Apple Pay",
60
- logo: "applepay",
61
- theme: "primary"
62
- };
61
+ ApplePay.args = { buttonLabel: "Apple Pay", logo: "applepay" };
62
+
63
63
  export const STCPay = Template.bind({});
64
- STCPay.args = {
65
- buttonLabel: "STC Pay",
66
- logo: "stcpay",
67
- theme: "primary"
68
- };
64
+ STCPay.args = { buttonLabel: "STC Pay", logo: "stcpay" };
65
+
69
66
  export const VisaMasterPay = Template.bind({});
70
- VisaMasterPay.args = {
71
- buttonLabel: "Visa / Mastercard",
72
- logo: "visa/master",
73
- theme: "primary"
74
- };
67
+ VisaMasterPay.args = { buttonLabel: "Visa / Mastercard", logo: "visa/master" };
68
+
75
69
  export const PayPal = Template.bind({});
76
- PayPal.args = {
77
- buttonLabel: "PayPal",
78
- logo: "paypal",
79
- theme: "primary"
80
- };
70
+ PayPal.args = { buttonLabel: "PayPal", logo: "paypal" };
71
+
81
72
  export const Mada = Template.bind({});
82
- Mada.args = {
83
- buttonLabel: "Mada",
84
- logo: "mada",
85
- theme: "primary"
86
- };
73
+ Mada.args = { buttonLabel: "Mada", logo: "mada" };