@sikka/hawa 0.0.36 → 0.0.40

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 (79) hide show
  1. package/.github/workflows/hawa-publish-push.yml +3 -1
  2. package/README.md +2 -1
  3. package/es/index.es.js +1 -1
  4. package/lib/index.js +1 -1
  5. package/package.json +5 -3
  6. package/src/Hooks.js +61 -0
  7. package/src/blocks/AuthForms/CodeConfirmation.js +94 -0
  8. package/src/blocks/AuthForms/index.js +1 -0
  9. package/src/blocks/Misc/NotFound.js +47 -0
  10. package/src/blocks/Misc/index.js +1 -0
  11. package/src/blocks/Pricing/PricingPlans.js +3 -3
  12. package/src/elements/HawaChip.js +6 -0
  13. package/src/elements/{HawaRadio.js → HawaPanelTabs.js} +3 -2
  14. package/src/elements/HawaSettingsRow.js +2 -2
  15. package/src/elements/HawaSnackbar.js +11 -8
  16. package/src/elements/PinInput.js +141 -0
  17. package/src/elements/index.js +2 -2
  18. package/src/index.js +2 -0
  19. package/src/layout/HawaAppBar.js +0 -1
  20. package/src/styles.css +4 -0
  21. package/src/styles.scss +3 -1
  22. package/src/theme/HawaTheme.js +927 -0
  23. package/src/theme/index.js +2 -0
  24. package/src/util.js +11 -1
  25. package/storybook-static/0.a2c13f8ca8477800b11f.manager.bundle.js +2 -0
  26. package/storybook-static/{0.0d994c92.iframe.bundle.js.LICENSE.txt → 0.a2c13f8ca8477800b11f.manager.bundle.js.LICENSE.txt} +0 -0
  27. package/storybook-static/0.d94b248f.iframe.bundle.js +3 -0
  28. package/storybook-static/{4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt → 0.d94b248f.iframe.bundle.js.LICENSE.txt} +0 -0
  29. package/storybook-static/0.d94b248f.iframe.bundle.js.map +1 -0
  30. package/storybook-static/1.37f89487.iframe.bundle.js +1 -0
  31. package/storybook-static/1.d522251f2377f7751924.manager.bundle.js +1 -0
  32. package/storybook-static/{2.430bf1e3.iframe.bundle.js → 2.89943a03.iframe.bundle.js} +1 -1
  33. package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js +2 -0
  34. package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js.LICENSE.txt +31 -0
  35. package/storybook-static/6.3a1fb0c3.iframe.bundle.js +3 -0
  36. package/storybook-static/6.3a1fb0c3.iframe.bundle.js.LICENSE.txt +31 -0
  37. package/storybook-static/6.3a1fb0c3.iframe.bundle.js.map +1 -0
  38. package/storybook-static/6.aee6c4935c69d480fc0d.manager.bundle.js +1 -0
  39. package/storybook-static/7.5b8a4de4b5fa42d8de02.manager.bundle.js +1 -0
  40. package/storybook-static/7.f33530b1.iframe.bundle.js +1 -0
  41. package/storybook-static/8.a3dec9c37e8951a17939.manager.bundle.js +2 -0
  42. package/storybook-static/{6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt → 8.a3dec9c37e8951a17939.manager.bundle.js.LICENSE.txt} +0 -0
  43. package/storybook-static/8.b569e86b.iframe.bundle.js +1 -0
  44. package/storybook-static/{8.76c3cbf398692028e834.manager.bundle.js → 9.d04fdaada645cd23cb4b.manager.bundle.js} +1 -1
  45. package/storybook-static/9.f9db5c90.iframe.bundle.js +3 -0
  46. package/storybook-static/{7.9ce807e3.iframe.bundle.js.LICENSE.txt → 9.f9db5c90.iframe.bundle.js.LICENSE.txt} +0 -0
  47. package/storybook-static/9.f9db5c90.iframe.bundle.js.map +1 -0
  48. package/storybook-static/iframe.html +19 -3
  49. package/storybook-static/index.html +2 -2
  50. package/storybook-static/main.066fa5c5.iframe.bundle.js +1 -0
  51. package/storybook-static/main.750dea0e0e515fd26844.manager.bundle.js +1 -0
  52. package/storybook-static/project.json +1 -0
  53. package/storybook-static/runtime~main.1bd817501fb34a0cb56b.manager.bundle.js +1 -0
  54. package/storybook-static/runtime~main.9be73be4.iframe.bundle.js +1 -0
  55. package/storybook-static/vendors~main.40879e99.iframe.bundle.js +76 -0
  56. package/storybook-static/{vendors~main.3cf4a535.iframe.bundle.js.LICENSE.txt → vendors~main.40879e99.iframe.bundle.js.LICENSE.txt} +15 -0
  57. package/storybook-static/vendors~main.40879e99.iframe.bundle.js.map +1 -0
  58. package/storybook-static/vendors~main.ed8bc18573e141ab3b26.manager.bundle.js +2 -0
  59. package/storybook-static/{vendors~main.11281b487bf96f5ff19e.manager.bundle.js.LICENSE.txt → vendors~main.ed8bc18573e141ab3b26.manager.bundle.js.LICENSE.txt} +18 -18
  60. package/src/elements/HawaTextArea.js +0 -26
  61. package/storybook-static/0.0d994c92.iframe.bundle.js +0 -3
  62. package/storybook-static/0.0d994c92.iframe.bundle.js.map +0 -1
  63. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +0 -1
  64. package/storybook-static/1.aabc3f3a.iframe.bundle.js +0 -1
  65. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +0 -2
  66. package/storybook-static/5.63ab4f94d50a3acf080d.manager.bundle.js +0 -1
  67. package/storybook-static/6.13a534cb.iframe.bundle.js +0 -1
  68. package/storybook-static/6.a6d45262f7e98f3f18d3.manager.bundle.js +0 -2
  69. package/storybook-static/7.097710753af9a1c41b80.manager.bundle.js +0 -1
  70. package/storybook-static/7.9ce807e3.iframe.bundle.js +0 -3
  71. package/storybook-static/7.9ce807e3.iframe.bundle.js.map +0 -1
  72. package/storybook-static/8.1bf48ea7.iframe.bundle.js +0 -1
  73. package/storybook-static/main.3f5171ae.iframe.bundle.js +0 -1
  74. package/storybook-static/main.9d5968bcf15d21f5487c.manager.bundle.js +0 -1
  75. package/storybook-static/runtime~main.708d7ac1.iframe.bundle.js +0 -1
  76. package/storybook-static/runtime~main.c8dac23bc753439736f0.manager.bundle.js +0 -1
  77. package/storybook-static/vendors~main.11281b487bf96f5ff19e.manager.bundle.js +0 -2
  78. package/storybook-static/vendors~main.3cf4a535.iframe.bundle.js +0 -76
  79. package/storybook-static/vendors~main.3cf4a535.iframe.bundle.js.map +0 -1
