@sikka/hawa 0.0.182 → 0.0.183

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.182",
3
+ "version": "0.0.183",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -37,11 +37,20 @@ type SignInFormTypes = {
37
37
  }
38
38
  withoutResetPassword?: boolean
39
39
  withoutSignUp?: boolean
40
+ /**
41
+ *show spinner if true
42
+ */
40
43
  isLoading?: any
41
44
  viaGoogle?: boolean
42
45
  viaGithub?: boolean
43
46
  viaTwitter?: boolean
47
+ /**
48
+ * Handle the sign in .
49
+ */
44
50
  handleSignIn?: (e: any) => void
51
+ /**
52
+ * Handle routing to sign up page
53
+ */
45
54
  handleRouteToSignUp?: () => void
46
55
  handleForgotPassword?: () => void
47
56
  handleGoogleSignIn?: () => void
@@ -4,7 +4,8 @@ import useDiscloser from "../hooks/useDiscloser"
4
4
  import { HawaMenu } from "../elements"
5
5
  import { HiMenu } from "react-icons/hi"
6
6
  import useBreakpoint from "../hooks/useBreakpoint"
7
- import { FaChevronLeft, FaChevronRight } from "react-icons/fa"
7
+ import { FaChevronRight } from "react-icons/fa"
8
+
8
9
  type HawaAppLayoutTypes = {
9
10
  drawerItems: {
10
11
  label: string
@@ -25,6 +26,7 @@ type HawaAppLayoutTypes = {
25
26
  email?: string
26
27
  profileMenuItems?: MenuItems[][]
27
28
  }
29
+
28
30
  type MenuItems = {
29
31
  icon?: JSX.Element
30
32
  label: string
@@ -34,7 +36,6 @@ type MenuItems = {
34
36
  ) => void
35
37
  isButton?: boolean
36
38
  }
37
-
38
39
  export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
39
40
  direction = "rtl",
40
41
  ...props
@@ -43,7 +44,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
43
44
  const [openSubItem, setOpenSubitem] = useState("")
44
45
  const { isOpen, onClose, onOpen } = useDiscloser(false)
45
46
  const ref = useRef(null)
46
-
47
+ const isRTL = direction === "rtl"
47
48
  let size
48
49
  if (typeof window !== "undefined") {
49
50
  size = useBreakpoint()
@@ -54,8 +55,6 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
54
55
  useEffect(() => {
55
56
  const handleClickOutside = (event) => {
56
57
  if (ref.current && !ref.current.contains(event.target) && !keepOpen) {
57
- // onClickOutside && onClickOutside()
58
-
59
58
  setOpenSideMenu(false)
60
59
  }
61
60
  }
@@ -65,54 +64,42 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
65
64
  }
66
65
  }, [keepOpen])
67
66
 
68
- //States of the side menu
69
- //larger than 600
70
- //as a bar and expands when hover
71
- //less than 600
72
- //as nothing and expands as button is clicked
73
- let ltrDrawerStyle = [
74
- " fixed top-0 left-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-layoutPrimary-500 transition-all",
75
- // size > 600 ? "w-14 hover:w-40" : "w-0",
76
- // openSideMenu ? "w-40" : "w-14",
77
- ]
78
- let rtlDrawerStyle = [
79
- "fixed top-0 right-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-layoutPrimary-500 transition-all",
80
- // size > 600 ? "w-14 hover:w-40" : "w-0",
81
- // openSideMenu ? "w-40" : "w-14",
82
- ]
67
+ let drawerDefaultStyle =
68
+ "fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-layoutPrimary-500 transition-all"
69
+ let ltrDrawerStyle = "left-0"
70
+ let rtlDrawerStyle = "right-0"
83
71
 
84
72
  let ltrChildrenStyle = [
85
73
  "fixed overflow-y-auto",
86
74
  size > 600 ? "left-14 w-[calc(100%-3.5rem)]" : "left-0 ",
87
75
  props.topBar ? "top-14 h-[calc(100%-3.5rem)]" : "top-0 h-full",
88
76
  keepOpen ? "left-40 w-[calc(100%-10rem)]" : "",
89
- keepOpen && size > 600 ? "left-0 w-[calc(100%-10.01rem)]" : "",
77
+ keepOpen && size > 600 ? "left-0 w-[calc(100%-10.01rem)]" : "w-full",
90
78
  ]
91
79
  let rtlChildrenStyle = [
92
80
  "fixed overflow-y-auto",
93
81
  size > 600 ? "right-14 w-[calc(100%-3.5rem)]" : "right-0 ",
94
82
  props.topBar ? "top-14 h-[calc(100%-3.5rem)]" : "top-0 h-full",
95
83
  keepOpen ? "right-40 w-[calc(100%-10rem)]" : "",
96
- keepOpen && size > 600 ? "right-0 w-[calc(100%-10.01rem)]" : "",
84
+ keepOpen && size > 600 ? "right-0 w-[calc(100%-10.01rem)]" : "w-full",
97
85
  ]
98
86
  return (
99
87
  <div className="fixed left-0 h-full">
88
+ {/* Top Bar Component */}
100
89
  {props.topBar && (
101
90
  <div
102
91
  className={clsx(
103
- "fixed top-0 z-30 flex h-14 flex-row items-center justify-between bg-layoutPrimary-500",
104
- // size > 600 ? "w-[calc(100%-3rem)] translate-x-[3rem]" : "w-full",
105
- "w-full",
106
- "p-2",
107
- direction === "rtl" ? "flex-row-reverse" : ""
108
- // "pr-5"
92
+ "fixed top-0 z-30 flex h-14 w-full flex-row items-center justify-between bg-layoutPrimary-500 p-2",
93
+ isRTL ? "flex-row-reverse" : ""
109
94
  )}
110
95
  >
96
+ {/* Nav Side Of Navbar */}
111
97
  {size > 600 ? (
112
98
  props.pageTitle ? (
99
+ // Title of the page
113
100
  <div
114
101
  className={clsx(
115
- direction === "rtl"
102
+ isRTL
116
103
  ? [size > 600 ? "mr-14" : "mr-2", keepOpen ? "mr-40" : ""]
117
104
  : [size > 600 ? "ml-14" : "ml-2", keepOpen ? "ml-40" : ""]
118
105
  )}
@@ -121,29 +108,36 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
121
108
  </div>
122
109
  ) : null
123
110
  ) : (
124
- <div className="flex items-center justify-center">
111
+ // Mobile Drawer Menu Button
112
+ <div
113
+ dir={direction}
114
+ className="flex items-center justify-center gap-2 "
115
+ >
125
116
  <div
126
117
  onClick={() => setOpenSideMenu(true)}
127
118
  className=" mr-2 cursor-pointer rounded p-2 transition-all hover:bg-gray-100"
128
119
  >
129
120
  <HiMenu size={25} />
130
121
  </div>
122
+ {/* Mobile Page Title */}
131
123
  {props.pageTitle ? <div>{props.pageTitle}</div> : <div></div>}
132
124
  </div>
133
125
  )}
134
126
 
135
127
  <div className="flex flex-row gap-2" dir={direction}>
128
+ {/* User Info */}
136
129
  <div
137
130
  className={clsx(
138
- "text-xs",
139
- direction === "rtl" ? "text-left" : "text-right"
131
+ isRTL ? "text-left text-xs" : "text-right text-xs"
140
132
  )}
141
133
  >
142
134
  <div className="font-bold">{props.username}</div>{" "}
143
135
  <div>{props.email}</div>
144
136
  </div>
137
+
138
+ {/* Profile Icon & Menu */}
145
139
  <HawaMenu
146
- buttonPosition={direction === "rtl" ? "top-left" : "top-right"}
140
+ buttonPosition={isRTL ? "top-left" : "top-right"}
147
141
  menuItems={props.profileMenuItems}
148
142
  handleClose={onClose}
149
143
  handleOpen={onOpen}
@@ -167,63 +161,70 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
167
161
  </div>
168
162
  </div>
169
163
  )}
164
+
165
+ {/* Drawer Container */}
170
166
  <div
171
167
  onMouseEnter={() => {
172
168
  setOpenSideMenu(true)
173
169
  }}
174
- onMouseLeave={() => {
175
- if (keepOpen) {
176
- setOpenSideMenu(true)
177
- } else {
178
- setOpenSideMenu(false)
179
- }
180
- }}
170
+ onMouseLeave={() =>
171
+ keepOpen ? setOpenSideMenu(true) : setOpenSideMenu(false)
172
+ }
181
173
  ref={ref}
182
- className={clsx(direction === "rtl" ? rtlDrawerStyle : ltrDrawerStyle)}
174
+ className={clsx(
175
+ drawerDefaultStyle,
176
+ isRTL ? rtlDrawerStyle : ltrDrawerStyle
177
+ )}
183
178
  style={{
184
- // 160px
185
- width: size > 600 ? (openSideMenu ? "160px" : "56px") : "0px",
186
- // openSideMenu ? "56px" : "w-14",
187
- // size > 600 ? "w-14 hover:w-40" : "w-0",
188
- // openSideMenu ? "w-40" : "w-14",
179
+ // width:"160px",
180
+ width:
181
+ size > 600
182
+ ? openSideMenu
183
+ ? "160px"
184
+ : "56px"
185
+ : openSideMenu
186
+ ? "160px"
187
+ : "0px",
189
188
  }}
190
189
  >
190
+ {/* Drawer Content Container */}
191
191
  <div
192
192
  className={clsx(
193
193
  props.topBar ? "" : "mt-2",
194
194
  openSideMenu ? "overflow-auto" : "overflow-hidden"
195
195
  )}
196
196
  >
197
+ {/* Logo Container */}
197
198
  <div
198
199
  className={clsx(
199
200
  "fixed z-50 mb-2 flex h-14 items-center justify-center bg-layoutPrimary-500 p-2 transition-all",
200
201
  openSideMenu ? "w-40" : "w-14"
201
202
  )}
202
203
  >
204
+ {/* Full Logo */}
203
205
  <img
204
206
  className={clsx(
205
207
  "fixed top-2.5 h-9 transition-all",
206
- direction === "rtl" ? "right-2.5" : "left-2.5",
208
+ isRTL ? "right-2.5" : "left-2.5",
207
209
  !openSideMenu ? "invisible opacity-0" : "visible opacity-100"
208
210
  )}
209
211
  src={props.logoLink}
210
- // src={"https://beta-my.qawaim.app/_next/image?url=%2Fqawaim-logo.svg&w=256&q=75"}
211
212
  />
212
213
 
214
+ {/* Logo Symbol */}
213
215
  {size > 600 ? (
214
216
  <img
215
217
  className={clsx(
216
218
  // " bg-green-500",
217
219
  "fixed top-2.5 h-9 transition-all",
218
- direction === "rtl" ? "right-2.5" : "left-2.5",
220
+ isRTL ? "right-2.5" : "left-2.5",
219
221
  openSideMenu ? "invisible opacity-0" : "visible opacity-100"
220
222
  )}
221
223
  src={props.logoSymbol}
222
- // src="https://beta-admin.qawaim.app/_next/image?url=%2Fqawaim-symbol.svg&w=128&q=75"
223
224
  />
224
225
  ) : null}
225
226
  </div>
226
-
227
+ {/* Drawer Items */}
227
228
  <div className="mt-14 mb-8">
228
229
  {props.drawerItems.map((dSection, j) => (
229
230
  <div
@@ -246,7 +247,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
246
247
  ? "bg-buttonPrimary-500 text-white"
247
248
  : "hover:bg-layoutPrimary-300",
248
249
  "m-2 my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
249
- direction === "rtl" ? "flex-row-reverse pr-3" : ""
250
+ isRTL ? "flex-row-reverse pr-3" : ""
250
251
  )}
251
252
  >
252
253
  <div className="flex flex-row" dir={direction}>
@@ -284,7 +285,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
284
285
  openSubItem == dItem.slug && openSideMenu
285
286
  ? ""
286
287
  : "my-0 py-0",
287
- direction === "rtl" ? "text-right" : "text-left"
288
+ isRTL ? "text-right" : "text-left"
288
289
  )}
289
290
  style={{
290
291
  height:
@@ -297,7 +298,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
297
298
  <div
298
299
  className={clsx(
299
300
  "flex flex-row gap-2 overflow-x-clip rounded p-2 px-4 text-xs hover:bg-layoutPrimary-500",
300
- direction === "rtl" ? "text-right" : "text-left"
301
+ isRTL ? "text-right" : "text-left"
301
302
  )}
302
303
  dir={direction}
303
304
  onClick={() => subIt.action()}
@@ -322,14 +323,14 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
322
323
  ))}
323
324
  </div>
324
325
  </div>
326
+
327
+ {/* Expand Button */}
325
328
  {openSideMenu && size > 600 ? (
326
329
  <div
327
330
  dir={direction}
328
331
  className={clsx(
329
332
  "fixed top-4 z-50 flex w-fit items-center",
330
- direction === "rtl"
331
- ? "right-32 justify-start"
332
- : "left-32 justify-start",
333
+ isRTL ? "right-32 justify-start" : "left-32 justify-start",
333
334
  "transition-all duration-700",
334
335
  openSideMenu && size > 600 ? " opacity-100" : " opacity-0"
335
336
  )}
@@ -340,38 +341,25 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
340
341
  "w-fit cursor-pointer rounded bg-gray-300 p-1 transition-all"
341
342
  }
342
343
  >
343
- {/* {keepOpen ? ( */}
344
344
  <FaChevronRight
345
345
  fontSize={11}
346
346
  className={clsx(
347
- direction === "rtl"
347
+ isRTL
348
348
  ? keepOpen
349
349
  ? "rotate-0"
350
350
  : "rotate-180"
351
351
  : keepOpen
352
352
  ? "rotate-180"
353
353
  : "rotate-0"
354
- // keepOpen ? "rotate-180" : ""
355
354
  )}
356
355
  />
357
- {/* // ) : (
358
- // <FaChevronLeft
359
- // fontSize={11}
360
- // className={clsx(
361
- // direction === "rtl" ? "rotate-0" : "rotate-180"
362
- // )}
363
- // />
364
- // )} */}
365
356
  </div>
366
357
  </div>
367
358
  ) : null}
