blue-react 8.0.0-next.1 → 8.0.0-next.5
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 +59 -59
- package/dist/components/ActionMenuSwitch.js +2 -2
- package/dist/components/Caret.js +2 -2
- package/dist/components/DocumentView.js +3 -3
- package/dist/components/Grid.js +275 -275
- package/dist/components/Header.js +2 -2
- package/dist/components/HeaderTitle.js +3 -3
- package/dist/components/Intro.js +2 -2
- package/dist/components/Layout.js +35 -7
- package/dist/components/Modal.js +16 -2
- package/dist/components/Outside.js +6 -6
- package/dist/components/Page.js +2 -2
- package/dist/components/SidebarMenu.js +2 -2
- package/dist/components/Switch.js +2 -2
- package/dist/style.css +480 -199
- package/dist/style.min.css +9 -9
- package/dist/style.scss +1 -1
- package/dist/styles/_action-menu.scss +81 -81
- package/dist/styles/_bootstrap-mixins_overwritten.scss +106 -106
- package/dist/styles/_bootstrap-optimizations.scss +13 -13
- package/dist/styles/_bootstrap-variables.scss +13 -13
- package/dist/styles/_bootstrap.scss +56 -56
- package/dist/styles/_caret.scss +50 -50
- package/dist/styles/_document-view.scss +6 -6
- package/dist/styles/_hover.scss +42 -42
- package/dist/styles/_keyframes.scss +73 -73
- package/dist/styles/_mixins.scss +6 -6
- package/dist/styles/_router.scss +18 -18
- package/dist/styles/_switch.scss +21 -21
- package/dist/styles/_variables.scss +6 -0
- package/dist/styles/mixins/_action-menu.scss +68 -68
- package/dist/styles/mixins/_custom-property.scss +10 -10
- package/dist/styles/mixins/_misc.scss +33 -33
- package/dist/styles/mixins/_scroll-shadow.scss +9 -9
- package/dist/styles/mixins/_sidebar.scss +142 -142
- package/dist/styles/mixins/_switch.scss +85 -85
- package/dist/types/components/Layout.d.ts +15 -6
- package/dist/types/components/Modal.d.ts +1 -1
- package/package.json +88 -88
|
@@ -41,16 +41,23 @@ window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
44
|
-
*
|
|
44
|
+
* You can also append your own event listeners.
|
|
45
45
|
*
|
|
46
|
-
* Allowed
|
|
46
|
+
* Allowed events:
|
|
47
47
|
*
|
|
48
48
|
* * **componentDidUpdate** - Component was updated.
|
|
49
|
-
* Example: `blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
49
|
+
* Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
50
50
|
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
51
|
-
* Example: `blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
51
|
+
* Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
52
52
|
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
53
|
-
* Example: `blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
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`
|
|
54
61
|
*/
|
|
55
62
|
var Layout = /*#__PURE__*/function (_Component) {
|
|
56
63
|
_inherits(Layout, _Component);
|
|
@@ -198,8 +205,29 @@ var Layout = /*#__PURE__*/function (_Component) {
|
|
|
198
205
|
}
|
|
199
206
|
}, {
|
|
200
207
|
key: "addEventListener",
|
|
201
|
-
value: function addEventListener(param1, param2, param3) {
|
|
202
|
-
this.eventListeners.push([param1, param2, param3]);
|
|
208
|
+
value: function addEventListener(param1, param2, param3, listenerId) {
|
|
209
|
+
this.eventListeners.push([param1, param2, param3, listenerId]);
|
|
210
|
+
this.removeDuplicatedEventListeners();
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
key: "removeEventListener",
|
|
214
|
+
value: function removeEventListener(type, listenerId) {
|
|
215
|
+
this.eventListeners = this.eventListeners.filter(function (param) {
|
|
216
|
+
if (param[0] !== type) {
|
|
217
|
+
return param;
|
|
218
|
+
} else if (param[0] === type && param[3] !== listenerId) {
|
|
219
|
+
return param;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}, {
|
|
224
|
+
key: "removeDuplicatedEventListeners",
|
|
225
|
+
value: function removeDuplicatedEventListeners() {
|
|
226
|
+
this.eventListeners = this.eventListeners.filter(function (value, index, self) {
|
|
227
|
+
return index === self.findIndex(function (t) {
|
|
228
|
+
return t[3] === value[3] && t[0] === value[0];
|
|
229
|
+
});
|
|
230
|
+
});
|
|
203
231
|
}
|
|
204
232
|
}, {
|
|
205
233
|
key: "render",
|
package/dist/components/Modal.js
CHANGED
|
@@ -33,7 +33,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
33
33
|
* Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
|
|
34
34
|
* It uses Bootstrap's Modal components.
|
|
35
35
|
*
|
|
36
|
-
* For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example
|
|
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,
|
|
@@ -75,6 +75,17 @@ function Modal(_ref) {
|
|
|
75
75
|
var btnStyle = {
|
|
76
76
|
maxWidth: "10rem"
|
|
77
77
|
};
|
|
78
|
+
|
|
79
|
+
var focusFirstControl = function focusFirstControl() {
|
|
80
|
+
var myModal = modalRef.current;
|
|
81
|
+
myModal.removeEventListener("shown.bs.modal", focusFirstControl);
|
|
82
|
+
var firstControl = myModal.querySelector(".btn, .form-control");
|
|
83
|
+
|
|
84
|
+
if (firstControl) {
|
|
85
|
+
firstControl.focus();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
78
89
|
(0, _react.useEffect)(function () {
|
|
79
90
|
setInput(defaultInput || "");
|
|
80
91
|
}, [defaultInput]);
|
|
@@ -91,7 +102,10 @@ function Modal(_ref) {
|
|
|
91
102
|
cancel();
|
|
92
103
|
});
|
|
93
104
|
} else {
|
|
94
|
-
modalContent !== undefined ? bsModal.show() : bsModal.hide();
|
|
105
|
+
modalContent !== undefined ? bsModal.show() : bsModal.hide(); // Will focus first button or text field inside of modal when it is shown.
|
|
106
|
+
// For accessibility: This way you can control the modal actions with a keyboard.
|
|
107
|
+
|
|
108
|
+
myModal.addEventListener("shown.bs.modal", focusFirstControl);
|
|
95
109
|
}
|
|
96
110
|
}, [modalContent]);
|
|
97
111
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -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,
|
package/dist/components/Page.js
CHANGED
|
@@ -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,
|
|
@@ -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,
|