@onepercentio/one-ui 0.1.3 → 0.1.6
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/WebpackConfigs/email-templates.js +1 -1
- package/WebpackConfigs/scripts/css-inliner.ts +27 -0
- package/WebpackConfigs/templates/index.html +6 -0
- 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 +1 -0
- package/dist/__test__/firestore.js +20 -0
- package/dist/__test__/firestore.js.map +1 -0
- package/dist/__test__/utils.d.ts +16 -0
- package/dist/__test__/utils.js +179 -2
- package/dist/__test__/utils.js.map +1 -1
- package/dist/assets/styles/variables.scss +2 -0
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +2 -2
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js.map +1 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.module.scss +3 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +2 -0
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.d.ts +1 -0
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +42 -36
- 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 +3 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +14 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js.map +1 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.d.ts +2 -1
- 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/context/OneUIProvider.d.ts +10 -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 +19 -0
- package/package.json +15 -9
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
function getTextNodesIn(elem: HTMLElement): ChildNode[] {
|
|
2
|
+
var textNodes: ChildNode[] = [];
|
|
3
|
+
if (elem) {
|
|
4
|
+
for (var nodes = elem.childNodes, i = nodes.length; i--;) {
|
|
5
|
+
var node = nodes[i], nodeType = node.nodeType;
|
|
6
|
+
if (nodeType == 3) {
|
|
7
|
+
textNodes.push(node);
|
|
8
|
+
}
|
|
9
|
+
else if (nodeType == 1 || nodeType == 9 || nodeType == 11) {
|
|
10
|
+
textNodes = textNodes.concat(getTextNodesIn(node as HTMLElement));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return textNodes;
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
export default function inlineCSS() {
|
|
2
18
|
if (process.env.NODE_ENV === "development") return;
|
|
3
19
|
const allEls = Array.from(document.querySelectorAll("*")) as HTMLElement[];
|
|
@@ -19,6 +35,17 @@ export default function inlineCSS() {
|
|
|
19
35
|
el.setAttribute("style", s);
|
|
20
36
|
});
|
|
21
37
|
|
|
38
|
+
getTextNodesIn(document.body).forEach(n => {
|
|
39
|
+
n.replaceWith(...n.textContent
|
|
40
|
+
.split(/\n/g)
|
|
41
|
+
.reduce((r, txt, i, arr) =>
|
|
42
|
+
(arr.length - 1 === i )
|
|
43
|
+
? [...r, txt]
|
|
44
|
+
: [...r, txt, document.createElement("br")],
|
|
45
|
+
[] as (Node | string)[])
|
|
46
|
+
);
|
|
47
|
+
})
|
|
48
|
+
|
|
22
49
|
if (process.env.NODE_ENV !== "test")
|
|
23
50
|
document.querySelectorAll("style").forEach((e) => e.remove());
|
|
24
51
|
}
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function createDoc(firestore: any, path: string, data: any): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
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.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
|
+
//# sourceMappingURL=firestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../src/__test__/firestore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAiD;AAEjD,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"}
|
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): 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,191 @@
|
|
|
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 [4400, 8055]) {
|
|
31
|
+
try {
|
|
32
|
+
if (window.Cypress)
|
|
33
|
+
cy.exec(`kill $(lsof -t -i:${port})`, { failOnNonZeroExit: false });
|
|
34
|
+
else
|
|
35
|
+
require("child_process").execSync(`kill -9 $(lsof -t -i:${port})`, {
|
|
36
|
+
stdio: "ignore",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (e) { }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
waitUntilUp() {
|
|
43
|
+
cy.wrap(null).then(() => {
|
|
44
|
+
return new Cypress.Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let breakLoop = false;
|
|
46
|
+
const timeout = setTimeout(() => {
|
|
47
|
+
breakLoop = true;
|
|
48
|
+
rej("Could not receive ok from firebase emulator");
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
}, 30000);
|
|
51
|
+
while (!breakLoop) {
|
|
52
|
+
try {
|
|
53
|
+
yield fetch("http://localhost:4000", {
|
|
54
|
+
mode: "no-cors",
|
|
55
|
+
});
|
|
56
|
+
res();
|
|
57
|
+
clearTimeout(timeout);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
catch (e) { }
|
|
61
|
+
yield WaitTimeout(1000);
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
start(fakeProjectName) {
|
|
67
|
+
this.killRelatedPorts();
|
|
68
|
+
if (window.Cypress) {
|
|
69
|
+
const command = `firebase emulators:start -P ${fakeProjectName} &`;
|
|
70
|
+
cy.on("fail", (error) => {
|
|
71
|
+
if (error.message.includes(command))
|
|
72
|
+
return false;
|
|
73
|
+
});
|
|
74
|
+
cy.on("uncaught:exception", (error) => {
|
|
75
|
+
if (error.message.includes(command))
|
|
76
|
+
return false;
|
|
77
|
+
});
|
|
78
|
+
cy.exec(command, {
|
|
79
|
+
timeout: 1000, // Instant fail
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.process = require("child_process").spawn("firebase", ["emulators:start", "-P", "whz-test"], {
|
|
84
|
+
stdio: "pipe",
|
|
85
|
+
});
|
|
86
|
+
return new Promise((r, rej) => {
|
|
87
|
+
let fullOutput = "";
|
|
88
|
+
const timeoutSeconds = 20;
|
|
89
|
+
const unexpectedTimeout = setTimeout(() => {
|
|
90
|
+
rej(new Error(`Waited for 20 seconds and didn't received ok from emulator.
|
|
91
|
+
|
|
92
|
+
Below is the full output:
|
|
93
|
+
|
|
94
|
+
--------EMULATOR START OUTPUT--------
|
|
95
|
+
|
|
96
|
+
${fullOutput}
|
|
97
|
+
|
|
98
|
+
--------EMULATOR START OUTPUT--------`));
|
|
99
|
+
}, timeoutSeconds * 1000);
|
|
100
|
+
this.process.stdout.on("data", (txt) => {
|
|
101
|
+
const output = txt.toString();
|
|
102
|
+
fullOutput += output;
|
|
103
|
+
if (output.includes("All emulators ready!")) {
|
|
104
|
+
clearTimeout(unexpectedTimeout);
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
r();
|
|
107
|
+
}, 2000);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
stop(immediate, timeoutSec) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const write = window.Cypress ? console.log : process.stdout.write;
|
|
116
|
+
const timeout = (timeoutSec || 10) * 1000;
|
|
117
|
+
const kill = (r) => {
|
|
118
|
+
if (window.Cypress)
|
|
119
|
+
this.killRelatedPorts();
|
|
120
|
+
else
|
|
121
|
+
this.process.kill("SIGINT");
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
r();
|
|
124
|
+
}, 2000);
|
|
125
|
+
};
|
|
126
|
+
if (immediate) {
|
|
127
|
+
return new Promise((res) => {
|
|
128
|
+
kill(res);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const clear = (message) => {
|
|
133
|
+
if (window.Cypress)
|
|
134
|
+
return;
|
|
135
|
+
write(new Array(message.length).fill("\r").join(""));
|
|
136
|
+
write(new Array(message.length).fill(" ").join(""));
|
|
137
|
+
};
|
|
138
|
+
return new Promise((res) => {
|
|
139
|
+
let remaining = timeout / 1000;
|
|
140
|
+
let message;
|
|
141
|
+
const interval = setInterval(() => {
|
|
142
|
+
if (message)
|
|
143
|
+
clear(message);
|
|
144
|
+
message = `Killing emulator in ${remaining} seconds`;
|
|
145
|
+
write(message);
|
|
146
|
+
remaining -= 1;
|
|
147
|
+
if (remaining === 0) {
|
|
148
|
+
kill(res);
|
|
149
|
+
clear(message);
|
|
150
|
+
write("Emulator killed");
|
|
151
|
+
clearInterval(interval);
|
|
152
|
+
}
|
|
153
|
+
}, 1000);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.EmulatorController = new FirebaseEmulatorInterface();
|
|
160
|
+
function cyPromise(someAssertion) {
|
|
161
|
+
return new Promise((r) => {
|
|
162
|
+
someAssertion.then(r);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
exports.cyPromise = cyPromise;
|
|
166
|
+
function initTestFirebase(fakeProjectId, setupEnv) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const testEnv = yield (0, rules_unit_testing_1.initializeTestEnvironment)({
|
|
169
|
+
projectId: fakeProjectId,
|
|
170
|
+
firestore: {
|
|
171
|
+
host: "localhost",
|
|
172
|
+
port: 8080,
|
|
173
|
+
},
|
|
174
|
+
storage: {
|
|
175
|
+
host: "localhost",
|
|
176
|
+
port: 9199,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
yield testEnv.withSecurityRulesDisabled((ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const firestore = ctx.firestore({
|
|
181
|
+
experimentalForceLongPolling: true,
|
|
182
|
+
});
|
|
183
|
+
const storage = ctx.storage();
|
|
184
|
+
if (setupEnv)
|
|
185
|
+
yield setupEnv(firestore, storage, testEnv);
|
|
186
|
+
}));
|
|
187
|
+
return testEnv;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
exports.initTestFirebase = initTestFirebase;
|
|
14
191
|
//# 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,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE;QAC7B,UAAU,CAAC,GAAG,EAAE;YACd,CAAC,EAAE,CAAC;QACN,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO;aACtB,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;YAAE,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC;AARD,kCAQC;AAED,MAAM,yBAAyB;IAGrB,gBAAgB;QACtB,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;YAC7B,IAAI;gBACF,IAAI,MAAM,CAAC,OA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,4BAA4B,EAAE,IAAI;aACnC,CAAQ,CAAC;YAEV,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAS,CAAC;YACrC,IAAI,QAAQ;gBAAE,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AA7BD,4CA6BC"}
|
|
@@ -24,6 +24,8 @@ $tableRowBorderColor: var(--table-row-border-color, #bec1ca);
|
|
|
24
24
|
|
|
25
25
|
$buttonMinHeight: var(--button-min-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
|
|
|
@@ -28,7 +28,7 @@ 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
32
|
/**
|
|
33
33
|
* This component implements a generic drawer that displays it as a drawer on mobile and as a modal on desktop
|
|
34
34
|
**/
|
|
@@ -81,7 +81,7 @@ function AdaptiveDialog({ onClose, open = false, className = "", children, }) {
|
|
|
81
81
|
react_1.default.createElement("div", { className: `${AdaptiveDialog_module_scss_1.default.container} ${className}` },
|
|
82
82
|
react_1.default.createElement("div", { ref: firstAnchor, tabIndex: 0, onFocus: onFocusAnchors }),
|
|
83
83
|
react_1.default.createElement("div", { ref: startOfModal, tabIndex: 0 }),
|
|
84
|
-
onClose && (react_1.default.createElement(
|
|
84
|
+
onClose && (react_1.default.createElement(MutableHamburgerButton_1.default, { className: AdaptiveDialog_module_scss_1.default.closeBtn, onClick: onClose, state: "closed", size: 24 })),
|
|
85
85
|
react_1.default.createElement("div", { className: AdaptiveDialog_module_scss_1.default.indicator, onClick: () => setExpanded((p) => !p) }),
|
|
86
86
|
children,
|
|
87
87
|
react_1.default.createElement("div", { ref: lastAnchor, tabIndex: 0, onFocus: onFocusAnchors })))) : null;
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,8FAAkD;AAClD,uFAA+D;AAE/D;;IAEI;AACJ,SAAwB,cAAc,CAAC,EACrC,OAAO,EACP,IAAI,GAAG,KAAK,EACZ,SAAS,GAAG,EAAE,EACd,QAAQ,GAKR;IACA,MAAM,UAAU,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEhD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,IAAI,EAAE;YACR,YAAY,CAAC,OAAQ,CAAC,KAAK,EAAE,CAAC;YAC9B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACxC,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,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
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;
|
|
@@ -48,6 +48,8 @@ function AdaptiveSidebar(_a) {
|
|
|
48
48
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
49
49
|
const containerRef = (0, react_1.useRef)(null);
|
|
50
50
|
(0, react_1.useEffect)(() => {
|
|
51
|
+
if (process.env.NODE_ENV === "test")
|
|
52
|
+
return;
|
|
51
53
|
containerRef.current.scrollTo({
|
|
52
54
|
left: 0,
|
|
53
55
|
behavior: "smooth",
|
|
@@ -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,EAMvC;QANuC,EACtC,QAAQ,EACR,SAAS,GAAG,EAAE,OAIf,EAHI,KAAK,cAH8B,yBAIvC,CADS;IAIR,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAQ,CAAC,QAAQ,CAAC;YAC7B,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,QAAQ;YAClB,GAA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7B,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,QAAQ;YAClB,GAAG,EAAE,CAAC;SACP,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL;QACE,qDACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,GAAG,qCAAM,CAAC,SAAS,IAC5B,IAAI,CAAC,CAAC,CAAC,qCAAM,CAAC,IAAI,CAAC,CAAC,CAAC,qCAAM,CAAC,MAC9B,IAAI,SAAS,EAAE,IACX,KAAK,GAER,QAAQ,CACL;QACN,uCAAK,SAAS,EAAE,qCAAM,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjE,8BAAC,gCAAsB,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAI,CACpE,CACL,CACJ,CAAC;AACJ,CAAC;AAnCD,kCAmCC"}
|
|
@@ -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
|
**/
|
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.updateTooltipPosition = void 0;
|
|
29
30
|
const react_1 = __importStar(require("react"));
|
|
30
31
|
const FadeIn_1 = __importDefault(require("../FadeIn"));
|
|
31
32
|
const AnchoredTooltip_module_scss_1 = __importDefault(require("./AnchoredTooltip.module.scss"));
|
|
@@ -33,32 +34,30 @@ function getPositionOnViewport(element) {
|
|
|
33
34
|
return element.getBoundingClientRect();
|
|
34
35
|
}
|
|
35
36
|
function calculateTooltipFromAnchor(anchorRef, tooltipRef) {
|
|
36
|
-
const anchorPosition = getPositionOnViewport(anchorRef
|
|
37
|
-
const shouldAnchorToBottom = tooltipRef.
|
|
38
|
-
let top = anchorPosition.top - tooltipRef.
|
|
39
|
-
let left = anchorPosition.left +
|
|
40
|
-
anchorPosition.width / 2 -
|
|
41
|
-
tooltipRef.current.clientWidth / 2;
|
|
37
|
+
const anchorPosition = getPositionOnViewport(anchorRef);
|
|
38
|
+
const shouldAnchorToBottom = tooltipRef.clientHeight > anchorPosition.top;
|
|
39
|
+
let top = anchorPosition.top - tooltipRef.clientHeight;
|
|
40
|
+
let left = anchorPosition.left + anchorPosition.width / 2 - tooltipRef.clientWidth / 2;
|
|
42
41
|
if (shouldAnchorToBottom)
|
|
43
|
-
top += tooltipRef.
|
|
42
|
+
top += tooltipRef.clientHeight + anchorRef.clientHeight;
|
|
44
43
|
if (top < 0)
|
|
45
44
|
top = 0;
|
|
46
|
-
const offset = top + tooltipRef.
|
|
45
|
+
const offset = top + tooltipRef.clientHeight - window.innerHeight;
|
|
47
46
|
if (offset > 0) {
|
|
48
47
|
top -= offset;
|
|
49
48
|
}
|
|
50
|
-
const offsetLeft = left + tooltipRef.
|
|
49
|
+
const offsetLeft = left + tooltipRef.clientWidth - window.innerWidth;
|
|
51
50
|
if (offsetLeft > 0) {
|
|
52
51
|
left -= offsetLeft;
|
|
53
52
|
}
|
|
54
53
|
if (left < 0) {
|
|
55
54
|
left = 0;
|
|
56
55
|
}
|
|
57
|
-
const maxLeftOffsetIndicator = tooltipRef.
|
|
58
|
-
const tooltipCenter = tooltipRef.
|
|
56
|
+
const maxLeftOffsetIndicator = tooltipRef.clientWidth / 2 - 60;
|
|
57
|
+
const tooltipCenter = tooltipRef.clientWidth / 2 + left;
|
|
59
58
|
const anchorPositionCenter = anchorPosition.left + anchorPosition.width / 2;
|
|
60
59
|
const offsetTooltip = anchorPositionCenter - tooltipCenter;
|
|
61
|
-
const minOffsetTooltip = -(tooltipRef.
|
|
60
|
+
const minOffsetTooltip = -(tooltipRef.clientWidth / 2) + 60;
|
|
62
61
|
const offsetIndicatorLeft = offsetLeft > 0
|
|
63
62
|
? offsetLeft > maxLeftOffsetIndicator
|
|
64
63
|
? maxLeftOffsetIndicator
|
|
@@ -76,33 +75,38 @@ function calculateTooltipFromAnchor(anchorRef, tooltipRef) {
|
|
|
76
75
|
shouldAnchorToBottom,
|
|
77
76
|
};
|
|
78
77
|
}
|
|
78
|
+
function updateTooltipPosition(tooltipRef, anchorRef, limitToViewport) {
|
|
79
|
+
const { top, left, shouldAnchorToBottom, offsetIndicatorLeft } = calculateTooltipFromAnchor(anchorRef, tooltipRef);
|
|
80
|
+
if (limitToViewport) {
|
|
81
|
+
const maxHeight = window.innerHeight - top;
|
|
82
|
+
tooltipRef.style.maxHeight = `${maxHeight - 32}px`;
|
|
83
|
+
}
|
|
84
|
+
tooltipRef.style.top = `${top}px`;
|
|
85
|
+
tooltipRef.style.left = `${left}px`;
|
|
86
|
+
tooltipRef.style.setProperty("--anchor-indicator-offset-left", `${offsetIndicatorLeft}px`);
|
|
87
|
+
if (shouldAnchorToBottom) {
|
|
88
|
+
tooltipRef.classList.remove(AnchoredTooltip_module_scss_1.default.anchoredTop);
|
|
89
|
+
tooltipRef.classList.add(AnchoredTooltip_module_scss_1.default.anchoredBottom);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
tooltipRef.classList.add(AnchoredTooltip_module_scss_1.default.anchoredTop);
|
|
93
|
+
tooltipRef.classList.remove(AnchoredTooltip_module_scss_1.default.anchoredBottom);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.updateTooltipPosition = updateTooltipPosition;
|
|
79
97
|
/**
|
|
80
98
|
* This tooltip anchors itself to an element and handles positioning relative to the anchored element
|
|
81
99
|
**/
|
|
82
100
|
function AnchoredTooltip(props) {
|
|
83
101
|
const { open, children, anchorRef } = props;
|
|
84
102
|
const tooltipRef = (0, react_1.useRef)(null);
|
|
85
|
-
function updateTooltipPosition() {
|
|
86
|
-
if (!anchorRef.current)
|
|
87
|
-
return;
|
|
88
|
-
const { top, left, shouldAnchorToBottom, offsetIndicatorLeft } = calculateTooltipFromAnchor(anchorRef, tooltipRef);
|
|
89
|
-
tooltipRef.current.style.top = `${top}px`;
|
|
90
|
-
tooltipRef.current.style.left = `${left}px`;
|
|
91
|
-
tooltipRef.current.style.setProperty("--anchor-indicator-offset-left", `${offsetIndicatorLeft}px`);
|
|
92
|
-
if (shouldAnchorToBottom) {
|
|
93
|
-
tooltipRef.current.classList.remove(AnchoredTooltip_module_scss_1.default.anchoredTop);
|
|
94
|
-
tooltipRef.current.classList.add(AnchoredTooltip_module_scss_1.default.anchoredBottom);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
tooltipRef.current.classList.add(AnchoredTooltip_module_scss_1.default.anchoredTop);
|
|
98
|
-
tooltipRef.current.classList.remove(AnchoredTooltip_module_scss_1.default.anchoredBottom);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
103
|
(0, react_1.useEffect)(() => {
|
|
102
104
|
if (open) {
|
|
103
|
-
|
|
105
|
+
if (anchorRef.current && tooltipRef.current)
|
|
106
|
+
updateTooltipPosition(tooltipRef.current, anchorRef.current);
|
|
104
107
|
const scrollHandler = () => {
|
|
105
|
-
|
|
108
|
+
if (anchorRef.current && tooltipRef.current)
|
|
109
|
+
updateTooltipPosition(tooltipRef.current, anchorRef.current);
|
|
106
110
|
};
|
|
107
111
|
window.addEventListener("scroll", scrollHandler);
|
|
108
112
|
return () => {
|
|
@@ -142,12 +146,14 @@ function DebuggingHelper(props) {
|
|
|
142
146
|
} },
|
|
143
147
|
"Calculated info:",
|
|
144
148
|
react_1.default.createElement("br", null),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
props.anchorRef.current &&
|
|
150
|
+
props.tooltipRef.current &&
|
|
151
|
+
Object.entries(calculateTooltipFromAnchor(props.anchorRef.current, props.tooltipRef.current)).map(([k, v]) => {
|
|
152
|
+
return (react_1.default.createElement("p", null,
|
|
153
|
+
react_1.default.createElement("b", null, k),
|
|
154
|
+
": ",
|
|
155
|
+
typeof v !== "boolean" ? v : v ? "true" : "false"));
|
|
156
|
+
}),
|
|
151
157
|
"Window info:",
|
|
152
158
|
react_1.default.createElement("br", null),
|
|
153
159
|
react_1.default.createElement("p", null,
|