@sikka/hawa 0.1.24 → 0.1.26

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.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -109,6 +109,7 @@
109
109
  "@radix-ui/react-dropdown-menu": "^2.0.5",
110
110
  "@radix-ui/react-label": "^2.0.2",
111
111
  "@radix-ui/react-popover": "^1.0.6",
112
+ "@radix-ui/react-tabs": "^1.0.4",
112
113
  "@radix-ui/react-tooltip": "^1.0.6",
113
114
  "class-variance-authority": "^0.7.0",
114
115
  "clsx": "^1.2.1",
@@ -69,6 +69,7 @@ export const HawaTabs: FC<TabsTypes> = ({
69
69
  >
70
70
  <ul
71
71
  className={clsx(
72
+ "w-full border-primary",
72
73
  marginBetween
73
74
  ? orientation === "vertical"
74
75
  ? "mb-0"
@@ -78,8 +79,9 @@ export const HawaTabs: FC<TabsTypes> = ({
78
79
  ? "ml-" + marginBetween
79
80
  : "mr-" + marginBetween,
80
81
  tabsStyle[orientation],
81
- "border-primary",
82
-
82
+ orientation === "horizontal"
83
+ ? "grid grid-cols-3 gap-1 sm:flex sm:flex-row sm:gap-0 "
84
+ : "",
83
85
  // orientation === "vertical"
84
86
  // ? direction === "rtl"
85
87
  // ? "rounded-none rounded-r border-l-2"
@@ -92,7 +94,7 @@ export const HawaTabs: FC<TabsTypes> = ({
92
94
  ? direction === "rtl"
93
95
  ? "rounded-none rounded-r border-l-2"
94
96
  : "rounded-none rounded-l border-r-2"
95
- : "border-b-2"
97
+ : "border-b-0 sm:border-b-2"
96
98
  )}
97
99
  >
98
100
  {props.options?.map((opt: any, o) => (
@@ -104,7 +106,7 @@ export const HawaTabs: FC<TabsTypes> = ({
104
106
  props?.onChangeTab(opt)
105
107
  }}
106
108
  className={clsx(
107
- "flex flex-row items-center gap-2",
109
+ "flex flex-row items-center gap-2 ",
108
110
  opt.value === selectedOption
109
111
  ? // props.options[selectedOption].value === opt.value
110
112
  [
@@ -117,7 +119,7 @@ export const HawaTabs: FC<TabsTypes> = ({
117
119
  ? "rounded"
118
120
  : orientation === "vertical"
119
121
  ? "rounded rounded-bl-none rounded-tl-none"
120
- : "rounded rounded-bl-none rounded-br-none"
122
+ : "rounded sm:rounded-b-none"
121
123
  // direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
122
124
  )}
123
125
  >
@@ -0,0 +1,53 @@
1
+ import * as React from "react"
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs"
3
+
4
+ import { cn } from "../util"
5
+
6
+ const Tabs = TabsPrimitive.Root
7
+
8
+ const TabsList = React.forwardRef<
9
+ React.ElementRef<typeof TabsPrimitive.List>,
10
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
11
+ >(({ className, ...props }, ref) => (
12
+ <TabsPrimitive.List
13
+ ref={ref}
14
+ className={cn(
15
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ ))
21
+ TabsList.displayName = TabsPrimitive.List.displayName
22
+
23
+ const TabsTrigger = React.forwardRef<
24
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
25
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
26
+ >(({ className, ...props }, ref) => (
27
+ <TabsPrimitive.Trigger
28
+ ref={ref}
29
+ className={cn(
30
+ "inline-flex select-none items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm",
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ ))
36
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
37
+
38
+ const TabsContent = React.forwardRef<
39
+ React.ElementRef<typeof TabsPrimitive.Content>,
40
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
41
+ >(({ className, ...props }, ref) => (
42
+ <TabsPrimitive.Content
43
+ ref={ref}
44
+ className={cn(
45
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ ))
51
+ TabsContent.displayName = TabsPrimitive.Content.displayName
52
+
53
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -64,3 +64,4 @@ export * from "./Skeleton"
64
64
  export * from "./InterfaceSettings"
65
65
  export * from "./DropdownMenu"
66
66
  export * from "./Popover"
67
+ export * from "./Tabs"
@@ -64,23 +64,41 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
64
64
  clickedItem,
65
65
  ...props
66
66
  }) => {
67
- const [openSideMenu, setOpenSideMenu] = useState(false)
68
- const [openSubItem, setOpenSubitem] = useState("")
67
+ let closeDrawerWidth = 56
68
+ let openDrawerWidth = 200
69
+ let drawerSizeStyle = {
70
+ opened: {
71
+ sm: "100",
72
+ md: openDrawerWidth,
73
+ lg: "250",
74
+ },
75
+ closed: {
76
+ sm: closeDrawerWidth,
77
+ md: closeDrawerWidth,
78
+ lg: closeDrawerWidth,
79
+ },
80
+ }
81
+
82
+ const ref = useRef(null)
83
+ const isRTL = direction === "rtl"
84
+
69
85
  const [openedSidebarItem, setOpenedSidebarItem] = useState("")
70
- const { isOpen, onClose, onOpen } = useDiscloser(false)
71
86
  const [selectedItem, setSelectedItem] = useState(
72
87
  currentPage ? currentPage : []
73
88
  )
74
89
 
75
- const [keepOpen, setKeepOpen] = useState(false)
76
- const ref = useRef(null)
77
- const isRTL = direction === "rtl"
78
90
  let size
79
91
  if (typeof window !== "undefined") {
80
92
  size = useBreakpoint()
81
93
  } else {
82
94
  size = 1200
83
95
  }
96
+ const [keepOpen, setKeepOpen] = useState(size > 600 ? true : false)
97
+ const [openSideMenu, setOpenSideMenu] = useState(size > 600 ? true : false)
98
+
99
+ let drawerSizeCondition =
100
+ size > 600 ? drawerSizeStyle[keepOpen ? "opened" : "closed"][drawerSize] : 0
101
+
84
102
  useEffect(() => {
85
103
  const handleClickOutside = (event) => {
86
104
  if (ref.current && !ref.current.contains(event.target) && !keepOpen) {
@@ -93,29 +111,13 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
93
111
  }
94
112
  }, [keepOpen])
95
113
 
96
- let drawerDefaultStyle =
97
- "fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-card transition-all"
98
- //The width of the drawer when closed
99
- let closeDrawerWidth = 56
100
- //The width of the drawer when opened
101
- let openDrawerWidth = 200
102
- let drawerSizeStyle = {
103
- opened: {
104
- sm: "100",
105
- md: openDrawerWidth,
106
- lg: "250",
107
- },
108
- closed: {
109
- sm: "56",
110
- md: "56",
111
- lg: "56",
112
- },
113
- }
114
-
115
- let drawerSizeCondition =
116
- size > 600 ? drawerSizeStyle[keepOpen ? "opened" : "closed"][drawerSize] : 0
117
114
  return (
118
115
  <div className="fixed left-0">
116
+ {/*
117
+ * ----------------------------------------------------------------------------------------------------
118
+ * Top Bar
119
+ * ----------------------------------------------------------------------------------------------------
120
+ */}
119
121
  {props.topBar && (
120
122
  <div
121
123
  className={clsx(
@@ -212,7 +214,18 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
212
214
  direction={isRTL ? "rtl" : "ltr"}
213
215
  trigger={
214
216
  <div className="relative h-8 w-8 cursor-pointer overflow-clip rounded ring-1 ring-primary/30 dark:bg-gray-600">
215
- <AvatarIcon />
217
+ <svg
218
+ aria-aria-label="Avatar Icon"
219
+ className="absolute -left-1 h-10 w-10 text-gray-400"
220
+ fill="currentColor"
221
+ viewBox="0 0 20 20"
222
+ >
223
+ <path
224
+ fillRule="evenodd"
225
+ d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
226
+ clipRule="evenodd"
227
+ ></path>
228
+ </svg>
216
229
  </div>
217
230
  }
218
231
  items={props.profileMenuItems}
@@ -433,17 +446,3 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
433
446
  </div>
434
447
  )
435
448
  }
436
-
437
- const AvatarIcon = () => (
438
- <svg
439
- className="absolute -left-1 h-10 w-10 text-gray-400"
440
- fill="currentColor"
441
- viewBox="0 0 20 20"
442
- >
443
- <path
444
- fillRule="evenodd"
445
- d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
446
- clipRule="evenodd"
447
- ></path>
448
- </svg>
449
- )
@@ -156,7 +156,7 @@ const SidebarItem: React.FC<{
156
156
  const getSelectedStyle = (value: string, index: number) => {
157
157
  return isSelected && isSelected[index] === value
158
158
  ? "bg-primary text-primary-foreground cursor-default"
159
- : "hover:bg-primary/30"
159
+ : "hover:bg-primary/10"
160
160
  }
161
161
  if (item.subitems) {
162
162
  return (
package/src/styles.css CHANGED
@@ -1464,6 +1464,9 @@ video {
1464
1464
  .grid-cols-2 {
1465
1465
  grid-template-columns: repeat(2, minmax(0, 1fr));
1466
1466
  }
1467
+ .grid-cols-3 {
1468
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1469
+ }
1467
1470
  .grid-cols-4 {
1468
1471
  grid-template-columns: repeat(4, minmax(0, 1fr));
1469
1472
  }
@@ -2990,9 +2993,6 @@ body {
2990
2993
  .hover\:bg-primary\/20:hover {
2991
2994
  background-color: hsl(var(--primary) / 0.2);
2992
2995
  }
2993
- .hover\:bg-primary\/30:hover {
2994
- background-color: hsl(var(--primary) / 0.3);
2995
- }
2996
2996
  .hover\:bg-primary\/40:hover {
2997
2997
  background-color: hsl(var(--primary) / 0.4);
2998
2998
  }
@@ -3315,6 +3315,9 @@ body {
3315
3315
  --tw-bg-opacity: 1;
3316
3316
  background-color: hsl(252 56.0% 57.5% / var(--tw-bg-opacity));
3317
3317
  }
3318
+ .data-\[state\=active\]\:bg-primary[data-state=active] {
3319
+ background-color: hsl(var(--primary));
3320
+ }
3318
3321
  .data-\[state\=open\]\:bg-accent[data-state=open] {
3319
3322
  background-color: hsl(var(--accent));
3320
3323
  }
@@ -3334,6 +3337,9 @@ body {
3334
3337
  --tw-text-opacity: 1;
3335
3338
  color: hsl(255 65.0% 99.4% / var(--tw-text-opacity));
3336
3339
  }
3340
+ .data-\[state\=active\]\:text-primary-foreground[data-state=active] {
3341
+ color: hsl(var(--primary-foreground));
3342
+ }
3337
3343
  .data-\[state\=open\]\:text-violet-11[data-state=open] {
3338
3344
  --tw-text-opacity: 1;
3339
3345
  color: hsl(250 43.0% 48.0% / var(--tw-text-opacity));
@@ -3341,6 +3347,11 @@ body {
3341
3347
  .data-\[disabled\]\:opacity-50[data-disabled] {
3342
3348
  opacity: 0.5;
3343
3349
  }
3350
+ .data-\[state\=active\]\:shadow-sm[data-state=active] {
3351
+ --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
3352
+ --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
3353
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3354
+ }
3344
3355
  .data-\[state\=open\]\:animate-in[data-state=open] {
3345
3356
  animation-name: enter;
3346
3357
  animation-duration: 150ms;
@@ -3683,15 +3694,36 @@ body {
3683
3694
  }
3684
3695
  @media (min-width: 640px) {
3685
3696
 
3697
+ .sm\:flex {
3698
+ display: flex;
3699
+ }
3700
+
3686
3701
  .sm\:columns-2 {
3687
3702
  -moz-columns: 2;
3688
3703
  columns: 2;
3689
3704
  }
3690
3705
 
3706
+ .sm\:flex-row {
3707
+ flex-direction: row;
3708
+ }
3709
+
3710
+ .sm\:gap-0 {
3711
+ gap: 0px;
3712
+ }
3713
+
3691
3714
  .sm\:gap-8 {
3692
3715
  gap: 2rem;
3693
3716
  }
3694
3717
 
3718
+ .sm\:rounded-b-none {
3719
+ border-bottom-right-radius: 0px;
3720
+ border-bottom-left-radius: 0px;
3721
+ }
3722
+
3723
+ .sm\:border-b-2 {
3724
+ border-bottom-width: 2px;
3725
+ }
3726
+
3695
3727
  .sm\:p-20 {
3696
3728
  padding: 5rem;
3697
3729
  }