@sikka/hawa 0.0.104 → 0.0.106

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.
Files changed (37) hide show
  1. package/dist/styles.css +167 -81
  2. package/es/blocks/Misc/EmptyState.d.ts +4 -0
  3. package/es/blocks/Misc/index.d.ts +1 -0
  4. package/es/elements/HawaButton.d.ts +1 -1
  5. package/es/elements/HawaCardInput.d.ts +25 -0
  6. package/es/elements/HawaTable.d.ts +1 -0
  7. package/es/elements/HawaTimeline.d.ts +8 -0
  8. package/es/elements/index.d.ts +3 -1
  9. package/es/index.es.js +1 -1
  10. package/es/layout/HawaContainer.d.ts +2 -0
  11. package/lib/blocks/Misc/EmptyState.d.ts +4 -0
  12. package/lib/blocks/Misc/index.d.ts +1 -0
  13. package/lib/elements/HawaButton.d.ts +1 -1
  14. package/lib/elements/HawaCardInput.d.ts +25 -0
  15. package/lib/elements/HawaTable.d.ts +1 -0
  16. package/lib/elements/HawaTimeline.d.ts +8 -0
  17. package/lib/elements/index.d.ts +3 -1
  18. package/lib/index.js +1 -1
  19. package/lib/layout/HawaContainer.d.ts +2 -0
  20. package/package.json +1 -1
  21. package/src/blocks/Misc/EmptyState.tsx +24 -0
  22. package/src/blocks/Misc/NotFound.tsx +15 -12
  23. package/src/blocks/Misc/index.ts +2 -1
  24. package/src/elements/HawaAccordian.tsx +21 -10
  25. package/src/elements/HawaButton.tsx +2 -1
  26. package/src/elements/HawaCardInput.tsx +317 -0
  27. package/src/elements/HawaItemCard.tsx +5 -2
  28. package/src/elements/HawaMenu.tsx +3 -3
  29. package/src/elements/HawaRadio.tsx +12 -4
  30. package/src/elements/HawaSwitch.tsx +5 -3
  31. package/src/elements/HawaTable.tsx +52 -17
  32. package/src/elements/HawaTimeline.tsx +82 -0
  33. package/src/elements/index.ts +33 -30
  34. package/src/layout/HawaContainer.tsx +18 -2
  35. package/src/styles.css +167 -81
  36. package/tailwind.config.js +10 -8
  37. package/tsconfig.json +30 -25
@@ -1,6 +1,8 @@
1
1
  import React from "react"
2
2
  import { HawaButton } from "./HawaButton"
3
-
3
+ import { FaTrash, FaExclamationCircle, FaPen } from "react-icons/fa"
4
+ import clsx from "clsx"
5
+ // import { HiOutlineEye } from "react-icons/hi2"
4
6
  type TableTypes = {
5
7
  lang?: any
6
8
  columns: any[string]
@@ -9,10 +11,19 @@ type TableTypes = {
9
11
  noDataText?: any
10
12
  handleActionClick?: any
11
13
  end?: any
14
+ size?: "normal" | "small"
12
15
  }
13
16
 
14
- export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
17
+ export const HawaTable: React.FunctionComponent<TableTypes> = ({
18
+ size = "normal",
19
+ ...props
20
+ }) => {
15
21
  let isArabic = props.lang === "ar"
22
+
23
+ let sizeStyles = {
24
+ normal: "py-3 px-6",
25
+ small: "px-3 py-1",
26
+ }
16
27
  return (
17
28
  <>
18
29
  <div>
@@ -21,15 +32,15 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
21
32
  <thead className="bg-gray-50 text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
22
33
  <tr>
23
34
  {props.columns.map((col: any, i: any) => (
24
- <th key={i} scope="col" className="py-3 px-6">
35
+ <th key={i} scope="col" className={clsx(sizeStyles[size])}>
25
36
  {col}
26
37
  </th>
27
38
  ))}
28
- {props.actions && (
29
- <th scope="col" className="py-3 px-6">
39
+ {props.actions && size !== "small" ? (
40
+ <th scope="col" className={clsx(sizeStyles[size])}>
30
41
  actions
31
42
  </th>
32
- )}
43
+ ) : null}
33
44
  </tr>
34
45
  </thead>
35
46
  <tbody>
@@ -44,30 +55,30 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
44
55
  return (
45
56
  <th
46
57
  scope="row"
47
- className="whitespace-nowrap py-4 px-6 font-medium text-gray-900 dark:text-white"
58
+ className={clsx(
59
+ sizeStyles[size],
60
+ "whitespace-nowrap font-medium text-gray-900 dark:text-white"
61
+ )}
48
62
  >
49
63
  {r}{" "}
50
64
  </th>
51
65
  )
52
66
  } else {
53
- return <td className="py-4 px-6">{r}</td>
67
+ return <td className={clsx(sizeStyles[size])}>{r}</td>
54
68
  }
55
69
  })}
