@sikka/hawa 0.0.7 → 0.0.8

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 (43) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +2 -1
  4. package/src/blocks/AuthForms/NewPasswordForm.js +54 -38
  5. package/src/blocks/AuthForms/ResetPasswordForm.js +41 -25
  6. package/src/blocks/AuthForms/SignInForm.js +40 -7
  7. package/src/blocks/AuthForms/SignUpForm.js +30 -8
  8. package/src/blocks/Payment/PayWithWallet.js +1 -1
  9. package/src/blocks/Payment/SelectPayment.js +15 -18
  10. package/src/stories/BlocksStories/AuthForm.stories.js +5 -3
  11. package/src/stories/Introduction.stories.mdx +229 -0
  12. package/src/stories/UIStories/ActionButton.stories.js +15 -22
  13. package/src/stories/UIStories/AdaptiveButton.stories.js +43 -42
  14. package/src/stories/UIStories/LogoButtons.stories.js +90 -0
  15. package/src/themes/HawaProvider.js +7 -2
  16. package/src/ui/ActionButton.js +1 -3
  17. package/src/ui/AdaptiveButton.js +43 -159
  18. package/src/ui/HawaAlert.js +1 -1
  19. package/src/ui/HawaLogoButton.js +96 -1
  20. package/src/ui/HawaSettingsRow.js +2 -2
  21. package/src/ui/HawaTextField.js +1 -4
  22. package/src/ui/HawaTypography.js +1 -2
  23. package/src/ui/index.js +1 -14
  24. package/storybook-static/iframe.html +1 -1
  25. package/storybook-static/main.5731dbe3.iframe.bundle.js +1 -0
  26. package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +76 -0
  27. package/storybook-static/{vendors~main.8ebae370.iframe.bundle.js.LICENSE.txt → vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt} +0 -15
  28. package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +1 -0
  29. package/src/stories/GlobalVariables.stories.js +0 -44
  30. package/src/stories/Introduction.stories.js +0 -233
  31. package/src/ui/ApplePayButton.js +0 -26
  32. package/src/ui/GithubButton.js +0 -24
  33. package/src/ui/GoogleButton.js +0 -23
  34. package/src/ui/GooglePayButton.js +0 -26
  35. package/src/ui/MadaButton.js +0 -26
  36. package/src/ui/PayPalButton.js +0 -26
  37. package/src/ui/STCPayButton.js +0 -26
  38. package/src/ui/TwitterButton.js +0 -27
  39. package/src/ui/VisaMasterButton.js +0 -26
  40. package/src/ui/WalletButton.js +0 -24
  41. package/storybook-static/main.b7ffaed0.iframe.bundle.js +0 -1
  42. package/storybook-static/vendors~main.8ebae370.iframe.bundle.js +0 -76
  43. package/storybook-static/vendors~main.8ebae370.iframe.bundle.js.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import React, { useState, useContext } from "react";
2
2
  import Button from "@mui/material/Button";
3
3
  import Tooltip from "@mui/material/Tooltip";
4
- import { motion } from "framer-motion";
5
4
  import PropTypes from "prop-types";
6
5
  import { ThemeProvider } from "../themes/HawaProvider";
7
6
  import { StyledTooltip } from "./StyledTooltip";