@@ -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, HawaRadio } from "../../elements";
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
- <HawaRadio
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
- <HawaRadio
31
+ <HawaPanelTabs
32
32
  location="inPricing"
33
33
  handleChange={(e) => {
34
34
  setCurrentCurrency(e);
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import Chip from "@mui/material/Chip";
3
+
4
+ export const HawaChip = (props) => {
5
+ return <Chip {...props} />;
6
+ };
@@ -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 HawaRadio = (props) => {
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
- HawaRadio.propTypes = {
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 { HawaRadio } from "./HawaRadio";
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
- <HawaRadio location="inSettings" {...props} />
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 : p[0], horizontal : p[1]});
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.duration ? props.duration : null}
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 icon={false} severity={props.severity} onClose={props.isClosable ? props.handleClose : null}>
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
+ };
@@ -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 "./HawaRadio";
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
@@ -1,3 +1,5 @@
1
1
  export * from "./blocks";
2
2
  export * from "./elements";
3
3
  export * from "./layout";
4
+ export * from "./theme";
5
+ export * from "./Hooks"
@@ -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
@@ -51,3 +51,7 @@
51
51
  border-width: 2px;
52
52
  cursor: pointer;
53
53
  }
54
+ input[type=number]::-webkit-inner-spin-button,
55
+ input[type=number]::-webkit-outer-spin-button {
56
+ -webkit-appearance: none;
57
+ }
package/src/styles.scss CHANGED
@@ -676,4 +676,6 @@
676
676
  transform: translateY(4px) scale(2.3);
677
677
  filter: blur(0.4px);
678
678
  position: relative;
679
- }
679
+ }
680
+
681
+