@sikka/hawa 0.1.26 → 0.1.27
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/es/elements/Tabs.d.ts +3 -1
- package/es/index.es.js +2 -2
- package/lib/elements/Tabs.d.ts +3 -1
- package/lib/index.js +2 -2
- package/package.json +1 -1
- package/src/blocks/Pricing/ComparingPlans.tsx +8 -14
- package/src/blocks/Pricing/PricingPlans.tsx +5 -5
- package/src/elements/HawaTabs.tsx +31 -33
- package/src/elements/Tabs.tsx +64 -20
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, FC } from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { HawaRadio } from "../../elements"
|
|
3
3
|
import { Tooltip } from "../../elements/Tooltip"
|
|
4
4
|
|
|
5
5
|
const CheckMark = () => (
|
|
@@ -65,29 +65,23 @@ type ComparingPlansTypes = {
|
|
|
65
65
|
direction?: "rtl" | "ltr"
|
|
66
66
|
}
|
|
67
67
|
export const ComparingPlans: FC<ComparingPlansTypes> = (props) => {
|
|
68
|
-
const [currentCurrency, setCurrentCurrency] = useState("
|
|
68
|
+
const [currentCurrency, setCurrentCurrency] = useState("sar")
|
|
69
69
|
const [currentCycle, setCurrentCycle] = useState("month")
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<div id="detailed-pricing" className="w-full overflow-x-auto">
|
|
73
73
|
<div className="mb-2 flex w-full justify-between">
|
|
74
|
-
<
|
|
75
|
-
|
|
74
|
+
<HawaRadio
|
|
75
|
+
design="tabs"
|
|
76
76
|
defaultValue={currentCycle}
|
|
77
77
|
options={props.billingCycles}
|
|
78
|
-
onChangeTab={(e: any) =>
|
|
79
|
-
// setCurrentCycle(e.label)
|
|
80
|
-
props.onCycleChange(e)
|
|
81
|
-
}}
|
|
78
|
+
onChangeTab={(e: any) => props.onCycleChange(e)}
|
|
82
79
|
/>
|
|
83
|
-
<
|
|
84
|
-
|
|
80
|
+
<HawaRadio
|
|
81
|
+
design="tabs"
|
|
85
82
|
defaultValue={currentCurrency}
|
|
86
83
|
options={props.currencies}
|
|
87
|
-
onChangeTab={(e: any) =>
|
|
88
|
-
// setCurrentCurrency(e.label)
|
|
89
|
-
props.onCurrencyChange(e)
|
|
90
|
-
}}
|
|
84
|
+
onChangeTab={(e: any) => props.onCurrencyChange(e)}
|
|
91
85
|
/>
|
|
92
86
|
</div>
|
|
93
87
|
<div className=" overflow-hidden rounded">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC } from "react"
|
|
2
|
-
import { HawaPricingCard,
|
|
2
|
+
import { HawaPricingCard, HawaRadio } from "../../elements"
|
|
3
3
|
|
|
4
4
|
type PricingPlansTypes = {
|
|
5
5
|
plans: [
|
|
@@ -46,14 +46,14 @@ export const PricingPlans: FC<PricingPlansTypes> = (props) => {
|
|
|
46
46
|
return (
|
|
47
47
|
<div>
|
|
48
48
|
<div className="mb-2 flex w-full justify-between">
|
|
49
|
-
<
|
|
50
|
-
|
|
49
|
+
<HawaRadio
|
|
50
|
+
design="tabs"
|
|
51
51
|
defaultValue={props.currentCycle}
|
|
52
52
|
options={props.billingCycles}
|
|
53
53
|
onChangeTab={(e: any) => props.onCycleChange(e)}
|
|
54
54
|
/>
|
|
55
|
-
<
|
|
56
|
-
|
|
55
|
+
<HawaRadio
|
|
56
|
+
design="tabs"
|
|
57
57
|
defaultValue={props.currentCurrency}
|
|
58
58
|
options={props.currencies}
|
|
59
59
|
onChangeTab={(e: any) => props.onCurrencyChange(e)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, FC } from "react"
|
|
2
|
-
import
|
|
2
|
+
import { cn } from "../util"
|
|
3
3
|
|
|
4
4
|
// TODO: fix wrapping issue when small screen
|
|
5
5
|
|
|
@@ -62,13 +62,13 @@ export const HawaTabs: FC<TabsTypes> = ({
|
|
|
62
62
|
return (
|
|
63
63
|
<div
|
|
64
64
|
dir={direction}
|
|
65
|
-
className={
|
|
65
|
+
className={cn(
|
|
66
66
|
containerStyle[orientation],
|
|
67
67
|
props.options[selectedOption] ? "border-b-2" : "border-b-0"
|
|
68
68
|
)}
|
|
69
69
|
>
|
|
70
70
|
<ul
|
|
71
|
-
className={
|
|
71
|
+
className={cn(
|
|
72
72
|
"w-full border-primary",
|
|
73
73
|
marginBetween
|
|
74
74
|
? orientation === "vertical"
|
|
@@ -98,35 +98,33 @@ export const HawaTabs: FC<TabsTypes> = ({
|
|
|
98
98
|
)}
|
|
99
99
|
>
|
|
100
100
|
{props.options?.map((opt: any, o) => (
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
[
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</button>
|
|
129
|
-
</li>
|
|
101
|
+
<button
|
|
102
|
+
key={o}
|
|
103
|
+
aria-current="page"
|
|
104
|
+
onClick={() => {
|
|
105
|
+
setSelectedOption(opt.value)
|
|
106
|
+
props?.onChangeTab(opt)
|
|
107
|
+
}}
|
|
108
|
+
className={cn(
|
|
109
|
+
opt.value === selectedOption
|
|
110
|
+
? // props.options[selectedOption].value === opt.value
|
|
111
|
+
[
|
|
112
|
+
activeTabStyle[orientation],
|
|
113
|
+
direction === "rtl" ? "rounded-r" : "rounded-l",
|
|
114
|
+
]
|
|
115
|
+
: inactiveTabStyle[orientation],
|
|
116
|
+
pill
|
|
117
|
+
? "rounded"
|
|
118
|
+
: orientation === "vertical"
|
|
119
|
+
? "rounded rounded-bl-none rounded-tl-none"
|
|
120
|
+
: "rounded sm:rounded-b-none",
|
|
121
|
+
// direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
|
|
122
|
+
"flex w-fit flex-row items-center gap-2 transition-all "
|
|
123
|
+
)}
|
|
124
|
+
>
|
|
125
|
+
{opt.icon}
|
|
126
|
+
{opt.label}
|
|
127
|
+
</button>
|
|
130
128
|
))}
|
|
131
129
|
</ul>
|
|
132
130
|
|
|
@@ -134,7 +132,7 @@ export const HawaTabs: FC<TabsTypes> = ({
|
|
|
134
132
|
{props.options.map((tab, i) => (
|
|
135
133
|
<div
|
|
136
134
|
key={i}
|
|
137
|
-
className={
|
|
135
|
+
className={cn(selectedOption === tab.value ? "" : "hidden")}
|
|
138
136
|
>
|
|
139
137
|
{tab.content}
|
|
140
138
|
</div>
|
package/src/elements/Tabs.tsx
CHANGED
|
@@ -3,36 +3,80 @@ import * as TabsPrimitive from "@radix-ui/react-tabs"
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "../util"
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const TabsContext = React.createContext<{
|
|
7
|
+
orientation?: "vertical" | "horizontal"
|
|
8
|
+
}>({
|
|
9
|
+
orientation: "vertical", // default value
|
|
10
|
+
})
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
|
|
12
|
+
// const Tabs = TabsPrimitive.Root
|
|
13
|
+
type TabsRootProps = React.ComponentPropsWithoutRef<
|
|
14
|
+
typeof TabsPrimitive.Root
|
|
15
|
+
> & {
|
|
16
|
+
orientation?: "vertical" | "horizontal"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Tabs = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof TabsPrimitive.Root>,
|
|
21
|
+
TabsRootProps
|
|
22
|
+
>(({ className, orientation, ...props }, ref) => (
|
|
23
|
+
<TabsPrimitive.Root
|
|
13
24
|
ref={ref}
|
|
14
25
|
className={cn(
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
className,
|
|
27
|
+
"flex gap-2",
|
|
28
|
+
orientation === "horizontal" ? "flex-row" : "flex-col"
|
|
17
29
|
)}
|
|
18
30
|
{...props}
|
|
19
|
-
|
|
31
|
+
>
|
|
32
|
+
<TabsContext.Provider value={{ orientation }}>
|
|
33
|
+
{props.children}
|
|
34
|
+
</TabsContext.Provider>
|
|
35
|
+
</TabsPrimitive.Root>
|
|
20
36
|
))
|
|
37
|
+
Tabs.displayName = TabsPrimitive.Root.displayName
|
|
38
|
+
|
|
39
|
+
// type TabsListProps = React.ComponentPropsWithoutRef<
|
|
40
|
+
// typeof TabsPrimitive.List
|
|
41
|
+
// > & {
|
|
42
|
+
// // orientation?: "vertical" | "horizontal"
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
const TabsList = React.forwardRef<
|
|
46
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
47
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
48
|
+
>(({ className, ...props }, ref) => {
|
|
49
|
+
const { orientation } = React.useContext(TabsContext)
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<TabsPrimitive.List
|
|
53
|
+
ref={ref}
|
|
54
|
+
className={cn(
|
|
55
|
+
"flex w-fit flex-wrap items-center justify-start gap-1 rounded bg-muted p-1 text-muted-foreground ",
|
|
56
|
+
orientation === "horizontal" ? "flex-col" : "flex-row",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
})
|
|
21
63
|
TabsList.displayName = TabsPrimitive.List.displayName
|
|
22
64
|
|
|
23
65
|
const TabsTrigger = React.forwardRef<
|
|
24
66
|
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
25
67
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
-
>(({ className, ...props }, ref) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
>(({ className, ...props }, ref) => {
|
|
69
|
+
return (
|
|
70
|
+
<TabsPrimitive.Trigger
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={cn(
|
|
73
|
+
"inline-flex w-full flex-1 select-none items-center justify-center whitespace-nowrap rounded border px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm ",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
})
|
|
36
80
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
|
37
81
|
|
|
38
82
|
const TabsContent = React.forwardRef<
|
|
@@ -42,7 +86,7 @@ const TabsContent = React.forwardRef<
|
|
|
42
86
|
<TabsPrimitive.Content
|
|
43
87
|
ref={ref}
|
|
44
88
|
className={cn(
|
|
45
|
-
"
|
|
89
|
+
"w-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
46
90
|
className
|
|
47
91
|
)}
|
|
48
92
|
{...props}
|