@sikka/hawa 0.0.239 → 0.0.241
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 +54 -17
- package/docs/README.md +2 -4
- package/docs/documentation/{901.ae81c179.iframe.bundle.js → 566.80f3d604.iframe.bundle.js} +2 -2
- package/docs/documentation/{807.1424ceed.iframe.bundle.js → 807.b81f7e21.iframe.bundle.js} +2 -2
- package/docs/documentation/iframe.html +1 -1
- package/docs/documentation/main.3c9bbcb1.iframe.bundle.js +1 -0
- package/docs/documentation/project.json +1 -1
- package/docs/documentation/{runtime~main.d6831407.iframe.bundle.js → runtime~main.d1d3f3a0.iframe.bundle.js} +1 -1
- package/es/elements/ArrowCarousel.d.ts +2 -2
- package/es/elements/BackToTop.d.ts +10 -0
- package/es/elements/Breadcrumb.d.ts +10 -7
- package/es/elements/DragDropImages.d.ts +9 -3
- package/es/elements/HawaAccordion.d.ts +11 -0
- package/es/elements/HawaAlert.d.ts +3 -2
- package/es/elements/index.d.ts +1 -0
- package/es/index.es.js +2 -2
- package/lib/elements/ArrowCarousel.d.ts +2 -2
- package/lib/elements/BackToTop.d.ts +10 -0
- package/lib/elements/Breadcrumb.d.ts +10 -7
- package/lib/elements/DragDropImages.d.ts +9 -3
- package/lib/elements/HawaAccordion.d.ts +11 -0
- package/lib/elements/HawaAlert.d.ts +3 -2
- package/lib/elements/index.d.ts +1 -0
- package/lib/index.js +2 -2
- package/package.json +1 -1
- package/src/elements/ArrowCarousel.tsx +37 -28
- package/src/elements/BackToTop.tsx +85 -0
- package/src/elements/Breadcrumb.tsx +12 -13
- package/src/elements/DragDropImages.tsx +10 -4
- package/src/elements/HawaAccordion.tsx +23 -47
- package/src/elements/HawaAlert.tsx +4 -2
- package/src/elements/HawaTextField.tsx +7 -3
- package/src/elements/index.ts +1 -0
- package/src/styles.css +54 -17
- package/docs/documentation/main.1d8c7d46.iframe.bundle.js +0 -1
- /package/docs/documentation/{901.ae81c179.iframe.bundle.js.LICENSE.txt → 566.80f3d604.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/docs/documentation/{807.1424ceed.iframe.bundle.js.LICENSE.txt → 807.b81f7e21.iframe.bundle.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { FaArrowLeft, FaArrowRight } from "react-icons/fa"
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import { useEffect, useState, FunctionComponent } from "react"
|
|
4
3
|
|
|
5
4
|
type Item = {
|
|
6
5
|
label?: string
|
|
@@ -15,28 +14,37 @@ type ComponentTypes = {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
const Arrow = (props: {
|
|
18
|
-
icon
|
|
19
|
-
size
|
|
17
|
+
icon?: any
|
|
18
|
+
size?: number
|
|
20
19
|
onClick?: () => void
|
|
21
20
|
disabled?: boolean
|
|
21
|
+
direction?: "right" | "left"
|
|
22
22
|
}) => {
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
className={
|
|
26
|
-
props.disabled || false ? "text-gray-300" : "hover:text-gray-500"
|
|
27
|
-
}
|
|
28
|
-
size={props.size}
|
|
24
|
+
<svg
|
|
29
25
|
onClick={props.onClick || (() => {})}
|
|
30
|
-
|
|
26
|
+
className={clsx(
|
|
27
|
+
"h-6 w-6 shrink-0 transition-all disabled:bg-gray-200",
|
|
28
|
+
props.direction === "right" ? "-rotate-90" : "rotate-90",
|
|
29
|
+
props.disabled ? "text-gray-300" : "cursor-pointer hover:scale-150"
|
|
30
|
+
)}
|
|
31
|
+
fill={props.disabled && "grey"}
|
|
32
|
+
viewBox="0 0 20 20"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
fillRule="evenodd"
|
|
37
|
+
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"
|
|
38
|
+
clipRule="evenodd"
|
|
39
|
+
></path>
|
|
40
|
+
</svg>
|
|
31
41
|
)
|
|
32
42
|
}
|
|
33
43
|
|
|
34
|
-
export const ArrowCarousel:
|
|
35
|
-
props
|
|
36
|
-
) => {
|
|
37
|
-
const [index, setIndex] = React.useState(props.index || 0)
|
|
44
|
+
export const ArrowCarousel: FunctionComponent<ComponentTypes> = (props) => {
|
|
45
|
+
const [index, setIndex] = useState(props.index || 0)
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
useEffect(() => {
|
|
40
48
|
console.log(`INDEX CHANGED TO: ${index}`)
|
|
41
49
|
}, [index])
|
|
42
50
|
|
|
@@ -47,10 +55,10 @@ export const ArrowCarousel: React.FunctionComponent<ComponentTypes> = (
|
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
return (
|
|
50
|
-
<div className="align-center box-boorder relative flex h-min w-min flex-row items-center justify-center rounded bg-
|
|
58
|
+
<div className="align-center box-boorder relative flex h-min w-min flex-row items-center justify-center rounded bg-layoutPrimary-500 p-4 py-0 pb-2 pt-2 shadow-md">
|
|
51
59
|
<Arrow
|
|
52
|
-
|
|
53
|
-
size={props.arrowSize || 48}
|
|
60
|
+
direction="left"
|
|
61
|
+
// size={props.arrowSize || 48}
|
|
54
62
|
disabled={index == 0}
|
|
55
63
|
onClick={() => {
|
|
56
64
|
if (index != 0) setIndex(index - 1)
|
|
@@ -58,24 +66,25 @@ export const ArrowCarousel: React.FunctionComponent<ComponentTypes> = (
|
|
|
58
66
|
/>
|
|
59
67
|
|
|
60
68
|
<div
|
|
61
|
-
className={`relative box-border flex h-
|
|
69
|
+
className={`relative m-5 my-0 box-border flex h-full flex-col items-center justify-center py-6 pt-0 `}
|
|
62
70
|
>
|
|
63
71
|
<div>{props.items[index].icon}</div>
|
|
64
72
|
<div
|
|
65
|
-
className={
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
className={"absolute bottom-1 mb-0 mt-2 select-none"}
|
|
74
|
+
// {`absolute bottom-0 text-${
|
|
75
|
+
// sizes[props.labelSize || "small"][0]
|
|
76
|
+
// }xl `}
|
|
77
|
+
// style={{
|
|
78
|
+
// marginBottom: sizes[props.labelSize || "small"][1],
|
|
79
|
+
// }}
|
|
71
80
|
>
|
|
72
81
|
{props.items[index].label}
|
|
73
82
|
</div>
|
|
74
83
|
</div>
|
|
75
84
|
|
|
76
85
|
<Arrow
|
|
77
|
-
|
|
78
|
-
size={props.arrowSize || 48}
|
|
86
|
+
direction="right"
|
|
87
|
+
// size={props.arrowSize || 48}
|
|
79
88
|
disabled={index == props.items.length - 1}
|
|
80
89
|
onClick={() => {
|
|
81
90
|
if (index != props.items.length - 1) setIndex(index + 1)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { FunctionComponent, ReactNode, useState, useEffect } from "react"
|
|
2
|
+
import { clsx } from "clsx"
|
|
3
|
+
|
|
4
|
+
type ComponentTypes = {
|
|
5
|
+
paddingX?: number // Horizontal padding relative to the attached corner
|
|
6
|
+
paddingY?: number // Vertical padding relative to the attached corner
|
|
7
|
+
paddingThreshold?: number // Increase to the threshold of the scroll value that has to be passed for the button to appear
|
|
8
|
+
corner?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
9
|
+
anchor: React.RefObject<HTMLInputElement>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const BackToTop: FunctionComponent<ComponentTypes> = ({ ...props }) => {
|
|
13
|
+
const [visible, setVisible] = useState<boolean>(false)
|
|
14
|
+
|
|
15
|
+
const getCoords = () => {
|
|
16
|
+
let anchor = props.anchor.current
|
|
17
|
+
return [anchor.scrollTop, anchor.scrollLeft]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const onScroll = () => {
|
|
21
|
+
let [scrollTop, scrollLeft] = getCoords()
|
|
22
|
+
|
|
23
|
+
let rect = props.anchor.current.getBoundingClientRect()
|
|
24
|
+
|
|
25
|
+
setVisible(scrollTop >= rect.height + (props.paddingThreshold || 100))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const backToTop = () => {
|
|
29
|
+
props.anchor.current.scrollTo(0, 0)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
props.anchor.current.addEventListener("scroll", onScroll)
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
props.anchor.current.removeEventListener("scroll", onScroll)
|
|
37
|
+
}
|
|
38
|
+
}, [])
|
|
39
|
+
|
|
40
|
+
// // Reference to tailwind classes of corners
|
|
41
|
+
// const corners = {
|
|
42
|
+
// "top-left": ["top-0 left-0", "ml", "mt"],
|
|
43
|
+
// "top-right": ["top-0 right-0", "mr", "mt"],
|
|
44
|
+
// "bottom-left": ["bottom-0 left-0", "ml", "mb"],
|
|
45
|
+
// "bottom-right": ["bottom-0 right-0", "mr", "mb"],
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// const getClasses = () => {
|
|
49
|
+
// let [corner, horizontal, vertical] = corners[props.corner || "bottom-right"]
|
|
50
|
+
|
|
51
|
+
// return clsx(
|
|
52
|
+
// `${horizontal}-[${props.paddingX || 100}px]`,
|
|
53
|
+
// `${vertical}-[${props.paddingY || 0}px]`,
|
|
54
|
+
// `${corner}`,
|
|
55
|
+
// `${visible ? "block" : "hidden"}`
|
|
56
|
+
// )
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// Had to use react styles because tailwind didn't update top & left
|
|
60
|
+
const getStyles = () => {
|
|
61
|
+
let corner = props.corner || "bottom-right"
|
|
62
|
+
let [vertical, horizontal] = corner.split("-")
|
|
63
|
+
|
|
64
|
+
let style = {}
|
|
65
|
+
|
|
66
|
+
style[vertical] = props.paddingY || 15
|
|
67
|
+
style[horizontal] = props.paddingX || 30
|
|
68
|
+
|
|
69
|
+
return style
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
className={clsx(
|
|
75
|
+
"fixed rounded bg-blue-300 p-2 text-black transition-all hover:bg-blue-500",
|
|
76
|
+
`${visible ? "block" : "hidden"}`
|
|
77
|
+
// getClasses()
|
|
78
|
+
)}
|
|
79
|
+
style={getStyles()}
|
|
80
|
+
onClick={backToTop}
|
|
81
|
+
>
|
|
82
|
+
Back to top
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from "react"
|
|
2
2
|
|
|
3
|
-
type TBreadcrumItem = {
|
|
4
|
-
label: string
|
|
5
|
-
href: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
type TBreadcrumb = {
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The array of crumbs, each one with a label and a href link
|
|
6
|
+
*/
|
|
7
|
+
breadcrumbLinks: [{ label: string; href: string }]
|
|
8
|
+
/** The separator between each crumb, can be character or React Node */
|
|
10
9
|
separator?: string | ReactNode
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
separator = "
|
|
12
|
+
const HawaBreadcrumb: FC<TBreadcrumb> = ({
|
|
13
|
+
breadcrumbLinks,
|
|
14
|
+
separator = ">",
|
|
16
15
|
...props
|
|
17
16
|
}) => {
|
|
18
17
|
return (
|
|
19
18
|
<div className="flex flex-row items-center gap-2 text-sm">
|
|
20
|
-
{
|
|
19
|
+
{breadcrumbLinks.map((singleBreadcrumbLink, index) => (
|
|
21
20
|
<div className="flex flex-row items-center justify-center gap-2">
|
|
22
21
|
<a
|
|
23
22
|
href={singleBreadcrumbLink.href}
|
|
24
23
|
className={
|
|
25
|
-
index + 1 ===
|
|
24
|
+
index + 1 === breadcrumbLinks.length
|
|
26
25
|
? "pointer-events-none"
|
|
27
26
|
: "underline-offset-4 transition-all hover:text-buttonPrimary-500 hover:underline hover:decoration-2"
|
|
28
27
|
}
|
|
29
28
|
>
|
|
30
29
|
{singleBreadcrumbLink.label}
|
|
31
30
|
</a>
|
|
32
|
-
{index !=
|
|
31
|
+
{index != breadcrumbLinks.length - 1 ? (
|
|
33
32
|
typeof separator == "string" ? (
|
|
34
33
|
<div>{separator}</div>
|
|
35
34
|
) : (
|
|
@@ -42,4 +41,4 @@ const Breadcrumb: FC<TBreadcrumb> = ({
|
|
|
42
41
|
)
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
export default
|
|
44
|
+
export default HawaBreadcrumb
|
|
@@ -4,6 +4,9 @@ import { HawaAlert } from "./HawaAlert"
|
|
|
4
4
|
import { HawaButton } from "./HawaButton"
|
|
5
5
|
|
|
6
6
|
type DragDropImagesTypes = {
|
|
7
|
+
/**
|
|
8
|
+
* The text label above the component. Consistant with the other form input fields
|
|
9
|
+
*/
|
|
7
10
|
label?: string
|
|
8
11
|
files: [File]
|
|
9
12
|
setFiles: any
|
|
@@ -13,15 +16,18 @@ type DragDropImagesTypes = {
|
|
|
13
16
|
onAcceptedFiles: any
|
|
14
17
|
showPreview: any
|
|
15
18
|
onDeleteFile: any
|
|
19
|
+
onClearFiles: any
|
|
20
|
+
maxSize: number
|
|
21
|
+
errorMessages: string
|
|
22
|
+
/**
|
|
23
|
+
* The translation object, use this to replace the default text with any translated text you want.
|
|
24
|
+
*/
|
|
16
25
|
texts: {
|
|
17
26
|
clickHereToUpload: string
|
|
18
27
|
maxFileSize: string
|
|
19
28
|
tooManyFiles: string
|
|
20
29
|
fileTooLarge: string
|
|
21
30
|
}
|
|
22
|
-
onClearFiles: any
|
|
23
|
-
maxSize: number
|
|
24
|
-
errorMessages: string
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
@@ -109,7 +115,7 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
109
115
|
onDeleteFile(file)
|
|
110
116
|
}}
|
|
111
117
|
type="button"
|
|
112
|
-
className="absolute left-0 ml-auto inline-flex items-center rounded rounded-
|
|
118
|
+
className="absolute left-0 ml-auto inline-flex items-center rounded rounded-bl-none rounded-tr-none bg-gray-900 p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
113
119
|
data-modal-toggle="defaultModal"
|
|
114
120
|
>
|
|
115
121
|
<svg
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type AccordionTypes = {
|
|
5
|
+
/**
|
|
6
|
+
* The title of the clickable accordion bar
|
|
7
|
+
*/
|
|
8
|
+
title: string
|
|
9
|
+
/**
|
|
10
|
+
* The content inside the accordion to be visible once the bar is clicked
|
|
11
|
+
*/
|
|
7
12
|
content: any
|
|
13
|
+
/**
|
|
14
|
+
* The index of each accordion, must be unique for each usage of this component
|
|
15
|
+
*/
|
|
16
|
+
index: any
|
|
8
17
|
}
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
export const HawaAccordion: React.FunctionComponent<AccordionTypes> = (
|
|
19
|
+
props
|
|
20
|
+
) => {
|
|
11
21
|
const [collapse, setCollapse] = React.useState(false)
|
|
12
|
-
let noRounding =
|
|
13
|
-
"flex items-center justify-between w-full p-5 font-medium text-left border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white"
|
|
14
|
-
let roundedTop =
|
|
15
|
-
"rounded-t-xl border-b-0 flex items-center justify-between w-full p-5 font-medium text-left border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white"
|
|
16
|
-
let roundedBottom =
|
|
17
|
-
"rounded-b-xl border-t-0 flex items-center justify-between w-full p-5 font-medium text-left border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white"
|
|
18
|
-
let accPaper =
|
|
19
|
-
"p-5 font-light border border-b-xl border-gray-200 dark:border-gray-700 dark:bg-gray-900"
|
|
20
|
-
let accPaperRounded =
|
|
21
|
-
"p-5 font-light border border-b-xl rounded-b-xl border-gray-200 dark:border-gray-700 dark:bg-gray-900"
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<div>
|
|
24
|
+
<div className="h-fit w-full">
|
|
25
25
|
<button
|
|
26
|
-
id={"accordion-collapse-heading-" + props.
|
|
26
|
+
id={"accordion-collapse-heading-" + props.index}
|
|
27
27
|
type="button"
|
|
28
28
|
className={clsx(
|
|
29
29
|
collapse ? "rounded" : "rounded-t",
|
|
30
30
|
"flex w-full items-center justify-between border border-gray-200 bg-gray-100 p-5 text-left font-medium text-gray-900 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-800 dark:focus:ring-gray-800"
|
|
31
31
|
)}
|
|
32
32
|
onClick={() => setCollapse(!collapse)}
|
|
33
|
-
data-accordion-target={"#accordion-collapse-body-" + props.
|
|
33
|
+
data-accordion-target={"#accordion-collapse-body-" + props.index}
|
|
34
34
|
aria-expanded="true"
|
|
35
|
-
aria-controls={"accordion-collapse-body-" + props.
|
|
35
|
+
aria-controls={"accordion-collapse-body-" + props.index}
|
|
36
36
|
>
|
|
37
37
|
<span>{props.title}</span>
|
|
38
38
|
<svg
|
|
@@ -52,11 +52,11 @@ const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
|
|
|
52
52
|
</svg>
|
|
53
53
|
</button>
|
|
54
54
|
<div
|
|
55
|
-
id={"accordion-collapse-body-" + props.
|
|
56
|
-
aria-labelledby={"accordion-collapse-heading-" + props.
|
|
55
|
+
id={"accordion-collapse-body-" + props.index}
|
|
56
|
+
aria-labelledby={"accordion-collapse-heading-" + props.index}
|
|
57
57
|
className={clsx(
|
|
58
|
-
collapse ? "invisible hidden h-0 p-0" : "
|
|
59
|
-
"rounded-b border border-t-0 border-gray-200 p-5 font-light dark:border-gray-700 dark:bg-gray-900"
|
|
58
|
+
collapse ? "invisible hidden h-0 p-0" : "visible h-full",
|
|
59
|
+
"w-full rounded-b border border-t-0 border-gray-200 p-5 font-light dark:border-gray-700 dark:bg-gray-900"
|
|
60
60
|
)}
|
|
61
61
|
>
|
|
62
62
|
<p className="mb-2 text-gray-500 dark:text-gray-400">{props.content}</p>
|
|
@@ -64,27 +64,3 @@ const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
|
|
|
64
64
|
</div>
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
|
-
type AccordionTypes = {
|
|
68
|
-
content: any
|
|
69
|
-
}
|
|
70
|
-
export const HawaAccordion: React.FunctionComponent<AccordionTypes> = (
|
|
71
|
-
props
|
|
72
|
-
) => {
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
id="accordion-collapse"
|
|
76
|
-
data-accordion="collapse"
|
|
77
|
-
className="flex flex-col gap-3"
|
|
78
|
-
>
|
|
79
|
-
{props.content.map((acc: any, i: any) => {
|
|
80
|
-
return (
|
|
81
|
-
<AccordionItem
|
|
82
|
-
title={acc.title}
|
|
83
|
-
content={acc.content}
|
|
84
|
-
count={props.content.length - 1 === i ? -1 : i}
|
|
85
|
-
/>
|
|
86
|
-
)
|
|
87
|
-
})}
|
|
88
|
-
</div>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
@@ -4,7 +4,11 @@ import { HawaButton } from "./HawaButton"
|
|
|
4
4
|
|
|
5
5
|
type AlertTypes = {
|
|
6
6
|
severity: "info" | "warning" | "error" | "success"
|
|
7
|
+
/** The title of the alert placed above the text of the alert. Can be used alone */
|
|
7
8
|
title?: any
|
|
9
|
+
/** The text of the alert placed below the title of the alert. Can be used alone */
|
|
10
|
+
text: any
|
|
11
|
+
// hideIcon?: any //TODO: an X button to delete the alert
|
|
8
12
|
variant?:
|
|
9
13
|
| "normal"
|
|
10
14
|
| "solid"
|
|
@@ -12,9 +16,7 @@ type AlertTypes = {
|
|
|
12
16
|
| "left-accent"
|
|
13
17
|
| "right-accent"
|
|
14
18
|
| "bottom-accent"
|
|
15
|
-
text: any
|
|
16
19
|
direction?: "rtl" | "ltr"
|
|
17
|
-
hideIcon?: any
|
|
18
20
|
actions?: [
|
|
19
21
|
{
|
|
20
22
|
label: string
|
|
@@ -2,7 +2,7 @@ import React from "react"
|
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
|
|
4
4
|
// TODO: make icon based on direction
|
|
5
|
-
// TODO: Preferebly
|
|
5
|
+
// TODO: Preferebly use context to pass direction rtl | ltr
|
|
6
6
|
|
|
7
7
|
type TextFieldTypes = {
|
|
8
8
|
margin?: "none" | "normal" | "large"
|
|
@@ -52,7 +52,7 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
52
52
|
let defaultInputStyle =
|
|
53
53
|
"block w-full rounded border border-gray-300 bg-white p-2 text-sm 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"
|
|
54
54
|
let previewInputStyle =
|
|
55
|
-
"block w-full rounded bg-gray-50 p-2 text-sm 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"
|
|
55
|
+
"block w-full rounded bg-gray-50 h-9 p-2 text-sm 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"
|
|
56
56
|
// "mb-0 block w-full rounded border border-gray-300 bg-gray-50 p-2 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",
|
|
57
57
|
|
|
58
58
|
return (
|
|
@@ -61,7 +61,7 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
61
61
|
>
|
|
62
62
|
{props.label && (
|
|
63
63
|
<label
|
|
64
|
-
htmlFor="first_name"
|
|
64
|
+
// htmlFor="first_name"
|
|
65
65
|
className="mb-2 block text-sm font-medium text-gray-900 dark:text-gray-300"
|
|
66
66
|
>
|
|
67
67
|
{props.label}
|
|
@@ -89,6 +89,10 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
89
89
|
{props.icon}
|
|
90
90
|
</div>
|
|
91
91
|
)}
|
|
92
|
+
{/* <input
|
|
93
|
+
{...props}
|
|
94
|
+
className={clsx(previewInputStyle, props.icon ? "pl-10" : "")}
|
|
95
|
+
/> */}
|
|
92
96
|
<div
|
|
93
97
|
// {...props}
|
|
94
98
|
className={clsx(previewInputStyle, props.icon ? "pl-10" : "")}
|
package/src/elements/index.ts
CHANGED
package/src/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
! tailwindcss v3.3.
|
|
2
|
+
! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com
|
|
3
3
|
*//*
|
|
4
4
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
5
5
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
@@ -167,6 +167,8 @@ optgroup,
|
|
|
167
167
|
select,
|
|
168
168
|
textarea {
|
|
169
169
|
font-family: inherit; /* 1 */
|
|
170
|
+
font-feature-settings: inherit; /* 1 */
|
|
171
|
+
font-variation-settings: inherit; /* 1 */
|
|
170
172
|
font-size: 100%; /* 1 */
|
|
171
173
|
font-weight: inherit; /* 1 */
|
|
172
174
|
line-height: inherit; /* 1 */
|
|
@@ -304,6 +306,13 @@ menu {
|
|
|
304
306
|
padding: 0;
|
|
305
307
|
}
|
|
306
308
|
|
|
309
|
+
/*
|
|
310
|
+
Reset default styling for dialogs.
|
|
311
|
+
*/
|
|
312
|
+
dialog {
|
|
313
|
+
padding: 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
307
316
|
/*
|
|
308
317
|
Prevent resizing textareas horizontally by default.
|
|
309
318
|
*/
|
|
@@ -594,6 +603,9 @@ video {
|
|
|
594
603
|
.bottom-0 {
|
|
595
604
|
bottom: 0px;
|
|
596
605
|
}
|
|
606
|
+
.bottom-1 {
|
|
607
|
+
bottom: 0.25rem;
|
|
608
|
+
}
|
|
597
609
|
.bottom-4 {
|
|
598
610
|
bottom: 1rem;
|
|
599
611
|
}
|
|
@@ -672,6 +684,9 @@ video {
|
|
|
672
684
|
.m-3 {
|
|
673
685
|
margin: 0.75rem;
|
|
674
686
|
}
|
|
687
|
+
.m-5 {
|
|
688
|
+
margin: 1.25rem;
|
|
689
|
+
}
|
|
675
690
|
.mx-1 {
|
|
676
691
|
margin-left: 0.25rem;
|
|
677
692
|
margin-right: 0.25rem;
|
|
@@ -696,6 +711,10 @@ video {
|
|
|
696
711
|
margin-top: 1rem;
|
|
697
712
|
margin-bottom: 1rem;
|
|
698
713
|
}
|
|
714
|
+
.my-8 {
|
|
715
|
+
margin-top: 2rem;
|
|
716
|
+
margin-bottom: 2rem;
|
|
717
|
+
}
|
|
699
718
|
.-mb-px {
|
|
700
719
|
margin-bottom: -1px;
|
|
701
720
|
}
|
|
@@ -1025,6 +1044,9 @@ video {
|
|
|
1025
1044
|
width: -moz-min-content;
|
|
1026
1045
|
width: min-content;
|
|
1027
1046
|
}
|
|
1047
|
+
.w-screen {
|
|
1048
|
+
width: 100vw;
|
|
1049
|
+
}
|
|
1028
1050
|
.min-w-\[24px\] {
|
|
1029
1051
|
min-width: 24px;
|
|
1030
1052
|
}
|
|
@@ -1122,6 +1144,11 @@ video {
|
|
|
1122
1144
|
.cursor-pointer {
|
|
1123
1145
|
cursor: pointer;
|
|
1124
1146
|
}
|
|
1147
|
+
.select-none {
|
|
1148
|
+
-webkit-user-select: none;
|
|
1149
|
+
-moz-user-select: none;
|
|
1150
|
+
user-select: none;
|
|
1151
|
+
}
|
|
1125
1152
|
.resize-none {
|
|
1126
1153
|
resize: none;
|
|
1127
1154
|
}
|
|
@@ -1196,9 +1223,6 @@ video {
|
|
|
1196
1223
|
.gap-20 {
|
|
1197
1224
|
gap: 5rem;
|
|
1198
1225
|
}
|
|
1199
|
-
.gap-3 {
|
|
1200
|
-
gap: 0.75rem;
|
|
1201
|
-
}
|
|
1202
1226
|
.gap-4 {
|
|
1203
1227
|
gap: 1rem;
|
|
1204
1228
|
}
|
|
@@ -1274,6 +1298,9 @@ video {
|
|
|
1274
1298
|
.overflow-y-clip {
|
|
1275
1299
|
overflow-y: clip;
|
|
1276
1300
|
}
|
|
1301
|
+
.overflow-y-scroll {
|
|
1302
|
+
overflow-y: scroll;
|
|
1303
|
+
}
|
|
1277
1304
|
.truncate {
|
|
1278
1305
|
overflow: hidden;
|
|
1279
1306
|
text-overflow: ellipsis;
|
|
@@ -1314,10 +1341,6 @@ video {
|
|
|
1314
1341
|
border-bottom-right-radius: 0.5rem;
|
|
1315
1342
|
border-bottom-left-radius: 0.5rem;
|
|
1316
1343
|
}
|
|
1317
|
-
.rounded-b-xl {
|
|
1318
|
-
border-bottom-right-radius: 0.75rem;
|
|
1319
|
-
border-bottom-left-radius: 0.75rem;
|
|
1320
|
-
}
|
|
1321
1344
|
.rounded-l {
|
|
1322
1345
|
border-top-left-radius: var(--border-radius);
|
|
1323
1346
|
border-bottom-left-radius: var(--border-radius);
|
|
@@ -1342,10 +1365,6 @@ video {
|
|
|
1342
1365
|
border-top-left-radius: 0.5rem;
|
|
1343
1366
|
border-top-right-radius: 0.5rem;
|
|
1344
1367
|
}
|
|
1345
|
-
.rounded-t-xl {
|
|
1346
|
-
border-top-left-radius: 0.75rem;
|
|
1347
|
-
border-top-right-radius: 0.75rem;
|
|
1348
|
-
}
|
|
1349
1368
|
.rounded-bl {
|
|
1350
1369
|
border-bottom-left-radius: var(--border-radius);
|
|
1351
1370
|
}
|
|
@@ -1602,6 +1621,10 @@ video {
|
|
|
1602
1621
|
--tw-bg-opacity: 1;
|
|
1603
1622
|
background-color: rgb(185 28 28 / var(--tw-bg-opacity));
|
|
1604
1623
|
}
|
|
1624
|
+
.bg-red-900 {
|
|
1625
|
+
--tw-bg-opacity: 1;
|
|
1626
|
+
background-color: rgb(127 29 29 / var(--tw-bg-opacity));
|
|
1627
|
+
}
|
|
1605
1628
|
.bg-slate-600 {
|
|
1606
1629
|
--tw-bg-opacity: 1;
|
|
1607
1630
|
background-color: rgb(71 85 105 / var(--tw-bg-opacity));
|
|
@@ -1766,6 +1789,9 @@ video {
|
|
|
1766
1789
|
.pt-0 {
|
|
1767
1790
|
padding-top: 0px;
|
|
1768
1791
|
}
|
|
1792
|
+
.pt-2 {
|
|
1793
|
+
padding-top: 0.5rem;
|
|
1794
|
+
}
|
|
1769
1795
|
.pt-3 {
|
|
1770
1796
|
padding-top: 0.75rem;
|
|
1771
1797
|
}
|
|
@@ -2179,6 +2205,12 @@ body {
|
|
|
2179
2205
|
width: 10rem;
|
|
2180
2206
|
}
|
|
2181
2207
|
|
|
2208
|
+
.hover\:scale-150:hover {
|
|
2209
|
+
--tw-scale-x: 1.5;
|
|
2210
|
+
--tw-scale-y: 1.5;
|
|
2211
|
+
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));
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2182
2214
|
.hover\:cursor-pointer:hover {
|
|
2183
2215
|
cursor: pointer;
|
|
2184
2216
|
}
|
|
@@ -2188,6 +2220,11 @@ body {
|
|
|
2188
2220
|
background-color: rgb(191 219 254 / var(--tw-bg-opacity));
|
|
2189
2221
|
}
|
|
2190
2222
|
|
|
2223
|
+
.hover\:bg-blue-500:hover {
|
|
2224
|
+
--tw-bg-opacity: 1;
|
|
2225
|
+
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2191
2228
|
.hover\:bg-buttonPrimary-500:hover {
|
|
2192
2229
|
background-color: var(--button-primary-500);
|
|
2193
2230
|
}
|
|
@@ -2250,11 +2287,6 @@ body {
|
|
|
2250
2287
|
color: rgb(156 163 175 / var(--tw-text-opacity));
|
|
2251
2288
|
}
|
|
2252
2289
|
|
|
2253
|
-
.hover\:text-gray-500:hover {
|
|
2254
|
-
--tw-text-opacity: 1;
|
|
2255
|
-
color: rgb(107 114 128 / var(--tw-text-opacity));
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
2290
|
.hover\:text-gray-900:hover {
|
|
2259
2291
|
--tw-text-opacity: 1;
|
|
2260
2292
|
color: rgb(17 24 39 / var(--tw-text-opacity));
|
|
@@ -2342,6 +2374,11 @@ body {
|
|
|
2342
2374
|
--tw-ring-color: rgb(249 250 251 / var(--tw-ring-opacity));
|
|
2343
2375
|
}
|
|
2344
2376
|
|
|
2377
|
+
.disabled\:bg-gray-200:disabled {
|
|
2378
|
+
--tw-bg-opacity: 1;
|
|
2379
|
+
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2345
2382
|
.peer:checked ~ .peer-checked\:bg-buttonPrimary-500 {
|
|
2346
2383
|
background-color: var(--button-primary-500);
|
|
2347
2384
|
}
|