opus-toolkit-components 2.0.1 → 2.0.2

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.
@@ -827,75 +827,78 @@ __webpack_require__.r(__webpack_exports__);
827
827
 
828
828
 
829
829
 
830
- /**
831
- * A single menu item (no children).
832
- * @typedef {Object} SidebarMenuItem
833
- * @property {string|number} key
834
- * @property {string} name
835
- * @property {string} [path]
836
- * @property {string} [href]
837
- * @property {import('../Icon').IconProps} [iconProps]
838
- * @property {(key: string|number) => void} [onClick]
830
+ /**
831
+ * A single menu item (no children).
832
+ * @typedef {Object} SidebarMenuItem
833
+ * @property {string|number} key
834
+ * @property {string} name
835
+ * @property {string} [path]
836
+ * @property {string} [href]
837
+ * @property {import('../Icon').IconProps} [iconProps]
838
+ * @property {(key: string|number) => void} [onClick]
839
839
  */
840
840
 
841
- /**
842
- * A grouped menu entry with children.
843
- * @typedef {Object} SidebarMenuGroup
844
- * @property {string|number} key
845
- * @property {string} name
846
- * @property {SidebarMenuItem[]} children
841
+ /**
842
+ * A grouped menu entry with children.
843
+ * @typedef {Object} SidebarMenuGroup
844
+ * @property {string|number} key
845
+ * @property {string} name
846
+ * @property {SidebarMenuItem[]} children
847
847
  */
848
848
 
849
- /**
850
- * A full menu entry (either group or leaf item).
851
- * @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
849
+ /**
850
+ * A full menu entry (either group or leaf item).
851
+ * @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
852
852
  */
853
853
 
854
- /**
855
- * Minimal shape expected for SidebarProfile.
856
- * @typedef {Object} SidebarUser
857
- * @property {string|number} id
858
- * @property {string} name
859
- * @property {string} role
860
- * @property {string} [avatar]
854
+ /**
855
+ * Minimal shape expected for SidebarProfile.
856
+ * @typedef {Object} SidebarUser
857
+ * @property {string|number} id
858
+ * @property {string} name
859
+ * @property {string} role
860
+ * @property {string} [avatar]
861
861
  */
862
862
 
863
- /**
864
- * Props for Sidebar.
865
- *
866
- * @typedef {Object} SidebarProps
867
- *
868
- * @property {SidebarMenu[]} menus
869
- * All sidebar menu items (groups + items).
870
- *
871
- * @property {SidebarUser} user
872
- * The current logged-in user.
873
- *
874
- * @property {string|number|null} [activeItem]
875
- * Key of the currently selected item.
876
- *
877
- * @property {(key: string|number) => void} [onItemClick]
878
- * Fired when a menu item is clicked.
879
- *
880
- * @property {string} [logo]
881
- * Optional logo override.
882
- *
883
- * @property {string} [searchValue]
884
- * Controlled search input value.
885
- *
886
- * @property {(value: string) => void} [onSearchChange]
887
- *
888
- * @property {string|number|null} [openGroupKey]
889
- * Optional controlled key of the currently expanded group.
890
- *
891
- * @property {(openGroupKey: string|number|null) => void} [onGroupToggle]
892
- * Optional controlled change handler. If omitted, Sidebar manages group state internally.
863
+ /**
864
+ * Props for Sidebar.
865
+ *
866
+ * @typedef {Object} SidebarProps
867
+ *
868
+ * @property {SidebarMenu[]} menus
869
+ * All sidebar menu items (groups + items).
870
+ *
871
+ * @property {SidebarUser} user
872
+ * The current logged-in user.
873
+ *
874
+ * @property {string|number|null} [activeItem]
875
+ * Key of the currently selected item.
876
+ *
877
+ * @property {(key: string|number) => void} [onItemClick]
878
+ * Fired when a menu item is clicked.
879
+ *
880
+ * @property {string} [logo]
881
+ * Optional logo override.
882
+ *
883
+ * @property {string} [searchValue]
884
+ * Controlled search input value.
885
+ *
886
+ * @property {(value: string) => void} [onSearchChange]
887
+ *
888
+ * @property {string|number|null} [openGroupKey]
889
+ * Optional controlled key of the currently expanded group.
890
+ *
891
+ * @property {(openGroupKey: string|number|null) => void} [onGroupToggle]
892
+ * Optional controlled change handler. If omitted, Sidebar manages group state internally.
893
+ *
894
+ * @property {() => void} [onLogout]
895
+ * Optional callback fired when the user clicks the logout button in the profile card.
893
896
  */
894
897
 
895
- /**
896
- * Fully typed Sidebar component.
897
- *
898
- * @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
898
+ /**
899
+ * Fully typed Sidebar component.
900
+ *
901
+ * @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
899
902
  */
900
903
 
