@sikka/hawa 0.0.205 → 0.0.207
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/dist/styles.css +128 -17
- package/es/elements/HawaButton.d.ts +4 -2
- package/es/elements/HawaChip.d.ts +3 -0
- package/es/elements/HawaCopyrights.d.ts +1 -0
- package/es/elements/HawaPricingCard.d.ts +1 -0
- package/es/elements/{HawaTimeline.d.ts → HawaStepper.d.ts} +1 -1
- package/es/elements/HawaTable.d.ts +7 -2
- package/es/elements/HawaTabs.d.ts +1 -1
- package/es/elements/HawaTooltip.d.ts +0 -1
- package/es/elements/index.d.ts +1 -1
- package/es/index.es.js +1 -1
- package/lib/elements/HawaButton.d.ts +4 -2
- package/lib/elements/HawaChip.d.ts +3 -0
- package/lib/elements/HawaCopyrights.d.ts +1 -0
- package/lib/elements/HawaPricingCard.d.ts +1 -0
- package/lib/elements/{HawaTimeline.d.ts → HawaStepper.d.ts} +1 -1
- package/lib/elements/HawaTable.d.ts +7 -2
- package/lib/elements/HawaTabs.d.ts +1 -1
- package/lib/elements/HawaTooltip.d.ts +0 -1
- package/lib/elements/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -2
- package/src/blocks/AuthForms/NewPasswordForm.tsx +0 -1
- package/src/blocks/AuthForms/SignInPhone.tsx +2 -14
- package/src/blocks/AuthForms/SignUpForm.tsx +1 -5
- package/src/blocks/Pricing/PricingPlans.tsx +16 -10
- package/src/blocks/Referral/ReferralAccount.tsx +0 -2
- package/src/elements/Breadcrumb.tsx +5 -2
- package/src/elements/HawaAccordion.tsx +0 -1
- package/src/elements/HawaButton.tsx +70 -51
- package/src/elements/HawaCheckbox.tsx +0 -1
- package/src/elements/HawaChip.tsx +29 -4
- package/src/elements/HawaCopyrights.tsx +5 -10
- package/src/elements/HawaDrawer.tsx +2 -5
- package/src/elements/HawaItemCard.tsx +0 -13
- package/src/elements/HawaMenu.tsx +1 -2
- package/src/elements/HawaModal.tsx +0 -2
- package/src/elements/HawaPhoneInput.tsx +1 -5
- package/src/elements/HawaPricingCard.tsx +52 -96
- package/src/elements/HawaSelect.tsx +3 -7
- package/src/elements/HawaStepper.tsx +97 -0
- package/src/elements/HawaTable.tsx +224 -209
- package/src/elements/HawaTabs.tsx +10 -18
- package/src/elements/HawaTextField.tsx +7 -8
- package/src/elements/HawaTooltip.tsx +0 -1
- package/src/elements/InvoiceAccordion.tsx +2 -7
- package/src/elements/TabPanel.tsx +0 -13
- package/src/elements/index.ts +1 -1
- package/src/hooks/useBreakpoint.ts +2 -3
- package/src/hooks/useTable.ts +6 -4
- package/src/styles.css +128 -17
- package/src/elements/HawaTimeline.tsx +0 -84
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
|
-
import { BsChevronRight,
|
|
2
|
+
import { BsChevronRight, BsFilter, BsPlus, BsThreeDots } from "react-icons/bs"
|
|
3
3
|
import clsx from "clsx"
|
|
4
4
|
import { HawaMenu } from "./HawaMenu"
|
|
5
5
|
import useTable from "../hooks/useTable"
|
|
6
|
-
|
|
6
|
+
import { HawaTextField } from "./HawaTextField"
|
|
7
|
+
import { HawaButton } from "./HawaButton"
|
|
8
|
+
import { FaSearch } from "react-icons/fa"
|
|
9
|
+
// TODO: translate header tools and make it more customizable
|
|
10
|
+
// TODO: pass the onSearch handler to the parent
|
|
7
11
|
type TableTypes = {
|
|
8
12
|
columns: any[string]
|
|
9
13
|
actions?: ActionItems[][]
|
|
10
14
|
direction?: "rtl" | "ltr"
|
|
11
15
|
rows?: any[any]
|
|
12
|
-
noDataText?: any
|
|
13
16
|
handleActionClick?: any
|
|
14
17
|
end?: any
|
|
15
18
|
size?: "normal" | "small"
|
|
16
19
|
highlightFirst?: boolean
|
|
17
20
|
customColor?: string
|
|
18
21
|
clickable?: boolean
|
|
19
|
-
|
|
22
|
+
texts?: {
|
|
23
|
+
actions?: string
|
|
24
|
+
noData?: any
|
|
25
|
+
items?: string
|
|
26
|
+
page?: string
|
|
27
|
+
}
|
|
20
28
|
bordersWidth?: string
|
|
21
29
|
onActionClicked?: any
|
|
30
|
+
headerTools?: boolean
|
|
22
31
|
borders?: "all" | "cols" | "rows" | "outer" | "inner"
|
|
23
32
|
}
|
|
24
33
|
type ActionItems = {
|
|
@@ -42,14 +51,17 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
42
51
|
const [enteredPage, setEnteredPage] = useState(null)
|
|
43
52
|
const [page, setPage] = useState(1)
|
|
44
53
|
|
|
45
|
-
const { slice, range } = useTable(props.rows
|
|
46
|
-
|
|
54
|
+
const { slice, range } = useTable(props.rows, page, perPage)
|
|
55
|
+
const changePage = () => {
|
|
47
56
|
if (slice?.length < 1 && page !== 1) {
|
|
48
57
|
setPage(page - 1)
|
|
49
58
|
}
|
|
50
59
|
if (enteredPage) {
|
|
51
60
|
setPage(enteredPage)
|
|
52
61
|
}
|
|
62
|
+
}
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
changePage()
|
|
53
65
|
}, [slice, page])
|
|
54
66
|
|
|
55
67
|
let isRTL = direction === "rtl"
|
|
@@ -60,168 +72,189 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
return (
|
|
63
|
-
<div className="relative">
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
"
|
|
75
|
+
<div className="relative flex flex-col gap-2 ">
|
|
76
|
+
<div className="rounded bg-gray-200">
|
|
77
|
+
{props.headerTools && (
|
|
78
|
+
<div className="flex flex-row items-center justify-between px-4 py-2">
|
|
79
|
+
<div className="w-1/2">
|
|
80
|
+
<HawaTextField
|
|
81
|
+
icon={<FaSearch color="gray" />}
|
|
82
|
+
placeholder={"Search"}
|
|
83
|
+
width="full"
|
|
84
|
+
margin="none"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
<div className="flex flex-row items-center justify-between gap-2">
|
|
88
|
+
<HawaButton startIcon={<BsPlus />}>Add Item</HawaButton>
|
|
89
|
+
<HawaButton startIcon={<BsChevronRight />}>Actions</HawaButton>
|
|
90
|
+
<HawaButton startIcon={<BsFilter />} endIcon={<BsChevronRight />}>
|
|
91
|
+
Filter
|
|
92
|
+
</HawaButton>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
67
95
|
)}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
<table
|
|
97
|
+
className={clsx(
|
|
98
|
+
"w-full rounded bg-gray-300 text-left text-sm text-gray-500 dark:text-gray-400"
|
|
99
|
+
)}
|
|
100
|
+
>
|
|
101
|
+
<thead className=" text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
|
|
102
|
+
<tr>
|
|
103
|
+
{props.columns.map((col: any, i: any) => {
|
|
104
|
+
if (col.hidden) {
|
|
105
|
+
return
|
|
106
|
+
} else {
|
|
107
|
+
return (
|
|
108
|
+
<th
|
|
109
|
+
key={i}
|
|
110
|
+
scope="col"
|
|
111
|
+
colSpan={2}
|
|
112
|
+
className={clsx(
|
|
113
|
+
sizeStyles[size],
|
|
114
|
+
i !== 0 && (borders === "cols" || borders === "all")
|
|
115
|
+
? `border-l border-l-[${bordersWidth}px]`
|
|
116
|
+
: ""
|
|
117
|
+
)}
|
|
118
|
+
>
|
|
119
|
+
{col.value}
|
|
120
|
+
</th>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
})}
|
|
124
|
+
{props.actions && size !== "small" ? (
|
|
125
|
+
<th
|
|
126
|
+
scope="col"
|
|
127
|
+
className={clsx(sizeStyles[size], "w-[calc(1%)] text-center")}
|
|
128
|
+
>
|
|
129
|
+
{props.texts?.actions ?? "Actions"}
|
|
130
|
+
</th>
|
|
131
|
+
) : null}
|
|
132
|
+
</tr>
|
|
133
|
+
</thead>
|
|
134
|
+
<tbody
|
|
135
|
+
className={
|
|
136
|
+
customColor && props.rows ? `bg-${customColor}` : "bg-transparent"
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
{/* Table Rows */}
|
|
140
|
+
{props.rows ? (
|
|
141
|
+
slice?.map((singleRow: any, rowIndex: any) => {
|
|
142
|
+
let lastRow = rowIndex == slice?.length - 1
|
|
75
143
|
return (
|
|
76
|
-
<
|
|
77
|
-
key={
|
|
78
|
-
scope="col"
|
|
79
|
-
colSpan={2}
|
|
144
|
+
<tr
|
|
145
|
+
key={rowIndex}
|
|
80
146
|
className={clsx(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
147
|
+
" dark:border-gray-700 dark:bg-gray-800",
|
|
148
|
+
props.clickable ? "hover:bg-gray-100" : "",
|
|
149
|
+
!lastRow &&
|
|
150
|
+
(borders === "all" ||
|
|
151
|
+
borders === "rows" ||
|
|
152
|
+
borders === "inner")
|
|
153
|
+
? `border-b border-b-[${bordersWidth}px]`
|
|
84
154
|
: ""
|
|
85
155
|
)}
|
|
86
156
|
>
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
>
|
|
97
|
-
{props.actionsText}
|
|
98
|
-
</th>
|
|
99
|
-
) : null}
|
|
100
|
-
</tr>
|
|
101
|
-
</thead>
|
|
102
|
-
<tbody
|
|
103
|
-
className={
|
|
104
|
-
customColor && props.rows ? `bg-${customColor}` : "bg-transparent"
|
|
105
|
-
}
|
|
106
|
-
>
|
|
107
|
-
{/* Table Rows */}
|
|
108
|
-
{props.rows ? (
|
|
109
|
-
slice?.map((singleRow: any, rowIndex: any) => {
|
|
110
|
-
let lastRow = rowIndex == slice?.length - 1
|
|
157
|
+
{singleRow?.map((r: any, i: any) => {
|
|
158
|
+
let firstCell = i === 0
|
|
159
|
+
let lastCell = i === singleRow?.length - 1
|
|
160
|
+
let isRTLLastCell =
|
|
161
|
+
isRTL && lastRow && lastCell && !props.actions
|
|
162
|
+
let isRTLFirstCell = isRTL && lastRow && firstCell
|
|
163
|
+
let isLTRFirstCell = !isRTL && lastRow && firstCell
|
|
164
|
+
let isLTRLastCell =
|
|
165
|
+
!isRTL && lastRow && lastCell && !props.actions
|
|
111
166
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
let isLTRLastCell =
|
|
134
|
-
!isRTL && lastRow && lastCell && !props.actions
|
|
135
|
-
|
|
136
|
-
if (r.hidden) {
|
|
137
|
-
return
|
|
138
|
-
} else {
|
|
139
|
-
return (
|
|
140
|
-
<td
|
|
141
|
-
colSpan={2}
|
|
142
|
-
key={i}
|
|
143
|
-
className={clsx(
|
|
144
|
-
sizeStyles[size],
|
|
145
|
-
highlightFirst && firstCell
|
|
146
|
-
? "font-bold"
|
|
147
|
-
: "font-normal",
|
|
148
|
-
isRTLFirstCell
|
|
149
|
-
? "rounded-bl-none rounded-br"
|
|
150
|
-
: isRTLLastCell
|
|
151
|
-
? "rounded-br-none rounded-bl"
|
|
152
|
-
: isLTRFirstCell
|
|
153
|
-
? "rounded-br-none rounded-bl"
|
|
154
|
-
: isLTRLastCell
|
|
155
|
-
? "rounded-bl-none rounded-br"
|
|
156
|
-
: "",
|
|
167
|
+
if (r.hidden) {
|
|
168
|
+
return
|
|
169
|
+
} else {
|
|
170
|
+
return (
|
|
171
|
+
<td
|
|
172
|
+
colSpan={2}
|
|
173
|
+
key={i}
|
|
174
|
+
className={clsx(
|
|
175
|
+
sizeStyles[size],
|
|
176
|
+
highlightFirst && firstCell
|
|
177
|
+
? "font-bold"
|
|
178
|
+
: "font-normal",
|
|
179
|
+
isRTLFirstCell
|
|
180
|
+
? "rounded-bl-none rounded-br"
|
|
181
|
+
: isRTLLastCell
|
|
182
|
+
? "rounded-br-none rounded-bl"
|
|
183
|
+
: isLTRFirstCell
|
|
184
|
+
? "rounded-br-none rounded-bl"
|
|
185
|
+
: isLTRLastCell
|
|
186
|
+
? "rounded-bl-none rounded-br"
|
|
187
|
+
: "",
|
|
157
188
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
(borders === "cols" || borders === "inner")
|
|
161
|
-
? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
|
|
162
|
-
: !firstCell &&
|
|
163
|
-
props.actions &&
|
|
189
|
+
!firstCell &&
|
|
190
|
+
!lastCell &&
|
|
164
191
|
(borders === "cols" || borders === "inner")
|
|
165
|
-
|
|
166
|
-
|
|
192
|
+
? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
|
|
193
|
+
: !firstCell &&
|
|
194
|
+
props.actions &&
|
|
195
|
+
(borders === "cols" || borders === "inner")
|
|
196
|
+
? `border-l border-l-[${bordersWidth}px] border-r border-r-[${bordersWidth}px]`
|
|
197
|
+
: ""
|
|
167
198
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
<
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
199
|
+
// customColor ? `bg-${customColor}` : "bg-white"
|
|
200
|
+
)}
|
|
201
|
+
>
|
|
202
|
+
{r.value}
|
|
203
|
+
</td>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
})}
|
|
207
|
+
{props.actions && size !== "small" ? (
|
|
208
|
+
<td
|
|
209
|
+
align={isRTL ? "right" : "left"}
|
|
210
|
+
className={clsx(
|
|
211
|
+
isRTL && lastRow ? "rounded-br-none rounded-bl" : "",
|
|
212
|
+
!isRTL && lastRow ? "rounded-bl-none rounded-br" : ""
|
|
213
|
+
// "w-fit bg-red-400"
|
|
214
|
+
)}
|
|
215
|
+
colSpan={1}
|
|
216
|
+
>
|
|
217
|
+
<div className="flex items-center justify-center">
|
|
218
|
+
<HawaMenu
|
|
219
|
+
size="small"
|
|
220
|
+
actionedItem={[rowIndex, singleRow]}
|
|
221
|
+
menuItems={props.actions}
|
|
222
|
+
position={
|
|
223
|
+
direction === "rtl"
|
|
224
|
+
? "right-bottom"
|
|
225
|
+
: "left-bottom"
|
|
226
|
+
}
|
|
227
|
+
direction={direction}
|
|
228
|
+
>
|
|
229
|
+
<div className="flex w-fit items-center justify-center rounded p-2 hover:bg-gray-200">
|
|
230
|
+
<BsThreeDots />
|
|
231
|
+
</div>
|
|
232
|
+
</HawaMenu>
|
|
233
|
+
</div>
|
|
234
|
+
</td>
|
|
235
|
+
) : null}
|
|
236
|
+
</tr>
|
|
237
|
+
)
|
|
238
|
+
})
|
|
239
|
+
) : (
|
|
240
|
+
<tr className="bg-transparent">
|
|
241
|
+
<td colSpan={20}>
|
|
242
|
+
<div
|
|
243
|
+
className={clsx(
|
|
244
|
+
"w-full rounded-b bg-white p-5 text-center",
|
|
245
|
+
customColor ? `bg-${customColor}` : "bg-white"
|
|
246
|
+
)}
|
|
247
|
+
>
|
|
248
|
+
{props.texts?.noData ?? "No Data"}
|
|
249
|
+
</div>
|
|
250
|
+
</td>
|
|
251
|
+
</tr>
|
|
252
|
+
)}
|
|
253
|
+
</tbody>
|
|
254
|
+
</table>
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<div className="flex flex-row items-center justify-between ">
|
|
225
258
|
{/* Pagination Pages */}
|
|
226
259
|
{range.length > 1 ? (
|
|
227
260
|
<div className="flex w-fit flex-row items-stretch justify-center gap-2 overflow-clip rounded ">
|
|
@@ -338,57 +371,39 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
338
371
|
<div></div>
|
|
339
372
|
)}
|
|
340
373
|
{/* Pagination Settings */}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
{ value: 7, label: "7" },
|
|
375
|
-
{ value: 10, label: "10" },
|
|
376
|
-
{ value: 20, label: "20" },
|
|
377
|
-
]}
|
|
378
|
-
onChange={(e: any) => {
|
|
379
|
-
// field.onChange(e.value)
|
|
380
|
-
console.log("changing to ", e.value)
|
|
381
|
-
setPage(1)
|
|
382
|
-
setPerPage(e.value)
|
|
383
|
-
}}
|
|
384
|
-
onInputChange={(e: any) => {
|
|
385
|
-
// field.onChange(e.value)
|
|
386
|
-
console.log("changing to ", e.value)
|
|
387
|
-
setPage(1)
|
|
388
|
-
setPerPage(e.value)
|
|
389
|
-
}}
|
|
390
|
-
/> */}
|
|
391
|
-
</div>
|
|
374
|
+
{props.rows ? (
|
|
375
|
+
<div className="flex w-fit flex-row items-center gap-2 ">
|
|
376
|
+
<div className="text-xs ">
|
|
377
|
+
{props.rows.length} {props.texts?.items ?? "Items"}
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<select
|
|
381
|
+
value={perPage}
|
|
382
|
+
className="h-6 rounded text-xs"
|
|
383
|
+
onChange={(e) => {
|
|
384
|
+
setPerPage(parseInt(e.target.value))
|
|
385
|
+
}}
|
|
386
|
+
>
|
|
387
|
+
<option value={10} style={{ fontSize: 10 }}>
|
|
388
|
+
10 / {props.texts?.page ?? "Page"}
|
|
389
|
+
</option>
|
|
390
|
+
<option value={20} style={{ fontSize: 10 }}>
|
|
391
|
+
20 / {props.texts?.page ?? "Page"}
|
|
392
|
+
</option>
|
|
393
|
+
<option value={30} style={{ fontSize: 10 }}>
|
|
394
|
+
30 / {props.texts?.page ?? "Page"}
|
|
395
|
+
</option>
|
|
396
|
+
<option value={50} style={{ fontSize: 10 }}>
|
|
397
|
+
50 / {props.texts?.page ?? "Page"}
|
|
398
|
+
</option>
|
|
399
|
+
<option value={100} style={{ fontSize: 10 }}>
|
|
400
|
+
100 / {props.texts?.page ?? "Page"}
|
|
401
|
+
</option>
|
|
402
|
+
</select>
|
|
403
|
+
</div>
|
|
404
|
+
) : (
|
|
405
|
+
<div></div>
|
|
406
|
+
)}
|
|
392
407
|
</div>
|
|
393
408
|
</div>
|
|
394
409
|
)
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React, { useState } from "react"
|
|
3
|
-
|
|
3
|
+
// TODO: fix wrapping issue when small screen
|
|
4
4
|
type TabsTypes = {
|
|
5
5
|
options?: any
|
|
6
6
|
onChangeTab?: any
|
|
7
7
|
defaultValue?: any
|
|
8
|
-
contents?: any
|
|
9
8
|
orientation?: "horizontal" | "vertical"
|
|
10
9
|
direction?: "rtl" | "ltr"
|
|
11
10
|
marginBetween?: any
|
|
12
11
|
width?: "full" | "normal"
|
|
12
|
+
pill?: boolean
|
|
13
13
|
}
|
|
14
14
|
export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
15
15
|
orientation = "horizontal",
|
|
16
16
|
direction = "ltr",
|
|
17
17
|
width = "normal",
|
|
18
18
|
marginBetween = 0,
|
|
19
|
+
pill = true,
|
|
19
20
|
...props
|
|
20
21
|
}) => {
|
|
21
22
|
const [selectedOption, setSelectedOption] = useState(props.options[0]?.value)
|
|
@@ -35,8 +36,6 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
35
36
|
full: "w-full min-w-full",
|
|
36
37
|
normal: "w-fit",
|
|
37
38
|
}
|
|
38
|
-
console.log("selected i : ", selectedOption)
|
|
39
|
-
console.log("selected object : ", props.options[selectedOption])
|
|
40
39
|
let orientationStyle = {
|
|
41
40
|
vertical: {
|
|
42
41
|
container: "flex flex-row",
|
|
@@ -68,7 +67,6 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
68
67
|
>
|
|
69
68
|
<ul
|
|
70
69
|
className={clsx(
|
|
71
|
-
// "mb-2",
|
|
72
70
|
marginBetween
|
|
73
71
|
? orientation === "vertical"
|
|
74
72
|
? "mb-0"
|
|
@@ -79,31 +77,24 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
79
77
|
: "mr-" + marginBetween,
|
|
80
78
|
tabsStyle[orientation],
|
|
81
79
|
"border-buttonPrimary-500",
|
|
80
|
+
|
|
82
81
|
orientation === "vertical"
|
|
83
82
|
? direction === "rtl"
|
|
84
83
|
? "rounded-none rounded-r border-l-2"
|
|
85
84
|
: "rounded-none rounded-l border-r-2"
|
|
86
85
|
: "border-b-2",
|
|
87
|
-
widthStyles[width]
|
|
86
|
+
widthStyles[width],
|
|
87
|
+
// "bg-red-400",
|
|
88
|
+
pill ? "overflow-clip rounded border-none" : ""
|
|
88
89
|
)}
|
|
89
90
|
>
|
|
90
|
-
{/*
|
|
91
|
-
if selected option
|
|
92
|
-
if vertical
|
|
93
|
-
if rtl
|
|
94
|
-
border left
|
|
95
|
-
else
|
|
96
|
-
border right
|
|
97
|
-
else
|
|
98
|
-
border bottom
|
|
99
|
-
*/}
|
|
100
91
|
{props.options?.map((opt: any, o) => (
|
|
101
92
|
<li key={o}>
|
|
102
93
|
<button
|
|
103
94
|
aria-current="page"
|
|
104
95
|
onClick={() => {
|
|
105
96
|
setSelectedOption(opt.value)
|
|
106
|
-
|
|
97
|
+
props.onChangeTab(opt)
|
|
107
98
|
}}
|
|
108
99
|
className={clsx(
|
|
109
100
|
opt.value === selectedOption
|
|
@@ -113,7 +104,8 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
113
104
|
direction === "rtl" ? "rounded-r" : "rounded-l",
|
|
114
105
|
]
|
|
115
106
|
: inactiveTabStyle[orientation],
|
|
116
|
-
"w-full
|
|
107
|
+
"w-full transition-all",
|
|
108
|
+
pill ? "rounded bg-green-400" : ""
|
|
117
109
|
// direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
|
|
118
110
|
)}
|
|
119
111
|
>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
+
// TODO: make icon based on direction
|
|
4
|
+
// TODO: Preferebly usse context to pass direction rtl | ltr
|
|
3
5
|
|
|
4
|
-
import { FaSearch } from "react-icons/fa"
|
|
5
6
|
type TextFieldTypes = {
|
|
6
7
|
margin?: "none" | "normal" | "large"
|
|
7
8
|
width?: "small" | "normal" | "full"
|
|
@@ -43,7 +44,6 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
43
44
|
|
|
44
45
|
return (
|
|
45
46
|
<div
|
|
46
|
-
// ref={props.ref}
|
|
47
47
|
className={clsx(defaultStyle, marginStyles[margin], widthStyles[width])}
|
|
48
48
|
>
|
|
49
49
|
{props.label && (
|
|
@@ -69,21 +69,20 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
69
69
|
/>
|
|
70
70
|
) : (
|
|
71
71
|
<div className="relative">
|
|
72
|
-
<input
|
|
73
|
-
{...props}
|
|
74
|
-
className={clsx(defaultInputStyle, props.icon ? "pr-10" : "")}
|
|
75
|
-
/>
|
|
76
72
|
{props.icon && (
|
|
77
|
-
<div className="absolute top-1/2
|
|
73
|
+
<div className="absolute top-1/2 left-3 -translate-y-1/2">
|
|
78
74
|
{props.icon}
|
|
79
75
|
</div>
|
|
80
76
|
)}
|
|
77
|
+
<input
|
|
78
|
+
{...props}
|
|
79
|
+
className={clsx(defaultInputStyle, props.icon ? "pl-10" : "")}
|
|
80
|
+
/>
|
|
81
81
|
</div>
|
|
82
82
|
)}
|
|
83
83
|
|
|
84
84
|
{props.helperText && (
|
|
85
85
|
<p className="mb-0 mt-1 text-xs text-red-600 dark:text-red-500">
|
|
86
|
-
{/* <span className="font-medium">Oh, snapp!</span> */}
|
|
87
86
|
{props.helperText}
|
|
88
87
|
</p>
|
|
89
88
|
)}
|
|
@@ -25,9 +25,7 @@ type InvoiceAccordionTypes = {
|
|
|
25
25
|
invoiceActions?: {
|
|
26
26
|
icon?: JSX.Element
|
|
27
27
|
label: string
|
|
28
|
-
action?: (
|
|
29
|
-
e: any
|
|
30
|
-
) => void
|
|
28
|
+
action?: (e: any) => void
|
|
31
29
|
isButton?: boolean
|
|
32
30
|
element?: any
|
|
33
31
|
}[][]
|
|
@@ -78,9 +76,7 @@ export const InvoiceAccordion: React.FunctionComponent<
|
|
|
78
76
|
<div className="flex w-full flex-col gap-0 ">
|
|
79
77
|
<div className="flex flex-row items-center gap-2">
|
|
80
78
|
<span className="bg-white-200">{props.invoiceTitle}</span>
|
|
81
|
-
{props.status &&
|
|
82
|
-
<HawaChip size="small" label={props.status} />
|
|
83
|
-
)}{" "}
|
|
79
|
+
{props.status && <HawaChip size="small" label={props.status} />}
|
|
84
80
|
</div>
|
|
85
81
|
<div className="font-sm text-gray-400">{props.invoiceSubtitle}</div>
|
|
86
82
|
</div>
|
|
@@ -89,7 +85,6 @@ export const InvoiceAccordion: React.FunctionComponent<
|
|
|
89
85
|
<HawaMenu
|
|
90
86
|
direction={direction}
|
|
91
87
|
position={direction === "rtl" ? "bottom-right" : "bottom-left"}
|
|
92
|
-
// menuItems={[[{ label: "Download PDF" }]]}
|
|
93
88
|
menuItems={props.invoiceActions}
|
|
94
89
|
>
|
|
95
90
|
<div className=" p-2">
|