@digigov/ui 0.12.1 → 0.12.2
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/.eslintrc.js +4 -0
- package/.prettierrc.js +3 -0
- package/.rush/temp/package-deps_build.json +176 -0
- package/.rush/temp/shrinkwrap-deps.json +278 -0
- package/CHANGELOG.json +796 -0
- package/CHANGELOG.md +8 -1
- package/docs/components.mdx +1 -0
- package/docs/create-a-new-service.mdx +93 -0
- package/docs/create-common-page-layout.mdx +205 -0
- package/docs/create-static-page.mdx +179 -0
- package/docs/edit-start-page.mdx +143 -0
- package/docs/index.mdx +66 -0
- package/docs/introduction.mdx +34 -0
- package/package.json +30 -7
- package/src/api/APIErrors.tsx +44 -0
- package/src/api/APIProvider.tsx +27 -0
- package/src/api/fetchAPI.ts +45 -0
- package/src/api/index.spec.tsx +419 -0
- package/{esm/api/index.js → src/api/index.tsx} +6 -3
- package/{api → src/api}/introduction.md +0 -0
- package/src/api/useResource.tsx +96 -0
- package/src/api/useResourceAction.tsx +80 -0
- package/src/api/useResourceQuery.tsx +177 -0
- package/src/api/utils.tsx +156 -0
- package/src/app/App.tsx +33 -0
- package/{app/Confirmation/index.d.ts → src/app/Confirmation/index.tsx} +0 -0
- package/{app/Footer/index.d.ts → src/app/Footer/index.tsx} +0 -0
- package/{es/app/Header/HeaderLogo.js → src/app/Header/HeaderLogo.tsx} +9 -7
- package/src/app/Header/HeaderSection.tsx +13 -0
- package/src/app/Header/HeaderTitle.tsx +24 -0
- package/{app → src/app}/Header/__snapshots__/index.spec.tsx.snap +0 -0
- package/{app → src/app}/Header/index.mdx +0 -0
- package/src/app/Header/index.spec.tsx +32 -0
- package/{esm/app/Header/index.js → src/app/Header/index.tsx} +10 -4
- package/src/app/NotFound/index.tsx +21 -0
- package/src/app/OutdatedBrowserBanner.tsx +37 -0
- package/src/app/PageTitle.tsx +70 -0
- package/{app → src/app}/QrCodeScanner/__snapshots__/index.spec.tsx.snap +0 -0
- package/{app → src/app}/QrCodeScanner/index.mdx +0 -0
- package/src/app/QrCodeScanner/index.spec.tsx +19 -0
- package/src/app/QrCodeScanner/index.tsx +90 -0
- package/src/app/i18n.tsx +44 -0
- package/{app/index.d.ts → src/app/index.ts} +0 -0
- package/{core → src/core}/Accordion/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/Accordion/index.mdx +0 -0
- package/src/core/Accordion/index.spec.tsx +30 -0
- package/src/core/Accordion/index.tsx +86 -0
- package/{core → src/core}/Blockquote/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/Blockquote/index.mdx +0 -0
- package/src/core/Blockquote/index.spec.tsx +10 -0
- package/{esm/core/Blockquote/index.js → src/core/Blockquote/index.tsx} +9 -7
- package/{core/Breadcrumbs/index.d.ts → src/core/Breadcrumbs/index.tsx} +0 -0
- package/{esm/core/Button/BackButton.js → src/core/Button/BackButton.tsx} +10 -8
- package/src/core/Button/ButtonLink.tsx +20 -0
- package/src/core/Button/CallToAction.tsx +31 -0
- package/src/core/Button/Icon.tsx +9 -0
- package/{core → src/core}/Button/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/Button/index.mdx +0 -0
- package/src/core/Button/index.spec.tsx +8 -0
- package/src/core/Button/index.tsx +46 -0
- package/{core/Card/index.d.ts → src/core/Card/index.tsx} +0 -0
- package/{core → src/core}/Details/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/Details/index.mdx +0 -0
- package/src/core/Details/index.spec.tsx +38 -0
- package/{core/Details/index.d.ts → src/core/Details/index.tsx} +2 -0
- package/src/core/Divider/index.tsx +13 -0
- package/{core → src/core}/ErrorSummary/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/ErrorSummary/index.mdx +0 -0
- package/src/core/ErrorSummary/index.spec.tsx +10 -0
- package/{core/ErrorSummary/index.d.ts → src/core/ErrorSummary/index.tsx} +1 -0
- package/{core/Hidden/index.d.ts → src/core/Hidden/index.tsx} +0 -0
- package/{core → src/core}/Link/__snapshots__/index.spec.tsx.snap +0 -0
- package/src/core/Link/index.spec.tsx +22 -0
- package/src/core/Link/index.tsx +41 -0
- package/{core/List/List.d.ts → src/core/List/List.tsx} +2 -0
- package/{core/List/ListItem.d.ts → src/core/List/ListItem.tsx} +2 -0
- package/src/core/List/ListItemContent.tsx +32 -0
- package/src/core/List/ListItemIcon.tsx +31 -0
- package/src/core/List/ListItemText.tsx +23 -0
- package/src/core/List/ListItemTitle.tsx +37 -0
- package/{core → src/core}/List/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/List/index.mdx +0 -0
- package/src/core/List/index.spec.tsx +10 -0
- package/{core/List/index.d.ts → src/core/List/index.tsx} +0 -0
- package/src/core/NavList/NavList.tsx +103 -0
- package/src/core/NavList/NavListContext.tsx +85 -0
- package/src/core/NavList/NavListItem.tsx +143 -0
- package/src/core/NavList/NavListItemBase.tsx +146 -0
- package/src/core/NavList/NavListSubMenu.tsx +33 -0
- package/{core → src/core}/NavList/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/NavList/index.mdx +0 -0
- package/src/core/NavList/index.spec.tsx +10 -0
- package/{core/NavList/index.d.ts → src/core/NavList/index.tsx} +0 -0
- package/{core → src/core}/NotificationBanner/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/NotificationBanner/index.mdx +0 -0
- package/src/core/NotificationBanner/index.spec.tsx +27 -0
- package/src/core/NotificationBanner/index.tsx +52 -0
- package/{core → src/core}/ServiceBadge/ServiceBadge.mdx +0 -0
- package/{core → src/core}/ServiceBadge/index.mdx +0 -0
- package/src/core/ServiceBadge/index.tsx +35 -0
- package/{core → src/core}/SummaryList/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/SummaryList/index.mdx +0 -0
- package/src/core/SummaryList/index.spec.tsx +28 -0
- package/{core/SummaryList/index.d.ts → src/core/SummaryList/index.tsx} +2 -0
- package/{core/Table/index.d.ts → src/core/Table/index.tsx} +0 -0
- package/{core → src/core}/Tabs/index.mdx +0 -0
- package/src/core/Tabs/index.tsx +36 -0
- package/{core/VisuallyHidden/index.d.ts → src/core/VisuallyHidden/index.tsx} +0 -0
- package/{core → src/core}/WarningText/__snapshots__/index.spec.tsx.snap +0 -0
- package/{core → src/core}/WarningText/index.mdx +0 -0
- package/src/core/WarningText/index.spec.tsx +10 -0
- package/{core/WarningText/index.d.ts → src/core/WarningText/index.tsx} +1 -0
- package/{core/index.d.ts → src/core/index.ts} +0 -0
- package/src/custom.d.ts +8 -0
- package/{es → src}/form/inputs/Input/index.mdx +0 -0
- package/src/govgr/Footer/Copyright.tsx +64 -0
- package/{govgr/Footer/HellenicRepublicLogo.d.ts → src/govgr/Footer/HellenicRepublicLogo.tsx} +1 -0
- package/src/govgr/Footer/LicenseCCSA.tsx +24 -0
- package/{es → src}/govgr/Footer/index.mdx +0 -0
- package/src/govgr/Footer/index.tsx +49 -0
- package/{esm/govgr/Footer/logo.js → src/govgr/Footer/logo.ts} +1 -1
- package/{esm/govgr/Footer/logos/logo-el.js → src/govgr/Footer/logos/logo-el.ts} +1 -1
- package/{esm/govgr/Footer/logos/logo-en.js → src/govgr/Footer/logos/logo-en.ts} +1 -1
- package/{es → src}/govgr/Logo/govgr-logo.svg +0 -0
- package/{govgr/Logo/index.d.ts → src/govgr/Logo/index.tsx} +2 -0
- package/{es/govgr/Logo/logo.js → src/govgr/Logo/logo.ts} +1 -1
- package/{govgr/index.d.ts → src/govgr/index.ts} +0 -0
- package/src/hooks/useDebounce.ts +50 -0
- package/src/hooks/useLatest.ts +12 -0
- package/{esm/hooks/useOutdatedBrowserCheck.js → src/hooks/useOutdatedBrowserCheck.ts} +16 -15
- package/src/hooks/useSearch.ts +47 -0
- package/src/hooks/useTogglableSections.tsx +102 -0
- package/{index.d.ts → src/index.ts} +0 -0
- package/{es → src}/layouts/Basic/Bottom/index.mdx +0 -0
- package/{layouts/Basic/Bottom/index.d.ts → src/layouts/Basic/Bottom/index.tsx} +1 -0
- package/{es → src}/layouts/Basic/Content/index.mdx +0 -0
- package/src/layouts/Basic/Content/index.tsx +24 -0
- package/{es → src}/layouts/Basic/Main/index.mdx +0 -0
- package/{layouts/Basic/Main/index.d.ts → src/layouts/Basic/Main/index.tsx} +1 -0
- package/{es → src}/layouts/Basic/Masthead/index.mdx +0 -0
- package/{layouts/Basic/Masthead/index.d.ts → src/layouts/Basic/Masthead/index.tsx} +2 -0
- package/{es → src}/layouts/Basic/Side/index.mdx +0 -0
- package/{esm/layouts/Basic/Side/index.js → src/layouts/Basic/Side/index.tsx} +5 -3
- package/{es → src}/layouts/Basic/Top/index.mdx +0 -0
- package/{es/layouts/Basic/Top/index.js → src/layouts/Basic/Top/index.tsx} +7 -5
- package/{es → src}/layouts/Basic/__snapshots__/index.spec.tsx.snap +0 -0
- package/{es → src}/layouts/Basic/index.mdx +0 -0
- package/src/layouts/Basic/index.spec.tsx +24 -0
- package/{layouts/Basic/index.d.ts → src/layouts/Basic/index.tsx} +2 -0
- package/{layouts/Grid/index.d.ts → src/layouts/Grid/index.tsx} +0 -0
- package/{layouts/index.d.ts → src/layouts/index.ts} +0 -0
- package/{es/locales/el.js → src/locales/el.ts} +19 -14
- package/{esm/locales/en.js → src/locales/en.ts} +17 -13
- package/{es → src}/router/index.mdx +0 -0
- package/src/router/index.tsx +28 -0
- package/src/test-utils/delay.ts +9 -0
- package/src/test-utils/mountWithTheme.tsx +33 -0
- package/{esm → src}/themes/govgr.js +33 -29
- package/src/themes/grnet.js +109 -0
- package/src/themes/index.tsx +38 -0
- package/src/typography/Caption.tsx +15 -0
- package/src/typography/NormalText.tsx +7 -0
- package/src/typography/Paragraph.tsx +9 -0
- package/src/typography/Title.tsx +51 -0
- package/{es → src}/typography/index.mdx +0 -0
- package/{typography/index.d.ts → src/typography/index.ts} +0 -0
- package/src/utils/evaluateBrowserVersion.ts +346 -0
- package/src/utils/withDeprecation.tsx +97 -0
- package/tsconfig.json +18 -0
- package/tsconfig.production.json +27 -0
- package/ui.build.log +17 -0
- package/LICENSE +0 -0
- package/api/APIErrors.d.ts +0 -22
- package/api/APIErrors.js +0 -117
- package/api/APIProvider.d.ts +0 -15
- package/api/APIProvider.js +0 -43
- package/api/fetchAPI.d.ts +0 -18
- package/api/fetchAPI.js +0 -64
- package/api/index.d.ts +0 -9
- package/api/index.js +0 -104
- package/api/index.spec.d.ts +0 -1
- package/api/index.spec.js +0 -584
- package/api/useResource.d.ts +0 -11
- package/api/useResource.js +0 -144
- package/api/useResourceAction.d.ts +0 -2
- package/api/useResourceAction.js +0 -157
- package/api/useResourceQuery.d.ts +0 -18
- package/api/useResourceQuery.js +0 -229
- package/api/utils.d.ts +0 -6
- package/api/utils.js +0 -250
- package/app/App.d.ts +0 -14
- package/app/App.js +0 -49
- package/app/Confirmation/index.js +0 -44
- package/app/Footer/index.js +0 -200
- package/app/Header/HeaderLogo.d.ts +0 -3
- package/app/Header/HeaderLogo.js +0 -30
- package/app/Header/HeaderSection.d.ts +0 -5
- package/app/Header/HeaderSection.js +0 -20
- package/app/Header/HeaderTitle.d.ts +0 -5
- package/app/Header/HeaderTitle.js +0 -30
- package/app/Header/index.d.ts +0 -11
- package/app/Header/index.js +0 -106
- package/app/Header/index.spec.d.ts +0 -1
- package/app/Header/index.spec.js +0 -45
- package/app/NotFound/index.d.ts +0 -3
- package/app/NotFound/index.js +0 -29
- package/app/OutdatedBrowserBanner.d.ts +0 -2
- package/app/OutdatedBrowserBanner.js +0 -41
- package/app/PageTitle.d.ts +0 -10
- package/app/PageTitle.js +0 -76
- package/app/QrCodeScanner/index.d.ts +0 -29
- package/app/QrCodeScanner/index.js +0 -85
- package/app/QrCodeScanner/index.spec.d.ts +0 -1
- package/app/QrCodeScanner/index.spec.js +0 -26
- package/app/i18n.d.ts +0 -10
- package/app/i18n.js +0 -57
- package/app/index.js +0 -70
- package/core/Accordion/index.d.ts +0 -21
- package/core/Accordion/index.js +0 -127
- package/core/Accordion/index.spec.d.ts +0 -1
- package/core/Accordion/index.spec.js +0 -19
- package/core/Blockquote/index.d.ts +0 -3
- package/core/Blockquote/index.js +0 -29
- package/core/Blockquote/index.spec.d.ts +0 -1
- package/core/Blockquote/index.spec.js +0 -21
- package/core/Breadcrumbs/index.js +0 -44
- package/core/Button/BackButton.d.ts +0 -3
- package/core/Button/BackButton.js +0 -34
- package/core/Button/ButtonLink.d.ts +0 -4
- package/core/Button/ButtonLink.js +0 -28
- package/core/Button/CallToAction.d.ts +0 -7
- package/core/Button/CallToAction.js +0 -41
- package/core/Button/Icon.d.ts +0 -2
- package/core/Button/Icon.js +0 -19
- package/core/Button/index.d.ts +0 -15
- package/core/Button/index.js +0 -122
- package/core/Button/index.spec.d.ts +0 -1
- package/core/Button/index.spec.js +0 -21
- package/core/Card/index.js +0 -57
- package/core/Details/index.js +0 -35
- package/core/Details/index.spec.d.ts +0 -1
- package/core/Details/index.spec.js +0 -27
- package/core/Divider/index.d.ts +0 -5
- package/core/Divider/index.js +0 -20
- package/core/ErrorSummary/index.js +0 -19
- package/core/ErrorSummary/index.spec.d.ts +0 -1
- package/core/ErrorSummary/index.spec.js +0 -21
- package/core/Hidden/index.js +0 -18
- package/core/Link/index.d.ts +0 -12
- package/core/Link/index.js +0 -50
- package/core/Link/index.spec.d.ts +0 -1
- package/core/Link/index.spec.js +0 -31
- package/core/List/List.js +0 -19
- package/core/List/ListItem.js +0 -19
- package/core/List/ListItemContent.d.ts +0 -7
- package/core/List/ListItemContent.js +0 -45
- package/core/List/ListItemIcon.d.ts +0 -7
- package/core/List/ListItemIcon.js +0 -48
- package/core/List/ListItemText.d.ts +0 -8
- package/core/List/ListItemText.js +0 -36
- package/core/List/ListItemTitle.d.ts +0 -10
- package/core/List/ListItemTitle.js +0 -44
- package/core/List/index.js +0 -96
- package/core/List/index.spec.d.ts +0 -1
- package/core/List/index.spec.js +0 -21
- package/core/NavList/NavList.d.ts +0 -17
- package/core/NavList/NavList.js +0 -99
- package/core/NavList/NavListContext.d.ts +0 -20
- package/core/NavList/NavListContext.js +0 -102
- package/core/NavList/NavListItem.d.ts +0 -13
- package/core/NavList/NavListItem.js +0 -171
- package/core/NavList/NavListItemBase.d.ts +0 -16
- package/core/NavList/NavListItemBase.js +0 -161
- package/core/NavList/NavListSubMenu.d.ts +0 -8
- package/core/NavList/NavListSubMenu.js +0 -52
- package/core/NavList/index.js +0 -68
- package/core/NavList/index.spec.d.ts +0 -1
- package/core/NavList/index.spec.js +0 -21
- package/core/NotificationBanner/index.d.ts +0 -18
- package/core/NotificationBanner/index.js +0 -78
- package/core/NotificationBanner/index.spec.d.ts +0 -1
- package/core/NotificationBanner/index.spec.js +0 -32
- package/core/ServiceBadge/index.d.ts +0 -9
- package/core/ServiceBadge/index.js +0 -36
- package/core/SummaryList/index.js +0 -79
- package/core/SummaryList/index.spec.d.ts +0 -1
- package/core/SummaryList/index.spec.js +0 -19
- package/core/Table/index.js +0 -96
- package/core/Tabs/index.d.ts +0 -16
- package/core/Tabs/index.js +0 -88
- package/core/VisuallyHidden/index.js +0 -18
- package/core/WarningText/index.js +0 -19
- package/core/WarningText/index.spec.d.ts +0 -1
- package/core/WarningText/index.spec.js +0 -21
- package/core/index.js +0 -227
- package/custom.d.js +0 -1
- package/es/api/APIErrors.js +0 -96
- package/es/api/APIProvider.js +0 -25
- package/es/api/fetchAPI.js +0 -49
- package/es/api/index.js +0 -13
- package/es/api/index.spec.js +0 -546
- package/es/api/introduction.md +0 -6
- package/es/api/useResource.js +0 -128
- package/es/api/useResourceAction.js +0 -141
- package/es/api/useResourceQuery.js +0 -208
- package/es/api/utils.js +0 -233
- package/es/app/App.js +0 -27
- package/es/app/Confirmation/index.js +0 -3
- package/es/app/Footer/index.js +0 -15
- package/es/app/Header/HeaderSection.js +0 -7
- package/es/app/Header/HeaderTitle.js +0 -17
- package/es/app/Header/__snapshots__/index.spec.tsx.snap +0 -393
- package/es/app/Header/index.js +0 -13
- package/es/app/Header/index.mdx +0 -50
- package/es/app/Header/index.spec.js +0 -32
- package/es/app/NotFound/index.js +0 -12
- package/es/app/OutdatedBrowserBanner.js +0 -24
- package/es/app/PageTitle.js +0 -57
- package/es/app/QrCodeScanner/__snapshots__/index.spec.tsx.snap +0 -22
- package/es/app/QrCodeScanner/index.js +0 -64
- package/es/app/QrCodeScanner/index.mdx +0 -22
- package/es/app/QrCodeScanner/index.spec.js +0 -13
- package/es/app/i18n.js +0 -36
- package/es/app/index.js +0 -5
- package/es/core/Accordion/__snapshots__/index.spec.tsx.snap +0 -78
- package/es/core/Accordion/index.js +0 -67
- package/es/core/Accordion/index.mdx +0 -104
- package/es/core/Accordion/index.spec.js +0 -9
- package/es/core/Blockquote/__snapshots__/index.spec.tsx.snap +0 -13
- package/es/core/Blockquote/index.js +0 -16
- package/es/core/Blockquote/index.mdx +0 -61
- package/es/core/Blockquote/index.spec.js +0 -9
- package/es/core/Breadcrumbs/index.js +0 -3
- package/es/core/Button/BackButton.js +0 -21
- package/es/core/Button/ButtonLink.js +0 -16
- package/es/core/Button/CallToAction.js +0 -27
- package/es/core/Button/Icon.js +0 -7
- package/es/core/Button/__snapshots__/index.spec.tsx.snap +0 -13
- package/es/core/Button/index.js +0 -37
- package/es/core/Button/index.mdx +0 -65
- package/es/core/Button/index.spec.js +0 -9
- package/es/core/Card/index.js +0 -4
- package/es/core/Details/__snapshots__/index.spec.tsx.snap +0 -50
- package/es/core/Details/index.js +0 -5
- package/es/core/Details/index.mdx +0 -34
- package/es/core/Details/index.spec.js +0 -17
- package/es/core/Divider/index.js +0 -7
- package/es/core/ErrorSummary/__snapshots__/index.spec.tsx.snap +0 -322
- package/es/core/ErrorSummary/index.js +0 -3
- package/es/core/ErrorSummary/index.mdx +0 -61
- package/es/core/ErrorSummary/index.spec.js +0 -9
- package/es/core/Hidden/index.js +0 -1
- package/es/core/Link/__snapshots__/index.spec.tsx.snap +0 -31
- package/es/core/Link/index.js +0 -26
- package/es/core/Link/index.spec.js +0 -21
- package/es/core/List/List.js +0 -3
- package/es/core/List/ListItem.js +0 -3
- package/es/core/List/ListItemContent.js +0 -27
- package/es/core/List/ListItemIcon.js +0 -29
- package/es/core/List/ListItemText.js +0 -19
- package/es/core/List/ListItemTitle.js +0 -25
- package/es/core/List/__snapshots__/index.spec.tsx.snap +0 -322
- package/es/core/List/index.js +0 -7
- package/es/core/List/index.mdx +0 -40
- package/es/core/List/index.spec.js +0 -9
- package/es/core/NavList/NavList.js +0 -78
- package/es/core/NavList/NavListContext.js +0 -80
- package/es/core/NavList/NavListItem.js +0 -141
- package/es/core/NavList/NavListItemBase.js +0 -133
- package/es/core/NavList/NavListSubMenu.js +0 -27
- package/es/core/NavList/__snapshots__/index.spec.tsx.snap +0 -334
- package/es/core/NavList/index.js +0 -5
- package/es/core/NavList/index.mdx +0 -185
- package/es/core/NavList/index.spec.js +0 -9
- package/es/core/NotificationBanner/__snapshots__/index.spec.tsx.snap +0 -737
- package/es/core/NotificationBanner/index.js +0 -35
- package/es/core/NotificationBanner/index.mdx +0 -77
- package/es/core/NotificationBanner/index.spec.js +0 -20
- package/es/core/ServiceBadge/ServiceBadge.mdx +0 -0
- package/es/core/ServiceBadge/index.js +0 -20
- package/es/core/ServiceBadge/index.mdx +0 -42
- package/es/core/SummaryList/__snapshots__/index.spec.tsx.snap +0 -57
- package/es/core/SummaryList/index.js +0 -7
- package/es/core/SummaryList/index.mdx +0 -82
- package/es/core/SummaryList/index.spec.js +0 -9
- package/es/core/Table/index.js +0 -7
- package/es/core/Tabs/index.js +0 -37
- package/es/core/Tabs/index.mdx +0 -54
- package/es/core/VisuallyHidden/index.js +0 -1
- package/es/core/WarningText/__snapshots__/index.spec.tsx.snap +0 -336
- package/es/core/WarningText/index.js +0 -3
- package/es/core/WarningText/index.mdx +0 -46
- package/es/core/WarningText/index.spec.js +0 -9
- package/es/core/index.js +0 -17
- package/es/custom.d.js +0 -0
- package/es/govgr/Footer/Copyright.js +0 -37
- package/es/govgr/Footer/HellenicRepublicLogo.js +0 -3
- package/es/govgr/Footer/LicenseCCSA.js +0 -18
- package/es/govgr/Footer/index.js +0 -21
- package/es/govgr/Footer/logo.js +0 -1
- package/es/govgr/Footer/logos/logo-el.js +0 -1
- package/es/govgr/Footer/logos/logo-en.js +0 -1
- package/es/govgr/Logo/index.js +0 -3
- package/es/govgr/index.js +0 -4
- package/es/hooks/useDebounce.js +0 -41
- package/es/hooks/useLatest.js +0 -12
- package/es/hooks/useOutdatedBrowserCheck.js +0 -46
- package/es/hooks/useSearch.js +0 -25
- package/es/hooks/useTogglableSections.js +0 -96
- package/es/index.js +0 -5
- package/es/layouts/Basic/Bottom/index.js +0 -3
- package/es/layouts/Basic/Content/index.js +0 -18
- package/es/layouts/Basic/Main/index.js +0 -3
- package/es/layouts/Basic/Masthead/index.js +0 -4
- package/es/layouts/Basic/Side/index.js +0 -7
- package/es/layouts/Basic/index.js +0 -8
- package/es/layouts/Basic/index.spec.js +0 -10
- package/es/layouts/Grid/index.js +0 -1
- package/es/layouts/index.js +0 -2
- package/es/locales/en.js +0 -55
- package/es/router/index.js +0 -15
- package/es/test-utils/delay.js +0 -31
- package/es/test-utils/mountWithTheme.js +0 -30
- package/es/themes/govgr.js +0 -79
- package/es/themes/grnet.js +0 -110
- package/es/themes/index.js +0 -2
- package/es/typography/Caption.js +0 -7
- package/es/typography/NormalText.js +0 -3
- package/es/typography/Paragraph.js +0 -2
- package/es/typography/Title.js +0 -48
- package/es/typography/index.js +0 -8
- package/es/utils/evaluateBrowserVersion.js +0 -201
- package/es/utils/withDeprecation.js +0 -103
- package/esm/api/APIErrors.js +0 -96
- package/esm/api/APIProvider.js +0 -25
- package/esm/api/fetchAPI.js +0 -49
- package/esm/api/index.spec.js +0 -546
- package/esm/api/introduction.md +0 -6
- package/esm/api/useResource.js +0 -128
- package/esm/api/useResourceAction.js +0 -141
- package/esm/api/useResourceQuery.js +0 -208
- package/esm/api/utils.js +0 -233
- package/esm/app/App.js +0 -27
- package/esm/app/Confirmation/index.js +0 -3
- package/esm/app/Footer/index.js +0 -15
- package/esm/app/Header/HeaderLogo.js +0 -17
- package/esm/app/Header/HeaderSection.js +0 -7
- package/esm/app/Header/HeaderTitle.js +0 -17
- package/esm/app/Header/__snapshots__/index.spec.tsx.snap +0 -393
- package/esm/app/Header/index.mdx +0 -50
- package/esm/app/Header/index.spec.js +0 -32
- package/esm/app/NotFound/index.js +0 -12
- package/esm/app/OutdatedBrowserBanner.js +0 -24
- package/esm/app/PageTitle.js +0 -57
- package/esm/app/QrCodeScanner/__snapshots__/index.spec.tsx.snap +0 -22
- package/esm/app/QrCodeScanner/index.js +0 -64
- package/esm/app/QrCodeScanner/index.mdx +0 -22
- package/esm/app/QrCodeScanner/index.spec.js +0 -13
- package/esm/app/i18n.js +0 -36
- package/esm/app/index.js +0 -5
- package/esm/core/Accordion/__snapshots__/index.spec.tsx.snap +0 -78
- package/esm/core/Accordion/index.js +0 -67
- package/esm/core/Accordion/index.mdx +0 -104
- package/esm/core/Accordion/index.spec.js +0 -9
- package/esm/core/Blockquote/__snapshots__/index.spec.tsx.snap +0 -13
- package/esm/core/Blockquote/index.mdx +0 -61
- package/esm/core/Blockquote/index.spec.js +0 -9
- package/esm/core/Breadcrumbs/index.js +0 -3
- package/esm/core/Button/ButtonLink.js +0 -16
- package/esm/core/Button/CallToAction.js +0 -27
- package/esm/core/Button/Icon.js +0 -7
- package/esm/core/Button/__snapshots__/index.spec.tsx.snap +0 -13
- package/esm/core/Button/index.js +0 -37
- package/esm/core/Button/index.mdx +0 -65
- package/esm/core/Button/index.spec.js +0 -9
- package/esm/core/Card/index.js +0 -4
- package/esm/core/Details/__snapshots__/index.spec.tsx.snap +0 -50
- package/esm/core/Details/index.js +0 -5
- package/esm/core/Details/index.mdx +0 -34
- package/esm/core/Details/index.spec.js +0 -17
- package/esm/core/Divider/index.js +0 -7
- package/esm/core/ErrorSummary/__snapshots__/index.spec.tsx.snap +0 -322
- package/esm/core/ErrorSummary/index.js +0 -3
- package/esm/core/ErrorSummary/index.mdx +0 -61
- package/esm/core/ErrorSummary/index.spec.js +0 -9
- package/esm/core/Hidden/index.js +0 -1
- package/esm/core/Link/__snapshots__/index.spec.tsx.snap +0 -31
- package/esm/core/Link/index.js +0 -26
- package/esm/core/Link/index.spec.js +0 -21
- package/esm/core/List/List.js +0 -3
- package/esm/core/List/ListItem.js +0 -3
- package/esm/core/List/ListItemContent.js +0 -27
- package/esm/core/List/ListItemIcon.js +0 -29
- package/esm/core/List/ListItemText.js +0 -19
- package/esm/core/List/ListItemTitle.js +0 -25
- package/esm/core/List/__snapshots__/index.spec.tsx.snap +0 -322
- package/esm/core/List/index.js +0 -7
- package/esm/core/List/index.mdx +0 -40
- package/esm/core/List/index.spec.js +0 -9
- package/esm/core/NavList/NavList.js +0 -78
- package/esm/core/NavList/NavListContext.js +0 -80
- package/esm/core/NavList/NavListItem.js +0 -141
- package/esm/core/NavList/NavListItemBase.js +0 -133
- package/esm/core/NavList/NavListSubMenu.js +0 -27
- package/esm/core/NavList/__snapshots__/index.spec.tsx.snap +0 -334
- package/esm/core/NavList/index.js +0 -5
- package/esm/core/NavList/index.mdx +0 -185
- package/esm/core/NavList/index.spec.js +0 -9
- package/esm/core/NotificationBanner/__snapshots__/index.spec.tsx.snap +0 -737
- package/esm/core/NotificationBanner/index.js +0 -35
- package/esm/core/NotificationBanner/index.mdx +0 -77
- package/esm/core/NotificationBanner/index.spec.js +0 -20
- package/esm/core/ServiceBadge/ServiceBadge.mdx +0 -0
- package/esm/core/ServiceBadge/index.js +0 -20
- package/esm/core/ServiceBadge/index.mdx +0 -42
- package/esm/core/SummaryList/__snapshots__/index.spec.tsx.snap +0 -57
- package/esm/core/SummaryList/index.js +0 -7
- package/esm/core/SummaryList/index.mdx +0 -82
- package/esm/core/SummaryList/index.spec.js +0 -9
- package/esm/core/Table/index.js +0 -7
- package/esm/core/Tabs/index.js +0 -37
- package/esm/core/Tabs/index.mdx +0 -54
- package/esm/core/VisuallyHidden/index.js +0 -1
- package/esm/core/WarningText/__snapshots__/index.spec.tsx.snap +0 -336
- package/esm/core/WarningText/index.js +0 -3
- package/esm/core/WarningText/index.mdx +0 -46
- package/esm/core/WarningText/index.spec.js +0 -9
- package/esm/core/index.js +0 -17
- package/esm/custom.d.js +0 -0
- package/esm/form/inputs/Input/index.mdx +0 -10
- package/esm/govgr/Footer/Copyright.js +0 -37
- package/esm/govgr/Footer/HellenicRepublicLogo.js +0 -3
- package/esm/govgr/Footer/LicenseCCSA.js +0 -18
- package/esm/govgr/Footer/index.js +0 -21
- package/esm/govgr/Footer/index.mdx +0 -97
- package/esm/govgr/Logo/govgr-logo.svg +0 -1
- package/esm/govgr/Logo/index.js +0 -3
- package/esm/govgr/Logo/logo.js +0 -1
- package/esm/govgr/index.js +0 -4
- package/esm/hooks/useDebounce.js +0 -41
- package/esm/hooks/useLatest.js +0 -12
- package/esm/hooks/useSearch.js +0 -25
- package/esm/hooks/useTogglableSections.js +0 -96
- package/esm/index.js +0 -10
- package/esm/layouts/Basic/Bottom/index.js +0 -3
- package/esm/layouts/Basic/Bottom/index.mdx +0 -37
- package/esm/layouts/Basic/Content/index.js +0 -18
- package/esm/layouts/Basic/Content/index.mdx +0 -64
- package/esm/layouts/Basic/Main/index.js +0 -3
- package/esm/layouts/Basic/Main/index.mdx +0 -64
- package/esm/layouts/Basic/Masthead/index.js +0 -4
- package/esm/layouts/Basic/Masthead/index.mdx +0 -74
- package/esm/layouts/Basic/Side/index.mdx +0 -71
- package/esm/layouts/Basic/Top/index.js +0 -11
- package/esm/layouts/Basic/Top/index.mdx +0 -74
- package/esm/layouts/Basic/__snapshots__/index.spec.tsx.snap +0 -54
- package/esm/layouts/Basic/index.js +0 -8
- package/esm/layouts/Basic/index.mdx +0 -62
- package/esm/layouts/Basic/index.spec.js +0 -10
- package/esm/layouts/Grid/index.js +0 -1
- package/esm/layouts/index.js +0 -2
- package/esm/locales/el.js +0 -55
- package/esm/router/index.js +0 -15
- package/esm/router/index.mdx +0 -40
- package/esm/test-utils/delay.js +0 -31
- package/esm/test-utils/mountWithTheme.js +0 -30
- package/esm/themes/grnet.js +0 -110
- package/esm/themes/index.js +0 -2
- package/esm/typography/Caption.js +0 -7
- package/esm/typography/NormalText.js +0 -3
- package/esm/typography/Paragraph.js +0 -2
- package/esm/typography/Title.js +0 -48
- package/esm/typography/index.js +0 -8
- package/esm/typography/index.mdx +0 -32
- package/esm/utils/evaluateBrowserVersion.js +0 -201
- package/esm/utils/withDeprecation.js +0 -103
- package/form/inputs/Input/index.mdx +0 -10
- package/govgr/Footer/Copyright.d.ts +0 -8
- package/govgr/Footer/Copyright.js +0 -52
- package/govgr/Footer/HellenicRepublicLogo.js +0 -19
- package/govgr/Footer/LicenseCCSA.d.ts +0 -3
- package/govgr/Footer/LicenseCCSA.js +0 -33
- package/govgr/Footer/index.d.ts +0 -13
- package/govgr/Footer/index.js +0 -39
- package/govgr/Footer/index.mdx +0 -97
- package/govgr/Footer/logo.d.ts +0 -2
- package/govgr/Footer/logo.js +0 -8
- package/govgr/Footer/logos/logo-el.d.ts +0 -2
- package/govgr/Footer/logos/logo-el.js +0 -8
- package/govgr/Footer/logos/logo-en.d.ts +0 -2
- package/govgr/Footer/logos/logo-en.js +0 -8
- package/govgr/Logo/govgr-logo.svg +0 -1
- package/govgr/Logo/index.js +0 -19
- package/govgr/Logo/logo.d.ts +0 -2
- package/govgr/Logo/logo.js +0 -8
- package/govgr/index.js +0 -57
- package/hooks/useDebounce.d.ts +0 -3
- package/hooks/useDebounce.js +0 -63
- package/hooks/useLatest.d.ts +0 -3
- package/hooks/useLatest.js +0 -26
- package/hooks/useOutdatedBrowserCheck.d.ts +0 -2
- package/hooks/useOutdatedBrowserCheck.js +0 -60
- package/hooks/useSearch.d.ts +0 -4
- package/hooks/useSearch.js +0 -40
- package/hooks/useTogglableSections.d.ts +0 -18
- package/hooks/useTogglableSections.js +0 -108
- package/index.js +0 -70
- package/layouts/Basic/Bottom/index.js +0 -19
- package/layouts/Basic/Bottom/index.mdx +0 -37
- package/layouts/Basic/Content/index.d.ts +0 -5
- package/layouts/Basic/Content/index.js +0 -31
- package/layouts/Basic/Content/index.mdx +0 -64
- package/layouts/Basic/Main/index.js +0 -19
- package/layouts/Basic/Main/index.mdx +0 -64
- package/layouts/Basic/Masthead/index.js +0 -27
- package/layouts/Basic/Masthead/index.mdx +0 -74
- package/layouts/Basic/Side/index.d.ts +0 -3
- package/layouts/Basic/Side/index.js +0 -20
- package/layouts/Basic/Side/index.mdx +0 -71
- package/layouts/Basic/Top/index.d.ts +0 -3
- package/layouts/Basic/Top/index.js +0 -24
- package/layouts/Basic/Top/index.mdx +0 -74
- package/layouts/Basic/__snapshots__/index.spec.tsx.snap +0 -54
- package/layouts/Basic/index.js +0 -97
- package/layouts/Basic/index.mdx +0 -62
- package/layouts/Basic/index.spec.d.ts +0 -1
- package/layouts/Basic/index.spec.js +0 -20
- package/layouts/Grid/index.js +0 -18
- package/layouts/index.js +0 -34
- package/locales/el.d.ts +0 -56
- package/locales/el.js +0 -62
- package/locales/en.d.ts +0 -56
- package/locales/en.js +0 -62
- package/router/index.d.ts +0 -9
- package/router/index.js +0 -37
- package/router/index.mdx +0 -40
- package/test-utils/delay.d.ts +0 -2
- package/test-utils/delay.js +0 -45
- package/test-utils/mountWithTheme.d.ts +0 -3
- package/test-utils/mountWithTheme.js +0 -43
- package/themes/govgr.d.ts +0 -3
- package/themes/govgr.js +0 -89
- package/themes/grnet.d.ts +0 -2
- package/themes/grnet.js +0 -128
- package/themes/index.d.ts +0 -32
- package/themes/index.js +0 -19
- package/typography/Caption.d.ts +0 -7
- package/typography/Caption.js +0 -20
- package/typography/NormalText.d.ts +0 -5
- package/typography/NormalText.js +0 -19
- package/typography/Paragraph.d.ts +0 -6
- package/typography/Paragraph.js +0 -13
- package/typography/Title.d.ts +0 -9
- package/typography/Title.js +0 -63
- package/typography/index.js +0 -97
- package/typography/index.mdx +0 -32
- package/utils/evaluateBrowserVersion.d.ts +0 -15
- package/utils/evaluateBrowserVersion.js +0 -216
- package/utils/withDeprecation.d.ts +0 -16
- package/utils/withDeprecation.js +0 -116
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useLatest from '@digigov/ui/hooks/useLatest';
|
|
3
|
+
|
|
4
|
+
export const useDebounceCallback = <CallbackArgs extends any[]>(
|
|
5
|
+
callback: (...args: CallbackArgs) => void,
|
|
6
|
+
wait = 100,
|
|
7
|
+
leading = false
|
|
8
|
+
): ((...args: CallbackArgs) => void) => {
|
|
9
|
+
const storedCallback = useLatest(callback);
|
|
10
|
+
const timeout = React.useRef<ReturnType<typeof setTimeout>>();
|
|
11
|
+
const deps = [wait, leading, storedCallback];
|
|
12
|
+
// Cleans up pending timeouts when the deps change
|
|
13
|
+
React.useEffect(
|
|
14
|
+
() => () => {
|
|
15
|
+
timeout.current && clearTimeout(timeout.current);
|
|
16
|
+
timeout.current = void 0;
|
|
17
|
+
},
|
|
18
|
+
deps
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return React.useCallback(function () {
|
|
22
|
+
// eslint-disable-next-line prefer-rest-params
|
|
23
|
+
const args = arguments;
|
|
24
|
+
const { current } = timeout;
|
|
25
|
+
// Calls on leading edge
|
|
26
|
+
if (current === void 0 && leading) {
|
|
27
|
+
timeout.current = setTimeout(() => {
|
|
28
|
+
timeout.current = void 0;
|
|
29
|
+
}, wait);
|
|
30
|
+
// eslint-disable-next-line prefer-spread
|
|
31
|
+
return storedCallback.current.apply(null, args as any);
|
|
32
|
+
}
|
|
33
|
+
// Clear the timeout every call and start waiting again
|
|
34
|
+
current && clearTimeout(current);
|
|
35
|
+
// Waits for `wait` before invoking the callback
|
|
36
|
+
timeout.current = setTimeout(() => {
|
|
37
|
+
timeout.current = void 0;
|
|
38
|
+
storedCallback.current.apply(null, args as any);
|
|
39
|
+
}, wait);
|
|
40
|
+
}, deps);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const useDebounce = <State extends any>(
|
|
44
|
+
initialState: State | (() => State),
|
|
45
|
+
wait?: number,
|
|
46
|
+
leading?: boolean
|
|
47
|
+
): [State, React.Dispatch<React.SetStateAction<State>>] => {
|
|
48
|
+
const state = React.useState(initialState);
|
|
49
|
+
return [state[0], useDebounceCallback(state[1], wait, leading)];
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// copied from https://github.com/jaredLunde/react-hook/blob/master/packages/latest/src/index.tsx
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
const useLatest = <T extends any>(current: T) => {
|
|
5
|
+
const storedValue = React.useRef(current)
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
storedValue.current = current
|
|
8
|
+
})
|
|
9
|
+
return storedValue
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default useLatest
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import evaluateBrowserVersion from '@digigov/ui/utils/evaluateBrowserVersion';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// Includes Chrome for mobile devices
|
|
2
|
+
|
|
3
|
+
const DEFAULT_BROWSER_SUPPORT = {
|
|
4
|
+
Chrome: 57, // Includes Chrome for mobile devices
|
|
5
5
|
Edge: 39,
|
|
6
6
|
Safari: 10,
|
|
7
7
|
'Mobile Safari': 10,
|
|
8
8
|
Firefox: 50,
|
|
9
9
|
Opera: 50,
|
|
10
|
-
IE: false
|
|
10
|
+
IE: false,
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
const browserUpdateLinks = {
|
|
13
14
|
Chrome: 'https://www.google.com/chrome/',
|
|
14
15
|
Edge: 'https://www.microsoft.com/en-us/edge',
|
|
15
16
|
Safari: 'https://www.apple.com/safari/',
|
|
16
17
|
'Mobile Safari': 'https://www.apple.com/safari/',
|
|
17
18
|
Firefox: 'https://www.mozilla.org/en-US/firefox/new/',
|
|
18
|
-
Opera: 'https://www.opera.com/download'
|
|
19
|
+
Opera: 'https://www.opera.com/download',
|
|
19
20
|
};
|
|
20
|
-
var browserNames = Object.keys(DEFAULT_BROWSER_SUPPORT);
|
|
21
|
-
export function useOutdatedBrowserCheck() {
|
|
22
|
-
var browserSupport = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BROWSER_SUPPORT;
|
|
23
|
-
var currentBrowser = evaluateBrowserVersion();
|
|
24
21
|
|
|
22
|
+
const browserNames = Object.keys(DEFAULT_BROWSER_SUPPORT);
|
|
23
|
+
|
|
24
|
+
export function useOutdatedBrowserCheck(
|
|
25
|
+
browserSupport: Record<string, number | boolean> = DEFAULT_BROWSER_SUPPORT
|
|
26
|
+
): [boolean, string] {
|
|
27
|
+
const currentBrowser = evaluateBrowserVersion();
|
|
25
28
|
if (!currentBrowser.version || !currentBrowser.name) {
|
|
26
29
|
return [true, browserUpdateLinks.Chrome];
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var currentBrowserName = currentBrowser.name;
|
|
31
|
-
|
|
31
|
+
const currentBrowserVersion = parseInt(currentBrowser.version);
|
|
32
|
+
const currentBrowserName = currentBrowser.name;
|
|
32
33
|
if (browserNames.indexOf(currentBrowser.name) > -1) {
|
|
33
34
|
if (browserSupport[currentBrowserName] === false) {
|
|
34
35
|
return [true, browserUpdateLinks.Chrome];
|
|
@@ -43,4 +44,4 @@ export function useOutdatedBrowserCheck() {
|
|
|
43
44
|
return [true, browserUpdateLinks.Chrome];
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
export default useOutdatedBrowserCheck;
|
|
47
|
+
export default useOutdatedBrowserCheck;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
export function normalizeGreek(text) {
|
|
4
|
+
text = text
|
|
5
|
+
.replace(/Ά|Α|ά/g, 'α')
|
|
6
|
+
.replace(/Έ|Ε|έ/g, 'ε')
|
|
7
|
+
.replace(/Ή|Η|ή/g, 'η')
|
|
8
|
+
.replace(/Ί|Ϊ|Ι|ί|ΐ|ϊ/g, 'ι')
|
|
9
|
+
.replace(/Ό|Ο|ό/g, 'ο')
|
|
10
|
+
.replace(/Ύ|Ϋ|Υ|ύ|ΰ|ϋ/g, 'υ')
|
|
11
|
+
.replace(/Ώ|Ω|ώ/g, 'ω')
|
|
12
|
+
.replace(/Σ|ς/g, 'σ');
|
|
13
|
+
return text;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function fullTextSearch(data: Object, search: string): boolean {
|
|
17
|
+
if (!search) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const q = normalizeGreek(
|
|
21
|
+
search
|
|
22
|
+
.normalize('NFC')
|
|
23
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
);
|
|
26
|
+
const index = Object.keys(data)
|
|
27
|
+
.map(k => {
|
|
28
|
+
return data[k] ? data[k].toString().toLowerCase() : '';
|
|
29
|
+
})
|
|
30
|
+
.join('');
|
|
31
|
+
|
|
32
|
+
return normalizeGreek(
|
|
33
|
+
index.normalize('NFC').replace(/[\u0300-\u036f]/g, '')
|
|
34
|
+
).includes(q);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useSearch(
|
|
38
|
+
data: Array<Object>,
|
|
39
|
+
query?: string
|
|
40
|
+
) {
|
|
41
|
+
if(!query) return data
|
|
42
|
+
return useMemo(() => {
|
|
43
|
+
return data.filter(t => fullTextSearch(t, query));
|
|
44
|
+
}, [data, query]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default useSearch
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface UseTogglableSectionsInterface {
|
|
5
|
+
toggleProperty: string;
|
|
6
|
+
singleOpen?: boolean;
|
|
7
|
+
onToggleProperty: string;
|
|
8
|
+
initial?: Record<string, boolean>;
|
|
9
|
+
firstOpen?: boolean;
|
|
10
|
+
ariaNavigation?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface UseTogglableSectionsReturn {
|
|
13
|
+
register: (el: HTMLElement) => void;
|
|
14
|
+
registered: { current: Record<string, HTMLElement> };
|
|
15
|
+
opened: Record<string, boolean>;
|
|
16
|
+
toggle: (id: string) => void;
|
|
17
|
+
setOpened: (
|
|
18
|
+
opened:
|
|
19
|
+
| ((curOpened: Record<string, boolean>) => Record<string, boolean>)
|
|
20
|
+
| Record<string, boolean>
|
|
21
|
+
) => void;
|
|
22
|
+
}
|
|
23
|
+
export function useTogglableSections({
|
|
24
|
+
toggleProperty,
|
|
25
|
+
singleOpen,
|
|
26
|
+
onToggleProperty,
|
|
27
|
+
initial,
|
|
28
|
+
firstOpen,
|
|
29
|
+
ariaNavigation,
|
|
30
|
+
}: UseTogglableSectionsInterface): UseTogglableSectionsReturn {
|
|
31
|
+
const [opened, setOpened] = useState(initial || {});
|
|
32
|
+
const registered = useRef<Record<string, HTMLElement>>({});
|
|
33
|
+
const sectionsOrder = useRef<string[]>([]);
|
|
34
|
+
const registerRef = useCallback((el) => {
|
|
35
|
+
if (!el) return;
|
|
36
|
+
const key = el.getAttribute('aria-controls') as string;
|
|
37
|
+
if (registered.current[key]) return;
|
|
38
|
+
registered.current[key] = el;
|
|
39
|
+
sectionsOrder.current.push(key);
|
|
40
|
+
if (firstOpen && sectionsOrder.current.length === 1) {
|
|
41
|
+
setOpened({
|
|
42
|
+
[key]: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
const toggle = useCallback((e) => {
|
|
47
|
+
const key = e.currentTarget.getAttribute('aria-controls') as string;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
if (singleOpen) {
|
|
50
|
+
setOpened({ [key]: true });
|
|
51
|
+
} else {
|
|
52
|
+
setOpened((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
55
|
+
const onKeyDown = useCallback((e) => {
|
|
56
|
+
const key = e.target.getAttribute('aria-controls');
|
|
57
|
+
const currentIndex = sectionsOrder.current.findIndex((k) => k === key);
|
|
58
|
+
const nextKey = sectionsOrder.current[currentIndex + 1];
|
|
59
|
+
const previousKey = sectionsOrder.current[currentIndex - 1];
|
|
60
|
+
switch (e.key) {
|
|
61
|
+
case 'ArrowRight':
|
|
62
|
+
case 'ArrowDown':
|
|
63
|
+
if (nextKey) {
|
|
64
|
+
registered.current[nextKey].focus();
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case 'ArrowLeft':
|
|
68
|
+
case 'ArrowUp':
|
|
69
|
+
if (previousKey) {
|
|
70
|
+
registered.current[previousKey].focus();
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case ' ':
|
|
74
|
+
case 'Enter':
|
|
75
|
+
toggle(e);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
const register = useCallback(
|
|
80
|
+
(key) => {
|
|
81
|
+
const isOpen = !!opened[key];
|
|
82
|
+
return {
|
|
83
|
+
ref: registerRef,
|
|
84
|
+
[toggleProperty]: isOpen,
|
|
85
|
+
[onToggleProperty]: toggle,
|
|
86
|
+
'aria-controls': `${key}`,
|
|
87
|
+
...(ariaNavigation && { onKeyDown, tabIndex: opened[key] ? 0 : -1 }),
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
[opened]
|
|
91
|
+
);
|
|
92
|
+
return useMemo(
|
|
93
|
+
() => ({
|
|
94
|
+
register,
|
|
95
|
+
registered,
|
|
96
|
+
opened,
|
|
97
|
+
toggle,
|
|
98
|
+
setOpened,
|
|
99
|
+
}),
|
|
100
|
+
[opened]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import CoreContainer, {
|
|
2
|
+
ContainerProps as CoreContainerProps,
|
|
3
|
+
} from '@digigov/react-core/Container';
|
|
4
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
5
|
+
|
|
6
|
+
export type ContainerProps = CoreContainerProps;
|
|
7
|
+
|
|
8
|
+
export const Content = withDeprecation(CoreContainer, {
|
|
9
|
+
name: 'Content',
|
|
10
|
+
rename: 'Container',
|
|
11
|
+
props: {
|
|
12
|
+
maxWidth: {
|
|
13
|
+
error: true,
|
|
14
|
+
},
|
|
15
|
+
flex: {
|
|
16
|
+
error: true,
|
|
17
|
+
},
|
|
18
|
+
dense: {
|
|
19
|
+
error: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default Content;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Aside from '@digigov/react-core/Aside';
|
|
2
2
|
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export const Side = withDeprecation(Aside, {
|
|
4
5
|
name: 'Side',
|
|
5
|
-
rename: 'Aside'
|
|
6
|
+
rename: 'Aside',
|
|
6
7
|
});
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export default Side;
|
|
File without changes
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import CoreTop from '@digigov/react-core/Top';
|
|
2
2
|
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export const Top = withDeprecation(CoreTop, {
|
|
4
5
|
name: 'Top',
|
|
5
6
|
props: {
|
|
6
7
|
dense: {
|
|
7
|
-
error: true
|
|
8
|
-
}
|
|
9
|
-
}
|
|
8
|
+
error: true,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
10
11
|
});
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
export default Top;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import BasicLayout, {
|
|
5
|
+
Top,
|
|
6
|
+
Side,
|
|
7
|
+
Main,
|
|
8
|
+
Content,
|
|
9
|
+
Bottom,
|
|
10
|
+
} from '@digigov/ui/layouts/Basic';
|
|
11
|
+
|
|
12
|
+
it('renders the BasicLayout with Top, Content, Bottom, Main and Side children ', () => {
|
|
13
|
+
const jsx = (
|
|
14
|
+
<BasicLayout>
|
|
15
|
+
<Top>Header content</Top>
|
|
16
|
+
<Content>
|
|
17
|
+
<Main>Main content</Main>
|
|
18
|
+
<Side>Side content</Side>
|
|
19
|
+
</Content>
|
|
20
|
+
<Bottom>Bottom content</Bottom>
|
|
21
|
+
</BasicLayout>
|
|
22
|
+
);
|
|
23
|
+
expect(mount(jsx)).toMatchSnapshot();
|
|
24
|
+
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import Layout from '@digigov/react-core/Layout';
|
|
2
|
+
|
|
2
3
|
export * from '@digigov/ui/layouts/Basic/Top';
|
|
3
4
|
export * from '@digigov/ui/layouts/Basic/Side';
|
|
4
5
|
export * from '@digigov/ui/layouts/Basic/Main';
|
|
5
6
|
export * from '@digigov/ui/layouts/Basic/Content';
|
|
6
7
|
export * from '@digigov/ui/layouts/Basic/Bottom';
|
|
7
8
|
export * from '@digigov/ui/layouts/Basic/Masthead';
|
|
9
|
+
|
|
8
10
|
export default Layout;
|
|
File without changes
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
label: {
|
|
4
4
|
day: 'Ημέρα',
|
|
5
5
|
month: 'Μήνας',
|
|
6
|
-
year: 'Έτος'
|
|
6
|
+
year: 'Έτος',
|
|
7
7
|
},
|
|
8
8
|
error: {
|
|
9
9
|
required: 'Το πεδίο είναι υποχρεωτικό.',
|
|
@@ -18,21 +18,21 @@ export default {
|
|
|
18
18
|
date: {
|
|
19
19
|
invalid: 'Η ημερομηνία πρέπει να είναι έγκυρη.',
|
|
20
20
|
earlier_than: 'Συμπληρώστε μια ημερομηνία προγενέστερη της {{maxDate}}',
|
|
21
|
-
later_than: 'Συμπληρώστε μια ημερομηνία μεταγενέστερη της {{minDate}}'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
21
|
+
later_than: 'Συμπληρώστε μια ημερομηνία μεταγενέστερη της {{minDate}}',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
25
|
button: {
|
|
26
26
|
start: 'Ξεκινήστε εδώ',
|
|
27
27
|
login: 'Σύνδεση',
|
|
28
28
|
back: 'Πίσω',
|
|
29
|
-
|
|
29
|
+
continue: 'Συνέχεια',
|
|
30
30
|
search_ref: 'Αναζητήστε',
|
|
31
31
|
scan: 'Σαρώστε QR Code',
|
|
32
32
|
save: 'Αποθήκευση',
|
|
33
33
|
logout: 'Εξοδος',
|
|
34
34
|
submit: 'Υποβολή',
|
|
35
|
-
|
|
35
|
+
delete: 'Διαγραφή',
|
|
36
36
|
},
|
|
37
37
|
footer: {
|
|
38
38
|
created_by: 'Υλοποίηση από το',
|
|
@@ -40,16 +40,21 @@ export default {
|
|
|
40
40
|
mindigital: 'Υπουργείο Ψηφιακής Διακυβέρνησης',
|
|
41
41
|
using: 'με χρήση',
|
|
42
42
|
open_source: 'Ανοιχτού Λογισμικού',
|
|
43
|
-
creative_commons: 'Άδεια χρήσης περιεχομένου'
|
|
43
|
+
creative_commons: 'Άδεια χρήσης περιεχομένου',
|
|
44
44
|
},
|
|
45
45
|
notfound: {
|
|
46
46
|
page_not_found: 'Η σελίδα δεν βρέθηκε',
|
|
47
|
-
wrong_key_address:
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
wrong_key_address:
|
|
48
|
+
'Εάν έχετε πληκτρολογήσει τη διεύθυνση της σελίδας, ελέγξτε ότι είναι σωστή.',
|
|
49
|
+
wrong_cp_address:
|
|
50
|
+
'Εάν έχετε επικολλήσει τη διεύθυνση της σελίδας, ελέγξτε ότι έχετε αντιγράψει ολόκληρη τη διεύθυνση.',
|
|
51
|
+
service_contact:
|
|
52
|
+
'Εάν η διεύθυνση της σελίδας είναι σωστή ή έχετε επιλέξει κάποιον σύνδεσμο ή κουμπί, επικοινωνήστε με τη γραμμή εξυπηρέτησης σε περίπτωση που χρειαστείτε βοήθεια.',
|
|
50
53
|
},
|
|
51
54
|
outdated: {
|
|
52
|
-
mobile:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
mobile:
|
|
56
|
+
'Η ιστοσελίδα ενδέχεται να μην λειτουργεί σωστά καθώς ο browser σας είτε δεν υποστηρίζεται είτε είναι μη επικαιροποιημένος. Παρακαλούμε επικαιροποιήστε τον browser σας.',
|
|
57
|
+
web:
|
|
58
|
+
'Η ιστοσελίδα ενδέχεται να μην λειτουργεί σωστά καθώς ο browser σας είναι μη επικαιροποιημένος. Για να επικαιροποιήσετε τον browser σας επισκεφθείτε την ιστοσελίδα: ',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
label: {
|
|
4
4
|
day: 'Day',
|
|
5
5
|
month: 'Month',
|
|
6
|
-
year: 'Year'
|
|
6
|
+
year: 'Year',
|
|
7
7
|
},
|
|
8
8
|
error: {
|
|
9
9
|
required: 'This field is required.',
|
|
@@ -18,21 +18,21 @@ export default {
|
|
|
18
18
|
date: {
|
|
19
19
|
invalid: 'Date must be a real date.',
|
|
20
20
|
earlier_than: 'The date must be earlier than {{maxDate}}.',
|
|
21
|
-
later_than: 'The date must be later than {{minDate}}'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
21
|
+
later_than: 'The date must be later than {{minDate}}',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
25
|
button: {
|
|
26
26
|
start: 'Start',
|
|
27
27
|
login: 'Login',
|
|
28
28
|
back: 'Back',
|
|
29
|
-
|
|
29
|
+
continue: 'Continue',
|
|
30
30
|
search_ref: 'Search',
|
|
31
31
|
scan: 'Scan QR Code',
|
|
32
32
|
save: 'Save',
|
|
33
33
|
logout: 'Logout',
|
|
34
34
|
submit: 'Sumbit',
|
|
35
|
-
|
|
35
|
+
delete: 'Delete',
|
|
36
36
|
},
|
|
37
37
|
footer: {
|
|
38
38
|
created_by: 'Created by',
|
|
@@ -40,16 +40,20 @@ export default {
|
|
|
40
40
|
mindigital: 'Ministry of Digital Governance',
|
|
41
41
|
using: 'using',
|
|
42
42
|
open_source: 'Open Source Software',
|
|
43
|
-
creative_commons: 'Creative Commons'
|
|
43
|
+
creative_commons: 'Creative Commons',
|
|
44
44
|
},
|
|
45
45
|
notfound: {
|
|
46
46
|
page_not_found: 'Page not found',
|
|
47
47
|
wrong_key_address: 'If you typed the web address, check it is correct.',
|
|
48
|
-
wrong_cp_address:
|
|
49
|
-
|
|
48
|
+
wrong_cp_address:
|
|
49
|
+
'If you pasted the web address, check you copied the entire address..',
|
|
50
|
+
service_contact:
|
|
51
|
+
'If the web address is correct or you selected a link or button, contact the Service Helpline if you need to speak to someone about your tax credits.',
|
|
50
52
|
},
|
|
51
53
|
outdated: {
|
|
52
|
-
mobile:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
mobile:
|
|
55
|
+
'This site may not work properly because your browser is either not supported or outdated. Please update your browser',
|
|
56
|
+
web:
|
|
57
|
+
'This site may not work properly because your browser outdated. To update your browser visit: ',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export type RouterInterface = {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
router?: any;
|
|
6
|
+
};
|
|
7
|
+
export const RouterContext = createContext<RouterInterface>({});
|
|
8
|
+
|
|
9
|
+
export const useRouter = (): RouterInterface => {
|
|
10
|
+
return useContext(RouterContext);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const RouterProvider: React.FC<RouterInterface> = ({
|
|
14
|
+
router,
|
|
15
|
+
children,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<RouterContext.Provider
|
|
19
|
+
value={{
|
|
20
|
+
router,
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</RouterContext.Provider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default RouterContext;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import { ThemeProvider, createMuiTheme } from '@material-ui/core/styles';
|
|
4
|
+
|
|
5
|
+
const mockTheme = createMuiTheme({
|
|
6
|
+
header: {
|
|
7
|
+
height: '',
|
|
8
|
+
logo: {
|
|
9
|
+
component: '',
|
|
10
|
+
height: '',
|
|
11
|
+
},
|
|
12
|
+
border: {
|
|
13
|
+
width: '',
|
|
14
|
+
height: '',
|
|
15
|
+
background: '',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
link: '',
|
|
20
|
+
contrastText: '',
|
|
21
|
+
main: '',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const mountWithTheme = (tree: React.ReactNode): any => {
|
|
26
|
+
return mount(
|
|
27
|
+
<>
|
|
28
|
+
<ThemeProvider theme={mockTheme}>{tree}</ThemeProvider>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default mountWithTheme;
|