blue-react 10.0.0-rc1 → 10.0.0-rc3
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/README.md +50 -0
- package/dist/components/A.js +8 -23
- package/dist/components/ActionMenu.js +35 -67
- package/dist/components/ActionMenuItem.js +15 -37
- package/dist/components/Body.js +13 -27
- package/dist/components/Caret.js +6 -9
- package/dist/components/Chevron.js +14 -24
- package/dist/components/HashRouter.js +23 -66
- package/dist/components/Header.js +12 -15
- package/dist/components/HeaderTitle.js +37 -45
- package/dist/components/IconMenuItem.js +17 -33
- package/dist/components/Intro.js +12 -22
- package/dist/components/Layout.js +47 -42
- package/dist/components/MenuItem.js +41 -83
- package/dist/components/Modal.js +53 -86
- package/dist/components/ModalProvider.js +70 -125
- package/dist/components/Outside.js +13 -29
- package/dist/components/Page.js +18 -44
- package/dist/components/Search.js +47 -85
- package/dist/components/SidebarMenu.js +8 -22
- package/dist/components/SidebarMenuItem.js +34 -65
- package/dist/components/SidebarToggler.js +12 -22
- package/dist/components/SlimContainer.js +6 -16
- package/dist/components/Status.js +33 -44
- package/dist/components/StatusProvider.js +28 -65
- package/dist/components/Switch.js +17 -23
- package/dist/components/ToastProvider.js +43 -83
- package/dist/components/Utilities.js +23 -45
- package/dist/components/shared.js +1 -11
- package/dist/style.scss +1 -1
- package/dist/types/components/A.d.ts +9 -9
- package/dist/types/components/ActionMenu.d.ts +25 -25
- package/dist/types/components/ActionMenuItem.d.ts +36 -35
- package/dist/types/components/Body.d.ts +20 -21
- package/dist/types/components/Caret.d.ts +18 -18
- package/dist/types/components/Chevron.d.ts +17 -17
- package/dist/types/components/HashRouter.d.ts +76 -77
- package/dist/types/components/Header.d.ts +9 -8
- package/dist/types/components/HeaderTitle.d.ts +40 -40
- package/dist/types/components/IconMenuItem.d.ts +18 -19
- package/dist/types/components/Intro.d.ts +22 -23
- package/dist/types/components/Layout.d.ts +9 -16
- package/dist/types/components/MenuItem.d.ts +149 -149
- package/dist/types/components/Modal.d.ts +30 -30
- package/dist/types/components/ModalProvider.d.ts +21 -21
- package/dist/types/components/Outside.d.ts +17 -17
- package/dist/types/components/Page.d.ts +11 -12
- package/dist/types/components/Search.d.ts +36 -36
- package/dist/types/components/SidebarMenu.d.ts +31 -32
- package/dist/types/components/SidebarMenuItem.d.ts +21 -22
- package/dist/types/components/SidebarToggler.d.ts +10 -10
- package/dist/types/components/SlimContainer.d.ts +10 -10
- package/dist/types/components/Status.d.ts +12 -12
- package/dist/types/components/StatusProvider.d.ts +15 -15
- package/dist/types/components/Switch.d.ts +33 -33
- package/dist/types/components/ToastProvider.d.ts +22 -22
- package/dist/types/components/Utilities.d.ts +41 -41
- package/dist/types/components/shared.d.ts +15 -15
- package/index.d.ts +8 -12
- package/index.js +56 -30
- package/package.json +27 -43
- package/dist/components/ActionMenuSwitch.js +0 -44
- package/dist/components/LegacyLayout.js +0 -367
- package/dist/components/LegacySidebarMenu.js +0 -74
- package/dist/style.css +0 -11944
- package/dist/style.min.css +0 -16
- package/dist/types/components/ActionMenuSwitch.d.ts +0 -12
- package/dist/types/components/LegacyLayout.d.ts +0 -145
- package/dist/types/components/LegacySidebarMenu.d.ts +0 -33
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = Header;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
import React from "react";
|
|
12
6
|
/**
|
|
13
7
|
* The top of a page.
|
|
14
8
|
*/
|
|
15
|
-
function Header(_ref) {
|
|
16
|
-
var children = _ref.children
|
|
17
|
-
|
|
18
|
-
className
|
|
9
|
+
export default function Header(_ref) {
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
_ref$className = _ref.className,
|
|
12
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
|
13
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
14
|
+
className: "bg-body position-sticky top-0 border-bottom d-flex justify-content-between ".concat(className),
|
|
15
|
+
style: _defineProperty(_defineProperty(_defineProperty({}, "--bs-bg-opacity", 1), "--blue-menu-item-dropdown-bg", "rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity))"), "zIndex", "var(--blue-header-z-index, 3)")
|
|
19
16
|
}, children);
|
|
20
17
|
}
|
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = HeaderTitle;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _utils = require("blue-web/dist/js/utils");
|
|
13
|
-
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { guid } from "blue-web/dist/js/utils";
|
|
18
3
|
/**
|
|
19
4
|
* The title area at the header bar.
|
|
20
5
|
* Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
|
|
21
6
|
*/
|
|
22
|
-
function HeaderTitle(_ref) {
|
|
7
|
+
export default function HeaderTitle(_ref) {
|
|
23
8
|
var logo = _ref.logo,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var uniqueId = "HeaderTitle-" +
|
|
37
|
-
|
|
9
|
+
_ref$logoAlt = _ref.logoAlt,
|
|
10
|
+
logoAlt = _ref$logoAlt === void 0 ? "Logo" : _ref$logoAlt,
|
|
11
|
+
appTitle = _ref.appTitle,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
sidebar = _ref.sidebar,
|
|
15
|
+
_ref$elementType = _ref.elementType,
|
|
16
|
+
elementType = _ref$elementType === void 0 ? "a" : _ref$elementType,
|
|
17
|
+
to = _ref.to,
|
|
18
|
+
_ref$href = _ref.href,
|
|
19
|
+
href = _ref$href === void 0 ? "#" : _ref$href,
|
|
20
|
+
breadcrumbItems = _ref.breadcrumbItems;
|
|
21
|
+
var uniqueId = "HeaderTitle-" + guid();
|
|
38
22
|
var setDocumentTitle = function setDocumentTitle() {
|
|
39
23
|
if (window.blueHashRouterRef && window.blueHashRouterRef.props && window.blueHashRouterRef.props.disableTitleSet === false) {
|
|
40
24
|
var element = document.querySelector("#".concat(uniqueId, " .blue-header-title-labels"));
|
|
41
25
|
var titleElement = document.querySelector("title");
|
|
42
|
-
|
|
43
26
|
if (element && element.innerText && titleElement) {
|
|
44
27
|
var titlePaths = element.innerText.split("/");
|
|
45
|
-
|
|
46
28
|
if (titlePaths.length > 1) {
|
|
47
29
|
titleElement.innerText = "".concat(titlePaths[titlePaths.length - 1].trim(), " - ").concat(titlePaths[0].trim());
|
|
48
30
|
} else {
|
|
@@ -51,23 +33,33 @@ function HeaderTitle(_ref) {
|
|
|
51
33
|
}
|
|
52
34
|
}
|
|
53
35
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
+
useEffect(setDocumentTitle, []);
|
|
37
|
+
useEffect(setDocumentTitle, [children]);
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
39
|
id: uniqueId,
|
|
59
|
-
className: "blue-header-title d-inline-flex gap-2 fw-medium align-items-center px-3 py-2
|
|
60
|
-
}, logo && /*#__PURE__*/
|
|
40
|
+
className: "blue-header-title d-inline-flex gap-2 fw-medium align-items-center px-3 py-2" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
|
|
41
|
+
}, logo && /*#__PURE__*/createElement(elementType, {
|
|
61
42
|
to: to,
|
|
62
43
|
href: href
|
|
63
|
-
}, /*#__PURE__*/
|
|
44
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
64
45
|
src: logo,
|
|
65
46
|
alt: logoAlt,
|
|
66
47
|
className: "blue-header-title-image"
|
|
67
|
-
})), /*#__PURE__*/
|
|
68
|
-
|
|
69
|
-
},
|
|
48
|
+
})), /*#__PURE__*/React.createElement("nav", {
|
|
49
|
+
"aria-label": "breadcrumb"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("ol", {
|
|
51
|
+
className: "breadcrumb mb-0"
|
|
52
|
+
}, appTitle !== undefined && appTitle !== "" && /*#__PURE__*/React.createElement("li", {
|
|
53
|
+
className: "breadcrumb-item"
|
|
54
|
+
}, /*#__PURE__*/createElement(elementType, {
|
|
70
55
|
to: to,
|
|
71
56
|
href: href
|
|
72
|
-
}, appTitle),
|
|
57
|
+
}, appTitle)), breadcrumbItems === null || breadcrumbItems === void 0 ? void 0 : breadcrumbItems.map(function (item, index) {
|
|
58
|
+
var active = index === breadcrumbItems.length - 1;
|
|
59
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
60
|
+
key: index,
|
|
61
|
+
className: "breadcrumb-item ".concat(active ? "active" : ""),
|
|
62
|
+
"aria-current": active ? "page" : undefined
|
|
63
|
+
}, item);
|
|
64
|
+
}))), children);
|
|
73
65
|
}
|
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = IconMenuItem;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
|
|
11
|
-
|
|
12
1
|
var _excluded = ["label", "outerClass", "tooltipClass", "horizontalOnOpenSidebar", "className"];
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
-
|
|
20
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
-
|
|
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 from "react";
|
|
6
|
+
import MenuItem from "./MenuItem";
|
|
22
7
|
/**
|
|
23
8
|
* Variant of `MenuItem` to primarily display an icon without a label.
|
|
24
9
|
* The label prop will be displayed as a tooltip.
|
|
25
10
|
*/
|
|
26
|
-
function IconMenuItem(_ref) {
|
|
11
|
+
export default function IconMenuItem(_ref) {
|
|
27
12
|
var label = _ref.label,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
|
+
_ref$outerClass = _ref.outerClass,
|
|
14
|
+
outerClass = _ref$outerClass === void 0 ? "" : _ref$outerClass,
|
|
15
|
+
_ref$tooltipClass = _ref.tooltipClass,
|
|
16
|
+
tooltipClass = _ref$tooltipClass === void 0 ? "blue-tooltip-end" : _ref$tooltipClass,
|
|
17
|
+
_ref$horizontalOnOpen = _ref.horizontalOnOpenSidebar,
|
|
18
|
+
horizontalOnOpenSidebar = _ref$horizontalOnOpen === void 0 ? true : _ref$horizontalOnOpen,
|
|
19
|
+
_ref$className = _ref.className,
|
|
20
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
23
|
className: "".concat(tooltipClass, " ").concat(horizontalOnOpenSidebar ? "blue-sidebar-menu-horizontal-on-open" : "", " ").concat(outerClass),
|
|
40
24
|
"data-tooltip": label
|
|
41
|
-
}, /*#__PURE__*/
|
|
25
|
+
}, /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
|
|
42
26
|
className: "".concat(className, " w-100"),
|
|
43
27
|
iconClassName: "w-100"
|
|
44
28
|
})));
|
package/dist/components/Intro.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = Intro;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
1
|
+
import React from "react";
|
|
12
2
|
/**
|
|
13
3
|
* Can be used for a sign-in page.
|
|
14
4
|
*/
|
|
15
|
-
function Intro(_ref) {
|
|
5
|
+
export default function Intro(_ref) {
|
|
16
6
|
var logo = _ref.logo,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /*#__PURE__*/
|
|
7
|
+
_ref$logoMaxWidth = _ref.logoMaxWidth,
|
|
8
|
+
logoMaxWidth = _ref$logoMaxWidth === void 0 ? "100px" : _ref$logoMaxWidth,
|
|
9
|
+
title = _ref.title,
|
|
10
|
+
children = _ref.children;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
12
|
className: "sign-in-screen"
|
|
23
|
-
}, /*#__PURE__*/
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
14
|
className: "sign-in-container mx-1"
|
|
25
|
-
}, /*#__PURE__*/
|
|
15
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
16
|
className: "bg-body rounded-3 shadow-lg px-4 py-5"
|
|
27
|
-
}, /*#__PURE__*/
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
18
|
className: "text-center"
|
|
29
|
-
}, /*#__PURE__*/
|
|
19
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
30
20
|
style: {
|
|
31
21
|
maxWidth: logoMaxWidth
|
|
32
22
|
},
|
|
33
23
|
src: logo,
|
|
34
24
|
alt: ""
|
|
35
|
-
}), /*#__PURE__*/
|
|
25
|
+
}), /*#__PURE__*/React.createElement("h2", {
|
|
36
26
|
className: "mt-4 mb-3"
|
|
37
27
|
}, title)), children)));
|
|
38
28
|
}
|
|
@@ -1,86 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = Layout;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
require("blue-web/dist/js/side-layout");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function Layout(_ref) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "blue-web/dist/js/side-layout";
|
|
3
|
+
var SideLayout = "side-layout";
|
|
4
|
+
export default function Layout(_ref) {
|
|
15
5
|
var children = _ref.children,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return /*#__PURE__*/
|
|
6
|
+
header = _ref.header,
|
|
7
|
+
side = _ref.side,
|
|
8
|
+
_ref$noPageBorder = _ref.noPageBorder,
|
|
9
|
+
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "vh-100"
|
|
12
|
+
}, /*#__PURE__*/React.createElement(SideLayout, {
|
|
21
13
|
style: {
|
|
22
|
-
|
|
14
|
+
"--base-z-index": 500,
|
|
15
|
+
"--side-width": "var(--blue-sidebar-width)",
|
|
16
|
+
"--toggler-size": "var(--blue-menu-item-height)"
|
|
23
17
|
}
|
|
24
|
-
}, /*#__PURE__*/
|
|
25
|
-
style: {
|
|
26
|
-
"--base-z-index": 500
|
|
27
|
-
}
|
|
28
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
19
|
slot: "expand-toggler",
|
|
30
20
|
className: "w-100 h-100",
|
|
31
21
|
style: {
|
|
32
22
|
color: "var(--blue-sidebar-color)",
|
|
33
23
|
background: "var(--blue-sidebar-bg)"
|
|
34
24
|
}
|
|
35
|
-
}, /*#__PURE__*/
|
|
36
|
-
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
37
|
-
|
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0",
|
|
27
|
+
style: {
|
|
28
|
+
boxShadow: "var(--trigger-box-shadow)"
|
|
29
|
+
}
|
|
30
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
38
31
|
xmlns: "http://www.w3.org/2000/svg",
|
|
39
32
|
viewBox: "0 0 16 16",
|
|
33
|
+
"aria-hidden": "true",
|
|
40
34
|
width: "1em",
|
|
41
35
|
height: "1em",
|
|
42
36
|
fill: "currentColor",
|
|
43
37
|
className: "bi bi-layout-sidebar"
|
|
44
|
-
}, /*#__PURE__*/
|
|
38
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
45
39
|
d: "M0 3a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm5-1v12h9a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1zM4 2H2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h2z"
|
|
46
|
-
})))), /*#__PURE__*/
|
|
40
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
47
41
|
slot: "drawer-toggler",
|
|
48
42
|
className: "w-100 h-100",
|
|
49
43
|
style: {
|
|
50
44
|
color: "var(--blue-sidebar-color)",
|
|
51
45
|
background: "var(--blue-sidebar-bg)"
|
|
52
46
|
}
|
|
53
|
-
}, /*#__PURE__*/
|
|
54
|
-
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
55
|
-
|
|
47
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0",
|
|
49
|
+
style: {
|
|
50
|
+
boxShadow: "var(--trigger-box-shadow)"
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
56
53
|
xmlns: "http://www.w3.org/2000/svg",
|
|
57
54
|
viewBox: "0 0 16 16",
|
|
55
|
+
"aria-hidden": "true",
|
|
58
56
|
width: "1em",
|
|
59
57
|
height: "1em",
|
|
60
58
|
fill: "currentColor",
|
|
61
59
|
className: "bi bi-layout-sidebar-inset"
|
|
62
|
-
}, /*#__PURE__*/
|
|
60
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
63
61
|
d: "M14 2a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2z"
|
|
64
|
-
}), /*#__PURE__*/
|
|
62
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
65
63
|
d: "M3 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"
|
|
66
|
-
})))), /*#__PURE__*/
|
|
64
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
67
65
|
slot: "overlay",
|
|
68
66
|
className: "bg-dark w-100 h-100",
|
|
69
67
|
style: {
|
|
70
68
|
"--bs-bg-opacity": 0.5
|
|
71
69
|
}
|
|
72
|
-
}), /*#__PURE__*/
|
|
70
|
+
}), /*#__PURE__*/React.createElement("header", {
|
|
71
|
+
className: "d-flex justify-content-between position-relative h-100",
|
|
72
|
+
style: {
|
|
73
|
+
color: "var(--blue-sidebar-color)",
|
|
74
|
+
background: "var(--blue-sidebar-bg)",
|
|
75
|
+
zIndex: "var(--blue-layout-header-z-index, 4)",
|
|
76
|
+
"--blue-menu-item-dropdown-bg": "var(--blue-sidebar-bg)"
|
|
77
|
+
},
|
|
73
78
|
slot: "header"
|
|
74
|
-
}, header), /*#__PURE__*/
|
|
79
|
+
}, header), /*#__PURE__*/React.createElement("div", {
|
|
75
80
|
slot: "side",
|
|
76
81
|
className: "overflow-x-hidden overflow-y-auto h-100",
|
|
77
82
|
style: {
|
|
78
83
|
color: "var(--blue-sidebar-color)",
|
|
79
84
|
background: "var(--blue-sidebar-bg)"
|
|
80
85
|
}
|
|
81
|
-
}, side), /*#__PURE__*/
|
|
82
|
-
className: "w-100 h-100 p-1"
|
|
83
|
-
}, /*#__PURE__*/
|
|
84
|
-
className: "\"w-100 h-100 overflow-auto rounded ".concat(
|
|
86
|
+
}, side), /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "w-100 h-100 p-1 pt-0"
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "\"w-100 h-100 overflow-auto rounded-3 ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
|
|
85
90
|
}, children))));
|
|
86
91
|
}
|
|
@@ -1,90 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = MenuItem;
|
|
9
|
-
|
|
10
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
|
-
var _Outside = _interopRequireDefault(require("./Outside"));
|
|
15
|
-
|
|
16
|
-
var _Chevron = _interopRequireDefault(require("./Chevron"));
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
-
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
26
2
|
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."); }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import React, { createElement, useEffect, useRef, useState } from "react";
|
|
9
|
+
import Outside from "./Outside";
|
|
10
|
+
import Chevron from "./Chevron";
|
|
36
11
|
function findParentWithClass(element, className) {
|
|
37
12
|
while (element && !element.classList.contains(className)) {
|
|
38
13
|
element = element.parentElement;
|
|
39
14
|
}
|
|
40
|
-
|
|
41
15
|
return element;
|
|
42
16
|
}
|
|
43
|
-
|
|
44
17
|
/**
|
|
45
18
|
* Link, button or custom component for Sidebar, Actions or ActionMenu
|
|
46
19
|
*/
|
|
47
|
-
function MenuItem(props) {
|
|
20
|
+
export default function MenuItem(props) {
|
|
48
21
|
var id = "blue-menu-item-wrapper-".concat(Math.random().toString(36).substring(7));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
setActive = _useState4[1];
|
|
59
|
-
|
|
60
|
-
var menuRef = (0, _react.useRef)(null);
|
|
61
|
-
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
showDropdown = _useState2[0],
|
|
25
|
+
setShowDropdown = _useState2[1];
|
|
26
|
+
var _useState3 = useState(false),
|
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
|
+
active = _useState4[0],
|
|
29
|
+
setActive = _useState4[1];
|
|
30
|
+
var menuRef = useRef(null);
|
|
62
31
|
var checkActive = function checkActive() {
|
|
63
32
|
setActive(props.href && window.location.hash.indexOf(props.href) > -1 || props.isHome && (window.location.hash === "" || window.location.hash === "#/") ? true : false);
|
|
64
33
|
};
|
|
65
|
-
|
|
66
34
|
var onClick = function onClick(event) {
|
|
67
35
|
if (props.href === "#") {
|
|
68
36
|
event.preventDefault();
|
|
69
37
|
}
|
|
70
|
-
|
|
71
38
|
if (props.onClick) {
|
|
72
39
|
props.onClick(event);
|
|
73
40
|
}
|
|
74
|
-
|
|
75
41
|
if (props.children) {
|
|
76
42
|
setShowDropdown(!showDropdown);
|
|
77
43
|
}
|
|
78
|
-
|
|
79
44
|
if (props.onClickAttached !== undefined) {
|
|
80
45
|
props.onClickAttached(event);
|
|
81
46
|
}
|
|
82
47
|
};
|
|
83
|
-
|
|
84
48
|
var onClickOutside = function onClickOutside(_ref) {
|
|
85
49
|
var target = _ref.target;
|
|
86
50
|
var ignoreClasses = props.outsideIgnoreClasses || [id];
|
|
87
|
-
|
|
88
51
|
if (ignoreClasses && target) {
|
|
89
52
|
for (var i = 0; i < ignoreClasses.length; i++) {
|
|
90
53
|
if (target !== null && target !== void 0 && target.classList.contains(ignoreClasses[i]) || findParentWithClass(target, ignoreClasses[i])) {
|
|
@@ -92,25 +55,23 @@ function MenuItem(props) {
|
|
|
92
55
|
}
|
|
93
56
|
}
|
|
94
57
|
}
|
|
95
|
-
|
|
96
58
|
setShowDropdown(false);
|
|
97
59
|
};
|
|
98
|
-
|
|
99
|
-
(0, _react.useEffect)(function () {
|
|
60
|
+
useEffect(function () {
|
|
100
61
|
checkActive();
|
|
101
62
|
window.addEventListener("hashchange", function () {
|
|
102
63
|
checkActive();
|
|
103
64
|
});
|
|
104
65
|
}, []);
|
|
105
|
-
|
|
66
|
+
useEffect(function () {
|
|
106
67
|
if (props.showDropdown !== undefined) setShowDropdown(props.showDropdown);
|
|
107
68
|
}, [props.showDropdown]);
|
|
108
|
-
|
|
69
|
+
useEffect(function () {
|
|
109
70
|
if (props.onShowDropdown) {
|
|
110
71
|
props.onShowDropdown(showDropdown);
|
|
111
72
|
}
|
|
112
73
|
}, [props.onShowDropdown, showDropdown]);
|
|
113
|
-
|
|
74
|
+
useEffect(function () {
|
|
114
75
|
if (menuRef && menuRef.current) {
|
|
115
76
|
var el = menuRef.current;
|
|
116
77
|
var rect = el.getBoundingClientRect();
|
|
@@ -119,30 +80,27 @@ function MenuItem(props) {
|
|
|
119
80
|
}, [menuRef, showDropdown]);
|
|
120
81
|
var className = "blue-menu-item btn" + (props.isActive ? " active" : "") + (props.className ? " " + props.className : "") + (props.children ? " blue-menu-item-dropdown-toggle w-100" : "") + (props.highlighted ? " highlighted" : "");
|
|
121
82
|
var icon, iconForActive;
|
|
122
|
-
|
|
123
83
|
if (typeof props.icon === "string") {
|
|
124
84
|
// is className
|
|
125
|
-
icon = /*#__PURE__*/
|
|
85
|
+
icon = /*#__PURE__*/React.createElement("span", {
|
|
126
86
|
className: props.icon + (props.children ? " blue-menu-item-dropdown-icon" : "")
|
|
127
87
|
});
|
|
128
88
|
} else {
|
|
129
89
|
// is element / component
|
|
130
90
|
icon = props.icon;
|
|
131
91
|
}
|
|
132
|
-
|
|
133
92
|
if (typeof props.iconForActive === "string") {
|
|
134
93
|
// is className
|
|
135
|
-
iconForActive = /*#__PURE__*/
|
|
94
|
+
iconForActive = /*#__PURE__*/React.createElement("span", {
|
|
136
95
|
className: props.iconForActive + (props.children ? " blue-menu-item-dropdown-icon" : "")
|
|
137
96
|
});
|
|
138
97
|
} else {
|
|
139
98
|
// is element / component
|
|
140
99
|
iconForActive = props.iconForActive;
|
|
141
100
|
}
|
|
142
|
-
|
|
143
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
144
102
|
className: "blue-menu-item-wrapper ".concat(id)
|
|
145
|
-
}, /*#__PURE__*/
|
|
103
|
+
}, /*#__PURE__*/createElement(props.elementType || (props.href ? "a" : "button"), {
|
|
146
104
|
to: props.to,
|
|
147
105
|
href: props.href,
|
|
148
106
|
exact: props.exact,
|
|
@@ -164,36 +122,36 @@ function MenuItem(props) {
|
|
|
164
122
|
style: props.style,
|
|
165
123
|
type: props.type,
|
|
166
124
|
id: props.id
|
|
167
|
-
}, /*#__PURE__*/
|
|
125
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, props.draggable && props.hideDraggableIcon !== true && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
|
|
168
126
|
xmlns: "http://www.w3.org/2000/svg",
|
|
169
127
|
width: ".5em",
|
|
170
128
|
height: "1em",
|
|
171
129
|
fill: "currentColor",
|
|
172
130
|
className: "bi bi-grip-vertical opacity-50",
|
|
173
131
|
viewBox: "0 0 8 16"
|
|
174
|
-
}, /*#__PURE__*/
|
|
132
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
175
133
|
d: "M3.376 1.876c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m3 0c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m-3 3c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m3 0c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m-3 3c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m3 0c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m-3 3c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m3 0c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m-3 3c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1m3 0c0 .55-.45 1-1 1-.549 0-1-.45-1-1 0-.549.451-1 1-1 .55 0 1 .451 1 1"
|
|
176
|
-
})), " "), props.icon !== undefined && /*#__PURE__*/
|
|
177
|
-
className: (
|
|
134
|
+
})), " "), props.icon !== undefined && /*#__PURE__*/React.createElement("span", {
|
|
135
|
+
className: clsx("blue-menu-item-icon", props.iconClassName, {
|
|
178
136
|
hasIconForActive: iconForActive
|
|
179
137
|
})
|
|
180
|
-
}, icon), iconForActive && /*#__PURE__*/
|
|
181
|
-
className: (
|
|
182
|
-
}, iconForActive), props.label && /*#__PURE__*/
|
|
183
|
-
className: (
|
|
184
|
-
}, props.label), props.children && /*#__PURE__*/
|
|
138
|
+
}, icon), iconForActive && /*#__PURE__*/React.createElement("span", {
|
|
139
|
+
className: clsx("blue-menu-item-icon iconForActive", props.iconClassName)
|
|
140
|
+
}, iconForActive), props.label && /*#__PURE__*/React.createElement("span", {
|
|
141
|
+
className: clsx("blue-menu-item-label text-truncate", props.labelClassName)
|
|
142
|
+
}, props.label), props.children && /*#__PURE__*/React.createElement(Chevron, {
|
|
185
143
|
open: showDropdown,
|
|
186
144
|
mirrored: true,
|
|
187
|
-
className: (
|
|
145
|
+
className: clsx("blue-menu-item-dropdown-caret ms-auto", props.caretClassName),
|
|
188
146
|
style: props.caretStyle
|
|
189
|
-
}))), showDropdown && (props.supportOutside ? /*#__PURE__*/
|
|
147
|
+
}))), showDropdown && (props.supportOutside ? /*#__PURE__*/React.createElement(Outside, {
|
|
190
148
|
wrapperRef: menuRef,
|
|
191
|
-
className: (
|
|
149
|
+
className: clsx("blue-menu-item-dropdown", props.dropdownClassName),
|
|
192
150
|
onClickOutside: onClickOutside,
|
|
193
151
|
style: props.dropdownStyle
|
|
194
|
-
}, props.children) : /*#__PURE__*/
|
|
152
|
+
}, props.children) : /*#__PURE__*/React.createElement("div", {
|
|
195
153
|
ref: menuRef,
|
|
196
|
-
className: (
|
|
154
|
+
className: clsx("blue-menu-item-dropdown", props.dropdownClassName),
|
|
197
155
|
style: props.dropdownStyle
|
|
198
156
|
}, props.children)));
|
|
199
157
|
}
|