@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
@@ -2,6 +2,8 @@ import React from "react";
2
2
  type ContainerTypes = {
3
3
  maxWidth?: "full" | "small" | "normal";
4
4
  children: React.ReactNode;
5
+ variant?: "contained" | "outlined";
6
+ centered?: boolean;
5
7
  };
6
8
  export declare const HawaContainer: React.FunctionComponent<ContainerTypes>;
7
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.104",
3
+ "version": "0.0.106",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -0,0 +1,24 @@
1
+ import React from "react"
2
+ import { HawaButton } from "../../elements"
3
+ import { HawaContainer } from "../../layout"
4
+ import { FaCheck } from "react-icons/fa"
5
+ type TEmptyState = {}
6
+
7
+ export const EmptyState: React.FunctionComponent<TEmptyState> = (props) => {
8
+ return (
9
+ <HawaContainer variant="outlined" centered={true}>
10
+ <div className="flex h-20 w-20 flex-col items-center justify-center rounded-3xl bg-primary-400 text-6xl font-bold">
11
+ <FaCheck size={30} />
12
+ </div>
13
+ <div className="m-2 text-center text-xl font-bold">
14
+ You're all caught up
15
+ </div>
16
+ <div className="text-center">
17
+ If you're lost please contact us help@sikka.io{" "}
18
+ </div>
19
+ <HawaButton color="primary" width="full">
20
+ Action
21
+ </HawaButton>
22
+ </HawaContainer>
23
+ )
24
+ }
@@ -6,23 +6,26 @@ type NotFoundTypes = {}
6
6
 
7
7
  export const NotFound: React.FunctionComponent<NotFoundTypes> = (props) => {
8
8
  return (
9
- <div
10
- style={{
11
- display: "flex",
12
- flexDirection: "column",
13
- alignItems: "center",
14
- }}
15
- >
16
- <div className="text-6xl font-bold">404</div>
17
- <div className="m-2 text-xl font-bold">Page Not Found</div>
18
- <HawaContainer>
9
+ <HawaContainer variant="outlined">
10
+ <div
11
+ // style={{
12
+ // display: "flex",
13
+ // flexDirection: "column",
14
+ // alignItems: "center",
15
+ // }}
16
+ className="flex flex-col items-center"
17
+ >
18
+ <div className="text-center text-6xl font-bold">404</div>
19
+ <div className="m-2 text-center text-xl font-bold">Page Not Found</div>
19
20
  <div className="text-center">
20
21
  If you're lost please contact us help@sikka.io{" "}
21
22
  </div>
23
+ {/* <div className="flex flex-col content-center items-stretch bg-red-200"> */}
22
24
  <HawaButton color="primary" width="full">
23
25
  Home
24
26
  </HawaButton>
25
- </HawaContainer>
26
- </div>
27
+ {/* </div> */}
28
+ </div>
29
+ </HawaContainer>
27
30
  )
28
31
  }
@@ -1 +1,2 @@
1
- export * from "./NotFound";
1
+ export * from "./NotFound"
2
+ export * from "./EmptyState"
@@ -1,3 +1,4 @@
1
+ import clsx from "clsx"
1
2
  import React from "react"
2
3
 
