@sikka/hawa 0.0.112 → 0.0.113
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/styles.css +10 -10
- package/es/elements/HawaAlert.d.ts +7 -0
- package/es/elements/HawaButton.d.ts +2 -1
- package/es/elements/HawaRadio.d.ts +6 -1
- package/es/elements/HawaSnackbar.d.ts +7 -0
- package/es/index.es.js +1 -1
- package/es/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
- package/lib/elements/HawaAlert.d.ts +7 -0
- package/lib/elements/HawaButton.d.ts +2 -1
- package/lib/elements/HawaRadio.d.ts +6 -1
- package/lib/elements/HawaSnackbar.d.ts +7 -0
- package/lib/index.js +1 -1
- package/lib/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
- package/package.json +1 -1
- package/src/blocks/Account/UserSettingsForm.tsx +0 -1
- package/src/elements/HawaAlert.tsx +21 -0
- package/src/elements/HawaButton.tsx +9 -2
- package/src/elements/HawaRadio.tsx +7 -2
- package/src/elements/HawaSnackbar.tsx +24 -2
- package/src/elements/HawaTextField.tsx +1 -1
- package/src/layout/HawaContainer.tsx +2 -3
- package/src/styles.css +10 -10
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
+
import { HawaButton } from "./HawaButton"
|
|
3
4
|
|
|
4
5
|
let severities = {
|
|
5
6
|
info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
@@ -13,6 +14,13 @@ type AlertTypes = {
|
|
|
13
14
|
title?: any
|
|
14
15
|
text: any
|
|
15
16
|
hideIcon?: any
|
|
17
|
+
actions?: [
|
|
18
|
+
{
|
|
19
|
+
label: string
|
|
20
|
+
onClick: any
|
|
21
|
+
variant: "contained" | "outlined"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
16
24
|
}
|
|
17
25
|
export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
|
|
18
26
|
return (
|
|
@@ -25,6 +33,19 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
|
|
|
25
33
|
>
|
|
26
34
|
<span className="font-medium">{props.title}</span>
|
|
27
35
|
<span>{" " + props.text}</span>
|
|
36
|
+
{props.actions && (
|
|
37
|
+
<div className="mt-2 flex flex-row gap-2">
|
|
38
|
+
{props.actions.map((act) => (
|
|
39
|
+
<HawaButton
|
|
40
|
+
variant={act.variant}
|
|
41
|
+
onClick={act.onClick()}
|
|
42
|
+
margins="none"
|
|
43
|
+
>
|
|
44
|
+
{act.label}
|
|
45
|
+
</HawaButton>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
28
49
|
</div>
|
|
29
50
|
)
|
|
30
51
|
}
|
|
@@ -6,7 +6,8 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
6
6
|
color?: "default" | "primary" | "secondary"
|
|
7
7
|
width?: "full" | "normal" | "half"
|
|
8
8
|
size?: "small" | "medium" | "large" | "noPadding"
|
|
9
|
-
|
|
9
|
+
margins?: "none" | "1" | "2" | "3" | "4"
|
|
10
|
+
tooltip?: string
|
|
10
11
|
isLoading?: boolean
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -59,6 +60,7 @@ export function HawaButton({
|
|
|
59
60
|
width = "normal",
|
|
60
61
|
disabled = false,
|
|
61
62
|
isLoading = false,
|
|
63
|
+
margins = "2",
|
|
62
64
|
tooltip,
|
|
63
65
|
children,
|
|
64
66
|
...props
|
|
@@ -66,7 +68,12 @@ export function HawaButton({
|
|
|
66
68
|
const [isHovered, setIsHovered] = React.useState(false)
|
|
67
69
|
|
|
68
70
|
return (
|
|
69
|
-
<div
|
|
71
|
+
<div
|
|
72
|
+
className={clsx(
|
|
73
|
+
"relative",
|
|
74
|
+
margins !== "none" ? `my-${margins}` : "my-0"
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
70
77
|
<button
|
|
71
78
|
onMouseEnter={() => {
|
|
72
79
|
setIsHovered(true)
|
|
@@ -2,7 +2,12 @@ import clsx from "clsx"
|
|
|
2
2
|
import React, { useState } from "react"
|
|
3
3
|
|
|
4
4
|
type RadioTypes = {
|
|
5
|
-
options?:
|
|
5
|
+
options?: [
|
|
6
|
+
{
|
|
7
|
+
value: any
|
|
8
|
+
label: any
|
|
9
|
+
}
|
|
10
|
+
]
|
|
6
11
|
onChangeTab?: any
|
|
7
12
|
defaultValue?: any
|
|
8
13
|
}
|
|
@@ -17,7 +22,7 @@ export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
|
|
|
17
22
|
<div>
|
|
18
23
|
<ul
|
|
19
24
|
className={clsx(
|
|
20
|
-
props.options
|
|
25
|
+
props.options?.length > 2
|
|
21
26
|
? "flex-wrap xs:max-w-full xs:flex-nowrap"
|
|
22
27
|
: "",
|
|
23
28
|
"flex max-w-fit flex-row whitespace-nowrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React, { FC } from "react"
|
|
3
|
+
import { HawaButton } from "./HawaButton"
|
|
3
4
|
|
|
4
5
|
type THawaSnackBar = {
|
|
5
6
|
severity: "info" | "warning" | "error" | "success" | "none"
|
|
@@ -12,6 +13,13 @@ type THawaSnackBar = {
|
|
|
12
13
|
| "bottom-right"
|
|
13
14
|
| "bottom-center"
|
|
14
15
|
| "bottom-left"
|
|
16
|
+
actions?: [
|
|
17
|
+
{
|
|
18
|
+
label: string
|
|
19
|
+
onClick: any
|
|
20
|
+
variant: "contained" | "outlined"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export const HawaSnackbar: FC<THawaSnackBar> = ({
|
|
@@ -19,6 +27,7 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
|
|
|
19
27
|
description,
|
|
20
28
|
severity = "info",
|
|
21
29
|
position = "bottom-left",
|
|
30
|
+
actions,
|
|
22
31
|
}) => {
|
|
23
32
|
let defaultStyle =
|
|
24
33
|
"fixed flex flex-row items-top p-1 w-full max-w-xs rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
|
|
@@ -44,8 +53,21 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
|
|
|
44
53
|
className={clsx(defaultStyle, severities[severity], positions[position])}
|
|
45
54
|
>
|
|
46
55
|
<div className="p-3">
|
|
47
|
-
<div className="
|
|
48
|
-
<div className="
|
|
56
|
+
<div className="text-sm font-bold">{title}</div>
|
|
57
|
+
<div className="text-sm font-normal">{description}</div>
|
|
58
|
+
{actions && (
|
|
59
|
+
<div className="mt-2 flex flex-row gap-2">
|
|
60
|
+
{actions.map((act) => (
|
|
61
|
+
<HawaButton
|
|
62
|
+
variant={act.variant}
|
|
63
|
+
onClick={act.onClick()}
|
|
64
|
+
margins="none"
|
|
65
|
+
>
|
|
66
|
+
{act.label}
|
|
67
|
+
</HawaButton>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
49
71
|
</div>
|
|
50
72
|
<button
|
|
51
73
|
type="button"
|
|
@@ -56,7 +56,7 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
56
56
|
) : (
|
|
57
57
|
<input
|
|
58
58
|
{...props}
|
|
59
|
-
className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-
|
|
59
|
+
className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
|
60
60
|
/>
|
|
61
61
|
)}
|
|
62
62
|
|
|
@@ -13,12 +13,11 @@ export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
|
|
|
13
13
|
centered = false,
|
|
14
14
|
...props
|
|
15
15
|
}) => {
|
|
16
|
-
let defaultStyle =
|
|
17
|
-
"flex w-full max-w-sm flex-col rounded-xl p-4 dark:bg-gray-600"
|
|
16
|
+
let defaultStyle = "flex w-full flex-col rounded-xl p-4 dark:bg-gray-600"
|
|
18
17
|
let maxWidthStyles: any = {
|
|
19
18
|
full: "md:max-w-xl",
|
|
20
19
|
small: "md:max-w-sm w-1/3 min-w-min",
|
|
21
|
-
normal: "md:max-w-md",
|
|
20
|
+
normal: "max-w-sm md:max-w-md",
|
|
22
21
|
}
|
|
23
22
|
let variantStyles = {
|
|
24
23
|
contained: "bg-primary-300",
|
package/src/styles.css
CHANGED
|
@@ -587,14 +587,18 @@ video {
|
|
|
587
587
|
margin-left: 0.25rem;
|
|
588
588
|
margin-right: 0.25rem;
|
|
589
589
|
}
|
|
590
|
-
.my-
|
|
591
|
-
margin-top:
|
|
592
|
-
margin-bottom:
|
|
590
|
+
.my-0 {
|
|
591
|
+
margin-top: 0px;
|
|
592
|
+
margin-bottom: 0px;
|
|
593
593
|
}
|
|
594
594
|
.mx-2 {
|
|
595
595
|
margin-left: 0.5rem;
|
|
596
596
|
margin-right: 0.5rem;
|
|
597
597
|
}
|
|
598
|
+
.my-2 {
|
|
599
|
+
margin-top: 0.5rem;
|
|
600
|
+
margin-bottom: 0.5rem;
|
|
601
|
+
}
|
|
598
602
|
.my-7 {
|
|
599
603
|
margin-top: 1.75rem;
|
|
600
604
|
margin-bottom: 1.75rem;
|
|
@@ -603,10 +607,6 @@ video {
|
|
|
603
607
|
margin-top: 0.125rem;
|
|
604
608
|
margin-bottom: 0.125rem;
|
|
605
609
|
}
|
|
606
|
-
.my-0 {
|
|
607
|
-
margin-top: 0px;
|
|
608
|
-
margin-bottom: 0px;
|
|
609
|
-
}
|
|
610
610
|
.ml-auto {
|
|
611
611
|
margin-left: auto;
|
|
612
612
|
}
|
|
@@ -619,6 +619,9 @@ video {
|
|
|
619
619
|
.mb-4 {
|
|
620
620
|
margin-bottom: 1rem;
|
|
621
621
|
}
|
|
622
|
+
.mt-2 {
|
|
623
|
+
margin-top: 0.5rem;
|
|
624
|
+
}
|
|
622
625
|
.mb-0 {
|
|
623
626
|
margin-bottom: 0px;
|
|
624
627
|
}
|
|
@@ -652,9 +655,6 @@ video {
|
|
|
652
655
|
.ml-2 {
|
|
653
656
|
margin-left: 0.5rem;
|
|
654
657
|
}
|
|
655
|
-
.mt-2 {
|
|
656
|
-
margin-top: 0.5rem;
|
|
657
|
-
}
|
|
658
658
|
.mb-5 {
|
|
659
659
|
margin-bottom: 1.25rem;
|
|
660
660
|
}
|