@sikka/hawa 0.0.37 → 0.0.41
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/.github/workflows/hawa-publish-push.yml +4 -2
- package/.github/workflows/hawa-publish.yml +3 -1
- package/README.md +2 -1
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +5 -3
- package/src/Hooks.js +61 -0
- package/src/blocks/AuthForms/CodeConfirmation.js +94 -0
- package/src/blocks/AuthForms/index.js +1 -0
- package/src/blocks/Misc/NotFound.js +47 -0
- package/src/blocks/Misc/index.js +1 -0
- package/src/blocks/Pricing/PricingPlans.js +3 -3
- package/src/elements/HawaChip.js +6 -0
- package/src/elements/{HawaRadio.js → HawaPanelTabs.js} +3 -2
- package/src/elements/HawaSettingsRow.js +2 -2
- package/src/elements/HawaSnackbar.js +11 -8
- package/src/elements/PinInput.js +141 -0
- package/src/elements/index.js +2 -2
- package/src/index.js +1 -0
- package/src/layout/HawaAppBar.js +0 -1
- package/src/styles.css +4 -0
- package/src/styles.scss +3 -1
- package/src/theme/HawaTheme.js +91 -46
- package/src/util.js +11 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.066fa5c5.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/{vendors~main.826e89a1.iframe.bundle.js → vendors~main.40879e99.iframe.bundle.js} +2 -2
- package/storybook-static/{vendors~main.826e89a1.iframe.bundle.js.LICENSE.txt → vendors~main.40879e99.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.40879e99.iframe.bundle.js.map +1 -0
- package/src/elements/HawaTextArea.js +0 -26
- package/storybook-static/main.1a0e1257.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.826e89a1.iframe.bundle.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Container from "@mui/material/Container";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Typography from "@mui/material/Typography";
|
|
5
|
+
import { Button } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
export const NotFound = (props) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
style={{
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
alignItems: "center"
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Typography variant="h2" fontWeight={700}>
|
|
17
|
+
404
|
|
18
|
+
</Typography>
|
|
19
|
+
<Typography variant="h5" fontWeight={700}>
|
|
20
|
+
Page Not Found
|
|
21
|
+
</Typography>
|
|
22
|
+
<Container
|
|
23
|
+
style={{
|
|
24
|
+
maxWidth: 300,
|
|
25
|
+
marginTop: 10,
|
|
26
|
+
direction: props.lang === "ar" ? "rtl" : "ltr"
|
|
27
|
+
}}
|
|
28
|
+
maxWidth="xs"
|
|
29
|
+
>
|
|
30
|
+
<Typography textAlign={"center"}>
|
|
31
|
+
If you're lost please contact us help@sikka.io{" "}
|
|
32
|
+
</Typography>
|
|
33
|
+
<Button style={{ marginTop: 5 }} variant="contained">
|
|
34
|
+
Home
|
|
35
|
+
</Button>
|
|
36
|
+
</Container>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
NotFound.propTypes = {
|
|
41
|
+
/**
|
|
42
|
+
* An object of all the texts in the blocks
|
|
43
|
+
*/
|
|
44
|
+
texts: PropTypes.shape({
|
|
45
|
+
emailLabel: PropTypes.string
|
|
46
|
+
})
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./NotFound.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Container from "@mui/material/Container";
|
|
3
|
-
import { HawaPricingCard,
|
|
3
|
+
import { HawaPricingCard, HawaPanelTabs } from "../../elements";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
6
|
export const PricingPlans = (props) => {
|
|
@@ -16,7 +16,7 @@ export const PricingPlans = (props) => {
|
|
|
16
16
|
marginBottom: 10
|
|
17
17
|
}}
|
|
18
18
|
>
|
|
19
|
-
<
|
|
19
|
+
<HawaPanelTabs
|
|
20
20
|
location="inPricing"
|
|
21
21
|
handleChange={(e) => setCurrentCycle(e)}
|
|
22
22
|
defaultValue="monthly"
|
|
@@ -28,7 +28,7 @@ export const PricingPlans = (props) => {
|
|
|
28
28
|
]}
|
|
29
29
|
/>
|
|
30
30
|
|
|
31
|
-
<
|
|
31
|
+
<HawaPanelTabs
|
|
32
32
|
location="inPricing"
|
|
33
33
|
handleChange={(e) => {
|
|
34
34
|
setCurrentCurrency(e);
|
|
@@ -3,7 +3,7 @@ import Button from "@mui/material/Button";
|
|
|
3
3
|
import Container from "@mui/material/Container";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const HawaPanelTabs = (props) => {
|
|
7
7
|
const [value, setValue] = useState(props.defaultValue);
|
|
8
8
|
return (
|
|
9
9
|
<Container variant={props.location || "panelTabs"}>
|
|
@@ -29,7 +29,8 @@ export const HawaRadio = (props) => {
|
|
|
29
29
|
</Container>
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
HawaPanelTabs.propTypes = {
|
|
33
34
|
lang: PropTypes.string,
|
|
34
35
|
options: PropTypes.arrayOf(
|
|
35
36
|
PropTypes.shape({
|
|
@@ -4,7 +4,7 @@ import Checkbox from "@mui/material/Checkbox";
|
|
|
4
4
|
import Container from "@mui/material/Container";
|
|
5
5
|
import { HawaTypography } from "./HawaTypography";
|
|
6
6
|
import { HawaTextField } from "./HawaTextField";
|
|
7
|
-
import {
|
|
7
|
+
import { HawaPanelTabs } from "./HawaPanelTabs";
|
|
8
8
|
import { HawaSwitch } from "./HawaSwitch";
|
|
9
9
|
import { HawaColorPicker } from "./HawaColorPicker";
|
|
10
10
|
import { HawaRange } from "./HawaRange";
|
|
@@ -19,7 +19,7 @@ export const HawaSettingsRow = (props) => {
|
|
|
19
19
|
{props.settingsType === "range" && <HawaRange {...props} />}
|
|
20
20
|
{props.settingsType === "color" && <HawaColorPicker {...props} />}
|
|
21
21
|
{props.settingsType === "radio" && (
|
|
22
|
-
<
|
|
22
|
+
<HawaPanelTabs location="inSettings" {...props} />
|
|
23
23
|
)}
|
|
24
24
|
</Container>
|
|
25
25
|
);
|
|
@@ -6,27 +6,26 @@ import { IconButton } from "@mui/material";
|
|
|
6
6
|
import CloseIcon from "@mui/icons-material/Close";
|
|
7
7
|
|
|
8
8
|
export const HawaSnackbar = (props) => {
|
|
9
|
-
|
|
10
|
-
const [position, setPosition] = useState({vertical : "", horizontal : ""});
|
|
9
|
+
const [position, setPosition] = useState({ vertical: "", horizontal: "" });
|
|
11
10
|
|
|
12
11
|
useEffect(() => {
|
|
13
|
-
if(props.position){
|
|
12
|
+
if (props.position) {
|
|
14
13
|
const p = props.position.split("-");
|
|
15
|
-
setPosition({vertical
|
|
14
|
+
setPosition({ vertical: p[0], horizontal: p[1] });
|
|
16
15
|
}
|
|
17
|
-
}, [props.position])
|
|
16
|
+
}, [props.position]);
|
|
18
17
|
|
|
19
18
|
return (
|
|
20
19
|
<Snackbar
|
|
21
20
|
open={props.open}
|
|
22
|
-
autoHideDuration={props.
|
|
21
|
+
autoHideDuration={props.autoHide ? props.duration : null}
|
|
23
22
|
onClose={props.handleClose}
|
|
24
23
|
anchorOrigin={position}
|
|
25
24
|
action={
|
|
26
25
|
<>
|
|
27
26
|
<IconButton
|
|
28
27
|
aria-label="close"
|
|
29
|
-
style={{color: "black"}}
|
|
28
|
+
style={{ color: "black" }}
|
|
30
29
|
sx={{ p: 0.5 }}
|
|
31
30
|
onClick={props.handleClose}
|
|
32
31
|
>
|
|
@@ -35,7 +34,11 @@ export const HawaSnackbar = (props) => {
|
|
|
35
34
|
</>
|
|
36
35
|
}
|
|
37
36
|
>
|
|
38
|
-
<Alert
|
|
37
|
+
<Alert
|
|
38
|
+
icon={false}
|
|
39
|
+
severity={props.severity}
|
|
40
|
+
onClose={props.isClosable ? props.handleClose : null}
|
|
41
|
+
>
|
|
39
42
|
{props.title && <AlertTitle>{props.title}</AlertTitle>}
|
|
40
43
|
{props.text}
|
|
41
44
|
</Alert>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Input,
|
|
3
|
+
makeStyles,
|
|
4
|
+
TextField,
|
|
5
|
+
InputLabel,
|
|
6
|
+
Typography,
|
|
7
|
+
Stack
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { object } from "prop-types";
|
|
10
|
+
import React, { useEffect, useState } from "react";
|
|
11
|
+
import { replaceAt } from "../util";
|
|
12
|
+
|
|
13
|
+
export const HawaPinInput = ({
|
|
14
|
+
children,
|
|
15
|
+
type,
|
|
16
|
+
defaultValue,
|
|
17
|
+
onChange,
|
|
18
|
+
onComplete,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
const [value, setValue] = useState(
|
|
22
|
+
defaultValue ? defaultValue.split("") : []
|
|
23
|
+
);
|
|
24
|
+
const [pinLength, setPinLength] = useState(0);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
let length = 0;
|
|
28
|
+
React.Children.map(children, (child) => {
|
|
29
|
+
if (
|
|
30
|
+
React.isValidElement(child) &&
|
|
31
|
+
child.type?.displayName &&
|
|
32
|
+
child.type?.displayName === "HawaPinInputField"
|
|
33
|
+
) {
|
|
34
|
+
length++;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
setPinLength(length);
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
const childrenWithProps = React.Children.map(children, (child, index) => {
|
|
41
|
+
if (React.isValidElement(child)) {
|
|
42
|
+
if (
|
|
43
|
+
child.type?.displayName &&
|
|
44
|
+
child.type?.displayName === "HawaPinInputField" &&
|
|
45
|
+
defaultValue &&
|
|
46
|
+
defaultValue[index]
|
|
47
|
+
) {
|
|
48
|
+
return React.cloneElement(child, {
|
|
49
|
+
type,
|
|
50
|
+
defaultValue: defaultValue[index],
|
|
51
|
+
index: index,
|
|
52
|
+
setValue: setValue,
|
|
53
|
+
value: value,
|
|
54
|
+
onChangeAction: (currentValue) => onChange(currentValue),
|
|
55
|
+
onCompleteAction: (finalValue) => onComplete(finalValue),
|
|
56
|
+
pinLength: pinLength
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return React.cloneElement(child, {
|
|
60
|
+
type,
|
|
61
|
+
setValue: setValue,
|
|
62
|
+
value: value,
|
|
63
|
+
index: index,
|
|
64
|
+
onChangeAction: (currentValue) => onChange(currentValue),
|
|
65
|
+
onCompleteAction: (finalValue) => onComplete(finalValue),
|
|
66
|
+
pinLength: pinLength
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return child;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (value.length === pinLength) {
|
|
74
|
+
onComplete(value);
|
|
75
|
+
}
|
|
76
|
+
}, [value]);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div style={props.inForm && { width: "100%" }}>
|
|
80
|
+
<div style={{ width: props.fullWidth ? "100%" : "fit-content" }}>
|
|
81
|
+
<div
|
|
82
|
+
style={{
|
|
83
|
+
display: "flex",
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
justifyContent: "space-between",
|
|
86
|
+
alignItems: "center"
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{props.label && <InputLabel>{props.label}</InputLabel>}
|
|
90
|
+
{props.helperText && (
|
|
91
|
+
<Typography
|
|
92
|
+
style={{ marginBottom: !props.label && 10 }}
|
|
93
|
+
variant="validation"
|
|
94
|
+
>
|
|
95
|
+
{props.helperText}
|
|
96
|
+
</Typography>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
<Stack
|
|
100
|
+
direction={"row"}
|
|
101
|
+
spacing={2}
|
|
102
|
+
justifyContent="center"
|
|
103
|
+
alignItems={"center"}
|
|
104
|
+
>
|
|
105
|
+
{childrenWithProps}
|
|
106
|
+
</Stack>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const HawaPinInputField = (props) => {
|
|
113
|
+
return (
|
|
114
|
+
<Input
|
|
115
|
+
type={props.type && props.type == "alphanumeric" ? "text" : "number"}
|
|
116
|
+
id={"pinInput" + props.index}
|
|
117
|
+
defaultValue={props.defaultValue || ""}
|
|
118
|
+
variant="pin"
|
|
119
|
+
disableUnderline
|
|
120
|
+
inputProps={{ maxLength: 1 }}
|
|
121
|
+
onChange={(e) => {
|
|
122
|
+
let newValue = props.value;
|
|
123
|
+
newValue[props.index] = e.target.value;
|
|
124
|
+
props.setValue(newValue);
|
|
125
|
+
props.onChangeAction(newValue.toString().replaceAll(",", ""));
|
|
126
|
+
if (
|
|
127
|
+
parseInt(e.target.attributes["maxlength"].value) >= 1 &&
|
|
128
|
+
e.target.value != ""
|
|
129
|
+
) {
|
|
130
|
+
let i = document.getElementById("pinInput" + (props.index + 1));
|
|
131
|
+
if (i) {
|
|
132
|
+
i.focus();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (props.value.length === props.pinLength) {
|
|
136
|
+
props.onCompleteAction(props.value.toString().replaceAll(",", ""));
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
};
|
package/src/elements/index.js
CHANGED
|
@@ -2,7 +2,8 @@ export * from "./AdaptiveButton";
|
|
|
2
2
|
export * from "./ActionButton";
|
|
3
3
|
export * from "./HawaSnackbar";
|
|
4
4
|
export * from "./HawaCheckbox";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./HawaPanelTabs";
|
|
6
|
+
export * from "./HawaChip";
|
|
6
7
|
export * from "./HawaItemCard";
|
|
7
8
|
export * from "./HawaPricingCard";
|
|
8
9
|
export * from "./HawaSettingsRow";
|
|
@@ -11,7 +12,6 @@ export * from "./HawaButton";
|
|
|
11
12
|
export * from "./HawaSelect";
|
|
12
13
|
export * from "./HawaRange";
|
|
13
14
|
export * from "./HawaTextField";
|
|
14
|
-
export * from "./HawaTextArea";
|
|
15
15
|
export * from "./HawaInputLabel";
|
|
16
16
|
export * from "./HawaTypography";
|
|
17
17
|
export * from "./HawaAlert";
|
package/src/index.js
CHANGED
package/src/layout/HawaAppBar.js
CHANGED
|
@@ -22,7 +22,6 @@ export const HawaAppBar = (props) => {
|
|
|
22
22
|
const handleCloseNavMenu = () => setAnchorElNav(null);
|
|
23
23
|
const handleCloseUserMenu = () => setAnchorElUser(null);
|
|
24
24
|
|
|
25
|
-
console.log("theme is ", theme);
|
|
26
25
|
return (
|
|
27
26
|
<AppBar position="static" variant="appbar">
|
|
28
27
|
<Container variant="appbar">
|
package/src/styles.css
CHANGED