@sikka/hawa 0.1.25 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -109,6 +109,7 @@
109
109
  "@radix-ui/react-dropdown-menu": "^2.0.5",
110
110
  "@radix-ui/react-label": "^2.0.2",
111
111
  "@radix-ui/react-popover": "^1.0.6",
112
+ "@radix-ui/react-tabs": "^1.0.4",
112
113
  "@radix-ui/react-tooltip": "^1.0.6",
113
114
  "class-variance-authority": "^0.7.0",
114
115
  "clsx": "^1.2.1",
@@ -1,5 +1,5 @@
1
1
  import React, { useState, FC } from "react"
2
- import { HawaTabs } from "../../elements"
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("SAR")
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
- <HawaTabs
75
- pill
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
- <HawaTabs
84
- pill
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, HawaTabs } from "../../elements"
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
- <HawaTabs
50
- pill
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
- <HawaTabs
56
- pill
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 clsx from "clsx"
2
+ import { cn } from "../util"
3
3
 
4
4
  // TODO: fix wrapping issue when small screen
5
5
 
@@ -62,13 +62,14 @@ export const HawaTabs: FC<TabsTypes> = ({
62
62
  return (
63
63
  <div
64
64
  dir={direction}
65
- className={clsx(
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={clsx(
71
+ className={cn(
72
+ "w-full border-primary",
72
73
  marginBetween
73
74
  ? orientation === "vertical"
74
75
  ? "mb-0"
@@ -78,8 +79,9 @@ export const HawaTabs: FC<TabsTypes> = ({
78
79
  ? "ml-" + marginBetween
79
80
  : "mr-" + marginBetween,
80
81
  tabsStyle[orientation],
81
- "border-primary",
82
-
82
+ orientation === "horizontal"
83
+ ? "grid grid-cols-3 gap-1 sm:flex sm:flex-row sm:gap-0 "
84
+ : "",
83
85
  // orientation === "vertical"
84
86
  // ? direction === "rtl"
85
87
  // ? "rounded-none rounded-r border-l-2"
@@ -92,39 +94,37 @@ export const HawaTabs: FC<TabsTypes> = ({
92
94
  ? direction === "rtl"
93
95
  ? "rounded-none rounded-r border-l-2"
94
96
  : "rounded-none rounded-l border-r-2"
95
- : "border-b-2"
97
+ : "border-b-0 sm:border-b-2"
96
98
  )}
97
99
  >
98
100
  {props.options?.map((opt: any, o) => (
99
- <li key={o}>
100
- <button
101
- aria-current="page"
102
- onClick={() => {
103
- setSelectedOption(opt.value)
104
- props?.onChangeTab(opt)
105
- }}
106
- className={clsx(
107
- "flex flex-row items-center gap-2",
108
- opt.value === selectedOption
109
- ? // props.options[selectedOption].value === opt.value
110
- [
111
- activeTabStyle[orientation],
112
- direction === "rtl" ? "rounded-r" : "rounded-l",
113
- ]
114
- : inactiveTabStyle[orientation],
115
- "w-full transition-all",
116
- pill
117
- ? "rounded"
118
- : orientation === "vertical"
119
- ? "rounded rounded-bl-none rounded-tl-none"
120
- : "rounded rounded-bl-none rounded-br-none"
121
- // direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
122
- )}
123
- >
124
- {opt.icon}
125
- {opt.label}
126
- </button>
127
- </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>
128
128
  ))}
129
129
  </ul>
130
130
 
@@ -132,7 +132,7 @@ export const HawaTabs: FC<TabsTypes> = ({
132
132
  {props.options.map((tab, i) => (
133
133
  <div
134
134
  key={i}
135
- className={clsx(selectedOption === tab.value ? "" : "hidden")}
135
+ className={cn(selectedOption === tab.value ? "" : "hidden")}
136
136
  >
137
137
  {tab.content}
138
138
  </div>
@@ -0,0 +1,97 @@
1
+ import * as React from "react"
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs"
3
+
4
+ import { cn } from "../util"
5
+
6
+ const TabsContext = React.createContext<{
7
+ orientation?: "vertical" | "horizontal"
8
+ }>({
9
+ orientation: "vertical", // default value
10
+ })
11
+
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
24
+ ref={ref}
25
+ className={cn(
26
+ className,
27
+ "flex gap-2",
28
+ orientation === "horizontal" ? "flex-row" : "flex-col"
29
+ )}
30
+ {...props}
31
+ >
32
+ <TabsContext.Provider value={{ orientation }}>
33
+ {props.children}
34
+ </TabsContext.Provider>
35
+ </TabsPrimitive.Root>
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
+ })
63
+ TabsList.displayName = TabsPrimitive.List.displayName
64
+
65
+ const TabsTrigger = React.forwardRef<
66
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
67
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
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
+ })
80
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
81
+
82
+ const TabsContent = React.forwardRef<
83
+ React.ElementRef<typeof TabsPrimitive.Content>,
84
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
85
+ >(({ className, ...props }, ref) => (
86
+ <TabsPrimitive.Content
87
+ ref={ref}
88
+ className={cn(
89
+ "w-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
90
+ className
91
+ )}
92
+ {...props}
93
+ />
94
+ ))
95
+ TabsContent.displayName = TabsPrimitive.Content.displayName
96
+
97
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -64,3 +64,4 @@ export * from "./Skeleton"
64
64
  export * from "./InterfaceSettings"
65
65
  export * from "./DropdownMenu"
66
66
  export * from "./Popover"
67
+ export * from "./Tabs"
@@ -156,7 +156,7 @@ const SidebarItem: React.FC<{
156
156
  const getSelectedStyle = (value: string, index: number) => {
157
157
  return isSelected && isSelected[index] === value
158
158
  ? "bg-primary text-primary-foreground cursor-default"
159
- : "hover:bg-primary/30"
159
+ : "hover:bg-primary/10"
160
160
  }
161
161
  if (item.subitems) {
162
162
  return (
package/src/styles.css CHANGED
@@ -1464,6 +1464,9 @@ video {
1464
1464
  .grid-cols-2 {
1465
1465
  grid-template-columns: repeat(2, minmax(0, 1fr));
1466
1466
  }
1467
+ .grid-cols-3 {
1468
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1469
+ }
1467
1470
  .grid-cols-4 {
1468
1471
  grid-template-columns: repeat(4, minmax(0, 1fr));
1469
1472
  }
@@ -2990,9 +2993,6 @@ body {
2990
2993
  .hover\:bg-primary\/20:hover {
2991
2994
  background-color: hsl(var(--primary) / 0.2);
2992
2995
  }
2993
- .hover\:bg-primary\/30:hover {
2994
- background-color: hsl(var(--primary) / 0.3);
2995
- }
2996
2996
  .hover\:bg-primary\/40:hover {
2997
2997
  background-color: hsl(var(--primary) / 0.4);
2998
2998
  }
@@ -3315,6 +3315,9 @@ body {
3315
3315
  --tw-bg-opacity: 1;
3316
3316
  background-color: hsl(252 56.0% 57.5% / var(--tw-bg-opacity));
3317
3317
  }
3318
+ .data-\[state\=active\]\:bg-primary[data-state=active] {
3319
+ background-color: hsl(var(--primary));
3320
+ }
3318
3321
  .data-\[state\=open\]\:bg-accent[data-state=open] {
3319
3322
  background-color: hsl(var(--accent));
3320
3323
  }
@@ -3334,6 +3337,9 @@ body {
3334
3337
  --tw-text-opacity: 1;
3335
3338
  color: hsl(255 65.0% 99.4% / var(--tw-text-opacity));
3336
3339
  }
3340
+ .data-\[state\=active\]\:text-primary-foreground[data-state=active] {
3341
+ color: hsl(var(--primary-foreground));
3342
+ }
3337
3343
  .data-\[state\=open\]\:text-violet-11[data-state=open] {
3338
3344
  --tw-text-opacity: 1;
3339
3345
  color: hsl(250 43.0% 48.0% / var(--tw-text-opacity));
@@ -3341,6 +3347,11 @@ body {
3341
3347
  .data-\[disabled\]\:opacity-50[data-disabled] {
3342
3348
  opacity: 0.5;
3343
3349
  }
3350
+ .data-\[state\=active\]\:shadow-sm[data-state=active] {
3351
+ --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
3352
+ --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
3353
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3354
+ }
3344
3355
  .data-\[state\=open\]\:animate-in[data-state=open] {
3345
3356
  animation-name: enter;
3346
3357
  animation-duration: 150ms;
@@ -3683,15 +3694,36 @@ body {
3683
3694
  }
3684
3695
  @media (min-width: 640px) {
3685
3696
 
3697
+ .sm\:flex {
3698
+ display: flex;
3699
+ }
3700
+
3686
3701
  .sm\:columns-2 {
3687
3702
  -moz-columns: 2;
3688
3703
  columns: 2;
3689
3704
  }
3690
3705
 
3706
+ .sm\:flex-row {
3707
+ flex-direction: row;
3708
+ }
3709
+
3710
+ .sm\:gap-0 {
3711
+ gap: 0px;
3712
+ }
3713
+
3691
3714
  .sm\:gap-8 {
3692
3715
  gap: 2rem;
3693
3716
  }
3694
3717
 
3718
+ .sm\:rounded-b-none {
3719
+ border-bottom-right-radius: 0px;
3720
+ border-bottom-left-radius: 0px;
3721
+ }
3722
+
3723
+ .sm\:border-b-2 {
3724
+ border-bottom-width: 2px;
3725
+ }
3726
+
3695
3727
  .sm\:p-20 {
3696
3728
  padding: 5rem;
3697
3729
  }