@sikka/hawa 0.1.99 → 0.1.100
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/layout/AppLayout.tsx +4 -6
- package/src/layout/Sidebar.tsx +20 -9
package/dist/index.d.mts
CHANGED
|
@@ -1110,7 +1110,7 @@ interface SidebarGroupProps {
|
|
|
1110
1110
|
declare const SidebarGroup: React$1.FC<SidebarGroupProps>;
|
|
1111
1111
|
declare const SidebarItem: React$1.FC<{
|
|
1112
1112
|
item: Item;
|
|
1113
|
-
|
|
1113
|
+
selectedItem?: any;
|
|
1114
1114
|
direction?: "rtl" | "ltr";
|
|
1115
1115
|
onItemClick?: (value: string[]) => void;
|
|
1116
1116
|
onSubItemClick?: (values: string[]) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1110,7 +1110,7 @@ interface SidebarGroupProps {
|
|
|
1110
1110
|
declare const SidebarGroup: React$1.FC<SidebarGroupProps>;
|
|
1111
1111
|
declare const SidebarItem: React$1.FC<{
|
|
1112
1112
|
item: Item;
|
|
1113
|
-
|
|
1113
|
+
selectedItem?: any;
|
|
1114
1114
|
direction?: "rtl" | "ltr";
|
|
1115
1115
|
onItemClick?: (value: string[]) => void;
|
|
1116
1116
|
onSubItemClick?: (values: string[]) => void;
|
package/dist/index.js
CHANGED
|
@@ -7480,6 +7480,7 @@ var AccordionContent = React75.forwardRef(function(_param, ref) /* @__PURE__ */
|
|
|
7480
7480
|
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
7481
7481
|
var SidebarGroup = function(param) {
|
|
7482
7482
|
var title = param.title, items = param.items, selectedItem = param.selectedItem, openedItem = param.openedItem, setOpenedItem = param.setOpenedItem, onItemClick = param.onItemClick, onSubItemClick = param.onSubItemClick, direction = param.direction, isOpen = param.isOpen;
|
|
7483
|
+
console.log("selected item is ", selectedItem);
|
|
7483
7484
|
return /* @__PURE__ */ React75.createElement("div", null, title && /* @__PURE__ */ React75.createElement("h3", {
|
|
7484
7485
|
className: "mb-1 font-bold"
|
|
7485
7486
|
}, title), /* @__PURE__ */ React75.createElement("ul", {
|
|
@@ -7495,7 +7496,7 @@ var SidebarGroup = function(param) {
|
|
|
7495
7496
|
}, items.map(function(item, idx) {
|
|
7496
7497
|
return /* @__PURE__ */ React75.createElement(SidebarItem, {
|
|
7497
7498
|
isOpen: isOpen,
|
|
7498
|
-
|
|
7499
|
+
selectedItem: selectedItem,
|
|
7499
7500
|
key: idx,
|
|
7500
7501
|
direction: direction,
|
|
7501
7502
|
item: item,
|
|
@@ -7504,10 +7505,16 @@ var SidebarGroup = function(param) {
|
|
|
7504
7505
|
});
|
|
7505
7506
|
}))));
|
|
7506
7507
|
};
|
|
7507
|
-
var SidebarItem = function(
|
|
7508
|
-
var item =
|
|
7509
|
-
|
|
7510
|
-
|
|
7508
|
+
var SidebarItem = function(_param) {
|
|
7509
|
+
var item = _param.item, onItemClick = _param.onItemClick, onSubItemClick = _param.onSubItemClick, direction = _param.direction, _param_isOpen = _param.isOpen, isOpen = _param_isOpen === void 0 ? true : _param_isOpen, props = _object_without_properties(_param, [
|
|
7510
|
+
"item",
|
|
7511
|
+
"onItemClick",
|
|
7512
|
+
"onSubItemClick",
|
|
7513
|
+
"direction",
|
|
7514
|
+
"isOpen"
|
|
7515
|
+
]);
|
|
7516
|
+
var getSelectedStyle = function(value) {
|
|
7517
|
+
return props.selectedItem === value ? "bg-primary text-primary-foreground cursor-default" : "hover:bg-primary/10";
|
|
7511
7518
|
};
|
|
7512
7519
|
if (item.subitems) {
|
|
7513
7520
|
return /* @__PURE__ */ React75.createElement(AccordionItem, {
|
|
@@ -7515,7 +7522,9 @@ var SidebarItem = function(param) {
|
|
|
7515
7522
|
className: "overflow-x-clip",
|
|
7516
7523
|
dir: direction
|
|
7517
7524
|
}, /* @__PURE__ */ React75.createElement(AccordionTrigger, {
|
|
7518
|
-
className: cn(
|
|
7525
|
+
className: cn("overflow-x-clip", props.selectedItem === item.value ? "cursor-default bg-primary text-primary-foreground" : "hover:bg-primary/10", item.subitems && item.subitems.some(function(subitem) {
|
|
7526
|
+
return props.selectedItem === subitem.value;
|
|
7527
|
+
}) ? "bg-primary text-primary-foreground hover:bg-primary" : ""),
|
|
7519
7528
|
showArrow: isOpen
|
|
7520
7529
|
}, /* @__PURE__ */ React75.createElement("div", {
|
|
7521
7530
|
className: cn(!isOpen && "py-1", "flex w-fit flex-row items-center gap-2")
|
|
@@ -7538,7 +7547,7 @@ var SidebarItem = function(param) {
|
|
|
7538
7547
|
]);
|
|
7539
7548
|
}
|
|
7540
7549
|
},
|
|
7541
|
-
className: cn("flex h-full cursor-pointer flex-row items-center gap-2 rounded bg-foreground/10 p-2 transition-all", getSelectedStyle(subitem.value
|
|
7550
|
+
className: cn("flex h-full cursor-pointer flex-row items-center gap-2 rounded bg-foreground/10 p-2 transition-all", getSelectedStyle(subitem.value))
|
|
7542
7551
|
}, subitem.icon, subitem.label);
|
|
7543
7552
|
}))));
|
|
7544
7553
|
} else {
|
|
@@ -7552,7 +7561,7 @@ var SidebarItem = function(param) {
|
|
|
7552
7561
|
]);
|
|
7553
7562
|
}
|
|
7554
7563
|
},
|
|
7555
|
-
className: cn(triggerStyles, getSelectedStyle(item.value
|
|
7564
|
+
className: cn(triggerStyles, getSelectedStyle(item.value), "overflow-x-clip ")
|
|
7556
7565
|
}, /* @__PURE__ */ React75.createElement("div", {
|
|
7557
7566
|
className: "flex flex-row items-center gap-2 "
|
|
7558
7567
|
}, item.icon, /* @__PURE__ */ React75.createElement("span", {
|
|
@@ -7588,7 +7597,7 @@ var AppLayout = function(_param) {
|
|
|
7588
7597
|
var ref = _react.useRef.call(void 0, null);
|
|
7589
7598
|
var isRTL = direction === "rtl";
|
|
7590
7599
|
var _react_useState_call = _sliced_to_array(_react.useState.call(void 0, ""), 2), openedSidebarItem = _react_useState_call[0], setOpenedSidebarItem = _react_useState_call[1];
|
|
7591
|
-
var _react_useState_call1 = _sliced_to_array(_react.useState.call(void 0, currentPage
|
|
7600
|
+
var _react_useState_call1 = _sliced_to_array(_react.useState.call(void 0, currentPage), 2), selectedItem = _react_useState_call1[0], setSelectedItem = _react_useState_call1[1];
|
|
7592
7601
|
var size;
|
|
7593
7602
|
if (typeof window !== "undefined") {
|
|
7594
7603
|
size = useBreakpoint_default();
|
|
@@ -7723,14 +7732,11 @@ var AppLayout = function(_param) {
|
|
|
7723
7732
|
}, /* @__PURE__ */ React6.default.createElement(SidebarGroup, {
|
|
7724
7733
|
direction: direction,
|
|
7725
7734
|
onItemClick: function(values) {
|
|
7726
|
-
console.log("vals ", values);
|
|
7727
|
-
setSelectedItem(values);
|
|
7728
7735
|
if (clickedItem) {
|
|
7729
7736
|
clickedItem(values);
|
|
7730
7737
|
}
|
|
7731
7738
|
},
|
|
7732
7739
|
onSubItemClick: function(values) {
|
|
7733
|
-
setSelectedItem(values);
|
|
7734
7740
|
if (clickedItem) {
|
|
7735
7741
|
clickedItem(values);
|
|
7736
7742
|
}
|