@sikka/hawa 0.0.265 → 0.0.266

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.
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  type HawaAppLayoutTypes = {
3
+ /** The pages of the side drawer */
3
4
  drawerItems: {
4
5
  label: string;
5
6
  icon: any;
@@ -20,6 +21,7 @@ type HawaAppLayoutTypes = {
20
21
  drawerSize?: "sm" | "md" | "large";
21
22
  profileMenuItems?: MenuItems[][];
22
23
  onSettingsClick?: () => void;
24
+ DrawerFooterActions: any;
23
25
  };
24
26
  type MenuItems = {
25
27
  icon?: JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.265",
3
+ "version": "0.0.266",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -1,6 +1,7 @@
1
1
  import React, { useRef, useState, useEffect } from "react"
2
2
  import clsx from "clsx"
3
3
  import { HawaButton } from "./HawaButton"
4
+ import { FiAlertCircle } from "react-icons/fi"
4
5
 
5
6
  type AlertTypes = {
6
7
  severity: "info" | "warning" | "error" | "success"
@@ -10,7 +11,6 @@ type AlertTypes = {
10
11
  text: any
11
12
  /** The duration for the alert to stay on the screen */
12
13
  duration?: number
13
- // hideIcon?: any //TODO: an X button to delete the alert
14
14
  variant?:
15
15
  | "normal"
16
16
  | "solid"
@@ -26,11 +26,14 @@ type AlertTypes = {
26
26
  variant: "contained" | "outlined"
27
27
  }
28
28
  ]
29
+ persistant?: boolean
30
+ icon?: any
29
31
  }
30
32
  export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
31
33
  variant = "normal",
32
34
  direction = "ltr",
33
35
  duration,
36
+ icon,
34
37
  ...props
35
38
  }) => {
36
39
  const alertRef = useRef(null)
@@ -55,6 +58,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
55
58
  }
56
59
  }, [duration])
57
60
  let closeButtonStyle = {
61
+ none: "hover:bg-gray-300",
58
62
  info: "hover:bg-blue-300",
59
63
  warning: "hover:bg-yellow-300",
60
64
  error: "hover:bg-red-300",
@@ -62,6 +66,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
62
66
  }