901
904
  function Sidebar(_ref) {
@@ -909,6 +912,7 @@ function Sidebar(_ref) {
909
912
  onSearchChange,
910
913
  openGroupKey,
911
914
  onGroupToggle,
915
+ onLogout,
912
916
  ...rest
913
917
  } = _ref;
914
918
  const [open, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
@@ -923,10 +927,10 @@ function Sidebar(_ref) {
923
927
  setInternalOpenGroupKey(nextOpenGroupKey);
924
928
  };
925
929
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
926
- className: "flex",
930
+ className: "flex h-full",
927
931
  ...rest,
928
932
  children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
929
- className: `${open ? "w-[20rem]" : "w-[3rem]"} transition-width flex min-h-screen flex-col bg-[--color-primary-bg] text-[--color-text-strong] duration-300 ease-in-out`,
933
+ className: `${open ? "w-[20rem]" : "w-[3rem]"} transition-width flex h-full flex-col bg-[--color-primary-bg] text-[--color-text-strong] duration-300 ease-in-out`,
930
934
  children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
931
935
  className: "flex items-center justify-between p-3 pr-0",
932
936
  children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("img", {
@@ -948,7 +952,7 @@ function Sidebar(_ref) {
948
952
  className: "h-6 w-6 text-[--color-text-strong] hover:text-[--color-primary-hover]"
949
953
  })
950
954
  }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("nav", {
951
- className: "mt-2 flex-1 space-y-1",
955
+ className: "mt-2 flex min-h-0 flex-1 flex-col overflow-hidden",
952
956
  children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
953
957
  className: "border-b-solid border-b-2 border-[--color-stroke] px-3 pb-2",
954
958
  children: open ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
@@ -970,7 +974,7 @@ function Sidebar(_ref) {
970
974
  })
971
975
  })
972
976
  }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
973
- className: "menu-item-container",
977
+ className: "menu-item-container flex-1",
974
978
  children: menus.map(menu => menu.children ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_SidebarGroup__WEBPACK_IMPORTED_MODULE_3__["default"], {
975
979
  menu: menu,
976
980
  open: open,
@@ -992,7 +996,8 @@ function Sidebar(_ref) {
992
996
  }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_SidebarProfile__WEBPACK_IMPORTED_MODULE_4__["default"], {
993
997
  user: user,
994
998
  open: open,
995
- href: `/users/${user.id}`
999
+ href: `/users/${user.id}`,
1000
+ onLogout: onLogout
996
1001
  })]
997
1002
  })
998
1003
  });
@@ -1243,27 +1248,41 @@ __webpack_require__.r(__webpack_exports__);
1243
1248
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1244
1249
  /* harmony export */ "default": () => (/* binding */ SidebarProfile)
1245
1250
  /* harmony export */ });
1246
- /* harmony import */ var _Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4977);
1247
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4178);
1248
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
1251
+ /* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(148);
1252
+ /* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__);
1253
+ /* harmony import */ var _Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4977);
1254
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4178);
1255
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
1256
+
1249
1257
 
1250
1258
 
1251
1259
  function SidebarProfile(_ref) {
1252
1260
  let {
1253
1261
  user,
1254
1262
  open,
1255
- href
1263
+ href,
1264
+ onLogout
1256
1265
  } = _ref;
1257
- return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", {
1266
+ return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
1258
1267
  className: "mt-auto flex items-center gap-3 p-2 pb-4",
1259
- children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img", {
1268
+ children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img", {
1260
1269
  src: user.avatar,
1261
1270
  alt: "profile",
1262
1271
  className: "h-8 w-8 rounded-full"
1263
- }), open && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_0__["default"], {
1264
- user: user,
1265
- href: href,
1266
- variant: "sidebar"
1272
+ }), open && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
1273
+ className: "flex flex-1 items-center justify-between gap-2",
1274
+ children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_1__["default"], {
1275
+ user: user,
1276
+ href: href,
1277
+ variant: "sidebar"
1278
+ }), onLogout && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", {
1279
+ onClick: onLogout,
1280
+ title: "Log out",
1281
+ className: "rounded p-1 text-[--color-text-strong] transition-colors hover:bg-[--color-primary-bg-hover] hover:text-[--color-primary]",
1282
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__.ArrowRightOnRectangleIcon, {
1283
+ className: "h-5 w-5"
1284
+ })
1285
+ })]
1267
1286
  })]
1268
1287
  });
1269
1288
  }
@@ -1438,7 +1457,7 @@ __webpack_require__.r(__webpack_exports__);
1438
1457
 
1439
1458
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
1440
1459
  // Module
1441
- ___CSS_LOADER_EXPORT___.push([module.id, `.sidebar-logo{width:24px;height:auto}`, "",{"version":3,"sources":["webpack://./src/components/Sidebar/sidebar.scss"],"names":[],"mappings":"AAAA,cACI,UAAA,CACA,WAAA","sourcesContent":[".sidebar-logo {\r\n width:24px;\r\n height: auto;\r\n}"],"sourceRoot":""}]);
1460
+ ___CSS_LOADER_EXPORT___.push([module.id, `.sidebar-logo{width:24px;height:auto}.menu-item-container{overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none;min-height:0}.menu-item-container::-webkit-scrollbar{display:none}`, "",{"version":3,"sources":["webpack://./src/components/Sidebar/sidebar.scss"],"names":[],"mappings":"AAAA,cACI,UAAA,CACA,WAAA,CAGJ,qBACI,eAAA,CACA,oBAAA,CACA,uBAAA,CACA,YAAA,CAEA,wCACI,YAAA","sourcesContent":[".sidebar-logo {\r\n width:24px;\r\n height: auto;\r\n}\r\n\r\n.menu-item-container {\r\n overflow-y: auto;\r\n scrollbar-width: none;\r\n -ms-overflow-style: none;\r\n min-height: 0;\r\n\r\n &::-webkit-scrollbar {\r\n display: none;\r\n }\r\n}"],"sourceRoot":""}]);
1442
1461
  // Exports
1443
1462
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
1444
1463