56
- {props.actions && (
70
+ {props.actions && size !== "small" ? (
57
71
  <td
58
72
  align={isArabic ? "right" : "left"}
59
73
  style={{ fontWeight: 700 }}
74
+ className="flex flex-row gap-1"
60
75
  // variant={isArabic ? "borderedRight" : "borderedLeft"}
61
76
  >
62
- {props.actions.map((act: any) => (
63
- <HawaButton
64
- onClick={() => props.handleActionClick(singleRow)}
65
- >
66
- {act}
67
- </HawaButton>
68
- ))}
77
+ {props.actions.map((act: any) => {
78
+ return <TableActionButton action={act} />
79
+ })}
69
80
  </td>
70
- )}
81
+ ) : null}
71
82
  </tr>
72
83
  ))
73
84
  ) : (
@@ -192,3 +203,27 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
192
203
  </>
193
204
  )
194
205
  }
206
+
207
+ const TableActionButton = (props) => {
208
+ let smallAct = props.action.toLowerCase()
209
+ return (
210
+ <HawaButton
211
+ size="noPadding"
212
+ variant="outlined"
213
+ tooltip={props.action}
214
+ onClick={() => props.handleActionClick(smallAct)}
215
+ >
216
+ <div className="w-full rounded-lg p-1.5">
217
+ {smallAct === "delete" ? (
218
+ <FaTrash />
219
+ ) : smallAct === "view" ? (
220
+ <FaExclamationCircle />
221
+ ) : smallAct === "edit" ? (
222
+ <FaPen />
223
+ ) : (
224
+ props.action
225
+ )}
226
+ </div>
227
+ </HawaButton>
228
+ )
229
+ }
@@ -0,0 +1,82 @@
1
+ import React from "react"
2
+ import clsx from "clsx"
3
+
4
+ type THawaTimeline = {
5
+ steps: any[any]
6
+ currentStep: any
7
+ orientation: "vertical" | "horizontal"
8
+ }
9
+
10
+ export const HawaTimeline: React.FunctionComponent<THawaTimeline> = ({
11
+ orientation = "horizontal",
12
+ ...props
13
+ }) => {
14
+ let orientationStyles = {
15
+ vertical: "flex flex-col items-start w-fit",
16
+ horizontal: "flex flex-row items-baseline",
17
+ }
18
+ let lineStyles = {
19
+ vertical: {
20
+ default: "w-1 h-32 rounded-lg bg-primary-200 ml-6 my-2",
21
+ selected: "w-1 h-32 rounded-lg bg-primary-400 ml-6 my-2",
22
+ },
23
+ horizontal: {
24
+ default: "h-0.5 w-full rounded-lg bg-primary-200",
25
+ selected: "h-0.5 w-full rounded-lg bg-primary-400",
26
+ },
27
+ }
28
+ return (
29
+ <div className={clsx(orientationStyles[orientation])}>
30
+ {props.steps.map((step: any, i: number) => {
31
+ if (i == 0) {
32
+ return (
33
+ <TimelineStep
34
+ orientation={orientation}
35
+ current={i + 1 <= props.currentStep}
36
+ stepName={step}
37
+ stepNumber={i + 1}
38
+ />
39
+ )
40
+ } else {
41
+ return (
42
+ <>
43
+ <div
44
+ className={clsx(
45
+ i == props.currentStep
46
+ ? lineStyles[orientation].default
47
+ : lineStyles[orientation].selected
48
+ )}
49
+ ></div>
50
+ <TimelineStep
51
+ orientation={orientation}
52
+ current={i + 1 <= props.currentStep}
53
+ stepName={step}
54
+ stepNumber={i + 1}
55
+ />
56
+ </>
57
+ )
58
+ }
59
+ })}
60
+ </div>
61
+ )
62
+ }
63
+
64
+ const TimelineStep = (props) => (
65
+ <div
66
+ className={
67
+ props.orientation === "vertical"
68
+ ? "flex w-full flex-row items-center"
69
+ : "flex w-fit flex-col items-center justify-center p-2"
70
+ }
71
+ >
72
+ <div
73
+ className={clsx(
74
+ "m-2 mr-4 flex h-10 w-10 items-center justify-center rounded-xl ring-2 ring-primary-200 ring-offset-2",
75
+ props.current ? "bg-primary-500 text-white" : "bg-primary-200"
76
+ )}
77
+ >
78
+ {props.stepNumber}
79
+ </div>
80
+ <div className="whitespace-nowrap">{props.stepName}</div>
81
+ </div>
82
+ )
@@ -1,32 +1,35 @@
1
- export * from "./HawaSnackbar";
2
- export * from "./HawaSwitch";
3
- export * from "./HawaCheckbox";
4
- export * from "./HawaPanelTabs";
5
- export * from "./HawaChip";
6
- export * from "./HawaSettingsRow";
7
- export * from "./HawaSelect";
8
- export * from "./HawaRange";
9
- export * from "./HawaTextField";
10
- export * from "./HawaTypography";
11
- export * from "./HawaAlert";
12
- export * from "./HawaTable";
13
- export * from "./HawaColorPicker";
14
- export * from "./HawaSearchBar";
15
- export * from "./HawaAccordian";
16
- export * from "./DragDropImages";
17
- export * from "./DraggableCard";
18
- export * from "./HawaPhoneInput";
19
- export * from "./HawaDrawerItem";
20
- export * from "./HawaTooltip";
21
- export * from "./HawaTabs";
22
- export * from "./HawaModal";
23
- export * from "./HawaMenu";
24
- export * from "./HawaDrawer";
25
- export * from "./HawaCopyrights";
1
+ export * from "./HawaSnackbar"
2
+ export * from "./HawaSwitch"
3
+ export * from "./HawaCheckbox"
4
+ export * from "./HawaPanelTabs"
5
+ export * from "./HawaChip"
6
+ export * from "./HawaSettingsRow"
7
+ export * from "./HawaSelect"
8
+ export * from "./HawaRange"
9
+ export * from "./HawaTypography"
10
+ export * from "./HawaAlert"
11
+ export * from "./HawaTable"
12
+ export * from "./HawaColorPicker"
13
+ export * from "./HawaSearchBar"
14
+ export * from "./HawaAccordian"
15
+ export * from "./DragDropImages"
16
+ export * from "./DraggableCard"
17
+ export * from "./HawaPhoneInput"
18
+ export * from "./HawaDrawerItem"
19
+ export * from "./HawaTooltip"
20
+ export * from "./HawaTabs"
21
+ export * from "./HawaModal"
22
+ export * from "./HawaMenu"
23
+ export * from "./HawaDrawer"
24
+ export * from "./HawaCopyrights"
25
+ export * from "./HawaTimeline"
26
+ // Inputs
27
+ export * from "./HawaTextField"
28
+ export * from "./HawaCardInput"
26
29
  // Cards
