@transferwise/components 0.0.0-experimental-15273df → 0.0.0-experimental-d6d5b6e
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/build/Calendar/Calendar.js +94 -16
- package/build/Calendar/Calendar.js.map +1 -1
- package/build/Calendar/Calendar.messages.js +12 -0
- package/build/Calendar/Calendar.messages.js.map +1 -1
- package/build/Calendar/Calendar.messages.mjs +12 -0
- package/build/Calendar/Calendar.messages.mjs.map +1 -1
- package/build/Calendar/Calendar.mjs +95 -17
- package/build/Calendar/Calendar.mjs.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.js +5 -1
- package/build/Calendar/DateHeader/DateHeader.js.map +1 -1
- package/build/Calendar/DateHeader/DateHeader.mjs +5 -1
- package/build/Calendar/DateHeader/DateHeader.mjs.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.js +14 -0
- package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.mjs +14 -0
- package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +53 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +53 -19
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.js +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.js.map +1 -1
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs +6 -0
- package/build/Calendar/MonthCalendar/MonthCalendar.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +8 -3
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
- package/build/Calendar/{tableLink → TableLink}/TableLink.js +26 -11
- package/build/Calendar/TableLink/TableLink.js.map +1 -0
- package/build/Calendar/{tableLink → TableLink}/TableLink.mjs +26 -11
- package/build/Calendar/TableLink/TableLink.mjs.map +1 -0
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs +8 -3
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.js +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.js.map +1 -1
- package/build/Calendar/YearCalendar/YearCalendar.mjs +7 -0
- package/build/Calendar/YearCalendar/YearCalendar.mjs.map +1 -1
- package/build/DateLookup/DateLookup.js +19 -9
- package/build/DateLookup/DateLookup.js.map +1 -1
- package/build/DateLookup/DateLookup.mjs +19 -9
- package/build/DateLookup/DateLookup.mjs.map +1 -1
- package/build/Sticky/Sticky.js +0 -1
- package/build/Sticky/Sticky.js.map +1 -1
- package/build/Sticky/Sticky.mjs +0 -1
- package/build/Sticky/Sticky.mjs.map +1 -1
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.js +40 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.js.map +1 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.mjs +38 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.mjs.map +1 -0
- package/build/i18n/en.json +4 -0
- package/build/i18n/en.json.js +4 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +4 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/main.css +123 -48
- package/build/styles/Calendar/Calendar.css +112 -37
- package/build/styles/Calendar/TableLink/TableLink.css +115 -0
- package/build/styles/main.css +123 -48
- package/build/types/Calendar/Calendar.d.ts +16 -3
- package/build/types/Calendar/Calendar.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.messages.d.ts +20 -0
- package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.types.d.ts +32 -0
- package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts +2 -0
- package/build/types/Calendar/DateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +5 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +4 -0
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts +1 -0
- package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts +2 -1
- package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +3 -1
- package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
- package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts +2 -1
- package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts +1 -0
- package/build/types/Calendar/YearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/Calendar/index.d.ts +1 -0
- package/build/types/Calendar/index.d.ts.map +1 -1
- package/build/types/DateLookup/DateLookup.d.ts +23 -4
- package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/DateLookup/index.d.ts +1 -0
- package/build/types/DateLookup/index.d.ts.map +1 -1
- package/build/types/Sticky/Sticky.d.ts.map +1 -1
- package/build/types/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
- package/build/types/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
- package/build/types/common/DateUtils/index.d.ts +2 -0
- package/build/types/common/DateUtils/index.d.ts.map +1 -1
- package/build/types/common/DateUtils/isDateDisabled/isDateDisabled.d.ts +3 -0
- package/build/types/common/DateUtils/isDateDisabled/isDateDisabled.d.ts.map +1 -0
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +8 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Calendar/Calendar.css +112 -37
- package/src/Calendar/Calendar.disabledDates.test.tsx +518 -0
- package/src/Calendar/Calendar.less +5 -35
- package/src/Calendar/Calendar.messages.ts +21 -0
- package/src/Calendar/Calendar.test.tsx +217 -28
- package/src/Calendar/Calendar.tsx +136 -19
- package/src/Calendar/Calendar.types.ts +35 -0
- package/src/Calendar/DateHeader/DateHeader.tsx +6 -0
- package/src/Calendar/DayCalendar/DayCalendar.tsx +33 -1
- package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +62 -28
- package/src/Calendar/MonthCalendar/MonthCalendar.tsx +8 -0
- package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +15 -3
- package/src/Calendar/TableLink/TableLink.css +115 -0
- package/src/Calendar/TableLink/TableLink.less +68 -0
- package/src/Calendar/{tableLink → TableLink}/TableLink.tsx +29 -14
- package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +15 -3
- package/src/Calendar/YearCalendar/YearCalendar.tsx +9 -0
- package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +118 -0
- package/src/Calendar/_stories/Calendar.story.tsx +138 -4
- package/src/Calendar/index.ts +7 -0
- package/src/DateLookup/DateLookup.disabledDates.test.tsx +293 -0
- package/src/DateLookup/DateLookup.test.tsx +34 -37
- package/src/DateLookup/DateLookup.tsx +36 -13
- package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +108 -0
- package/src/DateLookup/_stories/DateLookup.story.tsx +124 -2
- package/src/DateLookup/index.ts +6 -0
- package/src/Sticky/Sticky.test.tsx +0 -1
- package/src/Sticky/Sticky.tsx +0 -1
- package/src/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
- package/src/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
- package/src/common/DateUtils/index.ts +2 -0
- package/src/common/DateUtils/isDateDisabled/isDateDisabled.test.ts +159 -0
- package/src/common/DateUtils/isDateDisabled/isDateDisabled.ts +59 -0
- package/src/i18n/en.json +4 -0
- package/src/index.ts +3 -2
- package/src/main.css +123 -48
- package/src/main.less +0 -1
- package/build/Calendar/tableLink/TableLink.js.map +0 -1
- package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
- package/build/styles/Sticky/Sticky.css +0 -4
- package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
- package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
- package/src/Sticky/Sticky.css +0 -4
- package/src/Sticky/Sticky.less +0 -6
- package/src/Sticky/_stories/Sticky.test.story.tsx +0 -177
- /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
- /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { Card, Home, Payments, Recipients } from '@transferwise/icons';
|
|
3
|
-
import type { CSSProperties } from 'react';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { expect, userEvent, within } from 'storybook/test';
|
|
6
|
-
|
|
7
|
-
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
8
|
-
import Button from '../../Button';
|
|
9
|
-
import { wait } from '../../test-utils/wait';
|
|
10
|
-
import Sticky from '../Sticky';
|
|
11
|
-
|
|
12
|
-
const SAFE_AREA_INSET = 64;
|
|
13
|
-
const DEMO_HEIGHT = 400;
|
|
14
|
-
const DEMO_WIDTH = 390;
|
|
15
|
-
const SAFE_AREA_VIEWPORT = 'safe-area-demo';
|
|
16
|
-
|
|
17
|
-
type SafeAreaDemoStyle = CSSProperties & {
|
|
18
|
-
'--np-sticky-safe-area-inset-bottom': string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const safeAreaDemoStyle: SafeAreaDemoStyle = {
|
|
22
|
-
'--np-sticky-safe-area-inset-bottom': `${SAFE_AREA_INSET}px`,
|
|
23
|
-
background: 'var(--color-background-screen)',
|
|
24
|
-
height: DEMO_HEIGHT,
|
|
25
|
-
overflow: 'hidden',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const navigationItems = [
|
|
29
|
-
{ Icon: Home, label: 'Home' },
|
|
30
|
-
{ Icon: Card, label: 'Card' },
|
|
31
|
-
{ Icon: Recipients, label: 'Recipients' },
|
|
32
|
-
{ Icon: Payments, label: 'Payments' },
|
|
33
|
-
] as const;
|
|
34
|
-
|
|
35
|
-
function SafeAreaBottomBar() {
|
|
36
|
-
return (
|
|
37
|
-
<nav
|
|
38
|
-
aria-label="Safe area bottom bar"
|
|
39
|
-
data-testid="safe-area-bottom-bar"
|
|
40
|
-
style={{
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
background: 'var(--color-background-elevated)',
|
|
43
|
-
borderTop: '1px solid var(--color-border-neutral)',
|
|
44
|
-
bottom: 0,
|
|
45
|
-
display: 'flex',
|
|
46
|
-
height: SAFE_AREA_INSET,
|
|
47
|
-
justifyContent: 'space-around',
|
|
48
|
-
left: 0,
|
|
49
|
-
padding: '0 8px',
|
|
50
|
-
position: 'fixed',
|
|
51
|
-
right: 0,
|
|
52
|
-
zIndex: 1031,
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
{navigationItems.map(({ Icon, label }) => (
|
|
56
|
-
<span
|
|
57
|
-
key={label}
|
|
58
|
-
style={{
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
color: 'var(--color-content-primary)',
|
|
61
|
-
display: 'flex',
|
|
62
|
-
flexDirection: 'column',
|
|
63
|
-
fontSize: 11,
|
|
64
|
-
gap: 2,
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
<Icon size={24} />
|
|
68
|
-
{label}
|
|
69
|
-
</span>
|
|
70
|
-
))}
|
|
71
|
-
</nav>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function SafeAreaDemo() {
|
|
76
|
-
const [open, setOpen] = useState(false);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<main style={safeAreaDemoStyle}>
|
|
80
|
-
<section style={{ maxWidth: 520, padding: 32 }}>
|
|
81
|
-
<h1 style={{ fontSize: 32, lineHeight: 1.15, margin: '0 0 16px' }}>
|
|
82
|
-
Sticky respects safe area at bottom of screen
|
|
83
|
-
</h1>
|
|
84
|
-
<Button v2 onClick={() => setOpen((currentOpen) => !currentOpen)}>
|
|
85
|
-
{open ? 'Hide Sticky' : 'Show Sticky'}
|
|
86
|
-
</Button>
|
|
87
|
-
</section>
|
|
88
|
-
|
|
89
|
-
<SafeAreaBottomBar />
|
|
90
|
-
|
|
91
|
-
<Sticky open={open} position="bottom" testId="safe-area-sticky">
|
|
92
|
-
<div className="p-a-2" data-testid="sticky-content">
|
|
93
|
-
Sticky
|
|
94
|
-
</div>
|
|
95
|
-
</Sticky>
|
|
96
|
-
</main>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const meta = {
|
|
101
|
-
component: Sticky,
|
|
102
|
-
parameters: {
|
|
103
|
-
controls: { disable: true },
|
|
104
|
-
layout: 'fullscreen',
|
|
105
|
-
},
|
|
106
|
-
tags: ['!autodocs', '!manifest'],
|
|
107
|
-
title: 'Dialogs/Sticky/Tests',
|
|
108
|
-
} satisfies Meta<typeof Sticky>;
|
|
109
|
-
|
|
110
|
-
export default meta;
|
|
111
|
-
|
|
112
|
-
type Story = StoryObj<typeof Sticky>;
|
|
113
|
-
|
|
114
|
-
const SafeAreaRegression: Story = {
|
|
115
|
-
parameters: {
|
|
116
|
-
chromatic: { delay: 500 },
|
|
117
|
-
viewport: {
|
|
118
|
-
options: {
|
|
119
|
-
[SAFE_AREA_VIEWPORT]: {
|
|
120
|
-
name: 'Safe area demo',
|
|
121
|
-
styles: { height: `${DEMO_HEIGHT}px`, width: `${DEMO_WIDTH}px` },
|
|
122
|
-
type: 'mobile',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
globals: {
|
|
128
|
-
viewport: SAFE_AREA_VIEWPORT,
|
|
129
|
-
},
|
|
130
|
-
play: async ({ canvasElement, step }) => {
|
|
131
|
-
const canvas = within(canvasElement);
|
|
132
|
-
|
|
133
|
-
const expectStickyAboveSafeArea = async () => {
|
|
134
|
-
await wait(400);
|
|
135
|
-
|
|
136
|
-
const sticky = canvas.getByTestId('safe-area-sticky');
|
|
137
|
-
const stickyContent = canvas.getByTestId('sticky-content');
|
|
138
|
-
const safeArea = canvas.getByTestId('safe-area-bottom-bar');
|
|
139
|
-
|
|
140
|
-
await expect(sticky).toBeVisible();
|
|
141
|
-
await expect(window.getComputedStyle(sticky).paddingBottom).toBe(`${SAFE_AREA_INSET}px`);
|
|
142
|
-
await expect(Math.round(stickyContent.getBoundingClientRect().bottom)).toBe(
|
|
143
|
-
Math.round(safeArea.getBoundingClientRect().top),
|
|
144
|
-
);
|
|
145
|
-
await expect(stickyContent.getBoundingClientRect().bottom).toBeLessThanOrEqual(
|
|
146
|
-
safeArea.getBoundingClientRect().top,
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
await step('Open Sticky from the top button', async () => {
|
|
151
|
-
await userEvent.click(canvas.getByRole('button', { name: /^show sticky$/i }));
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
await step('Keep Sticky above the bottom safe area', expectStickyAboveSafeArea);
|
|
155
|
-
|
|
156
|
-
await step('Toggle Sticky closed and open again', async () => {
|
|
157
|
-
const hideStickyButton = canvas.getByRole('button', { name: /^hide sticky$/i });
|
|
158
|
-
|
|
159
|
-
await userEvent.click(hideStickyButton);
|
|
160
|
-
await wait(400);
|
|
161
|
-
await expect(canvas.queryByTestId('safe-area-sticky')).not.toBeInTheDocument();
|
|
162
|
-
|
|
163
|
-
await userEvent.click(canvas.getByRole('button', { name: /^show sticky$/i }));
|
|
164
|
-
await expectStickyAboveSafeArea();
|
|
165
|
-
});
|
|
166
|
-
},
|
|
167
|
-
render: () => <SafeAreaDemo />,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Reproduces the MobileNav replacement from DS-7193 with a fixed bottom safe area.
|
|
172
|
-
* It verifies that Sticky clears the inset.
|
|
173
|
-
*/
|
|
174
|
-
export const MobileNavSafeArea: Story = {
|
|
175
|
-
...SafeAreaRegression,
|
|
176
|
-
...withVariantConfig(['mobile'], SafeAreaRegression),
|
|
177
|
-
};
|
|
File without changes
|
|
File without changes
|