@sikka/hawa 0.0.76 → 0.0.78

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 (54) hide show
  1. package/.github/workflows/hawa-publish-push.yml +1 -0
  2. package/.github/workflows/hawa-publish.yml +1 -0
  3. package/dist/styles.css +1803 -0
  4. package/es/index.es.js +1 -1
  5. package/lib/index.js +1 -1
  6. package/package.json +2 -2
  7. package/src/elements/HawaButton.js +48 -10
  8. package/src/elements/HawaItemCard.js +48 -14
  9. package/src/styles.css +43 -6
  10. package/storybook-static/0.1104ca18.iframe.bundle.js +3 -0
  11. package/storybook-static/{0.60b9c65419c3ce80ab72.manager.bundle.js.LICENSE.txt → 0.1104ca18.iframe.bundle.js.LICENSE.txt} +0 -0
  12. package/storybook-static/0.1104ca18.iframe.bundle.js.map +1 -0
  13. package/storybook-static/{0.60b9c65419c3ce80ab72.manager.bundle.js → 0.cf71f8aa82edef0a7186.manager.bundle.js} +2 -2
  14. package/storybook-static/{0.e2b91f98.iframe.bundle.js.LICENSE.txt → 0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt} +0 -0
  15. package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +1 -0
  16. package/storybook-static/{1.e2210f7b.iframe.bundle.js → 1.e3eafd38.iframe.bundle.js} +0 -0
  17. package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +2 -0
  18. package/storybook-static/{5.c1ea708e0305a3f2690d.manager.bundle.js.LICENSE.txt → 5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt} +0 -0
  19. package/storybook-static/{6.fadd6632.iframe.bundle.js → 6.6023eba1.iframe.bundle.js} +2 -2
  20. package/storybook-static/{6.fadd6632.iframe.bundle.js.LICENSE.txt → 6.6023eba1.iframe.bundle.js.LICENSE.txt} +0 -0
  21. package/storybook-static/6.6023eba1.iframe.bundle.js.map +1 -0
  22. package/storybook-static/{6.aa9b5ae07e5f3bc21475.manager.bundle.js → 6.b34ce31193a7fa1dd965.manager.bundle.js} +1 -1
  23. package/storybook-static/{7.12834585.iframe.bundle.js → 7.632f8551.iframe.bundle.js} +0 -0
  24. package/storybook-static/{7.f95843e9a2777ac17dbf.manager.bundle.js → 7.72879af713f755a7aa7e.manager.bundle.js} +1 -1
  25. package/storybook-static/{8.15e99a30b6a9bc116f34.manager.bundle.js → 8.f9b98ef3e089be1a16d6.manager.bundle.js} +2 -2
  26. package/storybook-static/{8.15e99a30b6a9bc116f34.manager.bundle.js.LICENSE.txt → 8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt} +0 -0
  27. package/storybook-static/{9.78e4df0068efee922f9a.manager.bundle.js → 9.1e1335092fade49cc986.manager.bundle.js} +1 -1
  28. package/storybook-static/{9.51450e03.iframe.bundle.js → 9.63a5cf7a.iframe.bundle.js} +2 -2
  29. package/storybook-static/{9.51450e03.iframe.bundle.js.LICENSE.txt → 9.63a5cf7a.iframe.bundle.js.LICENSE.txt} +0 -0
  30. package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +1 -0
  31. package/storybook-static/iframe.html +1 -1
  32. package/storybook-static/index.html +1 -1
  33. package/storybook-static/main.4bd27e4e7faa098302d1.manager.bundle.js +1 -0
  34. package/storybook-static/main.ec5cf911.iframe.bundle.js +1 -0
  35. package/storybook-static/project.json +1 -1
  36. package/storybook-static/{runtime~main.49eed76e.iframe.bundle.js → runtime~main.67ec6e92.iframe.bundle.js} +1 -1
  37. package/storybook-static/{runtime~main.4d99c291be326901006a.manager.bundle.js → runtime~main.a58df7ba92d01c5088d3.manager.bundle.js} +1 -1
  38. package/storybook-static/vendors~main.2c1e652d.iframe.bundle.js +3 -0
  39. package/storybook-static/{vendors~main.a425b282.iframe.bundle.js.LICENSE.txt → vendors~main.2c1e652d.iframe.bundle.js.LICENSE.txt} +0 -0
  40. package/storybook-static/vendors~main.2c1e652d.iframe.bundle.js.map +1 -0
  41. package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +2 -0
  42. package/storybook-static/{vendors~main.86108d25403f3f41d9ea.manager.bundle.js.LICENSE.txt → vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt} +0 -0
  43. package/src/styles.scss +0 -681
  44. package/storybook-static/0.e2b91f98.iframe.bundle.js +0 -3
  45. package/storybook-static/0.e2b91f98.iframe.bundle.js.map +0 -1
  46. package/storybook-static/1.fcf12768b56cacc8bdd8.manager.bundle.js +0 -1
  47. package/storybook-static/5.c1ea708e0305a3f2690d.manager.bundle.js +0 -2
  48. package/storybook-static/6.fadd6632.iframe.bundle.js.map +0 -1
  49. package/storybook-static/9.51450e03.iframe.bundle.js.map +0 -1
  50. package/storybook-static/main.07232270.iframe.bundle.js +0 -1
  51. package/storybook-static/main.3b67cd32d74b4c684f1b.manager.bundle.js +0 -1
  52. package/storybook-static/vendors~main.86108d25403f3f41d9ea.manager.bundle.js +0 -2
  53. package/storybook-static/vendors~main.a425b282.iframe.bundle.js +0 -3
  54. 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.76",
3
+ "version": "0.0.78",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -9,7 +9,7 @@
9
9
  "start": "start-storybook -p 6006 -s public",
10
10
  "storybook": "start-storybook -p 6006 -s public",
11
11
  "build-storybook": "build-storybook",
12
- "generate-css": "postcss src/tailwind.css -o src/styles.css",
12
+ "generate-css": "postcss src/tailwind.css -o src/styles.css && mkdir -p dist && cp src/styles.css dist/",
13
13
  "deploy-storybook": "storybook-to-ghpages",
14
14
  "build-lib": "rollup -c",
15
15
  "build:styles": " node tools/build-styles"
@@ -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
  };
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));