@sikka/hawa 0.0.174 → 0.0.176

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.
@@ -3,6 +3,7 @@ type ContainerTypes = {
3
3
  maxWidth?: "full" | "small" | "normal";
4
4
  children: React.ReactNode;
5
5
  variant?: "contained" | "outlined" | "neobrutalism";
6
+ direction?: "rtl" | "ltr";
6
7
  centered?: boolean;
7
8
  };
8
9
  export declare const HawaContainer: React.FunctionComponent<ContainerTypes>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.174",
3
+ "version": "0.0.176",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -10,6 +10,7 @@ import { Controller, useForm } from "react-hook-form"
10
10
  import { HawaContainer } from "../../layout"
11
11
 
12
12
  type SignInFormTypes = {
13
+ language?: string
13
14
  showError?: any
14
15
  errorTitle?: string
15
16
  errorText?: string
@@ -47,7 +48,6 @@ type SignInFormTypes = {
47
48
  handleGithubSignIn?: () => void
48
49
  handleTwitterSignIn?: () => void
49
50
  }
50
- // TODO: add direction to flip block
51
51
 
52
52
  export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
53
53
  const {
@@ -57,7 +57,7 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
57
57
  } = useForm()
58
58
 
59
59
  return (
60
- <HawaContainer>
60
+ <HawaContainer direction={props.language === "ar" ? "rtl" : "ltr"}>
61
61
  <form onSubmit={handleSubmit((e) => props.handleSignIn(e))}>
62
62
  {props.showError && (
63
63
  <HawaAlert
@@ -11,6 +11,7 @@ import { Controller, FormProvider, useForm } from "react-hook-form"
11
11
  import { HawaContainer } from "../../layout/HawaContainer"
12
12
 
13
13
  type SignUpFormTypes = {
14
+ language?: string
14
15
  texts: {
15
16
  fullNameLabel: string
16
17
  fullNamePlaceholder: string
@@ -70,7 +71,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
70
71
  } = methods
71
72
 
72
73
  return (
73
- <HawaContainer>
74
+ <HawaContainer direction={props.language === "ar" ? "rtl" : "ltr"}>
74
75
  <div>
75
76
  {props.showError && (
76
77
  <HawaAlert
@@ -288,8 +289,8 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
288
289
  </HawaButton>
289
290
  </form>
290
291
  </FormProvider>
291
- <div className="p-3 text-center text-sm font-semibold">
292
- {props.texts.existingUserText}{" "}
292
+ <div className="flex flex-row items-center justify-center gap-1 p-3 text-center text-sm font-semibold">
293
+ <span>{props.texts.existingUserText}</span>
293
294
  <span
294
295
  onClick={props.handleRouteToSignIn}
295
296
  className="cursor-pointer text-blue-600"
@@ -12,7 +12,7 @@ export const EmptyState: React.FunctionComponent<TEmptyState> = ({
12
12
  return (
13
13
  <HawaContainer variant={variant} centered={true}>
14
14
  <div className="flex flex-col items-center justify-center text-center dark:text-white">
15
- <div className="flex h-10 w-10 flex-col items-center justify-center rounded-3xl bg-buttonPrimary-lighter text-6xl font-bold">
15
+ <div className="flex h-10 w-10 flex-col items-center justify-center rounded-3xl bg-buttonPrimary-300 text-6xl font-bold">
16
16
  <FaCheck size={20} />
17
17
  </div>
18
18
  <div className="m-2 text-xl font-bold">You're all caught up</div>
@@ -8,13 +8,13 @@ type TNewsletter = {
8
8
  wantToStayUpdated: string
9
9
  subscribeToNewsletter: string
10
10
  }
11
+ handleNewsletterSub: (e: string) => void
11
12
  }
12
13
 
13
- // TODO: make it a form and handle email submission
14
-
15
14
  export const Newsletter: React.FunctionComponent<TNewsletter> = ({
16
15
  variant = "contained",
17
16
  texts,
17
+ handleNewsletterSub,
18
18
  }) => {
19
19
  return (
20
20
  <HawaContainer variant={variant} centered={true}>
@@ -22,17 +22,24 @@ export const Newsletter: React.FunctionComponent<TNewsletter> = ({
22
22
  <h1 className="font-bold">{texts.wantToStayUpdated}</h1>
23
23
  <span>{texts.subscribeToNewsletter}</span>
24
24
  </div>
25
- <div className="flex flex-row gap-2">
25
+ <form
26
+ className="flex flex-row gap-2"
27
+ onSubmit={(e) => {
28
+ e.preventDefault()
29
+ handleNewsletterSub(e.target[0].value)
30
+ }}
31
+ >
26
32
  <HawaTextField
27
33
  width="full"
28
34
  type="email"
35
+ name="email"
29
36
  placeholder={"example@sikka.io"}
30
37
  margin="none"
31
38
  />
32
39
  <HawaButton size="full" margins="none">
33
40
  Submit
34
41
  </HawaButton>
35
- </div>
42
+ </form>
36
43
  </HawaContainer>
37
44
  )
38
45
  }
@@ -31,7 +31,7 @@ const sizeStyles = {
31
31
  const widthStyles = {
32
32
  full: "w-full flex justify-center px-5 py-2.5 text-center inline-flex items-center",
33
33
  normal:
34
- "w-fit dark:bg-buttonPrimary-dark dark:hover:bg-buttonPrimary-darker dark:hover:brightness-90 dark:focus:ring-buttonPrimary-500",
34
+ "w-fit dark:bg-buttonPrimary-dark dark:hover:bg-buttonPrimary-700 dark:hover:brightness-90 dark:focus:ring-buttonPrimary-500",
35
35
  half: "w-1/2",
36
36
  }
37
37
  const variantStyles = {
@@ -42,17 +42,17 @@ const variantStyles = {
42
42
  const colorStyles = {
43
43
  contained: {
44
44
  default:
45
- "text-neutral-900 bg-buttonPrimary-500 hover:bg-buttonPrimary-darker bg-buttonPrimary-500 text-white",
45
+ "text-neutral-900 bg-buttonPrimary-500 hover:bg-buttonPrimary-700 bg-buttonPrimary-500 text-white",
46
46
  primary:
47
- "text-white bg-buttonPrimary-500 hover:bg-buttonPrimary-darker transition-all",
47
+ "text-white bg-buttonPrimary-500 hover:bg-buttonPrimary-700 transition-all",
48
48
  secondary:
49
- "text-neutral-900 bg-buttonSecondary-default hover:text-white hover:bg-buttonSecondary-darker",
49
+ "text-neutral-900 bg-buttonSecondary-default hover:text-white hover:bg-buttonSecondary-700",
50
50
  },
51
51
  outlined: {
52
52
  default: "text-gray-600 border-gray-600 hover:bg-gray-200",
53
53
  primary: "text-black hover:bg-gray-50",
54
54
  secondary:
55
- "text-secondary-800 border-secondary-800 hover:bg-buttonSecondary-darker hover:text-white",
55
+ "text-secondary-800 border-secondary-800 hover:bg-buttonSecondary-700 hover:text-white",
56
56
  },
57
57
  }
58
58
 
@@ -84,6 +84,7 @@ export function HawaButton({
84
84
  >
85
85
  <button
86
86
  id={buttonID}
87
+ type={props.type}
87
88
  className={
88
89
  disabled
89
90
  ? clsx(
@@ -105,7 +106,6 @@ export function HawaButton({
105
106
  )
106
107
  }
107
108
  disabled={disabled}
108
- type={props.type}
109
109
  {...props}
110
110
  >
111
111
  {!isLoading ? children : <HawaSpinner size="button" />}
@@ -106,7 +106,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
106
106
  onClick={(e) => item.action(e, item.label)}
107
107
  className={
108
108
  item.isButton
109
- ? "mx-1 my-1 flex cursor-pointer flex-row items-center rounded bg-buttonPrimary-500 py-2 px-4 text-white hover:bg-buttonPrimary-darker rtl:flex-row-reverse dark:hover:bg-buttonPrimary-darker dark:hover:text-white"
109
+ ? "mx-1 my-1 flex cursor-pointer flex-row items-center rounded bg-buttonPrimary-500 py-2 px-4 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse dark:hover:bg-buttonPrimary-700 dark:hover:text-white"
110
110
  : "mx-1 flex cursor-pointer flex-row items-center rounded py-2 px-4 hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white"
111
111
  }
112
112
  >
@@ -1,21 +1,17 @@
1
+ import clsx from "clsx"
1
2
  import React from "react"
2
3
 
3
- // TODO: make the texts in one object property
4
- // TODO: give it a background color (white)
5
- // TODO: remove title_ar
6
- // TODO: spicifiy features object
7
- // TODO: remove features_ar
4
+ // TODO: if feature.included is false, show gray and x
8
5
 
9
6
  type PricingCardTypes = {
10
7
  lang: "ar" | "en"
11
- features: [any]
12
- features_ar: [any]
8
+ features: [{ included: boolean; text: string }]
13
9
  title: string
14
- title_ar: string
15
10
  price: number
16
- currency: string
17
- buttonText: string
18
- cycleText: string
11
+ // currency: string
12
+ // buttonText: string
13
+ // cycleText: string
14
+ texts: { buttonText: string; cycleText: string; currencyText: string }
19
15
  size: "small" | "medium" | "large"
20
16
  }
21
17
  type CycleTextTypes = {
@@ -48,8 +44,6 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = (
48
44
  usd: isArabic ? "دولار" : "$",
49
45
  sar: isArabic ? "ريال" : "SAR",
50
46
  }
51
- let featuresMapping = isArabic ? props.features_ar : props.features
52
- let chipSpacing = isArabic ? { left: 10 } : { right: 10 }
53
47
  let cardSizes = {
54
48
  small:
55
49
  "mx-1 w-full max-w-fit rounded border bg-white p-4 shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
@@ -59,45 +53,49 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = (
59
53
  "mx-1 w-full max-w-lg rounded border bg-white p-4 shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
60
54
  }
61
55
  return (
62
- <div dir={isArabic ? "rtl" : "ltr"} className={cardSizes[props.size]}>
56
+ <div
57
+ dir={isArabic ? "rtl" : "ltr"}
58
+ className={clsx(cardSizes[props.size], "bg-white")}
59
+ >
63
60
  <h5 className="mb-4 text-xl font-medium text-gray-500 dark:text-gray-400">
64
- {isArabic ? props.title_ar : props.title}
61
+ {props.title}
65
62
  </h5>
66
63
  <div className="flex items-baseline text-gray-900 dark:text-white">
67
- {isArabic ? (
68
- <>
69
- <span className="text-5xl font-extrabold tracking-tight">
70
- {props.price}
71
- </span>
72
- <span className="mx-1 text-sm font-semibold">
73
- {" "}
74
- {
75
- currencyMapping[
76
- props.currency?.toLowerCase() as keyof CurrencyTextTypes
77
- ]
78
- }
79
- </span>
80
- </>
81
- ) : (
82
- <>
83
- <span className="text-sm font-semibold">
84
- {" "}
85
- {
86
- currencyMapping[
87
- props.currency?.toLowerCase() as keyof CurrencyTextTypes
88
- ]
89
- }
90
- </span>
91
- <span className="mx-1 text-5xl font-extrabold tracking-tight">
92
- {props.price}
93
- </span>
94
- </>
95
- )}
64
+ {/* {isArabic ? ( */}
65
+ <>
66
+ <span className="text-5xl font-extrabold tracking-tight">
67
+ {props.price}
68
+ </span>
69
+ <span className="mx-1 text-sm font-semibold">
70
+ {" "}
71
+ {/* {
72
+ currencyMapping[
73
+ props.currency?.toLowerCase() as keyof CurrencyTextTypes
74
+ ]
75
+ } */}
76
+ {props.texts.currencyText}
77
+ </span>
78
+ </>
79
+ {/* // ) : (
80
+ // <>
81
+ // <span className="text-sm font-semibold">
82
+ // {" "}
83
+ // {
84
+ // currencyMapping[
85
+ // props.currency?.toLowerCase() as keyof CurrencyTextTypes
86
+ // ]
87
+ // }
88
+ // </span>
89
+ // <span className="mx-1 text-5xl font-extrabold tracking-tight">
90
+ // {props.price}
91
+ // </span>
92
+ // </>
93
+ // )} */}
96
94
  <span className="ml-1 text-xl font-normal text-gray-500 dark:text-gray-400">
97
- /{" "}
98
- {isArabic
95
+ / {props.texts.cycleText}
96
+ {/* {isArabic
99
97
  ? cycleTextsArabic[props.cycleText as keyof CycleTextTypes]
100
- : cycleTextsEnglish[props.cycleText as keyof CycleTextTypes]}
98
+ : cycleTextsEnglish[props.cycleText as keyof CycleTextTypes]} */}
101
99
  </span>
102
100
  </div>
103
101
  <ul role="list" className="my-7 space-y-0">
@@ -119,7 +117,7 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = (
119
117
  ></path>
120
118
  </svg>
121
119
  <span className="flex items-center text-center font-normal leading-tight text-gray-500 dark:text-gray-400">
122
- {feature}
120
+ {feature.text}
123
121
  </span>
124
122
  </li>
125
123
  )
@@ -129,7 +127,7 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = (
129
127
  type="button"
130
128
  className="inline-flex w-full justify-center rounded bg-blue-600 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-4 focus:ring-blue-200 dark:focus:ring-blue-900"
131
129
  >
132
- {props.buttonText}
130
+ {props.texts.buttonText}
133
131
  </button>
134
132
  </div>
135
133
 
@@ -1,6 +1,6 @@
1
1
  import clsx from "clsx"
2
2
  import React from "react"
3
- // TODO: Add different sizes
3
+
4
4
  type SpinnerTypes = {
5
5
  size?: "button" | "sm" | "normal" | "lg" | "xl"
6
6
  }
@@ -33,7 +33,7 @@ type MenuItems = {
33
33
  isButton?: boolean
34
34
  }
35
35
 
36
- // TODO: fix the drawer top when no topbar
36
+
37
37
  export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
38
38
  direction = "rtl",
39
39
  ...props
@@ -229,7 +229,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
229
229
  className={clsx(
230
230
  props.currentPage === dItem.slug
231
231
  ? "bg-buttonPrimary-500 text-white"
232
- : "hover:bg-buttonPrimary-lighter",
232
+ : "hover:bg-buttonPrimary-300",
233
233
  "m-2 flex cursor-pointer flex-row items-center overflow-x-clip rounded p-2 pl-3 transition-all ",
234
234
  direction === "rtl" ? "flex-row-reverse pr-3" : ""
235
235
  )}
@@ -26,7 +26,7 @@ export const HawaBottomAppBar: React.FunctionComponent<BottomAppBarTypes> = (
26
26
  >
27
27
  {props.appBarContent.map((singleContent: any) => (
28
28
  <div
29
- className="m-1 flex h-full w-full flex-col items-center justify-center rounded p-2 transition-all hover:cursor-pointer hover:bg-buttonPrimary-darker hover:text-white"
29
+ className="m-1 flex h-full w-full flex-col items-center justify-center rounded p-2 transition-all hover:cursor-pointer hover:bg-buttonPrimary-700 hover:text-white"
30
30
  onClick={singleContent.action}
31
31
  >
32
32
  <div
@@ -5,12 +5,14 @@ type ContainerTypes = {
5
5
  maxWidth?: "full" | "small" | "normal"
6
6
  children: React.ReactNode
7
7
  variant?: "contained" | "outlined" | "neobrutalism"
8
+ direction?: "rtl" | "ltr"
8
9
  centered?: boolean
9
10
  }
10
11
  export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
11
12
  maxWidth = "normal",
12
13
  variant = "contained",
13
14
  centered = false,
15
+ direction = "rtl",
14
16
  ...props
15
17
  }) => {
16
18
  let defaultStyle = "flex w-full flex-col rounded p-4"
@@ -34,6 +36,7 @@ export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
34
36
  variantStyles[variant],
35
37
  centered ? "flex items-center text-center" : ""
36
38
  )}
39
+ dir={direction}
37
40
  >
38
41
  {props.children}
39
42
  </div>
@@ -26,7 +26,6 @@ type HawaSiteLayoutTypes = {
26
26
  floating?: boolean
27
27
  }
28
28
 
29
- // TODO: fix the drawer top when no topbar
30
29
  export const HawaSiteLayout: React.FunctionComponent<HawaSiteLayoutTypes> = ({
31
30
  direction = "rtl",
32
31
  navigationSize = "md",
package/src/styles.css CHANGED
@@ -382,8 +382,8 @@ video {
382
382
  --button-primary-500: #4c37eb;
383
383
  --button-primary-700: #2e1dac;
384
384
 
385
- --button-secondary: #ffc011;
386
- --button-secondary-darker: #b48d24;
385
+ --button-secondary-500: #ffc011;
386
+ --button-secondary-700: #b48d24;
387
387
 
388
388
  --border-radius: 13px;
389
389
  }
@@ -1439,9 +1439,6 @@ video {
1439
1439
  .bg-buttonPrimary-500 {
1440
1440
  background-color: var(--button-primary-500);
1441
1441
  }
1442
- .bg-buttonSecondary-default {
1443
- background-color: var(--button-secondary);
1444
- }
1445
1442
  .bg-red-200 {
1446
1443
  --tw-bg-opacity: 1;
1447
1444
  background-color: rgb(254 202 202 / var(--tw-bg-opacity));
@@ -1502,9 +1499,8 @@ video {
1502
1499
  --tw-bg-opacity: 1;
1503
1500
  background-color: rgb(209 213 219 / var(--tw-bg-opacity));
1504
1501
  }
1505
- .bg-buttonPrimary-lighter {
1506
- --tw-bg-opacity: 1;
1507
- background-color: rgb(237 235 253 / var(--tw-bg-opacity));
1502
+ .bg-buttonPrimary-300 {
1503
+ background-color: var(--button-primary-300);
1508
1504
  }
1509
1505
  .bg-blue-400 {
1510
1506
  --tw-bg-opacity: 1;
@@ -1959,8 +1955,12 @@ body {
1959
1955
  background-color: rgb(243 244 246 / var(--tw-bg-opacity));
1960
1956
  }
1961
1957
 
1962
- .hover\:bg-buttonSecondary-darker:hover {
1963
- background-color: var(--button-secondary-darker);
1958
+ .hover\:bg-buttonPrimary-700:hover {
1959
+ background-color: var(--button-primary-700);
1960
+ }
1961
+
1962
+ .hover\:bg-buttonSecondary-700:hover {
1963
+ background-color: var(--button-secondary-700);
1964
1964
  }
1965
1965
 
1966
1966
  .hover\:bg-gray-50:hover {
@@ -1991,9 +1991,8 @@ body {
1991
1991
  background-color: rgb(55 65 81 / var(--tw-bg-opacity));
1992
1992
  }
1993
1993
 
1994
- .hover\:bg-buttonPrimary-lighter:hover {
1995
- --tw-bg-opacity: 1;
1996
- background-color: rgb(237 235 253 / var(--tw-bg-opacity));
1994
+ .hover\:bg-buttonPrimary-300:hover {
1995
+ background-color: var(--button-primary-300);
1997
1996
  }
1998
1997
 
1999
1998
  .hover\:text-gray-900:hover {
@@ -2293,6 +2292,10 @@ body {
2293
2292
  background-color: rgb(31 41 55 / var(--tw-bg-opacity));
2294
2293
  }
2295
2294
 
2295
+ .dark .dark\:hover\:bg-buttonPrimary-700:hover {
2296
+ background-color: var(--button-primary-700);
2297
+ }
2298
+
2296
2299
  .dark .dark\:hover\:text-white:hover {
2297
2300
  --tw-text-opacity: 1;
2298
2301
  color: rgb(255 255 255 / var(--tw-text-opacity));
package/src/tailwind.css CHANGED
@@ -11,8 +11,8 @@
11
11
  --button-primary-500: #4c37eb;
12
12
  --button-primary-700: #2e1dac;
13
13
 
14
- --button-secondary: #ffc011;
15
- --button-secondary-darker: #b48d24;
14
+ --button-secondary-500: #ffc011;
15
+ --button-secondary-700: #b48d24;
16
16
 
17
17
  --border-radius: 13px;
18
18
  }
@@ -361,4 +361,4 @@
361
361
 
362
362
 
363
363
 
364
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.4a2964ac.iframe.bundle.js"></script><script src="239.5e8067ea.iframe.bundle.js"></script><script src="main.ea6f9b48.iframe.bundle.js"></script></body></html>
364
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.4a2964ac.iframe.bundle.js"></script><script src="239.5e8067ea.iframe.bundle.js"></script><script src="main.46fe6f33.iframe.bundle.js"></script></body></html>