@sikka/hawa 0.1.36 → 0.1.37

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.36",
3
+ "version": "0.1.37",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -19,6 +19,7 @@ const Label = React.forwardRef<
19
19
  {...props}
20
20
  />
21
21
  ))
22
+
22
23
  Label.displayName = LabelPrimitive.Root.displayName
23
24
 
24
25
  export { Label }
@@ -9,12 +9,11 @@ const PopoverContent = React.forwardRef<
9
9
  >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
10
10
  <PopoverPrimitive.Portal>
11
11
  <PopoverPrimitive.Content
12
-
13
12
  ref={ref}
14
13
  align={align}
15
14
  sideOffset={sideOffset}
16
15
  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" ,
16
+ "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
17
  className
19
18
  )}
20
19
  {...props}
@@ -24,12 +23,12 @@ const PopoverContent = React.forwardRef<
24
23
  PopoverContent.displayName = PopoverPrimitive.Content.displayName
25
24
 
26
25
  interface PopoverProps {
26
+ side?: "top" | "right" | "bottom" | "left"
27
+ align?: "start" | "center" | "end"
27
28
  trigger: React.ReactNode
28
29
  children: React.ReactNode
29
30
  className?: string
30
- align?: "start" | "center" | "end"
31
31
  sideOffset?: number
32
- side?: "top" | "right" | "bottom" | "left"
33
32
  }
34
33
 
35
34
  const Popover: React.FC<PopoverProps> = ({
@@ -1,15 +1,11 @@
1
1
  import * as React from "react"
2
2
  import * as SelectPrimitive from "@radix-ui/react-select"
3
- // import { ChevronDown } from "lucide-react"
4
3
 
5
4
  import { cn } from "../util"
6
5
 
7
6
  const Select = SelectPrimitive.Root
8
-
9
7
  const SelectGroup = SelectPrimitive.Group
10
-
11
8
  const SelectValue = SelectPrimitive.Value
12
-
13
9
  const SelectTrigger = React.forwardRef<
14
10
  React.ElementRef<typeof SelectPrimitive.Trigger>,
15
11
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
@@ -5,16 +5,11 @@ import { cn } from "../util"
5
5
 
6
6
  const TabsContext = React.createContext<{
7
7
  orientation?: "vertical" | "horizontal"
8
- }>({
9
- orientation: "vertical", // default value
10
- })
8
+ }>({ orientation: "vertical" })
11
9
 
12
- // const Tabs = TabsPrimitive.Root
13
10
  type TabsRootProps = React.ComponentPropsWithoutRef<
14
11
  typeof TabsPrimitive.Root
15
- > & {
16
- orientation?: "vertical" | "horizontal"
17
- }
12
+ > & { orientation?: "vertical" | "horizontal" }
18
13
 
19
14
  const Tabs = React.forwardRef<
20
15
  React.ElementRef<typeof TabsPrimitive.Root>,
@@ -23,9 +18,9 @@ const Tabs = React.forwardRef<
23
18
  <TabsPrimitive.Root
24
19
  ref={ref}
25
20
  className={cn(
26
- className,
27
21
  "flex gap-2",
28
- orientation === "horizontal" ? "flex-row" : "flex-col"
22
+ orientation === "horizontal" ? "flex-row" : "flex-col",
23
+ className
29
24
  )}
30
25
  {...props}
31
26
  >
@@ -36,23 +31,16 @@ const Tabs = React.forwardRef<
36
31
  ))
37
32
  Tabs.displayName = TabsPrimitive.Root.displayName
38
33
 
39
- // type TabsListProps = React.ComponentPropsWithoutRef<
40
- // typeof TabsPrimitive.List
41
- // > & {
42
- // // orientation?: "vertical" | "horizontal"
43
- // }
44
-
45
34
  const TabsList = React.forwardRef<
46
35
  React.ElementRef<typeof TabsPrimitive.List>,
