@sikka/hawa 0.0.200 → 0.0.201

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.200",
3
+ "version": "0.0.201",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -1,5 +1,6 @@
1
1
  import clsx from "clsx"
2
2
  import React, { ReactNode, useEffect, useRef, useState } from "react"
3
+
3
4
  // TODO: add width to decrease width
4
5
 
5
6
  interface TMenuTypes {
@@ -3,8 +3,6 @@ import { BsThreeDotsVertical } from "react-icons/bs"
3
3
  import clsx from "clsx"
4
4
  import { HawaMenu } from "./HawaMenu"
5
5
 
6
- // TODO: make action column width max fit
7
-
8
6
  type TableTypes = {
9
7
  columns: any[string]
10
8
  actions?: ActionItems[][]
@@ -55,22 +53,32 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
55
53
  >
56
54
  <thead className=" text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
57
55
  <tr>
58
- {props.columns.map((col: any, i: any) => (
56
+ {props.columns.map((col: any, i: any) => {
57
+ if (col.hidden) {
58
+ return
59
+ } else {
60
+ return (
61
+ <th
62
+ key={i}
63
+ scope="col"
64
+ colSpan={2}
65
+ className={clsx(
66
+ sizeStyles[size],
67
+ i !== 0 && (borders === "cols" || borders === "all")
68
+ ? `border-l border-l-[${bordersWidth}px]`
69
+ : ""
70
+ )}
71
+ >
72
+ {col.value}
73
+ </th>
74
+ )
75
+ }
76
+ })}
77
+ {props.actions && size !== "small" ? (
59
78
  <th
60
- key={i}
61
79
  scope="col"
62
- className={clsx(
63
- sizeStyles[size],
64
- i !== 0 && (borders === "cols" || borders === "all")
65
- ? `border-l border-l-[${bordersWidth}px]`
66
- : ""
67
- )}
80
+ className={clsx(sizeStyles[size], "w-[calc(1%)] text-center")}
68
81
  >
69
- {col}
70
- </th>
71
- ))}
72
- {props.actions && size !== "small" ? (
73
- <th scope="col" className={clsx(sizeStyles[size], "text-center")}>
74
82
  {props.actionsText}
75
83
  </th>
76
84
  ) : null}
@@ -84,7 +92,9 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
84
92
  {/* Table Rows */}
85
93
  {props.rows ? (
86
94
  props.rows.map((singleRow: any, rowIndex: any) => {
95
+ console.log("single row is ", singleRow)
87
96
  let lastRow = rowIndex == props.rows.length - 1
97
+
88
98
  return (
89
99
  <tr
90
100
  key={rowIndex}
@@ -109,40 +119,45 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
109
119
  let isLTRLastCell =
110
120
  !isRTL && lastRow && lastCell && !props.actions
111
121
 
112
- return (
113
- <td
114
- key={i}
115
- className={clsx(
116
- sizeStyles[size],
117
- highlightFirst && firstCell
118
- ? "font-bold"
119
- : "font-normal",
120
- isRTLFirstCell
121
- ? "rounded-bl-none rounded-br"
122
- : isRTLLastCell
123
- ? "rounded-br-none rounded-bl"
124
- : isLTRFirstCell
125
- ? "rounded-br-none rounded-bl"
126
- : isLTRLastCell
127
- ? "rounded-bl-none rounded-br"
128
- : "",
122
+ if (r.hidden) {
123
+ return
124
+ } else {
125
+ return (
126
+ <td
127
+ colSpan={2}
128
+ key={i}
129
+ className={clsx(
130
+ sizeStyles[size],
131
+ highlightFirst && firstCell
132
+ ? "font-bold"
133
+ : "font-normal",
134
+ isRTLFirstCell
135
+ ? "rounded-bl-none rounded-br"
136
+ : isRTLLastCell
137
+ ? "rounded-br-none rounded-bl"
138
+ : isLTRFirstCell
139
+ ? "rounded-br-none rounded-bl"
140
+ : isLTRLastCell
141
+ ? "rounded-bl-none rounded-br"
142
+ : "",
129
143
 
130
- !firstCell &&
131
- !lastCell &&
132
- (borders === "cols" || borders === "inner")
133
- ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
134
- : !firstCell &&
135
- props.actions &&
144
+ !firstCell &&
145
+ !lastCell &&
136
146
  (borders === "cols" || borders === "inner")
137
- ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
138
- : ""
147
+ ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
148
+ : !firstCell &&
149
+ props.actions &&
150
+ (borders === "cols" || borders === "inner")
151
+ ? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
152
+ : ""
139
153
 
140
- // customColor ? `bg-${customColor}` : "bg-white"
141
- )}
142
- >
143
- {r}
144
- </td>
145
- )
154
+ // customColor ? `bg-${customColor}` : "bg-white"
155
+ )}
156
+ >
157
+ {r.value}
158
+ </td>
159
+ )
160
+ }
146
161
  // }
147
162
  })}
148
163
  {props.actions && size !== "small" ? (
@@ -151,7 +166,9 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
151
166
  className={clsx(
152
167
  isRTL && lastRow ? "rounded-br-none rounded-bl" : "",
153
168
  !isRTL && lastRow ? "rounded-bl-none rounded-br" : ""
169
+ // "w-fit bg-red-400"
154
170
  )}
171
+ colSpan={1}
155
172
  >
156
173
  <div className="flex items-center justify-center">
157
174
  <HawaMenu
package/src/styles.css CHANGED
@@ -938,6 +938,9 @@ video {
938
938
  .w-11 {
939
939
  width: 2.75rem;
940
940
  }
941
+ .w-\[calc\(1\%\)\] {
942
+ width: calc(1%);
943
+ }
941
944
  .w-1 {
942
945
  width: 0.25rem;
943
946
  }