@sikka/hawa 0.1.16 → 0.1.17

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.16",
3
+ "version": "0.1.17",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -107,6 +107,7 @@
107
107
  "dependencies": {
108
108
  "@radix-ui/react-dropdown-menu": "^2.0.5",
109
109
  "@radix-ui/react-label": "^2.0.2",
110
+ "@radix-ui/react-popover": "^1.0.6",
110
111
  "@radix-ui/react-tooltip": "^1.0.6",
111
112
  "class-variance-authority": "^0.7.0",
112
113
  "clsx": "^1.2.1",
@@ -11,6 +11,7 @@ const buttonVariants = cva(
11
11
  variants: {
12
12
  variant: {
13
13
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
14
+ light: "bg-primary/20 text-primary hover:bg-primary/40",
14
15
  destructive:
15
16
  "bg-destructive text-destructive-foreground hover:bg-destructive/90",
16
17
  outline:
@@ -222,16 +222,24 @@ type ExtendedDropdownMenuContentProps = Partial<
222
222
  // Add any additional types or overrides here, for example:
223
223
  // side?: "left" | "right" | "top" | "bottom"
224
224
  }
225
+ type ExtendedDropdownMenuTriggerProps = Partial<
226
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>
227
+ > & {
228
+ // Add any additional types or overrides here, for example:
229
+ // side?: "left" | "right" | "top" | "bottom"
230
+ }
225
231
 
226
232
  type SubItem = {
227
233
  label: string
228
234
  value: string
235
+ action?: () => void
229
236
  highlighted?: boolean
230
237
  }
231
238
 
232
239
  type Item = {
233
240
  label: string
234
241
  value: string
242
+ action?: () => void
235
243
  highlighted?: boolean
236
244
  subitems?: SubItem[] // Note the use of the optional modifier
237
245
  }
@@ -244,6 +252,7 @@ export const DropdownMenu = ({
244
252
  sideOffset,
245
253
  side,
246
254
  className,
255
+ triggerClassname,
247
256
  align,
248
257
  alignOffset,
249
258
  }: {
@@ -253,6 +262,7 @@ export const DropdownMenu = ({
253
262
  direction?: "rtl" | "ltr"
254
263
  onItemSelect?: any
255
264
  className?: ExtendedDropdownMenuContentProps["className"]
265
+ triggerClassname?: ExtendedDropdownMenuTriggerProps["className"]
256
266
  sideOffset?: ExtendedDropdownMenuContentProps["sideOffset"]
257
267
  side?: ExtendedDropdownMenuContentProps["side"]
258
268
  align?: ExtendedDropdownMenuContentProps["align"]
@@ -261,7 +271,7 @@ export const DropdownMenu = ({
261
271
  }) => {
262
272
  return (
263
273
  <DropdownMenuRoot dir={direction}>
264
- <DropdownMenuTrigger className="focus:ring-0">
274
+ <DropdownMenuTrigger className={triggerClassname}>
265
275
  {trigger}
266
276
  </DropdownMenuTrigger>
267
277
  <DropdownMenuPortal>
@@ -282,7 +292,7 @@ export const DropdownMenu = ({
282
292
  <DropdownMenuSubContent>
283
293
  {item.subitems.map((subitem, subIndex) => (
284
294
  <DropdownMenuItem
285
- onSelect={() => onItemSelect(subitem.value)}
295
+ onSelect={() => subitem.action()}
286
296
  key={subIndex}
287
297
  >
288
298
  {subitem.label}
@@ -292,10 +302,7 @@ export const DropdownMenu = ({
292
302
  </DropdownMenuPortal>
293
303
  </DropdownMenuSub>
294
304
  ) : (
295
- <DropdownMenuItem
296
- key={index}
297
- onSelect={() => onItemSelect(item.value)}
298
- >
305
+ <DropdownMenuItem key={index} onSelect={() => item.action()}>
299
306
  {item.label}
300
307
  </DropdownMenuItem>
301
308
  )
@@ -32,7 +32,7 @@ export const HawaStats: FC<StatTypes> = ({ variant = "default", ...props }) => {
32
32
  ) : (
33
33
  <div className="text-2xl font-bold">{props.number}</div>
34
34
  )}
35
- {props.isLoading ? (
35
+ {props.isLoading && props.helperText ? (
36
36
  <Skeleton className="mt-2 h-4 w-1/2" />
37
37
  ) : (
38
38
  props.helperText && (
@@ -0,0 +1,50 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
5
+
6
+ import { cn } from "../util"
7
+
8
+ interface PopoverProps {
9
+ trigger: React.ReactNode
10
+ children: React.ReactNode
11
+ className?: string
12
+ align?: "start" | "center" | "end"
13
+ sideOffset?: number
14
+ }
15
+
16
+ const Popover: React.FC<PopoverProps> = ({
17
+ trigger,
18
+ children,
19
+ className,
20
+ align = "center",
21
+ sideOffset = 4,
22
+ }) => (
23
+ <PopoverPrimitive.Root>
24
+ <PopoverPrimitive.Trigger>{trigger}</PopoverPrimitive.Trigger>
25
+ <PopoverContent className={className} align={align} sideOffset={sideOffset}>
26
+ {children}
27
+ </PopoverContent>
28
+ </PopoverPrimitive.Root>
29
+ )
30
+
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
+ export { Popover }
@@ -63,3 +63,4 @@ export * from "./Card"
63
63
  export * from "./Skeleton"
64
64
  export * from "./InterfaceSettings"
65
65
  export * from "./DropdownMenu"
66
+ export * from "./Popover"
@@ -208,13 +208,14 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
208
208
  </div>
209
209
  </HawaMenu> */}
210
210
  <DropdownMenu
211
+ triggerClassname="mx-2"
211
212
  align="end"
212
- alignOffset={10}
213
+ alignOffset={8}
213
214
  side={"bottom"}
214
- sideOffset={10}
215
+ sideOffset={5}
215
216
  direction={isRTL ? "rtl" : "ltr"}
216
217
  trigger={
217
- <div className="relative mx-2 h-8 w-8 cursor-pointer overflow-hidden rounded ring-1 ring-primary dark:bg-gray-600">
218
+ <div className="relative h-8 w-8 cursor-pointer overflow-clip rounded ring-1 ring-primary/30 dark:bg-gray-600">
218
219
  <AvatarIcon />
219
220
  </div>
220
221
  }
@@ -333,7 +334,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
333
334
  dItem.subItems?.find(
334
335
  (e) => e.slug === props.currentPage
335
336
  )
336
- ? "bg-primary text-white"
337
+ ? "bg-primary text-primary-foreground "
337
338
  : "hover:bg-primary/20",
338
339
  "my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
339
340
  isRTL ? "flex-row-reverse pr-3" : "",
@@ -341,12 +342,12 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
341
342
  )}
342
343
  >
343
344
  <div className="flex flex-row" dir={direction}>
344
- <div className="flex items-center justify-center dark:text-white">
345
+ <div className="flex items-center justify-center ">
345
346
  {dItem.icon}
346
347
  </div>
347
348
  <div
348
349
  className={clsx(
349
- "mx-2 whitespace-nowrap text-sm transition-all dark:text-white",
350
+ "mx-2 whitespace-nowrap text-sm transition-all",
350
351
  openSideMenu ? "opacity-100" : "opacity-0"
351
352
  )}
352
353
  >
@@ -481,22 +482,31 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
481
482
  }
482
483
  >
483
484
  <Button
484
- variant="secondary"
485
+ variant="light"
485
486
  onClick={() => setKeepOpen(!keepOpen)}
486
487
  size="icon"
487
488
  >
488
- <ArrowIcon
489
- // color={"black"}
490
- pointing={
489
+ <svg
490
+ className={clsx(
491
+ "h-8 w-8 shrink-0 text-primary transition-all disabled:bg-gray-200 ",
492
+ // directionStyle
491
493
  keepOpen
492
494
  ? isRTL
493
- ? "right"
494
- : "left"
495
+ ? "-rotate-90"
496
+ : "rotate-90"
495
497
  : isRTL
496
- ? "left"
497
- : "right"
498
- }
499
- />
498
+ ? "rotate-90"
499
+ : "-rotate-90"
500
+ )}
501
+ fill="currentColor"
502
+ viewBox="0 0 20 20"
503
+ >
504
+ <path
505
+ fillRule="evenodd"
506
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
507
+ clipRule="evenodd"
508
+ ></path>
509
+ </svg>
500
510
  </Button>
501
511
  </Tooltip>
502
512
  </div>
@@ -567,10 +577,9 @@ const ArrowIcon = ({ pointing }) => {
567
577
  return (
568
578
  <svg
569
579
  className={clsx(
570
- "h-6 w-6 shrink-0 transition-all disabled:bg-gray-200 dark:text-white",
580
+ "h-6 w-6 shrink-0 text-primary-foreground transition-all disabled:bg-gray-200 ",
571
581
  directionStyle
572
582
  )}
573
- // fill={color}
574
583
  fill="currentColor"
575
584
  viewBox="0 0 20 20"
576
585
  >
package/src/styles.css CHANGED
@@ -1220,6 +1220,9 @@ video {
1220
1220
  .w-7 {
1221
1221
  width: 1.75rem;
1222
1222
  }
1223
+ .w-72 {
1224
+ width: 18rem;
1225
+ }
1223
1226
  .w-8 {
1224
1227
  width: 2rem;
1225
1228
  }
@@ -2584,12 +2587,12 @@ video {
2584
2587
  .ring-buttonPrimary-500 {
2585
2588
  --tw-ring-color: hsl(var(--button-primary-500));
2586
2589
  }
2587
- .ring-primary {
2588
- --tw-ring-color: hsl(var(--primary));
2589
- }
2590
2590
  .ring-primary\/20 {
2591
2591
  --tw-ring-color: hsl(var(--primary) / 0.2);
2592
2592
  }
2593
+ .ring-primary\/30 {
2594
+ --tw-ring-color: hsl(var(--primary) / 0.3);
2595
+ }
2593
2596
  .ring-offset-1 {
2594
2597
  --tw-ring-offset-width: 1px;
2595
2598
  }
@@ -2957,6 +2960,9 @@ body {
2957
2960
  .hover\:bg-primary\/20:hover {
2958
2961
  background-color: hsl(var(--primary) / 0.2);
2959
2962
  }
2963
+ .hover\:bg-primary\/40:hover {
2964
+ background-color: hsl(var(--primary) / 0.4);
2965
+ }
2960
2966
  .hover\:bg-primary\/90:hover {
2961
2967
  background-color: hsl(var(--primary) / 0.9);
2962
2968
  }
@@ -3060,11 +3066,6 @@ body {
3060
3066
  outline: 2px solid transparent;
3061
3067
  outline-offset: 2px;
3062
3068
  }
3063
- .focus\:ring-0:focus {
3064
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3065
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
3066
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
3067
- }
3068
3069
  .focus\:ring-2:focus {
3069
3070
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3070
3071
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);