@sikka/hawa 0.0.136 → 0.0.137

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.136",
3
+ "version": "0.0.137",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -1,5 +1,5 @@
1
1
  import React, { FC, ReactElement, ReactNode, useEffect, useState } from "react"
2
- import { FaDailymotion } from "react-icons/fa"
2
+ import { FaChevronLeft, FaChevronRight } from "react-icons/fa"
3
3
  import clsx from "clsx"
4
4
 
5
5
  type TDrawerTypes = {
@@ -8,6 +8,9 @@ type TDrawerTypes = {
8
8
  position: any
9
9
  heading: any
10
10
  children?: ReactNode
11
+ drawerHeader?: any
12
+ drawerBody?: any
13
+ drawerFooter?: any
11
14
  }
12
15
 
13
16
  export const HawaDrawer: React.FunctionComponent<TDrawerTypes> = ({
@@ -19,53 +22,31 @@ export const HawaDrawer: React.FunctionComponent<TDrawerTypes> = ({
19
22
  ...props
20
23
  }) => {
21
24
  const leftDrawer =
22
- "w-60 z-50 h-full absolute overflow-x-hidden top-0 left-0 border-r bg-white"
25
+ "w-60 z-50 h-full absolute overflow-x-clip top-0 left-0 border-r bg-white"
23
26
  const rightDrawer =
24
- "w-60 z-50 h-full absolute overflow-x-hidden top-0 right-0 border-l bg-white"
25
-
26
- const isFunction = (data: any): data is (...args: any[]) => any =>
27
- typeof data === "function"
28
- // useEffect(() => {
29
- // setOpenDrawer(true);
30
- // }, [open]);
31
-
32
- const childrenWithProps = React.Children.map(children, (child) => {
33
- if (React.isValidElement(child) && isFunction(child.type)) {
34
- switch (child.type.name) {
35
- case "DrawerHeader":
36
- return (
37
- <DrawerHeader setOpen={setOpen} children={child.props.children} />
38
- )
39
-
40
- case "DrawerBody":
41
- return <DrawerBody children={child.props.children} />
42
-
43
- case "DrawerFooter":
44
- return <DrawerFooter children={child.props.children} />
45
- }
46
- return React.cloneElement(child, {
47
- // setOpen: setOpen,
48
- // children: child.props.children,
49
- })
50
- }
51
- })
52
-
53
- // const drawerClass =
54
- // open && position == "left"
55
- // ? clsx("block", leftDrawer)
56
- // : open && position == "right"
57
- // ? clsx("block", rightDrawer)
58
- // : "hidden w-0 "
27
+ "w-60 z-50 h-full absolute overflow-x-clip top-0 right-0 border-l bg-white"
59
28
 
60
29
  return (
61
30
  <div
62
31
  className={clsx(
63
32
  position == "left" ? leftDrawer : rightDrawer,
64
- "overflow-y-clip transition-all",
33
+ position == "left" ? "flex-row-reverse" : "flex-row",
34
+ "overflow-x-clip transition-all",
65
35
  open ? "w-60" : "w-0"
66
36
  )}
67
37
  >
68
- {childrenWithProps}
38
+ {props.drawerHeader && (
39
+ <DrawerHeader direction={position} setOpen={setOpen}>
40
+ {props.drawerHeader}
41
+ </DrawerHeader>
42
+ )}
43
+
44
+ {props.drawerBody && (
45
+ <DrawerBody direction={position}>{props.drawerBody}</DrawerBody>
46
+ )}
47
+ {props.drawerFooter && (
48
+ <DrawerFooter direction={position}>{props.drawerFooter}</DrawerFooter>
49
+ )}
69
50
  </div>
70
51
  )
71
52
  }
@@ -73,11 +54,17 @@ export const HawaDrawer: React.FunctionComponent<TDrawerTypes> = ({
73
54
  type TDrawerHeader = {
74
55
  setOpen: any
75
56
  children: ReactElement
57
+ direction: any
76
58
  }
77
59
 
78
- export const DrawerHeader: FC<TDrawerHeader> = (props) => {
60
+ const DrawerHeader: FC<TDrawerHeader> = (props) => {
79
61
  return (
80
- <div className=" flex w-full flex-row items-center justify-between border-b py-4 px-1">
62
+ <div
63
+ className={clsx(
64
+ "flex w-full flex-row items-center justify-between border-b p-4",
65
+ props.direction == "left" ? "flex-row" : "flex-row-reverse"
66
+ )}
67
+ >
81
68
  {props.children}
82
69
  <div
83
70
  className="justify-self-end rounded border p-1 hover:cursor-pointer"
@@ -86,7 +73,11 @@ export const DrawerHeader: FC<TDrawerHeader> = (props) => {
86
73
  props.setOpen(false)
87
74
  }}
88
75
  >
89
- <FaDailymotion size={20} strokeWidth={2} />
76
+ {props.direction == "left" ? (
77
+ <FaChevronLeft size={20} strokeWidth={2} />
78
+ ) : (
79
+ <FaChevronRight size={20} strokeWidth={2} />
80
+ )}
90
81
  </div>
91
82
  </div>
92
83
  )
@@ -94,50 +85,35 @@ export const DrawerHeader: FC<TDrawerHeader> = (props) => {
94
85
 
95
86
  type TDrawerBody = {
96
87
  children: ReactElement
88
+ direction: any
97
89
  }
98
-
99
- export const DrawerBody = (props: TDrawerBody) => {
100
- return <div className="p-1">{props.children}</div>
101
- }
102
-
103
- type TDrawerFooter = {
104
- children: ReactElement
105
- }
106
-
107
- export const DrawerFooter = (props: TDrawerFooter) => {
90
+ const DrawerBody = (props: TDrawerBody) => {
108
91
  return (
109
- <div className="absolute bottom-0 w-full border-t py-4 px-1">
92
+ <div
93
+ className={clsx(
94
+ "overflow-clip whitespace-nowrap p-4",
95
+ props.direction == "left" ? "flex-row" : "flex-row-reverse text-right"
96
+ )}
97
+ >
110
98
  {props.children}
111
99
  </div>
112
100
  )
113
101
  }
114
102
 
115
- type DrawerItemTypes = {
116
- action: any
117
- icon?: any
118
- text: any
103
+ type TDrawerFooter = {
104
+ children: ReactElement
105
+ direction: any
119
106
  }
120
- const HawaDrawerItem: React.FunctionComponent<DrawerItemTypes> = (props) => {
121
- let withIcon =
122
- "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700"
123
- let withoutIcon =
124
- "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700"
125
107
 
108
+ const DrawerFooter = (props: TDrawerFooter) => {
126
109
  return (
127
- <li onClick={props.action}>
128
- <div className={props.icon ? withIcon : withoutIcon}>
129
- {/* <svg
130
- aria-hidden="true"
131
- className="w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
132
- fill="currentColor"
133
- viewBox="0 0 20 20"
134
- xmlns="http://www.w3.org/2000/svg"
135
- >
136
- <path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path>
137
- <path d="M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"></path>
138
- </svg> */}
139
- <span className="ml-3">{props.text}</span>
140
- </div>
141
- </li>
110
+ <div
111
+ className={clsx(
112
+ "absolute bottom-0 w-full whitespace-nowrap border-t p-4",
113
+ props.direction == "left" ? "flex-row" : "flex-row-reverse text-right"
114
+ )}
115
+ >
116
+ {props.children}
117
+ </div>
142
118
  )
143
119
  }
package/src/styles.css CHANGED
@@ -643,9 +643,6 @@ video {
643
643
  .mt-1 {
644
644
  margin-top: 0.25rem;
645
645
  }
646
- .ml-3 {
647
- margin-left: 0.75rem;
648
- }
649
646
  .mr-2 {
650
647
  margin-right: 0.5rem;
651
648
  }
@@ -679,6 +676,9 @@ video {
679
676
  .mt-5 {
680
677
  margin-top: 1.25rem;
681
678
  }
679
+ .ml-3 {
680
+ margin-left: 0.75rem;
681
+ }
682
682
  .mr-1\.5 {
683
683
  margin-right: 0.375rem;
684
684
  }
@@ -1059,6 +1059,9 @@ video {
1059
1059
  .overflow-hidden {
1060
1060
  overflow: hidden;
1061
1061
  }
1062
+ .overflow-clip {
1063
+ overflow: clip;
1064
+ }
1062
1065
  .overflow-scroll {
1063
1066
  overflow: scroll;
1064
1067
  }
@@ -1068,9 +1071,6 @@ video {
1068
1071
  .overflow-y-auto {
1069
1072
  overflow-y: auto;
1070
1073
  }
1071
- .overflow-x-hidden {
1072
- overflow-x: hidden;
1073
- }
1074
1074
  .overflow-x-clip {
1075
1075
  overflow-x: clip;
1076
1076
  }
@@ -1466,14 +1466,6 @@ video {
1466
1466
  padding-top: 0.625rem;
1467
1467
  padding-bottom: 0.625rem;
1468
1468
  }
1469
- .py-4 {
1470
- padding-top: 1rem;
1471
- padding-bottom: 1rem;
1472
- }
1473
- .px-1 {
1474
- padding-left: 0.25rem;
1475
- padding-right: 0.25rem;
1476
- }
1477
1469
  .px-6 {
1478
1470
  padding-left: 1.5rem;
1479
1471
  padding-right: 1.5rem;
@@ -1482,6 +1474,10 @@ video {
1482
1474
  padding-top: 0.75rem;
1483
1475
  padding-bottom: 0.75rem;
1484
1476
  }
1477
+ .py-4 {
1478
+ padding-top: 1rem;
1479
+ padding-bottom: 1rem;
1480
+ }
1485
1481
  .py-5 {
1486
1482
  padding-top: 1.25rem;
1487
1483
  padding-bottom: 1.25rem;
@@ -1519,6 +1515,9 @@ video {
1519
1515
  .text-center {
1520
1516
  text-align: center;
1521
1517
  }
1518
+ .text-right {
1519
+ text-align: right;
1520
+ }
1522
1521
  .align-middle {
1523
1522
  vertical-align: middle;
1524
1523
  }
@@ -1536,10 +1535,6 @@ video {
1536
1535
  .text-\[10px\] {
1537
1536
  font-size: 10px;
1538
1537
  }
1539
- .text-base {
1540
- font-size: 1rem;
1541
- line-height: 1.5rem;
1542
- }
1543
1538
  .text-2xl {
1544
1539
  font-size: 1.5rem;
1545
1540
  line-height: 2rem;
@@ -1748,9 +1743,6 @@ video {
1748
1743
  .duration-300 {
1749
1744
  transition-duration: 300ms;
1750
1745
  }
1751
- .duration-75 {
1752
- transition-duration: 75ms;
1753
- }
1754
1746
  @import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;700&display=swap");
1755
1747
 
1756
1748
  body {
@@ -1938,10 +1930,6 @@ body {
1938
1930
  --tw-ring-opacity: 1;
1939
1931
  --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
1940
1932
  }
1941
- .group:hover .group-hover\:text-gray-900 {
1942
- --tw-text-opacity: 1;
1943
- color: rgb(17 24 39 / var(--tw-text-opacity));
1944
- }
1945
1933
  .peer:checked ~ .peer-checked\:bg-blue-600 {
1946
1934
  --tw-bg-opacity: 1;
1947
1935
  background-color: rgb(37 99 235 / var(--tw-bg-opacity));
@@ -2146,10 +2134,6 @@ body {
2146
2134
  --tw-ring-opacity: 1;
2147
2135
  --tw-ring-color: rgb(30 58 138 / var(--tw-ring-opacity));
2148
2136
  }
2149
- .dark .group:hover .dark\:group-hover\:text-white {
2150
- --tw-text-opacity: 1;
2151
- color: rgb(255 255 255 / var(--tw-text-opacity));
2152
- }
2153
2137
  .dark .peer:focus ~ .dark\:peer-focus\:ring-blue-800 {
2154
2138
  --tw-ring-opacity: 1;
2155
2139
  --tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity));