@sikka/hawa 0.0.104 → 0.0.105

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.104",
3
+ "version": "0.0.105",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -5,7 +5,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5
5
  variant?: "contained" | "outlined"
6
6
  color?: "default" | "primary" | "secondary"
7
7
  width?: "full" | "normal" | "half"
8
- size?: "small" | "medium" | "large"
8
+ size?: "small" | "medium" | "large" | "noPadding"
9
9
  tooltip?: string
10
10
  isLoading?: boolean
11
11
  }
@@ -16,6 +16,7 @@ const sizeStyles = {
16
16
  small: "text-xs px-2.5 py-1.5",
17
17
  medium: "text-sm leading-4 px-3 py-2",
18
18
  large: "text-sm px-4 py-2",
19
+ noPadding: "p-0",
19
20
  }
20
21
 
21
22
  const widthStyles = {
@@ -40,8 +40,9 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
40
40
  horizontal: "flex flex-row w-full",
41
41
  }
42
42
  let imageStyles = {
43
- vertical: "w-full rounded-tr-lg rounded-tl-lg",
44
- horizontal: "h-40 w-fit rounded-tl-lg rounded-bl-lg",
43
+ vertical: "h-auto max-h-56 w-full rounded-t-lg object-cover",
44
+ horizontal:
45
+ "h-auto w-full rounded-l-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg",
45
46
  }
46
47
  let headerActionsButtonStyle =
47
48
  "inline-block rounded-lg p-1 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
@@ -73,6 +74,8 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
73
74
  src={"https://via.placeholder.com/50"}
74
75
  // className=" h-full w-full max-w-sm bg-red-500 bg-[url('https://via.placeholder.com/50')] bg-cover bg-no-repeat"
75
76
  className={clsx(imageStyles[orientation])}
77
+ // className="h-40 w-fit rounded-tl-lg rounded-bl-lg bg-[url('https://via.placeholder.com/50')] bg-cover bg-no-repeat "
78
+ // className="h-auto w-full rounded-l-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
76
79
  />
77
80
  )}
78
81
  <div className="relative w-full px-6 pt-6">
@@ -36,7 +36,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
36
36
  children,
