@sikka/hawa 0.0.185 → 0.0.186

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.185",
3
+ "version": "0.0.186",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -49,6 +49,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
49
49
  handleClose()
50
50
  }
51
51
  }
52
+ console.log("ref is", ref.current?.getBoundingClientRect())
52
53
  document.addEventListener("click", handleClickOutside, true)
53
54
  return () => {
54
55
  document.removeEventListener("click", handleClickOutside, true)
@@ -63,8 +64,8 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
63
64
  "bottom-left": "bottom-12 left-0",
64
65
  }
65
66
  let animationStyles = {
66
- opened: "max-h-fit",
67
- closed: "h-0 ",
67
+ opened: "max-h-fit h-max visible opacity-100 block",
68
+ closed: "h-0 invisible opacity-0 hidden",
68
69
  }
69
70
  return (
70
71
  <div
@@ -48,7 +48,7 @@ export const HawaPhoneInput: React.FunctionComponent<HawaPhoneInputTypes> = (
48
48
  {props.label}
49
49
  </label>
50
50
  )}
51
- <div className="flex flex-row">
51
+ <div dir="ltr" className="flex flex-row">
52
52
  <Select
53
53
  styles={{
54
54
  input: (base) => ({
@@ -1,8 +1,6 @@
1
1
  import clsx from "clsx"
2
2
  import React, { useState } from "react"
3
3
 
4
- // TODO: add option to increase space between tabs and content
5
- // TODO: make the blued border rounded
6
4
  type TabsTypes = {
7
5
  options?: any
8
6
  onChangeTab?: any
@@ -5,8 +5,9 @@ import { HawaMenu } from "../elements"
5
5
  import { HiMenu } from "react-icons/hi"
6
6
  import useBreakpoint from "../hooks/useBreakpoint"
7
7
  import { FaChevronRight } from "react-icons/fa"
8
- // TODO: add ability to control the width of the drawer
9
8
  // TODO: when no navbar, the drawer can't be opened
9
+ // TODO: when no pagetitle, navbar gets messy
10
+ // TODO: the user menu avatar clickable area is exceeding the topbar
10
11
  type HawaAppLayoutTypes = {
11
12
  drawerItems: {
12
13
  label: string
@@ -46,6 +47,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
46
47
  const [openSideMenu, setOpenSideMenu] = useState(true)
47
48
  const [openSubItem, setOpenSubitem] = useState("")
48
49
  const { isOpen, onClose, onOpen } = useDiscloser(false)
50
+ const [keepOpen, setKeepOpen] = useState(true)
49
51
  const ref = useRef(null)
50
52
  const isRTL = direction === "rtl"
51
53
  let size
@@ -54,7 +56,6 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
54
56
  } else {
55
57
  size = 1200
56
58
  }
57
- const [keepOpen, setKeepOpen] = useState(false)
58
59
  useEffect(() => {
59
60
  const handleClickOutside = (event) => {
60
61
  if (ref.current && !ref.current.contains(event.target) && !keepOpen) {
@@ -165,7 +166,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
165
166
  handleOpen={onOpen}
166
167
  open={isOpen}
167
168
  >
168
- <div className="relative h-8 w-8 cursor-pointer overflow-hidden rounded-full bg-gray-100 dark:bg-gray-600">
169
+ <div className="relative h-8 w-8 cursor-pointer overflow-hidden rounded-full dark:bg-gray-600">
169
170
  <svg
170
171
  className="absolute -left-1 h-10 w-10 text-gray-400"
171
172
  fill="currentColor"
@@ -338,12 +339,19 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
338
339
  onClick={() => {
339
340
  dItem.subItems
340
341
  ? openSubItem === dItem.slug
341
- ? setOpenSubitem("")
342
+ ? // ||
343
+ // dItem.subItems.find(
344
+ // (e) => e.slug === props.currentPage
345
+ // )
346
+ setOpenSubitem("")
342
347
  : setOpenSubitem(dItem.slug)
343
348
  : dItem.action()
344
349
  }}
345
350
  className={clsx(
346
- props.currentPage === dItem.slug
351
+ props.currentPage === dItem.slug ||
352
+ dItem.subItems?.find(
353
+ (e) => e.slug === props.currentPage
354
+ )
347
355
  ? "bg-buttonPrimary-500 text-white"
348
356
  : "hover:bg-layoutPrimary-300",
349
357
  "m-2 my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
@@ -367,7 +375,11 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
367
375
  <div
368
376
  className={clsx(
369
377
  openSubItem && dItem.slug === openSubItem
370
- ? "-rotate-90"
378
+ ? // ||
379
+ // dItem.subItems.find(
380
+ // (e) => e.slug === props.currentPage
381
+ // )
382
+ "-rotate-90"
371
383
  : "rotate-90"
372
384
  )}
373
385
  >
@@ -382,6 +394,9 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
382
394
  "flex flex-col gap-0 whitespace-nowrap bg-layoutPrimary-300",
383
395
  "m-1 cursor-pointer rounded p-1",
384
396
  "overflow-clip transition-all",
397
+ // dItem.subItems.find(
398
+ // (e) => e.slug === props.currentPage
399
+ // ) ||
385
400
  openSubItem == dItem.slug && openSideMenu
386
401
  ? ""
387
402
  : "my-0 py-0",
@@ -389,6 +404,9 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
389
404
  )}
390
405
  style={{
391
406
  height:
407
+ // dItem.subItems.find(
408
+ // (e) => e.slug === props.currentPage
409
+ // ) ||
392
410
  openSubItem == dItem.slug && openSideMenu
393
411
  ? 6 + 33 * dItem.subItems?.length
394
412
  : 0,
@@ -397,11 +415,17 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
397
415
  {dItem.subItems?.map((subIt) => (
398
416
  <div
399
417
  className={clsx(
400
- "flex flex-row gap-2 overflow-x-clip rounded p-2 px-4 text-xs hover:bg-layoutPrimary-500",
401
- isRTL ? "text-right" : "text-left"
418
+ "flex flex-row gap-2 overflow-x-clip rounded p-2 px-2 text-xs",
419
+ isRTL ? "text-right" : "text-left",
420
+ props.currentPage === subIt.slug
421
+ ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
422
+ : "hover:bg-layoutPrimary-500"
402
423
  )}
403
424
  dir={direction}
404
- onClick={() => subIt.action()}
425
+ onClick={() => {
426
+ subIt.action()
427
+ // setOpenSubitem(dItem.slug)
428
+ }}
405
429
  >
406
430
  <div className="flex items-center justify-center">
407
431
  {subIt.icon}
@@ -12,7 +12,7 @@ export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
12
12
  maxWidth = "normal",
13
13
  variant = "contained",
14
14
  centered = false,
15
- direction = "rtl",
15
+ direction = "ltr",
16
16
  ...props
17
17
  }) => {
18
18
  let defaultStyle = "flex w-full flex-col rounded p-4"
package/src/styles.css CHANGED
@@ -851,6 +851,10 @@ video {
851
851
  .h-11 {
852
852
  height: 2.75rem;
853
853
  }
854
+ .h-max {
855
+ height: -moz-max-content;
856
+ height: max-content;
857
+ }
854
858
  .h-0 {
855
859
  height: 0px;
856
860
  }