@sikka/hawa 0.1.17 → 0.1.20

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 (38) hide show
  1. package/README.md +2 -16
  2. package/dist/styles.css +78 -3
  3. package/es/elements/Button.d.ts +1 -1
  4. package/es/elements/HawaRadio.d.ts +1 -0
  5. package/es/elements/InterfaceSettings.d.ts +2 -0
  6. package/es/elements/Popover.d.ts +1 -0
  7. package/es/index.es.js +3 -3
  8. package/es/layout/AppLayout.d.ts +49 -0
  9. package/es/layout/Sidebar.d.ts +36 -0
  10. package/es/layout/Sidebar2.d.ts +20 -0
  11. package/es/layout/index.d.ts +2 -0
  12. package/lib/elements/Button.d.ts +1 -1
  13. package/lib/elements/HawaRadio.d.ts +1 -0
  14. package/lib/elements/InterfaceSettings.d.ts +2 -0
  15. package/lib/elements/Popover.d.ts +1 -0
  16. package/lib/index.js +3 -3
  17. package/lib/layout/AppLayout.d.ts +49 -0
  18. package/lib/layout/Sidebar.d.ts +36 -0
  19. package/lib/layout/Sidebar2.d.ts +20 -0
  20. package/lib/layout/index.d.ts +2 -0
  21. package/package.json +2 -1
  22. package/src/blocks/AuthForms/SignInBlock.tsx +0 -2
  23. package/src/blocks/AuthForms/SignInForm.tsx +1 -1
  24. package/src/elements/Button.tsx +1 -0
  25. package/src/elements/DropdownMenu.tsx +0 -2
  26. package/src/elements/HawaRadio.tsx +8 -2
  27. package/src/elements/InterfaceSettings.tsx +15 -2
  28. package/src/elements/Label.tsx +0 -2
  29. package/src/elements/Popover.tsx +28 -22
  30. package/src/elements/Select.tsx +0 -2
  31. package/src/elements/Tooltip.tsx +1 -106
  32. package/src/layout/AppLayout.tsx +445 -0
  33. package/src/layout/HawaAppLayoutSimplified.tsx +78 -98
  34. package/src/layout/Sidebar.tsx +224 -0
  35. package/src/layout/Sidebar2.tsx +77 -0
  36. package/src/layout/index.ts +3 -0
  37. package/src/styles.css +78 -3
  38. package/tailwind.config.js +20 -1
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ type AppLayoutTypes = {
3
+ /** The pages of the side drawer */
4
+ drawerItems: Item[];
5
+ direction?: "rtl" | "ltr";
6
+ currentPage: string;
7
+ pageTitle?: string;
8
+ logoSymbol?: any;
9
+ logoLink?: string;
10
+ logoText?: any;
11
+ children?: any;
12
+ topBar?: boolean;
13
+ username?: string;
14
+ email?: string;
15
+ drawerSize?: "sm" | "md" | "large";
16
+ profileMenuItems?: ProfileItem[];
17
+ onSettingsClick?: () => void;
18
+ DrawerFooterActions?: any;
19
+ texts?: {
20
+ expandSidebar?: string;
21
+ collapseSidebar?: string;
22
+ };
23
+ };
24
+ type Item = {
25
+ value: string;
26
+ label: string;
27
+ icon?: any;
28
+ subitems?: SubItem[];
29
+ onClick?: () => void;
30
+ };
31
+ type SubItem = {
32
+ value: string;
33
+ label: string;
34
+ icon?: any;
35
+ onClick?: () => void;
36
+ };
37
+ type ProfileSubItem = {
38
+ label: string;
39
+ value: string;
40
+ highlighted?: boolean;
41
+ };
42
+ type ProfileItem = {
43
+ label: string;
44
+ value: string;
45
+ highlighted?: boolean;
46
+ subitems?: ProfileSubItem[];
47
+ };
48
+ export declare const AppLayout: React.FunctionComponent<AppLayoutTypes>;
49
+ export {};
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ type Item = {
3
+ value: string;
4
+ label: string;
5
+ icon?: any;
6
+ subitems?: SubItem[];
7
+ onClick?: () => void;
8
+ };
9
+ type SubItem = {
10
+ value: string;
11
+ label: string;
12
+ icon?: any;
13
+ onClick?: () => void;
14
+ };
15
+ interface SidebarGroupProps {
16
+ title?: string;
17
+ items: Item[];
18
+ collapsed?: any;
19
+ selectedItem?: any;
20
+ isOpen?: boolean;
21
+ onItemClick?: (value: string[]) => void;
22
+ onSubItemClick?: (values: string[]) => void;
23
+ }
24
+ interface SidebarRootProps {
25
+ children: any;
26
+ }
27
+ declare const SidebarRoot: React.FC<SidebarRootProps>;
28
+ declare const SidebarGroup: React.FC<SidebarGroupProps>;
29
+ declare const SidebarItem: React.FC<{
30
+ item: Item;
31
+ isSelected: any;
32
+ onItemClick?: (value: string[]) => void;
33
+ onSubItemClick?: (values: string[]) => void;
34
+ isOpen?: boolean;
35
+ }>;
36
+ export { SidebarRoot, SidebarGroup, SidebarItem };
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ type Item = {
3
+ value: string;
4
+ label: string;
5
+ icon?: any;
6
+ subitems?: Item[];
7
+ };
8
+ interface SidebarGroupProps {
9
+ title: string;
10
+ items: Item[];
11
+ }
12
+ interface SidebarRootProps {
13
+ children: any;
14
+ }
15
+ declare const SidebarRoot: React.FC<SidebarRootProps>;
16
+ declare const SidebarGroup: React.FC<SidebarGroupProps>;
17
+ declare const SidebarItem: React.FC<{
18
+ item: Item;
19
+ }>;
20
+ export { SidebarRoot, SidebarGroup, SidebarItem };
@@ -1,6 +1,7 @@
1
1
  export * from "./Box";