37
37
  }) => {
38
38
  let defaultStyles =
39
- "border-2 border-blue-400 border-opacity-20 ring-offset-1 absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded-lg bg-white shadow transition-all dark:bg-gray-700"
39
+ "border-none ring-offset-1 absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded-lg bg-gray-50 shadow-lg transition-all dark:bg-gray-700"
40
40
  let positionStyles = {
41
41
  "top-right": "top-30 right-0",
42
42
  "top-left": "top-30 left-0",
@@ -44,8 +44,8 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
44
44
  "bottom-left": "bottom-30 left-0",
45
45
  }
46
46
  let animationStyles = {
47
- opened: "max-h-72 animate-expandDown",
48
- closed: "max-h-0 opacity-0 animate-expandUp",
47
+ opened: "max-h-fit",
48
+ closed: "h-0 ",
49
49
  }
50
50
  return (
51
51
  <div className="relative w-fit " onClick={() => handleClose(!open)}>
@@ -1,3 +1,4 @@
1
+ import clsx from "clsx"
1
2
  import React, { useState } from "react"
2
3
 
3
4
  type RadioTypes = {
@@ -8,15 +9,22 @@ type RadioTypes = {
8
9
  export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
9
10
  const [selectedOption, setSelectedOption] = useState(props.defaultValue)
10
11
  let activeTabStyle =
11
- "inline-block py-2 px-4 text-white bg-blue-600 rounded-lg active"
12
+ "inline-block py-2 px-4 w-full text-white bg-blue-600 rounded-lg active"
12
13
  let inactiveTabStyle =
13
- "inline-block py-2 px-4 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
+ "inline-block py-2 px-4 w-full bg-gray-100 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
15
 
15
16
  return (
16
17
  <div>
17
- <ul className="flex w-fit flex-wrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400">
18
+ <ul
19
+ className={clsx(
20
+ props.options.length > 2
21
+ ? "flex-wrap xs:max-w-full xs:flex-nowrap"
22
+ : "",
23
+ "flex max-w-fit flex-row whitespace-nowrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400"
24
+ )}
25
+ >
18
26
  {props.options?.map((opt: any) => (
19
- <li>
27
+ <li className="w-full">
20
28
  <button
21
29
  aria-current="page"
22
30
  onClick={() => {
@@ -17,9 +17,11 @@ export const HawaSwitch: React.FunctionComponent<SwitchTypes> = (props) => {
17
17
  className="peer sr-only"
18
18
  />
19
19
  <div className="peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:top-[2px] after:left-[2px] after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:border-gray-600 dark:bg-gray-700 dark:peer-focus:ring-blue-800"></div>
20
- <span className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300">
21
- {props.text}
22
- </span>
20
+ {props.text && (
21
+ <span className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300">
22
+ {props.text}
23
+ </span>
24
+ )}
23
25
  </label>
24
26
  )
25
27
  }
@@ -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
+ }
package/src/styles.css CHANGED
@@ -713,6 +713,9 @@ video {
713
713
  .h-full {
714
714
  height: 100%;
715
715
  }
716
+ .h-auto {
717
+ height: auto;
718
+ }
716
719
  .h-40 {
717
720
  height: 10rem;
718
721
  }
@@ -722,6 +725,9 @@ video {
722
725
  .h-11 {
723
726
  height: 2.75rem;
724
727
  }
728
+ .h-0 {
729
+ height: 0px;
730
+ }
725
731
  .h-screen {
726
732
  height: 100vh;
727
733
  }
@@ -740,11 +746,8 @@ video {
740
746
  .h-96 {
741
747
  height: 24rem;
742
748
  }
743
- .max-h-72 {
744
- max-height: 18rem;
745
- }
746
- .max-h-0 {
747
- max-height: 0px;
749
+ .max-h-56 {
750
+ max-height: 14rem;
748
751
  }
749
752
  .max-h-fit {
750
753
  max-height: -moz-fit-content;
@@ -859,34 +862,6 @@ video {
859
862
  .animate-spin {
860
863
  animation: spin 1s linear infinite;
861
864
  }
862
- @keyframes expandDown {
863
-
864
- 0% {
865
- max-height: 0;
866
- height: 0;
867
- }
868
-
869
- 100% {
870
- max-height: 100px;
871
- }
872
- }
873
- .animate-expandDown {
874
- animation: expandDown 50ms linear;
875
- }
876
- @keyframes expandUp {
877
-
878
- 0% {
879
- max-height: 100px;
880
- }
881
-
882
- 100% {
883
- max-height: 0;
884
- height: 0;
885
- }
886
- }
887
- .animate-expandUp {
888
- animation: expandUp 100ms linear;
889
- }
890
865
  .cursor-default {
891
866
  cursor: default;
892
867
  }
@@ -1032,6 +1007,14 @@ video {
1032
1007
  border-bottom-right-radius: 0.75rem;
1033
1008
  border-bottom-left-radius: 0.75rem;
1034
1009
  }
1010
+ .rounded-t-lg {
1011
+ border-top-left-radius: 0.5rem;
1012
+ border-top-right-radius: 0.5rem;
1013
+ }
1014
+ .rounded-l-lg {
1015
+ border-top-left-radius: 0.5rem;
1016
+ border-bottom-left-radius: 0.5rem;
1017
+ }
1035
1018
  .rounded-b-lg {
1036
1019
  border-bottom-right-radius: 0.5rem;
1037
1020
  border-bottom-left-radius: 0.5rem;
@@ -1040,10 +1023,6 @@ video {
1040
1023
  border-top-left-radius: 0.25rem;
1041
1024
  border-top-right-radius: 0.25rem;
1042
1025
  }
1043
- .rounded-t-lg {
1044
- border-top-left-radius: 0.5rem;
1045
- border-top-right-radius: 0.5rem;
1046
- }
1047
1026
  .rounded-l-none {
1048
1027
  border-top-left-radius: 0px;
1049
1028
  border-bottom-left-radius: 0px;
@@ -1102,6 +1081,9 @@ video {
1102
1081
  .border-dashed {
1103
1082
  border-style: dashed;
1104
1083
  }
1084
+ .border-none {
1085
+ border-style: none;
1086
+ }
1105
1087
  .border-black {
1106
1088
  --tw-border-opacity: 1;
1107
1089
  border-color: rgb(0 0 0 / var(--tw-border-opacity));
@@ -1133,10 +1115,6 @@ video {
1133
1115
  --tw-border-opacity: 1;
1134
1116
  border-color: rgb(156 163 175 / var(--tw-border-opacity));
1135
1117
  }
1136
- .border-blue-400 {
1137
- --tw-border-opacity: 1;
1138
- border-color: rgb(96 165 250 / var(--tw-border-opacity));
1139
- }
1140
1118
  .border-blue-600 {
1141
1119
  --tw-border-opacity: 1;
1142
1120
  border-color: rgb(37 99 235 / var(--tw-border-opacity));
@@ -1149,9 +1127,6 @@ video {
1149
1127
  --tw-border-opacity: 1;
1150
1128
  border-bottom-color: rgb(61 147 249 / var(--tw-border-opacity));
1151
1129
  }
1152
- .border-opacity-20 {
1153
- --tw-border-opacity: 0.2;
1154
- }
1155
1130
  .bg-gray-900 {
1156
1131
  --tw-bg-opacity: 1;
1157
1132
  background-color: rgb(17 24 39 / var(--tw-bg-opacity));
@@ -1207,6 +1182,10 @@ video {
1207
1182
  --tw-bg-opacity: 1;
1208
1183
  background-color: rgb(239 68 68 / var(--tw-bg-opacity));
1209
1184
  }
1185
+ .bg-gray-50 {
1186
+ --tw-bg-opacity: 1;
1187
+ background-color: rgb(249 250 251 / var(--tw-bg-opacity));
1188
+ }
1210
1189
  .bg-primary-500 {
1211
1190
  --tw-bg-opacity: 1;
1212
1191
  background-color: rgb(61 147 249 / var(--tw-bg-opacity));
@@ -1215,10 +1194,6 @@ video {
1215
1194
  --tw-bg-opacity: 1;
1216
1195
  background-color: rgb(107 114 128 / var(--tw-bg-opacity));
1217
1196
  }
1218
- .bg-gray-50 {
1219
- --tw-bg-opacity: 1;
1220
- background-color: rgb(249 250 251 / var(--tw-bg-opacity));
1221
- }
1222
1197
  .bg-blue-600 {
1223
1198
  --tw-bg-opacity: 1;
1224
1199
  background-color: rgb(37 99 235 / var(--tw-bg-opacity));
@@ -1236,6 +1211,10 @@ video {
1236
1211
  .bg-no-repeat {
1237
1212
  background-repeat: no-repeat;
1238
1213
  }
1214
+ .object-cover {
1215
+ -o-object-fit: cover;
1216
+ object-fit: cover;
1217
+ }
1239
1218
  .p-1\.5 {
1240
1219
  padding: 0.375rem;
1241
1220
  }
@@ -1529,16 +1508,16 @@ video {
1529
1508
  --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
1530
1509
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1531
1510
  }
1532
- .shadow {
1533
- --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
1534
- --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
1535
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1536
- }
1537
1511
  .shadow-lg {
1538
1512
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
1539
1513
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
1540
1514
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1541
1515
  }
1516
+ .shadow {
1517
+ --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
1518
+ --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
1519
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1520
+ }
1542
1521
  .ring-1 {
1543
1522
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
1544
1523
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
@@ -1955,6 +1934,16 @@ body {
1955
1934
  --tw-ring-opacity: 1;
1956
1935
  --tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity));
1957
1936
  }
1937
+ @media (min-width: 440px) {
1938
+
1939
+ .xs\:max-w-full {
1940
+ max-width: 100%;
1941
+ }
1942
+
1943
+ .xs\:flex-nowrap {
1944
+ flex-wrap: nowrap;
1945
+ }
1946
+ }
1958
1947
  @media (min-width: 640px) {
1959
1948
 
1960
1949
  .sm\:p-8 {
@@ -1963,6 +1952,14 @@ body {
1963
1952
  }
1964
1953
  @media (min-width: 768px) {
1965
1954
 
1955
+ .md\:h-auto {
1956
+ height: auto;
1957
+ }
1958
+
1959
+ .md\:w-48 {
1960
+ width: 12rem;
1961
+ }
1962
+
1966
1963
  .md\:max-w-xl {
1967
1964
  max-width: 36rem;
1968
1965
  }
@@ -1978,4 +1975,13 @@ body {
1978
1975
  .md\:flex-row {
1979
1976
  flex-direction: row;
1980
1977
  }
1978
+
1979
+ .md\:rounded-none {
1980
+ border-radius: 0px;
1981
+ }
1982
+
1983
+ .md\:rounded-l-lg {
1984
+ border-top-left-radius: 0.5rem;
1985
+ border-bottom-left-radius: 0.5rem;
1986
+ }
1981
1987
  }
@@ -27,31 +27,33 @@ module.exports = {
27
27
  expandDown: {
28
28
  "0%": {
29
29
  // opacity: 0,
30
- "max-height": 0,
31
- height: 0
30
+ // maxHeight: 0,
31
+ height: "0px"
32
32
  },
33
33
  "100%": {
34
34
  // opacity: 1,
35
- "max-height": 100
35
+ // maxHeight: 100,
36
+ height: "15rem"
36
37
  }
37
38
  },
38
39
  expandUp: {
39
40
  "0%": {
40
41
  // opacity: 1,
41
- maxHeight: 100
42
+ // maxHeight: 100,
43
+ height: "15rem"
42
44
  },
43
45
  "100%": {
44
46
  // opacity: 0,
45
- maxHeight: 0,
46
- height: 0
47
+ // maxHeight: 0,
48
+ height: "0rem"
47
49
  }
48
50
  }
49
51
  },
50
52
 
51
53
  animation: {
52
54
  collapse: "collapse",
53
- expandDown: "expandDown 50ms linear",
54
- expandUp: "expandUp 100ms linear"
55
+ expandDown: "expandDown 500ms ease-in-out",
56
+ expandUp: "expandUp 100ms ease-in-out"
55
57
  },
56
58
  colors: {
57
59
  primary: {