blue-react 10.0.0-rc2 → 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 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 navbar ".concat(className, " navbar-expand").concat(_break !== "none" ? "-".concat(_break) : "", " ").concat(_break, " ").concat(actionsToggledIn ? "open" : ""),
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("ul", {
50
- className: "blue-actions-menu nav navbar-nav navbar-right"
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 z-1"
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
- return /*#__PURE__*/React.createElement("div", {
8
- className: "blue-header blue-header-extension"
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
+ breadcrumbItems = _ref.breadcrumbItems;
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 position-absolute z-1" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
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("span", {
49
- className: "blue-header-title-labels " + (keepAppTitle ? "keep" : "")
50
- }, appTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createElement(elementType, {
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), " ", children ? "/" : "", "\xA0"), children));
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);
54
65
  }
@@ -8,12 +8,12 @@ export default function Layout(_ref) {
8
8
  _ref$noPageBorder = _ref.noPageBorder,
9
9
  noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder;
10
10
  return /*#__PURE__*/React.createElement("div", {
11
- style: {
12
- height: "100vh"
13
- }
11
+ className: "vh-100"
14
12
  }, /*#__PURE__*/React.createElement(SideLayout, {
15
13
  style: {
16
- "--base-z-index": 500
14
+ "--base-z-index": 500,
15
+ "--side-width": "var(--blue-sidebar-width)",
16
+ "--toggler-size": "var(--blue-menu-item-height)"
17
17
  }
18
18
  }, /*#__PURE__*/React.createElement("div", {
19
19
  slot: "expand-toggler",
@@ -23,7 +23,10 @@ export default function Layout(_ref) {
23
23
  background: "var(--blue-sidebar-bg)"
24
24
  }
25
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"
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
+ }
27
30
  }, /*#__PURE__*/React.createElement("svg", {
28
31
  xmlns: "http://www.w3.org/2000/svg",
29
32
  viewBox: "0 0 16 16",
@@ -42,7 +45,10 @@ export default function Layout(_ref) {
42
45
  background: "var(--blue-sidebar-bg)"
43
46
  }
44
47
  }, /*#__PURE__*/React.createElement("div", {
45
- className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
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
+ }
46
52
  }, /*#__PURE__*/React.createElement("svg", {
47
53
  xmlns: "http://www.w3.org/2000/svg",
48
54
  viewBox: "0 0 16 16",
@@ -62,6 +68,13 @@ export default function Layout(_ref) {
62
68
  "--bs-bg-opacity": 0.5
63
69
  }
64
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
+ },
65
78
  slot: "header"
66
79
  }, header), /*#__PURE__*/React.createElement("div", {
67
80
  slot: "side",
@@ -71,8 +84,8 @@ export default function Layout(_ref) {
71
84
  background: "var(--blue-sidebar-bg)"
72
85
  }
73
86
  }, side), /*#__PURE__*/React.createElement("div", {
74
- className: "w-100 h-100 p-1"
87
+ className: "w-100 h-100 p-1 pt-0"
75
88
  }, /*#__PURE__*/React.createElement("div", {
76
- className: "\"w-100 h-100 overflow-auto rounded ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
89
+ className: "\"w-100 h-100 overflow-auto rounded-3 ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
77
90
  }, children))));
78
91
  }
@@ -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
+ breadcrumbItems?: 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, keepAppTitle, children, className, sidebar, elementType, to, href }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
40
+ export default function HeaderTitle({ logo, logoAlt, appTitle, children, className, sidebar, elementType, to, href, breadcrumbItems }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blue-react",
3
- "version": "10.0.0-rc2",
3
+ "version": "10.0.0-rc3",
4
4
  "description": "Blue React Components",
5
5
  "license": "LGPL-3.0-or-later",
6
6
  "type": "module",
@@ -15,7 +15,8 @@
15
15
  "url": "https://github.com/bruegmann/blue-react/issues"
16
16
  },
17
17
  "scripts": {
18
- "start": "vite",
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",
@@ -34,7 +35,7 @@
34
35
  },
35
36
  "dependencies": {
36
37
  "@popperjs/core": "^2.11.5",
37
- "blue-web": "^1.7.0",
38
+ "blue-web": "^1.8.0",
38
39
  "bootstrap": "~5.3.3",
39
40
  "clsx": "^1.1.1"
40
41
  },