@sikka/hawa 0.0.83 → 0.0.84

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
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
@@ -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
+ };
@@ -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
  };