27
- export * from "./HawaItemCard";
28
- export * from "./HawaPricingCard";
29
- export * from "./HawaAdCard";
30
+ export * from "./HawaItemCard"
31
+ export * from "./HawaPricingCard"
32
+ export * from "./HawaAdCard"
30
33
  //Buttons
31
- export * from "./HawaButton";
32
- export * from "./HawaLogoButton";
34
+ export * from "./HawaButton"
35
+ export * from "./HawaLogoButton"
@@ -4,20 +4,36 @@ import clsx from "clsx"
4
4
  type ContainerTypes = {
5
5
  maxWidth?: "full" | "small" | "normal"
6
6
  children: React.ReactNode
7
+ variant?: "contained" | "outlined"
8
+ centered?: boolean
7
9
  }
8
10
  export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
9
11
  maxWidth = "normal",
12
+ variant = "contained",
13
+ centered = false,
10
14
  ...props
11
15
  }) => {
12
16
  let defaultStyle =
13
- "flex w-full max-w-sm flex-col rounded-xl bg-primary-300 p-4 dark:bg-gray-600"
17
+ "flex w-full max-w-sm flex-col rounded-xl p-4 dark:bg-gray-600"
14
18
  let maxWidthStyles: any = {
15
19
  full: "md:max-w-xl",
16
20
  small: "md:max-w-sm w-1/3 min-w-min",
17
21
  normal: "md:max-w-md",
18
22
  }
23
+ let variantStyles = {
24
+ contained: "bg-primary-300",
25
+ outlined: "bg-transparent border-2 border-primary-200 w-fit",
26
+ }
27
+
19
28
  return (
20
- <div className={clsx(defaultStyle, maxWidthStyles[maxWidth], "")}>
29
+ <div
30
+ className={clsx(
31
+ defaultStyle,
32
+ maxWidthStyles[maxWidth],
33
+ variantStyles[variant],
34
+ centered ? "flex items-center text-center" : ""
35
+ )}
36
+ >
21
37
  {props.children}
22
38
  </div>
23
39
  )