@onepercentio/one-ui 0.1.5 → 0.2.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/cypress/support/commands.js +25 -0
- package/cypress/support/index.js +47 -0
- package/dist/__test__/analytics.d.ts +3 -0
- package/dist/__test__/analytics.js +20 -0
- package/dist/__test__/analytics.js.map +1 -0
- package/dist/__test__/firestore.d.ts +2 -0
- package/dist/__test__/firestore.js +26 -0
- package/dist/__test__/firestore.js.map +1 -0
- package/dist/__test__/utils.d.ts +16 -0
- package/dist/__test__/utils.js +184 -2
- package/dist/__test__/utils.js.map +1 -1
- package/dist/assets/styles/variables.scss +2 -0
- package/dist/components/AdaptiveButton/AdaptiveButton.js.map +1 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +6 -36
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js.map +1 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.module.scss +3 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +4 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +10 -3
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +4 -2
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.d.ts +3 -0
- package/dist/components/AnchoredTooltip/AnchoredTooltip.d.ts +1 -0
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +45 -37
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js.map +1 -1
- package/dist/components/Button/Button.d.ts +6 -6
- package/dist/components/Button/Button.js +27 -4
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.module.scss +2 -2
- package/dist/components/Button/Button.stories.d.ts +5 -1
- package/dist/components/Collapsable/Collapsable.d.ts +1 -1
- package/dist/components/Collapsable/Collapsable.js +5 -0
- package/dist/components/Collapsable/Collapsable.js.map +1 -1
- package/dist/components/Collapsable/Collapsable.module.scss +2 -1
- package/dist/components/EmailInput/EmailInput.d.ts +5 -2
- package/dist/components/EmailInput/EmailInput.js +2 -0
- package/dist/components/EmailInput/EmailInput.js.map +1 -1
- package/dist/components/EmailInput/EmailInput.stories.d.ts +4 -2
- package/dist/components/EmailInput/index.d.ts +1 -1
- package/dist/components/EmailInput/index.js +2 -1
- package/dist/components/EmailInput/index.js.map +1 -1
- package/dist/components/Form/Form.d.ts +3 -2
- package/dist/components/Form/Form.js +1 -1
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/Header.module.scss +15 -5
- package/dist/components/Header/Header.stories.d.ts +1 -0
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +6 -2
- package/dist/components/Input/Input.js +12 -4
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.module.scss +1 -1
- package/dist/components/Input/Input.stories.d.ts +3 -1
- package/dist/components/MainGrid/MainGrid.d.ts +3 -2
- package/dist/components/MainGrid/MainGrid.js.map +1 -1
- package/dist/components/MainGrid/MainGrid.stories.d.ts +3 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.d.ts +4 -3
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +14 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js.map +1 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +23 -0
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.d.ts +3 -2
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -1
- package/dist/components/Select/Select.module.scss +0 -1
- package/dist/components/Select/Select.stories.d.ts +6 -2
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Text/Text.d.ts +7 -7
- package/dist/components/Text/Text.js +29 -4
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/Text/Text.stories.d.ts +7 -2
- package/dist/components/Transition/Transition.d.ts +2 -5
- package/dist/components/Transition/Transition.js +3 -3
- package/dist/components/Transition/Transition.js.map +1 -1
- package/dist/components/Transition/Transition.stories.d.ts +3 -3
- package/dist/components/UncontrolledTransition/UncontrolledTransition.d.ts +1 -0
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +6 -2
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js.map +1 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.d.ts +2 -0
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.d.ts +16 -5
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +36 -12
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +1 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.d.ts +26 -3
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js +13 -4
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js.map +1 -1
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.d.ts +7 -0
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +71 -0
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js.map +1 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.d.ts +1 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.js +9 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.js.map +1 -0
- package/dist/context/OneUIProvider.d.ts +13 -0
- package/dist/context/OneUIProvider.js +14 -3
- package/dist/context/OneUIProvider.js.map +1 -1
- package/dist/context/OneUIProvider.test.js +0 -1
- package/dist/context/OneUIProvider.test.js.map +1 -1
- package/dist/context/__mocks__/OneUIProvider.d.ts +22 -0
- package/dist/hooks/shims/ObjectWatchShim.d.ts +0 -0
- package/dist/hooks/shims/ObjectWatchShim.js +48 -0
- package/dist/hooks/shims/ObjectWatchShim.js.map +1 -0
- package/dist/hooks/useObserve.d.ts +2 -0
- package/dist/hooks/useObserve.js +14 -0
- package/dist/hooks/useObserve.js.map +1 -0
- package/package.json +18 -10
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ***********************************************
|
|
2
|
+
// This example commands.js shows you how to
|
|
3
|
+
// create various custom commands and overwrite
|
|
4
|
+
// existing commands.
|
|
5
|
+
//
|
|
6
|
+
// For more comprehensive examples of custom
|
|
7
|
+
// commands please read more here:
|
|
8
|
+
// https://on.cypress.io/custom-commands
|
|
9
|
+
// ***********************************************
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
// -- This is a parent command --
|
|
13
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
// -- This is a child command --
|
|
17
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
// -- This is a dual command --
|
|
21
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
// -- This will overwrite an existing command --
|
|
25
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/index.js is processed and
|
|
3
|
+
// loaded automatically before your test files.
|
|
4
|
+
//
|
|
5
|
+
// This is a great place to put global configuration and
|
|
6
|
+
// behavior that modifies Cypress.
|
|
7
|
+
//
|
|
8
|
+
// You can change the location of this file or turn off
|
|
9
|
+
// automatically serving support files with the
|
|
10
|
+
// 'supportFile' configuration option.
|
|
11
|
+
//
|
|
12
|
+
// You can read more here:
|
|
13
|
+
// https://on.cypress.io/configuration
|
|
14
|
+
// ***********************************************************
|
|
15
|
+
|
|
16
|
+
// Import commands.js using ES2015 syntax:
|
|
17
|
+
import "./commands";
|
|
18
|
+
|
|
19
|
+
// Alternatively you can use CommonJS syntax:
|
|
20
|
+
// require('./commands')
|
|
21
|
+
|
|
22
|
+
const origLog = Cypress.log;
|
|
23
|
+
Cypress.log = function (opts, ...other) {
|
|
24
|
+
const isFirebaseEmulatorInitialization =
|
|
25
|
+
opts.message && opts.message.includes && opts.message.includes("firebase emulators");
|
|
26
|
+
const isExecError =
|
|
27
|
+
opts.error && opts.error.docsUrl && opts.error.docsUrl.includes("/exec");
|
|
28
|
+
const isKillCommand = opts.message && opts.message.includes && opts.message.includes("lsof -t -i");
|
|
29
|
+
const isFetch8080 = opts.url === "http://localhost:4000/";
|
|
30
|
+
const isXHRWithFirebaseEmulator =
|
|
31
|
+
opts.displayName === "xhr" &&
|
|
32
|
+
(!opts.url ||
|
|
33
|
+
[8090, 9199].some((port) =>
|
|
34
|
+
opts.url.startsWith(`http://localhost:${port}`)
|
|
35
|
+
));
|
|
36
|
+
if (
|
|
37
|
+
isXHRWithFirebaseEmulator ||
|
|
38
|
+
isFetch8080 ||
|
|
39
|
+
isFirebaseEmulatorInitialization ||
|
|
40
|
+
isExecError ||
|
|
41
|
+
isKillCommand
|
|
42
|
+
) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return origLog(opts, ...other);
|
|
47
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setUserId = exports.logEvent = exports.setCurrentPage = void 0;
|
|
4
|
+
function setCurrentPage(page) {
|
|
5
|
+
const message = `Analytics: Setting current page ${page}`;
|
|
6
|
+
(console.warn)(message);
|
|
7
|
+
}
|
|
8
|
+
exports.setCurrentPage = setCurrentPage;
|
|
9
|
+
function logEvent(eventType, eventParams) {
|
|
10
|
+
const message = `Analytics: Log event ${eventType}
|
|
11
|
+
${JSON.stringify(eventParams, null, 4)}`;
|
|
12
|
+
(console.warn)(message);
|
|
13
|
+
}
|
|
14
|
+
exports.logEvent = logEvent;
|
|
15
|
+
function setUserId(userId) {
|
|
16
|
+
const message = `Analytics: Set user id ${userId}`;
|
|
17
|
+
(console.warn)(message);
|
|
18
|
+
}
|
|
19
|
+
exports.setUserId = setUserId;
|
|
20
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/__test__/analytics.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAAC,IAAY;IACzC,MAAM,OAAO,GAAG,mCAAmC,IAAI,EAAE,CAAC;IAC1D,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAHD,wCAGC;AAED,SAAgB,QAAQ,CAAC,SAAiB,EAAE,WAAgB;IAC1D,MAAM,OAAO,GAAG,wBAAwB,SAAS;EACjD,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAJD,4BAIC;AAED,SAAgB,SAAS,CAAC,MAAc;IACtC,MAAM,OAAO,GAAG,0BAA0B,MAAM,EAAE,CAAC;IACnD,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAHD,8BAGC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.updateDoc = exports.createDoc = void 0;
|
|
13
|
+
const firestore_1 = require("firebase/firestore");
|
|
14
|
+
function createDoc(firestore, path, data) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
return yield (0, firestore_1.setDoc)((0, firestore_1.doc)(firestore, path), data);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.createDoc = createDoc;
|
|
20
|
+
function updateDoc(firestore, path, data) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return yield (0, firestore_1.updateDoc)((0, firestore_1.doc)(firestore, path), data);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.updateDoc = updateDoc;
|
|
26
|
+
//# sourceMappingURL=firestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../src/__test__/firestore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA0E;AAE1E,SAAsB,SAAS,CAAC,SAAc,EAAE,IAAY,EAAE,IAAS;;QACrE,OAAO,MAAM,IAAA,kBAAM,EAAC,IAAA,eAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CAAA;AAFD,8BAEC;AAED,SAAsB,SAAS,CAC7B,SAAc,EACd,IAAY,EACZ,IAAgB;;QAEhB,OAAO,MAAM,IAAA,qBAAU,EAAC,IAAA,eAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAW,CAAC,CAAC;IAC7D,CAAC;CAAA;AAND,8BAMC"}
|
package/dist/__test__/utils.d.ts
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
+
import { Firestore } from "firebase/firestore";
|
|
2
|
+
import { FirebaseStorage } from "firebase/storage";
|
|
3
|
+
import { RulesTestEnvironment } from "@firebase/rules-unit-testing";
|
|
1
4
|
export declare function WaitTimeout(ml?: number): Promise<void>;
|
|
5
|
+
declare class FirebaseEmulatorInterface {
|
|
6
|
+
private process;
|
|
7
|
+
private killRelatedPorts;
|
|
8
|
+
waitUntilUp(): void;
|
|
9
|
+
start(fakeProjectName: string, databaseToImport?: string): Promise<void> | undefined;
|
|
10
|
+
stop(immediate?: boolean, timeoutSec?: number): Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
export declare const EmulatorController: FirebaseEmulatorInterface;
|
|
13
|
+
export declare function cyPromise(someAssertion: {
|
|
14
|
+
then: Function;
|
|
15
|
+
}): Promise<unknown>;
|
|
16
|
+
export declare function initTestFirebase(fakeProjectId: string, setupEnv?: (ctx: Firestore, storageCtx: FirebaseStorage, testEnv: RulesTestEnvironment) => Promise<void>): Promise<RulesTestEnvironment>;
|
|
17
|
+
export {};
|
package/dist/__test__/utils.js
CHANGED
|
@@ -1,14 +1,196 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WaitTimeout = void 0;
|
|
13
|
+
exports.initTestFirebase = exports.cyPromise = exports.EmulatorController = exports.WaitTimeout = void 0;
|
|
14
|
+
const rules_unit_testing_1 = require("@firebase/rules-unit-testing");
|
|
15
|
+
// import { ChildProcess, execSync, spawn, SpawnSyncReturns } from "child_process";
|
|
4
16
|
function WaitTimeout(ml = 200) {
|
|
5
17
|
return new Promise((r) => {
|
|
6
18
|
setTimeout(() => {
|
|
7
19
|
r();
|
|
8
20
|
}, ml);
|
|
9
|
-
if (
|
|
21
|
+
if (window.Cypress)
|
|
22
|
+
return;
|
|
23
|
+
else if (jest.isMockFunction(setTimeout))
|
|
10
24
|
jest.advanceTimersByTime(ml);
|
|
11
25
|
});
|
|
12
26
|
}
|
|
13
27
|
exports.WaitTimeout = WaitTimeout;
|
|
28
|
+
class FirebaseEmulatorInterface {
|
|
29
|
+
killRelatedPorts() {
|
|
30
|
+
for (let port of [4000, 4400, 8055, 8080]) {
|
|
31
|
+
try {
|
|
32
|
+
if (window.Cypress)
|
|
33
|
+
cy.exec(`yarn kill-port ${port}`, { failOnNonZeroExit: true });
|
|
34
|
+
else
|
|
35
|
+
require("child_process").execSync(`kill -9 $(lsof -t -i:${port})`, {
|
|
36
|
+
stdio: "ignore",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error("Error when killing port", port, e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
waitUntilUp() {
|
|
45
|
+
cy.wrap("Waiting the emulator to be up").then({ timeout: 60000 }, () => {
|
|
46
|
+
return new Cypress.Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
let breakLoop = false;
|
|
48
|
+
const timeout = setTimeout(() => {
|
|
49
|
+
breakLoop = true;
|
|
50
|
+
rej("Could not receive ok from firebase emulator");
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
}, 30000);
|
|
53
|
+
while (!breakLoop) {
|
|
54
|
+
try {
|
|
55
|
+
yield fetch(`http://${window.location.hostname}:4000`, {
|
|
56
|
+
mode: "no-cors",
|
|
57
|
+
});
|
|
58
|
+
res();
|
|
59
|
+
clearTimeout(timeout);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
catch (e) { }
|
|
63
|
+
yield WaitTimeout(1000);
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
start(fakeProjectName, databaseToImport) {
|
|
69
|
+
if (sessionStorage.getItem("last-database") === databaseToImport)
|
|
70
|
+
return;
|
|
71
|
+
this.killRelatedPorts();
|
|
72
|
+
if (window.Cypress) {
|
|
73
|
+
const command = `firebase emulators:start -P ${fakeProjectName} ${databaseToImport ? `--import ${databaseToImport}` : ""}`;
|
|
74
|
+
cy.on("fail", (error) => {
|
|
75
|
+
if (error.message.includes(command))
|
|
76
|
+
return false;
|
|
77
|
+
});
|
|
78
|
+
cy.on("uncaught:exception", (error) => {
|
|
79
|
+
if (error.message.includes(command))
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
cy.exec(command, {
|
|
83
|
+
timeout: 10000, // Instant fail
|
|
84
|
+
});
|
|
85
|
+
sessionStorage.setItem("last-database", databaseToImport);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.process = require("child_process").spawn("firebase", ["emulators:start", "-P", "whz-test"], {
|
|
89
|
+
stdio: "pipe",
|
|
90
|
+
});
|
|
91
|
+
return new Promise((r, rej) => {
|
|
92
|
+
let fullOutput = "";
|
|
93
|
+
const timeoutSeconds = 20;
|
|
94
|
+
const unexpectedTimeout = setTimeout(() => {
|
|
95
|
+
rej(new Error(`Waited for 20 seconds and didn't received ok from emulator.
|
|
96
|
+
|
|
97
|
+
Below is the full output:
|
|
98
|
+
|
|
99
|
+
--------EMULATOR START OUTPUT--------
|
|
100
|
+
|
|
101
|
+
${fullOutput}
|
|
102
|
+
|
|
103
|
+
--------EMULATOR START OUTPUT--------`));
|
|
104
|
+
}, timeoutSeconds * 1000);
|
|
105
|
+
this.process.stdout.on("data", (txt) => {
|
|
106
|
+
const output = txt.toString();
|
|
107
|
+
fullOutput += output;
|
|
108
|
+
if (output.includes("All emulators ready!")) {
|
|
109
|
+
clearTimeout(unexpectedTimeout);
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
r();
|
|
112
|
+
}, 2000);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
stop(immediate, timeoutSec) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const write = window.Cypress ? console.log : process.stdout.write;
|
|
121
|
+
const timeout = (timeoutSec || 10) * 1000;
|
|
122
|
+
const kill = (r) => {
|
|
123
|
+
if (window.Cypress)
|
|
124
|
+
this.killRelatedPorts();
|
|
125
|
+
else
|
|
126
|
+
this.process.kill("SIGINT");
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
r();
|
|
129
|
+
}, 2000);
|
|
130
|
+
};
|
|
131
|
+
if (immediate) {
|
|
132
|
+
return new Promise((res) => {
|
|
133
|
+
kill(res);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const clear = (message) => {
|
|
138
|
+
if (window.Cypress)
|
|
139
|
+
return;
|
|
140
|
+
write(new Array(message.length).fill("\r").join(""));
|
|
141
|
+
write(new Array(message.length).fill(" ").join(""));
|
|
142
|
+
};
|
|
143
|
+
return new Promise((res) => {
|
|
144
|
+
let remaining = timeout / 1000;
|
|
145
|
+
let message;
|
|
146
|
+
const interval = setInterval(() => {
|
|
147
|
+
if (message)
|
|
148
|
+
clear(message);
|
|
149
|
+
message = `Killing emulator in ${remaining} seconds`;
|
|
150
|
+
write(message);
|
|
151
|
+
remaining -= 1;
|
|
152
|
+
if (remaining === 0) {
|
|
153
|
+
kill(res);
|
|
154
|
+
clear(message);
|
|
155
|
+
write("Emulator killed");
|
|
156
|
+
clearInterval(interval);
|
|
157
|
+
}
|
|
158
|
+
}, 1000);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.EmulatorController = new FirebaseEmulatorInterface();
|
|
165
|
+
function cyPromise(someAssertion) {
|
|
166
|
+
return new Promise((r) => {
|
|
167
|
+
someAssertion.then(r);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
exports.cyPromise = cyPromise;
|
|
171
|
+
function initTestFirebase(fakeProjectId, setupEnv) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const testEnv = yield (0, rules_unit_testing_1.initializeTestEnvironment)({
|
|
174
|
+
projectId: fakeProjectId,
|
|
175
|
+
firestore: {
|
|
176
|
+
host: "localhost",
|
|
177
|
+
port: 8080,
|
|
178
|
+
},
|
|
179
|
+
storage: {
|
|
180
|
+
host: "localhost",
|
|
181
|
+
port: 9199,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
yield testEnv.withSecurityRulesDisabled((ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const firestore = ctx.firestore({
|
|
186
|
+
experimentalForceLongPolling: true,
|
|
187
|
+
});
|
|
188
|
+
const storage = ctx.storage();
|
|
189
|
+
if (setupEnv)
|
|
190
|
+
yield setupEnv(firestore, storage, testEnv);
|
|
191
|
+
}));
|
|
192
|
+
return testEnv;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
exports.initTestFirebase = initTestFirebase;
|
|
14
196
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/__test__/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/__test__/utils.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAId,qEAGsC;AAEtC,mFAAmF;AACnF,SAAgB,WAAW,CAAC,EAAE,GAAG,GAAG;IAClC,OAAO,IAAI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height, 62px);
|
|
26
26
|
$buttonMinWidth: var(--button-min-width, 150px);
|
|
27
|
+
$buttonBorderRadius: var(--button-border-radius, 8px);
|
|
28
|
+
$buttonTextColor: var(--button-text-color, white);
|
|
27
29
|
|
|
28
30
|
$tooltipBackgroudColor: var(--tooltip-background-color, $digitalBlue);
|
|
29
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdaptiveButton.js","sourceRoot":"","sources":["../../../src/components/AdaptiveButton/AdaptiveButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"AdaptiveButton.js","sourceRoot":"","sources":["../../../src/components/AdaptiveButton/AdaptiveButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAMe;AACf,uDAA+B;AAC/B,8CAAyD;AACzD,uFAA+D;AAC/D,8FAAkD;AAElD;;IAEI;AACJ,SAAwB,cAAc,CAAC,EAMN;QANM,EACrC,QAAQ,EACR,SAAS,GAAG,EAAE,OAIiB,EAH5B,WAAW,cAHuB,yBAItC,CADe;IAId,MAAM,eAAe,GACnB,IAAA,cAAM,EAA4C,IAAI,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,IAAA,cAAM,EAAoB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,eAAe,CAAC,OAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;QAC/D,IAAI,UAAU;YAAE,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,UAAU,CAAC,WAAW,IAAI,CAAC;QACvE,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,UAAU,GAAG,eAAe,CAAC,OAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;YAC/D,IAAI,UAAU,EAAE;gBACd,MAAM,SAAS,GAAG,UAAU,CAAC,SAA2B,CAAC;gBACzD,IAAI,SAAS,EAAE;oBACb,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC;oBAC3C,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,YAAY,IAAI,CAAC;oBAC7C,SAAS,QAAQ;wBACf,UAAW,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC/B,CAAC;oBACD,UAAU,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;iBACxD;aACF;QACH,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL;QACE,8BAAC,gBAAM,kBACL,SAAS,EAAE,GAAG,oCAAM,CAAC,WAAW,IAAI,SAAS,EAAE,EAC/C,GAAG,EAAE,SAAS,IACV,WAAW;YAEf,8BAAC,gCAAsB,IACrB,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,qCAAwB,CAAC,MAAM,EAC/C,mBAAmB,EAAE,KAAK,EAC1B,MAAM,EAAE;oBACN,QAAQ,EAAE;wBACR,cAAc,EAAE,oCAAM,CAAC,eAAe;wBACtC,eAAe,EAAE,oCAAM,CAAC,aAAa;qBACtC;oBACD,OAAO,EAAE;wBACP,cAAc,EAAE,oCAAM,CAAC,eAAe;wBACtC,eAAe,EAAE,oCAAM,CAAC,aAAa;qBACtC;iBACF,EACD,SAAS,EAAE,oCAAM,CAAC,YAAY,IAE7B,QAAQ,CACc,CAClB,CACR,CACJ,CAAC;AACJ,CAAC;AA1DD,iCA0DC"}
|
|
@@ -28,7 +28,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const AdaptiveDialog_module_scss_1 = __importDefault(require("./AdaptiveDialog.module.scss"));
|
|
31
|
-
const
|
|
31
|
+
const MutableHamburgerButton_1 = __importDefault(require("../MutableHamburgerButton"));
|
|
32
|
+
const ScrollAndFocusLock_1 = __importDefault(require("../utilitary/ScrollAndFocusLock"));
|
|
32
33
|
/**
|
|
33
34
|
* This component implements a generic drawer that displays it as a drawer on mobile and as a modal on desktop
|
|
34
35
|
**/
|
|
@@ -38,8 +39,6 @@ function AdaptiveDialog({ onClose, open = false, className = "", children, }) {
|
|
|
38
39
|
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
39
40
|
(0, react_1.useEffect)(() => {
|
|
40
41
|
if (open) {
|
|
41
|
-
startOfModal.current.focus();
|
|
42
|
-
document.body.style.overflow = "hidden";
|
|
43
42
|
setIsVisible(true);
|
|
44
43
|
const toggleVisbility = (e) => {
|
|
45
44
|
if (e.animationName === AdaptiveDialog_module_scss_1.default.backdropDismiss) {
|
|
@@ -48,43 +47,14 @@ function AdaptiveDialog({ onClose, open = false, className = "", children, }) {
|
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
rootDivRef.current.addEventListener("animationend", toggleVisbility);
|
|
51
|
-
return () => {
|
|
52
|
-
document.body.style.overflow = "";
|
|
53
|
-
};
|
|
54
50
|
}
|
|
55
51
|
}, [open]);
|
|
56
|
-
const firstAnchor = (0, react_1.useRef)(null);
|
|
57
|
-
const lastAnchor = (0, react_1.useRef)(null);
|
|
58
|
-
const startOfModal = (0, react_1.useRef)(null);
|
|
59
|
-
function onFocusAnchors(e) {
|
|
60
|
-
const focusOnStartOfModal = () => {
|
|
61
|
-
const nextSibling = firstAnchor.current.nextElementSibling;
|
|
62
|
-
if (nextSibling instanceof HTMLDivElement)
|
|
63
|
-
nextSibling.focus();
|
|
64
|
-
};
|
|
65
|
-
if (e.target === firstAnchor.current) {
|
|
66
|
-
if (e.relatedTarget === startOfModal.current)
|
|
67
|
-
lastAnchor.current.focus();
|
|
68
|
-
else
|
|
69
|
-
focusOnStartOfModal();
|
|
70
|
-
}
|
|
71
|
-
else if (e.target === lastAnchor.current &&
|
|
72
|
-
e.relatedTarget !== firstAnchor.current) {
|
|
73
|
-
focusOnStartOfModal();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
(0, react_1.useEffect)(() => {
|
|
77
|
-
if (open)
|
|
78
|
-
startOfModal.current.focus();
|
|
79
|
-
}, []);
|
|
80
52
|
return isVisible || open ? (react_1.default.createElement("div", { ref: rootDivRef, className: `${AdaptiveDialog_module_scss_1.default.backdrop} ${open ? AdaptiveDialog_module_scss_1.default.open : AdaptiveDialog_module_scss_1.default.close} ${expanded ? AdaptiveDialog_module_scss_1.default.expanded : ""}` },
|
|
81
53
|
react_1.default.createElement("div", { className: `${AdaptiveDialog_module_scss_1.default.container} ${className}` },
|
|
82
|
-
react_1.default.createElement(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
children,
|
|
87
|
-
react_1.default.createElement("div", { ref: lastAnchor, tabIndex: 0, onFocus: onFocusAnchors })))) : null;
|
|
54
|
+
react_1.default.createElement(ScrollAndFocusLock_1.default, { open: open },
|
|
55
|
+
onClose && (react_1.default.createElement(MutableHamburgerButton_1.default, { className: AdaptiveDialog_module_scss_1.default.closeBtn, onClick: onClose, state: "closed", size: 24 })),
|
|
56
|
+
react_1.default.createElement("div", { className: AdaptiveDialog_module_scss_1.default.indicator, onClick: () => setExpanded((p) => !p) }),
|
|
57
|
+
children)))) : null;
|
|
88
58
|
}
|
|
89
59
|
exports.default = AdaptiveDialog;
|
|
90
60
|
//# sourceMappingURL=AdaptiveDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdaptiveDialog.js","sourceRoot":"","sources":["../../../src/components/AdaptiveDialog/AdaptiveDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,8FAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"AdaptiveDialog.js","sourceRoot":"","sources":["../../../src/components/AdaptiveDialog/AdaptiveDialog.tsx"],"names":[],"mappings":";;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E,GAAG,oCAAM,CAAC,SAAS,IAAI,SAAS,EAAE;YAChD,8BAAC,4BAAkB,IAAC,IAAI,EAAE,IAAI;gBAC3B,OAAO,IAAI,CACV,8BAAC,gCAAsB,IACrB,SAAS,EAAE,oCAAM,CAAC,QAAQ,EAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAC,QAAQ,EACd,IAAI,EAAE,EAAE,GACR,CACH;gBACD,uCACE,SAAS,EAAE,oCAAM,CAAC,SAAS,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GACrC;gBACD,QAAQ,CACU,CACjB,CACF,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAxDD,iCAwDC"}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
align-items: center;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
z-index: 1000;
|
|
13
|
+
transition: backdrop-filter $veryFast linear;
|
|
14
|
+
backdrop-filter: var(--adaptive-dialog-backdrop-backdrop, initial);
|
|
13
15
|
|
|
14
16
|
@media screen and (orientation: "portrait") {
|
|
15
17
|
align-items: flex-end;
|
|
@@ -53,7 +55,7 @@
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
.container {
|
|
56
|
-
>
|
|
58
|
+
> .closeBtn {
|
|
57
59
|
position: absolute;
|
|
58
60
|
right: 16px;
|
|
59
61
|
top: 16px;
|
|
@@ -2,6 +2,9 @@ import React, { PropsWithChildren } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* A component that you can put anywhere but hides when small enough and shows the control via a fixed floating button
|
|
4
4
|
**/
|
|
5
|
-
export default function AdaptiveSidebar({ children, className, ...props }: PropsWithChildren<{
|
|
5
|
+
export default function AdaptiveSidebar({ children, className, visibilityControlComponent: VisibilityControlComponent, ...props }: PropsWithChildren<{
|
|
6
6
|
className?: string;
|
|
7
|
+
visibilityControlComponent: (props: {
|
|
8
|
+
open: boolean;
|
|
9
|
+
}) => React.ReactElement;
|
|
7
10
|
} & React.HTMLProps<HTMLDivElement>>): JSX.Element;
|
|
@@ -39,15 +39,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const MutableHamburgerButton_1 = __importDefault(require("../MutableHamburgerButton"));
|
|
42
|
+
const ScrollAndFocusLock_1 = __importDefault(require("../utilitary/ScrollAndFocusLock"));
|
|
42
43
|
const AdaptiveSidebar_module_scss_1 = __importDefault(require("./AdaptiveSidebar.module.scss"));
|
|
44
|
+
const DefaultVisibilityControl = ({ open }) => (react_1.default.createElement(MutableHamburgerButton_1.default, { size: 48, state: open ? "closed" : "default" }));
|
|
43
45
|
/**
|
|
44
46
|
* A component that you can put anywhere but hides when small enough and shows the control via a fixed floating button
|
|
45
47
|
**/
|
|
46
48
|
function AdaptiveSidebar(_a) {
|
|
47
|
-
var { children, className = "" } = _a, props = __rest(_a, ["children", "className"]);
|
|
49
|
+
var { children, className = "", visibilityControlComponent: VisibilityControlComponent = DefaultVisibilityControl } = _a, props = __rest(_a, ["children", "className", "visibilityControlComponent"]);
|
|
48
50
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
49
51
|
const containerRef = (0, react_1.useRef)(null);
|
|
50
52
|
(0, react_1.useEffect)(() => {
|
|
53
|
+
if (process.env.NODE_ENV === "test")
|
|
54
|
+
return;
|
|
51
55
|
containerRef.current.scrollTo({
|
|
52
56
|
left: 0,
|
|
53
57
|
behavior: "smooth",
|
|
@@ -55,9 +59,12 @@ function AdaptiveSidebar(_a) {
|
|
|
55
59
|
});
|
|
56
60
|
}, [open]);
|
|
57
61
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
58
|
-
react_1.default.createElement("div", Object.assign({ ref: containerRef, className: `${AdaptiveSidebar_module_scss_1.default.container} ${
|
|
62
|
+
react_1.default.createElement("div", Object.assign({ ref: containerRef, className: `${AdaptiveSidebar_module_scss_1.default.container} ${DefaultVisibilityControl === VisibilityControlComponent
|
|
63
|
+
? AdaptiveSidebar_module_scss_1.default.defaultPadding
|
|
64
|
+
: ""} ${open ? AdaptiveSidebar_module_scss_1.default.open : AdaptiveSidebar_module_scss_1.default.closed} ${className}` }, props),
|
|
65
|
+
react_1.default.createElement(ScrollAndFocusLock_1.default, { open: open }, children)),
|
|
59
66
|
react_1.default.createElement("div", { className: AdaptiveSidebar_module_scss_1.default.hamburger, onClick: () => setOpen((a) => !a) },
|
|
60
|
-
react_1.default.createElement(
|
|
67
|
+
react_1.default.createElement(VisibilityControlComponent, { open: open }))));
|
|
61
68
|
}
|
|
62
69
|
exports.default = AdaptiveSidebar;
|
|
63
70
|
//# sourceMappingURL=AdaptiveSidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdaptiveSidebar.js","sourceRoot":"","sources":["../../../src/components/AdaptiveSidebar/AdaptiveSidebar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,uFAA+D;AAC/D,gGAAmD;AAEnD;;IAEI;AACJ,SAAwB,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"AdaptiveSidebar.js","sourceRoot":"","sources":["../../../src/components/AdaptiveSidebar/AdaptiveSidebar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,uFAA+D;AAC/D,yFAAiE;AACjE,gGAAmD;AAEnD,MAAM,wBAAwB,GAAG,CAAC,EAAE,IAAI,EAAqB,EAAE,EAAE,CAAC,CAChE,8BAAC,gCAAsB,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAI,CACzE,CAAC;AAEF;;IAEI;AACJ,SAAwB,eAAe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
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.container {
|
|
30
|
-
|
|
30
|
+
box-sizing: border-box;
|
|
31
31
|
height: 100%;
|
|
32
32
|
|
|
33
33
|
@media screen and (max-width: 640px) {
|
|
34
|
-
|
|
34
|
+
&.defaultPadding {
|
|
35
|
+
padding-top: #{$hamburgerSize + $hamburgerOffset * 2}px;
|
|
36
|
+
}
|
|
35
37
|
position: fixed;
|
|
36
38
|
width: 100%;
|
|
37
39
|
overflow: auto;
|
|
@@ -9,6 +9,9 @@ export declare const InitialImplementation: {
|
|
|
9
9
|
(args: any): JSX.Element;
|
|
10
10
|
args: Partial<{
|
|
11
11
|
className?: string | undefined;
|
|
12
|
+
visibilityControlComponent: (props: {
|
|
13
|
+
open: boolean;
|
|
14
|
+
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
12
15
|
} & React.HTMLProps<HTMLDivElement> & {
|
|
13
16
|
children?: React.ReactNode;
|
|
14
17
|
}>;
|
|
@@ -5,6 +5,7 @@ declare type Props = {
|
|
|
5
5
|
open: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
|
+
export declare function updateTooltipPosition(tooltipRef: HTMLDivElement, anchorRef: HTMLElement, limitToViewport?: boolean): void;
|
|
8
9
|
/**
|
|
9
10
|
* This tooltip anchors itself to an element and handles positioning relative to the anchored element
|
|
10
11
|
**/
|