@sikka/hawa 0.1.31 → 0.1.32
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/es/elements/Toast.d.ts +1 -0
- package/es/elements/Toaster.d.ts +1 -1
- package/es/index.es.js +2 -2
- package/lib/elements/Toast.d.ts +1 -0
- package/lib/elements/Toaster.d.ts +1 -1
- package/lib/index.js +2 -2
- package/package.json +3 -2
- package/src/elements/Toast.tsx +11 -9
- package/src/elements/Toaster.tsx +28 -20
- package/src/elements/Tooltip.tsx +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "SaaS Oriented UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -106,12 +106,13 @@
|
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
109
|
+
"@radix-ui/react-direction": "^1.0.1",
|
|
110
|
+
"@radix-ui/react-toast": "^1.1.4",
|
|
109
111
|
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
|
110
112
|
"@radix-ui/react-label": "^2.0.2",
|
|
111
113
|
"@radix-ui/react-popover": "^1.0.6",
|
|
112
114
|
"@radix-ui/react-separator": "^1.0.3",
|
|
113
115
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
114
|
-
"@radix-ui/react-toast": "^1.1.4",
|
|
115
116
|
"@radix-ui/react-tooltip": "^1.0.6",
|
|
116
117
|
"class-variance-authority": "^0.7.0",
|
|
117
118
|
"clsx": "^1.2.1",
|
package/src/elements/Toast.tsx
CHANGED
|
@@ -50,18 +50,20 @@ const Toast = React.forwardRef<
|
|
|
50
50
|
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
51
51
|
VariantProps<typeof toastVariants> & {
|
|
52
52
|
severity?: "info" | "warning" | "error" | "success" | "none"
|
|
53
|
+
direction?: "rtl" | "ltr"
|
|
53
54
|
}
|
|
54
55
|
>(({ className, variant, severity = "none", ...props }, ref) => {
|
|
55
56
|
return (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
<ToastPrimitives.Root
|
|
58
|
+
ref={ref}
|
|
59
|
+
// dir={'rtl'}
|
|
60
|
+
className={cn(
|
|
61
|
+
toastVariants({ variant, severity }),
|
|
62
|
+
className
|
|
63
|
+
// severity === "error" && "bg-red-500"
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
65
67
|
)
|
|
66
68
|
})
|
|
67
69
|
Toast.displayName = ToastPrimitives.Root.displayName
|
package/src/elements/Toaster.tsx
CHANGED
|
@@ -5,29 +5,37 @@ import {
|
|
|
5
5
|
ToastProvider,
|
|
6
6
|
ToastTitle,
|
|
7
7
|
ToastViewport,
|
|
8
|
-
} from
|
|
9
|
-
import { useToast } from
|
|
8
|
+
} from "./Toast"
|
|
9
|
+
import { useToast } from "../hooks/useToast"
|
|
10
|
+
import { cn } from "../util"
|
|
11
|
+
import { DirectionProvider } from "@radix-ui/react-direction"
|
|
10
12
|
|
|
11
|
-
export function Toaster() {
|
|
13
|
+
export function Toaster(props) {
|
|
12
14
|
const { toasts } = useToast()
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
<DirectionProvider dir={"rtl"}>
|
|
18
|
+
<ToastProvider
|
|
19
|
+
swipeDirection={props.direction === "rtl" ? "left" : "right"}
|
|
20
|
+
>
|
|
21
|
+
{toasts.map(function ({ id, title, description, action, ...props }) {
|
|
22
|
+
return (
|
|
23
|
+
<Toast direction={props.direction} key={id} {...props}>
|
|
24
|
+
<div className="grid gap-1">
|
|
25
|
+
{title && <ToastTitle>{title}</ToastTitle>}
|
|
26
|
+
{description && (
|
|
27
|
+
<ToastDescription>{description}</ToastDescription>
|
|
28
|
+
)}
|
|
29
|
+
</div>
|
|
30
|
+
{action}
|
|
31
|
+
<ToastClose />
|
|
32
|
+
</Toast>
|
|
33
|
+
)
|
|
34
|
+
})}
|
|
35
|
+
<ToastViewport
|
|
36
|
+
className={cn("gap-2", props.direction === "rtl" && "fixed left-0")}
|
|
37
|
+
/>
|
|
38
|
+
</ToastProvider>
|
|
39
|
+
</DirectionProvider>
|
|
32
40
|
)
|
|
33
41
|
}
|
package/src/elements/Tooltip.tsx
CHANGED
|
@@ -25,9 +25,7 @@ const TooltipArrow = React.forwardRef<
|
|
|
25
25
|
<TooltipPrimitive.Arrow
|
|
26
26
|
ref={ref}
|
|
27
27
|
className={cn(
|
|
28
|
-
// "
|
|
29
|
-
"bg-red-500 text-blue-500 ",
|
|
30
|
-
// "z-50 overflow-hidden rounded-md border bg-popover 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",
|
|
28
|
+
// "fill-white",
|
|
31
29
|
className
|
|
32
30
|
)}
|
|
33
31
|
{...props}
|