47
36
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
48
37
  >(({ className, ...props }, ref) => {
49
38
  const { orientation } = React.useContext(TabsContext)
50
-
51
39
  return (
52
40
  <TabsPrimitive.List
53
41
  ref={ref}
54
42
  className={cn(
55
- "flex w-fit flex-wrap items-center justify-start gap-1 rounded border bg-muted p-1 text-muted-foreground ",
43
+ "flex w-fit flex-wrap items-center justify-start gap-1 rounded border bg-muted p-1 text-muted-foreground dark:border-primary/10 ",
56
44
  orientation === "horizontal" ? "flex-col" : "flex-row",
57
45
  className
58
46
  )}
@@ -70,7 +58,7 @@ const TabsTrigger = React.forwardRef<
70
58
  <TabsPrimitive.Trigger
71
59
  ref={ref}
72
60
  className={cn(
73
- "inline-flex w-full flex-1 select-none items-center justify-center whitespace-nowrap rounded border 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 ",
61
+ "inline-flex w-full flex-1 select-none items-center justify-center whitespace-nowrap rounded border 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 dark:border-primary/10",
74
62
  className
75
63
  )}
76
64
  {...props}
@@ -1,5 +1,4 @@
1
1
  import * as React from "react"
2
-
3
2
  import { cn } from "../util"
4
3
  import { Label } from "./Label"
5
4
 
@@ -4,23 +4,6 @@ import { cva, type VariantProps } from "class-variance-authority"
4
4
 
5
5
  import { cn } from "../util"
6
6
 
7
- const ToastProvider = ToastPrimitives.Provider
8
-
9
- const ToastViewport = React.forwardRef<
10
- React.ElementRef<typeof ToastPrimitives.Viewport>,
11
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
12
- >(({ className, ...props }, ref) => (
13
- <ToastPrimitives.Viewport
14
- ref={ref}
15
- className={cn(
16
- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
17
- className
18
- )}
19
- {...props}
20
- />
21
- ))
22
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName
23
-
24
7
  const toastVariants = cva(
25
8
  "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
26
9
  {
@@ -45,6 +28,23 @@ const toastVariants = cva(
45
28
  }
46
29
  )
47
30
 
31
+ const ToastProvider = ToastPrimitives.Provider
32
+
33
+ const ToastViewport = React.forwardRef<
34
+ React.ElementRef<typeof ToastPrimitives.Viewport>,
35
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
36
+ >(({ className, ...props }, ref) => (
37
+ <ToastPrimitives.Viewport
38
+ ref={ref}
39
+ className={cn(
40
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ ))
46
+ ToastViewport.displayName = ToastPrimitives.Viewport.displayName
47
+
48
48
  const Toast = React.forwardRef<
49
49
  React.ElementRef<typeof ToastPrimitives.Root>,
50
50
  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
@@ -79,14 +79,9 @@ const ToastAction = React.forwardRef<
79
79
  ref={ref}
80
80
  className={cn(
81
81
  "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
82
- // "group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
83
-
84
82
  "group-[.info]:border-muted/40 group-[.info]:hover:border-info/30 group-[.info]:hover:bg-info group-[.info]:hover:text-info-foreground group-[.info]:focus:ring-info",
85
-
86
83
  "group-[.error]:border-muted/40 group-[.error]:hover:border-error/30 group-[.error]:hover:bg-error group-[.error]:hover:text-error-foreground group-[.error]:focus:ring-error",
87
-
88
84
  "group-[.success]:border-muted/40 group-[.success]:hover:border-success/30 group-[.success]:hover:bg-success group-[.success]:hover:text-success-foreground group-[.success]:focus:ring-success",
89
-
90
85
  "group-[.warning]:border-muted/40 group-[.warning]:hover:border-warning/30 group-[.warning]:hover:bg-warning group-[.warning]:hover:text-warning-foreground group-[.warning]:focus:ring-warning",
91
86
  className
92
87
  )}
@@ -151,7 +146,6 @@ const ToastDescription = React.forwardRef<
151
146
  ToastDescription.displayName = ToastPrimitives.Description.displayName
152
147
 
153
148
  type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
154
-
155
149
  type ToastActionElement = React.ReactElement<typeof ToastAction>
156
150
 
157
151
  export {
@@ -12,19 +12,14 @@ import { cn } from "../util"
12
12
 
13
13
  export function Toaster(props) {
14
14
  const { toasts } = useToast()
15
- console.log("toaster direction", props.direction)
15
+ let isRTL = props.direction === "rtl"
16
16
  return (
17
- <ToastProvider
18
- swipeDirection={props.direction === "rtl" ? "left" : "right"}
19
- >
17
+ <ToastProvider swipeDirection={isRTL ? "left" : "right"}>
20
18
  {toasts.map(function ({ id, title, description, action, ...toastProps }) {
21
19
  return (
22
20
  <Toast direction={props.direction} key={id} {...toastProps}>
23
21
  <div
24
- className={cn(
25
- "grid gap-1",
26
- props.direction === "rtl" ? "text-right" : "text-left"
27
- )}
22
+ className={cn("grid gap-1", isRTL ? "text-right" : "text-left")}
28
23
  >
29
24
  {title && <ToastTitle>{title}</ToastTitle>}
30
25
  {description && (
@@ -36,9 +31,7 @@ export function Toaster(props) {
36
31
  </Toast>
37
32
  )
38
33
  })}
39
- <ToastViewport
40
- className={cn("gap-2", props.direction === "rtl" && "fixed left-0")}
41
- />
34
+ <ToastViewport className={cn("gap-2", isRTL && "fixed left-0")} />
42
35
  </ToastProvider>
43
36
  )
44
37
  }
@@ -22,35 +22,28 @@ const TooltipArrow = React.forwardRef<
22
22
  React.ElementRef<typeof TooltipPrimitive.Arrow>,
23
23
  React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>
24
24
  >(({ className, ...props }, ref) => (
25
- <TooltipPrimitive.Arrow
26
- ref={ref}
27
- className={cn(
28
- // "fill-white",
29
- className
30
- )}
31
- {...props}
32
- />
25
+ <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />
33
26
  ))
34
27
  TooltipArrow.displayName = TooltipPrimitive.Arrow.displayName
35
28
 
36
29
  type TooltipTypes = {
30
+ open?: any
37
31
  side?: "top" | "right" | "bottom" | "left"
38
- children?: any
39
32
  content?: any
40
- open?: any
33
+ children?: any
41
34
  defaultOpen?: any
42
35
  onOpenChange?: any
43
36
  delayDuration?: any
44
37
  }
45
38
 
46
- export const Tooltip: React.FunctionComponent<TooltipTypes> = ({
47
- children,
48
- content,
39
+ const Tooltip: React.FunctionComponent<TooltipTypes> = ({
40
+ side,
49
41
  open,
42
+ content,
43
+ children,
50
44
  defaultOpen,
51
45
  onOpenChange,
52
46
  delayDuration = 300,
53
- side,
54
47
  ...props
55
48
  }) => {
56
49
  return (
@@ -63,10 +56,10 @@ export const Tooltip: React.FunctionComponent<TooltipTypes> = ({
63
56
  <TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
64
57
  <TooltipContent side={side} align="center" {...props}>
65
58
  {content}
66
- {/* <TooltipArrow width={21} height={5} /> */}
67
59
  </TooltipContent>
68
60
  </TooltipPrimitive.Root>
69
61
  </TooltipPrimitive.TooltipProvider>
70
62
  )
71
63
  }
72
- // export { Tooltip, TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider }
64
+
65
+ export { Tooltip }
@@ -4,7 +4,7 @@ import * as React from "react"
4
4
  import type { ToastActionElement, ToastProps } from "../elements/Toast"
5
5
 
6
6
  const TOAST_LIMIT = 5
7
- const TOAST_REMOVE_DELAY = 1000000
7
+ const TOAST_REMOVE_DELAY = 100000
8
8
 
9
9
  type ToasterToast = ToastProps & {
10
10
  id: string
@@ -102,21 +102,13 @@ export const reducer = (state: State, action: Action): State => {
102
102
  return {
103
103
  ...state,
104
104
  toasts: state.toasts.map((t) =>
105
- t.id === toastId || toastId === undefined
106
- ? {
107
- ...t,
108
- open: false,
109
- }
110
- : t
105
+ t.id === toastId || toastId === undefined ? { ...t, open: false } : t
111
106
  ),
112
107
  }
113
108
  }
114
109
  case "REMOVE_TOAST":
115
110
  if (action.toastId === undefined) {
116
- return {
117
- ...state,
118
- toasts: [],
119
- }
111
+ return { ...state, toasts: [] }
120
112
  }
121
113
  return {
122
114
  ...state,
package/src/styles.css CHANGED
@@ -3303,9 +3303,6 @@ body {
3303
3303
  --tw-blur: blur(16px);
3304
3304
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
3305
3305
  }
3306
- .group.destructive .group-\[\.destructive\]\:border-muted\/40 {
3307
- border-color: hsl(var(--muted) / 0.4);
3308
- }
3309
3306
  .group.error .group-\[\.error\]\:border-muted\/40 {
3310
3307
  border-color: hsl(var(--muted) / 0.4);
3311
3308
  }
@@ -3322,9 +3319,6 @@ body {
3322
3319
  --tw-text-opacity: 1;
3323
3320
  color: rgb(252 165 165 / var(--tw-text-opacity));
3324
3321
  }
3325
- .group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover {
3326
- border-color: hsl(var(--destructive) / 0.3);
3327
- }
3328
3322
  .group.error .group-\[\.error\]\:hover\:border-error\/30:hover {
3329
3323
  border-color: hsl(var(--error) / 0.3);
3330
3324
  }
@@ -3337,10 +3331,6 @@ body {
3337
3331
  .group.warning .group-\[\.warning\]\:hover\:border-warning\/30:hover {
3338
3332
  border-color: hsl(var(--warning) / 0.3);
3339
3333
  }
3340
- .group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover {
3341
- --tw-bg-opacity: 1;
3342
- background-color: hsl(var(--destructive) / var(--tw-bg-opacity));
3343
- }
3344
3334
  .group.error .group-\[\.error\]\:hover\:bg-error:hover {
3345
3335
  --tw-bg-opacity: 1;
3346
3336
  background-color: hsl(var(--error) / var(--tw-bg-opacity));
@@ -3357,10 +3347,6 @@ body {
3357
3347
  --tw-bg-opacity: 1;
3358
3348
  background-color: hsl(var(--warning) / var(--tw-bg-opacity));
3359
3349
  }
3360
- .group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover {
3361
- --tw-text-opacity: 1;
3362
- color: hsl(var(--destructive-foreground) / var(--tw-text-opacity));
3363
- }
3364
3350
  .group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover {
3365
3351
  --tw-text-opacity: 1;
3366
3352
  color: rgb(254 242 242 / var(--tw-text-opacity));
@@ -3381,10 +3367,6 @@ body {
3381
3367
  --tw-text-opacity: 1;
3382
3368
  color: hsl(var(--warning-foreground) / var(--tw-text-opacity));
3383
3369
  }
3384
- .group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus {
3385
- --tw-ring-opacity: 1;
3386
- --tw-ring-color: hsl(var(--destructive) / var(--tw-ring-opacity));
3387
- }
3388
3370
  .group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus {
3389
3371
  --tw-ring-opacity: 1;
3390
3372
  --tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity));
@@ -3755,6 +3737,9 @@ body {
3755
3737
  --tw-border-opacity: 1;
3756
3738
  border-color: rgb(17 24 39 / var(--tw-border-opacity));
3757
3739
  }
3740
+ :is(.dark .dark\:border-primary\/10) {
3741
+ border-color: hsl(var(--primary) / 0.1);
3742
+ }
3758
3743
  :is(.dark .dark\:bg-background) {
3759
3744
  background-color: hsl(var(--background));
3760
3745
  }