blue-react 10.0.4 → 10.1.0
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/components/Body.d.ts +1 -0
- package/dist/components/Body.js +1 -0
- package/dist/components/Page.d.ts +1 -0
- package/dist/components/Page.js +1 -0
- package/dist/components/SidebarToggler.d.ts +1 -0
- package/dist/components/SidebarToggler.js +1 -0
- package/dist/components/Tab.d.ts +12 -0
- package/dist/components/Tab.js +36 -0
- package/dist/components/Tabs.d.ts +16 -0
- package/dist/components/Tabs.js +18 -0
- package/index.d.ts +1 -6
- package/index.js +0 -4
- package/package.json +3 -3
- package/dist/components/ActionMenuItem.d.ts +0 -36
- package/dist/components/ActionMenuItem.js +0 -51
- package/dist/components/SidebarMenuItem.d.ts +0 -21
- package/dist/components/SidebarMenuItem.js +0 -84
|
@@ -15,6 +15,7 @@ export interface BodyProps {
|
|
|
15
15
|
children?: any;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
+
* @deprecated With the new layout design, you don't need this anymore.
|
|
18
19
|
* Contains the content of the page.
|
|
19
20
|
*/
|
|
20
21
|
export default function Body({ id, className, containerClass, hasActions, onClick, children, ...rest }: BodyProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/Body.js
CHANGED
|
@@ -3,6 +3,7 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React from "react";
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated With the new layout design, you don't need this anymore.
|
|
6
7
|
* Contains the content of the page.
|
|
7
8
|
*/
|
|
8
9
|
export default function Body(_ref) {
|
|
@@ -7,6 +7,7 @@ export interface PageProps {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated With the new layout design, you don't need this anymore.
|
|
10
11
|
* Main component for each page.
|
|
11
12
|
*/
|
|
12
13
|
export default function Page({ children, title }: PageProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/Page.js
CHANGED
|
@@ -7,6 +7,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
7
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
8
8
|
import clsx from "clsx";
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated With the new layout design, you don't need this anymore.
|
|
10
11
|
* Main component for each page.
|
|
11
12
|
*/
|
|
12
13
|
export default function Page(_ref) {
|
|
@@ -5,6 +5,7 @@ export interface SidebarTogglerProps {
|
|
|
5
5
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
+
* @deprecated With the new layout design, you don't need this anymore.
|
|
8
9
|
* Button to toggle sidebar state. Designed for internal use inside of `Layout`.
|
|
9
10
|
*/
|
|
10
11
|
export default function SidebarToggler({ className, sidebarToggleIconComponent, onClick }: SidebarTogglerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface TabProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
label: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
contentClassName?: string;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Always use together with `Tabs`.
|
|
11
|
+
*/
|
|
12
|
+
export default function Tab({ label, children, className, contentClassName, active, ...rest }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var _excluded = ["label", "children", "className", "contentClassName", "active"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import { useContext, useId } from "react";
|
|
6
|
+
import { TabsNameContext } from "./Tabs.js";
|
|
7
|
+
/**
|
|
8
|
+
* Always use together with `Tabs`.
|
|
9
|
+
*/
|
|
10
|
+
export default function Tab(_ref) {
|
|
11
|
+
var label = _ref.label,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
contentClassName = _ref.contentClassName,
|
|
15
|
+
active = _ref.active,
|
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var tabsName = useContext(TabsNameContext);
|
|
18
|
+
var tabId = "Tab_" + useId();
|
|
19
|
+
var tabPanelId = "Tab_Panel_" + useId();
|
|
20
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({
|
|
21
|
+
type: "radio",
|
|
22
|
+
name: tabsName,
|
|
23
|
+
role: "tab",
|
|
24
|
+
id: tabId,
|
|
25
|
+
"aria-label": label,
|
|
26
|
+
"aria-controls": tabPanelId,
|
|
27
|
+
className: "blue-tab nav-link ".concat(className),
|
|
28
|
+
defaultChecked: active
|
|
29
|
+
}, rest)), /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
role: "tabpanel",
|
|
31
|
+
id: tabPanelId,
|
|
32
|
+
"aria-labelledby": tabId,
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
className: "blue-tab-content ".concat(contentClassName)
|
|
35
|
+
}, children));
|
|
36
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const TabsNameContext: import("react").Context<string>;
|
|
3
|
+
export interface TabsProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* By default, tabs will have styling of Bootstrap `.nav.nav-tabs`.
|
|
8
|
+
* Set this property to `true` to use `.nav.nav-underline` instead.
|
|
9
|
+
*/
|
|
10
|
+
underline?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Implementation of Blue Web Tabs. Allows to use tabs without JavaScript.
|
|
14
|
+
* Use together with `Tab`.
|
|
15
|
+
*/
|
|
16
|
+
export default function Tabs({ children, className, underline }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useId, createContext } from "react";
|
|
2
|
+
export var TabsNameContext = /*#__PURE__*/createContext("");
|
|
3
|
+
/**
|
|
4
|
+
* Implementation of Blue Web Tabs. Allows to use tabs without JavaScript.
|
|
5
|
+
* Use together with `Tab`.
|
|
6
|
+
*/
|
|
7
|
+
export default function Tabs(_ref) {
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
className = _ref.className,
|
|
10
|
+
underline = _ref.underline;
|
|
11
|
+
var tabsName = "TabList-" + useId();
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
role: "tablist",
|
|
14
|
+
className: "blue-tabs nav nav-".concat(underline ? "underline" : "tabs", " ").concat(className)
|
|
15
|
+
}, /*#__PURE__*/React.createElement(TabsNameContext.Provider, {
|
|
16
|
+
value: tabsName
|
|
17
|
+
}, children));
|
|
18
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
interface Window {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
4
|
blueHashRouterRef: any
|
|
4
5
|
}
|
|
5
6
|
}
|
|
@@ -14,9 +15,6 @@ export { AProps } from "./dist/components/A"
|
|
|
14
15
|
export { default as ActionMenu } from "./dist/components/ActionMenu"
|
|
15
16
|
export { ActionMenuProps } from "./dist/components/ActionMenu"
|
|
16
17
|
|
|
17
|
-
export { default as ActionMenuItem } from "./dist/components/ActionMenuItem"
|
|
18
|
-
export { ActionMenuItemProps } from "./dist/components/ActionMenuItem"
|
|
19
|
-
|
|
20
18
|
export { default as Body } from "./dist/components/Body"
|
|
21
19
|
export { BodyProps } from "./dist/components/Body"
|
|
22
20
|
|
|
@@ -58,9 +56,6 @@ export { SearchProps } from "./dist/components/Search"
|
|
|
58
56
|
export { default as SidebarMenu } from "./dist/components/SidebarMenu"
|
|
59
57
|
export { SidebarMenuProps } from "./dist/components/SidebarMenu"
|
|
60
58
|
|
|
61
|
-
export { default as SidebarMenuItem } from "./dist/components/SidebarMenuItem"
|
|
62
|
-
export { SidebarMenuItemProps } from "./dist/components/SidebarMenuItem"
|
|
63
|
-
|
|
64
59
|
export { default as SimpleLayout } from "./dist/components/SimpleLayout"
|
|
65
60
|
export { SimpleLayoutProps } from "./dist/components/SimpleLayout"
|
|
66
61
|
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Import statements
|
|
2
2
|
import A from "./dist/components/A.js"
|
|
3
3
|
import ActionMenu from "./dist/components/ActionMenu.js"
|
|
4
|
-
import ActionMenuItem from "./dist/components/ActionMenuItem.js"
|
|
5
4
|
import Body from "./dist/components/Body.js"
|
|
6
5
|
import Chevron from "./dist/components/Chevron.js"
|
|
7
6
|
import HashRouter from "./dist/components/HashRouter.js"
|
|
@@ -17,7 +16,6 @@ import Outside from "./dist/components/Outside.js"
|
|
|
17
16
|
import Page from "./dist/components/Page.js"
|
|
18
17
|
import Search from "./dist/components/Search.js"
|
|
19
18
|
import SidebarMenu from "./dist/components/SidebarMenu.js"
|
|
20
|
-
import SidebarMenuItem from "./dist/components/SidebarMenuItem.js"
|
|
21
19
|
import SimpleLayout from "./dist/components/SimpleLayout.js"
|
|
22
20
|
import SlimContainer from "./dist/components/SlimContainer.js"
|
|
23
21
|
import Status from "./dist/components/Status.js"
|
|
@@ -29,7 +27,6 @@ import Utilities from "./dist/components/Utilities.js"
|
|
|
29
27
|
export {
|
|
30
28
|
A,
|
|
31
29
|
ActionMenu,
|
|
32
|
-
ActionMenuItem,
|
|
33
30
|
Body,
|
|
34
31
|
Chevron,
|
|
35
32
|
HashRouter,
|
|
@@ -46,7 +43,6 @@ export {
|
|
|
46
43
|
Page,
|
|
47
44
|
Search,
|
|
48
45
|
SidebarMenu,
|
|
49
|
-
SidebarMenuItem,
|
|
50
46
|
SimpleLayout,
|
|
51
47
|
SlimContainer,
|
|
52
48
|
Status,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blue-react",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Blue React Components",
|
|
5
5
|
"license": "LGPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@popperjs/core": "^2.11.5",
|
|
38
|
-
"blue-web": "^1.14.
|
|
38
|
+
"blue-web": "^1.14.2",
|
|
39
39
|
"bootstrap": "~5.3.3",
|
|
40
40
|
"clsx": "^1.1.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"react": "^
|
|
43
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/cli": "^7.10.4",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { MenuItemProps } from "./MenuItem";
|
|
2
|
-
export interface ActionMenuItemProps extends MenuItemProps {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use `MenuItem` instead. Special `ActionMenu` functionality is now handles with CSS by Blue Web.
|
|
6
|
-
*
|
|
7
|
-
* Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
|
|
8
|
-
*
|
|
9
|
-
* It basically is a shortcut. Instead of writing:
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <ActionMenu>
|
|
13
|
-
* <div className="position-relative z-1">
|
|
14
|
-
* <MenuItem
|
|
15
|
-
* label="Parent"
|
|
16
|
-
* supportOutside
|
|
17
|
-
* dropdownClassName={`position-md-absolute end-0 d-flex flex-column`}
|
|
18
|
-
* >
|
|
19
|
-
* <MenuItem label="Item 1" />
|
|
20
|
-
* </MenuItem>
|
|
21
|
-
* </div>
|
|
22
|
-
* </ActionMenu>
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* you can write:
|
|
26
|
-
* ```tsx
|
|
27
|
-
* <ActionMenu>
|
|
28
|
-
* <ActionMenuItem label="Parent">
|
|
29
|
-
* <MenuItem label="Item 1" />
|
|
30
|
-
* </MenuItem>
|
|
31
|
-
* </ActionMenu>
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* The responsive utility class for absolute position (`position-md-absolute` in this example) is automatically added based on the `break` param of the parent `ActionMenu`.
|
|
35
|
-
*/
|
|
36
|
-
export default function ActionMenuItem({ children, ...props }: ActionMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var _excluded = ["children"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import React, { useContext } from "react";
|
|
6
|
-
import MenuItem from "./MenuItem.js";
|
|
7
|
-
import { ActionMenuContext } from "./ActionMenu.js";
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `MenuItem` instead. Special `ActionMenu` functionality is now handles with CSS by Blue Web.
|
|
10
|
-
*
|
|
11
|
-
* Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
|
|
12
|
-
*
|
|
13
|
-
* It basically is a shortcut. Instead of writing:
|
|
14
|
-
*
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <ActionMenu>
|
|
17
|
-
* <div className="position-relative z-1">
|
|
18
|
-
* <MenuItem
|
|
19
|
-
* label="Parent"
|
|
20
|
-
* supportOutside
|
|
21
|
-
* dropdownClassName={`position-md-absolute end-0 d-flex flex-column`}
|
|
22
|
-
* >
|
|
23
|
-
* <MenuItem label="Item 1" />
|
|
24
|
-
* </MenuItem>
|
|
25
|
-
* </div>
|
|
26
|
-
* </ActionMenu>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* you can write:
|
|
30
|
-
* ```tsx
|
|
31
|
-
* <ActionMenu>
|
|
32
|
-
* <ActionMenuItem label="Parent">
|
|
33
|
-
* <MenuItem label="Item 1" />
|
|
34
|
-
* </MenuItem>
|
|
35
|
-
* </ActionMenu>
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* The responsive utility class for absolute position (`position-md-absolute` in this example) is automatically added based on the `break` param of the parent `ActionMenu`.
|
|
39
|
-
*/
|
|
40
|
-
export default function ActionMenuItem(_ref) {
|
|
41
|
-
var children = _ref.children,
|
|
42
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
-
var _useContext = useContext(ActionMenuContext),
|
|
44
|
-
breakOption = _useContext.breakOption;
|
|
45
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: "position-relative"
|
|
47
|
-
}, /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
|
|
48
|
-
supportOutside: true,
|
|
49
|
-
dropdownClassName: "position-".concat(breakOption, "-absolute end-0 d-flex flex-column")
|
|
50
|
-
}), children));
|
|
51
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MenuItemProps } from "./MenuItem";
|
|
2
|
-
export interface SidebarMenuItemProps extends MenuItemProps {
|
|
3
|
-
outerClass?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated `MenuItem` now has all the features of `SidebarMenuItem`. Use `MenuItem` instead.
|
|
7
|
-
* Extends `MenuItem` with following features:
|
|
8
|
-
* * Shows provided label as tooltip if sidebar is closed.
|
|
9
|
-
* * Children will be displayed on the right side of the parent item.
|
|
10
|
-
*
|
|
11
|
-
* **Important!** Set the following props to the surrounding `SidebarMenu` to provide problems with tooltips:
|
|
12
|
-
* ```jsx
|
|
13
|
-
* <SidebarMenu
|
|
14
|
-
* sidebarClass="overflow-visible"
|
|
15
|
-
* menuClass="overflow-visible"
|
|
16
|
-
* >
|
|
17
|
-
* ...
|
|
18
|
-
* </SidebarMenu>
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export default function SidebarMenuItem({ outerClass, children, onClick, ...props }: SidebarMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var _excluded = ["outerClass", "children", "onClick"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
9
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
12
|
-
import MenuItem from "./MenuItem.js";
|
|
13
|
-
import Outside from "./Outside.js";
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated `MenuItem` now has all the features of `SidebarMenuItem`. Use `MenuItem` instead.
|
|
16
|
-
* Extends `MenuItem` with following features:
|
|
17
|
-
* * Shows provided label as tooltip if sidebar is closed.
|
|
18
|
-
* * Children will be displayed on the right side of the parent item.
|
|
19
|
-
*
|
|
20
|
-
* **Important!** Set the following props to the surrounding `SidebarMenu` to provide problems with tooltips:
|
|
21
|
-
* ```jsx
|
|
22
|
-
* <SidebarMenu
|
|
23
|
-
* sidebarClass="overflow-visible"
|
|
24
|
-
* menuClass="overflow-visible"
|
|
25
|
-
* >
|
|
26
|
-
* ...
|
|
27
|
-
* </SidebarMenu>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export default function SidebarMenuItem(_ref) {
|
|
32
|
-
var _ref$outerClass = _ref.outerClass,
|
|
33
|
-
outerClass = _ref$outerClass === void 0 ? "" : _ref$outerClass,
|
|
34
|
-
children = _ref.children,
|
|
35
|
-
onClick = _ref.onClick,
|
|
36
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
var _useState = useState(false),
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
open = _useState2[0],
|
|
40
|
-
setOpen = _useState2[1];
|
|
41
|
-
var toggle = function toggle() {
|
|
42
|
-
return setOpen(!open);
|
|
43
|
-
};
|
|
44
|
-
var _useState3 = useState(0),
|
|
45
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
-
offsetTop = _useState4[0],
|
|
47
|
-
setOffsetTop = _useState4[1];
|
|
48
|
-
var menuRef = useRef(null);
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
setOpen(false);
|
|
51
|
-
}, [window.location.hash]);
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
if (menuRef && menuRef.current) {
|
|
54
|
-
setOffsetTop(menuRef.current.getBoundingClientRect().top);
|
|
55
|
-
}
|
|
56
|
-
}, [menuRef, open]);
|
|
57
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children ? /*#__PURE__*/React.createElement(Outside, {
|
|
58
|
-
className: "position-relative ".concat(outerClass),
|
|
59
|
-
onClickOutside: function onClickOutside() {
|
|
60
|
-
setOpen(false);
|
|
61
|
-
}
|
|
62
|
-
}, /*#__PURE__*/React.createElement(SidebarMenuItem, _extends({}, props, {
|
|
63
|
-
highlighted: open,
|
|
64
|
-
onClick: toggle
|
|
65
|
-
})), open && /*#__PURE__*/React.createElement("div", {
|
|
66
|
-
ref: menuRef,
|
|
67
|
-
className: ["position-absolute", "shadow", "top-0", "ms-1", "rounded", "w-bla-sidebar-width", "blue-menu-item-dropdown-from-start"].join(" "),
|
|
68
|
-
style: {
|
|
69
|
-
left: "var(--blue-sidebar-width, 3rem)",
|
|
70
|
-
maxHeight: "calc(100vh - (".concat(offsetTop, "px + 1rem))"),
|
|
71
|
-
overflowY: "auto",
|
|
72
|
-
overflowX: "hidden",
|
|
73
|
-
backgroundColor: "var(--blue-sidebar-bg)"
|
|
74
|
-
}
|
|
75
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: "blue-sidebar-state open"
|
|
77
|
-
}, children))) : /*#__PURE__*/React.createElement("div", {
|
|
78
|
-
className: "blue-tooltip-end blue-sidebar-pseudo-hidden-on-open ".concat(outerClass),
|
|
79
|
-
"data-tooltip": !props.isActive ? props.label : "",
|
|
80
|
-
title: props.isActive ? props.label : ""
|
|
81
|
-
}, /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
|
|
82
|
-
onClick: onClick
|
|
83
|
-
}))));
|
|
84
|
-
}
|