@sikka/hawa 0.0.168 → 0.0.169
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/README.md +0 -1
- package/dist/styles.css +14 -11
- package/es/blocks/Misc/Newsletter.d.ts +10 -0
- package/es/blocks/Misc/index.d.ts +1 -0
- package/es/elements/DragDropImages.d.ts +6 -1
- package/es/elements/HawaAlert.d.ts +2 -7
- package/es/elements/HawaButton.d.ts +1 -1
- package/es/elements/HawaTable.d.ts +1 -0
- package/es/hooks/useHover.d.ts +3 -0
- package/es/hooks/useScrollPosition.d.ts +2 -0
- package/es/index.es.js +1 -1
- package/lib/blocks/Misc/Newsletter.d.ts +10 -0
- package/lib/blocks/Misc/index.d.ts +1 -0
- package/lib/elements/DragDropImages.d.ts +6 -1
- package/lib/elements/HawaAlert.d.ts +2 -7
- package/lib/elements/HawaButton.d.ts +1 -1
- package/lib/elements/HawaTable.d.ts +1 -0
- package/lib/hooks/useHover.d.ts +3 -0
- package/lib/hooks/useScrollPosition.d.ts +2 -0
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/Misc/Newsletter.tsx +38 -0
- package/src/blocks/Misc/index.ts +1 -0
- package/src/elements/DragDropImages.tsx +8 -3
- package/src/elements/HawaAlert.tsx +4 -9
- package/src/elements/HawaButton.tsx +6 -16
- package/src/elements/HawaCardInput.tsx +1 -0
- package/src/elements/HawaTable.tsx +7 -2
- package/src/hooks/{useHover.js → useHover.ts} +0 -0
- package/src/hooks/{useScrollPosition.js → useScrollPosition.ts} +0 -0
- package/src/styles.css +14 -11
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { HawaButton, HawaTextField } from "../../elements"
|
|
3
|
+
import { HawaContainer } from "../../layout"
|
|
4
|
+
import { FaCheck } from "react-icons/fa"
|
|
5
|
+
type TNewsletter = {
|
|
6
|
+
variant?: "outlined" | "contained" | "neobrutalism"
|
|
7
|
+
texts: {
|
|
8
|
+
wantToStayUpdated: string
|
|
9
|
+
subscribeToNewsletter: string
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// TODO: make it a form and handle email submission
|
|
14
|
+
|
|
15
|
+
export const Newsletter: React.FunctionComponent<TNewsletter> = ({
|
|
16
|
+
variant = "contained",
|
|
17
|
+
texts,
|
|
18
|
+
}) => {
|
|
19
|
+
return (
|
|
20
|
+
<HawaContainer variant={variant} centered={true}>
|
|
21
|
+
<div className="p-4 pt-0">
|
|
22
|
+
<h1 className="font-bold">{texts.wantToStayUpdated}</h1>
|
|
23
|
+
<span>{texts.subscribeToNewsletter}</span>
|
|
24
|
+
</div>
|
|
25
|
+
<div className="flex flex-row gap-2">
|
|
26
|
+
<HawaTextField
|
|
27
|
+
width="full"
|
|
28
|
+
type="email"
|
|
29
|
+
placeholder={"example@sikka.io"}
|
|
30
|
+
margin="none"
|
|
31
|
+
/>
|
|
32
|
+
<HawaButton size="full" margins="none">
|
|
33
|
+
Submit
|
|
34
|
+
</HawaButton>
|
|
35
|
+
</div>
|
|
36
|
+
</HawaContainer>
|
|
37
|
+
)
|
|
38
|
+
}
|
package/src/blocks/Misc/index.ts
CHANGED
|
@@ -11,7 +11,6 @@ const thumbsContainer = {
|
|
|
11
11
|
}
|
|
12
12
|
type DragDropImagesTypes = {
|
|
13
13
|
label?: string
|
|
14
|
-
texts: any
|
|
15
14
|
files: [File]
|
|
16
15
|
setFiles: any
|
|
17
16
|
setDeletedFiles: any
|
|
@@ -20,6 +19,12 @@ type DragDropImagesTypes = {
|
|
|
20
19
|
onAcceptedFiles: any
|
|
21
20
|
showPreview: any
|
|
22
21
|
onDeleteFile: any
|
|
22
|
+
texts: {
|
|
23
|
+
clickHereToUpload: string
|
|
24
|
+
maxFileSize: string
|
|
25
|
+
tooManyFiles: string
|
|
26
|
+
fileTooLarge: string
|
|
27
|
+
}
|
|
23
28
|
onClearFiles: any
|
|
24
29
|
maxSize: number
|
|
25
30
|
errorMessages: string
|
|
@@ -171,10 +176,10 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
171
176
|
className="mb-2 flex flex-col justify-center rounded-xl border border-dashed border-black"
|
|
172
177
|
>
|
|
173
178
|
<input {...getInputProps()} />
|
|
179
|
+
<div className="p-1 text-center">{texts.clickHereToUpload}</div>
|
|
174
180
|
<div className="p-1 text-center">
|
|
175
|
-
|
|
181
|
+
{texts.maxFileSize} {max}
|
|
176
182
|
</div>
|
|
177
|
-
<div className="p-1 text-center">Max file size is {max}</div>
|
|
178
183
|
<div className="flex justify-center ">
|
|
179
184
|
{acceptedFiles.length > 0 && (
|
|
180
185
|
<HawaButton
|
|
@@ -2,15 +2,8 @@ import React from "react"
|
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import { HawaButton } from "./HawaButton"
|
|
4
4
|
|
|
5
|
-
let severities = {
|
|
6
|
-
info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
7
|
-
warning:
|
|
8
|
-
"text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
9
|
-
error: "text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
10
|
-
success: "text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
11
|
-
}
|
|
12
5
|
type AlertTypes = {
|
|
13
|
-
severity:
|
|
6
|
+
severity: "info" | "warning" | "error" | "success"
|
|
14
7
|
title?: any
|
|
15
8
|
variant?:
|
|
16
9
|
| "normal"
|
|
@@ -20,6 +13,7 @@ type AlertTypes = {
|
|
|
20
13
|
| "right-accent"
|
|
21
14
|
| "bottom-accent"
|
|
22
15
|
text: any
|
|
16
|
+
direction?: "rtl" | "ltr"
|
|
23
17
|
hideIcon?: any
|
|
24
18
|
actions?: [
|
|
25
19
|
{
|
|
@@ -31,6 +25,7 @@ type AlertTypes = {
|
|
|
31
25
|
}
|
|
32
26
|
export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
33
27
|
variant = "normal",
|
|
28
|
+
direction = "ltr",
|
|
34
29
|
...props
|
|
35
30
|
}) => {
|
|
36
31
|
let styleVariant = {
|
|
@@ -83,10 +78,10 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
83
78
|
<div
|
|
84
79
|
className={clsx(
|
|
85
80
|
"mb-4 flex flex-col rounded-lg p-4 text-sm",
|
|
86
|
-
// severities[props.severity],
|
|
87
81
|
styleVariant[variant][props.severity]
|
|
88
82
|
)}
|
|
89
83
|
role="alert"
|
|
84
|
+
dir={direction}
|
|
90
85
|
>
|
|
91
86
|
<span className="font-medium">{props.title}</span>
|
|
92
87
|
<span>{" " + props.text}</span>
|
|
@@ -9,7 +9,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
9
9
|
buttonID?: any
|
|
10
10
|
color?: "default" | "primary" | "secondary"
|
|
11
11
|
width?: "full" | "normal" | "half"
|
|
12
|
-
size?: "xs" | "small" | "medium" | "large" | "noPadding"
|
|
12
|
+
size?: "xs" | "small" | "medium" | "large" | "noPadding" | "full"
|
|
13
13
|
margins?: "none" | "1" | "2" | "3" | "4"
|
|
14
14
|
tooltip?: string
|
|
15
15
|
tooltipSize?: "normal" | "small" | "large"
|
|
@@ -17,7 +17,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
17
17
|
isLoading?: boolean
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const baseStyles = "cursor-pointer font-medium rounded-lg
|
|
20
|
+
const baseStyles = "cursor-pointer font-medium rounded-lg transition-all"
|
|
21
21
|
|
|
22
22
|
const sizeStyles = {
|
|
23
23
|
xs: "px-1 py-1",
|
|
@@ -25,6 +25,7 @@ const sizeStyles = {
|
|
|
25
25
|
medium: "text-sm leading-4 px-3 py-2",
|
|
26
26
|
large: "text-sm px-4 py-2",
|
|
27
27
|
noPadding: "p-0",
|
|
28
|
+
full: "h-full max-h-full p-2",
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const widthStyles = {
|
|
@@ -34,7 +35,7 @@ const widthStyles = {
|
|
|
34
35
|
half: "w-1/2",
|
|
35
36
|
}
|
|
36
37
|
const variantStyles = {
|
|
37
|
-
contained: "border
|
|
38
|
+
contained: "border-transparent",
|
|
38
39
|
outlined: "bg-transparent border",
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -79,17 +80,13 @@ export function HawaButton({
|
|
|
79
80
|
}: ButtonProps) {
|
|
80
81
|
return (
|
|
81
82
|
<div
|
|
82
|
-
className={clsx(
|
|
83
|
-
"relative",
|
|
84
|
-
margins !== "none" ? `my-${margins}` : "my-0"
|
|
85
|
-
)}
|
|
83
|
+
className={clsx("relative", margins !== "none" ? `my-${margins}` : "m-0")}
|
|
86
84
|
>
|
|
87
85
|
<button
|
|
88
86
|
id={buttonID}
|
|
89
87
|
className={
|
|
90
88
|
disabled
|
|
91
89
|
? clsx(
|
|
92
|
-
// "brightne",
|
|
93
90
|
className,
|
|
94
91
|
baseStyles,
|
|
95
92
|
variantStyles[variant],
|
|
@@ -111,14 +108,7 @@ export function HawaButton({
|
|
|
111
108
|
type={props.type}
|
|
112
109
|
{...props}
|
|
113
110
|
>
|
|
114
|
-
{!isLoading ?
|
|
115
|
-
children
|
|
116
|
-
) : (
|
|
117
|
-
// <div className="flex flex-row gap-x-3">
|
|
118
|
-
// <div className="h-5 w-5 animate-spin rounded-full border-2 border-gray-400 border-t-white text-white"></div>
|
|
119
|
-
// </div>
|
|
120
|
-
<HawaSpinner />
|
|
121
|
-
)}
|
|
111
|
+
{!isLoading ? children : <HawaSpinner />}
|
|
122
112
|
</button>
|
|
123
113
|
{tooltip && (
|
|
124
114
|
<HawaTooltip
|
|
@@ -12,10 +12,12 @@ type TableTypes = {
|
|
|
12
12
|
handleActionClick?: any
|
|
13
13
|
end?: any
|
|
14
14
|
size?: "normal" | "small"
|
|
15
|
+
customColor?: string
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
18
19
|
size = "normal",
|
|
20
|
+
customColor = "white",
|
|
19
21
|
...props
|
|
20
22
|
}) => {
|
|
21
23
|
let isArabic = props.lang === "ar"
|
|
@@ -27,7 +29,7 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
27
29
|
return (
|
|
28
30
|
<div className="relative overflow-x-visible rounded-xl">
|
|
29
31
|
<table className="w-full text-left text-sm text-gray-500 dark:text-gray-400">
|
|
30
|
-
<thead className="bg-
|
|
32
|
+
<thead className="bg-layoutPrimary-default text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
|
|
31
33
|
<tr>
|
|
32
34
|
{props.columns.map((col: any, i: any) => (
|
|
33
35
|
<th key={i} scope="col" className={clsx(sizeStyles[size])}>
|
|
@@ -46,7 +48,10 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
46
48
|
props.rows.map((singleRow: any, j: any) => (
|
|
47
49
|
<tr
|
|
48
50
|
key={j}
|
|
49
|
-
className=
|
|
51
|
+
className={clsx(
|
|
52
|
+
"border-b dark:border-gray-700 dark:bg-gray-800",
|
|
53
|
+
"bg-" + customColor
|
|
54
|
+
)}
|
|
50
55
|
>
|
|
51
56
|
{singleRow.map((r: any, i: any) => {
|
|
52
57
|
if (i === 0) {
|
|
File without changes
|
|
File without changes
|
package/src/styles.css
CHANGED
|
@@ -692,10 +692,6 @@ video {
|
|
|
692
692
|
.m-1 {
|
|
693
693
|
margin: 0.25rem;
|
|
694
694
|
}
|
|
695
|
-
.my-0 {
|
|
696
|
-
margin-top: 0px;
|
|
697
|
-
margin-bottom: 0px;
|
|
698
|
-
}
|
|
699
695
|
.mx-2 {
|
|
700
696
|
margin-left: 0.5rem;
|
|
701
697
|
margin-right: 0.5rem;
|
|
@@ -720,6 +716,10 @@ video {
|
|
|
720
716
|
margin-top: 0.125rem;
|
|
721
717
|
margin-bottom: 0.125rem;
|
|
722
718
|
}
|
|
719
|
+
.my-0 {
|
|
720
|
+
margin-top: 0px;
|
|
721
|
+
margin-bottom: 0px;
|
|
722
|
+
}
|
|
723
723
|
.ml-auto {
|
|
724
724
|
margin-left: auto;
|
|
725
725
|
}
|
|
@@ -901,6 +901,9 @@ video {
|
|
|
901
901
|
.h-96 {
|
|
902
902
|
height: 24rem;
|
|
903
903
|
}
|
|
904
|
+
.max-h-full {
|
|
905
|
+
max-height: 100%;
|
|
906
|
+
}
|
|
904
907
|
.max-h-56 {
|
|
905
908
|
max-height: 14rem;
|
|
906
909
|
}
|
|
@@ -1218,12 +1221,12 @@ video {
|
|
|
1218
1221
|
.rounded-xl {
|
|
1219
1222
|
border-radius: 0.75rem;
|
|
1220
1223
|
}
|
|
1221
|
-
.rounded-full {
|
|
1222
|
-
border-radius: 9999px;
|
|
1223
|
-
}
|
|
1224
1224
|
.rounded {
|
|
1225
1225
|
border-radius: 0.25rem;
|
|
1226
1226
|
}
|
|
1227
|
+
.rounded-full {
|
|
1228
|
+
border-radius: 9999px;
|
|
1229
|
+
}
|
|
1227
1230
|
.rounded-none {
|
|
1228
1231
|
border-radius: 0px;
|
|
1229
1232
|
}
|
|
@@ -1386,14 +1389,14 @@ video {
|
|
|
1386
1389
|
--tw-border-opacity: 1;
|
|
1387
1390
|
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
|
1388
1391
|
}
|
|
1389
|
-
.border-gray-400 {
|
|
1390
|
-
--tw-border-opacity: 1;
|
|
1391
|
-
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
|
1392
|
-
}
|
|
1393
1392
|
.border-blue-600 {
|
|
1394
1393
|
--tw-border-opacity: 1;
|
|
1395
1394
|
border-color: rgb(37 99 235 / var(--tw-border-opacity));
|
|
1396
1395
|
}
|
|
1396
|
+
.border-gray-400 {
|
|
1397
|
+
--tw-border-opacity: 1;
|
|
1398
|
+
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
|
1399
|
+
}
|
|
1397
1400
|
.border-buttonPrimary-default {
|
|
1398
1401
|
border-color: var(--button-primary);
|
|
1399
1402
|
}
|