@sikka/hawa 0.0.238 → 0.0.240

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.238",
3
+ "version": "0.0.240",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -1,6 +1,5 @@
1
- import React from "react"
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: any
19
- size: number
17
+ icon?: any
18
+ size?: number
20
19
  onClick?: () => void
21
20
  disabled?: boolean
21
+ direction?: "right" | "left"
22
22
  }) => {
23
23
  return (
24
- <props.icon
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: React.FunctionComponent<ComponentTypes> = (
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
- React.useEffect(() => {
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-white p-4 py-6 shadow-md">
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
- icon={FaArrowLeft}
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-min flex-col items-center justify-center p-5`}
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={`absolute bottom-0 text-${
66
- sizes[props.labelSize || "small"][0]
67
- }xl `}
68
- style={{
69
- marginBottom: sizes[props.labelSize || "small"][1],
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
- icon={FaArrowRight}
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)
@@ -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
- breadcrumbLink: TBreadcrumItem[]
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 Breadcrumb: FC<TBreadcrumb> = ({
14
- breadcrumbLink,
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
- {breadcrumbLink.map((singleBreadcrumbLink, index) => (
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 === breadcrumbLink.length
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 != breadcrumbLink.length - 1 ? (
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 Breadcrumb
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-tr-none rounded-bl-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"
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