@sikka/hawa 0.0.83 → 0.0.85

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 (62) hide show
  1. package/dist/styles.css +214 -232
  2. package/es/index.es.js +1 -1
  3. package/lib/index.js +1 -1
  4. package/package.json +1 -1
  5. package/src/blocks/AuthForms/AppLanding.js +62 -0
  6. package/src/blocks/AuthForms/SignInForm.js +3 -3
  7. package/src/elements/Copyrights.js +0 -0
  8. package/src/elements/HawaAccordian.js +4 -2
  9. package/src/elements/HawaButton.js +1 -1
  10. package/src/elements/HawaMenu.js +59 -0
  11. package/src/elements/HawaModal.js +55 -4
  12. package/src/elements/HawaRange.js +23 -9
  13. package/src/elements/HawaSnackbar.js +1 -0
  14. package/src/elements/index.js +1 -0
  15. package/src/layout/HawaContainer.js +3 -7
  16. package/src/styles.css +214 -232
  17. package/storybook-static/0.1104ca18.iframe.bundle.js +3 -0
  18. package/storybook-static/{0.60b9c65419c3ce80ab72.manager.bundle.js.LICENSE.txt → 0.1104ca18.iframe.bundle.js.LICENSE.txt} +0 -0
  19. package/storybook-static/0.1104ca18.iframe.bundle.js.map +1 -0
  20. package/storybook-static/{0.60b9c65419c3ce80ab72.manager.bundle.js → 0.cf71f8aa82edef0a7186.manager.bundle.js} +2 -2
  21. package/storybook-static/{0.e2b91f98.iframe.bundle.js.LICENSE.txt → 0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt} +0 -0
  22. package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +1 -0
  23. package/storybook-static/{1.e2210f7b.iframe.bundle.js → 1.e3eafd38.iframe.bundle.js} +0 -0
  24. package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +2 -0
  25. package/storybook-static/{5.c1ea708e0305a3f2690d.manager.bundle.js.LICENSE.txt → 5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt} +0 -0
  26. package/storybook-static/{6.fadd6632.iframe.bundle.js → 6.6023eba1.iframe.bundle.js} +2 -2
  27. package/storybook-static/{6.fadd6632.iframe.bundle.js.LICENSE.txt → 6.6023eba1.iframe.bundle.js.LICENSE.txt} +0 -0
  28. package/storybook-static/6.6023eba1.iframe.bundle.js.map +1 -0
  29. package/storybook-static/{6.aa9b5ae07e5f3bc21475.manager.bundle.js → 6.b34ce31193a7fa1dd965.manager.bundle.js} +1 -1
  30. package/storybook-static/{7.12834585.iframe.bundle.js → 7.632f8551.iframe.bundle.js} +0 -0
  31. package/storybook-static/{7.f95843e9a2777ac17dbf.manager.bundle.js → 7.72879af713f755a7aa7e.manager.bundle.js} +1 -1
  32. package/storybook-static/{8.15e99a30b6a9bc116f34.manager.bundle.js → 8.f9b98ef3e089be1a16d6.manager.bundle.js} +2 -2
  33. package/storybook-static/{8.15e99a30b6a9bc116f34.manager.bundle.js.LICENSE.txt → 8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt} +0 -0
  34. package/storybook-static/{9.78e4df0068efee922f9a.manager.bundle.js → 9.1e1335092fade49cc986.manager.bundle.js} +1 -1
  35. package/storybook-static/{9.51450e03.iframe.bundle.js → 9.63a5cf7a.iframe.bundle.js} +2 -2
  36. package/storybook-static/{9.51450e03.iframe.bundle.js.LICENSE.txt → 9.63a5cf7a.iframe.bundle.js.LICENSE.txt} +0 -0
  37. package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +1 -0
  38. package/storybook-static/iframe.html +1 -1
  39. package/storybook-static/index.html +1 -1
  40. package/storybook-static/main.4bd27e4e7faa098302d1.manager.bundle.js +1 -0
  41. package/storybook-static/main.c9ced472.iframe.bundle.js +1 -0
  42. package/storybook-static/project.json +1 -1
  43. package/storybook-static/{runtime~main.49eed76e.iframe.bundle.js → runtime~main.67ec6e92.iframe.bundle.js} +1 -1
  44. package/storybook-static/{runtime~main.4d99c291be326901006a.manager.bundle.js → runtime~main.a58df7ba92d01c5088d3.manager.bundle.js} +1 -1
  45. package/storybook-static/vendors~main.30019f92.iframe.bundle.js +3 -0
  46. package/storybook-static/{vendors~main.a425b282.iframe.bundle.js.LICENSE.txt → vendors~main.30019f92.iframe.bundle.js.LICENSE.txt} +0 -0
  47. package/storybook-static/vendors~main.30019f92.iframe.bundle.js.map +1 -0
  48. package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +2 -0
  49. package/storybook-static/{vendors~main.86108d25403f3f41d9ea.manager.bundle.js.LICENSE.txt → vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt} +0 -0
  50. package/tailwind.config.js +15 -2
  51. package/src/elements/HawaPopMenu.js +0 -97
  52. package/storybook-static/0.e2b91f98.iframe.bundle.js +0 -3
  53. package/storybook-static/0.e2b91f98.iframe.bundle.js.map +0 -1
  54. package/storybook-static/1.fcf12768b56cacc8bdd8.manager.bundle.js +0 -1
  55. package/storybook-static/5.c1ea708e0305a3f2690d.manager.bundle.js +0 -2
  56. package/storybook-static/6.fadd6632.iframe.bundle.js.map +0 -1
  57. package/storybook-static/9.51450e03.iframe.bundle.js.map +0 -1
  58. package/storybook-static/main.2539e901.iframe.bundle.js +0 -1
  59. package/storybook-static/main.3b67cd32d74b4c684f1b.manager.bundle.js +0 -1
  60. package/storybook-static/vendors~main.86108d25403f3f41d9ea.manager.bundle.js +0 -2
  61. package/storybook-static/vendors~main.a425b282.iframe.bundle.js +0 -3
  62. package/storybook-static/vendors~main.a425b282.iframe.bundle.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -0,0 +1,62 @@
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ HawaLogoButton,
5
+ HawaAlert,
6
+ HawaButton
7
+ } from "../../elements";
8
+ import { Controller, useForm } from "react-hook-form";
9
+ import PropTypes from "prop-types";
10
+ import { HawaContainer } from "../../layout/HawaContainer";
11
+
12
+ export const AppLanding = (props) => {
13
+ const methods = useForm();
14
+ const {
15
+ formState: { errors },
16
+ handleSubmit,
17
+ control
18
+ } = methods;
19
+
20
+ return (
21
+ <HawaContainer>
22
+ <HawaButton fullWidth text={"Sign In"} />
23
+ <HawaButton fullWidth text={"Sign Up"} />
24
+ <HawaButton fullWidth text={"عربي"} />
25
+ </HawaContainer>
26
+ );
27
+ };
28
+ AppLanding.propTypes = {
29
+ /**
30
+ * An object of all the texts in the blocks
31
+ */
32
+ texts: PropTypes.shape({
33
+ emailLabel: PropTypes.string,
34
+ emailPlaceholder: PropTypes.string,
35
+ emailRequiredText: PropTypes.string,
36
+ emailInvalidText: PropTypes.string,
37
+ usernameLabel: PropTypes.string,
38
+ usernamePlaceholder: PropTypes.string,
39
+ usernameRequired: PropTypes.string,
40
+ passwordLabel: PropTypes.string,
41
+ passwordPlaceholder: PropTypes.string,
42
+ passwordRequiredText: PropTypes.string,
43
+ forgotPasswordText: PropTypes.string,
44
+ newUserText: PropTypes.string,
45
+ signUpText: PropTypes.string,
46
+ signInText: PropTypes.string,
47
+ googleButtonLabel: PropTypes.string,
48
+ githubButtonLabel: PropTypes.string,
49
+ twitterButtonLabel: PropTypes.string
50
+ }),
51
+ viaGoogle: PropTypes.bool,
52
+ viaGithub: PropTypes.bool,
53
+ viaTwitter: PropTypes.bool,
54
+ handleSignIn: PropTypes.func,
55
+ handleRouteToSignUp: PropTypes.func,
56
+ handleGoogleSignIn: PropTypes.func,
57
+ handleGithubSignIn: PropTypes.func,
58
+ handleTwitterSignIn: PropTypes.func,
59
+ handleForgotPassword: PropTypes.func,
60
+
61
+ withoutSignUp: PropTypes.bool
62
+ };
@@ -90,7 +90,7 @@ export const SignInForm = (props) => {
90
90
  />
91
91
  {!props.withoutResetPassword && (
92
92
  <div
93
- className="text-xs cursor-pointer w-fit mb-3"
93
+ className="dark:text-gray-300 text-xs cursor-pointer w-fit mb-3"
94
94
  onClick={props.handleForgotPassword}
95
95
  >
96
96
  {props.texts.forgotPasswordText}
@@ -98,11 +98,11 @@ export const SignInForm = (props) => {
98
98
  )}
99
99
  <HawaButton fullWidth type="submit" text={props.texts.signInText} />{" "}
100
100
  {!props.withoutSignUp && (
101
- <div className="font-semibold p-3 text-center text-sm">
101
+ <div className="dark:text-gray-300 font-semibold p-3 text-center text-sm">
102
102
  {props.texts.newUserText}{" "}
103
103
  <span
104
104
  onClick={props.handleRouteToSignUp}
105
- className="text-blue-600 cursor-pointer"
105
+ className="dark:text-blue-400 text-blue-600 cursor-pointer"
106
106
  >
107
107
  {props.texts.signUpText}
108
108
  </span>
File without changes
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
4
  const AccordionItem = (props) => {
5
+ const [collapse, setCollapse] = React.useState(false);
5
6
  let noRounding =
6
7
  "flex items-center justify-between w-full p-5 font-medium text-left border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white";
7
8
  let roundedTop =
@@ -23,6 +24,7 @@ const AccordionItem = (props) => {
23
24
  // ? roundedBottom
24
25
  // : noRounding
25
26
  }
27
+ onClick={() => setCollapse(!collapse)}
26
28
  data-accordion-target={"#accordion-collapse-body-" + props.count}
27
29
  aria-expanded="true"
28
30
  aria-controls={"accordion-collapse-body-" + props.count}
@@ -30,7 +32,7 @@ const AccordionItem = (props) => {
30
32
  <span>What is Flowbite?</span>
31
33
  <svg
32
34
  data-accordion-icon=""
33
- className="w-6 h-6 rotate-180 shrink-0"
35
+ className={`w-6 h-6 ${collapse ? "" : "rotate-180"} shrink-0`}
34
36
  fill="currentColor"
35
37
  viewBox="0 0 20 20"
36
38
  xmlns="http://www.w3.org/2000/svg"
@@ -45,7 +47,7 @@ const AccordionItem = (props) => {
45
47
  </h2>
46
48
  <div
47
49
  id={"accordion-collapse-body-" + props.count}
48
- className=""
50
+ className={`${collapse ? "hidden" : "block"}`}
49
51
  aria-labelledby={"accordion-collapse-heading-" + props.count}
50
52
  >
51
53
  <div className={props.count === -1 ? accPaperRounded : accPaper}>
@@ -19,7 +19,7 @@ export const HawaButton = ({
19
19
  } m-1 px-2.5 py-2.5 text-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800`;
20
20
  if (props.fullWidth) {
21
21
  styles =
22
- "my-1 w-full flex justify-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800";
22
+ "my-1 w-full flex justify-center text-white bg-primary-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800";
23
23
  }
24
24
  if (iconOnly) {
25
25
  iconStyle = "flex flex-col justify-center items-center";
@@ -0,0 +1,59 @@
1
+ import PropTypes from "prop-types";
2
+
3
+ export const HawaMenu = ({
4
+ popMenuID,
5
+ menuItems,
6
+ withHeader,
7
+ withIcons,
8
+ headerTitle,
9
+ headerSubtitle
10
+ }) => {
11
+ return (
12
+ <div
13
+ id={popMenuID}
14
+ className="z-10 w-44 bg-white rounded-lg divide-y divide-gray-100 shadow dark:bg-gray-700"
15
+ >
16
+ {withHeader && (
17
+ <div class="py-3 px-4 text-sm text-gray-900 dark:text-white">
18
+ <div>{headerTitle}</div>
19
+ <div class="font-medium truncate">{headerSubtitle}</div>
20
+ </div>
21
+ )}
22
+ {menuItems.map((group) => {
23
+ return (
24
+ <ul className="py-1 text-sm text-gray-700 dark:text-gray-200">
25
+ {group.map((item) => {
26
+ return (
27
+ <li
28
+ onClick={item.action}
29
+ className={
30
+ item.button
31
+ ? "bg-primary-500 text-white hover:bg-primary-600 flex flex-row rtl:flex-row-reverse items-center cursor-pointer py-2 px-4 rounded-lg mx-1 hover:bg-gray-100 dark:hover:bg-primary-600 dark:hover:text-white"
32
+ : "flex flex-row rtl:flex-row-reverse items-center cursor-pointer py-2 px-4 rounded-lg mx-1 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
33
+ }
34
+ >
35
+ {withIcons && (
36
+ <div className="mr-2 rtl:ml-2">{item.icon}</div>
37
+ )}
38
+ {item.label}
39
+ </li>
40
+ );
41
+ })}
42
+ </ul>
43
+ );
44
+ })}
45
+ </div>
46
+ );
47
+ };
48
+
49
+ HawaMenu.propTypes = {
50
+ anchor: PropTypes.any,
51
+ handleClose: PropTypes.func,
52
+ menuItems: PropTypes.arrayOf(
53
+ PropTypes.shape({
54
+ icon: PropTypes.element,
55
+ label: PropTypes.string,
56
+ action: PropTypes.func
57
+ })
58
+ )
59
+ };
@@ -1,23 +1,48 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
 
3
- export const HawaModal = (props) => {
3
+ export const HawaModal = ({
4
+ open,
5
+ title,
6
+ onClose,
7
+ closeOnClickOutside,
8
+ ...props
9
+ }) => {
10
+ console.log("open : ", open);
11
+
12
+ useEffect(() => {
13
+ if (closeOnClickOutside) {
14
+ window.onclick = () => {
15
+ console.log("open : ", open);
16
+ if (open) {
17
+ console.log("Im clicing");
18
+ onClose();
19
+ }
20
+ };
21
+ }
22
+ return () => (window.onClick = null);
23
+ }, [open]);
4
24
  return (
5
25
  <div
6
26
  id={props.modalID}
7
27
  tabindex="-1"
8
28
  aria-hidden="true"
9
- className="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full justify-center items-center"
29
+ className={`${
30
+ open ? "block" : "hidden"
31
+ } overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full justify-center items-center`}
10
32
  >
11
33
  <div className="relative p-4 w-full max-w-2xl h-full md:h-auto">
12
34
  <div className="relative bg-white rounded-lg shadow dark:bg-gray-700">
13
35
  <div className="flex justify-between items-start p-4 rounded-t border-b dark:border-gray-600">
14
36
  <h3 className="text-xl font-semibold text-gray-900 dark:text-white">
15
- Terms of Service
37
+ {title}
16
38
  </h3>
17
39
  <button
18
40
  type="button"
19
41
  className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
20
42
  data-modal-toggle="defaultModal"
43
+ onClick={() => {
44
+ onClose();
45
+ }}
21
46
  >
22
47
  <svg
23
48
  aria-hidden="true"
@@ -70,3 +95,29 @@ export const HawaModal = (props) => {
70
95
  </div>
71
96
  );
72
97
  };
98
+
99
+ export const ModalContent = ({ children, ...props }) => {
100
+ return <div className="p-6 space-y-6">{children}</div>;
101
+ };
102
+
103
+ export const ModalFooter = ({ children, ...props }) => {
104
+ return (
105
+ <div className="flex items-center p-6 space-x-2 rounded-b border-t border-gray-200 dark:border-gray-600">
106
+ {/* <button
107
+ data-modal-toggle="defaultModal"
108
+ type="button"
109
+ className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
110
+ >
111
+ I accept
112
+ </button>
113
+ <button
114
+ data-modal-toggle="defaultModal"
115
+ type="button"
116
+ className="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-blue-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"
117
+ >
118
+ Decline
119
+ </button> */}
120
+ {children}
121
+ </div>
122
+ );
123
+ };
@@ -1,27 +1,39 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- export const HawaRange = (props) => {
4
+ export const HawaRange = ({
5
+ value,
6
+ handleChange,
7
+ startElement,
8
+ endElement,
9
+ label,
10
+ ...props
11
+ }) => {
12
+ const [rangeValue, setRangeValue] = React.useState(value);
13
+
5
14
  return (
6
- <div>
7
- {props.label && (
15
+ <div {...props}>
16
+ {label && (
8
17
  <label
9
18
  htmlFor="default-range"
10
19
  className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
11
20
  >
12
- {props.label}
21
+ {label}
13
22
  </label>
14
23
  )}
15
24
  <div className="flex flex-row justify-center items-center w-fit">
16
- <div className="mr-2">{props.startElement}</div>{" "}
25
+ <div className="mr-2">{startElement}</div>{" "}
17
26
  <input
18
27
  id="default-range"
19
28
  type="range"
20
- value={props.value}
21
- onChange={props.handleChange}
29
+ value={rangeValue}
30
+ onChange={(e) => {
31
+ setRangeValue(e.target.value);
32
+ handleChange(e);
33
+ }}
22
34
  className="w-fit h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
23
35
  />
24
- <div className="ml-2">{props.endElement}</div>{" "}
36
+ <div className="ml-2">{endElement}</div>{" "}
25
37
  </div>
26
38
  </div>
27
39
  );
@@ -32,9 +44,11 @@ HawaRange.propTypes = {
32
44
  * Can be an icon
33
45
  */
34
46
  startElement: PropTypes.element,
47
+ value: PropTypes.number,
35
48
  /**
36
49
  * The element at the side where the range value is 100
37
50
  */
38
51
  endElement: PropTypes.element,
39
- handleChange: PropTypes.func
52
+ handleChange: PropTypes.func,
53
+ label : PropTypes.string
40
54
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  export const HawaSnackbar = (props) => {
4
+
4
5
  let severities = {
5
6
  info: "bottom-4 fixed flex items-center p-4 w-full max-w-xs text-blue-700 bg-blue-100 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800",
6
7
  warning:
@@ -24,3 +24,4 @@ export * from "./HawaDrawerItem";
24
24
  export * from "./HawaTooltip";
25
25
  export * from "./HawaTabs";
26
26
  export * from "./HawaModal";
27
+ export * from "./HawaMenu";
@@ -1,12 +1,8 @@
1
1
  import React from "react";
2
2
 
3
3
  export const HawaContainer = (props) => {
4
- let containerStyle = "";
5
- if (props.withDividers) {
6
- containerStyle =
7
- "w-full max-w-sm flex flex-col divide-y divide-gray-300 bg-blue-300 rounded-xl p-4";
8
- } else {
9
- containerStyle = "w-full max-w-sm flex flex-col bg-blue-300 rounded-xl p-4";
10
- }
4
+ let containerStyle =
5
+ "w-full max-w-sm flex flex-col bg-primary-300 dark:bg-gray-600 rounded-xl p-4";
6
+
11
7
  return <div className={containerStyle}>{props.children}</div>;
12
8
  };