@sikka/hawa 0.0.195 → 0.0.197

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.195",
3
+ "version": "0.0.197",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -66,7 +66,7 @@ export const CheckoutForm: React.FunctionComponent<CheckoutFormTypes> = (
66
66
  {props.texts.orderDetails}
67
67
  </div>
68
68
  <HawaTable
69
- lang={props.lang}
69
+ direction={isArabic ? "rtl" : "ltr"}
70
70
  columns={["Product", "Price"]}
71
71
  rows={props.products}
72
72
  end={["Total", props.total]}
@@ -64,7 +64,7 @@ export const ConfirmationPage: React.FunctionComponent<
64
64
  </div>
65
65
  {props.products && (
66
66
  <HawaTable
67
- lang={props.lang}
67
+ direction={isArabic ? "rtl" : "ltr"}
68
68
  columns={["Product", "Price"]}
69
69
  rows={props.products}
70
70
  // end={["Total", props.total]}
@@ -3,9 +3,8 @@ import { BsThreeDotsVertical } from "react-icons/bs"
3
3
  import clsx from "clsx"
4
4
  import { HawaMenu } from "./HawaMenu"
5
5
  // TODO: make action click return row
6
-
6
+ // TODO: make action column width max fit
7
7
  type TableTypes = {
8
- lang?: any
9
8
  columns: any[string]
10
9
  actions?: ActionItems[][]
11
10
  direction?: "rtl" | "ltr"
@@ -41,7 +40,7 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
41
40
  bordersWidth = "1",
42
41
  ...props
43
42
  }) => {
44
- let isArabic = props.lang === "ar"
43
+ let isRTL = direction === "rtl"
45
44
 
46
45
  let sizeStyles = {
47
46
  normal: "py-3 px-6",
@@ -52,13 +51,7 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
52
51
  <div className="relative">
53
52
  <table
54
53
  className={clsx(
55
- "w-full rounded bg-layoutPrimary-500 text-left text-sm text-gray-500 dark:text-gray-400"
56
- // borders === "all" || borders === "outer"
57
- // ? `border-[${bordersWidth}px] bg-red-300 p-2`
58
- // : ""
59
- // `ring-[${bordersWidth}px] ring-blue-300`
60
- // `ring-[${10}px] ring-blue-300`
61
- // ` ring-[10px] ring-blue-300`
54
+ "w-full rounded bg-layoutPrimary-500 text-left text-sm text-gray-500 dark:text-gray-400"
62
55
  )}
63
56
  >
64
57
  <thead className=" text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
@@ -85,60 +78,65 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
85
78
  </tr>
86
79
  </thead>
87
80
  <tbody
88
- // style={{
89
- // borderWidth: bordersWidth,
90
- // border: "1px solid black",
91
- // }}
92
- // className="bg-yellow-400"
81
+ // className={customColor ? `bg-${customColor}` : "bg-transparent"}
93
82
  >
94
83
  {/* Table Rows */}
95
84
  {props.rows ? (
96
85
  props.rows.map((singleRow: any, rowIndex: any) => {
97
- let firstRow
98
86
  let lastRow = rowIndex == props.rows.length - 1
99
-
100
87
  return (
101
88
  <tr
102
89
  key={rowIndex}
103
90
  className={clsx(
104
91
  " dark:border-gray-700 dark:bg-gray-800",
105
92
  props.clickable ? "hover:bg-gray-100" : "",
106
- "bg-" + customColor,
107
93
  !lastRow &&
108
94
  (borders === "all" ||
109
95
  borders === "rows" ||
110
96
  borders === "inner")
111
97
  ? `border-b border-b-[${bordersWidth}px]`
112
98
  : ""
113
- // "bg-yellow-400"
114
99
  )}
115
100
  >
116
101
  {singleRow.map((r: any, i: any) => {
117
102
  let firstCell = i === 0
118
103
  let lastCell = i === singleRow.length - 1
104
+ let isRTLLastCell =
105
+ isRTL && lastRow && lastCell && !props.actions
106
+ let isRTLFirstCell = isRTL && lastRow && firstCell
107
+ let isLTRFirstCell = !isRTL && lastRow && firstCell
108
+ let isLTRLastCell =
109
+ !isRTL && lastRow && lastCell && !props.actions
119
110
 
120
111
  return (
121
112
  <td
122
113
  key={i}
123
114
  className={clsx(
115
+ sizeStyles[size],
124
116
  highlightFirst && firstCell
125
117
  ? "font-bold"
126
118
  : "font-normal",
127
- lastRow && firstCell ? "rounded-b" : "",
128
- firstCell ? "rounded-br-none" : "",
129
- lastCell ? "rounded-bl-none" : "",
130
- sizeStyles[size],
131
- !firstCell &&
132
- (borders === "cols" || borders === "inner")
133
- ? `border-l border-l-[${bordersWidth}px]`
119
+ isRTLFirstCell
120
+ ? "rounded-bl-none rounded-br"
121
+ : isRTLLastCell
122
+ ? "rounded-br-none rounded-bl"
123
+ : isLTRFirstCell
124
+ ? "rounded-br-none rounded-bl"
125
+ : isLTRLastCell
126
+ ? "rounded-bl-none rounded-br"
134
127
  : "",
135
128
 
136
- // borders === "all"
137
- // ? `border border-[${bordersWidth}px]`
138
- // : "",
139
- props.actions
140
- ? `border-r border-r-[${bordersWidth}px]`
129
+ !firstCell &&
130
+ !lastCell &&
131
+ (borders === "cols" || borders === "inner")
132
+ ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
133
+ : !firstCell &&
134
+ props.actions &&
135
+ (borders === "cols" || borders === "inner")
136
+ ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
141
137
  : ""
138
+
139
+ // customColor ? `bg-${customColor}` : "bg-white"
142
140
  )}
143
141
  >
144
142
  {r}
@@ -148,8 +146,11 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
148
146
  })}
149
147
  {props.actions && size !== "small" ? (
150
148
  <td
151
- align={isArabic ? "right" : "left"}
152
- className={lastRow ? "rounded-br" : ""}
149
+ align={isRTL ? "right" : "left"}
150
+ className={clsx(
151
+ isRTL && lastRow ? "rounded-br-none rounded-bl" : "",
152
+ !isRTL && lastRow ? "rounded-bl-none rounded-br" : ""
153
+ )}
153
154
  >
154
155
  <div className="flex items-center justify-center">
155
156
  <HawaMenu
@@ -171,9 +172,14 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
171
172
  )
172
173
  })
173
174
  ) : (
174
- <tr>
175
+ <tr className="bg-transparent">
175
176
  <td colSpan={props.columns.length}>
176
- <div className="w-full bg-white p-5 text-center">
177
+ <div
178
+ className={clsx(
179
+ "w-full rounded-b bg-white p-5 text-center",
180
+ customColor ? `bg-${customColor}` : "bg-white"
181
+ )}
182
+ >
177
183
  {props.noDataText}
178
184
  </div>
179
185
  </td>
package/src/styles.css CHANGED
@@ -1268,11 +1268,14 @@ video {
1268
1268
  .rounded-br-lg {
1269
1269
  border-bottom-right-radius: 0.5rem;
1270
1270
  }
1271
+ .rounded-br {
1272
+ border-bottom-right-radius: var(--border-radius);
1273
+ }
1271
1274
  .rounded-br-none {
1272
1275
  border-bottom-right-radius: 0px;
1273
1276
  }
1274
- .rounded-br {
1275
- border-bottom-right-radius: var(--border-radius);
1277
+ .rounded-bl {
1278
+ border-bottom-left-radius: var(--border-radius);
1276
1279
  }
1277
1280
  .rounded-tl-none {
1278
1281
  border-top-left-radius: 0px;
@@ -1840,19 +1843,10 @@ video {
1840
1843
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
1841
1844
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
1842
1845
  }
1843
- .ring-\[10px\] {
1844
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
1845
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(10px + var(--tw-ring-offset-width)) var(--tw-ring-color);
1846
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
1847
- }
1848
1846
  .ring-blue-200 {
1849
1847
  --tw-ring-opacity: 1;
1850
1848
  --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));
1851
1849
  }
1852
- .ring-blue-300 {
1853
- --tw-ring-opacity: 1;
1854
- --tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity));
1855
- }
1856
1850
  .ring-buttonPrimary-500 {
1857
1851
  --tw-ring-color: var(--button-primary-500);
1858
1852
  }