3
4
  type AccordionItemTypes = {
@@ -18,12 +19,17 @@ const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
18
19
  "p-5 font-light border border-b-xl border-gray-200 dark:border-gray-700 dark:bg-gray-900"
19
20
  let accPaperRounded =
20
21
  "p-5 font-light border border-b-xl rounded-b-xl border-gray-200 dark:border-gray-700 dark:bg-gray-900"
22
+
21
23
  return (
22
- <div>
24
+ <div className="rounded-lg ">
23
25
  <h2 id={"accordion-collapse-heading-" + props.count}>
24
26
  <button
25
27
  type="button"
26
- className={props.count === 0 ? roundedTop : noRounding}
28
+ className={clsx(
29
+ // props.count === 0 ? roundedTop : noRounding,
30
+ "flex w-full items-center justify-between border border-gray-200 bg-gray-100 p-5 text-left font-medium text-gray-900 hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-800 dark:focus:ring-gray-800",
31
+ !collapse ? "rounded-t-lg" : "rounded-lg"
32
+ )}
27
33
  onClick={() => setCollapse(!collapse)}
28
34
  data-accordion-target={"#accordion-collapse-body-" + props.count}
29
35
  aria-expanded="true"
@@ -32,7 +38,7 @@ const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
32
38
  <span>{props.title}</span>
33
39
  <svg
34
40
  data-accordion-icon=""
35
- className={`h-6 w-6 ${collapse ? "" : "rotate-180"} shrink-0`}
41
+ className={`h-6 w-6 ${collapse ? "" : "rotate-180"} shrink-0 transition-all`}
36
42
  fill="currentColor"
37
43
  viewBox="0 0 20 20"
38
44
  xmlns="http://www.w3.org/2000/svg"
@@ -47,14 +53,15 @@ const AccordionItem: React.FunctionComponent<AccordionItemTypes> = (props) => {
47
53
  </h2>
48
54
  <div
49
55
  id={"accordion-collapse-body-" + props.count}
50
- className={`${collapse ? "hidden" : "block"}`}
56
+ className={clsx(
57
+ collapse ? "invisible hidden" : "visible",
58
+ "border-b-xl rounded-b-xl border border-gray-200 p-5 font-light dark:border-gray-700 dark:bg-gray-900"
59
+ )}
51
60
  aria-labelledby={"accordion-collapse-heading-" + props.count}
52
61
  >
53
- <div className={props.count === -1 ? accPaperRounded : accPaper}>
54
- <p className="mb-2 text-gray-500 dark:text-gray-400">
55
- {props.content}
56
- </p>
57
- </div>
62
+ {/* <div className={props.count === -1 ? accPaperRounded : accPaper}> */}
63
+ <p className="mb-2 text-gray-500 dark:text-gray-400">{props.content}</p>
64
+ {/* </div> */}
58
65
  </div>
59
66
  </div>
60
67
  )
@@ -66,7 +73,11 @@ export const HawaAccordian: React.FunctionComponent<AccordionTypes> = (
66
73
  props
67
74
  ) => {
68
75
  return (
69
- <div id="accordion-collapse" data-accordion="collapse">
76
+ <div
77
+ id="accordion-collapse"
78
+ data-accordion="collapse"
79
+ className="flex flex-col gap-3"
80
+ >
70
81
  {props.content.map((acc: any, i: any) => {
71
82
  return (
72
83
  <AccordionItem
@@ -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 = {
@@ -0,0 +1,317 @@
1
+ import React, { useState } from "react"
2
+ import { HawaButton } from "./HawaButton"
3
+
4
+ const CARDS = {
5
+ mada: "^(4(0(0861|1757|3024|6136|6996|7(197|395)|9201)|1(0621|0685|2565|7633|9593)|2(281(7|8|9)|0(132)|1(141)|6(897)|8(1|331|67(1|2|3)))|3(1361|2328|4107|9954)|4(0(533|647|795)|5564|6(393|404|672))|5(5(036|708)|7865|7997|8456)|6(2220|854(0|1|2|3))|7(4491)|8(301(0|1|2)|4783|609(4|5|6)|931(7|8|9))|93428)|5(0(4300|6968|8160)|13213|2(0058|1076|4(130|514)|9(415|741))|3(0060|0906|1095|1196|2013|5(825|989)|6023|7767|9931)|4(3(085|357)|9760)|5(4180|7606|8563|8848)|8(5265|8(8(4(5|6|7|8|9)|5(0|1))|98(2|3))|9(005|206)))|6(0(4906|5141)|36120)|9682(0(1|2|3|4|5|6|7|8|9)|1(0|1)))",
6
+ visa: "^4",
7
+ amex: "^(34|37)",
8
+ mastercard: "^5[1-5]",
9
+ discover: "^6011",
10
+ unionpay: "^62",
11
+ troy: "^9792",
12
+ diners: "^(30[0-5]|36)",
13
+ }
14
+
15
+ const currentYear = new Date().getFullYear()
16
+ const monthsArr = Array.from({ length: 12 }, (x, i) => {
17
+ const month = i + 1
18
+ return month <= 9 ? "0" + month : month
19
+ })
20
+ const yearsArr = Array.from({ length: 9 }, (_x, i) => currentYear + i)
21
+
22
+ export const HawaCardInput = ({
23
+ cardHolder,
24
+ cardMonth,
25
+ cardYear,
26
+ cardCvv,
27
+ rememberMe,
28
+ onUpdateState,
29
+ cardNumberRef,
30
+ cardHolderRef,
31
+ cardDateRef,
32
+ cardCvvRef,
33
+ rememberMeRef,
34
+ onCardInputFocus,
35
+ onCardInputBlur,
36
+ children,
37
+ handlePaymentPayfort,
38
+ selectedPaymentMethod,
39
+ isRegister,
40
+ accessCode,
41
+ shaRequestPassphrase,
42
+ transaction,
43
+ signature,
44
+ isCheckout,
45
+ }) => {
46
+ // const token = getToken()
47
+ // const router = useRouter()
48
+ // const formRegister = useRef()
49
+ // const [loading, setLoading] = useState(false)
50
+ const [cardNumber, setCardNumber] = useState("")
51
+ const [expiryDate, setExpiryDate] = useState("")
52
+ const [binCardType, setBinCardType] = useState("")
53
+ // const [tokenName, setTokenName] = useState("")
54
+ // const [registeredCard, setRegisteredCard] = useState("")
55
+ const [registerSignature, setRegisterSignature] = useState("")
56
+ const [card, setCard] = useState("")
57
+ // const [payfortForm, setPayfortForm] = useState("")
58
+ // const classes = useStyles()
59
+ // const [value, setValue] = React.useState("")
60
+ // const [error, setError] = React.useState(false)
61
+ // const [helperText, setHelperText] = React.useState("Choose wisely")
62
+
63
+ // const { data: allCards, loading: loadingCards } = useQuery(getCards(), {
64
+ // variables: { userId: token.User._id },
65
+ // })
66
+
67
+ // const { t, lang } = useTranslation("common")
68
+
69
+ const cardType = (cardNumber) => {
70
+ const number = cardNumber.replace(/\D/g, "")
71
+ let re
72
+ for (const [card, pattern] of Object.entries(CARDS)) {
73
+ re = new RegExp(pattern)
74
+ console.log("number=", number)
75
+ console.log("card=", card)
76
+ console.log("pattern=", pattern)
77
+ console.log("res=", re.test(number))
78
+ if (number.match(re) != null) {
79
+ return card
80
+ }
81
+ }
82
+
83
+ return "" // default type
84
+ }
85
+
86
+ // TODO: We can improve the regex check with a better approach like in the card component.
87
+ const onCardNumberChange = (event) => {
88
+ let { value, name } = event.target
89
+ let cardNumber = value
90
+ value = value.replace(/\D/g, "")
91
+ if (/^3[47]\d{0,13}$/.test(value)) {
92
+ cardNumber = value
93
+ .replace(/(\d{4})/, "$1 ")
94
+ .replace(/(\d{4}) (\d{6})/, "$1 $2 ")
95
+ } else if (/^3(?:0[0-5]|[68]\d)\d{0,11}$/.test(value)) {
96
+ // diner's club, 14 digits
97
+ cardNumber = value
98
+ .replace(/(\d{4})/, "$1 ")
99
+ .replace(/(\d{4}) (\d{6})/, "$1 $2 ")
100
+ } else if (/^\d{0,16}$/.test(value)) {
101
+ // regular cc number, 16 digits
102
+ cardNumber = value
103
+ .replace(/(\d{4})/, "$1 ")
104
+ .replace(/(\d{4}) (\d{4})/, "$1 $2 ")
105
+ .replace(/(\d{4}) (\d{4}) (\d{4})/, "$1 $2 $3 ")
106
+ }
107
+
108
+ setCardNumber(cardNumber.trimRight())
109
+ setBinCardType(cardType(cardNumber.trimRight()))
110
+ onUpdateState(name, cardNumber)
111
+ }
112
+ const handleFormChange = (event) => {
113
+ const { name, value } = event.target
114
+ if (name === "rememberMe") {
115
+ onUpdateState(name, !rememberMe)
116
+ } else {
117
+ onUpdateState(name, value)
118
+ }
119
+ }
120
+
121
+ return (
122
+ <div>
123
+ <div>
124
+ <div>{children}</div>
125
+ <div>
126
+ <div className="w-fit bg-red-200 p-2">
127
+ <label htmlFor="cardNumber" className="relative">
128
+ Card Number
129
+ <input
130
+ type="tel"
131
+ name="cardNumber"
132
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
133
+ autoComplete="off"
134
+ onChange={onCardNumberChange}
135
+ maxLength={19}
136
+ ref={cardNumberRef}
137
+ onFocus={(e) => onCardInputFocus(e, "cardNumber")}
138
+ onBlur={onCardInputBlur}
139
+ value={cardNumber}
140
+ />
141
+ {/* {binCardType && (
142
+ <img className="bg-red-700" src={`/${binCardType}.png`} />
143
+ )} */}
144
+ <img
145
+ className="absolute right-2 top-1/2 translate-y-1/2 bg-red-700"
146
+ src={`../Assets/images/card-type/${binCardType}.png`}
147
+ />
148
+ </label>
149
+ </div>
150
+
151
+ <div className="flex w-fit flex-col bg-red-300 p-2">
152
+ <label htmlFor="cardName" className="card-input__label">
153
+ Card Holder{" "}
154
+ </label>
155
+ <input
156
+ type="text"
157
+ // className="card-input__input"
158
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
159
+ autoComplete="off"
160
+ name="cardHolder"
161
+ onChange={handleFormChange}
162
+ ref={cardHolderRef}
163
+ onFocus={(e) => onCardInputFocus(e, "cardHolder")}
164
+ onBlur={onCardInputBlur}
165
+ />
166
+ </div>
167
+
168
+ <div className="flex w-fit flex-col bg-red-400 p-2">
169
+ <div className="flex flex-col">
170
+ <label htmlFor="cardMonth" className="card-input__label">
171
+ Expiration
172
+ </label>
173
+ <div className="flex flex-row gap-2">
174
+ <select
175
+ className="rounded-lg p-2.5"
176
+ value={cardMonth}
177
+ name="cardMonth"
178
+ onChange={handleFormChange}
179
+ ref={cardDateRef}
180
+ onFocus={(e) => onCardInputFocus(e, "cardDate")}
181
+ onBlur={onCardInputBlur}
182
+ >
183
+ <option value="" disabled>
184
+ Month
185
+ </option>
186
+
187
+ {monthsArr.map((val, index) => (
188
+ <option key={index} value={val}>
189
+ {val}
190
+ </option>
191
+ ))}
192
+ </select>
193
+ <select
194
+ name="cardYear"
195
+ className="rounded-lg p-2.5"
196
+ value={cardYear}
197
+ onChange={handleFormChange}
198
+ onFocus={(e) => onCardInputFocus(e, "cardDate")}
199
+ onBlur={onCardInputBlur}
200
+ >
201
+ <option value="" disabled>
202
+ Year
203
+ </option>
204
+
205
+ {yearsArr.map((val, index) => (
206
+ <option key={index} value={val}>
207
+ {val}
208
+ </option>
209
+ ))}
210
+ </select>
211
+ </div>
212
+ </div>
213
+ </div>
214
+ <div className="flex w-fit flex-col bg-red-500 p-2">
215
+ <label htmlFor="cardCvv">CCV</label>
216
+ <input
217
+ type="tel"
218
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
219
+ maxLength={4}
220
+ autoComplete="off"
221
+ name="cardCvv"
222
+ onChange={handleFormChange}
223
+ // onFocus={onCvvFocus}
224
+ // onBlur={onCvvBlur}
225
+ ref={cardCvvRef}
226
+ />
227
+ </div>
228
+ {isCheckout && (
229
+ <div className="card-input">
230
+ <label htmlFor="rememberMe" className="card-input__label">
231
+ <input
232
+ type="checkbox"
233
+ autoComplete="off"
234
+ name="rememberMe"
235
+ checked={rememberMe}
236
+ onChange={handleFormChange}
237
+ ref={rememberMeRef}
238
+ />
239
+ Store Payment Details{" "}
240
+ </label>
241
+ </div>
242
+ )}
243
+ <div className="card-input" style={{ marginTop: "20px" }}>
244
+ <form
245
+ onSubmit={(e) => e.preventDefault()}
246
+ // ref={(ref) => setPayfortForm(ref)}
247
+ id="formSendToAps"
248
+ action={`${process.env.NEXT_PUBLIC_QAWAIM_PAYFORT_ENVIRONMENT_URL}`}
249
+ method="POST"
250
+ >
251
+ <input type="hidden" name="access_code" value={accessCode} />
252
+ <input
253
+ type="hidden"
254
+ name="merchant_identifier"
255
+ value={`${process.env.NEXT_PUBLIC_QAWAIM_PAYFORT_MERCHANT_ID}`}
256
+ />
257
+ <input type="hidden" name="language" value={"en"} />
258
+ <input
259
+ type="hidden"
260
+ name="card_number"
261
+ value={cardNumber.replace(/\s/g, "")}
262
+ />
263
+ <input type="hidden" name="expiry_date" value={expiryDate} />
264
+ <input
265
+ type="hidden"
266
+ name="signature"
267
+ value={isCheckout ? signature : registerSignature}
268
+ />
269
+ <input type="hidden" name="card_holder_name" value={cardHolder} />
270
+ <input
271
+ type="hidden"
272
+ name="merchant_reference"
273
+ // value={isCheckout ? transaction?._id : card?._id}
274
+ />
275
+ <input
276
+ type="hidden"
277
+ name="service_command"
278
+ value={isCheckout ? "TOKENIZATION" : "CREATE_TOKEN"}
279
+ />
280
+ <input
281
+ type="hidden"
282
+ name="return_url"
283
+ // value={
284
+ // isCheckout
285
+ // ? `${process.env.NEXT_PUBLIC_QAWAIM_USER_PORTAL_URL}/aps_online/response`
286
+ // : `${process.env.NEXT_PUBLIC_QAWAIM_USER_PORTAL_URL}/aps_online/register`
287
+ // }
288
+ />
289
+ {!isCheckout && (
290
+ <input
291
+ type="hidden"
292
+ name="currency"
293
+ // value={token.User.default_currency?.toUpperCase()}
294
+ />
295
+ )}
296
+ {isCheckout && (
297
+ <>
298
+ <input
299
+ type="hidden"
300
+ name="card_security_code"
301
+ value={cardCvv}
302
+ />
303
+
304
+ {/* {tokenName && (
305
+ <input type="hidden" name="token_name" value={tokenName} />
306
+ )} */}
307
+ </>
308
+ )}
309
+
310
+ <HawaButton>Pay</HawaButton>
311
+ </form>
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ )
317
+ }
@@ -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
  }