blue-react 10.0.0-rc2 → 10.0.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/README.md +46 -0
- package/dist/components/ActionMenu.js +3 -3
- package/dist/components/ActionMenuItem.js +3 -1
- package/dist/components/Header.js +10 -3
- package/dist/components/HeaderTitle.js +18 -7
- package/dist/components/Layout/LayoutHeader.js +25 -0
- package/dist/components/Layout/LayoutMain.js +17 -0
- package/dist/components/Layout.js +21 -12
- package/dist/components/LayoutHeader.js +25 -0
- package/dist/components/LayoutMain.js +17 -0
- package/dist/components/SimpleLayout.js +24 -0
- package/dist/types/components/ActionMenuItem.d.ts +2 -0
- package/dist/types/components/Header.d.ts +2 -1
- package/dist/types/components/HeaderTitle.d.ts +7 -6
- package/dist/types/components/Layout/LayoutHeader.d.ts +4 -0
- package/dist/types/components/Layout/LayoutMain.d.ts +5 -0
- package/dist/types/components/Layout.d.ts +3 -0
- package/dist/types/components/LayoutHeader.d.ts +4 -0
- package/dist/types/components/LayoutMain.d.ts +5 -0
- package/dist/types/components/Page.d.ts +2 -1
- package/dist/types/components/SimpleLayout.d.ts +11 -0
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -15,6 +15,52 @@ use Blue React.
|
|
|
15
15
|
|
|
16
16
|
Previously JS files were in type CommonJS, now they are in ESM. For projects with Webpack or CRA, take a look at this: https://stackoverflow.com/questions/70964723/webpack-5-in-ceate-react-app-cant-resolve-not-fully-specified-routes
|
|
17
17
|
|
|
18
|
+
#### Enable ESM in Webpack
|
|
19
|
+
|
|
20
|
+
Add this to the `webpack.config.js` inside the `module.rules`:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
{
|
|
24
|
+
test: /\.m?js/,
|
|
25
|
+
resolve: {
|
|
26
|
+
fullySpecified: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Enable ESM in CRA (react-scripts)
|
|
32
|
+
|
|
33
|
+
1. Install craco: `npm i -D @craco/craco`
|
|
34
|
+
2. Update the scripts inside `package.json`:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
"scripts": {
|
|
38
|
+
"start": "craco start",
|
|
39
|
+
"build": "craco build",
|
|
40
|
+
"test": "craco test",
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. Add a file called `craco.config.js` with this content:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
module.exports = {
|
|
47
|
+
webpack: {
|
|
48
|
+
configure: {
|
|
49
|
+
module: {
|
|
50
|
+
rules: [
|
|
51
|
+
{
|
|
52
|
+
test: /\.m?js$/,
|
|
53
|
+
resolve: {
|
|
54
|
+
fullySpecified: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
18
64
|
### Removed hash router from Layout
|
|
19
65
|
|
|
20
66
|
The new `Layout` no longer has a hash router. So there is no `pages` prop anymore. The router moved to its own component `HashRouter` for legacy reasons. But it's recommended to use other solutions like [React Router](https://reactrouter.com/) or [TanStack Router](https://tanstack.com/router/latest).
|
|
@@ -42,12 +42,12 @@ export default function ActionMenu(props) {
|
|
|
42
42
|
breakOption: _break
|
|
43
43
|
}
|
|
44
44
|
}, /*#__PURE__*/React.createElement(Outside, {
|
|
45
|
-
className: "blue-actions
|
|
45
|
+
className: "blue-actions ".concat(_break, " ").concat(actionsToggledIn ? "open" : "", " ").concat(className),
|
|
46
46
|
onClickOutside: function onClickOutside() {
|
|
47
47
|
setActionsToggledIn(false);
|
|
48
48
|
}
|
|
49
|
-
}, /*#__PURE__*/React.createElement("
|
|
50
|
-
className: "blue-actions-menu
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "blue-actions-menu d-flex"
|
|
51
51
|
}, validChildren.length > 0 && !actionsToggledIn && !hideToggleAction && /*#__PURE__*/React.createElement(MenuItem, {
|
|
52
52
|
className: "blue-actions-menu-toggle w-100",
|
|
53
53
|
onClick: function onClick() {
|
|
@@ -6,6 +6,8 @@ import React, { useContext } from "react";
|
|
|
6
6
|
import MenuItem from "./MenuItem";
|
|
7
7
|
import { ActionMenuContext } from "./ActionMenu";
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated Use `MenuItem` instead. Special `ActionMenu` functionality is now handles with CSS by Blue Web.
|
|
10
|
+
*
|
|
9
11
|
* Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
|
|
10
12
|
*
|
|
11
13
|
* It basically is a shortcut. Instead of writing:
|
|
@@ -41,7 +43,7 @@ export default function ActionMenuItem(_ref) {
|
|
|
41
43
|
var _useContext = useContext(ActionMenuContext),
|
|
42
44
|
breakOption = _useContext.breakOption;
|
|
43
45
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
className: "position-relative
|
|
46
|
+
className: "position-relative"
|
|
45
47
|
}, /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
|
|
46
48
|
supportOutside: true,
|
|
47
49
|
dropdownClassName: "position-".concat(breakOption, "-absolute end-0 d-flex flex-column")
|
|
@@ -1,10 +1,17 @@
|
|
|
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); }
|
|
1
5
|
import React from "react";
|
|
2
6
|
/**
|
|
3
7
|
* The top of a page.
|
|
4
8
|
*/
|
|
5
9
|
export default function Header(_ref) {
|
|
6
|
-
var children = _ref.children
|
|
7
|
-
|
|
8
|
-
className
|
|
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)")
|
|
9
16
|
}, children);
|
|
10
17
|
}
|
|
@@ -9,7 +9,6 @@ export default function HeaderTitle(_ref) {
|
|
|
9
9
|
_ref$logoAlt = _ref.logoAlt,
|
|
10
10
|
logoAlt = _ref$logoAlt === void 0 ? "Logo" : _ref$logoAlt,
|
|
11
11
|
appTitle = _ref.appTitle,
|
|
12
|
-
keepAppTitle = _ref.keepAppTitle,
|
|
13
12
|
children = _ref.children,
|
|
14
13
|
className = _ref.className,
|
|
15
14
|
sidebar = _ref.sidebar,
|
|
@@ -17,7 +16,8 @@ export default function HeaderTitle(_ref) {
|
|
|
17
16
|
elementType = _ref$elementType === void 0 ? "a" : _ref$elementType,
|
|
18
17
|
to = _ref.to,
|
|
19
18
|
_ref$href = _ref.href,
|
|
20
|
-
href = _ref$href === void 0 ? "#" : _ref$href
|
|
19
|
+
href = _ref$href === void 0 ? "#" : _ref$href,
|
|
20
|
+
breadcrumb = _ref.breadcrumb;
|
|
21
21
|
var uniqueId = "HeaderTitle-" + guid();
|
|
22
22
|
var setDocumentTitle = function setDocumentTitle() {
|
|
23
23
|
if (window.blueHashRouterRef && window.blueHashRouterRef.props && window.blueHashRouterRef.props.disableTitleSet === false) {
|
|
@@ -37,7 +37,7 @@ export default function HeaderTitle(_ref) {
|
|
|
37
37
|
useEffect(setDocumentTitle, [children]);
|
|
38
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
39
|
id: uniqueId,
|
|
40
|
-
className: "blue-header-title d-inline-flex gap-2 fw-medium align-items-center px-3 py-2
|
|
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
41
|
}, logo && /*#__PURE__*/createElement(elementType, {
|
|
42
42
|
to: to,
|
|
43
43
|
href: href
|
|
@@ -45,10 +45,21 @@ export default function HeaderTitle(_ref) {
|
|
|
45
45
|
src: logo,
|
|
46
46
|
alt: logoAlt,
|
|
47
47
|
className: "blue-header-title-image"
|
|
48
|
-
})), /*#__PURE__*/React.createElement("
|
|
49
|
-
|
|
50
|
-
},
|
|
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, {
|
|
51
55
|
to: to,
|
|
52
56
|
href: href
|
|
53
|
-
}, appTitle),
|
|
57
|
+
}, appTitle)), breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.map(function (item, index) {
|
|
58
|
+
var active = index === breadcrumb.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);
|
|
54
65
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
var _excluded = ["children", "className"];
|
|
3
|
+
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); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
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); }
|
|
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 from "react";
|
|
12
|
+
export default function LayoutHeader(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return /*#__PURE__*/React.createElement("header", _extends({
|
|
17
|
+
className: "d-flex justify-content-between position-relative h-100 ".concat(className),
|
|
18
|
+
style: _objectSpread({
|
|
19
|
+
color: "var(--blue-sidebar-color)",
|
|
20
|
+
background: "var(--blue-sidebar-bg)",
|
|
21
|
+
zIndex: "var(--blue-layout-header-z-index, 4)",
|
|
22
|
+
"--blue-menu-item-dropdown-bg": "var(--blue-sidebar-bg)"
|
|
23
|
+
}, rest.style)
|
|
24
|
+
}, rest), children);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "noPageBorder"];
|
|
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
|
+
export default function LayoutMain(_ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
className = _ref.className,
|
|
9
|
+
_ref$noPageBorder = _ref.noPageBorder,
|
|
10
|
+
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder,
|
|
11
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
13
|
+
className: "w-100 h-100 p-1 pt-0 ".concat(className)
|
|
14
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "\"w-100 h-100 overflow-auto rounded-3 ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
|
|
16
|
+
}, children));
|
|
17
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "blue-web/dist/js/side-layout";
|
|
3
|
+
import LayoutHeader from "./Layout/LayoutHeader";
|
|
4
|
+
import LayoutMain from "./Layout/LayoutMain";
|
|
3
5
|
var SideLayout = "side-layout";
|
|
6
|
+
/**
|
|
7
|
+
* A layout with header, side and main content area. Side is collapsible.
|
|
8
|
+
*/
|
|
4
9
|
export default function Layout(_ref) {
|
|
5
10
|
var children = _ref.children,
|
|
6
11
|
header = _ref.header,
|
|
@@ -8,12 +13,12 @@ export default function Layout(_ref) {
|
|
|
8
13
|
_ref$noPageBorder = _ref.noPageBorder,
|
|
9
14
|
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder;
|
|
10
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
-
|
|
12
|
-
height: "100vh"
|
|
13
|
-
}
|
|
16
|
+
className: "vh-100"
|
|
14
17
|
}, /*#__PURE__*/React.createElement(SideLayout, {
|
|
15
18
|
style: {
|
|
16
|
-
"--base-z-index": 500
|
|
19
|
+
"--base-z-index": 500,
|
|
20
|
+
"--side-width": "var(--blue-sidebar-width)",
|
|
21
|
+
"--toggler-size": "var(--blue-menu-item-height)"
|
|
17
22
|
}
|
|
18
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19
24
|
slot: "expand-toggler",
|
|
@@ -23,7 +28,10 @@ export default function Layout(_ref) {
|
|
|
23
28
|
background: "var(--blue-sidebar-bg)"
|
|
24
29
|
}
|
|
25
30
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
31
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0",
|
|
32
|
+
style: {
|
|
33
|
+
boxShadow: "var(--trigger-box-shadow)"
|
|
34
|
+
}
|
|
27
35
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
28
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29
37
|
viewBox: "0 0 16 16",
|
|
@@ -42,7 +50,10 @@ export default function Layout(_ref) {
|
|
|
42
50
|
background: "var(--blue-sidebar-bg)"
|
|
43
51
|
}
|
|
44
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
53
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0",
|
|
54
|
+
style: {
|
|
55
|
+
boxShadow: "var(--trigger-box-shadow)"
|
|
56
|
+
}
|
|
46
57
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
47
58
|
xmlns: "http://www.w3.org/2000/svg",
|
|
48
59
|
viewBox: "0 0 16 16",
|
|
@@ -61,7 +72,7 @@ export default function Layout(_ref) {
|
|
|
61
72
|
style: {
|
|
62
73
|
"--bs-bg-opacity": 0.5
|
|
63
74
|
}
|
|
64
|
-
}), /*#__PURE__*/React.createElement(
|
|
75
|
+
}), /*#__PURE__*/React.createElement(LayoutHeader, {
|
|
65
76
|
slot: "header"
|
|
66
77
|
}, header), /*#__PURE__*/React.createElement("div", {
|
|
67
78
|
slot: "side",
|
|
@@ -70,9 +81,7 @@ export default function Layout(_ref) {
|
|
|
70
81
|
color: "var(--blue-sidebar-color)",
|
|
71
82
|
background: "var(--blue-sidebar-bg)"
|
|
72
83
|
}
|
|
73
|
-
}, side), /*#__PURE__*/React.createElement(
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
className: "\"w-100 h-100 overflow-auto rounded ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
|
|
77
|
-
}, children))));
|
|
84
|
+
}, side), /*#__PURE__*/React.createElement(LayoutMain, {
|
|
85
|
+
noPageBorder: noPageBorder
|
|
86
|
+
}, children)));
|
|
78
87
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
var _excluded = ["children", "className"];
|
|
3
|
+
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); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
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); }
|
|
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 from "react";
|
|
12
|
+
export default function LayoutHeader(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return /*#__PURE__*/React.createElement("header", _extends({
|
|
17
|
+
className: "d-flex justify-content-between position-relative h-100 ".concat(className),
|
|
18
|
+
style: _objectSpread({
|
|
19
|
+
color: "var(--blue-sidebar-color)",
|
|
20
|
+
background: "var(--blue-sidebar-bg)",
|
|
21
|
+
zIndex: "var(--blue-layout-header-z-index, 4)",
|
|
22
|
+
"--blue-menu-item-dropdown-bg": "var(--blue-sidebar-bg)"
|
|
23
|
+
}, rest.style)
|
|
24
|
+
}, rest), children);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "noPageBorder"];
|
|
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
|
+
export default function LayoutMain(_ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
className = _ref.className,
|
|
9
|
+
_ref$noPageBorder = _ref.noPageBorder,
|
|
10
|
+
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder,
|
|
11
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
13
|
+
className: "w-100 h-100 p-1 pt-0 ".concat(className)
|
|
14
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "\"w-100 h-100 overflow-auto rounded-3 ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
|
|
16
|
+
}, children));
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "blue-web/dist/js/side-layout";
|
|
3
|
+
import LayoutHeader from "./Layout/LayoutHeader";
|
|
4
|
+
import LayoutMain from "./Layout/LayoutMain";
|
|
5
|
+
/**
|
|
6
|
+
* A simple layout with header and main content area.
|
|
7
|
+
*/
|
|
8
|
+
export default function SimpleLayout(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
header = _ref.header,
|
|
11
|
+
_ref$noPageBorder = _ref.noPageBorder,
|
|
12
|
+
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "vh-100 d-grid",
|
|
15
|
+
style: {
|
|
16
|
+
gridTemplateRows: "var(--blue-menu-item-height) auto"
|
|
17
|
+
}
|
|
18
|
+
}, /*#__PURE__*/React.createElement(LayoutHeader, {
|
|
19
|
+
slot: "header"
|
|
20
|
+
}, header), /*#__PURE__*/React.createElement(LayoutMain, {
|
|
21
|
+
noPageBorder: noPageBorder,
|
|
22
|
+
className: "overflow-hidden"
|
|
23
|
+
}, children));
|
|
24
|
+
}
|
|
@@ -2,6 +2,8 @@ import { MenuItemProps } from "./MenuItem";
|
|
|
2
2
|
export interface ActionMenuItemProps extends MenuItemProps {
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
|
+
* @deprecated Use `MenuItem` instead. Special `ActionMenu` functionality is now handles with CSS by Blue Web.
|
|
6
|
+
*
|
|
5
7
|
* Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
|
|
6
8
|
*
|
|
7
9
|
* It basically is a shortcut. Instead of writing:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
export interface HeaderProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
+
className?: string;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* The top of a page.
|
|
7
8
|
*/
|
|
8
|
-
export default function Header({ children }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function Header({ children, className }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
export interface HeaderTitleProps {
|
|
2
3
|
/**
|
|
3
4
|
* Can be an image. Will be placed inside of the `src` attribute.
|
|
@@ -8,11 +9,7 @@ export interface HeaderTitleProps {
|
|
|
8
9
|
* Text next to the logo.
|
|
9
10
|
*/
|
|
10
11
|
appTitle?: string;
|
|
11
|
-
|
|
12
|
-
* Disables that the app title will disappear at a specific view width.
|
|
13
|
-
*/
|
|
14
|
-
keepAppTitle?: boolean;
|
|
15
|
-
children?: any;
|
|
12
|
+
children?: ReactNode;
|
|
16
13
|
/**
|
|
17
14
|
* Extends `className` from parent element.
|
|
18
15
|
*/
|
|
@@ -31,9 +28,13 @@ export interface HeaderTitleProps {
|
|
|
31
28
|
*/
|
|
32
29
|
to?: string;
|
|
33
30
|
href?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Breadcrumb items to be shown.
|
|
33
|
+
*/
|
|
34
|
+
breadcrumb?: ReactNode[];
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* The title area at the header bar.
|
|
37
38
|
* Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
|
|
38
39
|
*/
|
|
39
|
-
export default function HeaderTitle({ logo, logoAlt, appTitle,
|
|
40
|
+
export default function HeaderTitle({ logo, logoAlt, appTitle, children, className, sidebar, elementType, to, href, breadcrumb }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface LayoutMainProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
noPageBorder?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export default function LayoutMain({ children, className, noPageBorder, ...rest }: LayoutMainProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,4 +6,7 @@ export interface LayoutProps {
|
|
|
6
6
|
side?: React.ReactNode;
|
|
7
7
|
noPageBorder?: boolean;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A layout with header, side and main content area. Side is collapsible.
|
|
11
|
+
*/
|
|
9
12
|
export default function Layout({ children, header, side, noPageBorder }: LayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface LayoutMainProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
noPageBorder?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export default function LayoutMain({ children, className, noPageBorder, ...rest }: LayoutMainProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "blue-web/dist/js/side-layout";
|
|
3
|
+
export interface SimpleLayoutProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
header?: React.ReactNode;
|
|
6
|
+
noPageBorder?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A simple layout with header and main content area.
|
|
10
|
+
*/
|
|
11
|
+
export default function SimpleLayout({ children, header, noPageBorder }: SimpleLayoutProps): import("react/jsx-runtime").JSX.Element;
|
package/index.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export { SidebarMenuProps } from "./dist/types/components/SidebarMenu"
|
|
|
61
61
|
export { default as SidebarMenuItem } from "./dist/types/components/SidebarMenuItem"
|
|
62
62
|
export { SidebarMenuItemProps } from "./dist/types/components/SidebarMenuItem"
|
|
63
63
|
|
|
64
|
+
export { default as SimpleLayout } from "./dist/types/components/SimpleLayout"
|
|
65
|
+
export { SimpleLayoutProps } from "./dist/types/components/SimpleLayout"
|
|
66
|
+
|
|
64
67
|
export { default as SlimContainer } from "./dist/types/components/SlimContainer"
|
|
65
68
|
export { SlimContainerProps } from "./dist/types/components/SlimContainer"
|
|
66
69
|
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import Page from "./dist/components/Page.js"
|
|
|
18
18
|
import Search from "./dist/components/Search.js"
|
|
19
19
|
import SidebarMenu from "./dist/components/SidebarMenu.js"
|
|
20
20
|
import SidebarMenuItem from "./dist/components/SidebarMenuItem.js"
|
|
21
|
+
import SimpleLayout from "./dist/components/SimpleLayout.js"
|
|
21
22
|
import SlimContainer from "./dist/components/SlimContainer.js"
|
|
22
23
|
import Status from "./dist/components/Status.js"
|
|
23
24
|
import { StatusProvider, useStatus } from "./dist/components/StatusProvider.js"
|
|
@@ -46,6 +47,7 @@ export {
|
|
|
46
47
|
Search,
|
|
47
48
|
SidebarMenu,
|
|
48
49
|
SidebarMenuItem,
|
|
50
|
+
SimpleLayout,
|
|
49
51
|
SlimContainer,
|
|
50
52
|
Status,
|
|
51
53
|
StatusProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blue-react",
|
|
3
|
-
"version": "10.0.0
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Blue React Components",
|
|
5
5
|
"license": "LGPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -15,26 +15,27 @@
|
|
|
15
15
|
"url": "https://github.com/bruegmann/blue-react/issues"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"start": "npm run dev",
|
|
19
20
|
"build-docs": "tsc -b && vite build --base=/blue-react/v10/ && npm run docgen",
|
|
20
21
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
21
22
|
"preview": "vite preview",
|
|
22
23
|
"build-types": "tsc -p tsconfig.app.json --declaration --emitDeclarationOnly --declarationDir ./dist/types --noEmit false --composite false",
|
|
23
24
|
"build": "babel ./src/components --out-dir ./dist/components --extensions \".tsx,.js,.ts\"",
|
|
24
25
|
"build-release": "npm run build-types && npm run build && npm run docgen",
|
|
25
|
-
"docgen": "react-docgen ./src/components/ -o ./src/docs/data/docs.json --extension tsx && node followUpDocs && npm run license-report",
|
|
26
|
+
"docgen": "react-docgen ./src/components/ --ignore Layout -o ./src/docs/data/docs.json --extension tsx && node followUpDocs && npm run license-report",
|
|
26
27
|
"test": "react-scripts test",
|
|
27
28
|
"eject": "react-scripts eject",
|
|
28
29
|
"predeploy": "npm run build-docs",
|
|
29
30
|
"deploy": "gh-pages --dist deployment --dest v10",
|
|
30
31
|
"prepublishOnly": "npm i && npm run build-release",
|
|
31
|
-
"release": "npm publish
|
|
32
|
+
"release": "npm publish && npm run deploy",
|
|
32
33
|
"prettier": "npx prettier --write .",
|
|
33
34
|
"license-report": "npx license-report --prod --output=json > ./src/docs/data/license-report.json"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@popperjs/core": "^2.11.5",
|
|
37
|
-
"blue-web": "^1.
|
|
38
|
+
"blue-web": "^1.8.0",
|
|
38
39
|
"bootstrap": "~5.3.3",
|
|
39
40
|
"clsx": "^1.1.1"
|
|
40
41
|
},
|