2
2
  export * from "./HawaBottomAppBar";
3
3
  export * from "./HawaSiteLayout";
4
+ export * from "./AppLayout";
4
5
  export * from "./HawaAppLayout";
5
6
  export * from "./HawaAppLayoutSimplified";
6
7
  export * from "./HawaContainer";
@@ -8,3 +9,4 @@ export * from "./HawaGrid";
8
9
  export * from "./AppSidebar";
9
10
  export * from "./Footer";
10
11
  export * from "./Banner";
12
+ export * from "./Sidebar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.1.17",
3
+ "version": "0.1.20",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -105,6 +105,7 @@
105
105
  "@storybook/manager-webpack5/webpack": "^5"
106
106
  },
107
107
  "dependencies": {
108
+ "@radix-ui/react-accordion": "^1.1.2",
108
109
  "@radix-ui/react-dropdown-menu": "^2.0.5",
109
110
  "@radix-ui/react-label": "^2.0.2",
110
111
  "@radix-ui/react-popover": "^1.0.6",
@@ -1,5 +1,3 @@
1
- "use client"
2
-
3
1
  import { Icons } from "../../elements/Icons"
4
2
  import { Button } from "../../elements/Button"
5
3
  import {
@@ -20,7 +20,7 @@ export const SignInForm: FC<SignInFormTypes> = (props) => {
20
20
  } = useForm()
21
21
 
22
22
  return (
23
- <div>
23
+ <div className="flex flex-col gap-4">
24
24
  <Card dir={props.direction}>
25
25
  <CardContent headless>
26
26
  <form onSubmit={handleSubmit((e) => props.handleSignIn(e))}>
@@ -28,6 +28,7 @@ const buttonVariants = cva(
28
28
  lg: "h-11 rounded-md px-8",
29
29
  xl: "h-14 rounded-md px-10",
30
30
  icon: "h-10 w-10",
31
+ smallIcon: "h-7 w-7",
31
32
  },
32
33
  },
33
34
  defaultVariants: {
@@ -1,5 +1,3 @@
1
- "use client"
2
-
3
1
  import * as React from "react"
4
2
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
5
3
 
@@ -11,12 +11,13 @@ type RadioTypes = {
11
11
  sublabel?: any
12
12
  icon?: any
13
13
  }[]
14
-
14
+ width?: "default" | "full"
15
15
  onChangeTab?: any
16
16
  defaultValue?: any
17
17
  }
18
18
  export const HawaRadio: FC<RadioTypes> = ({
19
19
  design = "default",
20
+ width = "default",
20
21
  orientation = "horizontal",
21
22
  ...props
22
23
  }) => {
@@ -29,6 +30,10 @@ export const HawaRadio: FC<RadioTypes> = ({
29
30
  horizontal: "flex flex-row",
30
31
  vertical: "flex flex-col",
31
32
  }
33
+ let widthStyle = {
34
+ default: "max-w-fit",
35
+ full: "w-full",
36
+ }
32
37
  switch (design) {
33
38
  case "tabs":
34
39
  return (
@@ -37,7 +42,8 @@ export const HawaRadio: FC<RadioTypes> = ({
37
42
  props.options?.length > 2
38
43
  ? "flex-wrap xs:max-w-full xs:flex-nowrap"
39
44
  : "",
40
- " max-w-fit whitespace-nowrap rounded border text-center text-sm font-medium select-none",
45
+ "select-none whitespace-nowrap rounded border text-center text-sm font-medium",
46
+ widthStyle[width],
41
47
  orientationStyle[orientation]
42
48
  )}
43
49
  >
@@ -1,18 +1,30 @@
1
1
  import React, { FC, useState } from "react"
2
2
  import { HawaRadio } from "./HawaRadio"
3
+ import { cn } from "../util"
3
4
 
4
5
  type TypographyTypes = {
5
6
  handleLanguage: (e) => void
6
7
  currentLanguage: any
7
8
  handleColorMode: (e) => void
8
9
  currentColorMode: any
10
+ orientation?: "vertical" | "horizontal"
11
+ width?: "default" | "full"
9
12
  }
10
- export const InterfaceSettings: FC<TypographyTypes> = (props) => {
13
+ export const InterfaceSettings: FC<TypographyTypes> = ({
14
+ orientation = "horizontal",
15
+ width = "default",
16
+ ...props
17
+ }) => {
11
18
  const [color, setColor] = useState(props.currentColorMode)
12
19
  const [language, setLanguage] = useState(props.currentLanguage)
20
+ let orientationStyle = {
21
+ horizontal: "flex flex-row justify-between",
22
+ vertical: "flex flex-col items-center gap-2",
23
+ }
13
24
  return (
14
- <div className="mt-6 flex flex-row justify-between">
25
+ <div className={cn(orientationStyle[orientation])}>
15
26
  <HawaRadio
27
+ width={width}
16
28
  defaultValue={language}
17
29
  onChangeTab={(e) => {
18
30
  props.handleLanguage(e)
@@ -25,6 +37,7 @@ export const InterfaceSettings: FC<TypographyTypes> = (props) => {
25
37
  ]}
26
38
  />
27
39
  <HawaRadio
40
+ width={width}
28
41
  defaultValue={color}
29
42
  onChangeTab={(e) => {
30
43
  props.handleColorMode(e)
@@ -1,5 +1,3 @@
1
- "use client"
2
-
3
1
  import * as React from "react"
4
2
  import * as LabelPrimitive from "@radix-ui/react-label"
5
3
  import { cva, type VariantProps } from "class-variance-authority"
@@ -1,16 +1,35 @@
1
- "use client"
2
-
3
1
  import * as React from "react"
4
2
  import * as PopoverPrimitive from "@radix-ui/react-popover"
5
3
 
6
4
  import { cn } from "../util"
7
5
 
6
+ const PopoverContent = React.forwardRef<
7
+ React.ElementRef<typeof PopoverPrimitive.Content>,
8
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
9
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
10
+ <PopoverPrimitive.Portal>
11
+ <PopoverPrimitive.Content
12
+
13
+ ref={ref}
14
+ align={align}
15
+ sideOffset={sideOffset}
16
+ className={cn(
17
+ "z-50 rounded border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:shadow-dark" ,
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ </PopoverPrimitive.Portal>
23
+ ))
24
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
25
+
8
26
  interface PopoverProps {
9
27
  trigger: React.ReactNode
10
28
  children: React.ReactNode
11
29
  className?: string
12
30
  align?: "start" | "center" | "end"
13
31
  sideOffset?: number
32
+ side?: "top" | "right" | "bottom" | "left"
14
33
  }
15
34
 
16
35
  const Popover: React.FC<PopoverProps> = ({
@@ -18,33 +37,20 @@ const Popover: React.FC<PopoverProps> = ({
18
37
  children,
19
38
  className,
20
39
  align = "center",
40
+ side,
21
41
  sideOffset = 4,
22
42
  }) => (
23
43
  <PopoverPrimitive.Root>
24
44
  <PopoverPrimitive.Trigger>{trigger}</PopoverPrimitive.Trigger>
25
- <PopoverContent className={className} align={align} sideOffset={sideOffset}>
45
+ <PopoverContent
46
+ side={side}
47
+ className={className}
48
+ align={align}
49
+ sideOffset={sideOffset}
50
+ >
26
51
  {children}
27
52
  </PopoverContent>
28
53
  </PopoverPrimitive.Root>
29
54
  )
30
55
 
31
- const PopoverContent = React.forwardRef<
32
- React.ElementRef<typeof PopoverPrimitive.Content>,
33
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
34
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
35
- <PopoverPrimitive.Portal>
36
- <PopoverPrimitive.Content
37
- ref={ref}
38
- align={align}
39
- sideOffset={sideOffset}
40
- className={cn(
41
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
42
- className
43
- )}
44
- {...props}
45
- />
46
- </PopoverPrimitive.Portal>
47
- ))
48
- PopoverContent.displayName = PopoverPrimitive.Content.displayName
49
-
50
56
  export { Popover }
@@ -1,5 +1,3 @@
1
- "use client"
2
-
3
1
  import * as React from "react"
4
2
  import * as SelectPrimitive from "@radix-ui/react-select"
5
3
  // import { ChevronDown } from "lucide-react"
@@ -1,111 +1,6 @@
1
- // "use client"
2
-
3
- // import * as React from "react"
4
- // import * as TooltipPrimitive from "@radix-ui/react-tooltip"
5
-
6
- import { cn } from "../util"
7
-
8
- // const TooltipProvider = TooltipPrimitive.Provider
9
-
10
- // const TooltipRoot = TooltipPrimitive.Root
11
-
12
- // const TooltipTrigger = TooltipPrimitive.Trigger
13
-
14
- // const TooltipContent = React.forwardRef<
15
- // React.ElementRef<typeof TooltipPrimitive.Content>,
16
- // React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
- // >(({ className, sideOffset = 4, ...props }, ref) => (
18
- // <TooltipPrimitive.Content
19
- // ref={ref}
20
- // sideOffset={sideOffset}
21
- // className={cn(
22
- // "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
- // className
24
- // )}
25
- // {...props}
26
- // />
27
- // ))
28
- // TooltipContent.displayName = TooltipPrimitive.Content.displayName
29
-
30
- // interface TooltipProps {
31
- // // TooltipProvider props
32
- // delayDurationProvider?: number
33
- // skipDelayDuration?: number
34
- // disableHoverableContentProvider?: boolean
35
-
36
- // // TooltipRoot props
37
- // defaultOpen?: boolean
38
- // open?: boolean
39
- // onOpenChange?: (open: boolean) => void
40
- // delayDurationRoot?: number
41
- // disableHoverableContentRoot?: boolean
42
-
43
- // // TooltipContent props
44
- // content: React.ReactNode
45
- // asChild?: boolean
46
- // ariaLabel?: string
47
- // onEscapeKeyDown?: () => void
48
- // onPointerDownOutside?: (event: MouseEvent | TouchEvent) => void
49
- // forceMount?: boolean
50
- // side?: "top" | "right" | "bottom" | "left"
51
- // sideOffset?: number
52
- // align?: "start" | "center" | "end"
53
- // alignOffset?: number
54
- // avoidCollisions?: boolean
55
- // collisionBoundary?: Element | Element[];
56
- // collisionPadding?: number
57
- // arrowPadding?: number
58
- // sticky?: "partial" | "always";
59
- // hideWhenDetached?: boolean
60
-
61
- // children: React.ReactNode
62
- // }
63
-
64
- // const Tooltip: React.FC<TooltipProps> = (props) => {
65
- // const { content, children, ...rest } = props
66
- // return (
67
- // <TooltipProvider
68
- // delayDuration={props.delayDurationProvider}
69
- // skipDelayDuration={props.skipDelayDuration}
70
- // disableHoverableContent={props.disableHoverableContentProvider}
71
- // >
72
- // <TooltipRoot
73
- // defaultOpen={props.defaultOpen}
74
- // open={props.open}
75
- // onOpenChange={props.onOpenChange}
76
- // delayDuration={props.delayDurationRoot}
77
- // disableHoverableContent={props.disableHoverableContentRoot}
78
- // >
79
- // <TooltipTrigger asChild>{children}</TooltipTrigger>
80
- // <TooltipContent
81
- // asChild={props.asChild}
82
- // aria-label={props.ariaLabel}
83
- // onEscapeKeyDown={props.onEscapeKeyDown}
84
- // onPointerDownOutside={props.onPointerDownOutside}
85
- // // forceMount={props.forceMount}
86
- // side={props.side}
87
-
88
- // sideOffset={props.sideOffset}
89
- // align={props.align}
90
- // alignOffset={props.alignOffset}
91
- // avoidCollisions={props.avoidCollisions}
92
- // collisionBoundary={props.collisionBoundary}
93
- // collisionPadding={props.collisionPadding}
94
- // arrowPadding={props.arrowPadding}
95
- // sticky={props.sticky}
96
- // hideWhenDetached={props.hideWhenDetached}
97
- // {...rest}
98
- // >
99
- // {content}
100
- // </TooltipContent>
101
- // </TooltipRoot>
102
- // </TooltipProvider>
103
- // )
104
- // }
105
-
106
- // your-tooltip.jsx
107
1
  import React from "react"
108
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip"
3
+ import { cn } from "../util"
109
4
 
110
5
  const TooltipContent = React.forwardRef<
111
6
  React.ElementRef<typeof TooltipPrimitive.Content>,