blue-react 8.1.7 → 8.3.1

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.
Files changed (75) hide show
  1. package/LICENSE +164 -164
  2. package/README.md +59 -59
  3. package/dist/components/ActionMenu.js +2 -2
  4. package/dist/components/ActionMenuSwitch.js +2 -2
  5. package/dist/components/Body.js +2 -2
  6. package/dist/components/BodyRounded.js +2 -2
  7. package/dist/components/Caret.js +2 -2
  8. package/dist/components/DocumentView.js +2 -2
  9. package/dist/components/Grid.js +287 -287
  10. package/dist/components/Header.js +2 -2
  11. package/dist/components/HeaderTitle.js +3 -3
  12. package/dist/components/Intro.js +2 -2
  13. package/dist/components/Layout.js +19 -19
  14. package/dist/components/MenuItem.js +11 -20
  15. package/dist/components/Modal.js +11 -7
  16. package/dist/components/ModalProvider.js +18 -9
  17. package/dist/components/Outside.js +6 -6
  18. package/dist/components/Page.js +2 -2
  19. package/dist/components/Search.js +2 -2
  20. package/dist/components/SidebarMenu.js +2 -2
  21. package/dist/components/Switch.js +2 -2
  22. package/dist/style.css +8701 -4960
  23. package/dist/style.css.map +1 -0
  24. package/dist/style.min.css +10 -12
  25. package/dist/style.scss +28 -28
  26. package/dist/styles/_action-menu.scss +81 -81
  27. package/dist/styles/_bootstrap-mixins_overwritten.scss +106 -106
  28. package/dist/styles/_bootstrap-optimizations.scss +13 -13
  29. package/dist/styles/_bootstrap-variables.scss +15 -15
  30. package/dist/styles/_bootstrap.scss +56 -56
  31. package/dist/styles/_caret.scss +50 -50
  32. package/dist/styles/_document-view.scss +6 -6
  33. package/dist/styles/_general.scss +177 -177
  34. package/dist/styles/_grid.scss +381 -381
  35. package/dist/styles/_hover.scss +42 -42
  36. package/dist/styles/_keyframes.scss +73 -73
  37. package/dist/styles/_mixins.scss +6 -6
  38. package/dist/styles/_router.scss +18 -18
  39. package/dist/styles/_search.scss +61 -61
  40. package/dist/styles/_status.scss +149 -149
  41. package/dist/styles/_switch.scss +21 -21
  42. package/dist/styles/_tooltips.scss +189 -189
  43. package/dist/styles/_variables.scss +97 -97
  44. package/dist/styles/mixins/_action-menu.scss +68 -68
  45. package/dist/styles/mixins/_custom-property.scss +10 -10
  46. package/dist/styles/mixins/_misc.scss +33 -33
  47. package/dist/styles/mixins/_scroll-shadow.scss +9 -9
  48. package/dist/styles/mixins/_sidebar.scss +156 -156
  49. package/dist/styles/mixins/_switch.scss +85 -85
  50. package/dist/types/components/ActionMenu.d.ts +22 -22
  51. package/dist/types/components/ActionMenuSwitch.d.ts +11 -11
  52. package/dist/types/components/Body.d.ts +21 -21
  53. package/dist/types/components/BodyRounded.d.ts +10 -10
  54. package/dist/types/components/Caret.d.ts +16 -16
  55. package/dist/types/components/DocumentView.d.ts +23 -23
  56. package/dist/types/components/Grid.d.ts +110 -110
  57. package/dist/types/components/Header.d.ts +8 -8
  58. package/dist/types/components/HeaderTitle.d.ts +29 -29
  59. package/dist/types/components/Intro.d.ts +23 -23
  60. package/dist/types/components/Layout.d.ts +120 -120
  61. package/dist/types/components/MenuItem.d.ts +69 -69
  62. package/dist/types/components/Modal.d.ts +25 -24
  63. package/dist/types/components/ModalProvider.d.ts +11 -11
  64. package/dist/types/components/Outside.d.ts +14 -14
  65. package/dist/types/components/Page.d.ts +12 -12
  66. package/dist/types/components/Search.d.ts +30 -30
  67. package/dist/types/components/SidebarMenu.d.ts +32 -32
  68. package/dist/types/components/Status.d.ts +12 -12
  69. package/dist/types/components/StatusProvider.d.ts +15 -15
  70. package/dist/types/components/Switch.d.ts +21 -21
  71. package/dist/types/components/Utilities.d.ts +17 -17
  72. package/dist/types/components/shared.d.ts +15 -15
  73. package/index.d.ts +65 -65
  74. package/index.js +27 -27
  75. package/package.json +88 -88
@@ -39,25 +39,25 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
39
39
 
40
40
  window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
41
41
 
