@sikka/hawa 0.1.22 → 0.1.24
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/index.es.js +1 -1
- package/es/layout/Sidebar.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/layout/Sidebar.d.ts +2 -0
- package/package.json +1 -1
- package/src/layout/AppLayout.tsx +2 -1
- package/src/layout/Sidebar.tsx +21 -4
package/lib/layout/Sidebar.d.ts
CHANGED
|
@@ -21,11 +21,13 @@ interface SidebarGroupProps {
|
|
|
21
21
|
isOpen?: boolean;
|
|
22
22
|
onItemClick?: (value: string[]) => void;
|
|
23
23
|
onSubItemClick?: (values: string[]) => void;
|
|
24
|
+
direction?: "rtl" | "ltr";
|
|
24
25
|
}
|
|
25
26
|
declare const SidebarGroup: React.FC<SidebarGroupProps>;
|
|
26
27
|
declare const SidebarItem: React.FC<{
|
|
27
28
|
item: Item;
|
|
28
29
|
isSelected: any;
|
|
30
|
+
direction?: "rtl" | "ltr";
|
|
29
31
|
onItemClick?: (value: string[]) => void;
|
|
30
32
|
onSubItemClick?: (values: string[]) => void;
|
|
31
33
|
isOpen?: boolean;
|
package/package.json
CHANGED
package/src/layout/AppLayout.tsx
CHANGED
|
@@ -56,7 +56,7 @@ type ProfileItem = {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
59
|
-
direction = "
|
|
59
|
+
direction = "ltr",
|
|
60
60
|
drawerSize = "md",
|
|
61
61
|
onSettingsClick,
|
|
62
62
|
DrawerFooterActions,
|
|
@@ -327,6 +327,7 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
327
327
|
*/}
|
|
328
328
|
|
|
329
329
|
<SidebarGroup
|
|
330
|
+
direction={direction}
|
|
330
331
|
onItemClick={(values) => {
|
|
331
332
|
setSelectedItem(values)
|
|
332
333
|
clickedItem(values)
|
package/src/layout/Sidebar.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { Button } from "../elements"
|
|
|
7
7
|
const Accordion = AccordionPrimitive.Root
|
|
8
8
|
|
|
9
9
|
let triggerStyles =
|
|
10
|
-
"flex flex-1 items-center cursor-pointer bg-primary-foreground rounded justify-between p-2 px-3 font-medium transition-all [&[data-state=open]>svg]:-rotate-90"
|
|
10
|
+
"flex flex-1 items-center select-none cursor-pointer bg-primary-foreground rounded justify-between p-2 px-3 font-medium transition-all [&[data-state=open]>svg]:-rotate-90"
|
|
11
11
|
const AccordionItem = React.forwardRef<
|
|
12
12
|
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
13
13
|
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
@@ -94,6 +94,7 @@ interface SidebarGroupProps {
|
|
|
94
94
|
isOpen?: boolean
|
|
95
95
|
onItemClick?: (value: string[]) => void
|
|
96
96
|
onSubItemClick?: (values: string[]) => void
|
|
97
|
+
direction?: "rtl" | "ltr"
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
const SidebarGroup: React.FC<SidebarGroupProps> = ({
|
|
@@ -104,6 +105,7 @@ const SidebarGroup: React.FC<SidebarGroupProps> = ({
|
|
|
104
105
|
setOpenedItem,
|
|
105
106
|
onItemClick,
|
|
106
107
|
onSubItemClick,
|
|
108
|
+
direction,
|
|
107
109
|
isOpen,
|
|
108
110
|
}) => {
|
|
109
111
|
return (
|
|
@@ -124,6 +126,7 @@ const SidebarGroup: React.FC<SidebarGroupProps> = ({
|
|
|
124
126
|
isOpen={isOpen}
|
|
125
127
|
isSelected={selectedItem}
|
|
126
128
|
key={idx}
|
|
129
|
+
direction={direction}
|
|
127
130
|
item={item}
|
|
128
131
|
onItemClick={onItemClick}
|
|
129
132
|
onSubItemClick={onSubItemClick}
|
|
@@ -137,10 +140,19 @@ const SidebarGroup: React.FC<SidebarGroupProps> = ({
|
|
|
137
140
|
const SidebarItem: React.FC<{
|
|
138
141
|
item: Item
|
|
139
142
|
isSelected: any
|
|
143
|
+
direction?: "rtl" | "ltr"
|
|
144
|
+
|
|
140
145
|
onItemClick?: (value: string[]) => void
|
|
141
146
|
onSubItemClick?: (values: string[]) => void
|
|
142
147
|
isOpen?: boolean
|
|
143
|
-
}> = ({
|
|
148
|
+
}> = ({
|
|
149
|
+
item,
|
|
150
|
+
isSelected,
|
|
151
|
+
onItemClick,
|
|
152
|
+
onSubItemClick,
|
|
153
|
+
direction,
|
|
154
|
+
isOpen = true,
|
|
155
|
+
}) => {
|
|
144
156
|
const getSelectedStyle = (value: string, index: number) => {
|
|
145
157
|
return isSelected && isSelected[index] === value
|
|
146
158
|
? "bg-primary text-primary-foreground cursor-default"
|
|
@@ -148,7 +160,11 @@ const SidebarItem: React.FC<{
|
|
|
148
160
|
}
|
|
149
161
|
if (item.subitems) {
|
|
150
162
|
return (
|
|
151
|
-
<AccordionItem
|
|
163
|
+
<AccordionItem
|
|
164
|
+
value={item.value}
|
|
165
|
+
className="overflow-x-clip"
|
|
166
|
+
dir={direction}
|
|
167
|
+
>
|
|
152
168
|
<AccordionTrigger
|
|
153
169
|
className={cn(getSelectedStyle(item.value, 0))}
|
|
154
170
|
showArrow={isOpen}
|
|
@@ -203,6 +219,7 @@ const SidebarItem: React.FC<{
|
|
|
203
219
|
} else {
|
|
204
220
|
return (
|
|
205
221
|
<div
|
|
222
|
+
dir={direction}
|
|
206
223
|
onClick={() => {
|
|
207
224
|
if (onItemClick) {
|
|
208
225
|
onItemClick([item.value])
|
|
@@ -218,7 +235,7 @@ const SidebarItem: React.FC<{
|
|
|
218
235
|
{item.icon}
|
|
219
236
|
<span
|
|
220
237
|
className={cn(
|
|
221
|
-
"transition-all",
|
|
238
|
+
"whitespace-nowrap transition-all",
|
|
222
239
|
isOpen ? "opacity-100" : "opacity-0"
|
|
223
240
|
)}
|
|
224
241
|
>
|