@digigov/ui 2.0.0-76ec20a0 → 2.0.0-7d765d3c
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/app/Footer/__stories__/Default.d.ts +1 -1
- package/app/Loader/Loader.stories.d.ts +45 -1
- package/app/Loader/__stories__/AccessibilityLoader.d.ts +3 -0
- package/app/Loader/__stories__/FullPageLoader.d.ts +1 -0
- package/app/Loader/__stories__/Secondary.d.ts +3 -0
- package/app/Loader/__stories__/Sizes.d.ts +3 -0
- package/app/Loader/index.native.d.ts +2 -2
- package/app/Loader/index.native.js.map +2 -2
- package/app/Loader/index.web/index.js +17 -1
- package/app/Loader/index.web.d.ts +19 -1
- package/app/Loader/index.web.js.map +3 -3
- package/app/Masthead/Masthead.stories.d.ts +28 -1
- package/app/Modal/Modal.stories.d.ts +20 -1
- package/app/Modal/hooks/index.js +2 -6
- package/app/Modal/hooks.d.ts +2 -2
- package/app/Modal/hooks.js.map +2 -2
- package/app/Modal/index.web/index.js +5 -5
- package/app/Modal/index.web.js.map +2 -2
- package/app/NotFound/__stories__/Default.d.ts +1 -1
- package/app/OutdatedBrowserBanner/index.d.ts +1 -0
- package/app/OutdatedBrowserBanner/index.js.map +2 -2
- package/app/PhaseBannerHeader/index.d.ts +1 -1
- package/app/PhaseBannerHeader/index.js.map +2 -2
- package/app/Skeleton/__stories__/Button.d.ts +1 -1
- package/app/Skeleton/__stories__/Default.d.ts +1 -1
- package/app/Skeleton/__stories__/NoAnimation.d.ts +1 -1
- package/app/hooks/useNotificationArea/index.js +76 -0
- package/app/hooks/useNotificationArea/package.json +6 -0
- package/app/hooks/useNotificationArea.d.ts +1 -0
- package/app/hooks/useNotificationArea.js.map +7 -0
- package/cjs/app/Loader/index.native.js.map +2 -2
- package/cjs/app/Loader/index.web/index.js +33 -2
- package/cjs/app/Loader/index.web.js.map +3 -3
- package/cjs/app/Modal/hooks/index.js +2 -6
- package/cjs/app/Modal/hooks.js.map +2 -2
- package/cjs/app/Modal/index.web/index.js +5 -5
- package/cjs/app/Modal/index.web.js.map +2 -2
- package/cjs/app/OutdatedBrowserBanner/index.js.map +2 -2
- package/cjs/app/PhaseBannerHeader/index.js.map +2 -2
- package/cjs/app/hooks/useNotificationArea/index.js +99 -0
- package/cjs/app/hooks/useNotificationArea.js.map +7 -0
- package/cjs/content/Accordion/hooks.js.map +1 -1
- package/cjs/form/AutoComplete/Status/index.js.map +2 -2
- package/cjs/form/AutoComplete/index.js +32 -19
- package/cjs/form/AutoComplete/index.js.map +2 -2
- package/cjs/i18n/locales/el/index.js +51 -23
- package/cjs/i18n/locales/el.js.map +2 -2
- package/cjs/i18n/locales/en/index.js +36 -8
- package/cjs/i18n/locales/en.js.map +2 -2
- package/cjs/layouts/Hidden/index.js +19 -0
- package/cjs/layouts/Hidden/index.js.map +3 -3
- package/cjs/lazy.js +1 -1
- package/cjs/lazy.js.map +2 -2
- package/cjs/navigation/Drawer/hooks/index.js +2 -6
- package/cjs/navigation/Drawer/hooks.js.map +2 -2
- package/cjs/navigation/Pagination/hooks/index.js +2 -2
- package/cjs/navigation/Pagination/hooks.js.map +2 -2
- package/cjs/navigation/Tabs/hooks.js.map +1 -1
- package/cjs/registry.js +50 -48
- package/cjs/registry.js.map +2 -2
- package/cjs/typography/CodeBlock/index.js +1 -2
- package/cjs/typography/CodeBlock/index.js.map +2 -2
- package/cjs/utils/hooks/useDebounce/index.js +1 -1
- package/cjs/utils/hooks/useDebounce.js.map +2 -2
- package/content/Accordion/Accordion.stories.d.ts +27 -16
- package/content/Accordion/hooks.js.map +1 -1
- package/content/Chip/__stories__/Default.d.ts +1 -1
- package/content/SummaryList/SummaryList.stories.d.ts +4 -1
- package/feedback/NotificationBanner/NotificationBanner.stories.d.ts +14 -13
- package/feedback/NotificationBanner/__stories__/Expanded.d.ts +3 -0
- package/feedback/PhaseBanner/PhaseBanner.stories.d.ts +1 -1
- package/form/AutoComplete/AutoComplete.stories.d.ts +57 -16
- package/form/AutoComplete/Status/index.d.ts +1 -1
- package/form/AutoComplete/Status/index.js.map +2 -2
- package/form/AutoComplete/__stories__/WithCustomValue.d.ts +3 -0
- package/form/AutoComplete/__stories__/WithHint.d.ts +3 -0
- package/form/AutoComplete/index.d.ts +4 -3
- package/form/AutoComplete/index.js +32 -18
- package/form/AutoComplete/index.js.map +2 -2
- package/form/Button/__stories__/ThemeToggle.d.ts +1 -1
- package/form/FileUpload/FileUpload.stories.d.ts +1 -0
- package/form/FileUpload/__stories__/WithVariantLink.d.ts +3 -0
- package/i18n/locales/el/index.js +51 -23
- package/i18n/locales/el.d.ts +33 -5
- package/i18n/locales/el.js.map +2 -2
- package/i18n/locales/en/index.js +36 -8
- package/i18n/locales/en.d.ts +32 -4
- package/i18n/locales/en.js.map +2 -2
- package/index.js +1 -1
- package/layouts/Grid/Grid.stories.d.ts +82 -0
- package/layouts/Hidden/Hidden.stories.d.ts +115 -0
- package/layouts/Hidden/index.d.ts +2 -0
- package/layouts/Hidden/index.js +5 -0
- package/layouts/Hidden/index.js.map +2 -2
- package/layouts/Stack/Stack.stories.d.ts +76 -0
- package/lazy/index.js +1 -1
- package/navigation/BackToTopLink/BackToTopLink.stories.d.ts +2 -0
- package/navigation/Drawer/hooks/index.js +2 -6
- package/navigation/Drawer/hooks.js.map +2 -2
- package/navigation/Dropdown/Dropdown.stories.d.ts +75 -1
- package/navigation/Pagination/hooks/index.js +2 -2
- package/navigation/Pagination/hooks.js.map +2 -2
- package/navigation/SkipLink/SkipLink.stories.d.ts +2 -0
- package/navigation/Tabs/hooks.d.ts +1 -1
- package/navigation/Tabs/hooks.js.map +1 -1
- package/package.json +7 -7
- package/registry/index.js +50 -48
- package/src/app/BannerContainer/__stories__/CookiesBanner.tsx +1 -21
- package/src/app/Footer/__stories__/Default.tsx +1 -1
- package/src/app/Header/doc.mdx +3 -3
- package/src/app/Loader/Loader.stories.jsx +54 -0
- package/src/app/Loader/__stories__/AccessibilityLoader.tsx +27 -0
- package/src/app/Loader/__stories__/FullPageLoader.tsx +9 -5
- package/src/app/Loader/__stories__/Secondary.tsx +11 -0
- package/src/app/Loader/__stories__/Sizes.tsx +18 -0
- package/src/app/Loader/doc.mdx +39 -0
- package/src/app/Loader/index.native.tsx +2 -2
- package/src/app/Loader/index.test.tsx +12 -0
- package/src/app/Loader/index.web.tsx +39 -1
- package/src/app/Masthead/Masthead.stories.jsx +66 -0
- package/src/app/Masthead/doc.mdx +3 -3
- package/src/app/Modal/Modal.stories.jsx +64 -0
- package/src/app/Modal/__stories__/AlertDialog.tsx +1 -1
- package/src/app/Modal/__stories__/Auto.tsx +1 -1
- package/src/app/Modal/__stories__/Default.tsx +1 -1
- package/src/app/Modal/__stories__/Dense.tsx +1 -1
- package/src/app/Modal/__stories__/WithHooks.tsx +1 -1
- package/src/app/Modal/__stories__/WithoutModalGaps.tsx +1 -1
- package/src/app/Modal/hooks.ts +8 -8
- package/src/app/Modal/index.web.tsx +5 -7
- package/src/app/NotFound/__stories__/Default.tsx +1 -1
- package/src/app/OutdatedBrowserBanner/index.tsx +1 -1
- package/src/app/PhaseBannerHeader/index.tsx +1 -1
- package/src/app/Skeleton/__stories__/Button.tsx +1 -1
- package/src/app/Skeleton/__stories__/Default.tsx +1 -1
- package/src/app/Skeleton/__stories__/NoAnimation.tsx +1 -1
- package/src/app/hooks/useNotificationArea.tsx +105 -0
- package/src/content/Accordion/Accordion.stories.jsx +9 -1
- package/src/content/Accordion/doc.mdx +1 -2
- package/src/content/Accordion/hooks.ts +1 -1
- package/src/content/Card/doc.mdx +11 -11
- package/src/content/Chip/__stories__/Default.tsx +1 -1
- package/src/content/Chip/doc.mdx +4 -4
- package/src/content/List/__snapshots__/index.spec.tsx.snap +13 -3
- package/src/content/List/doc.mdx +3 -3
- package/src/content/SummaryList/SummaryList.stories.js +5 -1
- package/src/content/TaskList/doc.mdx +1 -1
- package/src/content/Timeline/doc.mdx +1 -1
- package/src/feedback/CopyToClipboard/doc.mdx +1 -1
- package/src/feedback/ErrorSummary/__snapshots__/index.spec.tsx.snap +13 -3
- package/src/feedback/ErrorSummary/doc.mdx +1 -1
- package/src/feedback/NotificationBanner/NotificationBanner.stories.js +10 -9
- package/src/feedback/NotificationBanner/__snapshots__/index.spec.tsx.snap +24 -14
- package/src/feedback/NotificationBanner/__stories__/Expanded.tsx +27 -0
- package/src/feedback/NotificationBanner/doc.mdx +15 -6
- package/src/feedback/NotificationBanner/index.test.tsx +4 -0
- package/src/feedback/PhaseBanner/PhaseBanner.stories.jsx +1 -1
- package/src/feedback/WarningText/__snapshots__/index.spec.tsx.snap +13 -3
- package/src/form/AutoComplete/AutoComplete.stories.jsx +19 -4
- package/src/form/AutoComplete/Status/index.tsx +1 -1
- package/src/form/AutoComplete/__stories__/WithAutoSelect.tsx +1 -17
- package/src/form/AutoComplete/__stories__/WithCustomValue.tsx +28 -0
- package/src/form/AutoComplete/__stories__/WithDefaultValue.tsx +1 -6
- package/src/form/AutoComplete/__stories__/WithHint.tsx +16 -0
- package/src/form/AutoComplete/doc.mdx +14 -13
- package/src/form/AutoComplete/index.test.tsx +8 -0
- package/src/form/AutoComplete/index.tsx +38 -25
- package/src/form/Button/__stories__/ThemeToggle.tsx +1 -1
- package/src/form/Button/doc.mdx +25 -14
- package/src/form/Checkbox/doc.mdx +1 -1
- package/src/form/FileUpload/FileUpload.stories.js +1 -0
- package/src/form/FileUpload/__stories__/WithVariantLink.tsx +24 -0
- package/src/form/FileUpload/index.test.tsx +4 -0
- package/src/form/RadioContainer/doc.mdx +4 -4
- package/src/i18n/locales/el.ts +73 -22
- package/src/i18n/locales/en.ts +43 -7
- package/src/layouts/Basic/doc.mdx +0 -2
- package/src/layouts/Grid/Grid.stories.jsx +143 -0
- package/src/layouts/Hidden/Hidden.stories.jsx +62 -0
- package/src/layouts/Hidden/index.tsx +3 -0
- package/src/layouts/Stack/Stack.stories.jsx +104 -0
- package/src/lazy.js +1 -1
- package/src/navigation/BackToTopLink/BackToTopLink.stories.js +4 -0
- package/src/navigation/BackToTopLink/doc.mdx +22 -0
- package/src/navigation/Breadcrumbs/doc.mdx +4 -0
- package/src/navigation/Drawer/hooks.ts +6 -6
- package/src/navigation/Dropdown/Dropdown.stories.jsx +118 -0
- package/src/navigation/Dropdown/doc.mdx +24 -2
- package/src/navigation/NavList/__snapshots__/index.spec.tsx.snap +13 -3
- package/src/navigation/NavList/doc.mdx +1 -1
- package/src/navigation/Pagination/doc.mdx +5 -1
- package/src/navigation/Pagination/hooks.ts +2 -2
- package/src/navigation/SkipLink/SkipLink.stories.js +4 -0
- package/src/navigation/SkipLink/doc.mdx +19 -0
- package/src/navigation/Tabs/hooks.ts +2 -2
- package/src/registry.js +50 -48
- package/src/typography/CodeBlock/CodeBlock.stories.js +24 -0
- package/src/typography/CodeBlock/index.tsx +14 -12
- package/src/typography/Heading/Heading.stories.js +12 -0
- package/src/typography/HeadingCaption/HeadingCaption.stories.js +9 -0
- package/src/typography/Hint/Hint.stories.js +11 -0
- package/src/typography/Hint/__stories__/Default.tsx +1 -1
- package/src/typography/Hint/__stories__/FontSizes.tsx +4 -4
- package/src/typography/NormalText/NormalText.stories.js +10 -0
- package/src/typography/NormalText/__stories__/Default.tsx +1 -1
- package/src/typography/Paragraph/Paragraph.stories.js +23 -0
- package/src/typography/Paragraph/__stories__/Default.tsx +1 -1
- package/src/typography/Paragraph/__stories__/LeadVariant.tsx +3 -1
- package/src/typography/Paragraph/__stories__/SmallVariant.tsx +3 -1
- package/src/utils/hooks/useDebounce.ts +1 -1
- package/stories-registry/index.js +170 -154
- package/typography/CodeBlock/CodeBlock.stories.d.ts +11 -0
- package/typography/CodeBlock/index.d.ts +1 -1
- package/typography/CodeBlock/index.js +1 -2
- package/typography/CodeBlock/index.js.map +2 -2
- package/typography/Heading/Heading.stories.d.ts +10 -0
- package/typography/HeadingCaption/HeadingCaption.stories.d.ts +8 -0
- package/typography/Hint/Hint.stories.d.ts +9 -0
- package/typography/Hint/__stories__/Default.d.ts +1 -1
- package/typography/NormalText/NormalText.stories.d.ts +8 -0
- package/typography/NormalText/__stories__/Default.d.ts +1 -1
- package/typography/Paragraph/Paragraph.stories.d.ts +37 -0
- package/typography/Paragraph/__stories__/Default.d.ts +1 -1
- package/typography/Paragraph/__stories__/LeadVariant.d.ts +1 -1
- package/typography/Paragraph/__stories__/SmallVariant.d.ts +1 -1
- package/utils/hooks/useDebounce/index.js +1 -1
- package/utils/hooks/useDebounce.js.map +2 -2
- package/utils/hooks/useLatest.d.ts +1 -1
- package/src/app/Loader/Loader.stories.js +0 -8
- package/src/app/Masthead/Masthead.stories.js +0 -17
- package/src/app/Modal/Modal.stories.js +0 -18
- package/src/layouts/Grid/Grid.stories.js +0 -12
- package/src/layouts/Stack/Stack.stories.js +0 -15
- package/src/navigation/Dropdown/Dropdown.stories.js +0 -23
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { LoaderContainer, CircularProgress } from '@digigov/ui/app/Loader';
|
|
3
|
+
import { Paragraph } from '@digigov/ui/typography/Paragraph';
|
|
4
|
+
export const AccessibilityLoader = (_: any) => {
|
|
5
|
+
const [loading, setLoading] = useState(true);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
// Unmount after 8 seconds to trigger "Η φόρτωση ολοκληρώθηκε!" text
|
|
9
|
+
const timer = setTimeout(() => {
|
|
10
|
+
setLoading(false);
|
|
11
|
+
}, 8000);
|
|
12
|
+
return () => clearTimeout(timer);
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<LoaderContainer>
|
|
17
|
+
{loading && (
|
|
18
|
+
<CircularProgress
|
|
19
|
+
loadingText="Γίνεται φόρτωση"
|
|
20
|
+
loadingFinishedText="Η φόρτωση ολοκληρώθηκε"
|
|
21
|
+
/>
|
|
22
|
+
)}
|
|
23
|
+
{!loading && <Paragraph> Η φόρτωση ολοκληρώθηκε!</Paragraph>}
|
|
24
|
+
</LoaderContainer>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export default AccessibilityLoader;
|
|
@@ -7,10 +7,14 @@ import {
|
|
|
7
7
|
|
|
8
8
|
export const FullPageLoader = (_: any) => {
|
|
9
9
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
<div style={{ minHeight: '100px' }}>
|
|
11
|
+
<FullPageBackground>
|
|
12
|
+
<LoaderContainer>
|
|
13
|
+
<CircularProgress />
|
|
14
|
+
</LoaderContainer>
|
|
15
|
+
</FullPageBackground>
|
|
16
|
+
</div>
|
|
15
17
|
);
|
|
16
18
|
};
|
|
19
|
+
|
|
20
|
+
export default FullPageLoader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoaderContainer, CircularProgress } from '@digigov/ui/app/Loader';
|
|
3
|
+
|
|
4
|
+
export const Secondary = (_: any) => {
|
|
5
|
+
return (
|
|
6
|
+
<LoaderContainer>
|
|
7
|
+
<CircularProgress color="secondary" />
|
|
8
|
+
</LoaderContainer>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
export default Secondary;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Stack } from '@digigov/react-core';
|
|
3
|
+
import { LoaderContainer, CircularProgress } from '@digigov/ui/app/Loader';
|
|
4
|
+
|
|
5
|
+
export const Sizes = (_: any) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<LoaderContainer>
|
|
9
|
+
<Stack direction="row" alignItems="center" spacing={4}>
|
|
10
|
+
<CircularProgress size="sm" />
|
|
11
|
+
<CircularProgress size="md" />
|
|
12
|
+
<CircularProgress size="lg" />
|
|
13
|
+
</Stack>
|
|
14
|
+
</LoaderContainer>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
export default Sizes;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: loader
|
|
3
|
+
title: Loader
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Loader
|
|
7
|
+
|
|
8
|
+
Loading spinner is used for notifying users that their action is being processed or data retrieved from server.
|
|
9
|
+
|
|
10
|
+
## How to use
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<code src="@digigov/ui/app/Loader/__stories__/Default.tsx" />
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Secondary color
|
|
17
|
+
|
|
18
|
+
<code src="@digigov/ui/app/Loader/__stories__/Secondary.tsx" />
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Different sizes
|
|
22
|
+
|
|
23
|
+
<code src="@digigov/ui/app/Loader/__stories__/Sizes.tsx" />
|
|
24
|
+
|
|
25
|
+
### Full page loader
|
|
26
|
+
|
|
27
|
+
<code src="@digigov/ui/app/Loader/__stories__/FullPageLoader.tsx" />
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
See below for a complete reference to all of the props available to the components mentioned here.
|
|
33
|
+
|
|
34
|
+
<ComponentProps componentName={[
|
|
35
|
+
"CircularProgress",
|
|
36
|
+
"Loader",
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import { Animated, Easing } from 'react-native';
|
|
3
3
|
import Svg, { Circle } from 'react-native-svg';
|
|
4
|
-
import {
|
|
4
|
+
import { CircularProgressBaseProps } from '@digigov/react-core/CircularProgressBase';
|
|
5
5
|
|
|
6
|
-
export const CircularProgress: React.FC<
|
|
6
|
+
export const CircularProgress: React.FC<CircularProgressBaseProps> = ({
|
|
7
7
|
size = 'md',
|
|
8
8
|
color = 'primary',
|
|
9
9
|
}) => {
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
3
|
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
4
|
+
import { AccessibilityLoader } from '@digigov/ui/app/Loader/__stories__/AccessibilityLoader';
|
|
4
5
|
import { Default } from '@digigov/ui/app/Loader/__stories__/Default';
|
|
5
6
|
import { FullPageLoader } from '@digigov/ui/app/Loader/__stories__/FullPageLoader';
|
|
7
|
+
import { Secondary } from '@digigov/ui/app/Loader/__stories__/Secondary';
|
|
8
|
+
import { Sizes } from '@digigov/ui/app/Loader/__stories__/Sizes';
|
|
6
9
|
|
|
7
10
|
test('renders the All Loader variants', async ({ mount, page }) => {
|
|
8
11
|
await mount(
|
|
9
12
|
|
|
10
13
|
<div>
|
|
14
|
+
<TestVariant title="AccessibilityLoader">
|
|
15
|
+
<AccessibilityLoader />
|
|
16
|
+
</TestVariant>
|
|
11
17
|
<TestVariant title="Default">
|
|
12
18
|
<Default />
|
|
13
19
|
</TestVariant>
|
|
14
20
|
<TestVariant title="FullPageLoader">
|
|
15
21
|
<FullPageLoader />
|
|
16
22
|
</TestVariant>
|
|
23
|
+
<TestVariant title="Secondary">
|
|
24
|
+
<Secondary />
|
|
25
|
+
</TestVariant>
|
|
26
|
+
<TestVariant title="Sizes">
|
|
27
|
+
<Sizes />
|
|
28
|
+
</TestVariant>
|
|
17
29
|
</div>
|
|
18
30
|
)
|
|
19
31
|
await page.evaluate(() => document.fonts.ready);
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export * from '@digigov/react-core/CircularProgressBase';
|
|
3
|
+
import CircularProgressBase, {
|
|
4
|
+
CircularProgressBaseProps,
|
|
5
|
+
} from '@digigov/react-core/CircularProgressBase';
|
|
6
|
+
import { useNotificationArea } from '@digigov/ui/app/hooks/useNotificationArea';
|
|
7
|
+
|
|
8
|
+
export interface CircularProgressProps extends CircularProgressBaseProps {
|
|
9
|
+
/**
|
|
10
|
+
* loadingText prop is optional
|
|
11
|
+
* Text for screen readers when loading starts
|
|
12
|
+
* @default "Γίνεται φόρτωση..."
|
|
13
|
+
*/
|
|
14
|
+
loadingText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* loadingFinishedText prop is optional
|
|
17
|
+
* Text for screen readers when loading finishes
|
|
18
|
+
* @default "Η φόρτωση ολοκληρώθηκε."
|
|
19
|
+
*/
|
|
20
|
+
loadingFinishedText?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const CircularProgress = React.forwardRef<
|
|
24
|
+
SVGElement,
|
|
25
|
+
CircularProgressProps
|
|
26
|
+
>(function CircularProgress(
|
|
27
|
+
{
|
|
28
|
+
loadingText = 'Γίνεται φόρτωση...',
|
|
29
|
+
loadingFinishedText = 'Η φόρτωση ολοκληρώθηκε.',
|
|
30
|
+
...props
|
|
31
|
+
},
|
|
32
|
+
ref
|
|
33
|
+
) {
|
|
34
|
+
useNotificationArea(loadingText, loadingFinishedText);
|
|
35
|
+
|
|
36
|
+
return <CircularProgressBase ref={ref} {...props} />;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default CircularProgress;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import doc from './doc.mdx?raw';
|
|
3
|
+
|
|
4
|
+
import { Masthead, MastheadBody } from '@digigov/ui/app/Masthead';
|
|
5
|
+
import { CallToAction } from '@digigov/ui/form/Button/CallToAction';
|
|
6
|
+
import { Container } from '@digigov/ui/layouts/Basic/Container';
|
|
7
|
+
import { Main } from '@digigov/ui/layouts/Basic/Main';
|
|
8
|
+
import { Heading } from '@digigov/ui/typography/Heading';
|
|
9
|
+
import { Hint } from '@digigov/ui/typography/Hint';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Digigov UI/app/Masthead',
|
|
13
|
+
description:
|
|
14
|
+
'You can use the masthead at the top of the first page of a GOV.GR service, not at internal pages.',
|
|
15
|
+
link: 'https://guide.services.gov.gr/docs/components/masthead',
|
|
16
|
+
defaultWidth: 'lg',
|
|
17
|
+
component: Masthead,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
markdown: doc,
|
|
20
|
+
displayName: 'Masthead',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const WithControls = {
|
|
24
|
+
render: (args) => {
|
|
25
|
+
return (
|
|
26
|
+
<Masthead color={args.color}>
|
|
27
|
+
<Container>
|
|
28
|
+
<Main as="div">
|
|
29
|
+
<Heading>Σχεδιάστε την υπηρεσία σας, με το στυλ του GOV.GR</Heading>
|
|
30
|
+
<MastheadBody>
|
|
31
|
+
Χρησιμοποιείστε αυτόν τον οδηγό ώστε να φτιάξετε μια υπηρεσία
|
|
32
|
+
συνεπή στα πρότυπα του GOV.GR. Αποκτήστε γνώση από την έρευνα και
|
|
33
|
+
την εμπειρία άλλων ομάδων και αποφύγετε την επανάληψη εργασιών που
|
|
34
|
+
έχουν ήδη γίνει.
|
|
35
|
+
</MastheadBody>
|
|
36
|
+
{args.showHint && <Hint>Τελευταία ενημέρωση: 08/12/2021</Hint>}
|
|
37
|
+
<CallToAction href="#">Ξεκινήστε εδώ</CallToAction>
|
|
38
|
+
</Main>
|
|
39
|
+
</Container>
|
|
40
|
+
</Masthead>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
color: 'primary',
|
|
45
|
+
showHint: false,
|
|
46
|
+
},
|
|
47
|
+
argTypes: {
|
|
48
|
+
color: {
|
|
49
|
+
control: {
|
|
50
|
+
type: 'inline-radio',
|
|
51
|
+
},
|
|
52
|
+
options: ['primary', 'secondary'],
|
|
53
|
+
},
|
|
54
|
+
showHint: {
|
|
55
|
+
control: 'boolean',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
parameters: {
|
|
59
|
+
controls: { exclude: ['ref'] },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { Default } from '@digigov/ui/app/Masthead/__stories__/Default';
|
|
64
|
+
export { Secondary } from '@digigov/ui/app/Masthead/__stories__/Secondary';
|
|
65
|
+
export { WithLogo } from '@digigov/ui/app/Masthead/__stories__/WithLogo';
|
|
66
|
+
export { WithElements } from '@digigov/ui/app/Masthead/__stories__/WithElements';
|
package/src/app/Masthead/doc.mdx
CHANGED
|
@@ -11,15 +11,15 @@ The Masthead component is a set of features or layout that marks the page and de
|
|
|
11
11
|
|
|
12
12
|
<code src="@digigov/ui/app/Masthead/__stories__/Default.tsx" />
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### With secondary color
|
|
15
15
|
|
|
16
16
|
<code src="@digigov/ui/app/Masthead/__stories__/Secondary.tsx" />
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### With logo
|
|
19
19
|
|
|
20
20
|
<code src="@digigov/ui/app/Masthead/__stories__/WithLogo.tsx" />
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
### With elements
|
|
23
23
|
|
|
24
24
|
<code src="@digigov/ui/app/Masthead/__stories__/WithElements.tsx" />
|
|
25
25
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import doc from './doc.mdx?raw';
|
|
3
|
+
import { Paragraph } from '@digigov/ui/typography/Paragraph';
|
|
4
|
+
import {
|
|
5
|
+
Modal,
|
|
6
|
+
ModalHeading,
|
|
7
|
+
ModalContent,
|
|
8
|
+
ModalAction,
|
|
9
|
+
} from '@digigov/ui/app/Modal';
|
|
10
|
+
import Button from '@digigov/ui/form/Button';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Digigov UI/app/Modal',
|
|
14
|
+
description:
|
|
15
|
+
'Use the modal component with caution when you need to provide critical information or ask for a decision.',
|
|
16
|
+
link: 'https://guide.services.gov.gr/docs/patterns/admin-pages/components/modal',
|
|
17
|
+
component: Modal,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
markdown: doc,
|
|
20
|
+
displayName: 'Modal',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const WithControls = {
|
|
24
|
+
render: (args) => {
|
|
25
|
+
return (
|
|
26
|
+
<Modal
|
|
27
|
+
open={true}
|
|
28
|
+
aria-labelledby="modal-label"
|
|
29
|
+
dense={args.dense}
|
|
30
|
+
gaps={args.gaps}
|
|
31
|
+
>
|
|
32
|
+
<ModalHeading id="modal-label">Διαγραφή τηλεφώνου</ModalHeading>
|
|
33
|
+
<ModalContent>
|
|
34
|
+
<Paragraph mb={args.gaps ? 0 : 4}>
|
|
35
|
+
Είστε σίγουροι ότι θέλετε να διαγράψετε τον αριθμό τηλεφώνου; Αυτή η
|
|
36
|
+
ενέργεια είναι οριστική.
|
|
37
|
+
</Paragraph>
|
|
38
|
+
</ModalContent>
|
|
39
|
+
<ModalAction>
|
|
40
|
+
<Button>Διαγραφή</Button>
|
|
41
|
+
<Button variant="link">Ακύρωση</Button>
|
|
42
|
+
</ModalAction>
|
|
43
|
+
</Modal>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
dense: false,
|
|
48
|
+
gaps: true,
|
|
49
|
+
},
|
|
50
|
+
argsTypes: {
|
|
51
|
+
dense: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
},
|
|
54
|
+
gaps: {
|
|
55
|
+
control: 'boolean',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export { Default } from '@digigov/ui/app/Modal/__stories__/Default';
|
|
60
|
+
export { AlertDialog } from '@digigov/ui/app/Modal/__stories__/AlertDialog';
|
|
61
|
+
export { Dense } from '@digigov/ui/app/Modal/__stories__/Dense';
|
|
62
|
+
export { WithHooks } from '@digigov/ui/app/Modal/__stories__/WithHooks';
|
|
63
|
+
export { Auto } from '@digigov/ui/app/Modal/__stories__/Auto';
|
|
64
|
+
export { WithoutModalGaps } from '@digigov/ui/app/Modal/__stories__/WithoutModalGaps';
|
|
@@ -13,7 +13,7 @@ import { Paragraph } from '@digigov/ui/typography/Paragraph';
|
|
|
13
13
|
export const AlertDialog = (_: any) => {
|
|
14
14
|
const [open, setOpen] = useState(false);
|
|
15
15
|
return (
|
|
16
|
-
<div>
|
|
16
|
+
<div style={{ minHeight: '300px' }}>
|
|
17
17
|
<Button
|
|
18
18
|
color="warning"
|
|
19
19
|
onClick={() => {
|
|
@@ -13,7 +13,7 @@ import { LabelContainer } from '@digigov/ui/form/LabelContainer';
|
|
|
13
13
|
import { TextInput } from '@digigov/ui/form/TextInput';
|
|
14
14
|
export const Auto = (_: any) => {
|
|
15
15
|
return (
|
|
16
|
-
<div>
|
|
16
|
+
<div style={{ minHeight: '300px' }}>
|
|
17
17
|
<ModalProvider>
|
|
18
18
|
<ModalButtonAuto open modal="modal-1">
|
|
19
19
|
Προσθήκη τηλεφώνου
|
|
@@ -14,7 +14,7 @@ import { TextInput } from '@digigov/ui/form/TextInput';
|
|
|
14
14
|
export const WithHooks = (_: any) => {
|
|
15
15
|
const { registerModal, registerAction } = useModal();
|
|
16
16
|
return (
|
|
17
|
-
<div>
|
|
17
|
+
<div style={{ minHeight: '300px' }}>
|
|
18
18
|
<Button {...registerAction('modal-1', 'open')}>Προσθήκη τηλεφώνου</Button>
|
|
19
19
|
<Modal
|
|
20
20
|
{...registerModal('modal-1', {
|
package/src/app/Modal/hooks.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface UseModalReturn {
|
|
|
18
18
|
id: string;
|
|
19
19
|
'aria-modal': boolean;
|
|
20
20
|
'aria-labelledby': string;
|
|
21
|
-
ref?: React.RefObject<HTMLDivElement>;
|
|
21
|
+
ref?: React.RefObject<HTMLDivElement | null>;
|
|
22
22
|
};
|
|
23
23
|
registerAction: (
|
|
24
24
|
id: ModalId,
|
|
@@ -29,18 +29,18 @@ export interface UseModalReturn {
|
|
|
29
29
|
}
|
|
30
30
|
) => {
|
|
31
31
|
onClick: () => void;
|
|
32
|
-
ref?: React.RefObject<HTMLButtonElement>;
|
|
32
|
+
ref?: React.RefObject<HTMLButtonElement | null>;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export const useModal = (): UseModalReturn => {
|
|
37
37
|
const [currentOpen, setCurrentOpen] = useState<ModalId | null>(null);
|
|
38
|
-
const modalsRef = useRef<
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
const buttonsRef = useRef<
|
|
42
|
-
|
|
43
|
-
);
|
|
38
|
+
const modalsRef = useRef<
|
|
39
|
+
Map<ModalId, React.RefObject<HTMLDivElement | null>>
|
|
40
|
+
>(new Map());
|
|
41
|
+
const buttonsRef = useRef<
|
|
42
|
+
Map<ModalId, React.RefObject<HTMLButtonElement | null>>
|
|
43
|
+
>(new Map());
|
|
44
44
|
const open = useCallback((id: ModalId) => {
|
|
45
45
|
setCurrentOpen(id);
|
|
46
46
|
}, []);
|
|
@@ -20,20 +20,18 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
20
20
|
|
|
21
21
|
export const ModalBase = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
22
22
|
function ModalBase({ open, children, onEscape, ...props }, ref) {
|
|
23
|
-
const firstModalElement =
|
|
24
|
-
|
|
25
|
-
const lastModalElement =
|
|
26
|
-
useRef() as React.MutableRefObject<HTMLSpanElement>;
|
|
23
|
+
const firstModalElement = useRef<HTMLSpanElement>(null);
|
|
24
|
+
const lastModalElement = useRef<HTMLSpanElement>(null);
|
|
27
25
|
const handleFocus = useCallback(() => {
|
|
28
|
-
firstModalElement.current
|
|
26
|
+
firstModalElement.current?.focus();
|
|
29
27
|
}, []);
|
|
30
28
|
useKeypress('Escape', onEscape);
|
|
31
29
|
useEffect(() => {
|
|
32
30
|
const lastModalElementInstance = lastModalElement.current;
|
|
33
31
|
handleFocus();
|
|
34
|
-
lastModalElementInstance
|
|
32
|
+
lastModalElementInstance?.addEventListener('focus', handleFocus);
|
|
35
33
|
return () => {
|
|
36
|
-
lastModalElementInstance
|
|
34
|
+
lastModalElementInstance?.removeEventListener('focus', handleFocus);
|
|
37
35
|
};
|
|
38
36
|
}, []);
|
|
39
37
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
2
|
import { isMobile } from '@digigov/ui/app/OutdatedBrowserBanner/hooks/evaluateBrowserVersion';
|
|
3
3
|
import useOutdatedBrowserCheck from '@digigov/ui/app/OutdatedBrowserBanner/hooks/useOutdatedBrowserCheck';
|
|
4
4
|
import { WarningText } from '@digigov/ui/feedback/WarningText';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
2
|
import HeaderContent from '@digigov/react-core/HeaderContent';
|
|
3
3
|
import PhaseBanner from '@digigov/react-core/PhaseBanner';
|
|
4
4
|
import PhaseBannerHeaderContainer from '@digigov/react-core/PhaseBannerHeaderContainer';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
// Unique ID for the aria-live notification area element.
|
|
4
|
+
const notificationAreaId = 'loader-notification-area';
|
|
5
|
+
// Custom attribute to track active spinners
|
|
6
|
+
const activeSpinnersAttr = 'data-active-spinners';
|
|
7
|
+
|
|
8
|
+
// Generates a random unique ID for each spinner instance.
|
|
9
|
+
function generateUniqueId() {
|
|
10
|
+
return `spinner-${Math.random().toString(36).substring(2, 9)}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Finds or creates the notification area element in the DOM.
|
|
14
|
+
const getOrCreateNotificationArea = (): HTMLElement => {
|
|
15
|
+
let element = document.getElementById(notificationAreaId);
|
|
16
|
+
|
|
17
|
+
// Create and append it to the DOM.
|
|
18
|
+
if (!element) {
|
|
19
|
+
element = document.createElement('div');
|
|
20
|
+
element.id = notificationAreaId;
|
|
21
|
+
element.setAttribute('role', 'status');
|
|
22
|
+
element.setAttribute('aria-live', 'polite');
|
|
23
|
+
element.className = 'ds-visually-hidden';
|
|
24
|
+
document.body.appendChild(element);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return element;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const useNotificationArea = (
|
|
31
|
+
loadingText = 'Γίνεται φόρτωση...',
|
|
32
|
+
finishedText = 'Η φόρτωση ολοκληρώθηκε.'
|
|
33
|
+
) => {
|
|
34
|
+
// Unique ID for this spinner.
|
|
35
|
+
const spinnerId = useRef(generateUniqueId());
|
|
36
|
+
// Reference to the notification area DOM element.
|
|
37
|
+
const notificationRef = useRef<HTMLElement | null>(null);
|
|
38
|
+
|
|
39
|
+
// Returns an array of active spinner IDs.
|
|
40
|
+
const getActiveIds = useCallback(() => {
|
|
41
|
+
const current = notificationRef.current;
|
|
42
|
+
const value = current?.getAttribute(activeSpinnersAttr) || '';
|
|
43
|
+
return value.split(',').filter(Boolean);
|
|
44
|
+
}, [notificationRef]);
|
|
45
|
+
|
|
46
|
+
// Adds this spinner's ID to the active list.
|
|
47
|
+
const setActiveSpinnerId = useCallback(() => {
|
|
48
|
+
const current = notificationRef.current;
|
|
49
|
+
if (current) {
|
|
50
|
+
const ids = new Set(getActiveIds());
|
|
51
|
+
ids.add(spinnerId.current);
|
|
52
|
+
current.setAttribute(activeSpinnersAttr, Array.from(ids).join(','));
|
|
53
|
+
}
|
|
54
|
+
}, [notificationRef, getActiveIds, spinnerId]);
|
|
55
|
+
|
|
56
|
+
// Removes this spinner's ID from the active list.
|
|
57
|
+
const unsetActiveSpinnerId = useCallback(() => {
|
|
58
|
+
const current = notificationRef.current;
|
|
59
|
+
if (current) {
|
|
60
|
+
const ids = getActiveIds().filter((id) => id !== spinnerId.current);
|
|
61
|
+
current.setAttribute(activeSpinnersAttr, ids.join(','));
|
|
62
|
+
}
|
|
63
|
+
}, [notificationRef, getActiveIds, spinnerId]);
|
|
64
|
+
|
|
65
|
+
// Updates the text content of the aria-live region.
|
|
66
|
+
const setTextContent = (text: string) => {
|
|
67
|
+
if (notificationRef.current) {
|
|
68
|
+
notificationRef.current.textContent = text;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (typeof document === 'undefined') return;
|
|
74
|
+
|
|
75
|
+
// Set up notification area and mark this spinner as active.
|
|
76
|
+
notificationRef.current = getOrCreateNotificationArea();
|
|
77
|
+
setActiveSpinnerId();
|
|
78
|
+
setTextContent(loadingText);
|
|
79
|
+
|
|
80
|
+
// Cleanup when component unmounts.
|
|
81
|
+
return () => {
|
|
82
|
+
unsetActiveSpinnerId();
|
|
83
|
+
|
|
84
|
+
// If no active spinners remain, announce "finished" and clear the text.
|
|
85
|
+
if (getActiveIds().length === 0) {
|
|
86
|
+
setTextContent(finishedText);
|
|
87
|
+
|
|
88
|
+
// Give screen readers a chance to announce "finished" before clearing.
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
const el = notificationRef.current;
|
|
91
|
+
if (el && getActiveIds().length === 0) {
|
|
92
|
+
el.removeAttribute(activeSpinnersAttr);
|
|
93
|
+
el.textContent = '';
|
|
94
|
+
}
|
|
95
|
+
}, 1000);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}, [
|
|
99
|
+
loadingText,
|
|
100
|
+
finishedText,
|
|
101
|
+
setActiveSpinnerId,
|
|
102
|
+
unsetActiveSpinnerId,
|
|
103
|
+
getActiveIds,
|
|
104
|
+
]);
|
|
105
|
+
};
|