@sikka/hawa 0.1.95 → 0.1.97
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 +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +63 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -44
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +7 -1
- package/package.json +3 -3
- package/src/blocks/AuthForms/NewPasswordForm.tsx +3 -1
- package/src/elements/DropdownMenu.tsx +103 -60
- package/src/elements/HawaRadio.tsx +3 -2
- package/src/elements/HawaStats.tsx +6 -0
- package/src/elements/HawaTable.tsx +5 -2
- package/src/layout/AppLayout.tsx +4 -2
- package/src/styles.css +7 -1
- package/src/tailwind.css +1 -1
package/dist/styles.css
CHANGED
|
@@ -422,7 +422,7 @@ video {
|
|
|
422
422
|
--border: 240 5.9% 90%;
|
|
423
423
|
--input: 240 5.9% 90%;
|
|
424
424
|
--ring: 240 5% 64.9%;
|
|
425
|
-
--radius:
|
|
425
|
+
--radius: 1rem;
|
|
426
426
|
--radius-inner: calc(var(--radius) - calc(var(--radius) / 3));
|
|
427
427
|
|
|
428
428
|
--layout-primary-700: #b7aff7;
|
|
@@ -1194,6 +1194,9 @@ video {
|
|
|
1194
1194
|
.h-\[400px\] {
|
|
1195
1195
|
height: 400px;
|
|
1196
1196
|
}
|
|
1197
|
+
.h-\[80px\] {
|
|
1198
|
+
height: 80px;
|
|
1199
|
+
}
|
|
1197
1200
|
.h-\[calc\(100\%-3\.5rem\)\] {
|
|
1198
1201
|
height: calc(100% - 3.5rem);
|
|
1199
1202
|
}
|
|
@@ -2489,6 +2492,9 @@ video {
|
|
|
2489
2492
|
font-size: 3.75rem;
|
|
2490
2493
|
line-height: 1;
|
|
2491
2494
|
}
|
|
2495
|
+
.text-\[0\.70rem\] {
|
|
2496
|
+
font-size: 0.70rem;
|
|
2497
|
+
}
|
|
2492
2498
|
.text-\[0\.75rem\] {
|
|
2493
2499
|
font-size: 0.75rem;
|
|
2494
2500
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.97",
|
|
4
4
|
"description": "Modern UI Kit made with Tailwind & Radix Primitives",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@storybook/addon-actions": "^6.5.8",
|
|
49
49
|
"@storybook/addon-docs": "^6.5.8",
|
|
50
50
|
"@storybook/addon-essentials": "^6.5.8",
|
|
51
|
+
"@storybook/addon-info": "^5.3.21",
|
|
51
52
|
"@storybook/addon-links": "^6.5.8",
|
|
52
53
|
"@storybook/addon-postcss": "^2.0.0",
|
|
53
|
-
"@storybook/addon-info": "^5.3.21",
|
|
54
54
|
"@storybook/addons": "^6.5.8",
|
|
55
55
|
"@storybook/api": "^7.3.2",
|
|
56
56
|
"@storybook/builder-webpack5": "^6.5.13",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"react-dom": "^18.2.0",
|
|
77
77
|
"react-phone-input-2": "^2.15.1",
|
|
78
78
|
"react-transition-group": "^4.4.2",
|
|
79
|
+
"recharts": "^2.8.0",
|
|
79
80
|
"rollup": "^2.38.4",
|
|
80
81
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
81
82
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
@@ -92,7 +93,6 @@
|
|
|
92
93
|
"typescript": "^4.8.4",
|
|
93
94
|
"webpack": "^5.75.0"
|
|
94
95
|
},
|
|
95
|
-
|
|
96
96
|
"resolutions": {
|
|
97
97
|
"@storybook/react-docgen-typescript-plugin": "npm:react-docgen-typescript-plugin@1.0.2",
|
|
98
98
|
"@storybook/react/webpack": "^5",
|
|
@@ -13,6 +13,8 @@ import { Button } from "../../elements/Button"
|
|
|
13
13
|
|
|
14
14
|
type NewPasswordTypes = {
|
|
15
15
|
handleNewPassword: () => void
|
|
16
|
+
direction?: "rtl" | "ltr"
|
|
17
|
+
|
|
16
18
|
passwordChanged: any
|
|
17
19
|
texts: {
|
|
18
20
|
passwordPlaceholder: string
|
|
@@ -45,7 +47,7 @@ export const NewPasswordForm: FC<NewPasswordTypes> = (props) => {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
|
-
<Card>
|
|
50
|
+
<Card dir={props.direction}>
|
|
49
51
|
{matchError && (
|
|
50
52
|
<HawaAlert text={props.texts.passwordMatchError} severity="error" />
|
|
51
53
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
-
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
4
|
import { cn } from "../util"
|
|
5
5
|
|
|
6
6
|
const DropdownMenuRoot = DropdownMenuPrimitive.Root
|
|
@@ -241,13 +241,13 @@ export type SubItem = {
|
|
|
241
241
|
highlighted?: boolean
|
|
242
242
|
disabled?: boolean
|
|
243
243
|
}
|
|
244
|
-
|
|
245
244
|
export type MenuItemType = {
|
|
246
245
|
icon?: any
|
|
247
|
-
label
|
|
248
|
-
value
|
|
246
|
+
label?: string
|
|
247
|
+
value?: string
|
|
249
248
|
end?: any
|
|
250
249
|
presist?: boolean
|
|
250
|
+
type?: "separator" | "label"
|
|
251
251
|
action?: () => void
|
|
252
252
|
highlighted?: boolean
|
|
253
253
|
subitems?: SubItem[] // Note the use of the optional modifier
|
|
@@ -265,8 +265,29 @@ interface DropdownMenuProps {
|
|
|
265
265
|
align?: ExtendedDropdownMenuContentProps["align"]
|
|
266
266
|
alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
|
|
267
267
|
width?: "default" | "sm" | "lg" | "parent"
|
|
268
|
+
size?: "default" | "sm"
|
|
268
269
|
selectCallback?: any
|
|
269
270
|
}
|
|
271
|
+
|
|
272
|
+
// const dropDownMenuVariants = cva(
|
|
273
|
+
// "inline-flex items-center justify-center select-none rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
274
|
+
// {
|
|
275
|
+
// variants: {
|
|
276
|
+
// width: {
|
|
277
|
+
// default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
278
|
+
// },
|
|
279
|
+
// size: {
|
|
280
|
+
// default: "h-10 px-4 py-2",
|
|
281
|
+
// sm: "h-9 rounded-md px-3",
|
|
282
|
+
// },
|
|
283
|
+
// },
|
|
284
|
+
// defaultVariants: {
|
|
285
|
+
// width: "default",
|
|
286
|
+
// size: "default",
|
|
287
|
+
// },
|
|
288
|
+
// }
|
|
289
|
+
// )
|
|
290
|
+
|
|
270
291
|
export const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
271
292
|
trigger,
|
|
272
293
|
items,
|
|
@@ -279,6 +300,7 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
|
279
300
|
align,
|
|
280
301
|
alignOffset,
|
|
281
302
|
selectCallback,
|
|
303
|
+
size = "default",
|
|
282
304
|
width = "default",
|
|
283
305
|
}) => {
|
|
284
306
|
const widthStyles = {
|
|
@@ -287,6 +309,10 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
|
287
309
|
lg: "w-[200px]",
|
|
288
310
|
parent: "ddm-w-parent",
|
|
289
311
|
}
|
|
312
|
+
const sizeStyles = {
|
|
313
|
+
default: "px-2 py-3 ",
|
|
314
|
+
sm: "text-xs px-1.5 py-1.5",
|
|
315
|
+
}
|
|
290
316
|
return (
|
|
291
317
|
<DropdownMenuRoot dir={direction}>
|
|
292
318
|
<DropdownMenuTrigger className={triggerClassname}>
|
|
@@ -301,64 +327,81 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
|
301
327
|
alignOffset={alignOffset}
|
|
302
328
|
>
|
|
303
329
|
{items.map((item, index) => {
|
|
304
|
-
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
<
|
|
311
|
-
<
|
|
312
|
-
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
330
|
+
if (item.type === "separator") {
|
|
331
|
+
return <DropdownMenuSeparator />
|
|
332
|
+
} else if (item.type === "label") {
|
|
333
|
+
return <DropdownMenuLabel>{item.label}</DropdownMenuLabel>
|
|
334
|
+
} else {
|
|
335
|
+
return item.subitems ? (
|
|
336
|
+
<DropdownMenuSub key={index}>
|
|
337
|
+
<DropdownMenuSubTrigger
|
|
338
|
+
className={cn(sizeStyles[size])}
|
|
339
|
+
dir={direction}
|
|
340
|
+
>
|
|
341
|
+
{item.icon && item.icon}
|
|
342
|
+
{item.label && item.label}
|
|
343
|
+
</DropdownMenuSubTrigger>
|
|
344
|
+
<DropdownMenuPortal>
|
|
345
|
+
<DropdownMenuSubContent>
|
|
346
|
+
{item.subitems.map((subitem, subIndex) => (
|
|
347
|
+
<DropdownMenuItem
|
|
348
|
+
className={cn(
|
|
349
|
+
sizeStyles[size],
|
|
350
|
+
|
|
351
|
+
!item.icon && !item.label
|
|
352
|
+
? "px-0 py-0 focus:bg-transparent"
|
|
353
|
+
: "focus:bg-accent"
|
|
354
|
+
)}
|
|
355
|
+
disabled={subitem.disabled}
|
|
356
|
+
// className="flex flex-row gap-2"
|
|
357
|
+
onSelect={() => {
|
|
358
|
+
subitem.action()
|
|
359
|
+
if (selectCallback) {
|
|
360
|
+
selectCallback(subitem.value)
|
|
361
|
+
}
|
|
362
|
+
}}
|
|
363
|
+
key={subIndex}
|
|
364
|
+
>
|
|
365
|
+
{subitem.icon && subitem.icon}
|
|
366
|
+
{subitem.label && subitem.label}
|
|
367
|
+
</DropdownMenuItem>
|
|
368
|
+
))}
|
|
369
|
+
</DropdownMenuSubContent>
|
|
370
|
+
</DropdownMenuPortal>
|
|
371
|
+
</DropdownMenuSub>
|
|
372
|
+
) : (
|
|
373
|
+
<DropdownMenuItem
|
|
374
|
+
disabled={item.disabled}
|
|
375
|
+
key={index}
|
|
376
|
+
onSelect={(e) => {
|
|
377
|
+
if (item.presist) {
|
|
378
|
+
e.preventDefault()
|
|
344
379
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
selectCallback
|
|
380
|
+
if (item.action) {
|
|
381
|
+
item.action()
|
|
382
|
+
if (selectCallback) {
|
|
383
|
+
selectCallback(item.value)
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
if (selectCallback) {
|
|
387
|
+
selectCallback(item.value)
|
|
388
|
+
}
|
|
348
389
|
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
390
|
+
}}
|
|
391
|
+
end={item.end}
|
|
392
|
+
className={cn(
|
|
393
|
+
sizeStyles[size],
|
|
394
|
+
!item.icon && !item.label
|
|
395
|
+
? "px-0 py-0 focus:bg-transparent "
|
|
396
|
+
: "focus:bg-accent ",
|
|
397
|
+
item.presist && "focus:bg-transparent"
|
|
398
|
+
)}
|
|
399
|
+
>
|
|
400
|
+
{item.icon && item.icon}
|
|
401
|
+
{item.label && item.label}
|
|
402
|
+
</DropdownMenuItem>
|
|
403
|
+
)
|
|
404
|
+
}
|
|
362
405
|
})}
|
|
363
406
|
</DropdownMenuContent>
|
|
364
407
|
</DropdownMenuPortal>
|
|
@@ -55,7 +55,7 @@ export const HawaRadio: FC<RadioTypes> = ({
|
|
|
55
55
|
: "",
|
|
56
56
|
"select-none whitespace-nowrap rounded border text-center text-sm font-medium",
|
|
57
57
|
widthStyle[width],
|
|
58
|
-
orientationStyle[orientation]
|
|
58
|
+
orientationStyle[orientation]
|
|
59
59
|
)}
|
|
60
60
|
>
|
|
61
61
|
{props.options?.map((opt: any, o) => (
|
|
@@ -66,7 +66,7 @@ export const HawaRadio: FC<RadioTypes> = ({
|
|
|
66
66
|
props.onChangeTab(opt.value)
|
|
67
67
|
}}
|
|
68
68
|
className={cn(
|
|
69
|
-
"w-full cursor-pointer",
|
|
69
|
+
"w-full cursor-pointer ",
|
|
70
70
|
orientation === "horizontal" &&
|
|
71
71
|
parentDirection === "ltr" &&
|
|
72
72
|
"rounded-none first:rounded-l last:rounded-r",
|
|
@@ -78,6 +78,7 @@ export const HawaRadio: FC<RadioTypes> = ({
|
|
|
78
78
|
|
|
79
79
|
"last flex flex-row items-center justify-center gap-2 ",
|
|
80
80
|
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
|
81
|
+
// "bg-red-500"
|
|
81
82
|
)}
|
|
82
83
|
key={o}
|
|
83
84
|
>
|
|
@@ -7,6 +7,7 @@ type StatTypes = {
|
|
|
7
7
|
color?: string
|
|
8
8
|
number?: string
|
|
9
9
|
helperText?: string
|
|
10
|
+
chart?: any
|
|
10
11
|
icon?: any
|
|
11
12
|
variant?:
|
|
12
13
|
| "default"
|
|
@@ -39,6 +40,11 @@ export const HawaStats: FC<StatTypes> = ({ variant = "default", ...props }) => {
|
|
|
39
40
|
<p className="text-xs text-muted-foreground">{props.helperText}</p>
|
|
40
41
|
)
|
|
41
42
|
)}
|
|
43
|
+
{props.isLoading && props.chart ? (
|
|
44
|
+
<Skeleton className="mt-2 h-4 w-1/2" />
|
|
45
|
+
) : (
|
|
46
|
+
props.chart
|
|
47
|
+
)}
|
|
42
48
|
</CardContent>
|
|
43
49
|
</Card>
|
|
44
50
|
)
|
|
@@ -23,6 +23,8 @@ type TableTypes = {
|
|
|
23
23
|
pagination?: boolean
|
|
24
24
|
columns: ColTypes[]
|
|
25
25
|
actions?: MenuItemType[]
|
|
26
|
+
actionsWidth?: "default" | "sm" | "lg" | "parent"
|
|
27
|
+
actionsSize?: "default" | "sm"
|
|
26
28
|
direction?: "rtl" | "ltr"
|
|
27
29
|
rows?: RowTypes[][]
|
|
28
30
|
handleActionClick?: any
|
|
@@ -110,7 +112,7 @@ export const HawaTable: FC<TableTypes> = ({
|
|
|
110
112
|
}, [slice, page])
|
|
111
113
|
|
|
112
114
|
return (
|
|
113
|
-
<div className="relative flex flex-col gap-2
|
|
115
|
+
<div className="relative flex flex-col gap-2 ">
|
|
114
116
|
<div className={`overflow-x-auto rounded bg-${headerColor}`}>
|
|
115
117
|
{props.headerTools && (
|
|
116
118
|
<div className="flex flex-row items-center justify-between gap-2 border bg-background px-2 py-2">
|
|
@@ -265,7 +267,8 @@ export const HawaTable: FC<TableTypes> = ({
|
|
|
265
267
|
>
|
|
266
268
|
<div className="flex items-center justify-center">
|
|
267
269
|
<DropdownMenu
|
|
268
|
-
width=
|
|
270
|
+
width={props.actionsWidth}
|
|
271
|
+
size={props.actionsSize}
|
|
269
272
|
direction={direction}
|
|
270
273
|
side="right"
|
|
271
274
|
items={props.actions}
|
package/src/layout/AppLayout.tsx
CHANGED
|
@@ -24,6 +24,7 @@ type AppLayoutTypes = {
|
|
|
24
24
|
avatarImage?: any
|
|
25
25
|
drawerSize?: "sm" | "md" | "large"
|
|
26
26
|
profileMenuItems?: MenuItemType[]
|
|
27
|
+
profileMenuWidth: "default" | "sm" | "lg" | "parent"
|
|
27
28
|
onSettingsClick?: () => void
|
|
28
29
|
DrawerFooterActions?: any
|
|
29
30
|
clickedItem?: any
|
|
@@ -203,7 +204,10 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
203
204
|
alignOffset={8}
|
|
204
205
|
side={"bottom"}
|
|
205
206
|
sideOffset={5}
|
|
207
|
+
width={props.profileMenuWidth}
|
|
206
208
|
direction={isRTL ? "rtl" : "ltr"}
|
|
209
|
+
items={props.profileMenuItems}
|
|
210
|
+
onItemSelect={(e) => console.log("selecting item ", e)}
|
|
207
211
|
trigger={
|
|
208
212
|
<div className="relative h-8 w-8 cursor-pointer overflow-clip rounded ring-1 ring-primary/30 dark:bg-gray-600">
|
|
209
213
|
{props.avatarImage ? (
|
|
@@ -224,8 +228,6 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
224
228
|
)}
|
|
225
229
|
</div>
|
|
226
230
|
}
|
|
227
|
-
items={props.profileMenuItems}
|
|
228
|
-
onItemSelect={(e) => console.log("selecting item ", e)}
|
|
229
231
|
/>
|
|
230
232
|
</div>
|
|
231
233
|
</div>
|
package/src/styles.css
CHANGED
|
@@ -422,7 +422,7 @@ video {
|
|
|
422
422
|
--border: 240 5.9% 90%;
|
|
423
423
|
--input: 240 5.9% 90%;
|
|
424
424
|
--ring: 240 5% 64.9%;
|
|
425
|
-
--radius:
|
|
425
|
+
--radius: 1rem;
|
|
426
426
|
--radius-inner: calc(var(--radius) - calc(var(--radius) / 3));
|
|
427
427
|
|
|
428
428
|
--layout-primary-700: #b7aff7;
|
|
@@ -1194,6 +1194,9 @@ video {
|
|
|
1194
1194
|
.h-\[400px\] {
|
|
1195
1195
|
height: 400px;
|
|
1196
1196
|
}
|
|
1197
|
+
.h-\[80px\] {
|
|
1198
|
+
height: 80px;
|
|
1199
|
+
}
|
|
1197
1200
|
.h-\[calc\(100\%-3\.5rem\)\] {
|
|
1198
1201
|
height: calc(100% - 3.5rem);
|
|
1199
1202
|
}
|
|
@@ -2489,6 +2492,9 @@ video {
|
|
|
2489
2492
|
font-size: 3.75rem;
|
|
2490
2493
|
line-height: 1;
|
|
2491
2494
|
}
|
|
2495
|
+
.text-\[0\.70rem\] {
|
|
2496
|
+
font-size: 0.70rem;
|
|
2497
|
+
}
|
|
2492
2498
|
.text-\[0\.75rem\] {
|
|
2493
2499
|
font-size: 0.75rem;
|
|
2494
2500
|
}
|