@jobber/hooks 1.5.2 → 1.7.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/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,44 @@ menu: Changelog
|
|
|
8
8
|
All notable changes to this project will be documented in this file.
|
|
9
9
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
10
10
|
|
|
11
|
+
# [1.7.0](https://github.com/GetJobber/atlantis/compare/@jobber/hooks@1.6.1...@jobber/hooks@1.7.0) (2021-09-23)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **components:** Added keyboard shortcut to confirmation modal ([#669](https://github.com/GetJobber/atlantis/issues/669)) ([f93456f](https://github.com/GetJobber/atlantis/commit/f93456fcf0bd08472e194282d059572ee1583fc3))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.6.1](https://github.com/GetJobber/atlantis/compare/@jobber/hooks@1.6.0...@jobber/hooks@1.6.1) (2021-09-21)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @jobber/hooks
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [1.6.0](https://github.com/GetJobber/atlantis/compare/@jobber/hooks@1.5.3...@jobber/hooks@1.6.0) (2021-09-20)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **eslint:** Update prettier to latest version ([#667](https://github.com/GetJobber/atlantis/issues/667)) ([84e5895](https://github.com/GetJobber/atlantis/commit/84e589542c642b27acd2997af7200b86ba197b7e))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [1.5.3](https://github.com/GetJobber/atlantis/compare/@jobber/hooks@1.5.2...@jobber/hooks@1.5.3) (2021-09-10)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @jobber/hooks
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
11
49
|
## [1.5.2](https://github.com/GetJobber/atlantis/compare/@jobber/hooks@1.5.1...@jobber/hooks@1.5.2) (2021-09-10)
|
|
12
50
|
|
|
13
51
|
|
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
var react_1 = require("react");
|
|
7
7
|
var zxcvbn_1 = __importDefault(require("zxcvbn"));
|
|
8
8
|
function usePasswordStrength(password, dictionary) {
|
|
9
|
-
var _a = react_1.useMemo(function () { return zxcvbn_1.default(password, dictionary); }, [
|
|
10
|
-
password,
|
|
11
|
-
dictionary,
|
|
12
|
-
]), guesses = _a.guesses, score = _a.score, _b = _a.feedback, warning = _b.warning, suggestions = _b.suggestions, timeToCrack = _a.crack_times_display.offline_fast_hashing_1e10_per_second;
|
|
9
|
+
var _a = react_1.useMemo(function () { return zxcvbn_1.default(password, dictionary); }, [password, dictionary]), guesses = _a.guesses, score = _a.score, _b = _a.feedback, warning = _b.warning, suggestions = _b.suggestions, timeToCrack = _a.crack_times_display.offline_fast_hashing_1e10_per_second;
|
|
13
10
|
return {
|
|
14
11
|
guesses: guesses,
|
|
15
12
|
score: score,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@apollo/client": "^3.3.16",
|
|
41
41
|
"react": "^16.8.6"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e0c006a348b7c237501ab52016c04ed624d70069"
|
|
44
44
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
22
|
-
result["default"] = mod;
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
var react_1 = __importStar(require("react"));
|
|
27
|
-
var react_2 = require("@testing-library/react");
|
|
28
|
-
var _1 = require(".");
|
|
29
|
-
function waitForNextTick(callback) {
|
|
30
|
-
// https://github.com/testing-library/jest-dom/issues/53
|
|
31
|
-
// Based on this finding [https://github.com/testing-library/jest-dom/issues/53#issuecomment-421671377]
|
|
32
|
-
// and [https://stackoverflow.com/a/11299876] the focus always goes back to
|
|
33
|
-
// the <body> before focusing on the correct element. In turn, there's a
|
|
34
|
-
// delay and you have to wait for a tick to get the right element.
|
|
35
|
-
setTimeout(callback, 20);
|
|
36
|
-
}
|
|
37
|
-
it("should return the focus on the activator", function () {
|
|
38
|
-
var activatorId = "activator";
|
|
39
|
-
var closerId = "closer";
|
|
40
|
-
var getByTestId = react_2.render(react_1.default.createElement(TestComponent, { activatorId: activatorId, closerId: closerId })).getByTestId;
|
|
41
|
-
react_2.fireEvent.click(getByTestId(activatorId));
|
|
42
|
-
react_2.fireEvent.click(getByTestId(closerId));
|
|
43
|
-
waitForNextTick(function () {
|
|
44
|
-
expect(getByTestId(activatorId)).toHaveFocus();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
describe("Nested components with return focus hook", function () {
|
|
48
|
-
it("should return the focus on the correct activator", function () {
|
|
49
|
-
var activatorId = "activator";
|
|
50
|
-
var closerId = "closer";
|
|
51
|
-
var childActivatorId = "activator-child";
|
|
52
|
-
var childCloserId = "closer-child";
|
|
53
|
-
var getByTestId = react_2.render(react_1.default.createElement(TestComponent, { activatorId: activatorId, closerId: closerId },
|
|
54
|
-
react_1.default.createElement(TestComponent, { activatorId: childActivatorId, closerId: childCloserId }))).getByTestId;
|
|
55
|
-
react_2.fireEvent.click(getByTestId(activatorId));
|
|
56
|
-
react_2.fireEvent.click(getByTestId(childActivatorId));
|
|
57
|
-
expect(getByTestId(childCloserId)).toBeInTheDocument();
|
|
58
|
-
react_2.fireEvent.click(getByTestId(childCloserId));
|
|
59
|
-
waitForNextTick(function () {
|
|
60
|
-
expect(getByTestId(childActivatorId)).toHaveFocus();
|
|
61
|
-
});
|
|
62
|
-
react_2.fireEvent.click(getByTestId(closerId));
|
|
63
|
-
waitForNextTick(function () {
|
|
64
|
-
expect(getByTestId(activatorId)).toHaveFocus();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
function TestComponent(_a) {
|
|
69
|
-
var activatorId = _a.activatorId, closerId = _a.closerId, children = _a.children;
|
|
70
|
-
var _b = __read(react_1.useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
71
|
-
_1.useRefocusOnActivator(true);
|
|
72
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
73
|
-
react_1.default.createElement("button", { "data-testid": activatorId, onClick: function () { return setOpen(true); } }, "Click me!"),
|
|
74
|
-
open && (react_1.default.createElement("div", null,
|
|
75
|
-
"Haloo!",
|
|
76
|
-
react_1.default.createElement("button", { onClick: function () { return setOpen(false); }, "data-testid": closerId }, "x"),
|
|
77
|
-
children))));
|
|
78
|
-
}
|