368
359
  </div>
369
360
 
370
- <div
371
- className={clsx(
372
- direction === "rtl" ? rtlChildrenStyle : ltrChildrenStyle
373
- )}
374
- >
361
+ {/* Children Container */}
362
+ <div className={clsx(isRTL ? rtlChildrenStyle : ltrChildrenStyle)}>
375
363
  {props.children}
376
364
  </div>
377
365
  </div>
package/src/styles.css CHANGED
@@ -689,6 +689,9 @@ video {
689
689
  .m-1 {
690
690
  margin: 0.25rem;
691
691
  }
692
+ .m-4 {
693
+ margin: 1rem;
694
+ }
692
695
  .mx-2 {
693
696
  margin-left: 0.5rem;
694
697
  margin-right: 0.5rem;
@@ -970,9 +973,6 @@ video {
970
973
  .w-2\/3 {
971
974
  width: 66.666667%;
972
975
  }
973
- .w-40 {
974
- width: 10rem;
975
- }
976
976
  .w-\[calc\(100\%-3\.5rem\)\] {
977
977
  width: calc(100% - 3.5rem);
978
978
  }
@@ -982,8 +982,8 @@ video {
982
982
  .w-\[calc\(100\%-10\.01rem\)\] {
983
983
  width: calc(100% - 10.01rem);
984
984
  }
985
- .w-\[calc\(100\%-3rem\)\] {
986
- width: calc(100% - 3rem);
985
+ .w-40 {
986
+ width: 10rem;
987
987
  }
988
988
  .w-10\/12 {
989
989
  width: 83.333333%;
@@ -1049,10 +1049,6 @@ video {
1049
1049
  --tw-translate-x: 100px;
1050
1050
  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));
1051
1051
  }
1052
- .translate-x-\[3rem\] {
1053
- --tw-translate-x: 3rem;
1054
- 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));
1055
- }
1056
1052
  .rotate-180 {
1057
1053
  --tw-rotate: 180deg;
1058
1054
  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));
@@ -1518,9 +1514,9 @@ video {
1518
1514
  .bg-buttonPrimary-300 {
1519
1515
  background-color: var(--button-primary-300);
1520
1516
  }
1521
- .bg-blue-400 {
1517
+ .bg-blue-50 {
1522
1518
  --tw-bg-opacity: 1;
1523
- background-color: rgb(96 165 250 / var(--tw-bg-opacity));
1519
+ background-color: rgb(239 246 255 / var(--tw-bg-opacity));
1524
1520
  }
1525
1521
  .bg-opacity-75 {
1526
1522
  --tw-bg-opacity: 0.75;
@@ -1646,9 +1642,6 @@ video {
1646
1642
  .pl-10 {
1647
1643
  padding-left: 2.5rem;
1648
1644
  }
1649
- .pr-5 {
1650
- padding-right: 1.25rem;
1651
- }
1652
1645
  .pl-3 {
1653
1646
  padding-left: 0.75rem;
1654
1647
  }
@@ -1723,6 +1716,9 @@ video {
1723
1716
  .uppercase {
1724
1717
  text-transform: uppercase;
1725
1718
  }
1719
+ .capitalize {
1720
+ text-transform: capitalize;
1721
+ }
1726
1722
  .leading-4 {
1727
1723
  line-height: 1rem;
1728
1724
  }