@sikka/hawa 0.0.207 → 0.0.209
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 +3 -14
- package/es/blocks/Pricing/PricingPlans.d.ts +33 -2
- package/es/elements/HawaPricingCard.d.ts +3 -2
- package/es/index.es.js +1 -1
- package/lib/blocks/Pricing/PricingPlans.d.ts +33 -2
- package/lib/elements/HawaPricingCard.d.ts +3 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/Pricing/ComparingPlans.tsx +0 -1
- package/src/blocks/Pricing/PricingPlans.tsx +43 -39
- package/src/elements/HawaMenu.tsx +2 -15
- package/src/elements/HawaPricingCard.tsx +24 -37
- package/src/elements/HawaTabs.tsx +22 -13
- package/src/styles.css +3 -14
package/package.json
CHANGED
|
@@ -1,58 +1,65 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
2
|
import { HawaPricingCard, HawaTabs } from "../../elements"
|
|
3
|
+
// TODO: make lang into direction rtl | ltr
|
|
3
4
|
|
|
4
5
|
type PricingPlansTypes = {
|
|
5
|
-
plans:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
plans: [
|
|
7
|
+
{
|
|
8
|
+
direction: "rtl" | "ltr"
|
|
9
|
+
features: [{ included: boolean; text: string }]
|
|
10
|
+
price: number
|
|
11
|
+
texts: {
|
|
12
|
+
title: string
|
|
13
|
+
subtitle: string
|
|
14
|
+
buttonText: string
|
|
15
|
+
cycleText: string
|
|
16
|
+
currencyText: string
|
|
17
|
+
}
|
|
18
|
+
size: "small" | "medium" | "large"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
currencies: [
|
|
22
|
+
{
|
|
23
|
+
label: string
|
|
24
|
+
value: string
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
billingCycles: [
|
|
28
|
+
{
|
|
29
|
+
label: string
|
|
30
|
+
value: string
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
onCycleChange?: (e) => void
|
|
34
|
+
onCurrencyChange?: (e) => void
|
|
35
|
+
direction?: "rtl" | "ltr"
|
|
22
36
|
}
|
|
23
37
|
export const PricingPlans: React.FunctionComponent<PricingPlansTypes> = (
|
|
24
38
|
props
|
|
25
39
|
) => {
|
|
26
40
|
const [currentCurrency, setCurrentCurrency] = useState("SAR")
|
|
27
41
|
const [currentCycle, setCurrentCycle] = useState("month")
|
|
28
|
-
|
|
29
|
-
{ label: `Monthly`, value: `month` },
|
|
30
|
-
// { label: `3 Months`, value: `3-months` },
|
|
31
|
-
// { label: `6 Months`, value: `6-months` },
|
|
32
|
-
{ label: `Annually`, value: `annually` },
|
|
33
|
-
]
|
|
34
|
-
let currencyOptions = [
|
|
35
|
-
{ label: `USD`, value: `usd` },
|
|
36
|
-
{ label: `SAR`, value: `sar` },
|
|
37
|
-
]
|
|
38
|
-
let activeTabStyle =
|
|
39
|
-
"inline-block py-3 px-4 text-white bg-blue-600 rounded active"
|
|
40
|
-
let inactiveTabStyle =
|
|
41
|
-
"inline-block py-3 px-4 rounded hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
|
|
42
|
+
|
|
42
43
|
return (
|
|
43
44
|
<div>
|
|
44
45
|
<div className="mb-2 flex w-full justify-between">
|
|
45
46
|
<HawaTabs
|
|
46
47
|
pill
|
|
47
48
|
defaultValue={currentCycle}
|
|
48
|
-
options={
|
|
49
|
-
onChangeTab={(e: any) =>
|
|
49
|
+
options={props.billingCycles}
|
|
50
|
+
onChangeTab={(e: any) => {
|
|
51
|
+
setCurrentCycle(e.label)
|
|
52
|
+
props.onCycleChange(e)
|
|
53
|
+
}}
|
|
50
54
|
/>
|
|
51
55
|
<HawaTabs
|
|
52
56
|
pill
|
|
53
57
|
defaultValue={currentCurrency}
|
|
54
|
-
options={
|
|
55
|
-
onChangeTab={(e: any) =>
|
|
58
|
+
options={props.currencies}
|
|
59
|
+
onChangeTab={(e: any) => {
|
|
60
|
+
setCurrentCurrency(e.label)
|
|
61
|
+
props.onCurrencyChange(e)
|
|
62
|
+
}}
|
|
56
63
|
/>
|
|
57
64
|
</div>
|
|
58
65
|
|
|
@@ -60,12 +67,9 @@ export const PricingPlans: React.FunctionComponent<PricingPlansTypes> = (
|
|
|
60
67
|
{props.plans.map((plan: any) => {
|
|
61
68
|
return (
|
|
62
69
|
<HawaPricingCard
|
|
63
|
-
// size="large"
|
|
64
|
-
// features={plan.features}
|
|
65
|
-
lang={props.lang}
|
|
66
70
|
{...plan}
|
|
67
71
|
texts={{
|
|
68
|
-
|
|
72
|
+
...plan.texts,
|
|
69
73
|
currencyText: currentCurrency,
|
|
70
74
|
cycleText: currentCycle,
|
|
71
75
|
}}
|
|
@@ -47,17 +47,13 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
47
47
|
position = "top-right",
|
|
48
48
|
}) => {
|
|
49
49
|
const [menuOpened, setMenuOpened] = useState(false)
|
|
50
|
-
|
|
51
50
|
const childrenRef = useRef(null)
|
|
52
51
|
const [childrenHeight, setChildrenHeight] = useState(null)
|
|
53
52
|
const [childrenWidth, setChildrenWidth] = useState(null)
|
|
54
|
-
|
|
55
53
|
const menuRef = useRef(null)
|
|
56
54
|
const [menuWidth, setMenuWidth] = useState(null)
|
|
57
55
|
const [menuHeight, setMenuHeight] = useState(null)
|
|
58
56
|
|
|
59
|
-
const ref = useRef(null)
|
|
60
|
-
|
|
61
57
|
useEffect(() => {
|
|
62
58
|
setMenuHeight(menuRef.current?.getBoundingClientRect().height)
|
|
63
59
|
setMenuWidth(menuRef.current?.getBoundingClientRect().width)
|
|
@@ -74,18 +70,9 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
74
70
|
document.removeEventListener("click", handleClickOutside, true)
|
|
75
71
|
}
|
|
76
72
|
}, [onClickOutside])
|
|
73
|
+
|
|
77
74
|
let defaultStyles =
|
|
78
75
|
"border-none absolute ring-offset-1 absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded bg-gray-50 shadow-lg transition-all dark:bg-gray-700"
|
|
79
|
-
let positionStyles = {
|
|
80
|
-
"top-right": "top-8 right-0",
|
|
81
|
-
"top-left": "top-8 left-0",
|
|
82
|
-
"bottom-right": "bottom-8 right-0",
|
|
83
|
-
"bottom-left": "bottom-8 left-0",
|
|
84
|
-
}
|
|
85
|
-
let animationStyles = {
|
|
86
|
-
opened: "max-h-fit h-max visible opacity-100 block",
|
|
87
|
-
closed: "h-0 invisible opacity-0 hidden",
|
|
88
|
-
}
|
|
89
76
|
let sizeStyles = {
|
|
90
77
|
small: "text-[11px] p-1 px-4 m-0",
|
|
91
78
|
normal: "py-2 px-4",
|
|
@@ -191,7 +178,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
191
178
|
>
|
|
192
179
|
{group?.map((item) => {
|
|
193
180
|
return item.element ? (
|
|
194
|
-
<li className="
|
|
181
|
+
<li className="cursor-pointer items-center rounded hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white">
|
|
195
182
|
{item.element}
|
|
196
183
|
</li>
|
|
197
184
|
) : (
|
|
@@ -1,57 +1,37 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React from "react"
|
|
3
|
+
import { HawaButton } from "./HawaButton"
|
|
3
4
|
|
|
4
|
-
// TODO: if feature.
|
|
5
|
+
// TODO: if feature.excluded is false, show gray and x
|
|
6
|
+
// TODO: add badge to feature if soon
|
|
5
7
|
|
|
6
8
|
type PricingCardTypes = {
|
|
7
|
-
|
|
9
|
+
direction?: "rtl" | "ltr"
|
|
8
10
|
features: [{ included: boolean; text: string }]
|
|
9
|
-
title: string
|
|
10
11
|
price: number
|
|
11
12
|
texts: {
|
|
13
|
+
title: string
|
|
12
14
|
subtitle: string
|
|
13
15
|
buttonText: string
|
|
14
16
|
cycleText: string
|
|
15
17
|
currencyText: string
|
|
16
18
|
}
|
|
19
|
+
currentPlan?: boolean
|
|
17
20
|
size: "small" | "medium" | "large"
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
monthly: string
|
|
21
|
-
"3-months": string
|
|
22
|
-
"6-months": string
|
|
23
|
-
annually: string
|
|
24
|
-
}
|
|
25
|
-
type CurrencyTextTypes = {
|
|
26
|
-
usd: string
|
|
27
|
-
sar: string
|
|
28
|
-
}
|
|
22
|
+
|
|
29
23
|
export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
30
24
|
size = "medium",
|
|
25
|
+
direction = "ltr",
|
|
26
|
+
currentPlan = true,
|
|
31
27
|
...props
|
|
32
28
|
}) => {
|
|
33
|
-
let isArabic =
|
|
34
|
-
let cycleTextsArabic: CycleTextTypes = {
|
|
35
|
-
monthly: "شهرياً",
|
|
36
|
-
"3-months": "كل 3 أشهر",
|
|
37
|
-
"6-months": "كل 6 أشهر",
|
|
38
|
-
annually: "سنوياً",
|
|
39
|
-
}
|
|
40
|
-
let cycleTextsEnglish: CycleTextTypes = {
|
|
41
|
-
monthly: "Monthly",
|
|
42
|
-
"3-months": "3 Months",
|
|
43
|
-
"6-months": "6 Months",
|
|
44
|
-
annually: "Annually",
|
|
45
|
-
}
|
|
46
|
-
let currencyMapping: CurrencyTextTypes = {
|
|
47
|
-
usd: isArabic ? "دولار" : "$",
|
|
48
|
-
sar: isArabic ? "ريال" : "SAR",
|
|
49
|
-
}
|
|
29
|
+
let isArabic = direction === "rtl"
|
|
50
30
|
let cardSizes = {
|
|
51
31
|
small:
|
|
52
32
|
"mx-1 w-full max-w-sm rounded border shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
53
33
|
medium:
|
|
54
|
-
"mx-1 w-full rounded min-w-fit border
|
|
34
|
+
"mx-1 w-full rounded min-w-fit border dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
55
35
|
large:
|
|
56
36
|
"mx-1 w-full max-w-lg rounded border p-4 shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
57
37
|
}
|
|
@@ -59,12 +39,15 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
59
39
|
<div
|
|
60
40
|
dir={isArabic ? "rtl" : "ltr"}
|
|
61
41
|
className={clsx(
|
|
42
|
+
currentPlan
|
|
43
|
+
? "border-buttonPrimary-500 bg-layoutPrimary-500 p-0"
|
|
44
|
+
: "bg-white",
|
|
62
45
|
cardSizes[size],
|
|
63
|
-
"flex flex-col gap-4 border-2
|
|
46
|
+
"flex flex-col gap-4 rounded border-2 p-4"
|
|
64
47
|
)}
|
|
65
48
|
>
|
|
66
49
|
<h5 className="text-md 0 font-bold text-gray-500 dark:text-gray-400">
|
|
67
|
-
{props.title}
|
|
50
|
+
{props.texts.title}
|
|
68
51
|
</h5>
|
|
69
52
|
<div className=" flex items-baseline text-gray-900 dark:text-white">
|
|
70
53
|
<>
|
|
@@ -75,9 +58,9 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
75
58
|
{props.texts.currencyText}
|
|
76
59
|
</span>
|
|
77
60
|
</>
|
|
78
|
-
|
|
61
|
+
<span className="ml-1 text-xl font-normal text-gray-500 dark:text-gray-400">
|
|
79
62
|
/ {props.texts.cycleText}
|
|
80
|
-
</span>
|
|
63
|
+
</span>
|
|
81
64
|
</div>
|
|
82
65
|
<h5 className="text-md font-normal text-gray-500 dark:text-gray-400">
|
|
83
66
|
{props.texts.subtitle}
|
|
@@ -110,12 +93,16 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
110
93
|
})}
|
|
111
94
|
</ul>
|
|
112
95
|
)}
|
|
113
|
-
<button
|
|
96
|
+
{/* <button
|
|
97
|
+
disabled={currentPlan}
|
|
114
98
|
type="button"
|
|
115
99
|
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"
|
|
116
100
|
>
|
|
117
101
|
{props.texts.buttonText}
|
|
118
|
-
</button>
|
|
102
|
+
</button> */}
|
|
103
|
+
<HawaButton disabled={currentPlan} width="full">
|
|
104
|
+
{props.texts.buttonText}
|
|
105
|
+
</HawaButton>
|
|
119
106
|
</div>
|
|
120
107
|
)
|
|
121
108
|
}
|
|
@@ -16,22 +16,23 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
16
16
|
direction = "ltr",
|
|
17
17
|
width = "normal",
|
|
18
18
|
marginBetween = 0,
|
|
19
|
-
pill =
|
|
19
|
+
pill = false,
|
|
20
20
|
...props
|
|
21
21
|
}) => {
|
|
22
22
|
const [selectedOption, setSelectedOption] = useState(props.options[0]?.value)
|
|
23
23
|
|
|
24
24
|
let activeTabStyle = {
|
|
25
25
|
vertical: "inline-block py-2 px-4 text-white bg-buttonPrimary-500 active",
|
|
26
|
-
horizontal:
|
|
27
|
-
"inline-block py-2 px-4 text-white bg-buttonPrimary-500 rounded rounded-br-none rounded-bl-none active",
|
|
26
|
+
horizontal: "inline-block py-2 px-4 text-white bg-buttonPrimary-500 active",
|
|
28
27
|
}
|
|
28
|
+
// rounded rounded-br-none rounded-bl-none
|
|
29
29
|
let inactiveTabStyle = {
|
|
30
30
|
vertical:
|
|
31
|
-
"inline-block py-2 px-4
|
|
31
|
+
"inline-block py-2 px-4 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-white",
|
|
32
32
|
horizontal:
|
|
33
|
-
"bg-gray-100 inline-block py-2 px-4
|
|
33
|
+
"bg-gray-100 inline-block py-2 px-4 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-white",
|
|
34
34
|
}
|
|
35
|
+
// rounded rounded-br-none rounded-bl-none
|
|
35
36
|
let widthStyles = {
|
|
36
37
|
full: "w-full min-w-full",
|
|
37
38
|
normal: "w-fit",
|
|
@@ -54,7 +55,7 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
54
55
|
vertical:
|
|
55
56
|
"sticky top-2 h-fit flex flex-col w-fit flex-wrap rounded border-b-buttonPrimary-500 bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
|
|
56
57
|
horizontal:
|
|
57
|
-
"flex w-fit
|
|
58
|
+
"flex w-fit flex-wrap border-b-buttonPrimary-500 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
|
|
58
59
|
}
|
|
59
60
|
return (
|
|
60
61
|
<div
|
|
@@ -62,7 +63,6 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
62
63
|
className={clsx(
|
|
63
64
|
containerStyle[orientation],
|
|
64
65
|
props.options[selectedOption] ? "border-b-2" : "border-b-0"
|
|
65
|
-
// "bg-red-400"
|
|
66
66
|
)}
|
|
67
67
|
>
|
|
68
68
|
<ul
|
|
@@ -78,14 +78,19 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
78
78
|
tabsStyle[orientation],
|
|
79
79
|
"border-buttonPrimary-500",
|
|
80
80
|
|
|
81
|
-
orientation === "vertical"
|
|
81
|
+
// orientation === "vertical"
|
|
82
|
+
// ? direction === "rtl"
|
|
83
|
+
// ? "rounded-none rounded-r border-l-2"
|
|
84
|
+
// : "rounded-none rounded-l border-r-2"
|
|
85
|
+
// : "border-b-2",
|
|
86
|
+
widthStyles[width],
|
|
87
|
+
pill
|
|
88
|
+
? "gap-0.5 rounded border-none bg-gray-100 p-0.5"
|
|
89
|
+
: orientation === "vertical"
|
|
82
90
|
? direction === "rtl"
|
|
83
91
|
? "rounded-none rounded-r border-l-2"
|
|
84
92
|
: "rounded-none rounded-l border-r-2"
|
|
85
|
-
: "border-b-2"
|
|
86
|
-
widthStyles[width],
|
|
87
|
-
// "bg-red-400",
|
|
88
|
-
pill ? "overflow-clip rounded border-none" : ""
|
|
93
|
+
: "border-b-2"
|
|
89
94
|
)}
|
|
90
95
|
>
|
|
91
96
|
{props.options?.map((opt: any, o) => (
|
|
@@ -105,7 +110,11 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
105
110
|
]
|
|
106
111
|
: inactiveTabStyle[orientation],
|
|
107
112
|
"w-full transition-all",
|
|
108
|
-
pill
|
|
113
|
+
pill
|
|
114
|
+
? "rounded"
|
|
115
|
+
: orientation === "vertical"
|
|
116
|
+
? "rounded rounded-tl-none rounded-bl-none"
|
|
117
|
+
: "rounded rounded-br-none rounded-bl-none"
|
|
109
118
|
// direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
|
|
110
119
|
)}
|
|
111
120
|
>
|
package/src/styles.css
CHANGED
|
@@ -584,9 +584,6 @@ video {
|
|
|
584
584
|
.bottom-4 {
|
|
585
585
|
bottom: 1rem;
|
|
586
586
|
}
|
|
587
|
-
.bottom-8 {
|
|
588
|
-
bottom: 2rem;
|
|
589
|
-
}
|
|
590
587
|
.left-0 {
|
|
591
588
|
left: 0px;
|
|
592
589
|
}
|
|
@@ -632,9 +629,6 @@ video {
|
|
|
632
629
|
.top-4 {
|
|
633
630
|
top: 1rem;
|
|
634
631
|
}
|
|
635
|
-
.top-8 {
|
|
636
|
-
top: 2rem;
|
|
637
|
-
}
|
|
638
632
|
.top-auto {
|
|
639
633
|
top: auto;
|
|
640
634
|
}
|
|
@@ -883,10 +877,6 @@ video {
|
|
|
883
877
|
.h-full {
|
|
884
878
|
height: 100%;
|
|
885
879
|
}
|
|
886
|
-
.h-max {
|
|
887
|
-
height: -moz-max-content;
|
|
888
|
-
height: max-content;
|
|
889
|
-
}
|
|
890
880
|
.h-screen {
|
|
891
881
|
height: 100vh;
|
|
892
882
|
}
|
|
@@ -1478,10 +1468,6 @@ video {
|
|
|
1478
1468
|
--tw-bg-opacity: 1;
|
|
1479
1469
|
background-color: rgb(220 252 231 / var(--tw-bg-opacity));
|
|
1480
1470
|
}
|
|
1481
|
-
.bg-green-400 {
|
|
1482
|
-
--tw-bg-opacity: 1;
|
|
1483
|
-
background-color: rgb(74 222 128 / var(--tw-bg-opacity));
|
|
1484
|
-
}
|
|
1485
1471
|
.bg-green-500 {
|
|
1486
1472
|
--tw-bg-opacity: 1;
|
|
1487
1473
|
background-color: rgb(34 197 94 / var(--tw-bg-opacity));
|
|
@@ -1553,6 +1539,9 @@ video {
|
|
|
1553
1539
|
.p-0 {
|
|
1554
1540
|
padding: 0px;
|
|
1555
1541
|
}
|
|
1542
|
+
.p-0\.5 {
|
|
1543
|
+
padding: 0.125rem;
|
|
1544
|
+
}
|
|
1556
1545
|
.p-1 {
|
|
1557
1546
|
padding: 0.25rem;
|
|
1558
1547
|
}
|