@sikka/hawa 0.1.59 → 0.1.61
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/dist/index.d.mts +63 -80
- package/dist/index.d.ts +63 -80
- package/dist/index.js +330 -214
- package/dist/index.mjs +795 -677
- package/dist/styles.css +61 -0
- package/package.json +3 -2
- package/src/elements/Button.tsx +1 -1
- package/src/elements/Dialog.tsx +136 -0
- package/src/elements/DropdownMenu.tsx +16 -16
- package/src/elements/HawaAlert.tsx +9 -5
- package/src/elements/HawaItemCard.tsx +29 -22
- package/src/elements/HawaTable.tsx +3 -20
- package/src/elements/index.ts +1 -0
- package/src/layout/AppLayout.tsx +2 -13
- package/src/layout/HawaAppLayoutSimplified.tsx +2 -13
- package/src/styles.css +61 -0
- package/tools/build-styles.js +0 -17
package/dist/styles.css
CHANGED
|
@@ -794,6 +794,9 @@ video {
|
|
|
794
794
|
.left-7 {
|
|
795
795
|
left: 1.75rem;
|
|
796
796
|
}
|
|
797
|
+
.left-\[50\%\] {
|
|
798
|
+
left: 50%;
|
|
799
|
+
}
|
|
797
800
|
.right-0 {
|
|
798
801
|
right: 0px;
|
|
799
802
|
}
|
|
@@ -842,6 +845,9 @@ video {
|
|
|
842
845
|
.top-\[22px\] {
|
|
843
846
|
top: 22px;
|
|
844
847
|
}
|
|
848
|
+
.top-\[50\%\] {
|
|
849
|
+
top: 50%;
|
|
850
|
+
}
|
|
845
851
|
.top-\[76px\] {
|
|
846
852
|
top: 76px;
|
|
847
853
|
}
|
|
@@ -1474,10 +1480,18 @@ video {
|
|
|
1474
1480
|
--tw-translate-x: 0.125rem;
|
|
1475
1481
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1476
1482
|
}
|
|
1483
|
+
.translate-x-\[-50\%\] {
|
|
1484
|
+
--tw-translate-x: -50%;
|
|
1485
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1486
|
+
}
|
|
1477
1487
|
.translate-y-0 {
|
|
1478
1488
|
--tw-translate-y: 0px;
|
|
1479
1489
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1480
1490
|
}
|
|
1491
|
+
.translate-y-\[-50\%\] {
|
|
1492
|
+
--tw-translate-y: -50%;
|
|
1493
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1494
|
+
}
|
|
1481
1495
|
.-rotate-180 {
|
|
1482
1496
|
--tw-rotate: -180deg;
|
|
1483
1497
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -2002,6 +2016,9 @@ video {
|
|
|
2002
2016
|
.bg-background {
|
|
2003
2017
|
background-color: hsl(var(--background));
|
|
2004
2018
|
}
|
|
2019
|
+
.bg-background\/80 {
|
|
2020
|
+
background-color: hsl(var(--background) / 0.8);
|
|
2021
|
+
}
|
|
2005
2022
|
.bg-black {
|
|
2006
2023
|
--tw-bg-opacity: 1;
|
|
2007
2024
|
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
|
|
@@ -2732,6 +2749,9 @@ video {
|
|
|
2732
2749
|
.opacity-60 {
|
|
2733
2750
|
opacity: 0.6;
|
|
2734
2751
|
}
|
|
2752
|
+
.opacity-70 {
|
|
2753
|
+
opacity: 0.7;
|
|
2754
|
+
}
|
|
2735
2755
|
.opacity-90 {
|
|
2736
2756
|
opacity: 0.9;
|
|
2737
2757
|
}
|
|
@@ -2843,6 +2863,11 @@ video {
|
|
|
2843
2863
|
.filter {
|
|
2844
2864
|
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);
|
|
2845
2865
|
}
|
|
2866
|
+
.backdrop-blur-sm {
|
|
2867
|
+
--tw-backdrop-blur: blur(4px);
|
|
2868
|
+
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
|
2869
|
+
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
|
2870
|
+
}
|
|
2846
2871
|
.transition {
|
|
2847
2872
|
transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-text-decoration-color, -webkit-backdrop-filter;
|
|
2848
2873
|
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
|
|
@@ -3233,6 +3258,9 @@ body {
|
|
|
3233
3258
|
.hover\:decoration-2:hover {
|
|
3234
3259
|
text-decoration-thickness: 2px;
|
|
3235
3260
|
}
|
|
3261
|
+
.hover\:opacity-100:hover {
|
|
3262
|
+
opacity: 1;
|
|
3263
|
+
}
|
|
3236
3264
|
.hover\:opacity-50:hover {
|
|
3237
3265
|
opacity: 0.5;
|
|
3238
3266
|
}
|
|
@@ -3612,6 +3640,9 @@ body {
|
|
|
3612
3640
|
.data-\[state\=active\]\:text-primary-foreground[data-state=active] {
|
|
3613
3641
|
color: hsl(var(--primary-foreground));
|
|
3614
3642
|
}
|
|
3643
|
+
.data-\[state\=open\]\:text-muted-foreground[data-state=open] {
|
|
3644
|
+
color: hsl(var(--muted-foreground));
|
|
3645
|
+
}
|
|
3615
3646
|
.data-\[state\=open\]\:text-violet-11[data-state=open] {
|
|
3616
3647
|
--tw-text-opacity: 1;
|
|
3617
3648
|
color: hsl(250 43.0% 48.0% / var(--tw-text-opacity));
|
|
@@ -3681,12 +3712,24 @@ body {
|
|
|
3681
3712
|
.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top] {
|
|
3682
3713
|
--tw-enter-translate-y: 0.5rem;
|
|
3683
3714
|
}
|
|
3715
|
+
.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed] {
|
|
3716
|
+
--tw-exit-translate-x: -50%;
|
|
3717
|
+
}
|
|
3684
3718
|
.data-\[state\=closed\]\:slide-out-to-left-full[data-state=closed] {
|
|
3685
3719
|
--tw-exit-translate-x: -100%;
|
|
3686
3720
|
}
|
|
3687
3721
|
.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed] {
|
|
3688
3722
|
--tw-exit-translate-x: 100%;
|
|
3689
3723
|
}
|
|
3724
|
+
.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed] {
|
|
3725
|
+
--tw-exit-translate-y: -48%;
|
|
3726
|
+
}
|
|
3727
|
+
.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open] {
|
|
3728
|
+
--tw-enter-translate-x: -50%;
|
|
3729
|
+
}
|
|
3730
|
+
.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open] {
|
|
3731
|
+
--tw-enter-translate-y: -48%;
|
|
3732
|
+
}
|
|
3690
3733
|
.data-\[state\=open\]\:slide-in-from-top-full[data-state=open] {
|
|
3691
3734
|
--tw-enter-translate-y: -100%;
|
|
3692
3735
|
}
|
|
@@ -4023,6 +4066,10 @@ body {
|
|
|
4023
4066
|
flex-direction: column;
|
|
4024
4067
|
}
|
|
4025
4068
|
|
|
4069
|
+
.sm\:justify-end {
|
|
4070
|
+
justify-content: flex-end;
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4026
4073
|
.sm\:gap-0 {
|
|
4027
4074
|
gap: 0px;
|
|
4028
4075
|
}
|
|
@@ -4031,6 +4078,16 @@ body {
|
|
|
4031
4078
|
gap: 2rem;
|
|
4032
4079
|
}
|
|
4033
4080
|
|
|
4081
|
+
.sm\:space-x-2 > :not([hidden]) ~ :not([hidden]) {
|
|
4082
|
+
--tw-space-x-reverse: 0;
|
|
4083
|
+
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
|
|
4084
|
+
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
.sm\:rounded-lg {
|
|
4088
|
+
border-radius: var(--radius);
|
|
4089
|
+
}
|
|
4090
|
+
|
|
4034
4091
|
.sm\:rounded-b-none {
|
|
4035
4092
|
border-bottom-right-radius: 0px;
|
|
4036
4093
|
border-bottom-left-radius: 0px;
|
|
@@ -4044,6 +4101,10 @@ body {
|
|
|
4044
4101
|
padding: 5rem;
|
|
4045
4102
|
}
|
|
4046
4103
|
|
|
4104
|
+
.sm\:text-left {
|
|
4105
|
+
text-align: left;
|
|
4106
|
+
}
|
|
4107
|
+
|
|
4047
4108
|
.sm\:text-2xl {
|
|
4048
4109
|
font-size: 1.5rem;
|
|
4049
4110
|
line-height: 2rem;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "Modern UI Kit made with Tailwind & Radix Primitives",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
8
9
|
"author": {
|
|
9
10
|
"name": "Sikka Software",
|
|
10
11
|
"email": "contact@sikka.io",
|
|
11
12
|
"url": "http://sikka.io"
|
|
12
13
|
},
|
|
13
|
-
"license": "MIT",
|
|
14
14
|
"keywords": [
|
|
15
15
|
"ui",
|
|
16
16
|
"kit",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
113
|
+
"@radix-ui/react-dialog": "^1.0.4",
|
|
113
114
|
"@radix-ui/react-direction": "^1.0.1",
|
|
114
115
|
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
|
115
116
|
"@radix-ui/react-label": "^2.0.2",
|
package/src/elements/Button.tsx
CHANGED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
// import { X } from "lucide-react"
|
|
6
|
+
import { cn } from "../util"
|
|
7
|
+
|
|
8
|
+
const Dialog = DialogPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const DialogPortal = ({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: DialogPrimitive.DialogPortalProps) => (
|
|
16
|
+
<DialogPrimitive.Portal className={cn(className)} {...props} />
|
|
17
|
+
)
|
|
18
|
+
DialogPortal.displayName = DialogPrimitive.Portal.displayName
|
|
19
|
+
|
|
20
|
+
const DialogOverlay = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<DialogPrimitive.Overlay
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(
|
|
27
|
+
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
34
|
+
|
|
35
|
+
const DialogContent = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
37
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
38
|
+
>(({ className, children, ...props }, ref) => (
|
|
39
|
+
<DialogPortal>
|
|
40
|
+
<DialogOverlay />
|
|
41
|
+
<DialogPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
51
|
+
{/* <X className="h-4 w-4" /> */}
|
|
52
|
+
|
|
53
|
+
<svg
|
|
54
|
+
aria-label="Close Icon"
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
className="h-5 w-5"
|
|
57
|
+
fill="currentColor"
|
|
58
|
+
viewBox="0 0 20 20"
|
|
59
|
+
>
|
|
60
|
+
<path
|
|
61
|
+
fillRule="evenodd"
|
|
62
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
63
|
+
clipRule="evenodd"
|
|
64
|
+
></path>
|
|
65
|
+
</svg>
|
|
66
|
+
<span className="sr-only">Close</span>
|
|
67
|
+
</DialogPrimitive.Close>
|
|
68
|
+
</DialogPrimitive.Content>
|
|
69
|
+
</DialogPortal>
|
|
70
|
+
))
|
|
71
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
72
|
+
|
|
73
|
+
const DialogHeader = ({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
77
|
+
<div
|
|
78
|
+
className={cn(
|
|
79
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
80
|
+
className
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
85
|
+
DialogHeader.displayName = "DialogHeader"
|
|
86
|
+
|
|
87
|
+
const DialogFooter = ({
|
|
88
|
+
className,
|
|
89
|
+
...props
|
|
90
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
91
|
+
<div
|
|
92
|
+
className={cn(
|
|
93
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
DialogFooter.displayName = "DialogFooter"
|
|
100
|
+
|
|
101
|
+
const DialogTitle = React.forwardRef<
|
|
102
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
103
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
104
|
+
>(({ className, ...props }, ref) => (
|
|
105
|
+
<DialogPrimitive.Title
|
|
106
|
+
ref={ref}
|
|
107
|
+
className={cn(
|
|
108
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
))
|
|
114
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
115
|
+
|
|
116
|
+
const DialogDescription = React.forwardRef<
|
|
117
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
118
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
119
|
+
>(({ className, ...props }, ref) => (
|
|
120
|
+
<DialogPrimitive.Description
|
|
121
|
+
ref={ref}
|
|
122
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
))
|
|
126
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
Dialog,
|
|
130
|
+
DialogTrigger,
|
|
131
|
+
DialogContent,
|
|
132
|
+
DialogHeader,
|
|
133
|
+
DialogFooter,
|
|
134
|
+
DialogTitle,
|
|
135
|
+
DialogDescription,
|
|
136
|
+
}
|
|
@@ -232,7 +232,7 @@ type ExtendedDropdownMenuTriggerProps = Partial<
|
|
|
232
232
|
// side?: "left" | "right" | "top" | "bottom"
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
type SubItem = {
|
|
235
|
+
export type SubItem = {
|
|
236
236
|
label: string
|
|
237
237
|
value: string
|
|
238
238
|
icon?: any
|
|
@@ -240,7 +240,7 @@ type SubItem = {
|
|
|
240
240
|
highlighted?: boolean
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
type
|
|
243
|
+
export type MenuItemType = {
|
|
244
244
|
icon?: any
|
|
245
245
|
label: string
|
|
246
246
|
value: string
|
|
@@ -250,8 +250,20 @@ type Item = {
|
|
|
250
250
|
highlighted?: boolean
|
|
251
251
|
subitems?: SubItem[] // Note the use of the optional modifier
|
|
252
252
|
}
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
interface DropdownMenuProps {
|
|
254
|
+
trigger?: any
|
|
255
|
+
items?: MenuItemType[]
|
|
256
|
+
direction?: "rtl" | "ltr"
|
|
257
|
+
onItemSelect?: any
|
|
258
|
+
className?: ExtendedDropdownMenuContentProps["className"]
|
|
259
|
+
triggerClassname?: ExtendedDropdownMenuTriggerProps["className"]
|
|
260
|
+
sideOffset?: ExtendedDropdownMenuContentProps["sideOffset"]
|
|
261
|
+
side?: ExtendedDropdownMenuContentProps["side"]
|
|
262
|
+
align?: ExtendedDropdownMenuContentProps["align"]
|
|
263
|
+
alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
|
|
264
|
+
width?: "default" | "sm" | "lg" | "parent"
|
|
265
|
+
}
|
|
266
|
+
export const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
255
267
|
trigger,
|
|
256
268
|
items,
|
|
257
269
|
direction,
|
|
@@ -263,18 +275,6 @@ export const DropdownMenu = ({
|
|
|
263
275
|
align,
|
|
264
276
|
alignOffset,
|
|
265
277
|
width = "default",
|
|
266
|
-
}: {
|
|
267
|
-
trigger?: any
|
|
268
|
-
items?: Item[]
|
|
269
|
-
direction?: "rtl" | "ltr"
|
|
270
|
-
onItemSelect?: any
|
|
271
|
-
className?: ExtendedDropdownMenuContentProps["className"]
|
|
272
|
-
triggerClassname?: ExtendedDropdownMenuTriggerProps["className"]
|
|
273
|
-
sideOffset?: ExtendedDropdownMenuContentProps["sideOffset"]
|
|
274
|
-
side?: ExtendedDropdownMenuContentProps["side"]
|
|
275
|
-
align?: ExtendedDropdownMenuContentProps["align"]
|
|
276
|
-
alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
|
|
277
|
-
width?: "default" | "sm" | "lg" | "parent"
|
|
278
278
|
}) => {
|
|
279
279
|
const widthStyles = {
|
|
280
280
|
default: "min-w-[8rem]",
|
|
@@ -5,7 +5,7 @@ import { Button } from "./Button"
|
|
|
5
5
|
// TODO: make handleClose to detect when the alert is closed from outside this component
|
|
6
6
|
|
|
7
7
|
type AlertTypes = {
|
|
8
|
-
severity
|
|
8
|
+
severity?: "info" | "warning" | "error" | "success"
|
|
9
9
|
/** The title of the alert placed above the text of the alert. Can be used alone */
|
|
10
10
|
title?: any
|
|
11
11
|
/** The text of the alert placed below the title of the alert. Can be used alone */
|
|
@@ -35,12 +35,15 @@ type AlertTypes = {
|
|
|
35
35
|
]
|
|
36
36
|
persistant?: boolean
|
|
37
37
|
icon?: any
|
|
38
|
+
className?: any
|
|
38
39
|
}
|
|
39
40
|
export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
40
41
|
variant = "normal",
|
|
41
42
|
direction = "ltr",
|
|
43
|
+
severity = "info",
|
|
42
44
|
duration,
|
|
43
45
|
icon,
|
|
46
|
+
className,
|
|
44
47
|
...props
|
|
45
48
|
}) => {
|
|
46
49
|
const alertRef = useRef(null)
|
|
@@ -127,8 +130,9 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
127
130
|
<div
|
|
128
131
|
className={clsx(
|
|
129
132
|
"relative mb-4 flex flex-col rounded p-4 text-sm transition-all",
|
|
130
|
-
styleVariant[variant][
|
|
131
|
-
closed ? "opacity-0" : "opacity-100"
|
|
133
|
+
styleVariant[variant][severity],
|
|
134
|
+
closed ? "opacity-0" : "opacity-100",
|
|
135
|
+
className
|
|
132
136
|
)}
|
|
133
137
|
role="alert"
|
|
134
138
|
dir={direction}
|
|
@@ -148,7 +152,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
148
152
|
>
|
|
149
153
|
{props.title}
|
|
150
154
|
</span>
|
|
151
|
-
<span>{
|
|
155
|
+
<span>{props.text}</span>
|
|
152
156
|
{props.actions && (
|
|
153
157
|
<div className="mt-2 flex flex-row gap-2">
|
|
154
158
|
{props.actions.map((act, index) => (
|
|
@@ -169,7 +173,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
169
173
|
type="button"
|
|
170
174
|
className={clsx(
|
|
171
175
|
"absolute top-2 inline-flex h-9 w-9 items-center justify-center rounded-inner p-1.5 text-gray-400 transition-all hover:text-gray-900",
|
|
172
|
-
closeButtonStyle[
|
|
176
|
+
closeButtonStyle[severity],
|
|
173
177
|
direction === "rtl" ? "left-2" : "right-2"
|
|
174
178
|
)}
|
|
175
179
|
data-dismiss-target="#alert-default"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState, FC } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Button } from "./Button"
|
|
4
|
+
import { DropdownMenu, MenuItemType } from "./DropdownMenu"
|
|
5
5
|
|
|
6
6
|
interface ItemCardTypes {
|
|
7
|
-
headerActions?:
|
|
7
|
+
headerActions?: MenuItemType[]
|
|
8
|
+
// headerActions?: THeaderActions[]
|
|
8
9
|
header?: any
|
|
9
10
|
content?: any
|
|
10
11
|
/** a URL for the image of the card */
|
|
@@ -29,6 +30,7 @@ interface ItemCardTypes {
|
|
|
29
30
|
|
|
30
31
|
type THeaderActions = {
|
|
31
32
|
icon?: JSX.Element
|
|
33
|
+
value?: string
|
|
32
34
|
label: string
|
|
33
35
|
action?: (e: any) => void
|
|
34
36
|
isButton?: boolean
|
|
@@ -97,13 +99,15 @@ export const HawaItemCard: FC<ItemCardTypes> = ({
|
|
|
97
99
|
/>
|
|
98
100
|
{clickableImage && (
|
|
99
101
|
<div className="absolute left-0 top-0 flex h-full w-full items-center justify-center opacity-0 transition-all group-hover:opacity-100 ">
|
|
100
|
-
<
|
|
101
|
-
startIcon={clickableImageActionIcon}
|
|
102
|
-
variant="
|
|
102
|
+
<Button
|
|
103
|
+
// startIcon={clickableImageActionIcon}
|
|
104
|
+
variant="secondary"
|
|
103
105
|
onClick={clickableImageAction}
|
|
106
|
+
className="flex flex-row gap-2"
|
|
104
107
|
>
|
|
108
|
+
{clickableImageActionIcon}
|
|
105
109
|
{clickableImageActionText}
|
|
106
|
-
</
|
|
110
|
+
</Button>
|
|
107
111
|
</div>
|
|
108
112
|
)}
|
|
109
113
|
</div>
|
|
@@ -111,22 +115,25 @@ export const HawaItemCard: FC<ItemCardTypes> = ({
|
|
|
111
115
|
<div className="relative w-full p-6">
|
|
112
116
|
{headerActions && (
|
|
113
117
|
<div className="max-h- bg-red absolute right-0 top-0 flex justify-end pr-3 pt-3">
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<svg
|
|
121
|
-
className="h-6 w-6"
|
|
122
|
-
aria-hidden="true"
|
|
123
|
-
fill="currentColor"
|
|
124
|
-
viewBox="0 0 20 20"
|
|
118
|
+
<DropdownMenu
|
|
119
|
+
items={headerActions}
|
|
120
|
+
trigger={
|
|
121
|
+
<div
|
|
122
|
+
className={clsx(headerActionsButtonStyle)}
|
|
123
|
+
onClick={handleOpenActionHeader}
|
|
125
124
|
>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
<span className="sr-only">Open dropdown</span>
|
|
126
|
+
<svg
|
|
127
|
+
className="h-6 w-6"
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
fill="currentColor"
|
|
130
|
+
viewBox="0 0 20 20"
|
|
131
|
+
>
|
|
132
|
+
<path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path>
|
|
133
|
+
</svg>
|
|
134
|
+
</div>
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
130
137
|
</div>
|
|
131
138
|
)}
|
|
132
139
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState, FC } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
-
import { HawaMenu } from "./HawaMenu"
|
|
4
3
|
import useTable from "../hooks/useTable"
|
|
5
|
-
import { HawaTextField } from "./HawaTextField"
|
|
6
|
-
import { HawaButton } from "./HawaButton"
|
|
7
4
|
import { cn } from "../util"
|
|
8
5
|
import { Button } from "./Button"
|
|
9
|
-
import {
|
|
6
|
+
import { HawaTextField } from "./HawaTextField"
|
|
7
|
+
import { DropdownMenu, MenuItemType } from "./DropdownMenu"
|
|
10
8
|
|
|
11
9
|
// TODO: translate header tools and make it more customizable
|
|
12
10
|
// TODO: pass the onSearch handler to the parent
|
|
@@ -24,7 +22,7 @@ type ColTypes = {
|
|
|
24
22
|
type TableTypes = {
|
|
25
23
|
pagination?: boolean
|
|
26
24
|
columns: ColTypes[]
|
|
27
|
-
actions?:
|
|
25
|
+
actions?: MenuItemType[]
|
|
28
26
|
direction?: "rtl" | "ltr"
|
|
29
27
|
rows?: RowTypes[][]
|
|
30
28
|
handleActionClick?: any
|
|
@@ -46,21 +44,6 @@ type TableTypes = {
|
|
|
46
44
|
headerTools?: boolean
|
|
47
45
|
borders?: "all" | "cols" | "rows" | "outer" | "inner"
|
|
48
46
|
}
|
|
49
|
-
type ActionItems = {
|
|
50
|
-
icon?: JSX.Element
|
|
51
|
-
label: string
|
|
52
|
-
action?: (e: any) => void
|
|
53
|
-
isButton?: boolean
|
|
54
|
-
element?: any
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type Item = {
|
|
58
|
-
label: string
|
|
59
|
-
value: string
|
|
60
|
-
action?: () => void
|
|
61
|
-
highlighted?: boolean
|
|
62
|
-
}
|
|
63
|
-
|
|
64
47
|
const ChevronIcon = () => (
|
|
65
48
|
<svg
|
|
66
49
|
aria-label="Chevron Right Icon"
|
package/src/elements/index.ts
CHANGED
package/src/layout/AppLayout.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react"
|
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import useDiscloser from "../hooks/useDiscloser"
|
|
4
4
|
import useBreakpoint from "../hooks/useBreakpoint"
|
|
5
|
-
import { Button, DropdownMenu, Tooltip } from "../elements"
|
|
5
|
+
import { Button, DropdownMenu, MenuItemType, Tooltip } from "../elements"
|
|
6
6
|
import { SidebarGroup } from "./Sidebar"
|
|
7
7
|
|
|
8
8
|
type AppLayoutTypes = {
|
|
@@ -22,7 +22,7 @@ type AppLayoutTypes = {
|
|
|
22
22
|
username?: string
|
|
23
23
|
email?: string
|
|
24
24
|
drawerSize?: "sm" | "md" | "large"
|
|
25
|
-
profileMenuItems?:
|
|
25
|
+
profileMenuItems?: MenuItemType[]
|
|
26
26
|
onSettingsClick?: () => void
|
|
27
27
|
DrawerFooterActions?: any
|
|
28
28
|
clickedItem?: any
|
|
@@ -44,17 +44,6 @@ type SubItem = {
|
|
|
44
44
|
icon?: any
|
|
45
45
|
onClick?: () => void
|
|
46
46
|
}
|
|
47
|
-
type ProfileSubItem = {
|
|
48
|
-
label: string
|
|
49
|
-
value: string
|
|
50
|
-
highlighted?: boolean
|
|
51
|
-
}
|
|
52
|
-
type ProfileItem = {
|
|
53
|
-
label: string
|
|
54
|
-
value: string
|
|
55
|
-
highlighted?: boolean
|
|
56
|
-
subitems?: ProfileSubItem[] // Note the use of the optional modifier
|
|
57
|
-
}
|
|
58
47
|
|
|
59
48
|
export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
60
49
|
direction = "ltr",
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react"
|
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import useDiscloser from "../hooks/useDiscloser"
|
|
4
4
|
import useBreakpoint from "../hooks/useBreakpoint"
|
|
5
|
-
import { Button, DropdownMenu, Tooltip } from "../elements"
|
|
5
|
+
import { Button, DropdownMenu, MenuItemType, Tooltip } from "../elements"
|
|
6
6
|
|
|
7
7
|
type HawaAppLayoutTypes = {
|
|
8
8
|
/** The pages of the side drawer */
|
|
@@ -26,7 +26,7 @@ type HawaAppLayoutTypes = {
|
|
|
26
26
|
username?: string
|
|
27
27
|
email?: string
|
|
28
28
|
drawerSize?: "sm" | "md" | "large"
|
|
29
|
-
profileMenuItems?:
|
|
29
|
+
profileMenuItems?: MenuItemType[]
|
|
30
30
|
onSettingsClick?: () => void
|
|
31
31
|
DrawerFooterActions?: any
|
|
32
32
|
texts?: {
|
|
@@ -34,17 +34,6 @@ type HawaAppLayoutTypes = {
|
|
|
34
34
|
collapseSidebar?: string
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
type SubItem = {
|
|
38
|
-
label: string
|
|
39
|
-
value: string
|
|
40
|
-
highlighted?: boolean
|
|
41
|
-
}
|
|
42
|
-
type Item = {
|
|
43
|
-
label: string
|
|
44
|
-
value: string
|
|
45
|
-
highlighted?: boolean
|
|
46
|
-
subitems?: SubItem[] // Note the use of the optional modifier
|
|
47
|
-
}
|
|
48
37
|
|
|
49
38
|
export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
50
39
|
HawaAppLayoutTypes
|