@sikka/hawa 0.1.99 → 0.1.101
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 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/layout/AppLayout.tsx +5 -7
- 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
|
@@ -7495,7 +7495,7 @@ var SidebarGroup = function(param) {
|
|
|
7495
7495
|
}, items.map(function(item, idx) {
|
|
7496
7496
|
return /* @__PURE__ */ React75.createElement(SidebarItem, {
|
|
7497
7497
|
isOpen: isOpen,
|
|
7498
|
-
|
|
7498
|
+
selectedItem: selectedItem,
|
|
7499
7499
|
key: idx,
|
|
7500
7500
|
direction: direction,
|
|
7501
7501
|
item: item,
|
|
@@ -7504,10 +7504,16 @@ var SidebarGroup = function(param) {
|
|
|
7504
7504
|
});
|
|
7505
7505
|
}))));
|
|
7506
7506
|
};
|
|
7507
|
-
var SidebarItem = function(
|
|
7508
|
-
var item =
|
|
7509
|
-
|
|
7510
|
-
|
|
7507
|
+
var SidebarItem = function(_param) {
|
|
7508
|
+
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, [
|
|
7509
|
+
"item",
|
|
7510
|
+
"onItemClick",
|
|
7511
|
+
"onSubItemClick",
|
|
7512
|
+
"direction",
|
|
7513
|
+
"isOpen"
|
|
7514
|
+
]);
|
|
7515
|
+
var getSelectedStyle = function(value) {
|
|
7516
|
+
return props.selectedItem === value ? "bg-primary text-primary-foreground cursor-default" : "hover:bg-primary/10";
|
|
7511
7517
|
};
|
|
7512
7518
|
if (item.subitems) {
|
|
7513
7519
|
return /* @__PURE__ */ React75.createElement(AccordionItem, {
|
|
@@ -7515,7 +7521,9 @@ var SidebarItem = function(param) {
|
|
|
7515
7521
|
className: "overflow-x-clip",
|
|
7516
7522
|
dir: direction
|
|
7517
7523
|
}, /* @__PURE__ */ React75.createElement(AccordionTrigger, {
|
|
7518
|
-
className: cn(
|
|
7524
|
+
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) {
|
|
7525
|
+
return props.selectedItem === subitem.value;
|
|
7526
|
+
}) ? "bg-primary text-primary-foreground hover:bg-primary" : ""),
|
|
7519
7527
|
showArrow: isOpen
|
|
7520
7528
|
}, /* @__PURE__ */ React75.createElement("div", {
|
|
7521
7529
|
className: cn(!isOpen && "py-1", "flex w-fit flex-row items-center gap-2")
|
|
@@ -7538,7 +7546,7 @@ var SidebarItem = function(param) {
|
|
|
7538
7546
|
]);
|
|
7539
7547
|
}
|
|
7540
7548
|
},
|
|
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
|
|
7549
|
+
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
7550
|
}, subitem.icon, subitem.label);
|
|
7543
7551
|
}))));
|
|
7544
7552
|
} else {
|
|
@@ -7552,7 +7560,7 @@ var SidebarItem = function(param) {
|
|
|
7552
7560
|
]);
|
|
7553
7561
|
}
|
|
7554
7562
|
},
|
|
7555
|
-
className: cn(triggerStyles, getSelectedStyle(item.value
|
|
7563
|
+
className: cn(triggerStyles, getSelectedStyle(item.value), "overflow-x-clip ")
|
|
7556
7564
|
}, /* @__PURE__ */ React75.createElement("div", {
|
|
7557
7565
|
className: "flex flex-row items-center gap-2 "
|
|
7558
7566
|
}, item.icon, /* @__PURE__ */ React75.createElement("span", {
|
|
@@ -7588,7 +7596,7 @@ var AppLayout = function(_param) {
|
|
|
7588
7596
|
var ref = _react.useRef.call(void 0, null);
|
|
7589
7597
|
var isRTL = direction === "rtl";
|
|
7590
7598
|
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
|
|
7599
|
+
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
7600
|
var size;
|
|
7593
7601
|
if (typeof window !== "undefined") {
|
|
7594
7602
|
size = useBreakpoint_default();
|
|
@@ -7723,19 +7731,16 @@ var AppLayout = function(_param) {
|
|
|
7723
7731
|
}, /* @__PURE__ */ React6.default.createElement(SidebarGroup, {
|
|
7724
7732
|
direction: direction,
|
|
7725
7733
|
onItemClick: function(values) {
|
|
7726
|
-
console.log("vals ", values);
|
|
7727
|
-
setSelectedItem(values);
|
|
7728
7734
|
if (clickedItem) {
|
|
7729
7735
|
clickedItem(values);
|
|
7730
7736
|
}
|
|
7731
7737
|
},
|
|
7732
7738
|
onSubItemClick: function(values) {
|
|
7733
|
-
setSelectedItem(values);
|
|
7734
7739
|
if (clickedItem) {
|
|
7735
7740
|
clickedItem(values);
|
|
7736
7741
|
}
|
|
7737
7742
|
},
|
|
7738
|
-
selectedItem:
|
|
7743
|
+
selectedItem: currentPage,
|
|
7739
7744
|
openedItem: openedSidebarItem,
|
|
7740
7745
|
setOpenedItem: function(e) {
|
|
7741
7746
|
return setOpenedSidebarItem(e);
|