@digigov/ui 2.0.0-aefd0709 → 2.0.0-b15d5d44
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/cjs/feedback/ErrorSummary/ErrorSummary.stories/index.js +3 -0
- package/cjs/feedback/ErrorSummary/ErrorSummary.stories.js.map +2 -2
- package/cjs/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput/index.js +49 -0
- package/cjs/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput.js.map +7 -0
- package/cjs/i18n/index.js +18 -1
- package/cjs/i18n/index.js.map +2 -2
- package/cjs/i18n/locales/el/index.js +18 -1
- package/cjs/i18n/locales/el.js.map +2 -2
- package/cjs/i18n/locales/en/index.js +25 -2
- package/cjs/i18n/locales/en.js.map +2 -2
- package/cjs/lazy/index.js +330 -1650
- package/cjs/lazy.js.map +3 -3
- package/cjs/registry/index.js +885 -501
- package/cjs/registry.js.map +3 -3
- package/cjs/utils/hooks/useScreen/index.js +1 -1
- package/cjs/utils/hooks/useScreen.js.map +2 -2
- package/feedback/ErrorSummary/ErrorSummary.stories/index.js +2 -0
- package/feedback/ErrorSummary/ErrorSummary.stories.d.ts +1 -0
- package/feedback/ErrorSummary/ErrorSummary.stories.js.map +2 -2
- package/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput/index.js +16 -0
- package/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput/package.json +6 -0
- package/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput.d.ts +3 -0
- package/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput.js.map +7 -0
- package/i18n/index.js +18 -1
- package/i18n/index.js.map +2 -2
- package/i18n/locales/el/index.js +18 -1
- package/i18n/locales/el.d.ts +17 -0
- package/i18n/locales/el.js.map +2 -2
- package/i18n/locales/en/index.js +25 -2
- package/i18n/locales/en.d.ts +23 -0
- package/i18n/locales/en.js.map +2 -2
- package/index.js +1 -1
- package/lazy/index.js +332 -1656
- package/package.json +5 -5
- package/registry/index.js +960 -576
- package/src/app/BannerContainer/index.test.tsx +10 -11
- package/src/app/Footer/index.test.tsx +31 -32
- package/src/app/Header/index.test.tsx +22 -23
- package/src/app/Loader/index.test.tsx +13 -14
- package/src/app/Masthead/index.test.tsx +19 -20
- package/src/app/Modal/index.test.tsx +25 -26
- package/src/app/NotFound/index.test.tsx +10 -11
- package/src/app/Panel/index.test.tsx +10 -11
- package/src/app/PhaseBannerHeader/index.test.tsx +10 -11
- package/src/app/QrCodeViewer/index.test.tsx +13 -14
- package/src/app/Skeleton/index.test.tsx +34 -35
- package/src/content/Accordion/index.test.tsx +19 -20
- package/src/content/Blockquote/index.test.tsx +13 -14
- package/src/content/Card/index.test.tsx +40 -41
- package/src/content/Chip/index.test.tsx +22 -23
- package/src/content/Details/index.test.tsx +10 -11
- package/src/content/List/index.test.tsx +25 -26
- package/src/content/Markdown/index.test.tsx +10 -11
- package/src/content/SafeHTML/index.test.tsx +10 -11
- package/src/content/StepNav/index.test.tsx +22 -23
- package/src/content/SummaryList/index.test.tsx +31 -32
- package/src/content/Table/index.test.tsx +62 -63
- package/src/content/TaskList/index.test.tsx +13 -14
- package/src/content/Timeline/index.test.tsx +13 -14
- package/src/feedback/CopyToClipboard/index.test.tsx +16 -17
- package/src/feedback/ErrorSummary/ErrorSummary.stories.js +1 -0
- package/src/feedback/ErrorSummary/__stories__/ErrorGroupLinkedToInput.tsx +47 -0
- package/src/feedback/ErrorSummary/index.test.tsx +29 -26
- package/src/feedback/NotificationBanner/index.test.tsx +16 -17
- package/src/feedback/PhaseBanner/index.test.tsx +13 -14
- package/src/feedback/WarningText/index.test.tsx +16 -17
- package/src/form/AutoComplete/index.test.tsx +37 -38
- package/src/form/Button/index.test.tsx +43 -44
- package/src/form/Checkbox/index.test.tsx +37 -38
- package/src/form/DateInputContainer/index.test.tsx +22 -23
- package/src/form/ErrorMessage/index.test.tsx +16 -17
- package/src/form/FileUpload/index.test.tsx +13 -14
- package/src/form/RadioContainer/index.test.tsx +37 -38
- package/src/form/SearchContainer/index.test.tsx +10 -11
- package/src/form/SelectContainer/index.test.tsx +19 -20
- package/src/form/SingleCharacterInputs/index.test.tsx +20 -24
- package/src/form/TextArea/index.test.tsx +31 -32
- package/src/form/TextInput/index.test.tsx +37 -38
- package/src/i18n/index.tsx +14 -1
- package/src/i18n/locales/el.ts +22 -0
- package/src/i18n/locales/en.ts +23 -0
- package/src/layouts/Basic/index.test.tsx +19 -20
- package/src/layouts/Grid/index.test.tsx +16 -17
- package/src/layouts/Screen/index.test.tsx +19 -20
- package/src/layouts/Stack/index.test.tsx +25 -26
- package/src/lazy.js +330 -1650
- package/src/navigation/BackLink/index.test.tsx +10 -11
- package/src/navigation/BackToTopLink/index.test.tsx +13 -14
- package/src/navigation/Breadcrumbs/index.test.tsx +22 -23
- package/src/navigation/Drawer/index.test.tsx +16 -17
- package/src/navigation/Dropdown/index.test.tsx +40 -41
- package/src/navigation/Link/index.test.tsx +28 -29
- package/src/navigation/NavList/index.test.tsx +34 -35
- package/src/navigation/Pagination/index.test.tsx +28 -29
- package/src/navigation/SkipLink/index.test.tsx +10 -11
- package/src/navigation/Tabs/index.test.tsx +19 -20
- package/src/registry.js +1026 -701
- package/src/typography/CodeBlock/index.test.tsx +19 -20
- package/src/typography/Heading/index.test.tsx +10 -11
- package/src/typography/HeadingCaption/index.test.tsx +13 -14
- package/src/typography/Hint/index.test.tsx +13 -14
- package/src/typography/NormalText/index.test.tsx +19 -20
- package/src/typography/Paragraph/index.test.tsx +22 -23
- package/src/utils/VisuallyHidden/index.test.tsx +10 -11
- package/src/utils/hooks/useScreen.ts +2 -3
- package/utils/hooks/useScreen/index.js +1 -1
- package/utils/hooks/useScreen.js.map +2 -2
- package/cjs/test-utils/delay/index.js +0 -35
- package/cjs/test-utils/delay.js.map +0 -7
- package/lazy.d.ts +0 -361
- package/lazy.js.map +0 -7
- package/registry.d.ts +0 -315
- package/registry.js.map +0 -7
- package/src/test-utils/delay.ts +0 -9
- package/test-utils/delay/index.js +0 -12
- package/test-utils/delay/package.json +0 -6
- package/test-utils/delay.d.ts +0 -2
- package/test-utils/delay.js.map +0 -7
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/CodeBlock/__stories__/Default';
|
|
4
5
|
import { Highlighted } from '@digigov/ui/typography/CodeBlock/__stories__/Highlighted';
|
|
5
6
|
import { WithCopyToClipboard } from '@digigov/ui/typography/CodeBlock/__stories__/WithCopyToClipboard';
|
|
6
7
|
import { WithPhaseBanner } from '@digigov/ui/typography/CodeBlock/__stories__/WithPhaseBanner';
|
|
7
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
8
8
|
|
|
9
9
|
test('renders the All CodeBlock variants', async ({ mount, page }) => {
|
|
10
10
|
await mount(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</
|
|
25
|
-
|
|
11
|
+
|
|
12
|
+
<div>
|
|
13
|
+
<TestVariant title="Default">
|
|
14
|
+
<Default />
|
|
15
|
+
</TestVariant>
|
|
16
|
+
<TestVariant title="Highlighted">
|
|
17
|
+
<Highlighted />
|
|
18
|
+
</TestVariant>
|
|
19
|
+
<TestVariant title="WithCopyToClipboard">
|
|
20
|
+
<WithCopyToClipboard />
|
|
21
|
+
</TestVariant>
|
|
22
|
+
<TestVariant title="WithPhaseBanner">
|
|
23
|
+
<WithPhaseBanner />
|
|
24
|
+
</TestVariant>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
26
27
|
await page.evaluate(() => document.fonts.ready);
|
|
27
28
|
|
|
28
|
-
const screenshot = await page.screenshot({
|
|
29
|
-
fullPage: true,
|
|
30
|
-
animations: 'disabled',
|
|
31
|
-
});
|
|
29
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
32
30
|
expect(screenshot).toMatchSnapshot();
|
|
33
31
|
});
|
|
32
|
+
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/Heading/__stories__/Default';
|
|
4
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
5
5
|
|
|
6
6
|
test('renders the All Heading variants', async ({ mount, page }) => {
|
|
7
7
|
await mount(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<TestVariant title="Default">
|
|
11
|
+
<Default />
|
|
12
|
+
</TestVariant>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
14
15
|
await page.evaluate(() => document.fonts.ready);
|
|
15
16
|
|
|
16
|
-
const screenshot = await page.screenshot({
|
|
17
|
-
fullPage: true,
|
|
18
|
-
animations: 'disabled',
|
|
19
|
-
});
|
|
17
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
20
18
|
expect(screenshot).toMatchSnapshot();
|
|
21
19
|
});
|
|
20
|
+
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/HeadingCaption/__stories__/Default';
|
|
4
5
|
import { NestedToTitle } from '@digigov/ui/typography/HeadingCaption/__stories__/NestedToTitle';
|
|
5
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
6
6
|
|
|
7
7
|
test('renders the All HeadingCaption variants', async ({ mount, page }) => {
|
|
8
8
|
await mount(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</
|
|
17
|
-
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<TestVariant title="Default">
|
|
12
|
+
<Default />
|
|
13
|
+
</TestVariant>
|
|
14
|
+
<TestVariant title="NestedToTitle">
|
|
15
|
+
<NestedToTitle />
|
|
16
|
+
</TestVariant>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
18
19
|
await page.evaluate(() => document.fonts.ready);
|
|
19
20
|
|
|
20
|
-
const screenshot = await page.screenshot({
|
|
21
|
-
fullPage: true,
|
|
22
|
-
animations: 'disabled',
|
|
23
|
-
});
|
|
21
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
24
22
|
expect(screenshot).toMatchSnapshot();
|
|
25
23
|
});
|
|
24
|
+
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/Hint/__stories__/Default';
|
|
4
5
|
import { FontSizes } from '@digigov/ui/typography/Hint/__stories__/FontSizes';
|
|
5
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
6
6
|
|
|
7
7
|
test('renders the All Hint variants', async ({ mount, page }) => {
|
|
8
8
|
await mount(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</
|
|
17
|
-
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<TestVariant title="Default">
|
|
12
|
+
<Default />
|
|
13
|
+
</TestVariant>
|
|
14
|
+
<TestVariant title="FontSizes">
|
|
15
|
+
<FontSizes />
|
|
16
|
+
</TestVariant>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
18
19
|
await page.evaluate(() => document.fonts.ready);
|
|
19
20
|
|
|
20
|
-
const screenshot = await page.screenshot({
|
|
21
|
-
fullPage: true,
|
|
22
|
-
animations: 'disabled',
|
|
23
|
-
});
|
|
21
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
24
22
|
expect(screenshot).toMatchSnapshot();
|
|
25
23
|
});
|
|
24
|
+
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/NormalText/__stories__/Default';
|
|
4
5
|
import { FontSizes } from '@digigov/ui/typography/NormalText/__stories__/FontSizes';
|
|
5
6
|
import { FontWeight } from '@digigov/ui/typography/NormalText/__stories__/FontWeight';
|
|
6
7
|
import { Variants } from '@digigov/ui/typography/NormalText/__stories__/Variants';
|
|
7
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
8
8
|
|
|
9
9
|
test('renders the All NormalText variants', async ({ mount, page }) => {
|
|
10
10
|
await mount(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</
|
|
25
|
-
|
|
11
|
+
|
|
12
|
+
<div>
|
|
13
|
+
<TestVariant title="Default">
|
|
14
|
+
<Default />
|
|
15
|
+
</TestVariant>
|
|
16
|
+
<TestVariant title="FontSizes">
|
|
17
|
+
<FontSizes />
|
|
18
|
+
</TestVariant>
|
|
19
|
+
<TestVariant title="FontWeight">
|
|
20
|
+
<FontWeight />
|
|
21
|
+
</TestVariant>
|
|
22
|
+
<TestVariant title="Variants">
|
|
23
|
+
<Variants />
|
|
24
|
+
</TestVariant>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
26
27
|
await page.evaluate(() => document.fonts.ready);
|
|
27
28
|
|
|
28
|
-
const screenshot = await page.screenshot({
|
|
29
|
-
fullPage: true,
|
|
30
|
-
animations: 'disabled',
|
|
31
|
-
});
|
|
29
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
32
30
|
expect(screenshot).toMatchSnapshot();
|
|
33
31
|
});
|
|
32
|
+
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
4
|
import { Default } from '@digigov/ui/typography/Paragraph/__stories__/Default';
|
|
4
5
|
import { FontSizes } from '@digigov/ui/typography/Paragraph/__stories__/FontSizes';
|
|
5
6
|
import { FontWeight } from '@digigov/ui/typography/Paragraph/__stories__/FontWeight';
|
|
6
7
|
import { LeadVariant } from '@digigov/ui/typography/Paragraph/__stories__/LeadVariant';
|
|
7
8
|
import { SmallVariant } from '@digigov/ui/typography/Paragraph/__stories__/SmallVariant';
|
|
8
|
-
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
9
9
|
|
|
10
10
|
test('renders the All Paragraph variants', async ({ mount, page }) => {
|
|
11
11
|
await mount(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
|
|
12
|
+
|
|
13
|
+
<div>
|
|
14
|
+
<TestVariant title="Default">
|
|
15
|
+
<Default />
|
|
16
|
+
</TestVariant>
|
|
17
|
+
<TestVariant title="FontSizes">
|
|
18
|
+
<FontSizes />
|
|
19
|
+
</TestVariant>
|
|
20
|
+
<TestVariant title="FontWeight">
|
|
21
|
+
<FontWeight />
|
|
22
|
+
</TestVariant>
|
|
23
|
+
<TestVariant title="LeadVariant">
|
|
24
|
+
<LeadVariant />
|
|
25
|
+
</TestVariant>
|
|
26
|
+
<TestVariant title="SmallVariant">
|
|
27
|
+
<SmallVariant />
|
|
28
|
+
</TestVariant>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
30
31
|
await page.evaluate(() => document.fonts.ready);
|
|
31
32
|
|
|
32
|
-
const screenshot = await page.screenshot({
|
|
33
|
-
fullPage: true,
|
|
34
|
-
animations: 'disabled',
|
|
35
|
-
});
|
|
33
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
36
34
|
expect(screenshot).toMatchSnapshot();
|
|
37
35
|
});
|
|
36
|
+
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
-
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
4
4
|
import { Default } from '@digigov/ui/utils/VisuallyHidden/__stories__/Default';
|
|
5
5
|
|
|
6
6
|
test('renders the All VisuallyHidden variants', async ({ mount, page }) => {
|
|
7
7
|
await mount(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<TestVariant title="Default">
|
|
11
|
+
<Default />
|
|
12
|
+
</TestVariant>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
14
15
|
await page.evaluate(() => document.fonts.ready);
|
|
15
16
|
|
|
16
|
-
const screenshot = await page.screenshot({
|
|
17
|
-
fullPage: true,
|
|
18
|
-
animations: 'disabled',
|
|
19
|
-
});
|
|
17
|
+
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
20
18
|
expect(screenshot).toMatchSnapshot();
|
|
21
19
|
});
|
|
20
|
+
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
2
1
|
import { useEffect, useState } from 'react';
|
|
3
2
|
import breakpoints from '@digigov/css/screens.json';
|
|
4
3
|
export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -10,7 +9,7 @@ export const breakpointValues = Object.values(breakpoints) as number[];
|
|
|
10
9
|
function resolveScreenSize(width: number): Breakpoints {
|
|
11
10
|
let breakpointIndex = 0;
|
|
12
11
|
for (const breakpoint of breakpointValues) {
|
|
13
|
-
if (width
|
|
12
|
+
if (width >= breakpoint && width < breakpointValues[breakpointIndex + 1]) {
|
|
14
13
|
return breakpointKeys[breakpointIndex];
|
|
15
14
|
}
|
|
16
15
|
breakpointIndex++;
|
|
@@ -18,7 +17,7 @@ function resolveScreenSize(width: number): Breakpoints {
|
|
|
18
17
|
return 'xl';
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
const listeners = new Set<
|
|
20
|
+
const listeners = new Set<(width: number) => void>();
|
|
22
21
|
let resizeObserver: ResizeObserver | null = null;
|
|
23
22
|
function createResizeObserver() {
|
|
24
23
|
if (resizeObserver === null && typeof window !== 'undefined') {
|
|
@@ -7,7 +7,7 @@ const breakpointValues = Object.values(breakpoints);
|
|
|
7
7
|
function resolveScreenSize(width) {
|
|
8
8
|
let breakpointIndex = 0;
|
|
9
9
|
for (const breakpoint of breakpointValues) {
|
|
10
|
-
if (width
|
|
10
|
+
if (width >= breakpoint && width < breakpointValues[breakpointIndex + 1]) {
|
|
11
11
|
return breakpointKeys[breakpointIndex];
|
|
12
12
|
}
|
|
13
13
|
breakpointIndex++;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/hooks/useScreen.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useEffect, useState } from 'react';\nimport breakpoints from '@digigov/css/screens.json';\nexport type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\nexport const breakpointKeys: Breakpoints[] = Object.keys(\n breakpoints\n) as Breakpoints[];\nexport const breakpointValues = Object.values(breakpoints) as number[];\n\nfunction resolveScreenSize(width: number): Breakpoints {\n let breakpointIndex = 0;\n for (const breakpoint of breakpointValues) {\n if (width >= breakpoint && width < breakpointValues[breakpointIndex + 1]) {\n return breakpointKeys[breakpointIndex];\n }\n breakpointIndex++;\n }\n return 'xl';\n}\n\nconst listeners = new Set<(width: number) => void>();\nlet resizeObserver: ResizeObserver | null = null;\nfunction createResizeObserver() {\n if (resizeObserver === null && typeof window !== 'undefined') {\n resizeObserver = new ResizeObserver(([body]) => {\n listeners.forEach((listener) => {\n listener(body.contentRect.width);\n });\n });\n resizeObserver.observe(window.document?.body);\n }\n return listeners;\n}\nexport const useScreenSize = () => {\n const [screenSize, setSize] = useState<Breakpoints>(\n resolveScreenSize(\n typeof window !== 'undefined' ? window.document.body.clientWidth : 0\n )\n );\n useEffect(() => {\n const listeners = createResizeObserver();\n const listener = (width: number) => {\n setSize(resolveScreenSize(width));\n };\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }, []);\n return {\n screenSize,\n screenWidth:\n typeof window !== 'undefined' && window.document.body.clientWidth,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW,gBAAgB;AACpC,OAAO,iBAAiB;AAEjB,MAAM,iBAAgC,OAAO;AAAA,EAClD;AACF;AACO,MAAM,mBAAmB,OAAO,OAAO,WAAW;AAEzD,SAAS,kBAAkB,OAA4B;AACrD,MAAI,kBAAkB;AACtB,aAAW,cAAc,kBAAkB;AACzC,QAAI,SAAS,cAAc,QAAQ,iBAAiB,kBAAkB,CAAC,GAAG;AACxE,aAAO,eAAe,eAAe;AAAA,IACvC;AACA;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,YAAY,oBAAI,IAA6B;AACnD,IAAI,iBAAwC;AAC5C,SAAS,uBAAuB;AAC9B,MAAI,mBAAmB,QAAQ,OAAO,WAAW,aAAa;AAC5D,qBAAiB,IAAI,eAAe,CAAC,CAAC,IAAI,MAAM;AAC9C,gBAAU,QAAQ,CAAC,aAAa;AAC9B,iBAAS,KAAK,YAAY,KAAK;AAAA,MACjC,CAAC;AAAA,IACH,CAAC;AACD,mBAAe,QAAQ,OAAO,UAAU,IAAI;AAAA,EAC9C;AACA,SAAO;AACT;AACO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,OAAO,IAAI;AAAA,IAC5B;AAAA,MACE,OAAO,WAAW,cAAc,OAAO,SAAS,KAAK,cAAc;AAAA,IACrE;AAAA,EACF;AACA,YAAU,MAAM;AACd,UAAMA,aAAY,qBAAqB;AACvC,UAAM,WAAW,CAAC,UAAkB;AAClC,cAAQ,kBAAkB,KAAK,CAAC;AAAA,IAClC;AACA,IAAAA,WAAU,IAAI,QAAQ;AACtB,WAAO,MAAM;AACX,MAAAA,WAAU,OAAO,QAAQ;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AAAA,IACL;AAAA,IACA,aACE,OAAO,WAAW,eAAe,OAAO,SAAS,KAAK;AAAA,EAC1D;AACF;",
|
|
6
6
|
"names": ["listeners"]
|
|
7
7
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var delay_exports = {};
|
|
19
|
-
__export(delay_exports, {
|
|
20
|
-
default: () => delay_default,
|
|
21
|
-
delay: () => delay
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(delay_exports);
|
|
24
|
-
var import_react = require("@testing-library/react");
|
|
25
|
-
async function delay(ms) {
|
|
26
|
-
await (0, import_react.act)(
|
|
27
|
-
() => new Promise((resolve) => setTimeout(resolve, ms))
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
var delay_default = delay;
|
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
-
0 && (module.exports = {
|
|
33
|
-
delay
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=delay.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/test-utils/delay.ts"],
|
|
4
|
-
"sourcesContent": ["import { act } from '@testing-library/react';\n\nexport async function delay(ms): Promise<void> {\n await act(\n (): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))\n ); // still suspending\n}\n\nexport default delay;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoB;AAEpB,eAAsB,MAAM,IAAmB;AAC7C,YAAM;AAAA,IACJ,MAAqB,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAAA,EACvE;AACF;AAEA,IAAO,gBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|