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.
- package/lib/components/Cookie/index.js +23 -23
- package/lib/components/Cookie/index.js.map +1 -1
- package/lib/components/PageTemplate/index.js +94 -75
- package/lib/components/PageTemplate/index.js.map +1 -1
- package/lib/components/Sidebar/index.d.ts +60 -57
- package/lib/components/Sidebar/index.js +94 -75
- package/lib/components/Sidebar/index.js.map +1 -1
- package/lib/main.js +117 -98
- package/lib/main.js.map +1 -1
- package/package.json +1 -1
package/lib/main.js
CHANGED
|
@@ -590,32 +590,32 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
590
590
|
|
|
591
591
|
|
|
592
592
|
|
|
593
|
-
/**
|
|
594
|
-
* The visual intent / theme of the Card.
|
|
595
|
-
* @typedef {'default'|'info'|'warning'|'success'|'error'|'brand'|'brandSecondary'} CardIntent
|
|
593
|
+
/**
|
|
594
|
+
* The visual intent / theme of the Card.
|
|
595
|
+
* @typedef {'default'|'info'|'warning'|'success'|'error'|'brand'|'brandSecondary'} CardIntent
|
|
596
596
|
*/
|
|
597
597
|
|
|
598
|
-
/**
|
|
599
|
-
* Props for the Card component.
|
|
600
|
-
*
|
|
601
|
-
* @typedef {Object} CardProps
|
|
602
|
-
* @property {CardIntent} [intent]
|
|
603
|
-
* Controls the background + text color theme of the card.
|
|
604
|
-
*
|
|
605
|
-
* @property {boolean} [hasOutline=true]
|
|
606
|
-
* Toggles the default card outline.
|
|
607
|
-
*
|
|
608
|
-
* @property {string} [className]
|
|
609
|
-
* Additional custom class names.
|
|
610
|
-
*
|
|
611
|
-
* @property {React.ReactNode} [children]
|
|
612
|
-
* Card content.
|
|
598
|
+
/**
|
|
599
|
+
* Props for the Card component.
|
|
600
|
+
*
|
|
601
|
+
* @typedef {Object} CardProps
|
|
602
|
+
* @property {CardIntent} [intent]
|
|
603
|
+
* Controls the background + text color theme of the card.
|
|
604
|
+
*
|
|
605
|
+
* @property {boolean} [hasOutline=true]
|
|
606
|
+
* Toggles the default card outline.
|
|
607
|
+
*
|
|
608
|
+
* @property {string} [className]
|
|
609
|
+
* Additional custom class names.
|
|
610
|
+
*
|
|
611
|
+
* @property {React.ReactNode} [children]
|
|
612
|
+
* Card content.
|
|
613
613
|
*/
|
|
614
614
|
|
|
615
|
-
/**
|
|
616
|
-
* Card component with typed JSDoc for TS autocomplete.
|
|
617
|
-
*
|
|
618
|
-
* @param {CardProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
615
|
+
/**
|
|
616
|
+
* Card component with typed JSDoc for TS autocomplete.
|
|
617
|
+
*
|
|
618
|
+
* @param {CardProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
619
619
|
*/
|
|
620
620
|
|
|
621
621
|
function Card(_ref) {
|
|
@@ -637,7 +637,7 @@ function Card(_ref) {
|
|
|
637
637
|
brandSecondary: "bg-[--color-brand-secondary] text-[--color-white]"
|
|
638
638
|
};
|
|
639
639
|
const resolvedIntent = intent || "default";
|
|
640
|
-
const cardClasses = (0,clsx__WEBPACK_IMPORTED_MODULE_1__["default"])("p-5", "rounded-lg", "shadow-lg", hasOutline ? "border
|
|
640
|
+
const cardClasses = (0,clsx__WEBPACK_IMPORTED_MODULE_1__["default"])("p-5", "rounded-lg", "shadow-lg", hasOutline ? "border border-solid border-[--color-stroke]" : "border-0", intentClasses[resolvedIntent], className);
|
|
641
641
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
|
|
642
642
|
className: cardClasses,
|
|
643
643
|
...rest,
|
|
@@ -3915,75 +3915,78 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3915
3915
|
|
|
3916
3916
|
|
|
3917
3917
|
|
|
3918
|
-
/**
|
|
3919
|
-
* A single menu item (no children).
|
|
3920
|
-
* @typedef {Object} SidebarMenuItem
|
|
3921
|
-
* @property {string|number} key
|
|
3922
|
-
* @property {string} name
|
|
3923
|
-
* @property {string} [path]
|
|
3924
|
-
* @property {string} [href]
|
|
3925
|
-
* @property {import('../Icon').IconProps} [iconProps]
|
|
3926
|
-
* @property {(key: string|number) => void} [onClick]
|
|
3918
|
+
/**
|
|
3919
|
+
* A single menu item (no children).
|
|
3920
|
+
* @typedef {Object} SidebarMenuItem
|
|
3921
|
+
* @property {string|number} key
|
|
3922
|
+
* @property {string} name
|
|
3923
|
+
* @property {string} [path]
|
|
3924
|
+
* @property {string} [href]
|
|
3925
|
+
* @property {import('../Icon').IconProps} [iconProps]
|
|
3926
|
+
* @property {(key: string|number) => void} [onClick]
|
|
3927
3927
|
*/
|
|
3928
3928
|
|
|
3929
|
-
/**
|
|
3930
|
-
* A grouped menu entry with children.
|
|
3931
|
-
* @typedef {Object} SidebarMenuGroup
|
|
3932
|
-
* @property {string|number} key
|
|
3933
|
-
* @property {string} name
|
|
3934
|
-
* @property {SidebarMenuItem[]} children
|
|
3929
|
+
/**
|
|
3930
|
+
* A grouped menu entry with children.
|
|
3931
|
+
* @typedef {Object} SidebarMenuGroup
|
|
3932
|
+
* @property {string|number} key
|
|
3933
|
+
* @property {string} name
|
|
3934
|
+
* @property {SidebarMenuItem[]} children
|
|
3935
3935
|
*/
|
|
3936
3936
|
|
|
3937
|
-
/**
|
|
3938
|
-
* A full menu entry (either group or leaf item).
|
|
3939
|
-
* @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
|
|
3937
|
+
/**
|
|
3938
|
+
* A full menu entry (either group or leaf item).
|
|
3939
|
+
* @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
|
|
3940
3940
|
*/
|
|
3941
3941
|
|
|
3942
|
-
/**
|
|
3943
|
-
* Minimal shape expected for SidebarProfile.
|
|
3944
|
-
* @typedef {Object} SidebarUser
|
|
3945
|
-
* @property {string|number} id
|
|
3946
|
-
* @property {string} name
|
|
3947
|
-
* @property {string} role
|
|
3948
|
-
* @property {string} [avatar]
|
|
3942
|
+
/**
|
|
3943
|
+
* Minimal shape expected for SidebarProfile.
|
|
3944
|
+
* @typedef {Object} SidebarUser
|
|
3945
|
+
* @property {string|number} id
|
|
3946
|
+
* @property {string} name
|
|
3947
|
+
* @property {string} role
|
|
3948
|
+
* @property {string} [avatar]
|
|
3949
3949
|
*/
|
|
3950
3950
|
|
|
3951
|
-
/**
|
|
3952
|
-
* Props for Sidebar.
|
|
3953
|
-
*
|
|
3954
|
-
* @typedef {Object} SidebarProps
|
|
3955
|
-
*
|
|
3956
|
-
* @property {SidebarMenu[]} menus
|
|
3957
|
-
* All sidebar menu items (groups + items).
|
|
3958
|
-
*
|
|
3959
|
-
* @property {SidebarUser} user
|
|
3960
|
-
* The current logged-in user.
|
|
3961
|
-
*
|
|
3962
|
-
* @property {string|number|null} [activeItem]
|
|
3963
|
-
* Key of the currently selected item.
|
|
3964
|
-
*
|
|
3965
|
-
* @property {(key: string|number) => void} [onItemClick]
|
|
3966
|
-
* Fired when a menu item is clicked.
|
|
3967
|
-
*
|
|
3968
|
-
* @property {string} [logo]
|
|
3969
|
-
* Optional logo override.
|
|
3970
|
-
*
|
|
3971
|
-
* @property {string} [searchValue]
|
|
3972
|
-
* Controlled search input value.
|
|
3973
|
-
*
|
|
3974
|
-
* @property {(value: string) => void} [onSearchChange]
|
|
3975
|
-
*
|
|
3976
|
-
* @property {string|number|null} [openGroupKey]
|
|
3977
|
-
* Optional controlled key of the currently expanded group.
|
|
3978
|
-
*
|
|
3979
|
-
* @property {(openGroupKey: string|number|null) => void} [onGroupToggle]
|
|
3980
|
-
* Optional controlled change handler. If omitted, Sidebar manages group state internally.
|
|
3951
|
+
/**
|
|
3952
|
+
* Props for Sidebar.
|
|
3953
|
+
*
|
|
3954
|
+
* @typedef {Object} SidebarProps
|
|
3955
|
+
*
|
|
3956
|
+
* @property {SidebarMenu[]} menus
|
|
3957
|
+
* All sidebar menu items (groups + items).
|
|
3958
|
+
*
|
|
3959
|
+
* @property {SidebarUser} user
|
|
3960
|
+
* The current logged-in user.
|
|
3961
|
+
*
|
|
3962
|
+
* @property {string|number|null} [activeItem]
|
|
3963
|
+
* Key of the currently selected item.
|
|
3964
|
+
*
|
|
3965
|
+
* @property {(key: string|number) => void} [onItemClick]
|
|
3966
|
+
* Fired when a menu item is clicked.
|
|
3967
|
+
*
|
|
3968
|
+
* @property {string} [logo]
|
|
3969
|
+
* Optional logo override.
|
|
3970
|
+
*
|
|
3971
|
+
* @property {string} [searchValue]
|
|
3972
|
+
* Controlled search input value.
|
|
3973
|
+
*
|
|
3974
|
+
* @property {(value: string) => void} [onSearchChange]
|
|
3975
|
+
*
|
|
3976
|
+
* @property {string|number|null} [openGroupKey]
|
|
3977
|
+
* Optional controlled key of the currently expanded group.
|
|
3978
|
+
*
|
|
3979
|
+
* @property {(openGroupKey: string|number|null) => void} [onGroupToggle]
|
|
3980
|
+
* Optional controlled change handler. If omitted, Sidebar manages group state internally.
|
|
3981
|
+
*
|
|
3982
|
+
* @property {() => void} [onLogout]
|
|
3983
|
+
* Optional callback fired when the user clicks the logout button in the profile card.
|
|
3981
3984
|
*/
|
|
3982
3985
|
|
|
3983
|
-
/**
|
|
3984
|
-
* Fully typed Sidebar component.
|
|
3985
|
-
*
|
|
3986
|
-
* @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
3986
|
+
/**
|
|
3987
|
+
* Fully typed Sidebar component.
|
|
3988
|
+
*
|
|
3989
|
+
* @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
3987
3990
|
*/
|
|
3988
3991
|
|
|
3989
3992
|
function Sidebar(_ref) {
|
|
@@ -3997,6 +4000,7 @@ function Sidebar(_ref) {
|
|
|
3997
4000
|
onSearchChange,
|
|
3998
4001
|
openGroupKey,
|
|
3999
4002
|
onGroupToggle,
|
|
4003
|
+
onLogout,
|
|
4000
4004
|
...rest
|
|
4001
4005
|
} = _ref;
|
|
4002
4006
|
const [open, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
@@ -4011,10 +4015,10 @@ function Sidebar(_ref) {
|
|
|
4011
4015
|
setInternalOpenGroupKey(nextOpenGroupKey);
|
|
4012
4016
|
};
|
|
4013
4017
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
4014
|
-
className: "flex",
|
|
4018
|
+
className: "flex h-full",
|
|
4015
4019
|
...rest,
|
|
4016
4020
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
4017
|
-
className: `${open ? "w-[20rem]" : "w-[3rem]"} transition-width flex
|
|
4021
|
+
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`,
|
|
4018
4022
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
4019
4023
|
className: "flex items-center justify-between p-3 pr-0",
|
|
4020
4024
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("img", {
|
|
@@ -4036,7 +4040,7 @@ function Sidebar(_ref) {
|
|
|
4036
4040
|
className: "h-6 w-6 text-[--color-text-strong] hover:text-[--color-primary-hover]"
|
|
4037
4041
|
})
|
|
4038
4042
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("nav", {
|
|
4039
|
-
className: "mt-2 flex-1
|
|
4043
|
+
className: "mt-2 flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
4040
4044
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
4041
4045
|
className: "border-b-solid border-b-2 border-[--color-stroke] px-3 pb-2",
|
|
4042
4046
|
children: open ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
@@ -4058,7 +4062,7 @@ function Sidebar(_ref) {
|
|
|
4058
4062
|
})
|
|
4059
4063
|
})
|
|
4060
4064
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
4061
|
-
className: "menu-item-container",
|
|
4065
|
+
className: "menu-item-container flex-1",
|
|
4062
4066
|
children: menus.map(menu => menu.children ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_SidebarGroup__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
4063
4067
|
menu: menu,
|
|
4064
4068
|
open: open,
|
|
@@ -4080,7 +4084,8 @@ function Sidebar(_ref) {
|
|
|
4080
4084
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_SidebarProfile__WEBPACK_IMPORTED_MODULE_4__["default"], {
|
|
4081
4085
|
user: user,
|
|
4082
4086
|
open: open,
|
|
4083
|
-
href: `/users/${user.id}
|
|
4087
|
+
href: `/users/${user.id}`,
|
|
4088
|
+
onLogout: onLogout
|
|
4084
4089
|
})]
|
|
4085
4090
|
})
|
|
4086
4091
|
});
|
|
@@ -4331,27 +4336,41 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4331
4336
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4332
4337
|
/* harmony export */ "default": () => (/* binding */ SidebarProfile)
|
|
4333
4338
|
/* harmony export */ });
|
|
4334
|
-
/* harmony import */ var
|
|
4335
|
-
/* harmony import */ var
|
|
4336
|
-
/* harmony import */ var
|
|
4339
|
+
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(148);
|
|
4340
|
+
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__);
|
|
4341
|
+
/* harmony import */ var _Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4977);
|
|
4342
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4178);
|
|
4343
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
|
|
4344
|
+
|
|
4337
4345
|
|
|
4338
4346
|
|
|
4339
4347
|
function SidebarProfile(_ref) {
|
|
4340
4348
|
let {
|
|
4341
4349
|
user,
|
|
4342
4350
|
open,
|
|
4343
|
-
href
|
|
4351
|
+
href,
|
|
4352
|
+
onLogout
|
|
4344
4353
|
} = _ref;
|
|
4345
|
-
return /*#__PURE__*/(0,
|
|
4354
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
4346
4355
|
className: "mt-auto flex items-center gap-3 p-2 pb-4",
|
|
4347
|
-
children: [/*#__PURE__*/(0,
|
|
4356
|
+
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img", {
|
|
4348
4357
|
src: user.avatar,
|
|
4349
4358
|
alt: "profile",
|
|
4350
4359
|
className: "h-8 w-8 rounded-full"
|
|
4351
|
-
}), open && /*#__PURE__*/(0,
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4360
|
+
}), open && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
4361
|
+
className: "flex flex-1 items-center justify-between gap-2",
|
|
4362
|
+
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_Profile_ProfileCard_ProfileCard__WEBPACK_IMPORTED_MODULE_1__["default"], {
|
|
4363
|
+
user: user,
|
|
4364
|
+
href: href,
|
|
4365
|
+
variant: "sidebar"
|
|
4366
|
+
}), onLogout && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button", {
|
|
4367
|
+
onClick: onLogout,
|
|
4368
|
+
title: "Log out",
|
|
4369
|
+
className: "rounded p-1 text-[--color-text-strong] transition-colors hover:bg-[--color-primary-bg-hover] hover:text-[--color-primary]",
|
|
4370
|
+
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_0__.ArrowRightOnRectangleIcon, {
|
|
4371
|
+
className: "h-5 w-5"
|
|
4372
|
+
})
|
|
4373
|
+
})]
|
|
4355
4374
|
})]
|
|
4356
4375
|
});
|
|
4357
4376
|
}
|
|
@@ -4728,7 +4747,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4728
4747
|
|
|
4729
4748
|
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()));
|
|
4730
4749
|
// Module
|
|
4731
|
-
___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":""}]);
|
|
4750
|
+
___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":""}]);
|
|
4732
4751
|
// Exports
|
|
4733
4752
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
4734
4753
|
|