@homefile/components-v2 2.63.0 → 2.64.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/dist/components/onboarding/CardFooter.js +2 -1
- package/dist/components/onboarding/pages/ActivateAccount.js +3 -3
- package/dist/components/onboarding/pages/AuthHeader.js +2 -2
- package/dist/components/onboarding/pages/BasePageWrapper.d.ts +32 -1
- package/dist/components/onboarding/pages/BasePageWrapper.js +23 -3
- package/dist/components/onboarding/pages/EmailValidation.js +2 -2
- package/dist/components/onboarding/pages/MessagePage.js +3 -3
- package/dist/components/onboarding/pages/NewPassword.js +3 -3
- package/dist/components/onboarding/pages/ResendResetPassword.js +2 -2
- package/dist/components/onboarding/pages/ResetPassword.js +3 -3
- package/dist/components/onboarding/pages/SignIn.js +3 -3
- package/dist/components/onboarding/pages/SignUp.js +3 -3
- package/dist/components/onboarding/pages/TwoFactor.d.ts +1 -1
- package/dist/components/onboarding/pages/TwoFactor.js +13 -4
- package/dist/components/onboarding/pages/Welcome.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/pages/TwoFactor.interface.d.ts +2 -1
- package/dist/stories/foundations/EnglishStrings.stories.d.ts +4 -0
- package/dist/stories/foundations/EnglishStrings.stories.js +66 -0
- package/dist/stories/onboarding/CardFooter.stories.d.ts +2 -1
- package/dist/stories/onboarding/CardFooter.stories.js +24 -0
- package/dist/stories/onboarding/pages/ActivateAccount.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/ActivateAccount.stories.js +41 -0
- package/dist/stories/onboarding/pages/EmailValidation.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/EmailValidation.stories.js +43 -0
- package/dist/stories/onboarding/pages/MessagePage.stories.js +10 -2
- package/dist/stories/onboarding/pages/NewPassword.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/NewPassword.stories.js +44 -0
- package/dist/stories/onboarding/pages/ResendResetPassword.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/ResendResetPassword.stories.js +47 -0
- package/dist/stories/onboarding/pages/ResetPassword.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/ResetPassword.stories.js +45 -0
- package/dist/stories/onboarding/pages/SignIn.stories.d.ts +2 -0
- package/dist/stories/onboarding/pages/SignIn.stories.js +52 -0
- package/dist/stories/onboarding/pages/SignUp.stories.d.ts +2 -1
- package/dist/stories/onboarding/pages/SignUp.stories.js +34 -0
- package/dist/stories/onboarding/pages/TwoFactor.stories.d.ts +3 -1
- package/dist/stories/onboarding/pages/TwoFactor.stories.js +68 -11
- package/dist/stories/onboarding/pages/Welcome.stories.d.ts +2 -1
- package/dist/stories/onboarding/pages/Welcome.stories.js +29 -0
- package/dist/stories/onboarding/phoneLayout.d.ts +20 -0
- package/dist/stories/onboarding/phoneLayout.js +89 -0
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { expect } from '@storybook/test';
|
|
11
|
+
// Onboarding pages on a phone (Matt, 2026-10-07): the card fills the screen
|
|
12
|
+
// from side to side, and its fields and buttons keep 13px from each side.
|
|
13
|
+
// The full-screen pages also start at the very top, with no bar above the card.
|
|
14
|
+
export const PHONE = {
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
viewport: { defaultViewport: 'iphone12' }, // 390x844
|
|
17
|
+
};
|
|
18
|
+
// A small tablet, between the 480px and 768px breakpoints (iPad mini, 744x1133).
|
|
19
|
+
export const SMALL_TABLET = {
|
|
20
|
+
layout: 'fullscreen',
|
|
21
|
+
viewport: { defaultViewport: 'ipadmini' },
|
|
22
|
+
};
|
|
23
|
+
const SIDE = 13;
|
|
24
|
+
// The onboarding top gap ('onboarding.top', 3.125rem).
|
|
25
|
+
const TOP_GAP = 50;
|
|
26
|
+
// The page's card: the first Chakra Container in the story.
|
|
27
|
+
export const getCard = (canvasElement) => canvasElement.querySelector('.chakra-container');
|
|
28
|
+
// The card spans the screen from side to side.
|
|
29
|
+
export const expectCardFullWidth = (card) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const box = card.getBoundingClientRect();
|
|
31
|
+
yield expect(Math.round(box.left), 'card left').toBe(0);
|
|
32
|
+
yield expect(Math.round(box.right), 'card right').toBe(document.documentElement.clientWidth);
|
|
33
|
+
});
|
|
34
|
+
// The card starts at the very top of the screen: no bar above it.
|
|
35
|
+
export const expectCardAtTop = (card) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
yield expect(Math.round(card.getBoundingClientRect().top), 'card top').toBe(0);
|
|
37
|
+
});
|
|
38
|
+
// The card sits below the onboarding top gap, and is still a card: it has a
|
|
39
|
+
// shadow and is narrower than the screen (tablets and desktops).
|
|
40
|
+
export const expectCardBelowTopGap = (card) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
yield expect(Math.round(card.getBoundingClientRect().top), 'card top').toBe(TOP_GAP);
|
|
42
|
+
yield expect(getComputedStyle(card).boxShadow, 'card shadow').not.toBe('none');
|
|
43
|
+
yield expect(Math.round(card.getBoundingClientRect().width), 'card width').toBeLessThan(document.documentElement.clientWidth);
|
|
44
|
+
});
|
|
45
|
+
// The card has no shadow: on a phone it is the page, not a card on it.
|
|
46
|
+
export const expectNoCardShadow = (card) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
yield expect(getComputedStyle(card).boxShadow, 'card shadow').toBe('none');
|
|
48
|
+
});
|
|
49
|
+
// The page ends at the bottom of the screen, as sign in does on a phone: the
|
|
50
|
+
// card grows down to the copyright, and the copyright sits at the bottom of the
|
|
51
|
+
// screen. A page without the copyright: the card reaches the bottom.
|
|
52
|
+
export const expectPageFillsScreen = (card) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const cardBottom = card.getBoundingClientRect().bottom;
|
|
54
|
+
const footer = card.nextElementSibling;
|
|
55
|
+
if (!footer) {
|
|
56
|
+
yield expect(Math.round(cardBottom), 'card bottom').toBe(window.innerHeight);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const box = footer.getBoundingClientRect();
|
|
60
|
+
const style = getComputedStyle(footer);
|
|
61
|
+
yield expect(Math.round(box.bottom + parseFloat(style.marginBottom)), 'page bottom').toBe(window.innerHeight);
|
|
62
|
+
yield expect(Math.round(cardBottom + parseFloat(style.marginTop)), 'card bottom').toBe(Math.round(box.top));
|
|
63
|
+
});
|
|
64
|
+
// Each element sits 13px in from both sides of the card. A row given as
|
|
65
|
+
// [first, last] is measured from its first element's left side to its last
|
|
66
|
+
// element's right side.
|
|
67
|
+
export const expectSides = (card, elements) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const box = card.getBoundingClientRect();
|
|
69
|
+
for (const [name, element] of Object.entries(elements)) {
|
|
70
|
+
const [first, last] = Array.isArray(element) ? element : [element, element];
|
|
71
|
+
const left = first.getBoundingClientRect().left;
|
|
72
|
+
const right = last.getBoundingClientRect().right;
|
|
73
|
+
yield expect(Math.round(left - box.left), `${name} left`).toBe(SIDE);
|
|
74
|
+
yield expect(Math.round(box.right - right), `${name} right`).toBe(SIDE);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// For a full-width block that sets the margin with its own padding (a centred
|
|
78
|
+
// title): its content starts 13px in from both sides of the card.
|
|
79
|
+
export const expectContentSides = (card, elements) => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
+
const box = card.getBoundingClientRect();
|
|
81
|
+
for (const [name, element] of Object.entries(elements)) {
|
|
82
|
+
const rect = element.getBoundingClientRect();
|
|
83
|
+
const style = getComputedStyle(element);
|
|
84
|
+
const left = rect.left + parseFloat(style.borderLeftWidth) + parseFloat(style.paddingLeft);
|
|
85
|
+
const right = rect.right - parseFloat(style.borderRightWidth) - parseFloat(style.paddingRight);
|
|
86
|
+
yield expect(Math.round(left - box.left), `${name} left`).toBe(SIDE);
|
|
87
|
+
yield expect(Math.round(box.right - right), `${name} right`).toBe(SIDE);
|
|
88
|
+
}
|
|
89
|
+
});
|