@sikka/hawa 0.0.5 → 0.0.6
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.
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -5
- package/src/blocks/AuthForms/NewPasswordForm.js +80 -14
- package/src/blocks/AuthForms/ResetPasswordForm.js +46 -3
- package/src/blocks/AuthForms/SignInForm.js +60 -13
- package/src/blocks/AuthForms/SignUpForm.js +70 -18
- package/src/blocks/Payment/ChargeWalletForm.js +32 -0
- package/src/blocks/Payment/PayWithWallet.js +35 -0
- package/src/blocks/Payment/SelectPayment.js +15 -16
- package/src/blocks/Payment/index.js +2 -0
- package/src/layout/Box.js +0 -1
- package/src/stories/BlocksStories/AuthForm.stories.js +11 -5
- package/src/stories/BlocksStories/PaymentForm.stories.js +12 -41
- package/src/stories/Introduction.stories.js +132 -110
- package/src/stories/{ActionButton.stories.js → UIStories/ActionButton.stories.js} +2 -2
- package/src/stories/{AdaptiveButton.stories.js → UIStories/AdaptiveButton.stories.js} +2 -2
- package/src/stories/UIStories/Alert.stories.js +55 -0
- package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
- package/src/stories/UIStories/InputLabel.stories.js +13 -0
- package/src/stories/{RadioSelector.stories.js → UIStories/RadioSelector.stories.js} +5 -6
- package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
- package/src/themes/HawaProvider.js +54 -2
- package/src/ui/ApplePayButton.js +0 -1
- package/src/ui/GithubButton.js +0 -1
- package/src/ui/GoogleButton.js +0 -1
- package/src/ui/GooglePayButton.js +1 -2
- package/src/ui/HawaAlert.js +37 -0
- package/src/ui/HawaButton.js +48 -0
- package/src/ui/{Checkbox.js → HawaCheckbox.js} +1 -1
- package/src/ui/HawaInputLabel.js +0 -1
- package/src/ui/HawaLogoButton.js +48 -0
- package/src/ui/{RadioSelector.js → HawaRadio.js} +1 -1
- package/src/ui/HawaTextField.js +52 -57
- package/src/ui/HawaTypography.js +29 -0
- package/src/ui/MadaButton.js +0 -1
- package/src/ui/PayPalButton.js +1 -2
- package/src/ui/STCPayButton.js +1 -2
- package/src/ui/TwitterButton.js +0 -1
- package/src/ui/VisaMasterButton.js +0 -1
- package/src/ui/WalletButton.js +4 -71
- package/src/ui/index.js +8 -5
- package/storybook-static/{1.95be85dd.iframe.bundle.js → 0.0d994c92.iframe.bundle.js} +3 -3
- package/storybook-static/{1.95be85dd.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
- package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
- package/storybook-static/{3.d72f7fac.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
- package/storybook-static/{7.ffb0d84b.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
- package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
- package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
- package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.e55ce615.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.30a2c5d7.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt → vendors~main.30a2c5d7.iframe.bundle.js.LICENSE.txt} +15 -0
- package/storybook-static/vendors~main.30a2c5d7.iframe.bundle.js.map +1 -0
- package/src/stories/Alert.stories.js +0 -41
- package/src/stories/InputLabel.stories.js +0 -92
- package/src/ui/StyledAlert.js +0 -30
- package/storybook-static/0.54f7e52e.iframe.bundle.js +0 -1
- package/storybook-static/1.95be85dd.iframe.bundle.js.map +0 -1
- package/storybook-static/2.eb601582.iframe.bundle.js +0 -1
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
- package/storybook-static/main.044648aa.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.3e280e98.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { defaultTheme, HawaProvider } from "
|
|
4
|
-
import { ActionButton } from "
|
|
3
|
+
import { defaultTheme, HawaProvider } from "../../themes/HawaProvider";
|
|
4
|
+
import { ActionButton } from "../../ui";
|
|
5
5
|
|
|
6
6
|
const Template = (args) => {
|
|
7
7
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import CastIcon from "@mui/icons-material/Cast";
|
|
3
|
-
import { HawaProvider } from "
|
|
4
|
-
import { AdaptiveButton } from "
|
|
3
|
+
import { HawaProvider } from "../../themes/HawaProvider";
|
|
4
|
+
import { AdaptiveButton } from "../../ui";
|
|
5
5
|
|
|
6
6
|
const Template = (args) => {
|
|
7
7
|
const theme = {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { defaultTheme, HawaProvider } from "../../themes/HawaProvider";
|
|
4
|
+
import { HawaAlert } from "../../ui";
|
|
5
|
+
|
|
6
|
+
const Template = (args) => {
|
|
7
|
+
return (
|
|
8
|
+
<HawaProvider theme={{ ...defaultTheme }}>
|
|
9
|
+
<HawaAlert
|
|
10
|
+
themeType={args.theme}
|
|
11
|
+
title="What?"
|
|
12
|
+
text="This is a success alert"
|
|
13
|
+
severity="success"
|
|
14
|
+
/>
|
|
15
|
+
<HawaAlert
|
|
16
|
+
themeType={args.theme}
|
|
17
|
+
text="This is an info alert"
|
|
18
|
+
severity="info"
|
|
19
|
+
/>
|
|
20
|
+
<HawaAlert
|
|
21
|
+
themeType={args.theme}
|
|
22
|
+
text="This is a warning alert"
|
|
23
|
+
severity="warning"
|
|
24
|
+
/>
|
|
25
|
+
<HawaAlert
|
|
26
|
+
themeType={args.theme}
|
|
27
|
+
text="This is an error alert"
|
|
28
|
+
severity="error"
|
|
29
|
+
/>
|
|
30
|
+
</HawaProvider>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
//types:
|
|
34
|
+
//error (red)
|
|
35
|
+
//warning (red)
|
|
36
|
+
//notice (blue)
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
title: "UI/Alert",
|
|
40
|
+
component: HawaAlert,
|
|
41
|
+
argTypes: {
|
|
42
|
+
theme: {
|
|
43
|
+
options: ["primary", "secondary", "default"],
|
|
44
|
+
control: { type: "select" }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
args: {
|
|
48
|
+
theme: "primary"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Default = Template.bind({});
|
|
53
|
+
Default.args = {
|
|
54
|
+
theme: "primary"
|
|
55
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import "../styles.css";
|
|
2
|
+
import { HawaCheckbox } from "../../ui";
|
|
4
3
|
|
|
5
4
|
const Template = (args) => {
|
|
6
|
-
return <
|
|
5
|
+
return <HawaCheckbox {...args} />;
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
export default {
|
|
10
9
|
title: "UI/Checkbox",
|
|
11
|
-
component:
|
|
10
|
+
component: HawaCheckbox,
|
|
12
11
|
argsTypes: {
|
|
13
12
|
defaultValue: {
|
|
14
13
|
options: [true, false],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import { HawaInputLabel } from "../../ui";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/InputLabel",
|
|
6
|
+
component: [HawaInputLabel],
|
|
7
|
+
argTypes: {
|
|
8
|
+
resize: {
|
|
9
|
+
options: ["vertical", "horizontal", "both"],
|
|
10
|
+
control: { type: "radio" }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "../styles.css";
|
|
2
|
+
import { HawaProvider } from "../../themes/HawaProvider";
|
|
3
|
+
import { HawaRadio } from "../../ui";
|
|
5
4
|
|
|
6
5
|
const Template = (args) => {
|
|
7
6
|
const theme = {
|
|
@@ -13,13 +12,13 @@ const Template = (args) => {
|
|
|
13
12
|
};
|
|
14
13
|
return (
|
|
15
14
|
<HawaProvider theme={theme}>
|
|
16
|
-
<
|
|
15
|
+
<HawaRadio {...args} />
|
|
17
16
|
</HawaProvider>
|
|
18
17
|
);
|
|
19
18
|
};
|
|
20
19
|
export default {
|
|
21
|
-
title: "
|
|
22
|
-
component:
|
|
20
|
+
title: "UI/RadioSelector",
|
|
21
|
+
component: HawaRadio,
|
|
23
22
|
argTypes: {
|
|
24
23
|
options: {
|
|
25
24
|
control: "array"
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import "../styles.css";
|
|
2
|
+
import { HawaTextField } from "../../ui";
|
|
4
3
|
|
|
5
4
|
const Template = (args) => {
|
|
6
|
-
return <
|
|
5
|
+
return <HawaTextField {...args} />;
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
export default {
|
|
10
|
-
title: "
|
|
11
|
-
component:
|
|
9
|
+
title: "UI/TextField",
|
|
10
|
+
component: HawaTextField,
|
|
12
11
|
argsTypes: {
|
|
13
12
|
type: {
|
|
14
13
|
name: "type",
|
|
@@ -13,16 +13,50 @@ export const defaultTheme = {
|
|
|
13
13
|
inputColor: "white", //Color of input fields
|
|
14
14
|
lightBackground: "#FBF5F3", //
|
|
15
15
|
darkBackground: "#0F0E0E",
|
|
16
|
+
testcolor: "green",
|
|
16
17
|
margins: 10,
|
|
17
18
|
paddings: 10,
|
|
18
19
|
allBorderRadius: 10,
|
|
20
|
+
typography: {
|
|
21
|
+
primary: { color: "black" },
|
|
22
|
+
secondary: { color: "white" }
|
|
23
|
+
},
|
|
24
|
+
logoButton: {
|
|
25
|
+
primary: {
|
|
26
|
+
borderRadius: 10,
|
|
27
|
+
backgroundColor: "#f90900",
|
|
28
|
+
|
|
29
|
+
padding: 10,
|
|
30
|
+
border: "1px solid #ced4da",
|
|
31
|
+
height: 50,
|
|
32
|
+
"&:focus": {
|
|
33
|
+
borderColor: "green"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
secondary: {
|
|
37
|
+
borderRadius: 10,
|
|
38
|
+
backgroundColor: "#f90900",
|
|
39
|
+
padding: 10,
|
|
40
|
+
border: "1px solid #ced4da",
|
|
41
|
+
height: 50,
|
|
42
|
+
"&:focus": {
|
|
43
|
+
borderColor: "green"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
19
47
|
actionButton: {
|
|
20
48
|
primary: {
|
|
21
49
|
borderRadius: 10,
|
|
22
50
|
backgroundColor: "#f90900",
|
|
23
51
|
color: "white",
|
|
24
52
|
margin: 10,
|
|
25
|
-
padding: 10
|
|
53
|
+
padding: 10,
|
|
54
|
+
border: "1px solid #ced4da",
|
|
55
|
+
fontSize: 16,
|
|
56
|
+
height: 50,
|
|
57
|
+
"&:focus": {
|
|
58
|
+
borderColor: "red"
|
|
59
|
+
}
|
|
26
60
|
},
|
|
27
61
|
secondary: {
|
|
28
62
|
borderRadius: 10,
|
|
@@ -56,7 +90,12 @@ export const defaultTheme = {
|
|
|
56
90
|
flexDirection: "column",
|
|
57
91
|
alignItems: "flex-start",
|
|
58
92
|
justifyContent: "flex-start",
|
|
59
|
-
borderRadius: 10
|
|
93
|
+
borderRadius: 10,
|
|
94
|
+
"&:focus": {
|
|
95
|
+
// boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`,
|
|
96
|
+
// borderColor: theme.palette.primary.main
|
|
97
|
+
borderColor: "#f90900"
|
|
98
|
+
}
|
|
60
99
|
},
|
|
61
100
|
secondary: {
|
|
62
101
|
backgroundColor: "white",
|
|
@@ -66,6 +105,19 @@ export const defaultTheme = {
|
|
|
66
105
|
justifyContent: "flex-start",
|
|
67
106
|
borderRadius: 10
|
|
68
107
|
}
|
|
108
|
+
},
|
|
109
|
+
alerts: {
|
|
110
|
+
primary: {
|
|
111
|
+
// marginTop: 10,
|
|
112
|
+
marginBottom: 10,
|
|
113
|
+
padding: 10,
|
|
114
|
+
borderRadius: 10
|
|
115
|
+
},
|
|
116
|
+
secondary: {
|
|
117
|
+
marginBottom: 10,
|
|
118
|
+
padding: 10,
|
|
119
|
+
borderRadius: 10
|
|
120
|
+
}
|
|
69
121
|
}
|
|
70
122
|
};
|
|
71
123
|
|
package/src/ui/ApplePayButton.js
CHANGED
|
@@ -9,7 +9,6 @@ export const ApplePayButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
package/src/ui/GithubButton.js
CHANGED
|
@@ -9,7 +9,6 @@ export const GithubButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
package/src/ui/GoogleButton.js
CHANGED
|
@@ -7,7 +7,6 @@ export const GoogleButton = (props) => {
|
|
|
7
7
|
const theme = useContext(ThemeProvider);
|
|
8
8
|
let buttonStyle = {};
|
|
9
9
|
|
|
10
|
-
console.log(Object.keys(theme.actionButton));
|
|
11
10
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
12
11
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
13
12
|
);
|
|
@@ -9,7 +9,6 @@ export const GooglePayButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
|
@@ -74,7 +73,7 @@ export const GooglePayButton = (props) => {
|
|
|
74
73
|
>
|
|
75
74
|
<img
|
|
76
75
|
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png"
|
|
77
|
-
height={
|
|
76
|
+
height={20}
|
|
78
77
|
/>{" "}
|
|
79
78
|
<div style={{ width: 10 }} />
|
|
80
79
|
<p
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
|
+
import { styled, alpha } from "@mui/material/styles";
|
|
4
|
+
|
|
5
|
+
import Alert from "@mui/material/Alert";
|
|
6
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
7
|
+
|
|
8
|
+
export const HawaAlert = (props) => {
|
|
9
|
+
const theme = useContext(ThemeProvider);
|
|
10
|
+
const currentTheme = Object.keys(theme.alerts).find(
|
|
11
|
+
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
12
|
+
);
|
|
13
|
+
let alertStyle = {};
|
|
14
|
+
|
|
15
|
+
if (currentTheme) {
|
|
16
|
+
alertStyle = {
|
|
17
|
+
...theme.alerts[currentTheme]
|
|
18
|
+
};
|
|
19
|
+
} else {
|
|
20
|
+
alertStyle = {
|
|
21
|
+
marginBottom: 10
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const StyledAlert = styled(Alert)(({ theme }) => {
|
|
26
|
+
return {
|
|
27
|
+
...alertStyle
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<StyledAlert themeType={props.themeType} {...props}>
|
|
33
|
+
{props.title && <AlertTitle>{props.title}</AlertTitle>}
|
|
34
|
+
{props.text}
|
|
35
|
+
</StyledAlert>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
|
+
import { styled, darken } from "@mui/material/styles";
|
|
4
|
+
import Button from "@mui/material/Button";
|
|
5
|
+
|
|
6
|
+
export const HawaButton = (props) => {
|
|
7
|
+
const theme = useContext(ThemeProvider);
|
|
8
|
+
let buttonStyle = {};
|
|
9
|
+
let currentTheme = Object.keys(theme.actionButton).find(
|
|
10
|
+
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
11
|
+
);
|
|
12
|
+
if (currentTheme) {
|
|
13
|
+
buttonStyle = {
|
|
14
|
+
...theme.actionButton[currentTheme],
|
|
15
|
+
// marginTop: theme.actionButton[currentTheme].margin,
|
|
16
|
+
border: props.outlined ? "2px solid black" : "none",
|
|
17
|
+
// borderRadius: theme.actionButton[currentTheme].borderRadius,
|
|
18
|
+
backgroundColor: "white",
|
|
19
|
+
// height: 50,
|
|
20
|
+
"&:hover": {
|
|
21
|
+
backgroundColor: darken("#ffffff", 0.1)
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
// Default theme
|
|
26
|
+
buttonStyle = {
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
marginTop: theme.actionButton[currentTheme]?.margin,
|
|
33
|
+
border: props.outlined ? "2px solid black" : "none",
|
|
34
|
+
borderRadius: 0,
|
|
35
|
+
//backgroundColor: "white",
|
|
36
|
+
backgroundColor: "red",
|
|
37
|
+
"&:hover": {
|
|
38
|
+
backgroundColor: darken("#ffffff", 0.1)
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const StyledButton = styled(Button)(({ theme }) => {
|
|
43
|
+
return {
|
|
44
|
+
...buttonStyle
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
return <StyledButton {...props}>{props.children}</StyledButton>;
|
|
48
|
+
};
|
|
@@ -3,7 +3,7 @@ import FormControlLabel from "@mui/material/FormControlLabel";
|
|
|
3
3
|
import Checkbox from "@mui/material/Checkbox";
|
|
4
4
|
// import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const HawaCheckbox = (props) => {
|
|
7
7
|
console.log("props : ", props);
|
|
8
8
|
return (
|
|
9
9
|
<React.Fragment>
|
package/src/ui/HawaInputLabel.js
CHANGED
|
@@ -6,7 +6,6 @@ export const HawaInputLabel = (props) => {
|
|
|
6
6
|
const theme = useContext(ThemeProvider);
|
|
7
7
|
let labelStyle = {};
|
|
8
8
|
|
|
9
|
-
console.log(Object.keys(theme.actionButton));
|
|
10
9
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
11
10
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
12
11
|
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
|
+
import { styled, darken } from "@mui/material/styles";
|
|
4
|
+
import Button from "@mui/material/Button";
|
|
5
|
+
|
|
6
|
+
export const HawaLogoButton = (props) => {
|
|
7
|
+
const theme = useContext(ThemeProvider);
|
|
8
|
+
let buttonStyle = {};
|
|
9
|
+
let currentTheme = Object.keys(theme.logoButton).find(
|
|
10
|
+
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
11
|
+
);
|
|
12
|
+
if (currentTheme) {
|
|
13
|
+
buttonStyle = {
|
|
14
|
+
...theme.logoButton[currentTheme],
|
|
15
|
+
// marginTop: theme.actionButton[currentTheme].margin,
|
|
16
|
+
border: props.outlined ? "2px solid black" : "none",
|
|
17
|
+
// borderRadius: theme.actionButton[currentTheme].borderRadius,
|
|
18
|
+
backgroundColor: "white",
|
|
19
|
+
// height: 50,
|
|
20
|
+
"&:hover": {
|
|
21
|
+
backgroundColor: darken("#ffffff", 0.1)
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
// Default theme
|
|
26
|
+
buttonStyle = {
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
marginTop: theme.logoButton[currentTheme]?.margin,
|
|
33
|
+
border: props.outlined ? "2px solid black" : "none",
|
|
34
|
+
// borderRadius: 0,
|
|
35
|
+
height: 50,
|
|
36
|
+
backgroundColor: "white",
|
|
37
|
+
"&:hover": {
|
|
38
|
+
backgroundColor: darken("#ffffff", 0.1)
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const StyledButton = styled(Button)(({ theme }) => {
|
|
43
|
+
return {
|
|
44
|
+
...buttonStyle
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
return <StyledButton {...props}>{props.children}</StyledButton>;
|
|
48
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useContext } from "react";
|
|
2
2
|
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const HawaRadio = (props) => {
|
|
5
5
|
const [value, setValue] = useState(props.defaultValue);
|
|
6
6
|
const theme = useContext(ThemeProvider);
|
|
7
7
|
|
package/src/ui/HawaTextField.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
// import TextField from "@mui/material/TextField";
|
|
3
2
|
import InputBase from "@mui/material/InputBase";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
4
|
import { styled, alpha } 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
10
|
export const HawaTextField = (props) => {
|
|
11
|
+
const { control, register } = useFormContext();
|
|
12
|
+
|
|
11
13
|
const theme = useContext(ThemeProvider);
|
|
12
14
|
const currentTheme = Object.keys(theme.actionButton).find(
|
|
13
15
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
@@ -30,7 +32,7 @@ export const HawaTextField = (props) => {
|
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const
|
|
35
|
+
const StyledTextField = styled(InputBase)(({ theme }) => {
|
|
34
36
|
return {
|
|
35
37
|
// "label + &": {
|
|
36
38
|
// marginTop: theme.spacing(3)
|
|
@@ -44,75 +46,68 @@ export const HawaTextField = (props) => {
|
|
|
44
46
|
]),
|
|
45
47
|
|
|
46
48
|
"&:focus": {
|
|
47
|
-
boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`,
|
|
48
|
-
borderColor: theme.palette.primary.main
|
|
49
|
+
// boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`,
|
|
50
|
+
// borderColor: theme.palette.primary.main
|
|
51
|
+
// borderColor: theme.actionButton[currentTheme]?.backgroundColor
|
|
49
52
|
},
|
|
50
53
|
borderRadius: 4,
|
|
51
|
-
position: "relative",
|
|
54
|
+
// position: "relative",
|
|
52
55
|
border: "1px solid #ced4da",
|
|
53
56
|
fontSize: 16,
|
|
54
57
|
// width: "auto",
|
|
55
58
|
padding: "10px 12px",
|
|
59
|
+
marginBottom: props.helperText ? 5 : 0,
|
|
56
60
|
...textFieldStyle
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
63
|
});
|
|
60
64
|
|
|
61
65
|
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<BootstrapInput fullWidth aria-label="dws" />
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
// return (
|
|
75
|
-
// <div>
|
|
76
|
-
// {props.inputLabel ? (
|
|
77
|
-
// <HawaInputLabel themeType={props.themeType} label={props.inputLabel} />
|
|
78
|
-
// ) : null}
|
|
79
|
-
// <TextField
|
|
80
|
-
// fullWidth
|
|
81
|
-
// style={textFieldStyle}
|
|
82
|
-
// helperText={props.helperText}
|
|
83
|
-
// type={props.type ? props.type : "text"}
|
|
84
|
-
// placeholder={props.placeholder}
|
|
85
|
-
// inputProps={
|
|
86
|
-
// props.type === "number"
|
|
87
|
-
// ? {
|
|
88
|
-
// inputMode: "numeric",
|
|
89
|
-
// min: "0",
|
|
90
|
-
// max: "9999999",
|
|
91
|
-
// step: "0.01"
|
|
92
|
-
// }
|
|
93
|
-
// : {}
|
|
94
|
-
// }
|
|
95
|
-
// InputProps={{
|
|
96
|
-
// style: {
|
|
97
|
-
// ...textFieldStyle
|
|
98
|
-
// // // height: 50
|
|
99
|
-
// // padding: 0
|
|
100
|
-
// },
|
|
66
|
+
<Controller
|
|
67
|
+
render={({ field }) => (
|
|
68
|
+
<>
|
|
69
|
+
{props.inputLabel && (
|
|
70
|
+
<HawaInputLabel
|
|
71
|
+
themeType={props.themeType}
|
|
72
|
+
label={props.inputLabel}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
101
75
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
76
|
+
<StyledTextField
|
|
77
|
+
fullWidth={true}
|
|
78
|
+
// helperText={props.helperText}
|
|
79
|
+
type={props.type ?? "text"}
|
|
80
|
+
// placeholder={props.placeholder}
|
|
81
|
+
// inputProps={
|
|
82
|
+
// props.type === "number"
|
|
83
|
+
// ? {
|
|
84
|
+
// inputMode: "numeric",
|
|
85
|
+
// min: "0",
|
|
86
|
+
// max: "9999999",
|
|
87
|
+
// step: "0.01"
|
|
88
|
+
// }
|
|
89
|
+
// : {}
|
|
90
|
+
// }
|
|
91
|
+
defaultValue={props.defaultValue && ""}
|
|
92
|
+
value={props.value && ""}
|
|
93
|
+
{...props}
|
|
94
|
+
// {...field}
|
|
95
|
+
{...register(props.name)}
|
|
96
|
+
/>
|
|
97
|
+
<Typography variant="caption" style={{ margin: 5, color: "red" }}>
|
|
98
|
+
{props.helperText}
|
|
99
|
+
</Typography>
|
|
100
|
+
</>
|
|
101
|
+
)}
|
|
102
|
+
name={props.name}
|
|
103
|
+
rules={props.rules}
|
|
104
|
+
control={control}
|
|
105
|
+
shouldUnregister={props.shouldUnregister}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
109
108
|
};
|
|
110
109
|
|
|
111
110
|
HawaTextField.propTypes = {
|
|
112
|
-
type: PropTypes.oneOf(["text", "number"]),
|
|
111
|
+
type: PropTypes.oneOf(["text", "number", "password"]),
|
|
113
112
|
helperText: PropTypes.string
|
|
114
113
|
};
|
|
115
|
-
|
|
116
|
-
// StyledTextField.defaultProps = {
|
|
117
|
-
// type: "text"
|
|
118
|
-
// };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { styled, alpha } from "@mui/material/styles";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
5
|
+
import Typography from "@mui/material/Typography";
|
|
6
|
+
|
|
7
|
+
export const HawaTypography = (props) => {
|
|
8
|
+
const theme = useContext(ThemeProvider);
|
|
9
|
+
const currentTheme = Object.keys(theme.actionButton).find(
|
|
10
|
+
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
11
|
+
);
|
|
12
|
+
let typographyStyle = {};
|
|
13
|
+
|
|
14
|
+
if (currentTheme) {
|
|
15
|
+
typographyStyle = { ...theme.typography[currentTheme] };
|
|
16
|
+
} else {
|
|
17
|
+
typographyStyle = {
|
|
18
|
+
color: "black"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const StyledTypography = styled(Typography)(({ theme }) => {
|
|
23
|
+
return {
|
|
24
|
+
...typographyStyle
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return <StyledTypography {...props}>{props.children}</StyledTypography>;
|
|
29
|
+
};
|
package/src/ui/MadaButton.js
CHANGED
|
@@ -9,7 +9,6 @@ export const MadaButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
package/src/ui/PayPalButton.js
CHANGED
|
@@ -9,7 +9,6 @@ export const PayPalButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
|
@@ -74,7 +73,7 @@ export const PayPalButton = (props) => {
|
|
|
74
73
|
>
|
|
75
74
|
<img
|
|
76
75
|
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png"
|
|
77
|
-
height={
|
|
76
|
+
height={25}
|
|
78
77
|
/>{" "}
|
|
79
78
|
<div style={{ width: 10 }} />
|
|
80
79
|
<p
|
package/src/ui/STCPayButton.js
CHANGED
|
@@ -9,7 +9,6 @@ export const STCPayButton = (props) => {
|
|
|
9
9
|
const theme = useContext(ThemeProvider);
|
|
10
10
|
let buttonStyle = {};
|
|
11
11
|
|
|
12
|
-
console.log(Object.keys(theme.actionButton));
|
|
13
12
|
let currentTheme = Object.keys(theme.actionButton).find(
|
|
14
13
|
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
15
14
|
);
|
|
@@ -74,7 +73,7 @@ export const STCPayButton = (props) => {
|
|
|
74
73
|
>
|
|
75
74
|
<img
|
|
76
75
|
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png"
|
|
77
|
-
height={
|
|
76
|
+
height={20}
|
|
78
77
|
/>{" "}
|
|
79
78
|
<div style={{ width: 10 }} />
|
|
80
79
|
<p
|