@sikka/hawa 0.0.77 → 0.0.79

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.77",
3
+ "version": "0.0.79",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -74,15 +74,17 @@ export const SignInForm = (props) => {
74
74
  {props.texts.forgotPasswordText}
75
75
  </div>
76
76
  <HawaButton fullWidth type="submit" text={props.texts.signInText} />{" "}
77
- <div className="font-semibold p-3 text-center text-sm">
78
- {props.texts.newUserText}{" "}
79
- <span
80
- onClick={props.handleRouteToSignUp}
81
- className="text-blue-600 cursor-pointer"
82
- >
83
- {props.texts.signUpText}
84
- </span>
85
- </div>
77
+ {!props.withoutSignUp && (
78
+ <div className="font-semibold p-3 text-center text-sm">
79
+ {props.texts.newUserText}{" "}
80
+ <span
81
+ onClick={props.handleRouteToSignUp}
82
+ className="text-blue-600 cursor-pointer"
83
+ >
84
+ {props.texts.signUpText}
85
+ </span>
86
+ </div>
87
+ )}
86
88
  </form>
87
89
  {/* <Divider /> */}
88
90
  {/* <div className="divide-y divide-gray-900"></div> */}
@@ -141,5 +143,8 @@ SignInForm.propTypes = {
141
143
  handleRouteToSignUp: PropTypes.func,
142
144
  handleGoogleSignIn: PropTypes.func,
143
145
  handleGithubSignIn: PropTypes.func,
144
- handleTwitterSignIn: PropTypes.func
146
+ handleTwitterSignIn: PropTypes.func,
147
+ handleForgotPassword: PropTypes.func,
148
+
149
+ withoutSignUp: PropTypes.bool
145
150
  };
@@ -31,6 +31,7 @@ export const SignInPhone = (props) => {
31
31
  />
32
32
  )}
33
33
  />
34
+ <div className="mt-2"></div>
34
35
  <HawaButton fullWidth type="submit" text={props.SignInButtonText} />
35
36
  </form>
36
37
  </HawaContainer>
@@ -1,24 +1,62 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import { HawaTooltip } from "./HawaTooltip";
3
+ import PropTypes from "prop-types";
3
4
 