42
- /**
43
- * The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
44
- * You can also append your own event listeners.
45
- *
46
- * Allowed events:
47
- *
48
- * * **componentDidUpdate** - Component was updated.
49
- * Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
50
- * * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
51
- * Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
52
- * * **pageDidHide** - This page disappeared and another page appears instead.
53
- * Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
54
- *
55
- * Method to add event listeners:
56
- * * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
57
- *
58
- * Methods to remove event listeners:
59
- * * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
60
- * * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
42
+ /**
43
+ * The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
44
+ * You can also append your own event listeners.
45
+ *
46
+ * Allowed events:
47
+ *
48
+ * * **componentDidUpdate** - Component was updated.
49
+ * Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
50
+ * * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
51
+ * Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
52
+ * * **pageDidHide** - This page disappeared and another page appears instead.
53
+ * Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
54
+ *
55
+ * Method to add event listeners:
56
+ * * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
57
+ *
58
+ * Methods to remove event listeners:
59
+ * * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
60
+ * * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
61
61
  */
62
62
  var Layout = /*#__PURE__*/function (_Component) {
63
63
  _inherits(Layout, _Component);
@@ -23,12 +23,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
27
-
28
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
-
30
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
-
32
26
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
27
 
34
28
  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."); }
@@ -41,8 +35,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
41
35
 
42
36
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
37
 
44
- /**
45
- * Link, button or custom component for Sidebar, Actions or ActionMenu
38
+ /**
39
+ * Link, button or custom component for Sidebar, Actions or ActionMenu
46
40
  */
47
41
  function MenuItem(props) {
48
42
  var _useState = (0, _react.useState)(false),
@@ -123,19 +117,16 @@ function MenuItem(props) {
123
117
  iconForActive = props.iconForActive;
124
118
  }
125
119
 
126
- var passingProps = {
127
- id: "blue-action-menu-item-" + _Utilities.default.guid()
128
- };
129
- var removeFromAttrs = ["isActive", "isHome", "children", "dropdownClassName", "showDropdown", "supportOutside", "elementType"];
130
- Object.keys(props).forEach(function (key) {
131
- if (!removeFromAttrs.includes(key)) {
132
- passingProps[key] = props[key];
133
- }
134
- });
135
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/(0, _react.createElement)(props.elementType || (props.href ? "a" : "button"), _objectSpread(_objectSpread({}, passingProps), {}, {
120
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/(0, _react.createElement)(props.elementType || (props.href ? "a" : "button"), {
121
+ to: props.to,
122
+ href: props.href,
123
+ exact: props.exact,
136
124
  className: className + (props.isActive || active ? " active" : "") + (props.label ? " has-label" : ""),
137
- onClick: onClick
138
- }), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
125
+ onClick: onClick,
126
+ target: props.target,
127
+ rel: props.rel,
128
+ title: props.title
129
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
139
130
  className: (0, _clsx.default)("blue-menu-item-icon", {
140
131
  hasIconForActive: iconForActive
141
132
  })
@@ -29,14 +29,15 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
29
29
 
30
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
31
 
32
- /**
33
- * Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
34
- * It uses Bootstrap's Modal components.
35
- *
36
- * For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example there.
32
+ /**
33
+ * Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
34
+ * It uses Bootstrap's Modal components.
35
+ *
36
+ * For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example there.
37
37
  */
38
38
  function Modal(_ref) {
39
39
  var modalContent = _ref.modalContent,
40
+ modalTitle = _ref.modalTitle,
40
41
  unSetModalContent = _ref.unSetModalContent,
41
42
  onSubmit = _ref.onSubmit,
42
43
  defaultInput = _ref.defaultInput,
@@ -122,12 +123,15 @@ function Modal(_ref) {
122
123
  className: "modal-header"
123
124
  }, /*#__PURE__*/_react.default.createElement("h5", {
124
125
  className: "modal-title"
125
- }, (0, _shared.getPhrase)("Message")), /*#__PURE__*/_react.default.createElement("button", {
126
+ }, modalTitle || (0, _shared.getPhrase)("Message")), /*#__PURE__*/_react.default.createElement("button", {
126
127
  type: "button",
127
128
  className: "btn-close",
128
129
  onClick: cancel
129
130
  })), /*#__PURE__*/_react.default.createElement("div", {
130
- className: "modal-body"
131
+ className: "modal-body",
132
+ style: {
133
+ whiteSpace: "pre-wrap"
134
+ }
131
135
  }, modalContent, type === "ask" && /*#__PURE__*/_react.default.createElement("input", {
132
136
  type: "text",
133
137
  className: "form-control mt-1",
@@ -59,22 +59,28 @@ var ModalProvider = function ModalProvider(_ref) {
59
59
 
60
60
  var _useState5 = (0, _react.useState)(),
61
61
  _useState6 = _slicedToArray(_useState5, 2),
62
- defaultInput = _useState6[0],
63
- setDefaultInput = _useState6[1];
62
+ modalTitle = _useState6[0],
63
+ setModalTitle = _useState6[1];
64
+
65
+ var _useState7 = (0, _react.useState)(),
66
+ _useState8 = _slicedToArray(_useState7, 2),
67
+ defaultInput = _useState8[0],
68
+ setDefaultInput = _useState8[1];
64
69
 
65
70
  var unSetModalContent = (0, _react.useCallback)(function () {
66
71
  setModalContent(undefined);
67
72
  }, [setModalContent]);
68
73
 
69
- var _useState7 = (0, _react.useState)(),
70
- _useState8 = _slicedToArray(_useState7, 2),
71
- onSubmit = _useState8[0],
72
- setOnSubmit = _useState8[1];
74
+ var _useState9 = (0, _react.useState)(),
75
+ _useState10 = _slicedToArray(_useState9, 2),
76
+ onSubmit = _useState10[0],
77
+ setOnSubmit = _useState10[1];
73
78
 
74
- var ask = function ask(text) {
79
+ var ask = function ask(text, title) {
75
80
  return new Promise(function (resolve) {
76
81
  setType("ask");
77
82
  setModalContent(text);
83
+ setModalTitle(title);
78
84
  setDefaultInput("");
79
85
  setOnSubmit(function () {
80
86
  return function (input) {
@@ -86,10 +92,11 @@ var ModalProvider = function ModalProvider(_ref) {
86
92
  });
87
93
  };
88
94
 
89
- var tell = function tell(text) {
95
+ var tell = function tell(text, title) {
90
96
  return new Promise(function (resolve) {
91
97
  setType("tell");
92
98
  setModalContent(text);
99
+ setModalTitle(title);
93
100
  setOnSubmit(function () {
94
101
  return function (input) {
95
102
  resolve(input ? true : false);
@@ -99,10 +106,11 @@ var ModalProvider = function ModalProvider(_ref) {
99
106
  });
100
107
  };
101
108
 
102
- var verify = function verify(text) {
109
+ var verify = function verify(text, title) {
103
110
  return new Promise(function (resolve) {
104
111
  setType("verify");
105
112
  setModalContent(text);
113
+ setModalTitle(title);
106
114
  setOnSubmit(function () {
107
115
  return function (input) {
108
116
  resolve(input ? true : false);
@@ -120,6 +128,7 @@ var ModalProvider = function ModalProvider(_ref) {
120
128
  }
121
129
  }, rest), children, /*#__PURE__*/_react.default.createElement(_Modal.default, {
122
130
  modalContent: modalContent,
131
+ modalTitle: modalTitle,
123
132
  unSetModalContent: unSetModalContent,
124
133
  onSubmit: onSubmit,
125
134
  defaultInput: defaultInput,
@@ -14,13 +14,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
14
14
 
15
15
  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; }
16
16
 
17
- /**
18
- * Hook that alerts clicks outside of the passed ref
17
+ /**
18
+ * Hook that alerts clicks outside of the passed ref
19
19
  */
20
20
  function useOutside(ref, callback) {
21
21
  (0, _react.useEffect)(function () {
22
- /**
23
- * Alert if clicked on outside of element
22
+ /**
23
+ * Alert if clicked on outside of element
24
24
  */
25
25
  function handleClickOutside(event) {
26
26
  if (ref.current && !ref.current.contains(event.target) && callback) {
@@ -37,8 +37,8 @@ function useOutside(ref, callback) {
37
37
  }, [ref]);
38
38
  }
39
39
 
40
- /**
41
- * Component that fires an event if you click outside of it
40
+ /**
41
+ * Component that fires an event if you click outside of it
42
42
  */
43
43
  function Outside(_ref) {
44
44
  var children = _ref.children,
@@ -29,8 +29,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
29
29
 
30
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
31
 
32
- /**
33
- * Main component for each page.
32
+ /**
33
+ * Main component for each page.
34
34
  */
35
35
  function Page(_ref) {
36
36
  var children = _ref.children,
@@ -31,8 +31,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
31
31
 
32
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
33
 
34
- /**
35
- * A search bar that can be placed to the sidebar or on a page.
34
+ /**
35
+ * A search bar that can be placed to the sidebar or on a page.
36
36
  */
37
37
  function Search(props) {
38
38
  var autoFocus = props.autoFocus,
@@ -25,8 +25,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
25
25
 
26
26
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
27
 
28
- /**
29
- * Sidebar for the `Layout` component.
28
+ /**
29
+ * Sidebar for the `Layout` component.
30
30
  */
31
31
  function SidebarMenu(props) {
32
32
  var _useState = (0, _react.useState)(false),
@@ -13,8 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  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; }
15
15
 
16
- /**
17
- * Switch.
16
+ /**
17
+ * Switch.
18
18
  */
19
19
  function Switch(_ref) {
20
20
  var className = _ref.className,