63
67
  let styleVariant = {
64
68
  normal: {
69
+ none: "text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
65
70
  info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
66
71
  warning:
67
72
  "text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
@@ -70,6 +75,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
70
75
  "text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
71
76
  },
72
77
  "top-accent": {
78
+ none: "border-t-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
73
79
  info: "border-t-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
74
80
  warning:
75
81
  "border-t-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
@@ -79,6 +85,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
79
85
  "border-t-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
80
86
  },
81
87
  "left-accent": {
88
+ none: "border-l-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
82
89
  info: "border-l-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
83
90
  warning:
84
91
  "border-l-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
@@ -88,6 +95,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
88
95
  "border-l-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
89
96
  },
90
97
  "right-accent": {
98
+ none: "border-r-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
91
99
  info: "border-r-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
92
100
  warning:
93
101
  "border-r-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
@@ -97,6 +105,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
97
105
  "border-r-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
98
106
  },
99
107
  "bottom-accent": {
108
+ none: "border-b-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
100
109
  info: "border-b-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
101
110
  warning:
102
111
  "border-b-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
@@ -117,58 +126,71 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
117
126
  role="alert"
118
127
  dir={direction}
119
128
  >
120
- <span
121
- className={clsx("font-medium", direction === "rtl" ? "ml-8" : "mr-8")}
122
- >
123
- {props.title}
124
- </span>
125
- <span>{" " + props.text}</span>
126
-
127
- {props.actions && (
128
- <div className="mt-2 flex flex-row gap-2">
129
- {props.actions.map((act, index) => (
130
- <HawaButton
131
- key={index}
132
- variant={act.variant}
133
- onClick={act.onClick()}
134
- margins="none"
135
- >
136
- {act.label}
137
- </HawaButton>
138
- ))}
139
- </div>
140
- )}
141
- <button
142
- type="button"
143
- className={clsx(
144
- "absolute top-2 inline-flex h-9 w-9 items-center justify-center rounded-inner p-1.5 text-gray-400 transition-all hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white",
145
- closeButtonStyle[props.severity],
146
- direction === "rtl" ? "left-2" : "right-2"
129
+ <div className="flex flex-row">
130
+ {icon && (
131
+ <div className={direction === "rtl" ? "pl-2 pt-1" : "pr-2 pt-1"}>
132
+ {icon}
133
+ </div>
147
134
  )}
148
- data-dismiss-target="#alert-default"
149
- aria-label="Close"
150
- onClick={() => {
151
- setClosed(true)
152
- setTimeout(() => {
153
- alertRef.current.removeChild(alertRef.current.children[0])
154
- }, 200)
155
- }}
156
- >
157
- <span className="sr-only">Close</span>
158
- <svg
159
- aria-hidden="true"
160
- className="h-5 w-5"
161
- fill="currentColor"
162
- viewBox="0 0 20 20"
163
- xmlns="http://www.w3.org/2000/svg"
135
+ <div className="flex flex-col">
136
+ <span
137
+ className={clsx(
138
+ "font-medium",
139
+ direction === "rtl" ? "ml-8" : "mr-8"
140
+ )}
141
+ >
142
+ {props.title}
143
+ </span>
144
+ <span>{" " + props.text}</span>
145
+ {props.actions && (
146
+ <div className="mt-2 flex flex-row gap-2">
147
+ {props.actions.map((act, index) => (
148
+ <HawaButton
149
+ key={index}
150
+ variant={act.variant}
151
+ onClick={act.onClick()}
152
+ margins="none"
153
+ >
154
+ {act.label}
155
+ </HawaButton>
156
+ ))}
157
+ </div>
158
+ )}
159
+ </div>
160
+ </div>
161
+ {!props.persistant && (
162
+ <button
163
+ type="button"
164
+ className={clsx(
165
+ "absolute top-2 inline-flex h-9 w-9 items-center justify-center rounded-inner p-1.5 text-gray-400 transition-all hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white",
166
+ closeButtonStyle[props.severity],
167
+ direction === "rtl" ? "left-2" : "right-2"
168
+ )}
169
+ data-dismiss-target="#alert-default"
170
+ aria-label="Close"
171
+ onClick={() => {
172
+ setClosed(true)
173
+ setTimeout(() => {
174
+ alertRef.current.removeChild(alertRef.current.children[0])
175
+ }, 200)
176
+ }}
164
177
  >
165
- <path
166
- fillRule="evenodd"
167
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
168
- clipRule="evenodd"
169
- ></path>
170
- </svg>
171
- </button>
178
+ <span className="sr-only">Close</span>
179
+ <svg
180
+ aria-hidden="true"
181
+ className="h-5 w-5"
182
+ fill="currentColor"
183
+ viewBox="0 0 20 20"
184
+ xmlns="http://www.w3.org/2000/svg"
185
+ >
186
+ <path
187
+ fillRule="evenodd"
188
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
189
+ clipRule="evenodd"
190
+ ></path>
191
+ </svg>
192
+ </button>
193
+ )}
172
194
  </div>
173
195
  </div>
174
196
  )
@@ -7,7 +7,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
7
7
  variant?: "contained" | "outlined"
8
8
  feedback?: string
9
9
  tooltipDirection?: "rtl" | "ltr"
10
- color?: "default" | "primary" | "secondary"
10
+ color?: "default" | "primary" | "secondary" | "light" | "dark"
11
11
  width?: "full" | "normal" | "half"
12
12
  size?: "xs" | "small" | "medium" | "large" | "noPadding" | "full"
13
13
  margins?: "none" | "1" | "2" | "3" | "4"
@@ -26,6 +26,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
26
26
  endIcon?: any
27
27
  isLoading?: boolean
28
28
  badge?: any
29
+ edgeCorner?: any
29
30
  }
30
31
 
31
32
  const disabledSyles = "cursor-default pointer-events-none"
@@ -34,7 +35,7 @@ const disabledVariantSyles = {
34
35
  outlined: "text-gray-300 border-gray-300",
35
36
  }
36
37
  const baseStyles =
37
- "cursor-pointer h-[2.36rem] justify-center items-center text-center font-medium rounded transition-all"
38
+ "cursor-pointer h-[2.36rem] justify-center items-center text-center font-medium transition-all"
38
39
  const sizeStyles = {
39
40
  xs: "px-1 py-1",
40
41
  small: "text-xs px-2.5 py-1.5",
@@ -65,13 +66,17 @@ const colorStyles = {
65
66
  primary:
66
67
  "text-white bg-buttonPrimary-500 hover:bg-buttonPrimary-700 transition-all",
67
68
  secondary:
68
- "text-neutral-900 bg-buttonSecondary-default hover:text-white hover:bg-buttonSecondary-700",
69
+ "bg-buttonSecondary-500 hover:text-white hover:bg-buttonSecondary-700",
70
+ gray: "text-neutral-900 bg-gray-200 hover:bg-gray-300",
71
+ dark: "text-neutral-900 bg-gray-200 hover:bg-gray-300",
69
72
  },
70
73
  outlined: {
71
74
  default: "text-gray-600 border-gray-600 hover:bg-gray-200",
72
75
  primary: "text-black hover:bg-gray-50",
73
76
  secondary:
74
77
  "text-secondary-800 border-secondary-800 hover:bg-buttonSecondary-700 hover:text-white",
78
+ gray: "border-gray-300 hover:bg-gray-200 ",
79
+ dark: "border-gray-900 hover:bg-gray-700 ",
75
80
  },
76
81
  }
77
82
 
@@ -90,6 +95,7 @@ export const HawaButton: FC<ButtonProps> = ({
90
95
  margins = "2",
91
96
  children,
92
97
  badge,
98
+ edgeCorner = false,
93
99
  feedback,
94
100
  ...props
95
101
  }) => {
@@ -136,6 +142,8 @@ export const HawaButton: FC<ButtonProps> = ({
136
142
  ? clsx(
137
143
  className,
138
144
  baseStyles,
145
+ edgeCorner ? "rounded-inner" : "rounded",
146
+
139
147
  variantStyles[variant],
140
148
  sizeStyles[size],
141
149
  widthStyles[width],
@@ -145,6 +153,8 @@ export const HawaButton: FC<ButtonProps> = ({
145
153
  : clsx(
146
154
  className,
147
155
  baseStyles,
156
+ edgeCorner ? "rounded-inner" : "rounded",
157
+
148
158
  variantStyles[variant],
149
159
  sizeStyles[size],
150
160
  colorStyles[variant][color],
@@ -165,6 +175,8 @@ export const HawaButton: FC<ButtonProps> = ({
165
175
  ? clsx(
166
176
  className,
167
177
  baseStyles,
178
+ edgeCorner ? "rounded-inner" : "rounded",
179
+
168
180
  variantStyles[variant],
169
181
  sizeStyles[size],
170
182
  widthStyles[width],
@@ -175,6 +187,7 @@ export const HawaButton: FC<ButtonProps> = ({
175
187
  className,
176
188
  "overflow-x-clip",
177
189
  baseStyles,
190
+ edgeCorner ? "rounded-inner" : "rounded",
178
191
  variantStyles[variant],
179
192
  sizeStyles[size],
180
193
  colorStyles[variant][color],
@@ -188,7 +201,7 @@ export const HawaButton: FC<ButtonProps> = ({
188
201
  {!isLoading ? (
189
202
  <div
190
203
  className={clsx(
191
- " flex flex-col-reverse items-start justify-center gap-4 s transition-all",
204
+ " s flex flex-col-reverse items-start justify-center gap-4 transition-all",
192
205
  isClicked && feedback
193
206
  ? " -translate-y-8 pb-1 pt-1"
194
207
  : "translate-y-0"
@@ -112,6 +112,7 @@ export const HawaCodeBlock: FC<CodeBlockTypes> = ({
112
112
  </div>
113
113
  <HawaButton
114
114
  variant="outlined"
115
+ color="dark"
115
116
  onClick={() => {
116
117
  handleCopyClick()
117
118
  navigator.clipboard.writeText(
@@ -0,0 +1,9 @@
1
+ import React, { FC } from "react"
2
+
3
+ type InlineCodeTypes = {
4
+ text: string
5
+ }
6
+
7
+ export const HawaInlineCode: FC<InlineCodeTypes> = (props) => {
8
+ return <code className="inline-code">{props.text}</code>
9
+ }
@@ -197,10 +197,10 @@ export const HawaMenu: FC<TMenuTypes> = ({
197
197
  className={clsx(
198
198
  "transition-all",
199
199
  item.isButton
200
- ? "flex cursor-pointer flex-row items-center rounded bg-buttonPrimary-500 px-4 py-2 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse"
200
+ ? "flex cursor-pointer flex-row items-center rounded-inner bg-buttonPrimary-500 px-4 py-2 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse"
201
201
  : item.disabled
202
202
  ? "text-gray-300"
203
- : " flex cursor-pointer flex-row items-center rounded hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white ",
203
+ : " flex cursor-pointer flex-row items-center rounded-inner hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white ",
204
204
  sizeStyles[size]
205
205
  )}
206
206
  >
@@ -0,0 +1,35 @@
1
+ import React, { FC } from "react"
2
+
3
+ type TimelineTypes = {
4
+ title: any
5
+ steps: StepTypes[]
6
+ }
7
+ type StepTypes = {
8
+ date: string
9
+ title: string
10
+ description?: string
11
+ actions?: any
12
+ }
13
+ export const Timeline: FC<TimelineTypes> = (props) => {
14
+ return (
15
+ <div>
16
+ <ol className="relative border-l border-gray-200 dark:border-gray-700">
17
+ {props.steps.map((step) => (
18
+ <li className="mb-10 ml-4">
19
+ <div className="absolute -left-1.5 mt-1.5 h-3 w-3 rounded-full border border-white bg-gray-200 dark:border-gray-900 dark:bg-gray-700"></div>
20
+ <time className="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">
21
+ {step.date}
22
+ </time>
23
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white">
24
+ {step.title}
25
+ </h3>
26
+ <p className="mb-4 text-base font-normal text-gray-500 dark:text-gray-400">
27
+ {step.description}
28
+ </p>
29
+ {step.actions}
30
+ </li>
31
+ ))}
32
+ </ol>
33
+ </div>
34
+ )
35
+ }
@@ -13,8 +13,6 @@ export * from "./HawaTable"
13
13
  export * from "./HawaColorPicker"
14
14
  export * from "./HawaSearchBar"
15
15
  export * from "./HawaAccordion"
16
- export * from "./DragDropImages"
17
- export * from "./DraggableCard"
18
16
  export * from "./HawaPhoneInput"
19
17
  export * from "./HawaTooltip"
20
18
  export * from "./HawaTabs"
@@ -22,22 +20,26 @@ export * from "./HawaModal"
22
20
  export * from "./HawaMenu"
23
21
  export * from "./HawaCopyrights"
24
22
  export * from "./HawaStepper"
25
- export * from "./Breadcrumb"
26
23
  export * from "./HawaStats"
27
24
  export * from "./HawaCodeBlock"
28
25
  export * from "./HawaSpinner"
29
26
  export * from "./HawaRadio"
30
27
  export * from "./HawaDrawer"
28
+ export * from "./HawaDatepicker"
29
+ export * from "./DragDropImages"
30
+ export * from "./DraggableCard"
31
+ export * from "./Breadcrumb"
31
32
  export * from "./SubsectionList"
32
33
  export * from "./UsageCard"
33
34
  export * from "./InvoiceAccordion"
34
- export * from "./HawaDatepicker"
35
35
  export * from "./UserFeedback"
36
36
  export * from "./ArrowCarousel"
37
37
  export * from "./FloatingComment"
38
38
  export * from "./FloatingCommentSlate"
39
39
  export * from "./FloatingCommentExec"
40
40
  export * from "./BackToTop"
41
+ export * from "./HawaInlineCode"
42
+ export * from "./Timeline"
41
43
  // Inputs
42
44
  export * from "./HawaTextField"
43
45
  export * from "./HawaCardInput"