@sikka/hawa 0.0.239 → 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.239",
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
@@ -1,38 +1,38 @@
1
1
  import React from "react"
2
2
  import clsx from "clsx"
3
3
 
4
- type AccordionItemTypes = {
5
- title: any
6
- count: any
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
- const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
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.count}
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.count}
33
+ data-accordion-target={"#accordion-collapse-body-" + props.index}
34
34
  aria-expanded="true"
35
- aria-controls={"accordion-collapse-body-" + props.count}
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.count}
56
- aria-labelledby={"accordion-collapse-heading-" + props.count}
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" : " visible h-full",
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 usse context to pass direction rtl | ltr
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/styles.css CHANGED
@@ -594,6 +594,9 @@ video {
594
594
  .bottom-0 {
595
595
  bottom: 0px;
596
596
  }
597
+ .bottom-1 {
598
+ bottom: 0.25rem;
599
+ }
597
600
  .bottom-4 {
598
601
  bottom: 1rem;
599
602
  }
@@ -672,6 +675,9 @@ video {
672
675
  .m-3 {
673
676
  margin: 0.75rem;
674
677
  }
678
+ .m-5 {
679
+ margin: 1.25rem;
680
+ }
675
681
  .mx-1 {
676
682
  margin-left: 0.25rem;
677
683
  margin-right: 0.25rem;
@@ -696,6 +702,10 @@ video {
696
702
  margin-top: 1rem;
697
703
  margin-bottom: 1rem;
698
704
  }
705
+ .my-8 {
706
+ margin-top: 2rem;
707
+ margin-bottom: 2rem;
708
+ }
699
709
  .-mb-px {
700
710
  margin-bottom: -1px;
701
711
  }
@@ -1122,6 +1132,11 @@ video {
1122
1132
  .cursor-pointer {
1123
1133
  cursor: pointer;
1124
1134
  }
1135
+ .select-none {
1136
+ -webkit-user-select: none;
1137
+ -moz-user-select: none;
1138
+ user-select: none;
1139
+ }
1125
1140
  .resize-none {
1126
1141
  resize: none;
1127
1142
  }
@@ -1196,9 +1211,6 @@ video {
1196
1211
  .gap-20 {
1197
1212
  gap: 5rem;
1198
1213
  }
1199
- .gap-3 {
1200
- gap: 0.75rem;
1201
- }
1202
1214
  .gap-4 {
1203
1215
  gap: 1rem;
1204
1216
  }
@@ -1314,10 +1326,6 @@ video {
1314
1326
  border-bottom-right-radius: 0.5rem;
1315
1327
  border-bottom-left-radius: 0.5rem;
1316
1328
  }
1317
- .rounded-b-xl {
1318
- border-bottom-right-radius: 0.75rem;
1319
- border-bottom-left-radius: 0.75rem;
1320
- }
1321
1329
  .rounded-l {
1322
1330
  border-top-left-radius: var(--border-radius);
1323
1331
  border-bottom-left-radius: var(--border-radius);
@@ -1342,10 +1350,6 @@ video {
1342
1350
  border-top-left-radius: 0.5rem;
1343
1351
  border-top-right-radius: 0.5rem;
1344
1352
  }
1345
- .rounded-t-xl {
1346
- border-top-left-radius: 0.75rem;
1347
- border-top-right-radius: 0.75rem;
1348
- }
1349
1353
  .rounded-bl {
1350
1354
  border-bottom-left-radius: var(--border-radius);
1351
1355
  }
@@ -1766,6 +1770,9 @@ video {
1766
1770
  .pt-0 {
1767
1771
  padding-top: 0px;
1768
1772
  }
1773
+ .pt-2 {
1774
+ padding-top: 0.5rem;
1775
+ }
1769
1776
  .pt-3 {
1770
1777
  padding-top: 0.75rem;
1771
1778
  }
@@ -2179,6 +2186,12 @@ body {
2179
2186
  width: 10rem;
2180
2187
  }
2181
2188
 
2189
+ .hover\:scale-150:hover {
2190
+ --tw-scale-x: 1.5;
2191
+ --tw-scale-y: 1.5;
2192
+ 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));
2193
+ }
2194
+
2182
2195
  .hover\:cursor-pointer:hover {
2183
2196
  cursor: pointer;
2184
2197
  }
@@ -2250,11 +2263,6 @@ body {
2250
2263
  color: rgb(156 163 175 / var(--tw-text-opacity));
2251
2264
  }
2252
2265
 
2253
- .hover\:text-gray-500:hover {
2254
- --tw-text-opacity: 1;
2255
- color: rgb(107 114 128 / var(--tw-text-opacity));
2256
- }
2257
-
2258
2266
  .hover\:text-gray-900:hover {
2259
2267
  --tw-text-opacity: 1;
2260
2268
  color: rgb(17 24 39 / var(--tw-text-opacity));
@@ -2342,6 +2350,11 @@ body {
2342
2350
  --tw-ring-color: rgb(249 250 251 / var(--tw-ring-opacity));
2343
2351
  }
2344
2352
 
2353
+ .disabled\:bg-gray-200:disabled {
2354
+ --tw-bg-opacity: 1;
2355
+ background-color: rgb(229 231 235 / var(--tw-bg-opacity));
2356
+ }
2357
+
2345
2358
  .peer:checked ~ .peer-checked\:bg-buttonPrimary-500 {
2346
2359
  background-color: var(--button-primary-500);
2347
2360
  }