@sikka/hawa 0.0.213 → 0.0.214

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.213",
3
+ "version": "0.0.214",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -26,9 +26,9 @@
26
26
  "test": "echo \"Error: no test specified\" && exit 1",
27
27
  "start": "start-storybook -p 6006 -s public",
28
28
  "storybook": "start-storybook -p 6006 -s public",
29
- "build-storybook": "build-storybook",
30
29
  "generate-css": "postcss src/tailwind.css -o src/styles.css && mkdir -p dist && cp src/styles.css dist/",
31
30
  "deploy-storybook": "storybook-to-ghpages",
31
+ "build-storybook": "build-storybook",
32
32
  "build-lib": "rollup -c",
33
33
  "build:styles": " node tools/build-styles"
34
34
  },
@@ -21,10 +21,10 @@ export const Newsletter: React.FunctionComponent<TNewsletter> = ({
21
21
  <HawaContainer variant={variant} centered={true}>
22
22
  <div className="p-4 pt-0">
23
23
  <h1 className="font-bold">
24
- {texts.wantToStayUpdated ?? "Want to stay updated?"}
24
+ {texts?.wantToStayUpdated ?? "Want to stay updated?"}
25
25
  </h1>
26
26
  <span>
27
- {texts.subscribeToNewsletter ?? "Subscribe to our newsletter"}
27
+ {texts?.subscribeToNewsletter ?? "Subscribe to our newsletter"}
28
28
  </span>
29
29
  </div>
30
30
  <form
@@ -42,7 +42,7 @@ export const Newsletter: React.FunctionComponent<TNewsletter> = ({
42
42
  margin="none"
43
43
  />
44
44
  <HawaButton size="full" margins="none">
45
- {texts.submit ?? "Submit"}
45
+ {texts?.submit ?? "Submit"}
46
46
  </HawaButton>
47
47
  </form>
48
48
  </HawaContainer>
@@ -5,14 +5,14 @@ import { HawaContainer } from "../../layout"
5
5
  type NotFoundTypes = {
6
6
  variant?: "outlined" | "contained" | "neobrutalism"
7
7
  texts?: {
8
- pageNotFound: string
9
- ifLost: string
10
- home: string
8
+ pageNotFound?: string
9
+ ifLost?: string
10
+ home?: string
11
11
  }
12
12
  }
13
13
 
14
14
  export const NotFound: React.FunctionComponent<NotFoundTypes> = ({
15
- variant,
15
+ variant = "contained",
16
16
  texts,
17
17
  }) => {
18
18
  return (
@@ -20,13 +20,13 @@ export const NotFound: React.FunctionComponent<NotFoundTypes> = ({
20
20
  <div className="flex flex-col items-center dark:text-white">
21
21
  <div className="text-center text-6xl font-bold ">404</div>
22
22
  <div className="m-2 text-center text-xl font-bold ">
23
- {texts.pageNotFound ?? "Page Not Found"}
23
+ {texts?.pageNotFound ?? "Page Not Found"}
24
24
  </div>
25
25
  <div className="text-center ">
26
- {texts.ifLost ?? "If you're lost please contact us help@sikka.io"}
26
+ {texts?.ifLost ?? "If you're lost please contact us help@sikka.io"}
27
27
  </div>
28
28
  <HawaButton color="primary" width="full">
29
- {texts.home ?? "Home"}
29
+ {texts?.home ?? "Home"}
30
30
  </HawaButton>
31
31
  </div>
32
32
  </HawaContainer>
@@ -67,6 +67,7 @@ export const CheckoutForm: React.FunctionComponent<CheckoutFormTypes> = (
67
67
  </div>
68
68
  <div className="rounded border border-gray-300">
69
69
  <HawaTable
70
+ pagination={false}
70
71
  direction={isArabic ? "rtl" : "ltr"}
71
72
  columns={[
72
73
  { hidden: false, value: "Product" },
@@ -28,6 +28,7 @@ export const HawaLogoButton: React.FunctionComponent<LogoButtonTypes> = (
28
28
  src={
29
29
  "https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"
30
30
  }
31
+ className="h-6"
31
32
  />
32
33
  )
33
34
  break
@@ -11,6 +11,7 @@ import { BsChevronRight, BsFilter, BsPlus, BsThreeDots } from "react-icons/bs"
11
11
  // TODO: pass the onSearch handler to the parent
12
12
 
13
13
  type TableTypes = {
14
+ pagination?: boolean
14
15
  columns: any[string]
15
16
  actions?: ActionItems[][]
16
17
  direction?: "rtl" | "ltr"
@@ -47,6 +48,7 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
47
48
  highlightFirst = false,
48
49
  direction = "ltr",
49
50
  bordersWidth = "1",
51
+ pagination = true,
50
52
  ...props
51
53
  }) => {
52
54
  const [perPage, setPerPage] = useState(10)
@@ -256,71 +258,92 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
256
258
  </table>
257
259
  </div>
258
260
 
259
- <div className="flex flex-row items-center justify-between ">
260
- {/* Pagination Pages */}
261
- {range.length > 1 ? (
262
- <div className="flex w-fit flex-row items-stretch justify-center gap-2 overflow-clip rounded ">
263
- {/* Previous Page Button */}
264
- <div
265
- className={clsx(
266
- "flex h-6 w-6 rotate-180 items-center justify-center rounded bg-gray-100 p-1 text-xs hover:bg-layoutPrimary-700 "
267
- )}
268
- onClick={() =>
269
- page <= 1 ? setPage(range.length) : setPage(page - 1)
270
- }
271
- >
272
- <BsChevronRight />
273
- </div>
274
- {/* Numbered Pagination */}
275
- <div className="flex flex-row items-center overflow-clip rounded transition-all">
276
- {/* The first page */}
277
- {range.length > 6 &&
278
- range.map((el, index) => {
279
- if (index <= 0) {
280
- return (
281
- <button
282
- key={index}
283
- className={clsx(
284
- "w-10 p-1 text-xs hover:bg-gray-200",
285
- page === el
286
- ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
287
- : "bg-gray-100"
288
- )}
289
- onClick={() => setPage(el)}
290
- >
291
- {el}
292
- </button>
293
- )
294
- }
295
- })}
296
- {/* The Current Page / Input */}
297
- {range?.length > 6 && (
298
- <input
299
- type={"text"}
300
- className=" w-10 bg-gray-100 p-1 text-center text-xs"
301
- defaultValue={
302
- page !== 0 || page !== range.length - 1 ? page : "..."
303
- }
304
- value={
305
- page == 1 || page == range.length
306
- ? "..."
307
- : enteredPage
308
- ? enteredPage
309
- : page
310
- }
311
- onChange={(e) => setEnteredPage(parseInt(e.target.value))}
312
- onKeyDown={(e) => {
313
- if (e.key === "Enter") {
314
- setPage(enteredPage)
315
- setEnteredPage(null)
261
+ {pagination && (
262
+ <div className="flex flex-row items-center justify-between ">
263
+ {/* Pagination Pages */}
264
+ {range.length > 1 ? (
265
+ <div className="flex w-fit flex-row items-stretch justify-center gap-2 overflow-clip rounded ">
266
+ {/* Previous Page Button */}
267
+ <div
268
+ className={clsx(
269
+ "flex h-6 w-6 rotate-180 items-center justify-center rounded bg-gray-100 p-1 text-xs hover:bg-layoutPrimary-700 "
270
+ )}
271
+ onClick={() =>
272
+ page <= 1 ? setPage(range.length) : setPage(page - 1)
273
+ }
274
+ >
275
+ <BsChevronRight />
276
+ </div>
277
+ {/* Numbered Pagination */}
278
+ <div className="flex flex-row items-center overflow-clip rounded transition-all">
279
+ {/* The first page */}
280
+ {range.length > 6 &&
281
+ range.map((el, index) => {
282
+ if (index <= 0) {
283
+ return (
284
+ <button
285
+ key={index}
286
+ className={clsx(
287
+ "w-10 p-1 text-xs hover:bg-gray-200",
288
+ page === el
289
+ ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
290
+ : "bg-gray-100"
291
+ )}
292
+ onClick={() => setPage(el)}
293
+ >
294
+ {el}
295
+ </button>
296
+ )
297
+ }
298
+ })}
299
+ {/* The Current Page / Input */}
300
+ {range?.length > 6 && (
301
+ <input
302
+ type={"text"}
303
+ className=" w-10 bg-gray-100 p-1 text-center text-xs"
304
+ defaultValue={
305
+ page !== 0 || page !== range.length - 1 ? page : "..."
306
+ }
307
+ value={
308
+ page == 1 || page == range.length
309
+ ? "..."
310
+ : enteredPage
311
+ ? enteredPage
312
+ : page
313
+ }
314
+ onChange={(e) => setEnteredPage(parseInt(e.target.value))}
315
+ onKeyDown={(e) => {
316
+ if (e.key === "Enter") {
317
+ setPage(enteredPage)
318
+ setEnteredPage(null)
319
+ }
320
+ }}
321
+ />
322
+ )}
323
+ {/* The last page */}
324
+ {range?.length > 6 &&
325
+ range.map((el, index) => {
326
+ if (index >= range.length - 1) {
327
+ return (
328
+ <button
329
+ key={index}
330
+ className={clsx(
331
+ "w-10 p-1 text-xs hover:bg-gray-200",
332
+ page === el
333
+ ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
334
+ : "bg-gray-100"
335
+ )}
336
+ onClick={() => setPage(el)}
337
+ >
338
+ {el}
339
+ </button>
340
+ )
316
341
  }
317
- }}
318
- />
319
- )}
320
- {/* The last page */}
321
- {range?.length > 6 &&
322
- range.map((el, index) => {
323
- if (index >= range.length - 1) {
342
+ })}
343
+
344
+ {/* All Pages if less than 6 pages */}
345
+ {range?.length <= 6 &&
346
+ range.map((el, index) => {
324
347
  return (
325
348
  <button
326
349
  key={index}
@@ -335,78 +358,59 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
335
358
  {el}
336
359
  </button>
337
360
  )
338
- }
339
- })}
340
-
341
- {/* All Pages if less than 6 pages */}
342
- {range?.length <= 6 &&
343
- range.map((el, index) => {
344
- return (
345
- <button
346
- key={index}
347
- className={clsx(
348
- "w-10 p-1 text-xs hover:bg-gray-200",
349
- page === el
350
- ? "bg-buttonPrimary-500 text-white hover:bg-buttonPrimary-500"
351
- : "bg-gray-100"
352
- )}
353
- onClick={() => setPage(el)}
354
- >
355
- {el}
356
- </button>
357
- )
358
- })}
359
- </div>
360
- {/* Next Page Button */}
361
- <div
362
- onClick={() =>
363
- page >= range.length ? setPage(1) : setPage(page + 1)
364
- }
365
- className={clsx(
366
- "flex h-6 w-6 items-center justify-center rounded bg-gray-100 p-1 text-xs hover:bg-layoutPrimary-700 "
367
- )}
368
- >
369
- <BsChevronRight />
370
- </div>
371
- </div>
372
- ) : (
373
- <div></div>
374
- )}
375
- {/* Pagination Settings */}
376
- {props.rows ? (
377
- <div className="flex w-fit flex-row items-center gap-2 ">
378
- <div className="text-xs ">
379
- {props.rows.length} {props.texts?.items ?? "Items"}
361
+ })}
362
+ </div>
363
+ {/* Next Page Button */}
364
+ <div
365
+ onClick={() =>
366
+ page >= range.length ? setPage(1) : setPage(page + 1)
367
+ }
368
+ className={clsx(
369
+ "flex h-6 w-6 items-center justify-center rounded bg-gray-100 p-1 text-xs hover:bg-layoutPrimary-700 "
370
+ )}
371
+ >
372
+ <BsChevronRight />
373
+ </div>
380
374
  </div>
375
+ ) : (
376
+ <div></div>
377
+ )}
378
+ {/* Pagination Settings */}
379
+ {props.rows ? (
380
+ <div className="flex w-fit flex-row items-center gap-2 ">
381
+ <div className="text-xs ">
382
+ {props.rows.length} {props.texts?.items ?? "Items"}
383
+ </div>
381
384
 
382
- <select
383
- value={perPage}
384
- className="h-6 rounded text-xs"
385
- onChange={(e) => {
386
- setPerPage(parseInt(e.target.value))
387
- }}
388
- >
389
- <option value={10} style={{ fontSize: 10 }}>
390
- 10 / {props.texts?.page ?? "Page"}
391
- </option>
392
- <option value={20} style={{ fontSize: 10 }}>
393
- 20 / {props.texts?.page ?? "Page"}
394
- </option>
395
- <option value={30} style={{ fontSize: 10 }}>
396
- 30 / {props.texts?.page ?? "Page"}
397
- </option>
398
- <option value={50} style={{ fontSize: 10 }}>
399
- 50 / {props.texts?.page ?? "Page"}
400
- </option>
401
- <option value={100} style={{ fontSize: 10 }}>
402
- 100 / {props.texts?.page ?? "Page"}
403
- </option>
404
- </select>
405
- </div>
406
- ) : (
407
- <div></div>
408
- )}
409
- </div>
385
+ <select
386
+ value={perPage}
387
+ className="h-6 rounded text-xs"
388
+ onChange={(e) => {
389
+ setPerPage(parseInt(e.target.value))
390
+ }}
391
+ >
392
+ <option value={10} style={{ fontSize: 10 }}>
393
+ 10 / {props.texts?.page ?? "Page"}
394
+ </option>
395
+ <option value={20} style={{ fontSize: 10 }}>
396
+ 20 / {props.texts?.page ?? "Page"}
397
+ </option>
398
+ <option value={30} style={{ fontSize: 10 }}>
399
+ 30 / {props.texts?.page ?? "Page"}
400
+ </option>
401
+ <option value={50} style={{ fontSize: 10 }}>
402
+ 50 / {props.texts?.page ?? "Page"}
403
+ </option>
404
+ <option value={100} style={{ fontSize: 10 }}>
405
+ 100 / {props.texts?.page ?? "Page"}
406
+ </option>
407
+ </select>
408
+ </div>
409
+ ) : (
410
+ <div></div>
411
+ )}
412
+ </div>
413
+ )}
410
414
  </div>
411
415
  )
412
416
  }
@@ -5,7 +5,7 @@ import React, { useState } from "react"
5
5
 
6
6
  type TabsTypes = {
7
7
  options?: any
8
- onChangeTab?: any
8
+ onChangeTab?: (option) => void
9
9
  defaultValue?: any
10
10
  orientation?: "horizontal" | "vertical"
11
11
  direction?: "rtl" | "ltr"
@@ -101,7 +101,7 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
101
101
  aria-current="page"
102
102
  onClick={() => {
103
103
  setSelectedOption(opt.value)
104
- props.onChangeTab(opt)
104
+ props?.onChangeTab(opt)
105
105
  }}
106
106
  className={clsx(
107
107
  opt.value === selectedOption
@@ -406,8 +406,9 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
406
406
  : 0,
407
407
  }}
408
408
  >
409
- {dItem.subItems?.map((subIt) => (
409
+ {dItem.subItems?.map((subIt, s) => (
410
410
  <div
411
+ key={s}
411
412
  className={clsx(
412
413
  "flex flex-row gap-2 overflow-x-clip rounded p-2 px-2 text-xs",
413
414
  isRTL ? "text-right" : "text-left",