opus-toolkit-components 1.7.5 → 1.7.6
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/lib/opus-components.main.js +120 -101
- package/lib/opus-components.main.js.map +1 -1
- package/package.json +1 -1
|
@@ -5558,66 +5558,72 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5558
5558
|
|
|
5559
5559
|
|
|
5560
5560
|
|
|
5561
|
-
/**
|
|
5562
|
-
* A single menu item (no children).
|
|
5563
|
-
* @typedef {Object} SidebarMenuItem
|
|
5564
|
-
* @property {string|number} key
|
|
5565
|
-
* @property {string} name
|
|
5566
|
-
* @property {string} [icon] // optional icon name depending on your app
|
|
5567
|
-
* @property {string} [href] // optional link target
|
|
5561
|
+
/**
|
|
5562
|
+
* A single menu item (no children).
|
|
5563
|
+
* @typedef {Object} SidebarMenuItem
|
|
5564
|
+
* @property {string|number} key
|
|
5565
|
+
* @property {string} name
|
|
5566
|
+
* @property {string} [icon] // optional icon name depending on your app
|
|
5567
|
+
* @property {string} [href] // optional link target
|
|
5568
5568
|
*/
|
|
5569
5569
|
|
|
5570
|
-
/**
|
|
5571
|
-
* A grouped menu entry with children.
|
|
5572
|
-
* @typedef {Object} SidebarMenuGroup
|
|
5573
|
-
* @property {string|number} key
|
|
5574
|
-
* @property {string} name
|
|
5575
|
-
* @property {SidebarMenuItem[]} children
|
|
5570
|
+
/**
|
|
5571
|
+
* A grouped menu entry with children.
|
|
5572
|
+
* @typedef {Object} SidebarMenuGroup
|
|
5573
|
+
* @property {string|number} key
|
|
5574
|
+
* @property {string} name
|
|
5575
|
+
* @property {SidebarMenuItem[]} children
|
|
5576
5576
|
*/
|
|
5577
5577
|
|
|
5578
|
-
/**
|
|
5579
|
-
* A full menu entry (either group or leaf item).
|
|
5580
|
-
* @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
|
|
5578
|
+
/**
|
|
5579
|
+
* A full menu entry (either group or leaf item).
|
|
5580
|
+
* @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
|
|
5581
5581
|
*/
|
|
5582
5582
|
|
|
5583
|
-
/**
|
|
5584
|
-
* Minimal shape expected for SidebarProfile.
|
|
5585
|
-
* @typedef {Object} SidebarUser
|
|
5586
|
-
* @property {string|number} id
|
|
5587
|
-
* @property {string} name
|
|
5588
|
-
* @property {string} role
|
|
5589
|
-
* @property {string} [avatar] // optional depending on your design
|
|
5583
|
+
/**
|
|
5584
|
+
* Minimal shape expected for SidebarProfile.
|
|
5585
|
+
* @typedef {Object} SidebarUser
|
|
5586
|
+
* @property {string|number} id
|
|
5587
|
+
* @property {string} name
|
|
5588
|
+
* @property {string} role
|
|
5589
|
+
* @property {string} [avatar] // optional depending on your design
|
|
5590
5590
|
*/
|
|
5591
5591
|
|
|
5592
|
-
/**
|
|
5593
|
-
* Props for Sidebar.
|
|
5594
|
-
*
|
|
5595
|
-
* @typedef {Object} SidebarProps
|
|
5596
|
-
*
|
|
5597
|
-
* @property {SidebarMenu[]} menus
|
|
5598
|
-
* All sidebar menu items (groups + items).
|
|
5599
|
-
*
|
|
5600
|
-
* @property {SidebarUser} user
|
|
5601
|
-
* The current logged-in user.
|
|
5602
|
-
*
|
|
5603
|
-
* @property {string|number|null} [activeItem]
|
|
5604
|
-
* Key of the currently selected item.
|
|
5605
|
-
*
|
|
5606
|
-
* @property {(key: string|number) => void} [onItemClick]
|
|
5607
|
-
* Fired when a menu item is clicked.
|
|
5608
|
-
*
|
|
5609
|
-
* @property {string} [logo]
|
|
5610
|
-
* Optional logo override.
|
|
5611
|
-
*
|
|
5612
|
-
* @property {string} [searchValue='']
|
|
5613
|
-
|
|
5614
|
-
* @property {
|
|
5592
|
+
/**
|
|
5593
|
+
* Props for Sidebar.
|
|
5594
|
+
*
|
|
5595
|
+
* @typedef {Object} SidebarProps
|
|
5596
|
+
*
|
|
5597
|
+
* @property {SidebarMenu[]} menus
|
|
5598
|
+
* All sidebar menu items (groups + items).
|
|
5599
|
+
*
|
|
5600
|
+
* @property {SidebarUser} user
|
|
5601
|
+
* The current logged-in user.
|
|
5602
|
+
*
|
|
5603
|
+
* @property {string|number|null} [activeItem]
|
|
5604
|
+
* Key of the currently selected item.
|
|
5605
|
+
*
|
|
5606
|
+
* @property {(key: string|number) => void} [onItemClick]
|
|
5607
|
+
* Fired when a menu item is clicked.
|
|
5608
|
+
*
|
|
5609
|
+
* @property {string} [logo]
|
|
5610
|
+
* Optional logo override.
|
|
5611
|
+
*
|
|
5612
|
+
* @property {string} [searchValue='']
|
|
5613
|
+
/**
|
|
5614
|
+
* @property {string|number|null} [openGroupKey]
|
|
5615
|
+
* Key of the currently expanded group (controlled).
|
|
5616
|
+
*
|
|
5617
|
+
* @property {(key: string|number) => void} [onGroupToggle]
|
|
5618
|
+
* Fired when a group header is clicked.
|
|
5619
|
+
*
|
|
5620
|
+
* @property {(value: string) => void} [onSearchChange]
|
|
5615
5621
|
*/
|
|
5616
5622
|
|
|
5617
|
-
/**
|
|
5618
|
-
* Fully typed Sidebar component.
|
|
5619
|
-
*
|
|
5620
|
-
* @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
5623
|
+
/**
|
|
5624
|
+
* Fully typed Sidebar component.
|
|
5625
|
+
*
|
|
5626
|
+
* @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
5621
5627
|
*/
|
|
5622
5628
|
|
|
5623
5629
|
function Sidebar(_ref) {
|
|
@@ -5628,7 +5634,9 @@ function Sidebar(_ref) {
|
|
|
5628
5634
|
onItemClick,
|
|
5629
5635
|
logo,
|
|
5630
5636
|
searchValue = "",
|
|
5631
|
-
onSearchChange
|
|
5637
|
+
onSearchChange,
|
|
5638
|
+
openGroupKey,
|
|
5639
|
+
onGroupToggle
|
|
5632
5640
|
} = _ref;
|
|
5633
5641
|
const [open, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
5634
5642
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
@@ -5685,7 +5693,9 @@ function Sidebar(_ref) {
|
|
|
5685
5693
|
open: open,
|
|
5686
5694
|
activeItem: activeItem,
|
|
5687
5695
|
onItemClick: onItemClick,
|
|
5688
|
-
toggleSidebar: setOpen
|
|
5696
|
+
toggleSidebar: setOpen,
|
|
5697
|
+
isOpen: openGroupKey === menu.key,
|
|
5698
|
+
onToggle: () => onGroupToggle === null || onGroupToggle === void 0 ? void 0 : onGroupToggle(menu.key)
|
|
5689
5699
|
}, "group-".concat(menu.key, "-").concat(menu.name)) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_SidebarItem__WEBPACK_IMPORTED_MODULE_2__["default"], {
|
|
5690
5700
|
// composite key
|
|
5691
5701
|
menu: menu,
|
|
@@ -50661,55 +50671,64 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
50661
50671
|
|
|
50662
50672
|
|
|
50663
50673
|
|
|
50664
|
-
/**
|
|
50665
|
-
* Icon props used by your dynamic Icon component (optional).
|
|
50666
|
-
* @typedef {import('../Icon/Icon').IconProps} IconProps
|
|
50674
|
+
/**
|
|
50675
|
+
* Icon props used by your dynamic Icon component (optional).
|
|
50676
|
+
* @typedef {import('../Icon/Icon').IconProps} IconProps
|
|
50667
50677
|
*/
|
|
50668
50678
|
|
|
50669
|
-
/**
|
|
50670
|
-
* A single child menu item.
|
|
50671
|
-
* @typedef {Object} SidebarChild
|
|
50672
|
-
* @property {string|number} key
|
|
50673
|
-
* @property {string} name
|
|
50674
|
-
* @property {string} [path]
|
|
50675
|
-
* @property {string} [href]
|
|
50676
|
-
* @property {IconProps} [iconProps]
|
|
50679
|
+
/**
|
|
50680
|
+
* A single child menu item.
|
|
50681
|
+
* @typedef {Object} SidebarChild
|
|
50682
|
+
* @property {string|number} key
|
|
50683
|
+
* @property {string} name
|
|
50684
|
+
* @property {string} [path]
|
|
50685
|
+
* @property {string} [href]
|
|
50686
|
+
* @property {IconProps} [iconProps]
|
|
50677
50687
|
*/
|
|
50678
50688
|
|
|
50679
|
-
/**
|
|
50680
|
-
* Sidebar group object containing children.
|
|
50681
|
-
* @typedef {Object} SidebarGroupMenu
|
|
50682
|
-
* @property {string|number} key
|
|
50683
|
-
* @property {string} name
|
|
50684
|
-
* @property {SidebarChild[]} children
|
|
50685
|
-
* @property {IconProps} [iconProps]
|
|
50689
|
+
/**
|
|
50690
|
+
* Sidebar group object containing children.
|
|
50691
|
+
* @typedef {Object} SidebarGroupMenu
|
|
50692
|
+
* @property {string|number} key
|
|
50693
|
+
* @property {string} name
|
|
50694
|
+
* @property {SidebarChild[]} children
|
|
50695
|
+
* @property {IconProps} [iconProps]
|
|
50686
50696
|
*/
|
|
50687
50697
|
|
|
50688
|
-
/**
|
|
50689
|
-
* Props for SidebarGroup component.
|
|
50690
|
-
*
|
|
50691
|
-
* @typedef {Object} SidebarGroupProps
|
|
50692
|
-
*
|
|
50693
|
-
* @property {SidebarGroupMenu} menu
|
|
50694
|
-
* The group menu containing children.
|
|
50695
|
-
*
|
|
50696
|
-
* @property {boolean} open
|
|
50697
|
-
* Whether the sidebar is
|
|
50698
|
-
*
|
|
50699
|
-
* @property {string|number|null} activeItem
|
|
50700
|
-
* The currently selected menu item key.
|
|
50701
|
-
*
|
|
50702
|
-
* @property {(key: string|number) => void} onItemClick
|
|
50703
|
-
* Handler fired when a child item is selected.
|
|
50704
|
-
*
|
|
50705
|
-
* @property {(open: boolean) => void} toggleSidebar
|
|
50706
|
-
*
|
|
50698
|
+
/**
|
|
50699
|
+
* Props for SidebarGroup component.
|
|
50700
|
+
*
|
|
50701
|
+
* @typedef {Object} SidebarGroupProps
|
|
50702
|
+
*
|
|
50703
|
+
* @property {SidebarGroupMenu} menu
|
|
50704
|
+
* The group menu containing children.
|
|
50705
|
+
*
|
|
50706
|
+
* @property {boolean} open
|
|
50707
|
+
* Whether the sidebar itself is expanded (wide mode vs collapsed).
|
|
50708
|
+
*
|
|
50709
|
+
* @property {string|number|null} activeItem
|
|
50710
|
+
* The currently selected menu item key.
|
|
50711
|
+
*
|
|
50712
|
+
* @property {(key: string|number) => void} onItemClick
|
|
50713
|
+
* Handler fired when a child item is selected.
|
|
50714
|
+
*
|
|
50715
|
+
* @property {(open: boolean) => void} toggleSidebar
|
|
50716
|
+
* Opens the sidebar when a user clicks a collapsed group.
|
|
50717
|
+
*
|
|
50718
|
+
*
|
|
50719
|
+
* // NEW CONTROLLED STATE PROPS:
|
|
50720
|
+
*
|
|
50721
|
+
* @property {boolean} isOpen
|
|
50722
|
+
* Whether THIS group’s children are currently expanded.
|
|
50723
|
+
*
|
|
50724
|
+
* @property {(key: string|number) => void} onToggle
|
|
50725
|
+
* Fired when the group header is clicked. Parent controls open/close.
|
|
50707
50726
|
*/
|
|
50708
50727
|
|
|
50709
|
-
/**
|
|
50710
|
-
* Fully typed SidebarGroup component.
|
|
50711
|
-
*
|
|
50712
|
-
* @param {SidebarGroupProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
50728
|
+
/**
|
|
50729
|
+
* Fully typed SidebarGroup component.
|
|
50730
|
+
*
|
|
50731
|
+
* @param {SidebarGroupProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
50713
50732
|
*/
|
|
50714
50733
|
|
|
50715
50734
|
function SidebarGroup(_ref) {
|
|
@@ -50718,25 +50737,26 @@ function SidebarGroup(_ref) {
|
|
|
50718
50737
|
open,
|
|
50719
50738
|
activeItem,
|
|
50720
50739
|
onItemClick,
|
|
50721
|
-
toggleSidebar
|
|
50740
|
+
toggleSidebar,
|
|
50741
|
+
isOpen,
|
|
50742
|
+
onToggle
|
|
50722
50743
|
} = _ref;
|
|
50723
|
-
const [expanded, setExpanded] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
50724
50744
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
|
|
50725
50745
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
|
|
50726
50746
|
className: "group relative flex cursor-pointer items-center justify-between p-4 transition-all duration-500 ease-in-out",
|
|
50727
50747
|
onClick: () => {
|
|
50728
50748
|
if (!open) toggleSidebar(true);
|
|
50729
|
-
|
|
50749
|
+
onToggle(menu.key); // let parent handle open/close
|
|
50730
50750
|
},
|
|
50731
50751
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
50732
|
-
className: "absolute left-0 top-0 h-full w-[5px] rounded-r transition-all duration-300 ease-in-out ".concat(
|
|
50752
|
+
className: "absolute left-0 top-0 h-full w-[5px] rounded-r transition-all duration-300 ease-in-out ".concat(isOpen || activeItem === menu.key ? "bg-[--color-brand-primary]" : "bg-[--color-stroke] group-hover:bg-[--color-brand-primary]")
|
|
50733
50753
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
|
|
50734
50754
|
className: "flex items-center gap-3",
|
|
50735
50755
|
children: [menu.iconProps && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Icon_Icon__WEBPACK_IMPORTED_MODULE_4__["default"], _objectSpread({}, menu.iconProps)), !open && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
|
|
50736
50756
|
className: "absolute left-full top-1/2 ml-2 -translate-y-1/2 whitespace-nowrap rounded bg-[--color-primary-bg] px-2 py-1 text-xs text-[--color-text-strong] opacity-0 transition-opacity duration-300 group-hover:opacity-100",
|
|
50737
50757
|
children: menu.name
|
|
50738
50758
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
50739
|
-
className: "overflow-hidden whitespace-nowrap transition-all duration-500 ease-in-out ".concat(open ? "ml-2 w-auto translate-y-0 opacity-100" : "ml-0 w-0 translate-y-2 opacity-0"
|
|
50759
|
+
className: "overflow-hidden whitespace-nowrap transition-all duration-500 ease-in-out ".concat(open ? "ml-2 w-auto translate-y-0 opacity-100" : "ml-0 w-0 translate-y-2 opacity-0"),
|
|
50740
50760
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Text_Text__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
50741
50761
|
as: "span",
|
|
50742
50762
|
variant: "label",
|
|
@@ -50744,12 +50764,11 @@ function SidebarGroup(_ref) {
|
|
|
50744
50764
|
})
|
|
50745
50765
|
})]
|
|
50746
50766
|
}), open && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_1__.ChevronDownIcon, {
|
|
50747
|
-
className: "h-4 w-4 transition-transform duration-300 ".concat(
|
|
50767
|
+
className: "h-4 w-4 transition-transform duration-300 ".concat(isOpen ? "rotate-180" : "")
|
|
50748
50768
|
})]
|
|
50749
50769
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
50750
|
-
className: "ml-10 mt-1 overflow-hidden transition-all duration-300 ease-in-out ".concat(
|
|
50770
|
+
className: "ml-10 mt-1 overflow-hidden transition-all duration-300 ease-in-out ".concat(isOpen && open ? "max-h-96 opacity-100" : "max-h-0 opacity-0"),
|
|
50751
50771
|
children: menu.children.map(child => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_SidebarItem__WEBPACK_IMPORTED_MODULE_2__["default"], {
|
|
50752
|
-
// composite unique key
|
|
50753
50772
|
menu: child,
|
|
50754
50773
|
open: open,
|
|
50755
50774
|
active: activeItem === child.key,
|