blue-react 10.1.3 → 11.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 +41 -84
- package/dist/components/A.js +13 -6
- package/dist/components/ActionMenu.d.ts +1 -0
- package/dist/components/ActionMenu.js +28 -22
- package/dist/components/Actions.d.ts +16 -0
- package/dist/components/Actions.js +68 -0
- package/dist/components/Button.d.ts +31 -0
- package/dist/components/Button.js +119 -0
- package/dist/components/Chevron.js +11 -9
- package/dist/components/HashRouter.js +9 -6
- package/dist/components/Header.js +5 -3
- package/dist/components/HeaderTitle.js +31 -26
- package/dist/components/IconMenuItem.d.ts +2 -2
- package/dist/components/IconMenuItem.js +17 -10
- package/dist/components/Intro.js +23 -17
- package/dist/components/Layout.d.ts +4 -2
- package/dist/components/Layout.js +83 -74
- package/dist/components/LegacyMenuItem.d.ts +150 -0
- package/dist/components/LegacyMenuItem.js +170 -0
- package/dist/components/MenuItem.d.ts +13 -149
- package/dist/components/MenuItem.js +168 -153
- package/dist/components/Modal.js +62 -49
- package/dist/components/ModalProvider.js +43 -35
- package/dist/components/Outside.js +5 -3
- package/dist/components/Search.js +69 -60
- package/dist/components/SidebarMenu.js +9 -6
- package/dist/components/SimpleLayout.d.ts +4 -2
- package/dist/components/SimpleLayout.js +20 -13
- package/dist/components/SlimContainer.js +8 -5
- package/dist/components/Status.js +56 -40
- package/dist/components/StatusProvider.js +22 -14
- package/dist/components/Tab.js +28 -19
- package/dist/components/Tabs.js +8 -5
- package/dist/components/ToastProvider.js +55 -44
- package/dist/components/shared.js +5 -1
- package/dist/style.css +16286 -0
- package/dist/style.min.css +12 -0
- package/index.d.ts +5 -5
- package/index.js +4 -2
- package/package.json +14 -12
- package/dist/components/Body.d.ts +0 -21
- package/dist/components/Body.js +0 -25
- package/dist/components/Layout/LayoutHeader.d.ts +0 -4
- package/dist/components/Layout/LayoutHeader.js +0 -25
- package/dist/components/Layout/LayoutMain.d.ts +0 -5
- package/dist/components/Layout/LayoutMain.js +0 -17
- package/dist/components/Page.d.ts +0 -13
- package/dist/components/Page.js +0 -39
- package/dist/components/SidebarToggler.d.ts +0 -11
- package/dist/components/SidebarToggler.js +0 -24
package/README.md
CHANGED
|
@@ -9,90 +9,47 @@
|
|
|
9
9
|
[Checkout the docs](https://bruegmann.github.io/blue-react) to find out how to
|
|
10
10
|
use Blue React.
|
|
11
11
|
|
|
12
|
-
## Breaking changes between
|
|
13
|
-
|
|
14
|
-
###
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
resolve: {
|
|
54
|
-
fullySpecified: false
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Removed hash router from Layout
|
|
65
|
-
|
|
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).
|
|
67
|
-
|
|
68
|
-
### Move side content to `side` prop
|
|
69
|
-
|
|
70
|
-
It should look like this:
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
<Layout
|
|
74
|
-
side={
|
|
75
|
-
<SidebarMenu>
|
|
76
|
-
<MenuItem href="." label="Home" />
|
|
77
|
-
</SidebarMenu>
|
|
78
|
-
}
|
|
79
|
-
>
|
|
80
|
-
Your page content
|
|
81
|
-
</Layout>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Removed HTML elements for status
|
|
85
|
-
|
|
86
|
-
If you use util functions for status like `showSuccess()` or `setAlertMessage()` you need to embed the `Status` React component like this:
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
<Status
|
|
90
|
-
dangerIcon={<XCircleFill />}
|
|
91
|
-
infoIcon={<InfoCircleFill />}
|
|
92
|
-
successIcon={<CheckCircleFill />}
|
|
93
|
-
warningIcon={<ExclamationCircleFill />}
|
|
94
|
-
/>
|
|
95
|
-
```
|
|
12
|
+
## Breaking changes between v10 and v11
|
|
13
|
+
|
|
14
|
+
### Fundamental changes in `MenuItem`
|
|
15
|
+
|
|
16
|
+
- Removed props
|
|
17
|
+
- onClickAttached
|
|
18
|
+
- iconClassName
|
|
19
|
+
- labelClassName
|
|
20
|
+
- caretClassName
|
|
21
|
+
- caretStyle
|
|
22
|
+
- isHome
|
|
23
|
+
- dropdownClassName
|
|
24
|
+
- dropdownStyle
|
|
25
|
+
- showDropdown
|
|
26
|
+
- onShowDropdown
|
|
27
|
+
- supportOutside
|
|
28
|
+
- outsideIgnoreClasses
|
|
29
|
+
- Renamed
|
|
30
|
+
- iconForActive -> iconForCurrent
|
|
31
|
+
- isActive -> current
|
|
32
|
+
- highlighted -> active
|
|
33
|
+
- Changed behviour. Menu item no longer has built in styling if `draggable`. But since Menu item extends HTML Button or A element, props `draggable`, `onDragStart` etc. should still work.
|
|
34
|
+
- Added
|
|
35
|
+
- sm
|
|
36
|
+
- lg
|
|
37
|
+
- iconBefore
|
|
38
|
+
- iconAfter
|
|
39
|
+
- labelHidden
|
|
40
|
+
- busy
|
|
41
|
+
- success
|
|
42
|
+
- defaultDisplay
|
|
43
|
+
- buttonContent
|
|
44
|
+
- as
|
|
45
|
+
|
|
46
|
+
The previous Menu Item with the older API is still available as `LegacyMenuItem`, but will be removed in a future release. Because of styling changes in Blue Web, it might not behave the same.
|
|
47
|
+
|
|
48
|
+
### Removed deprecated components
|
|
49
|
+
|
|
50
|
+
- Body
|
|
51
|
+
- Page
|
|
52
|
+
- SidebarToggler
|
|
96
53
|
|
|
97
54
|
## Developing
|
|
98
55
|
|
package/dist/components/A.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
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); }
|
|
1
2
|
var _excluded = ["children", "rel"];
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
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); }
|
|
8
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
10
|
import React from "react";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
12
|
/**
|
|
7
13
|
* The `<a>` element automatically sets `rel="noreferrer"` for external links with `target="_blank"`.\
|
|
8
14
|
* `A` allows all props of the `<a>` element.\
|
|
@@ -12,7 +18,8 @@ export default function A(_ref) {
|
|
|
12
18
|
var children = _ref.children,
|
|
13
19
|
rel = _ref.rel,
|
|
14
20
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
return /*#__PURE__*/
|
|
16
|
-
rel: "".concat(rel ? "".concat(rel, " ") : "").concat(rest.target === "_blank" ? "noreferrer" : "")
|
|
17
|
-
|
|
21
|
+
return /*#__PURE__*/_jsx("a", _objectSpread(_objectSpread({}, rest), {}, {
|
|
22
|
+
rel: "".concat(rel ? "".concat(rel, " ") : "").concat(rest.target === "_blank" ? "noreferrer" : ""),
|
|
23
|
+
children: children
|
|
24
|
+
}));
|
|
18
25
|
}
|
|
@@ -20,6 +20,7 @@ export interface ActionMenuProps {
|
|
|
20
20
|
break?: breakOption | "none";
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
+
* @deprecated Use the new `Actions` instead, which is more flexible.
|
|
23
24
|
* The Action Menu on the top right of a page. You can place Actions here which are in context of the current page.
|
|
24
25
|
*/
|
|
25
26
|
export default function ActionMenu(props: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,12 +5,14 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
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
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
7
|
import React, { Children, createContext, useState } from "react";
|
|
8
|
-
import MenuItem from "./
|
|
8
|
+
import MenuItem from "./LegacyMenuItem.js";
|
|
9
9
|
import Outside from "./Outside.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
export var ActionMenuContext = /*#__PURE__*/createContext({
|
|
11
12
|
breakOption: "lg"
|
|
12
13
|
});
|
|
13
14
|
/**
|
|
15
|
+
* @deprecated Use the new `Actions` instead, which is more flexible.
|
|
14
16
|
* The Action Menu on the top right of a page. You can place Actions here which are in context of the current page.
|
|
15
17
|
*/
|
|
16
18
|
export default function ActionMenu(props) {
|
|
@@ -18,16 +20,17 @@ export default function ActionMenu(props) {
|
|
|
18
20
|
children = props.children,
|
|
19
21
|
className = props.className,
|
|
20
22
|
_props$toggleIcon = props.toggleIcon,
|
|
21
|
-
toggleIcon = _props$toggleIcon === void 0 ? /*#__PURE__*/
|
|
23
|
+
toggleIcon = _props$toggleIcon === void 0 ? /*#__PURE__*/_jsx("svg", {
|
|
22
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23
25
|
width: "16",
|
|
24
26
|
height: "16",
|
|
25
27
|
fill: "currentColor",
|
|
26
28
|
className: "bi bi-three-dots-vertical",
|
|
27
|
-
viewBox: "0 0 16 16"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
viewBox: "0 0 16 16",
|
|
30
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
31
|
+
d: "M9.5 13a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0-5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0-5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"
|
|
32
|
+
})
|
|
33
|
+
}) : _props$toggleIcon;
|
|
31
34
|
var _break = props["break"] || "lg";
|
|
32
35
|
var _useState = useState(false),
|
|
33
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -37,23 +40,26 @@ export default function ActionMenu(props) {
|
|
|
37
40
|
return setActionsToggledIn(!actionsToggledIn);
|
|
38
41
|
};
|
|
39
42
|
var validChildren = Children.toArray(children).filter(Boolean);
|
|
40
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_jsx(ActionMenuContext.Provider, {
|
|
41
44
|
value: {
|
|
42
45
|
breakOption: _break
|
|
43
|
-
}
|
|
44
|
-
}, /*#__PURE__*/React.createElement(Outside, {
|
|
45
|
-
className: "blue-actions ".concat(_break, " ").concat(actionsToggledIn ? "open" : "", " ").concat(className),
|
|
46
|
-
onClickOutside: function onClickOutside() {
|
|
47
|
-
setActionsToggledIn(false);
|
|
48
|
-
}
|
|
49
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
-
className: "blue-actions-menu d-flex"
|
|
51
|
-
}, validChildren.length > 0 && !actionsToggledIn && !hideToggleAction && /*#__PURE__*/React.createElement(MenuItem, {
|
|
52
|
-
className: "blue-actions-menu-toggle w-100",
|
|
53
|
-
onClick: function onClick() {
|
|
54
|
-
return toggleActions();
|
|
55
46
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
children: /*#__PURE__*/_jsx(Outside, {
|
|
48
|
+
className: "blue-actions ".concat(_break, " ").concat(actionsToggledIn ? "open" : "", " ").concat(className),
|
|
49
|
+
onClickOutside: function onClickOutside() {
|
|
50
|
+
setActionsToggledIn(false);
|
|
51
|
+
},
|
|
52
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
53
|
+
className: "blue-actions-menu d-flex",
|
|
54
|
+
children: [validChildren.length > 0 && !actionsToggledIn && !hideToggleAction && /*#__PURE__*/_jsx(MenuItem, {
|
|
55
|
+
className: "blue-actions-menu-toggle w-100",
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return toggleActions();
|
|
58
|
+
},
|
|
59
|
+
icon: toggleIcon,
|
|
60
|
+
"aria-label": "Toggle menu"
|
|
61
|
+
}), children]
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
59
65
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from "react";
|
|
2
|
+
export interface ActionsProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
menuClassName?: string;
|
|
6
|
+
collapseClassName?: string;
|
|
7
|
+
collapseStyle?: CSSProperties;
|
|
8
|
+
collapseMenuClassName?: string;
|
|
9
|
+
collapseMenuStyle?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Combination of toolbar and a dropdown menu. Items in toolbar will only be shown if there is enough space.
|
|
13
|
+
* Otherwise they will be visible in the dropdown menu. JavaScript detects if space is changing and rearranges.
|
|
14
|
+
* IMPORTANT: As of right now, children you pass will be rendered twice. Once in the toolbar and once in the dropdown.
|
|
15
|
+
*/
|
|
16
|
+
export default function Actions({ children, className, menuClassName, collapseClassName, collapseStyle, collapseMenuClassName, collapseMenuStyle }: ActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
import React, { useEffect, useId, useRef } from "react";
|
|
8
|
+
import { getPhrase } from "./shared.js";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { init } from "blue-web/dist/js/actions.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Combination of toolbar and a dropdown menu. Items in toolbar will only be shown if there is enough space.
|
|
14
|
+
* Otherwise they will be visible in the dropdown menu. JavaScript detects if space is changing and rearranges.
|
|
15
|
+
* IMPORTANT: As of right now, children you pass will be rendered twice. Once in the toolbar and once in the dropdown.
|
|
16
|
+
*/
|
|
17
|
+
export default function Actions(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
menuClassName = _ref.menuClassName,
|
|
21
|
+
collapseClassName = _ref.collapseClassName,
|
|
22
|
+
collapseStyle = _ref.collapseStyle,
|
|
23
|
+
collapseMenuClassName = _ref.collapseMenuClassName,
|
|
24
|
+
collapseMenuStyle = _ref.collapseMenuStyle;
|
|
25
|
+
var element = useRef(null);
|
|
26
|
+
var id = "Actions_Dropdown_".concat(useId().replace(/:/g, "-"));
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (element.current) {
|
|
29
|
+
var _init = init(element.current),
|
|
30
|
+
destroy = _init.destroy;
|
|
31
|
+
return function () {
|
|
32
|
+
destroy();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
37
|
+
ref: element,
|
|
38
|
+
className: clsx("BLUE-actions", className),
|
|
39
|
+
role: "toolbar",
|
|
40
|
+
"aria-label": getPhrase("Toolbar with buttons and button groups"),
|
|
41
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: clsx("BLUE-actions-menu", menuClassName),
|
|
43
|
+
children: children
|
|
44
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
45
|
+
className: clsx("BLUE-actions-collapse", collapseClassName),
|
|
46
|
+
style: collapseStyle,
|
|
47
|
+
children: [/*#__PURE__*/_jsxs("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
popoverTarget: id,
|
|
50
|
+
className: "blue-anchor blue-menu-item btn px-3",
|
|
51
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
52
|
+
className: "blue-menu-item-icon",
|
|
53
|
+
"aria-hidden": true,
|
|
54
|
+
children: "\u22EE"
|
|
55
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
56
|
+
className: "visually-hidden",
|
|
57
|
+
children: getPhrase("Toggle menu")
|
|
58
|
+
})]
|
|
59
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
60
|
+
id: id,
|
|
61
|
+
popover: "",
|
|
62
|
+
className: clsx("BLUE-actions-collapse-menu blue-anchored blue-anchored-end blue-anchored-fallback", "blue-menu-item-dropdown text-body", collapseMenuClassName),
|
|
63
|
+
style: _objectSpread(_defineProperty({}, "--blue-menu-item-dropdown-bg", "var(--bs-body-bg)"), collapseMenuStyle),
|
|
64
|
+
children: children
|
|
65
|
+
})]
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode, ElementType } from "react";
|
|
2
|
+
export type ButtonVariant = "filled" | "soft" | "plain" | "outline" | "link" | "menu-item";
|
|
3
|
+
export type ButtonColor = "theme" | "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
4
|
+
export type ButtonProps = ComponentProps<"a"> & ComponentProps<"button"> & {
|
|
5
|
+
elementType?: ElementType;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
color?: ButtonColor;
|
|
8
|
+
sm?: boolean;
|
|
9
|
+
lg?: boolean;
|
|
10
|
+
iconBefore?: ReactNode;
|
|
11
|
+
iconAfter?: ReactNode;
|
|
12
|
+
label?: string;
|
|
13
|
+
labelHidden?: boolean;
|
|
14
|
+
busy?: boolean;
|
|
15
|
+
success?: boolean;
|
|
16
|
+
active?: boolean;
|
|
17
|
+
} & {
|
|
18
|
+
/**
|
|
19
|
+
* For compatibility with React Router NavLink
|
|
20
|
+
*/
|
|
21
|
+
to?: string;
|
|
22
|
+
/**
|
|
23
|
+
* For compatibility with React Router NavLink
|
|
24
|
+
*/
|
|
25
|
+
exact?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* For compatibility with React Router NavLink
|
|
28
|
+
*/
|
|
29
|
+
activeClassName?: string;
|
|
30
|
+
};
|
|
31
|
+
export default function Button({ elementType, className, type, variant, color, sm, lg, iconBefore, iconAfter, label, labelHidden, busy: busyProp, success: successProp, active, activeClassName, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var _excluded = ["elementType", "className", "type", "variant", "color", "sm", "lg", "iconBefore", "iconAfter", "label", "labelHidden", "busy", "success", "active", "activeClassName"];
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
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); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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; } }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
import { getPhrase } from "./shared.js";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
function getButtonVariantClass(variant, color) {
|
|
21
|
+
switch (variant) {
|
|
22
|
+
case "soft":
|
|
23
|
+
return "blue-btn-soft-".concat(color);
|
|
24
|
+
case "plain":
|
|
25
|
+
return "blue-btn-plain-".concat(color);
|
|
26
|
+
case "outline":
|
|
27
|
+
return "btn-outline-".concat(color);
|
|
28
|
+
case "link":
|
|
29
|
+
return "btn-link link-".concat(color, " link-offset-2");
|
|
30
|
+
case "menu-item":
|
|
31
|
+
return "blue-menu-item";
|
|
32
|
+
default:
|
|
33
|
+
return "btn-".concat(color);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default function Button(_ref) {
|
|
37
|
+
var elementType = _ref.elementType,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
type = _ref.type,
|
|
40
|
+
_ref$variant = _ref.variant,
|
|
41
|
+
variant = _ref$variant === void 0 ? "soft" : _ref$variant,
|
|
42
|
+
_ref$color = _ref.color,
|
|
43
|
+
color = _ref$color === void 0 ? "secondary" : _ref$color,
|
|
44
|
+
sm = _ref.sm,
|
|
45
|
+
lg = _ref.lg,
|
|
46
|
+
iconBefore = _ref.iconBefore,
|
|
47
|
+
iconAfter = _ref.iconAfter,
|
|
48
|
+
label = _ref.label,
|
|
49
|
+
labelHidden = _ref.labelHidden,
|
|
50
|
+
busyProp = _ref.busy,
|
|
51
|
+
successProp = _ref.success,
|
|
52
|
+
active = _ref.active,
|
|
53
|
+
_ref$activeClassName = _ref.activeClassName,
|
|
54
|
+
activeClassName = _ref$activeClassName === void 0 ? "current" : _ref$activeClassName,
|
|
55
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
+
var Comp = elementType || (props.href ? "a" : "button");
|
|
57
|
+
var _useState = useState(false),
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
success = _useState2[0],
|
|
60
|
+
setSuccess = _useState2[1];
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
if (successProp) {
|
|
63
|
+
setSuccess(true);
|
|
64
|
+
setTimeout(function () {
|
|
65
|
+
setSuccess(false);
|
|
66
|
+
}, 3000);
|
|
67
|
+
}
|
|
68
|
+
}, [successProp]);
|
|
69
|
+
var variantClass = getButtonVariantClass(variant, color);
|
|
70
|
+
var isNavLink = _typeof(elementType) === "object" && elementType !== null && "displayName" in elementType && elementType.displayName === "NavLink";
|
|
71
|
+
if (isNavLink) {
|
|
72
|
+
props = _objectSpread(_objectSpread({}, props), {}, {
|
|
73
|
+
activeClassName: activeClassName
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/_jsx(Comp, _objectSpread(_objectSpread({
|
|
77
|
+
type: Comp === "button" && type === undefined ? "button" : type,
|
|
78
|
+
className: clsx("btn", _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, variantClass, !success), "btn-success", success), "btn-sm", sm), "btn-lg", lg), "icon-link", busyProp || iconBefore !== null || iconAfter !== null), "active", active), className)
|
|
79
|
+
}, props), {}, {
|
|
80
|
+
children: busyProp ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
81
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
82
|
+
className: "spinner-border spinner-border-sm bi me-1",
|
|
83
|
+
"aria-hidden": true
|
|
84
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
85
|
+
role: "status",
|
|
86
|
+
children: [getPhrase("Loading"), "\u2026"]
|
|
87
|
+
})]
|
|
88
|
+
}) : success ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
+
children: [/*#__PURE__*/_jsx("svg", {
|
|
90
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
91
|
+
width: "1em",
|
|
92
|
+
height: "1em",
|
|
93
|
+
fill: "currentColor",
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
className: "bi bi-check-lg me-1",
|
|
96
|
+
viewBox: "0 0 16 16",
|
|
97
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
98
|
+
d: "M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425z"
|
|
99
|
+
})
|
|
100
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
101
|
+
role: "status",
|
|
102
|
+
children: getPhrase("Successful")
|
|
103
|
+
})]
|
|
104
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [iconBefore !== null && /*#__PURE__*/_jsx("span", {
|
|
106
|
+
className: "blue-btn-icon-wrapper",
|
|
107
|
+
"aria-hidden": true,
|
|
108
|
+
children: iconBefore
|
|
109
|
+
}), label && !labelHidden && /*#__PURE__*/_jsx("span", {
|
|
110
|
+
className: "text-truncate",
|
|
111
|
+
children: label
|
|
112
|
+
}), props.children, iconAfter != null && /*#__PURE__*/_jsx("span", {
|
|
113
|
+
className: "blue-btn-icon-wrapper",
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
children: iconAfter
|
|
116
|
+
})]
|
|
117
|
+
})
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
@@ -5,6 +5,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
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); }
|
|
7
7
|
import React from "react";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
/**
|
|
9
10
|
* Chevron icon component with open state.
|
|
10
11
|
*/
|
|
@@ -14,7 +15,7 @@ export default function Chevron(_ref) {
|
|
|
14
15
|
className = _ref.className,
|
|
15
16
|
style = _ref.style;
|
|
16
17
|
var prefersReducedMotion = window.matchMedia("(prefers-reduced-motion)").matches;
|
|
17
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
18
19
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
20
|
width: "1em",
|
|
20
21
|
height: "1em",
|
|
@@ -26,12 +27,13 @@ export default function Chevron(_ref) {
|
|
|
26
27
|
transform: "rotate(".concat(open && mirrored ? -90 : open ? 90 : 0, "deg)"),
|
|
27
28
|
transition: prefersReducedMotion ? "none" : "transform 0.2s"
|
|
28
29
|
}),
|
|
29
|
-
viewBox: "0 0 16 16"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
viewBox: "0 0 16 16",
|
|
31
|
+
children: mirrored ? /*#__PURE__*/_jsx("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
d: "M11.354 1.646a.5.5 0 010 .708L5.707 8l5.647 5.646a.5.5 0 01-.708.708l-6-6a.5.5 0 010-.708l6-6a.5.5 0 01.708 0"
|
|
34
|
+
}) : /*#__PURE__*/_jsx("path", {
|
|
35
|
+
fillRule: "evenodd",
|
|
36
|
+
d: "M4.646 1.646a.5.5 0 01.708 0l6 6a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708L10.293 8 4.646 2.354a.5.5 0 010-.708"
|
|
37
|
+
})
|
|
38
|
+
});
|
|
37
39
|
}
|
|
@@ -12,6 +12,7 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
12
12
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
13
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
14
|
import React, { Component } from "react";
|
|
15
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
16
|
/**
|
|
16
17
|
* Component for simple hash routing. It's recommended to use solutions like `react-router-dom` for more complex routing.
|
|
17
18
|
*
|
|
@@ -156,12 +157,14 @@ var HashRouter = /*#__PURE__*/function (_Component) {
|
|
|
156
157
|
value: function render() {
|
|
157
158
|
var _this$props$pages,
|
|
158
159
|
_this3 = this;
|
|
159
|
-
return /*#__PURE__*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
161
|
+
children: (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
162
|
+
return _this3.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_jsx("div", {
|
|
163
|
+
className: "router-page " + (_this3.state.match[0] === page.name ? "active" : "d-none"),
|
|
164
|
+
children: page.component
|
|
165
|
+
}, page.name);
|
|
166
|
+
})
|
|
167
|
+
});
|
|
165
168
|
}
|
|
166
169
|
}], [{
|
|
167
170
|
key: "defaultProps",
|
|
@@ -3,6 +3,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
4
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
5
|
import React from "react";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
/**
|
|
7
8
|
* The top of a page.
|
|
8
9
|
*/
|
|
@@ -10,8 +11,9 @@ export default function Header(_ref) {
|
|
|
10
11
|
var children = _ref.children,
|
|
11
12
|
_ref$className = _ref.className,
|
|
12
13
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
13
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/_jsx("header", {
|
|
14
15
|
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)")
|
|
16
|
-
|
|
16
|
+
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)"),
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
17
19
|
}
|