@sikka/hawa 0.0.5 → 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.
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +4 -5
- package/src/blocks/Account/UserProfile.js +57 -7
- package/src/blocks/AuthForms/NewPasswordForm.js +100 -17
- package/src/blocks/AuthForms/ResetPasswordForm.js +61 -5
- package/src/blocks/AuthForms/SignInForm.js +101 -26
- package/src/blocks/AuthForms/SignUpForm.js +113 -32
- package/src/blocks/Payment/ChargeWalletForm.js +53 -0
- package/src/blocks/Payment/CreditCardForm.js +50 -21
- package/src/blocks/Payment/PayWithWallet.js +14 -0
- package/src/blocks/Payment/SelectPayment.js +20 -42
- package/src/blocks/Payment/index.js +2 -0
- package/src/layout/Box.js +9 -10
- package/src/stories/BlocksStories/AuthForm.stories.js +18 -12
- package/src/stories/BlocksStories/PaymentForm.stories.js +15 -40
- package/src/stories/BlocksStories/UserForm.stories.js +41 -0
- package/src/stories/{Introduction.stories.js → Introduction.stories.mdx} +45 -27
- package/src/stories/LayoutStories/Box.stories.js +4 -4
- package/src/stories/{ActionButton.stories.js → UIStories/ActionButton.stories.js} +16 -23
- package/src/stories/UIStories/AdaptiveButton.stories.js +81 -0
- package/src/stories/UIStories/Alert.stories.js +42 -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/UIStories/LogoButtons.stories.js +90 -0
- package/src/stories/UIStories/RadioSelector.stories.js +53 -0
- package/src/stories/UIStories/SettingsRow.stories.js +64 -0
- package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
- package/src/themes/HawaProvider.js +107 -11
- package/src/ui/ActionButton.js +12 -11
- package/src/ui/AdaptiveButton.js +43 -159
- 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 +4 -5
- package/src/ui/HawaLogoButton.js +138 -0
- package/src/ui/HawaRadio.js +73 -0
- package/src/ui/HawaSettingsRow.js +71 -0
- package/src/ui/HawaTextField.js +69 -80
- package/src/ui/HawaTypography.js +28 -0
- package/src/ui/index.js +9 -19
- 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.5731dbe3.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt → vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +1 -0
- package/src/stories/AdaptiveButton.stories.js +0 -80
- package/src/stories/Alert.stories.js +0 -41
- package/src/stories/BlocksStories/UserAccount.stories.js +0 -46
- package/src/stories/GlobalVariables.stories.js +0 -44
- package/src/stories/InputLabel.stories.js +0 -92
- package/src/stories/RadioSelector.stories.js +0 -69
- package/src/ui/ApplePayButton.js +0 -94
- package/src/ui/GithubButton.js +0 -91
- package/src/ui/GoogleButton.js +0 -83
- package/src/ui/GooglePayButton.js +0 -94
- package/src/ui/MadaButton.js +0 -94
- package/src/ui/PayPalButton.js +0 -94
- package/src/ui/RadioSelector.js +0 -51
- package/src/ui/STCPayButton.js +0 -94
- package/src/ui/StyledAlert.js +0 -30
- package/src/ui/TwitterButton.js +0 -84
- package/src/ui/VisaMasterButton.js +0 -94
- package/src/ui/WalletButton.js +0 -91
- 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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
|
+
import { styled } 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 { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
10
|
+
const currentTheme = Object.keys(hawaTheme.alerts).find(
|
|
11
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
12
|
+
);
|
|
13
|
+
let alertStyle = {};
|
|
14
|
+
|
|
15
|
+
if (currentTheme) {
|
|
16
|
+
alertStyle = {
|
|
17
|
+
...hawaTheme.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 {...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 { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
8
|
+
let buttonStyle = {};
|
|
9
|
+
let currentTheme = Object.keys(hawaTheme.actionButton).find(
|
|
10
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
11
|
+
);
|
|
12
|
+
if (currentTheme) {
|
|
13
|
+
buttonStyle = {
|
|
14
|
+
...hawaTheme.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: hawaTheme.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
|
@@ -3,19 +3,18 @@ import { useContext } from "react";
|
|
|
3
3
|
import { ThemeProvider } from "../themes/HawaProvider";
|
|
4
4
|
|
|
5
5
|
export const HawaInputLabel = (props) => {
|
|
6
|
-
const
|
|
6
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
7
7
|
let labelStyle = {};
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
|
|
9
|
+
let currentTheme = Object.keys(hawaTheme.actionButton).find(
|
|
10
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
12
11
|
);
|
|
13
12
|
if (currentTheme) {
|
|
14
13
|
labelStyle = {
|
|
15
14
|
margin: 15,
|
|
16
15
|
marginRight: 5,
|
|
17
16
|
marginLeft: 5,
|
|
18
|
-
color:
|
|
17
|
+
color: hawaTheme.layout[currentTheme].color
|
|
19
18
|
};
|
|
20
19
|
} else {
|
|
21
20
|
labelStyle = {
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
import GitHubIcon from "@mui/icons-material/GitHub";
|
|
6
|
+
import TwitterIcon from "@mui/icons-material/Twitter";
|
|
7
|
+
import WalletIcon from "@mui/icons-material/AccountBalanceWallet";
|
|
8
|
+
|
|
9
|
+
export const HawaLogoButton = (props) => {
|
|
10
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
11
|
+
let buttonStyle = {};
|
|
12
|
+
let currentTheme = Object.keys(hawaTheme.logoButton).find(
|
|
13
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
14
|
+
);
|
|
15
|
+
if (currentTheme) {
|
|
16
|
+
buttonStyle = {
|
|
17
|
+
...hawaTheme.logoButton[currentTheme],
|
|
18
|
+
backgroundColor: "white",
|
|
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: 10,
|
|
32
|
+
height: 50,
|
|
33
|
+
padding: 30,
|
|
34
|
+
paddingTop: 0,
|
|
35
|
+
paddingBottom: 0,
|
|
36
|
+
border: "1px solid #ced4da",
|
|
37
|
+
backgroundColor: "white",
|
|
38
|
+
"&:hover": {
|
|
39
|
+
backgroundColor: darken("#ffffff", 0.1)
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const StyledButton = styled(Button)(({ theme }) => {
|
|
44
|
+
return {
|
|
45
|
+
...buttonStyle
|
|
46
|
+
};
|
|
47
|
+
});
|
|
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
|
+
);
|
|
138
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Typography } from "@mui/material";
|
|
2
|
+
import React, { useState, useContext } from "react";
|
|
3
|
+
import { Box } from "../layout";
|
|
4
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
5
|
+
|
|
6
|
+
export const HawaRadio = (props) => {
|
|
7
|
+
const [value, setValue] = useState(props.defaultValue);
|
|
8
|
+
|
|
9
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
10
|
+
const currentTheme = Object.keys(hawaTheme.radioSelector).find(
|
|
11
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
12
|
+
);
|
|
13
|
+
let radioSelectorStyle = {};
|
|
14
|
+
|
|
15
|
+
if (currentTheme) {
|
|
16
|
+
radioSelectorStyle = {
|
|
17
|
+
...hawaTheme.radioSelector[currentTheme],
|
|
18
|
+
"-moz-user-select": "-moz-none",
|
|
19
|
+
"-khtml-user-select": "none",
|
|
20
|
+
"-webkit-user-select": "none",
|
|
21
|
+
"-ms-user-select": "none",
|
|
22
|
+
"user-select": "none"
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
radioSelectorStyle = {
|
|
26
|
+
display: "flex",
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
justifyContent: "space-between",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
backgroundColor: "#F5F5F5",
|
|
31
|
+
margin: 0,
|
|
32
|
+
|
|
33
|
+
backgroundColor: "lightGrey",
|
|
34
|
+
color: "black",
|
|
35
|
+
padding: 10
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Box horizontal maxWidth={"fit-content"}>
|
|
41
|
+
{props.options.map((singleOption) => {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
key={singleOption.label}
|
|
45
|
+
onClick={() => {
|
|
46
|
+
setValue(singleOption.label);
|
|
47
|
+
if (props.handleChange) {
|
|
48
|
+
props.handleChange();
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
style={{
|
|
52
|
+
...radioSelectorStyle,
|
|
53
|
+
backgroundColor:
|
|
54
|
+
value.toLowerCase() === singleOption.label.toLowerCase()
|
|
55
|
+
? currentTheme
|
|
56
|
+
? hawaTheme.actionButton[currentTheme]?.backgroundColor
|
|
57
|
+
: "black"
|
|
58
|
+
: hawaTheme.layout[currentTheme]?.backgroundColor,
|
|
59
|
+
color:
|
|
60
|
+
value.toLowerCase() === singleOption.label.toLowerCase()
|
|
61
|
+
? hawaTheme.actionButton[currentTheme]?.color
|
|
62
|
+
: currentTheme
|
|
63
|
+
? hawaTheme.layout[currentTheme]?.color
|
|
64
|
+
: "black"
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<Typography>{singleOption.text}</Typography>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
})}
|
|
71
|
+
</Box>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
5
|
+
import { Box } from "../layout";
|
|
6
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
7
|
+
import TextField from "@mui/material/TextField";
|
|
8
|
+
import { HawaTypography } from "./HawaTypography";
|
|
9
|
+
export const HawaSettingsRow = (props) => {
|
|
10
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
11
|
+
const currentTheme = Object.keys(hawaTheme.settingsRow).find(
|
|
12
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
13
|
+
);
|
|
14
|
+
let settingsRowStyle = {};
|
|
15
|
+
|
|
16
|
+
if (currentTheme) {
|
|
17
|
+
settingsRowStyle = {
|
|
18
|
+
...hawaTheme.settingsRow[currentTheme],
|
|
19
|
+
margin: props.last ? 0 : hawaTheme.settingsRow[currentTheme].margin,
|
|
20
|
+
marginTop: props.last ? hawaTheme.settingsRow[currentTheme].margin * 2 : 0
|
|
21
|
+
};
|
|
22
|
+
} else {
|
|
23
|
+
settingsRowStyle = {
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
justifyContent: "space-between",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
backgroundColor: "#F5F5F5",
|
|
29
|
+
margin: 0,
|
|
30
|
+
|
|
31
|
+
backgroundColor: "lightGrey",
|
|
32
|
+
color: "black",
|
|
33
|
+
padding: 10
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Box noColor>
|
|
39
|
+
{props.settingsType === "checkbox" && (
|
|
40
|
+
<div style={{ ...settingsRowStyle }}>
|
|
41
|
+
<HawaTypography>Checkbox Label</HawaTypography> <Checkbox />
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
{props.settingsType === "text" && (
|
|
45
|
+
<div style={{ ...settingsRowStyle }}>
|
|
46
|
+
Text Label{" "}
|
|
47
|
+
<TextField
|
|
48
|
+
InputProps={{
|
|
49
|
+
style: {
|
|
50
|
+
...hawaTheme.inputFields[currentTheme],
|
|
51
|
+
// borderRadius: 0,
|
|
52
|
+
// padding: 0,
|
|
53
|
+
// backgroundColor: "white",
|
|
54
|
+
height: 40
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
style={{
|
|
58
|
+
padding: 0
|
|
59
|
+
}}
|
|
60
|
+
placeholder="test"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</Box>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
HawaSettingsRow.propTypes = {
|
|
69
|
+
type: PropTypes.oneOf(["text", "number", "password"]),
|
|
70
|
+
helperText: PropTypes.string
|
|
71
|
+
};
|
package/src/ui/HawaTextField.js
CHANGED
|
@@ -1,118 +1,107 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
// import TextField from "@mui/material/TextField";
|
|
3
2
|
import InputBase from "@mui/material/InputBase";
|
|
4
|
-
import
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
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
10
|
export const HawaTextField = (props) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const { control, register } = useFormContext();
|
|
12
|
+
|
|
13
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
14
|
+
const currentTheme = Object.keys(hawaTheme.inputFields).find(
|
|
15
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
14
16
|
);
|
|
15
17
|
let textFieldStyle = {};
|
|
16
18
|
|
|
17
19
|
if (currentTheme) {
|
|
18
20
|
textFieldStyle = {
|
|
19
|
-
...
|
|
20
|
-
margin: props.last ? 0 :
|
|
21
|
-
marginTop: props.last ?
|
|
21
|
+
...hawaTheme.inputFields[currentTheme],
|
|
22
|
+
margin: props.last ? 0 : hawaTheme.inputFields[currentTheme].margin,
|
|
23
|
+
marginTop: props.last ? hawaTheme.inputFields[currentTheme].margin * 2 : 0
|
|
22
24
|
};
|
|
23
25
|
} else {
|
|
24
26
|
textFieldStyle = {
|
|
25
|
-
backgroundColor: "white"
|
|
26
|
-
display: "flex",
|
|
27
|
-
flexDirection: "column",
|
|
28
|
-
alignItems: "flex-start",
|
|
29
|
-
justifyContent: "flex-start"
|
|
27
|
+
backgroundColor: "white"
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
const
|
|
31
|
+
const StyledTextField = styled(InputBase)(({ theme }) => {
|
|
34
32
|
return {
|
|
35
33
|
// "label + &": {
|
|
36
34
|
// marginTop: theme.spacing(3)
|
|
37
35
|
// },
|
|
38
36
|
"& .MuiInputBase-input": {
|
|
39
|
-
backgroundColor: theme.palette.mode === "light" ? "#fcfcfb" : "#2b2b2b",
|
|
37
|
+
// backgroundColor: theme.palette.mode === "light" ? "#fcfcfb" : "#2b2b2b",
|
|
40
38
|
transition: theme.transitions.create([
|
|
41
39
|
"border-color",
|
|
42
40
|
"background-color",
|
|
43
41
|
"box-shadow"
|
|
44
|
-
])
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
// backgroundColor: "red"
|
|
45
|
+
},
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...textFieldStyle
|
|
57
|
-
}
|
|
47
|
+
// position: "relative",
|
|
48
|
+
border: "1px solid #ced4da",
|
|
49
|
+
fontSize: 16,
|
|
50
|
+
// width: "auto",
|
|
51
|
+
padding: "10px 12px",
|
|
52
|
+
marginBottom: props.helperText ? 5 : 0,
|
|
53
|
+
paddingLeft: 10,
|
|
54
|
+
paddingRight: 10,
|
|
55
|
+
...textFieldStyle
|
|
56
|
+
// backgroundColor: "green"
|
|
58
57
|
};
|
|
59
58
|
});
|
|
60
59
|
|
|
61
60
|
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
) : null}
|
|
67
|
-
{/* <InputLabel shrink htmlFor="bootstrap-input">
|
|
68
|
-
{props.inputLabel}
|
|
69
|
-
</InputLabel> */}
|
|
70
|
-
{/* <div>ss</div> */}
|
|
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
|
-
// },
|
|
61
|
+
<Controller
|
|
62
|
+
render={({ field }) => (
|
|
63
|
+
<>
|
|
64
|
+
{props.inputLabel && <HawaInputLabel label={props.inputLabel} />}
|
|
101
65
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
66
|
+
<StyledTextField
|
|
67
|
+
fullWidth={true}
|
|
68
|
+
// helperText={props.helperText}
|
|
69
|
+
type={props.type ?? "text"}
|
|
70
|
+
// placeholder={props.placeholder}
|
|
71
|
+
// inputProps={
|
|
72
|
+
// props.type === "number"
|
|
73
|
+
// ? {
|
|
74
|
+
// inputMode: "numeric",
|
|
75
|
+
// min: "0",
|
|
76
|
+
// max: "9999999",
|
|
77
|
+
// step: "0.01"
|
|
78
|
+
// }
|
|
79
|
+
// : {}
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
defaultValue={props.defaultValue && ""}
|
|
83
|
+
value={props.value && ""}
|
|
84
|
+
{...props}
|
|
85
|
+
// {...field}
|
|
86
|
+
{...register(props.name)}
|
|
87
|
+
/>
|
|
88
|
+
<Typography
|
|
89
|
+
variant="caption"
|
|
90
|
+
style={{ margin: 5, marginBottom: 0, color: "red" }}
|
|
91
|
+
>
|
|
92
|
+
{props.helperText}
|
|
93
|
+
</Typography>
|
|
94
|
+
</>
|
|
95
|
+
)}
|
|
96
|
+
name={props.name}
|
|
97
|
+
rules={props.rules}
|
|
98
|
+
control={control}
|
|
99
|
+
shouldUnregister={props.shouldUnregister}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
109
102
|
};
|
|
110
103
|
|
|
111
104
|
HawaTextField.propTypes = {
|
|
112
|
-
type: PropTypes.oneOf(["text", "number"]),
|
|
105
|
+
type: PropTypes.oneOf(["text", "number", "password"]),
|
|
113
106
|
helperText: PropTypes.string
|
|
114
107
|
};
|
|
115
|
-
|
|
116
|
-
// StyledTextField.defaultProps = {
|
|
117
|
-
// type: "text"
|
|
118
|
-
// };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
4
|
+
import Typography from "@mui/material/Typography";
|
|
5
|
+
|
|
6
|
+
export const HawaTypography = (props) => {
|
|
7
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
8
|
+
const currentTheme = Object.keys(hawaTheme.typography).find(
|
|
9
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
10
|
+
);
|
|
11
|
+
let typographyStyle = {};
|
|
12
|
+
|
|
13
|
+
if (currentTheme) {
|
|
14
|
+
typographyStyle = { ...hawaTheme.typography[currentTheme] };
|
|
15
|
+
} else {
|
|
16
|
+
typographyStyle = {
|
|
17
|
+
color: "black"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const StyledTypography = styled(Typography)(({ theme }) => {
|
|
22
|
+
return {
|
|
23
|
+
...typographyStyle
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return <StyledTypography {...props}>{props.children}</StyledTypography>;
|
|
28
|
+
};
|
package/src/ui/index.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./AdaptiveButton";
|
|
2
2
|
export * from "./ActionButton";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// export * from "./HawaTextArea";
|
|
3
|
+
export * from "./HawaCheckbox";
|
|
4
|
+
export * from "./HawaRadio";
|
|
5
|
+
|
|
6
|
+
export * from "./HawaSettingsRow";
|
|
7
|
+
export * from "./HawaLogoButton";
|
|
8
|
+
export * from "./HawaButton";
|
|
10
9
|
export * from "./HawaTextField";
|
|
11
10
|
export * from "./HawaInputLabel";
|
|
12
|
-
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./GithubButton";
|
|
15
|
-
export * from "./TwitterButton";
|
|
16
|
-
export * from "./VisaMasterButton";
|
|
17
|
-
export * from "./MadaButton";
|
|
18
|
-
export * from "./STCPayButton";
|
|
19
|
-
export * from "./PayPalButton";
|
|
20
|
-
export * from "./ApplePayButton";
|
|
21
|
-
export * from "./GooglePayButton";
|
|
22
|
-
export * from "./WalletButton";
|
|
11
|
+
export * from "./HawaTypography";
|
|
12
|
+
export * from "./HawaAlert";
|