4
- export const HawaButton = (props) => {
5
+ export const HawaButton = ({
6
+ tooltip,
7
+ icon,
8
+ iconOnly,
9
+ text,
10
+ isLoading = false,
11
+ loadingText,
12
+ onClick,
13
+ ...props
14
+ }) => {
15
+ const [loading, setLoading] = useState(isLoading);
5
16
  let iconStyle = "pr-2 flex flex-col justify-center items-center";
6
- let styles =
7
- "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";
17
+ let styles = `${
18
+ isLoading ? "cursor-not-allowed" : "cursor-pointer"
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`;
8
20
  if (props.fullWidth) {
9
21
  styles =
10
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";
11
23
  }
12
- if (props.iconOnly) {
24
+ if (iconOnly) {
13
25
  iconStyle = "flex flex-col justify-center items-center";
14
26
  }
15
27
  return (
16
- <button data-tooltip-target={props.tooltip} type="button" className={styles} {...props}>
17
- {props.tooltip && (
18
- <HawaTooltip tooltipID={props.tooltip} content={props.tooltip} />
28
+ <button
29
+ data-tooltip-target={tooltip}
30
+ type="button"
31
+ className={styles}
32
+ onClick={() => console.log("clicking")}
33
+ disabled={isLoading}
34
+ {...props}
35
+ >
36
+ {!isLoading ? (
37
+ <>
38
+ {tooltip ? (
39
+ <HawaTooltip tooltipID={tooltip} content={tooltip} />
40
+ ) : null}
41
+ {icon ? <div className={iconStyle}>{icon}</div> : null}
42
+ {!iconOnly && text}
43
+ </>
44
+ ) : (
45
+ <div className="flex flex-row gap-x-3">
46
+ <div className="border-2 border-gray-400 border-t-white animate-spin text-white rounded-full h-5 w-5"></div>
47
+ <div>{loadingText}</div>
48
+ </div>
19
49
  )}
20
- {props.icon ? <div className={iconStyle}>{props.icon}</div> : null}
21
- {!props.iconOnly && props.text}
22
50
  </button>
23
51
  );
24
52
  };
53
+
54
+ HawaButton.PropTypes = {
55
+ tooltip: PropTypes.string,
56
+ icon: PropTypes.element,
57
+ iconOnly: PropTypes.bool,
58
+ text: PropTypes.string,
59
+ isLoading: PropTypes.bool,
60
+ loadingText: PropTypes.string,
61
+ onClick : PropTypes.func
62
+ };
@@ -1,16 +1,43 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import PropTypes from "prop-types";
3
+ import { useState } from "react";
4
+
5
+ export const HawaItemCard = ({
6
+ actions,
7
+ content,
8
+ headerActions,
9
+ header,
10
+ ...props
11
+ }) => {
12
+ const [openActionHeader, setOpenActionHeader] = useState(false);
13
+
14
+ function handleOpenActionHeader() {
15
+ setOpenActionHeader(!openActionHeader);
16
+ }
17
+
18
+ useEffect(() => {
19
+ window.onclick = () => {
20
+ console.log("clicking, state = ", openActionHeader);
21
+ if (openActionHeader) {
22
+ setOpenActionHeader(false);
23
+ }
24
+ };
25
+ return () => (window.onClick = null);
26
+ }, [openActionHeader]);
3
27
 
4
- export const HawaItemCard = (props) => {
5
28
  return (
6
- <div className="block pt-6 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700 ">
7
- {props.headerActions && (
8
- <div className="flex justify-end pr-6">
29
+ <div
30
+ className="block pt-6 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700 "
31
+ {...props}
32
+ >
33
+ {headerActions && (
34
+ <div className="relative flex justify-end pr-6">
9
35
  <button
10
36
  id="dropdownButton"
11
37
  data-dropdown-toggle="dropdown"
12
38
  className="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm"
13
39
  type="button"
40
+ onClick={handleOpenActionHeader}
14
41
  >
15
42
  <span className="sr-only">Open dropdown</span>
16
43
  <svg
@@ -25,17 +52,19 @@ export const HawaItemCard = (props) => {
25
52
  </button>
26
53
  <div
27
54
  id="dropdown"
28
- className="hidden z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700"
55
+ className={`absolute ${
56
+ openActionHeader ? "block" : "hidden"
57
+ } right-0 top-7 z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700`}
29
58
  >
30
59
  <ul className="py-1" aria-labelledby="dropdownButton">
31
- {props.headerActions.map((action) => {
60
+ {headerActions.map(({ label, action }) => {
32
61
  return (
33
- <li>
62
+ <li onClick={action}>
34
63
  <a
35
64
  href="#"
36
65
  className="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
37
66
  >
38
- {action.label}
67
+ {label}
39
68
  </a>
40
69
  </li>
41
70
  );
@@ -46,19 +75,24 @@ export const HawaItemCard = (props) => {
46
75
  )}
47
76
  <div className="px-6">
48
77
  <h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
49
- {props.header}{" "}
78
+ {header}{" "}
50
79
  </h5>
51
80
  <p className="font-normal text-gray-700 dark:text-gray-400">
52
- {props.content}
81
+ {content}
53
82
  </p>
54
83
  </div>
55
- <div className="p-3 mt-6 rounded-b-lg flex justify-end">
56
- {props.actions}
57
- </div>
84
+ <div className="p-3 mt-6 rounded-b-lg flex justify-end">{actions}</div>
58
85
  </div>
59
86
  );
60
87
  };
61
88
  HawaItemCard.propTypes = {
62
89
  lang: PropTypes.string,
90
+ actions: PropTypes.element,
91
+ content: PropTypes.element,
92
+ headerActions: PropTypes.arrayOf({
93
+ label: PropTypes.string,
94
+ action: PropTypes.func
95
+ }),
96
+ header: PropTypes.element,
63
97
  onCardClick: PropTypes.func
64
98
  };
@@ -85,9 +85,7 @@ export default function HawaPhoneInput({ preferredCountry }) {
85
85
  setSelectedCountry(newValue);
86
86
  }}
87
87
  />
88
- <div>
89
- <input className="bg-gray-50 border rounded-l-none border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 border-l-0" />
90
- </div>
88
+ <input className="bg-gray-50 border rounded-l-none border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 border-l-0" />
91
89
  </div>
92
90
  );
93
91
  }
package/src/styles.css CHANGED
@@ -575,12 +575,15 @@ video {
575
575
  .left-0 {
576
576
  left: 0px;
577
577
  }
578
- .top-0 {
579
- top: 0px;
580
- }
581
578
  .right-0 {
582
579
  right: 0px;
583
580
  }
581
+ .top-7 {
582
+ top: 1.75rem;
583
+ }
584
+ .top-0 {
585
+ top: 0px;
586
+ }
584
587
  .bottom-4 {
585
588
  bottom: 1rem;
586
589
  }
@@ -820,6 +823,25 @@ video {
820
823
  .transform {
821
824
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
822
825
  }
826
+ @-webkit-keyframes spin {
827
+
828
+ to {
829
+ transform: rotate(360deg);
830
+ }
831
+ }
832
+ @keyframes spin {
833
+
834
+ to {
835
+ transform: rotate(360deg);
836
+ }
837
+ }
838
+ .animate-spin {
839
+ -webkit-animation: spin 1s linear infinite;
840
+ animation: spin 1s linear infinite;
841
+ }
842
+ .cursor-not-allowed {
843
+ cursor: not-allowed;
844
+ }
823
845
  .cursor-pointer {
824
846
  cursor: pointer;
825
847
  }
@@ -864,6 +886,10 @@ video {
864
886
  .justify-between {
865
887
  justify-content: space-between;
866
888
  }
889
+ .gap-x-3 {
890
+ -moz-column-gap: 0.75rem;
891
+ column-gap: 0.75rem;
892
+ }
867
893
  .gap-x-16 {
868
894
  -moz-column-gap: 4rem;
869
895
  column-gap: 4rem;
@@ -936,12 +962,12 @@ video {
936
962
  .rounded-xl {
937
963
  border-radius: 0.75rem;
938
964
  }
939
- .rounded {
940
- border-radius: 0.25rem;
941
- }
942
965
  .rounded-full {
943
966
  border-radius: 9999px;
944
967
  }
968
+ .rounded {
969
+ border-radius: 0.25rem;
970
+ }
945
971
  .rounded-t-xl {
946
972
  border-top-left-radius: 0.75rem;
947
973
  border-top-right-radius: 0.75rem;
@@ -973,6 +999,9 @@ video {
973
999
  .border {
974
1000
  border-width: 1px;
975
1001
  }
1002
+ .border-2 {
1003
+ border-width: 2px;
1004
+ }
976
1005
  .border-b-0 {
977
1006
  border-bottom-width: 0px;
978
1007
  }
@@ -1002,6 +1031,10 @@ video {
1002
1031
  --tw-border-opacity: 1;
1003
1032
  border-color: rgb(229 231 235 / var(--tw-border-opacity));
1004
1033
  }
1034
+ .border-gray-400 {
1035
+ --tw-border-opacity: 1;
1036
+ border-color: rgb(156 163 175 / var(--tw-border-opacity));
1037
+ }
1005
1038
  .border-gray-300 {
1006
1039
  --tw-border-opacity: 1;
1007
1040
  border-color: rgb(209 213 219 / var(--tw-border-opacity));
@@ -1010,6 +1043,10 @@ video {
1010
1043
  --tw-border-opacity: 1;
1011
1044
  border-color: rgb(37 99 235 / var(--tw-border-opacity));
1012
1045
  }
1046
+ .border-t-white {
1047
+ --tw-border-opacity: 1;
1048
+ border-top-color: rgb(255 255 255 / var(--tw-border-opacity));
1049
+ }
1013
1050
  .bg-gray-900 {
1014
1051
  --tw-bg-opacity: 1;
1015
1052
  background-color: rgb(17 24 39 / var(--tw-bg-opacity));
@@ -361,4 +361,4 @@
361
361
 
362
362
 
363
363
 
364
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.49eed76e.iframe.bundle.js"></script><script src="vendors~main.a425b282.iframe.bundle.js"></script><script src="main.07232270.iframe.bundle.js"></script></body></html>
364
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.49eed76e.iframe.bundle.js"></script><script src="vendors~main.a425b282.iframe.bundle.js"></script><script src="main.2539e901.iframe.bundle.js"></script></body></html>