@sikka/hawa 0.0.265 → 0.0.267
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/.github/workflows/hawa-publish-push.yml +1 -0
- package/dist/styles.css +150 -15
- package/es/elements/DragDropImages.d.ts +2 -0
- package/es/elements/HawaAlert.d.ts +2 -0
- package/es/elements/HawaButton.d.ts +2 -1
- package/es/elements/HawaInlineCode.d.ts +6 -0
- package/es/elements/HawaTable.d.ts +12 -2
- package/es/elements/Timeline.d.ts +13 -0
- package/es/elements/index.d.ts +6 -4
- package/es/hooks/useTable.d.ts +1 -1
- package/es/index.es.js +3 -3
- package/es/layout/Banner.d.ts +14 -0
- package/es/layout/HawaAppLayoutSimplified.d.ts +2 -0
- package/es/layout/index.d.ts +1 -0
- package/lib/elements/DragDropImages.d.ts +2 -0
- package/lib/elements/HawaAlert.d.ts +2 -0
- package/lib/elements/HawaButton.d.ts +2 -1
- package/lib/elements/HawaInlineCode.d.ts +6 -0
- package/lib/elements/HawaTable.d.ts +12 -2
- package/lib/elements/Timeline.d.ts +13 -0
- package/lib/elements/index.d.ts +6 -4
- package/lib/hooks/useTable.d.ts +1 -1
- package/lib/index.js +3 -3
- package/lib/layout/Banner.d.ts +14 -0
- package/lib/layout/HawaAppLayoutSimplified.d.ts +2 -0
- package/lib/layout/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/blocks/Misc/EmptyState.tsx +11 -2
- package/src/blocks/Misc/NoPermission.tsx +11 -2
- package/src/blocks/Pricing/ComparingPlans.tsx +11 -2
- package/src/blocks/Referral/ReferralAccount.tsx +22 -3
- package/src/blocks/Referral/ReferralSettlement.tsx +15 -3
- package/src/elements/DragDropImages.tsx +88 -58
- package/src/elements/HawaAlert.tsx +72 -51
- package/src/elements/HawaButton.tsx +17 -4
- package/src/elements/HawaCodeBlock.tsx +1 -0
- package/src/elements/HawaInlineCode.tsx +9 -0
- package/src/elements/HawaMenu.tsx +2 -2
- package/src/elements/HawaTable.tsx +71 -13
- package/src/elements/Timeline.tsx +35 -0
- package/src/elements/index.ts +6 -4
- package/src/hooks/useTable.ts +129 -4
- package/src/layout/Banner.tsx +123 -0
- package/src/layout/HawaAppLayout.tsx +16 -3
- package/src/layout/HawaAppLayoutSimplified.tsx +125 -85
- package/src/layout/HawaSiteLayout.tsx +16 -3
- package/src/layout/index.ts +1 -0
- package/src/styles.css +150 -15
- package/src/tailwind.css +34 -0
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
-
import { HiMenu } from "react-icons/hi"
|
|
4
|
-
import { FaChevronRight } from "react-icons/fa"
|
|
5
3
|
import useDiscloser from "../hooks/useDiscloser"
|
|
6
4
|
import useBreakpoint from "../hooks/useBreakpoint"
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
// TODO: when no pagetitle, navbar gets messy
|
|
5
|
+
import { HawaMenu } from "../elements"
|
|
10
6
|
|
|
11
7
|
type HawaAppLayoutTypes = {
|
|
8
|
+
/** The pages of the side drawer */
|
|
12
9
|
drawerItems: {
|
|
13
10
|
label: string
|
|
14
11
|
icon: any
|
|
@@ -16,7 +13,9 @@ type HawaAppLayoutTypes = {
|
|
|
16
13
|
action: () => void
|
|
17
14
|
subItems?: any
|
|
18
15
|
}[][]
|
|
16
|
+
// The direction of the layout
|
|
19
17
|
direction?: "rtl" | "ltr"
|
|
18
|
+
// The title of the current selected page, make sure it's the same as the drawerItem slug
|
|
20
19
|
currentPage: string
|
|
21
20
|
pageTitle?: string
|
|
22
21
|
logoSymbol?: any
|
|
@@ -29,6 +28,7 @@ type HawaAppLayoutTypes = {
|
|
|
29
28
|
drawerSize?: "sm" | "md" | "large"
|
|
30
29
|
profileMenuItems?: MenuItems[][]
|
|
31
30
|
onSettingsClick?: () => void
|
|
31
|
+
DrawerFooterActions: any
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
type MenuItems = {
|
|
@@ -39,7 +39,13 @@ type MenuItems = {
|
|
|
39
39
|
}
|
|
40
40
|
export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
41
41
|
HawaAppLayoutTypes
|
|
42
|
-
> = ({
|
|
42
|
+
> = ({
|
|
43
|
+
direction = "rtl",
|
|
44
|
+
drawerSize = "md",
|
|
45
|
+
onSettingsClick,
|
|
46
|
+
DrawerFooterActions,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
43
49
|
const [openSideMenu, setOpenSideMenu] = useState(false)
|
|
44
50
|
const [openSubItem, setOpenSubitem] = useState("")
|
|
45
51
|
const { isOpen, onClose, onOpen } = useDiscloser(false)
|
|
@@ -92,35 +98,32 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
92
98
|
>
|
|
93
99
|
{/* Nav Side Of Navbar */}
|
|
94
100
|
{size > 600 ? (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{props.pageTitle}
|
|
122
|
-
</div>
|
|
123
|
-
) : null
|
|
101
|
+
<div
|
|
102
|
+
className={clsx(
|
|
103
|
+
isRTL
|
|
104
|
+
? [size > 600 ? "mr-14" : "mr-2", keepOpen ? "mr-40" : ""]
|
|
105
|
+
: [size > 600 ? "ml-14" : "ml-2", keepOpen ? "ml-40" : ""]
|
|
106
|
+
)}
|
|
107
|
+
style={
|
|
108
|
+
isRTL
|
|
109
|
+
? {
|
|
110
|
+
marginRight: `${
|
|
111
|
+
drawerSizeStyle[keepOpen ? "opened" : "closed"][
|
|
112
|
+
drawerSize
|
|
113
|
+
]
|
|
114
|
+
}px`,
|
|
115
|
+
}
|
|
116
|
+
: {
|
|
117
|
+
marginLeft: `${
|
|
118
|
+
drawerSizeStyle[keepOpen ? "opened" : "closed"][
|
|
119
|
+
drawerSize
|
|
120
|
+
]
|
|
121
|
+
}px`,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
{props.pageTitle}
|
|
126
|
+
</div>
|
|
124
127
|
) : (
|
|
125
128
|
// Mobile Drawer Menu Button
|
|
126
129
|
<div
|
|
@@ -131,7 +134,22 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
131
134
|
onClick={() => setOpenSideMenu(true)}
|
|
132
135
|
className="z-40 mx-1 cursor-pointer rounded p-2 transition-all hover:bg-gray-100"
|
|
133
136
|
>
|
|
134
|
-
<
|
|
137
|
+
<svg
|
|
138
|
+
stroke="currentColor"
|
|
139
|
+
fill="currentColor"
|
|
140
|
+
stroke-width="0"
|
|
141
|
+
viewBox="0 0 20 20"
|
|
142
|
+
aria-hidden="true"
|
|
143
|
+
height="1.6em"
|
|
144
|
+
width="1.6em"
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
>
|
|
147
|
+
<path
|
|
148
|
+
fill-rule="evenodd"
|
|
149
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
150
|
+
clip-rule="evenodd"
|
|
151
|
+
></path>
|
|
152
|
+
</svg>
|
|
135
153
|
</div>
|
|
136
154
|
{/* Mobile Page Title */}
|
|
137
155
|
{props.pageTitle ? (
|
|
@@ -147,14 +165,11 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
147
165
|
"flex gap-2",
|
|
148
166
|
isRTL ? "flex-row-reverse" : "flex-row"
|
|
149
167
|
)}
|
|
150
|
-
// dir={direction}
|
|
151
168
|
>
|
|
152
169
|
{/* User Info */}
|
|
153
170
|
{size > 600 ? (
|
|
154
171
|
<div
|
|
155
|
-
className={
|
|
156
|
-
isRTL ? "text-left text-xs" : "text-right text-xs"
|
|
157
|
-
)}
|
|
172
|
+
className={isRTL ? "text-left text-xs" : "text-right text-xs"}
|
|
158
173
|
>
|
|
159
174
|
<div className="font-bold">{props.username}</div>{" "}
|
|
160
175
|
<div>{props.email}</div>
|
|
@@ -187,9 +202,6 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
187
202
|
<div
|
|
188
203
|
className={clsx(
|
|
189
204
|
"fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip transition-all",
|
|
190
|
-
// drawerDefaultStyle,
|
|
191
|
-
// "bg-green-400",
|
|
192
|
-
// drawerSizeStyle[drawerSize],
|
|
193
205
|
isRTL ? "right-0" : "left-0"
|
|
194
206
|
)}
|
|
195
207
|
style={{
|
|
@@ -298,8 +310,9 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
298
310
|
)
|
|
299
311
|
? "bg-buttonPrimary-500 text-white"
|
|
300
312
|
: "hover:bg-layoutPrimary-300",
|
|
301
|
-
"
|
|
302
|
-
isRTL ? "flex-row-reverse pr-3" : ""
|
|
313
|
+
"my-1 flex cursor-pointer flex-row items-center justify-between overflow-x-clip rounded p-2 pl-3 transition-all ",
|
|
314
|
+
isRTL ? "flex-row-reverse pr-3" : "",
|
|
315
|
+
openSideMenu ? "m-2" : "m-2"
|
|
303
316
|
)}
|
|
304
317
|
>
|
|
305
318
|
<div className="flex flex-row" dir={direction}>
|
|
@@ -316,22 +329,28 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
316
329
|
</div>
|
|
317
330
|
</div>
|
|
318
331
|
{dItem.subItems && (
|
|
319
|
-
<
|
|
320
|
-
|
|
332
|
+
<ArrowIcon
|
|
333
|
+
color={
|
|
334
|
+
props.currentPage === dItem.slug ||
|
|
335
|
+
dItem.subItems?.find(
|
|
336
|
+
(e) => e.slug === props.currentPage
|
|
337
|
+
)
|
|
338
|
+
? "white"
|
|
339
|
+
: "black"
|
|
340
|
+
}
|
|
341
|
+
pointing={
|
|
321
342
|
openSubItem && dItem.slug === openSubItem
|
|
322
|
-
? "
|
|
323
|
-
: "
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
{/* <FaChevronRight fontSize={11} /> */}
|
|
327
|
-
</div>
|
|
343
|
+
? "up"
|
|
344
|
+
: "down"
|
|
345
|
+
}
|
|
346
|
+
/>
|
|
328
347
|
)}
|
|
329
348
|
</div>
|
|
330
349
|
|
|
331
350
|
{dItem.subItems && (
|
|
332
351
|
<div
|
|
333
352
|
className={clsx(
|
|
334
|
-
"m-1 flex cursor-pointer flex-col gap-
|
|
353
|
+
"m-1 mx-2 flex cursor-pointer flex-col gap-1 overflow-clip whitespace-nowrap rounded bg-layoutPrimary-300 p-1 transition-all",
|
|
335
354
|
openSubItem == dItem.slug && openSideMenu
|
|
336
355
|
? ""
|
|
337
356
|
: "my-0 py-0",
|
|
@@ -340,7 +359,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
340
359
|
style={{
|
|
341
360
|
height:
|
|
342
361
|
openSubItem == dItem.slug && openSideMenu
|
|
343
|
-
? 6 +
|
|
362
|
+
? 6 + 35 * dItem.subItems?.length
|
|
344
363
|
: 0,
|
|
345
364
|
}}
|
|
346
365
|
>
|
|
@@ -348,7 +367,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
348
367
|
<div
|
|
349
368
|
key={s}
|
|
350
369
|
className={clsx(
|
|
351
|
-
"flex flex-row gap-2 overflow-x-clip rounded p-2 px-2 text-xs",
|
|
370
|
+
"flex flex-row gap-2 overflow-x-clip rounded-inner p-2 px-2 text-xs",
|
|
352
371
|
isRTL ? "text-right" : "text-left",
|
|
353
372
|
props.currentPage === subIt.slug
|
|
354
373
|
? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
|
|
@@ -381,7 +400,11 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
381
400
|
</div>
|
|
382
401
|
{/* Drawer Footer */}
|
|
383
402
|
<div
|
|
384
|
-
className=
|
|
403
|
+
className={clsx(
|
|
404
|
+
"fixed bottom-0 flex h-14 w-full items-center justify-center gap-2 bg-layoutPrimary-500 transition-all",
|
|
405
|
+
|
|
406
|
+
direction === "rtl" ? "flex-row-reverse" : "flex-row"
|
|
407
|
+
)}
|
|
385
408
|
style={{
|
|
386
409
|
width:
|
|
387
410
|
size > 600
|
|
@@ -389,19 +412,14 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
389
412
|
: `${openSideMenu ? 160 : 0}px`,
|
|
390
413
|
}}
|
|
391
414
|
>
|
|
392
|
-
{
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
>
|
|
397
|
-
<SettingsIcon />
|
|
398
|
-
</div>
|
|
399
|
-
)}
|
|
415
|
+
{size > 600 && DrawerFooterActions && openSideMenu ? (
|
|
416
|
+
<>{DrawerFooterActions}</>
|
|
417
|
+
) : null}
|
|
418
|
+
|
|
400
419
|
{/* Expand Button */}
|
|
401
|
-
{size > 600 ? (
|
|
420
|
+
{size > 600 && openSideMenu ? (
|
|
402
421
|
<div
|
|
403
422
|
className={clsx("w-fit transition-all")}
|
|
404
|
-
// style={isRTL ? {} : {left: }}
|
|
405
423
|
style={
|
|
406
424
|
isRTL
|
|
407
425
|
? {
|
|
@@ -430,10 +448,11 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
430
448
|
<div
|
|
431
449
|
onClick={() => setKeepOpen(!keepOpen)}
|
|
432
450
|
className={
|
|
433
|
-
"w-fit cursor-pointer rounded bg-gray-300 p-
|
|
451
|
+
"w-fit cursor-pointer rounded bg-gray-300 p-1 transition-all hover:bg-gray-400"
|
|
434
452
|
}
|
|
435
453
|
>
|
|
436
454
|
<ArrowIcon
|
|
455
|
+
color={"black"}
|
|
437
456
|
pointing={
|
|
438
457
|
keepOpen
|
|
439
458
|
? isRTL
|
|
@@ -454,7 +473,7 @@ export const HawaAppLayoutSimplified: React.FunctionComponent<
|
|
|
454
473
|
|
|
455
474
|
{/* Children Container */}
|
|
456
475
|
<div
|
|
457
|
-
className="fixed overflow-y-auto
|
|
476
|
+
className="fixed overflow-y-auto"
|
|
458
477
|
style={
|
|
459
478
|
isRTL
|
|
460
479
|
? {
|
|
@@ -492,22 +511,43 @@ const AvatarIcon = () => (
|
|
|
492
511
|
</svg>
|
|
493
512
|
)
|
|
494
513
|
|
|
495
|
-
const ArrowIcon = ({ pointing }) =>
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
514
|
+
const ArrowIcon = ({ pointing, color }) => {
|
|
515
|
+
let directionStyle
|
|
516
|
+
switch (pointing) {
|
|
517
|
+
case "right":
|
|
518
|
+
directionStyle = "-rotate-90"
|
|
519
|
+
break
|
|
520
|
+
case "left":
|
|
521
|
+
directionStyle = "rotate-90"
|
|
522
|
+
break
|
|
523
|
+
case "up":
|
|
524
|
+
directionStyle = "-rotate-180"
|
|
525
|
+
break
|
|
526
|
+
case "down":
|
|
527
|
+
directionStyle = "rotate-0"
|
|
528
|
+
break
|
|
529
|
+
|
|
530
|
+
default:
|
|
531
|
+
break
|
|
532
|
+
}
|
|
533
|
+
return (
|
|
534
|
+
<svg
|
|
535
|
+
className={clsx(
|
|
536
|
+
"h-6 w-6 shrink-0 transition-all disabled:bg-gray-200",
|
|
537
|
+
directionStyle
|
|
538
|
+
)}
|
|
539
|
+
fill={color}
|
|
540
|
+
viewBox="0 0 20 20"
|
|
541
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
542
|
+
>
|
|
543
|
+
<path
|
|
544
|
+
fillRule="evenodd"
|
|
545
|
+
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"
|
|
546
|
+
clipRule="evenodd"
|
|
547
|
+
></path>
|
|
548
|
+
</svg>
|
|
549
|
+
)
|
|
550
|
+
}
|
|
511
551
|
|
|
512
552
|
const SettingsIcon = () => (
|
|
513
553
|
<svg
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import useDiscloser from "../hooks/useDiscloser"
|
|
4
|
-
import { HiMenu } from "react-icons/hi"
|
|
5
4
|
import useBreakpoint from "../hooks/useBreakpoint"
|
|
6
5
|
|
|
7
6
|
type HawaSiteLayoutTypes = {
|
|
@@ -117,8 +116,22 @@ export const HawaSiteLayout: React.FunctionComponent<HawaSiteLayoutTypes> = ({
|
|
|
117
116
|
onClick={() => setOpenSideMenu(!openSideMenu)}
|
|
118
117
|
className="cursor-pointer rounded p-1 transition-all hover:bg-gray-100"
|
|
119
118
|
>
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
<svg
|
|
120
|
+
stroke="currentColor"
|
|
121
|
+
fill="currentColor"
|
|
122
|
+
stroke-width="0"
|
|
123
|
+
viewBox="0 0 20 20"
|
|
124
|
+
aria-hidden="true"
|
|
125
|
+
height="1.6em"
|
|
126
|
+
width="1.6em"
|
|
127
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
+
>
|
|
129
|
+
<path
|
|
130
|
+
fill-rule="evenodd"
|
|
131
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
132
|
+
clip-rule="evenodd"
|
|
133
|
+
></path>
|
|
134
|
+
</svg> </div>
|
|
122
135
|
{props.pageTitle ? <div>{props.pageTitle}</div> : <div></div>}
|
|
123
136
|
</div>
|
|
124
137
|
)}
|
package/src/layout/index.ts
CHANGED