@@ -19,81 +18,35 @@ export const AdaptiveButton = (props) => {
19
18
  //full button
20
19
  if (showText) {
21
20
  return (
22
- <motion.div
23
- transition={{ duration: 0.2 }}
24
- whileTap={{ scale: 1.2 }}
25
- whileHover={{
26
- // backgroundColor: props.hoverColor,
21
+ <Button
22
+ disableRipple
23
+ disabled={props.disabled}
24
+ aria-label={props.buttonLabel}
25
+ color={props.danger ? "secondary" : "primary"}
26
+ onClick={props.handleClick}
27
+ style={{
28
+ backgroundColor: theme.primaryColor,
27
29
  borderRadius: theme.borderRadius,
28
- color: "red"
30
+ padding: theme.paddings,
31
+ color: getTextColor(theme.primaryColor)
32
+ // color: hovered
33
+ // ? "#ffffff"
34
+ // : props.danger
35
+ // ? "#f50057"
36
+ // : "var(--blue)"
29
37
  }}
30
- onMouseEnter={() => setHovered(true)}
31
- onMouseLeave={() => setHovered(false)}
32
- onMouseDown={() => setHovered(true)}
33
- onMouseUp={() => setHovered(false)}
34
- onMouseOver={() => setHovered(true)}
35
- onMouseOut={() => setHovered(false)}
36
38
  >
37
- <Button
38
- disableRipple
39
- disabled={props.disabled}
40
- aria-label={props.buttonLabel}
41
- color={props.danger ? "secondary" : "primary"}
42
- onClick={props.handleClick}
43
- style={{
44
- backgroundColor: theme.primaryColor,
45
- borderRadius: theme.borderRadius,
46
- padding: theme.paddings,
47
- color: getTextColor(theme.primaryColor)
48
- // color: hovered
49
- // ? "#ffffff"
50
- // : props.danger
51
- // ? "#f50057"
52
- // : "var(--blue)"
53
- }}
54
- >
55
- {props.icon}
56
- {props.showText ? (
57
- <span style={{ marginLeft: props.icon ? 5 : 0 }}>
58
- {props.buttonLabel}
59
- </span>
60
- ) : null}
61
- </Button>
62
- </motion.div>
39
+ {props.icon}
40
+ {props.showText ? (
41
+ <span style={{ marginLeft: props.icon ? 5 : 0 }}>
42
+ {props.buttonLabel}
43
+ </span>
44
+ ) : null}
45
+ </Button>
63
46
  );
64
47
  } else if (props.buttonLabelOnly) {
65
48
  return (
66
- <motion.div
67
- transition={{ duration: 0.2 }}
68
- initial={{
69
- width: "fit-content",
70
- backgroundColor: props.buttonColor,
71
- borderRadius: theme.borderRadius
72
- }}
73
- whileTap={{ scale: 1.2 }}
74
- whileHover={{
75
- backgroundColor: props.hoverColor,
76
- borderRadius: theme.borderRadius
77
- }}
78
- onMouseEnter={() => setHovered(true)}
79
- onMouseLeave={() => setHovered(false)}
80
- onMouseDown={() => {
81
- setHovered(true);
82
- setTooltip(true);
83
- }}
84
- onMouseUp={() => {
85
- setHovered(false);
86
- setTooltip(true);
87
- }}
88
- onMouseOver={() => {
89
- setHovered(true);
90
- setTooltip(true);
91
- }}
92
- onMouseOut={() => {
93
- setHovered(false);
94
- // setTooltip(true);
95
- }}
96
- >
49
+ <>
97
50
  <Tooltip
98
51
  placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
99
52
  enterTouchDelay={100}
@@ -146,100 +99,31 @@ export const AdaptiveButton = (props) => {
146
99
  {props.buttonLabel}
147
100
  </Button>
148
101
  </Tooltip>
149
- </motion.div>
102
+ </>
150
103
  );
151
104
  } else {
152
105
  //icon only
153
106
  return (
154
- <motion.div
155
- transition={{ duration: 0.2 }}
156
- initial={{
157
- width: "fit-content",
158
- backgroundColor: props.buttonColor,
159
- borderRadius: theme.borderRadius,
160
- // padding: 5,
161
- margin: 5
162
- }}
163
- whileTap={{ scale: 1.2 }}
164
- whileHover={{
165
- backgroundColor: props.hoverColor,
166
- borderRadius: theme.borderRadius
167
- }}
168
- onMouseEnter={() => setHovered(true)}
169
- onMouseLeave={() => setHovered(false)}
170
- onMouseDown={() => {
171
- setHovered(true);
172
- setTooltip(true);
173
- }}
174
- onMouseUp={() => {
175
- setHovered(false);
176
- setTooltip(true);
177
- }}
178
- onMouseOver={() => {
179
- setHovered(true);
180
- setTooltip(true);
181
- }}
182
- onMouseOut={() => {
183
- setHovered(false);
184
- // setTooltip(true);
185
- }}
186
- >
187
- <StyledTooltip hintTitle="Example" hintContent="More explaination here">
188
- <Button
189
- disabled={props.disabled}
190
- size="small"
191
- disableRipple
192
- aria-label={props.buttonLabel}
193
- onClick={props.handleClick}
194
- color={props.danger ? "secondary" : "primary"}
195
- style={{
196
- padding: 10,
197
- color: hovered
198
- ? "#ffffff"
199
- : props.danger
200
- ? "#f50057"
201
- : "var(--blue)"
202
- }}
203
- >
204
- {props.icon}
205
- </Button>
206
- </StyledTooltip>
207
- {/* <Tooltip
208
- placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
209
- enterTouchDelay={100}
210
- title={
211
- props.hint ? (
212
- props.hint
213
- ) : (
214
- <div>
215
- <div
216
- style={{
217
- fontSize: 20,
218
- fontWeight: 800,
219
- padding: 10,
220
- paddingBottom: 5,
221
- textAlign: "center"
222
- }}
223
- >
224
- {props.hintTitle}
225
- </div>
226
- <div
227
- style={{
228
- fontSize: 13,
229
- fontWeight: 100,
230
- padding: 10,
231
- textAlign: "center"
232
- }}
233
- >
234
- {props.hintContent}
235
- </div>
236
- </div>
237
- )
238
- }
107
+ <StyledTooltip hintTitle="Example" hintContent="More explaination here">
108
+ <Button
109
+ disabled={props.disabled}
110
+ size="small"
111
+ disableRipple
112
+ aria-label={props.buttonLabel}
113
+ onClick={props.handleClick}
114
+ color={props.danger ? "secondary" : "primary"}
115
+ style={{
116
+ padding: 10,
117
+ color: hovered
118
+ ? "#ffffff"
119
+ : props.danger
120
+ ? "#f50057"
121
+ : "var(--blue)"
122
+ }}
239
123
  >
240
-
241
- </Tooltip> */}
242
- </motion.div>
124
+ {props.icon}
125
+ </Button>
126
+ </StyledTooltip>
243
127
  );
244
128
  }
245
129
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from "react";
2
2
  import { ThemeProvider } from "../themes/HawaProvider";
3
- import { styled, alpha } from "@mui/material/styles";
3
+ import { styled } from "@mui/material/styles";
4
4
 
5
5
  import Alert from "@mui/material/Alert";
6
6
  import AlertTitle from "@mui/material/AlertTitle";
@@ -2,6 +2,9 @@ import React, { useContext } from "react";
2
2
  import { ThemeProvider } from "../themes/HawaProvider";
3
3
  import { styled, darken } from "@mui/material/styles";
4
4
  import Button from "@mui/material/Button";
5
+ import GitHubIcon from "@mui/icons-material/GitHub";
6
+ import TwitterIcon from "@mui/icons-material/Twitter";
7
+ import WalletIcon from "@mui/icons-material/AccountBalanceWallet";
5
8
 
6
9
  export const HawaLogoButton = (props) => {
7
10
  const { hawaTheme, themeName } = useContext(ThemeProvider);
@@ -27,6 +30,9 @@ export const HawaLogoButton = (props) => {
27
30
  justifyContent: "center",
28
31
  marginTop: 10,
29
32
  height: 50,
33
+ padding: 30,
34
+ paddingTop: 0,
35
+ paddingBottom: 0,
30
36
  border: "1px solid #ced4da",
31
37
  backgroundColor: "white",
32
38
  "&:hover": {
@@ -39,5 +45,94 @@ export const HawaLogoButton = (props) => {
39
45
  ...buttonStyle
40
46
  };
41
47
  });
42
- return <StyledButton {...props}>{props.children}</StyledButton>;
48
+ let logoElement = "";
49
+ switch (props.logo?.toLowerCase()) {
50
+ case "google":
51
+ logoElement = (
52
+ <img
53
+ src={
54
+ "https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"
55
+ }
56
+ />
57
+ );
58
+ break;
59
+ case "github":
60
+ logoElement = <GitHubIcon />;
61
+ break;
62
+ case "twitter":
63
+ logoElement = <TwitterIcon />;
64
+ break;
65
+ case "mada":
66
+ logoElement = (
67
+ <img
68
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png"
69
+ height={20}
70
+ />
71
+ );
72
+ break;
73
+ case "stcpay":
74
+ logoElement = (
75
+ <img
76
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png"
77
+ height={20}
78
+ />
79
+ );
80
+ break;
81
+ case "visa/master":
82
+ logoElement = (
83
+ <img
84
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png"
85
+ height={30}
86
+ />
87
+ );
88
+ break;
89
+ case "paypal":
90
+ logoElement = (
91
+ <img
92
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png"
93
+ height={25}
94
+ />
95
+ );
96
+ break;
97
+ case "googlepay":
98
+ logoElement = (
99
+ <img
100
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png"
101
+ height={20}
102
+ />
103
+ );
104
+ break;
105
+ case "applepay":
106
+ logoElement = (
107
+ <img
108
+ src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png"
109
+ height={40}
110
+ />
111
+ );
112
+ break;
113
+ case "wallet":
114
+ logoElement = <WalletIcon />;
115
+ break;
116
+
117
+ default:
118
+ break;
119
+ }
120
+ return (
121
+ <StyledButton {...props}>
122
+ {logoElement}
123
+ <div style={{ width: 10 }} />
124
+ <p
125
+ style={{
126
+ color: "black",
127
+ fontSize: 14,
128
+ textAlign: "center",
129
+ letterSpacing: 0.4,
130
+ fontFamily: "Roboto",
131
+ fontWeight: 500
132
+ }}
133
+ >
134
+ {props.buttonText}
135
+ </p>
136
+ </StyledButton>
137
+ );
43
138
  };
@@ -5,7 +5,7 @@ import { ThemeProvider } from "../themes/HawaProvider";
5
5
  import { Box } from "../layout";
6
6
  import Checkbox from "@mui/material/Checkbox";
7
7
  import TextField from "@mui/material/TextField";
8
-
8
+ import { HawaTypography } from "./HawaTypography";
9
9
  export const HawaSettingsRow = (props) => {
10
10
  const { hawaTheme, themeName } = useContext(ThemeProvider);
11
11
  const currentTheme = Object.keys(hawaTheme.settingsRow).find(
@@ -38,7 +38,7 @@ export const HawaSettingsRow = (props) => {
38
38
  <Box noColor>
39
39
  {props.settingsType === "checkbox" && (
40
40
  <div style={{ ...settingsRowStyle }}>
41
- Checkbox Label <Checkbox />
41
+ <HawaTypography>Checkbox Label</HawaTypography> <Checkbox />
42
42
  </div>
43
43
  )}
44
44
  {props.settingsType === "text" && (
@@ -1,15 +1,12 @@
1
1
  import React, { useContext } from "react";
2
2
  import InputBase from "@mui/material/InputBase";
3
3
  import Typography from "@mui/material/Typography";
4
- import { styled, alpha } from "@mui/material/styles";
4
+ import { styled } from "@mui/material/styles";
5
5
  import PropTypes from "prop-types";
6
6
  import { ThemeProvider } from "../themes/HawaProvider";
7
7
  import { HawaInputLabel } from "./HawaInputLabel";
8
8
  import { Controller, useFormContext } from "react-hook-form";
9
9
 
10
- import { InputAdornment, TextField } from "@mui/material";
11
- import { MailOutline } from "@mui/icons-material";
12
-
13
10
  export const HawaTextField = (props) => {
14
11
  const { control, register } = useFormContext();
15
12
 
@@ -1,6 +1,5 @@
1
1
  import React, { useContext } from "react";
2
- import { styled, alpha } from "@mui/material/styles";
3
- import PropTypes from "prop-types";
2
+ import { styled } from "@mui/material/styles";
4
3
  import { ThemeProvider } from "../themes/HawaProvider";
5
4
  import Typography from "@mui/material/Typography";
6
5
 
package/src/ui/index.js CHANGED
@@ -2,9 +2,7 @@ export * from "./AdaptiveButton";
2
2
  export * from "./ActionButton";
3
3
  export * from "./HawaCheckbox";
4
4
  export * from "./HawaRadio";
5
- // export * from "./RadioSelector";
6
- // export * from "./Row";
7
- // export * from "./SelectedField";
5
+
8
6
  export * from "./HawaSettingsRow";
9
7
  export * from "./HawaLogoButton";
10
8
  export * from "./HawaButton";
@@ -12,14 +10,3 @@ export * from "./HawaTextField";
12
10
  export * from "./HawaInputLabel";
13
11
  export * from "./HawaTypography";
14
12
  export * from "./HawaAlert";
15
-
16
- export * from "./GoogleButton";
17
- export * from "./GithubButton";
18
- export * from "./TwitterButton";
19
- export * from "./VisaMasterButton";
20
- export * from "./MadaButton";
21
- export * from "./STCPayButton";
22
- export * from "./PayPalButton";
23
- export * from "./ApplePayButton";
24
- export * from "./GooglePayButton";
25
- export * from "./WalletButton";
@@ -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.cfefe972.iframe.bundle.js"></script><script src="vendors~main.8ebae370.iframe.bundle.js"></script><script src="main.b7ffaed0.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.cfefe972.iframe.bundle.js"></script><script src="vendors~main.aa1d952a.iframe.bundle.js"></script><script src="main.5731dbe3.iframe.bundle.js"></script></body></html>