@digigov/ui 0.11.0 → 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 +22 -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 +31 -8
- 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} +3 -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/src/locales/el.ts +60 -0
- package/{esm/locales/en.js → src/locales/en.ts} +25 -11
- 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/{es → 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 -121
- 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 -199
- 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 -36
- 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 -14
- 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/el.js +0 -45
- package/es/locales/en.js +0 -45
- 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/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 -36
- 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 -14
- 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 -45
- 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/govgr.js +0 -79
- 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 -46
- package/locales/el.js +0 -52
- package/locales/en.d.ts +0 -46
- package/locales/en.js +0 -52
- 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,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PageTitle from '@digigov/react-core/PageTitle';
|
|
3
|
+
import PageTitleHeading from '@digigov/react-core/PageTitleHeading';
|
|
4
|
+
import Paragraph from '@digigov/react-core/Paragraph';
|
|
5
|
+
import { useTranslation } from '@digigov/ui/app';
|
|
6
|
+
|
|
7
|
+
export const NotFound: React.FC = () => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<PageTitle>
|
|
12
|
+
<PageTitleHeading>{t('notfound.page_not_found')}</PageTitleHeading>
|
|
13
|
+
</PageTitle>
|
|
14
|
+
<Paragraph>{t('notfound.wrong_key_address')}</Paragraph>
|
|
15
|
+
<Paragraph>{t('notfound.wrong_cp_address')}</Paragraph>
|
|
16
|
+
<Paragraph>{t('notfound.service_contact')}</Paragraph>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default NotFound;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WarningText } from '@digigov/ui/core/WarningText';
|
|
3
|
+
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
4
|
+
import useOutdatedBrowserCheck from '@digigov/ui/hooks/useOutdatedBrowserCheck';
|
|
5
|
+
import Link from '@digigov/ui/core/Link';
|
|
6
|
+
import { isMobile } from '@digigov/ui/utils/evaluateBrowserVersion';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/app/';
|
|
8
|
+
|
|
9
|
+
export default function OutdatedBrowserBanner(): JSX.Element {
|
|
10
|
+
const mob = isMobile;
|
|
11
|
+
const [shouldUpdate, updateLink] = useOutdatedBrowserCheck();
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
return (
|
|
14
|
+
<WarningText>
|
|
15
|
+
{shouldUpdate ? (
|
|
16
|
+
<>
|
|
17
|
+
{mob.any() ? (
|
|
18
|
+
<>
|
|
19
|
+
<Paragraph>{t('outdated.mobile')}</Paragraph>
|
|
20
|
+
</>
|
|
21
|
+
) : (
|
|
22
|
+
<>
|
|
23
|
+
<Paragraph>
|
|
24
|
+
{t('outdated.web')}
|
|
25
|
+
<Link href={updateLink} target="_blank">
|
|
26
|
+
{updateLink}{' '}
|
|
27
|
+
</Link>
|
|
28
|
+
</Paragraph>
|
|
29
|
+
</>
|
|
30
|
+
)}
|
|
31
|
+
</>
|
|
32
|
+
) : (
|
|
33
|
+
<></>
|
|
34
|
+
)}
|
|
35
|
+
</WarningText>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Caption, { CaptionProps } from '@digigov/ui/typography/Caption';
|
|
3
|
+
import Title, { TitleProps } from '@digigov/ui/typography/Title';
|
|
4
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
5
|
+
|
|
6
|
+
export const PageTitle: React.FC<{}> = withDeprecation(
|
|
7
|
+
({ children }) => {
|
|
8
|
+
return <>{children}</>;
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'PageTitle',
|
|
12
|
+
warning:
|
|
13
|
+
'There is no need to use PageTitle components anymore. It will be removed in a later version',
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default PageTitle;
|
|
18
|
+
|
|
19
|
+
export const PageTitleSection: React.FC<{}> = withDeprecation(
|
|
20
|
+
({ children }) => {
|
|
21
|
+
return <>{children}</>;
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'PageTitleSection',
|
|
25
|
+
warning:
|
|
26
|
+
'There is no need to use PageTitleSection components anymore. It will be removed in a later version',
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const PageTitleCaption: React.FC<CaptionProps> = withDeprecation(
|
|
31
|
+
Caption,
|
|
32
|
+
{
|
|
33
|
+
name: 'PageTitleCaption',
|
|
34
|
+
rename: 'Caption',
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export interface PageTitleHeadingProps extends TitleProps { }
|
|
39
|
+
|
|
40
|
+
export const PageTitleHeading: React.FC<TitleProps> = withDeprecation(
|
|
41
|
+
({ component, children, ...props }) => {
|
|
42
|
+
return (
|
|
43
|
+
<Title size="xl" element={component} {...props}>
|
|
44
|
+
{children}
|
|
45
|
+
</Title>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'PageTitleHeading',
|
|
50
|
+
props: {
|
|
51
|
+
dense: {
|
|
52
|
+
error: true,
|
|
53
|
+
},
|
|
54
|
+
size: {
|
|
55
|
+
values: {
|
|
56
|
+
xs: {
|
|
57
|
+
error: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
component: {
|
|
62
|
+
values: {
|
|
63
|
+
h5: {
|
|
64
|
+
error: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import QrCodeScanner from '@digigov/ui/app/QrCodeScanner';
|
|
5
|
+
|
|
6
|
+
it('renders the qr code scanner', () => {
|
|
7
|
+
expect(
|
|
8
|
+
mount(
|
|
9
|
+
<QrCodeScanner
|
|
10
|
+
onScan={(args) => {
|
|
11
|
+
console.log(args);
|
|
12
|
+
}}
|
|
13
|
+
onError={(args) => {
|
|
14
|
+
console.log(args);
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
).toMatchSnapshot();
|
|
19
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const QrReader = React.lazy(() => import('react-qr-reader'));
|
|
4
|
+
|
|
5
|
+
export interface QrCodeScannerProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
dataType?: 'url' | 'text';
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
legacyMode?: boolean;
|
|
10
|
+
validate?: (...args) => boolean;
|
|
11
|
+
onScan: (...args) => void;
|
|
12
|
+
onError: (err: any) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* QRCodeScanner assumes that the data provided inside the QR code image,
|
|
17
|
+
* are a HTTP link, thus it uses the `encodeURI` function to escape
|
|
18
|
+
* all scanned data that will be forwarded to the `onScan` function
|
|
19
|
+
*
|
|
20
|
+
* When a QR code is scanned, before we run the `onScan` callback function,
|
|
21
|
+
* we do the following:
|
|
22
|
+
*
|
|
23
|
+
* 1. Run a validator function provided in the props of QrCodeScanner component
|
|
24
|
+
* that receives the *raw* scanned data and returns a boolean type. (eg. check
|
|
25
|
+
* if it's a gov.gr subdomain, or that it matches the current domain)
|
|
26
|
+
* 2. If the validator returns `true`, then construct a URL object from the data provided
|
|
27
|
+
* and check if the protocol is `https` and the `origin` is the same as the origin of this page
|
|
28
|
+
* 2. Automatically fallback to the `onError` callback function, if the validation or url check fail
|
|
29
|
+
* 3. Finally, run `onScan` callback function with the scanned data encoded as a URI.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export const QrCodeScanner: React.FC<QrCodeScannerProps> = ({
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
validate,
|
|
37
|
+
onScan,
|
|
38
|
+
onError,
|
|
39
|
+
dataType = 'url',
|
|
40
|
+
legacyMode = false,
|
|
41
|
+
}) => {
|
|
42
|
+
if (dataType === 'text') {
|
|
43
|
+
console.warn(
|
|
44
|
+
`Security Warning! The \`text\` dataType could be used to inject XSS code to your application database or user DOM.
|
|
45
|
+
|
|
46
|
+
In order to be safe, you can:
|
|
47
|
+
1. Use a sanitizer function inside the \`onScan\` callback function that makes sure the data is not posing a threat to your app
|
|
48
|
+
2. Contact @digigov-ui for any further details and feature requests.
|
|
49
|
+
3. Read more about xss https://owasp.org/www-community/attacks/xss/
|
|
50
|
+
`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const handleOnScan = (data) => {
|
|
54
|
+
if (data) {
|
|
55
|
+
if (dataType === 'url') {
|
|
56
|
+
if (
|
|
57
|
+
!data.match(
|
|
58
|
+
/^https?:\/\/([a-z0-9-]*\.?)*(:?)(([a-z0-9-]*)\/)*([a-z0-9-]*)$/gi
|
|
59
|
+
)
|
|
60
|
+
) {
|
|
61
|
+
return onError(
|
|
62
|
+
new Error(
|
|
63
|
+
'@digigov-ui XSS Validation failed: qr code payload should follow the pattern `https://example.com/data/:id`'
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// run a validator function provided by the application code
|
|
69
|
+
if (validate && !validate(data)) {
|
|
70
|
+
return onError(new Error('Custom QR Code payload validation failed'));
|
|
71
|
+
}
|
|
72
|
+
// proceed with application defined callback function
|
|
73
|
+
onScan(data);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<QrReader
|
|
79
|
+
className={className}
|
|
80
|
+
delay={100}
|
|
81
|
+
onError={onError}
|
|
82
|
+
onScan={handleOnScan}
|
|
83
|
+
legacyMode={legacyMode}
|
|
84
|
+
/>
|
|
85
|
+
{children}
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default QrCodeScanner;
|
package/src/app/i18n.tsx
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import el from '@digigov/ui/locales/el';
|
|
3
|
+
export interface I18NContextProps {
|
|
4
|
+
t: (str: string) => string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
i18n?: any;
|
|
7
|
+
}
|
|
8
|
+
const defaultTranslate = (key) => {
|
|
9
|
+
try {
|
|
10
|
+
if (key.split('.').length > 0) {
|
|
11
|
+
return key.split('.').reduce((locale, path) => {
|
|
12
|
+
return locale[path] ? locale[path] : key;
|
|
13
|
+
}, el);
|
|
14
|
+
} else if (el[key]) {
|
|
15
|
+
return el[key];
|
|
16
|
+
} else {
|
|
17
|
+
return key;
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error(`Translation key \`${key}\` not found`);
|
|
21
|
+
return key;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const I18NContext = React.createContext<I18NContextProps>({
|
|
25
|
+
t: defaultTranslate,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const I18NProvider: React.FC<I18NContextProps> = ({
|
|
29
|
+
t = defaultTranslate,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: I18NContextProps) => {
|
|
33
|
+
return (
|
|
34
|
+
<I18NContext.Provider value={{ t, ...props }}>
|
|
35
|
+
{children}
|
|
36
|
+
</I18NContext.Provider>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const useTranslation = (): I18NContextProps => {
|
|
41
|
+
return React.useContext(I18NContext);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default I18NProvider;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Accordion,
|
|
6
|
+
AccordionItem,
|
|
7
|
+
AccordionItemDetails,
|
|
8
|
+
AccordionItemSummary,
|
|
9
|
+
} from '@digigov/ui/core/Accordion';
|
|
10
|
+
|
|
11
|
+
it('renders the Accordion', () => {
|
|
12
|
+
expect(
|
|
13
|
+
mount(
|
|
14
|
+
<Accordion>
|
|
15
|
+
<AccordionItem>
|
|
16
|
+
<AccordionItemSummary>Βασικες Ρυθμισεις</AccordionItemSummary>
|
|
17
|
+
<AccordionItemDetails>
|
|
18
|
+
Περιεχομενο Βασικων Ρυθμισεων
|
|
19
|
+
</AccordionItemDetails>
|
|
20
|
+
</AccordionItem>
|
|
21
|
+
<AccordionItem>
|
|
22
|
+
<AccordionItemSummary>Υπολοιπες Ρυθμισεις</AccordionItemSummary>
|
|
23
|
+
<AccordionItemDetails>
|
|
24
|
+
Περιεχομενο Υπολοιπων Ρυθμισεων
|
|
25
|
+
</AccordionItemDetails>
|
|
26
|
+
</AccordionItem>
|
|
27
|
+
</Accordion>
|
|
28
|
+
)
|
|
29
|
+
).toMatchSnapshot();
|
|
30
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
import Accordion from '@digigov/react-core/Accordion';
|
|
3
|
+
import AccordionSection from '@digigov/react-core/AccordionSection';
|
|
4
|
+
import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
|
|
5
|
+
import AccordionSectionHeader from '@digigov/react-core/AccordionSectionHeader';
|
|
6
|
+
import AccordionControls from '@digigov/react-core/AccordionControls';
|
|
7
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
8
|
+
import {
|
|
9
|
+
useTogglableSections,
|
|
10
|
+
UseTogglableSectionsReturn,
|
|
11
|
+
} from '@digigov/ui/hooks/useTogglableSections';
|
|
12
|
+
import React, { useCallback, useMemo } from 'react';
|
|
13
|
+
|
|
14
|
+
export const AccordionItemDetails = withDeprecation(AccordionSectionContent, {
|
|
15
|
+
name: 'AccordionItemDetails',
|
|
16
|
+
rename: 'AccordionSectionContent',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const AccordionItemSummary = withDeprecation(AccordionSectionHeader, {
|
|
20
|
+
name: 'AccordionItemSummary',
|
|
21
|
+
rename: 'AccordionSectionHeader',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const AccordionItem = withDeprecation(
|
|
25
|
+
React.memo(AccordionSection, (prev, next) => prev.open === next.open),
|
|
26
|
+
{
|
|
27
|
+
name: 'AccordionItem',
|
|
28
|
+
rename: 'AccordionSection',
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
export interface UseAccordionProps {
|
|
32
|
+
singleOpen?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface UseAccordionReturn extends UseTogglableSectionsReturn {
|
|
35
|
+
isOpenAll: boolean;
|
|
36
|
+
openAll: () => void;
|
|
37
|
+
closeAll: () => void;
|
|
38
|
+
}
|
|
39
|
+
const useAccordion = (props: UseAccordionProps): UseAccordionReturn => {
|
|
40
|
+
const {
|
|
41
|
+
register,
|
|
42
|
+
setOpened,
|
|
43
|
+
opened,
|
|
44
|
+
registered,
|
|
45
|
+
...rest
|
|
46
|
+
} = useTogglableSections({
|
|
47
|
+
toggleProperty: 'open',
|
|
48
|
+
onToggleProperty: 'onClick',
|
|
49
|
+
singleOpen: props && !!props.singleOpen,
|
|
50
|
+
});
|
|
51
|
+
const keys = useMemo(() => Object.keys(registered.current), [
|
|
52
|
+
registered.current.length,
|
|
53
|
+
]);
|
|
54
|
+
const openAll = useCallback(() => {
|
|
55
|
+
setOpened(
|
|
56
|
+
keys.reduce(
|
|
57
|
+
(newOpened, key) => ({
|
|
58
|
+
...newOpened,
|
|
59
|
+
[key]: true,
|
|
60
|
+
}),
|
|
61
|
+
{}
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}, [keys]);
|
|
65
|
+
const closeAll = useCallback(() => setOpened({}), []);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
register,
|
|
69
|
+
openAll,
|
|
70
|
+
closeAll,
|
|
71
|
+
isOpenAll: keys.length ? keys.every((v) => opened[v]) : false,
|
|
72
|
+
setOpened,
|
|
73
|
+
opened,
|
|
74
|
+
registered,
|
|
75
|
+
...rest,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
Accordion,
|
|
80
|
+
AccordionControls,
|
|
81
|
+
AccordionSection,
|
|
82
|
+
AccordionSectionContent,
|
|
83
|
+
AccordionSectionHeader,
|
|
84
|
+
useAccordion,
|
|
85
|
+
};
|
|
86
|
+
export default Accordion;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import Component from '@digigov/ui/core/Blockquote';
|
|
5
|
+
|
|
6
|
+
it('renders the Blockquote with sample data', () => {
|
|
7
|
+
expect(
|
|
8
|
+
mount(<Component>this is some random data</Component>)
|
|
9
|
+
).toMatchSnapshot();
|
|
10
|
+
});
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import CoreBlockquote from '@digigov/react-core/Blockquote';
|
|
2
2
|
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export const Blockquote = withDeprecation(CoreBlockquote, {
|
|
4
5
|
name: 'Blockquote',
|
|
5
6
|
props: {
|
|
6
7
|
variant: {
|
|
7
8
|
values: {
|
|
8
9
|
info: {
|
|
9
|
-
warning: true
|
|
10
|
-
}
|
|
10
|
+
warning: true,
|
|
11
|
+
},
|
|
11
12
|
},
|
|
12
|
-
error: true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
13
|
+
error: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
export default Blockquote;
|
|
File without changes
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import BackLink from '@digigov/react-core/BackLink';
|
|
2
2
|
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export const BackButton = withDeprecation(BackLink, {
|
|
4
5
|
name: 'BackButton',
|
|
5
6
|
rename: 'BackLink',
|
|
6
7
|
props: {
|
|
7
8
|
variant: {
|
|
8
|
-
error: true
|
|
9
|
+
error: true,
|
|
9
10
|
},
|
|
10
11
|
size: {
|
|
11
|
-
error: true
|
|
12
|
+
error: true,
|
|
12
13
|
},
|
|
13
14
|
xsFullWidth: {
|
|
14
|
-
error: true
|
|
15
|
+
error: true,
|
|
15
16
|
},
|
|
16
17
|
startIcon: {
|
|
17
|
-
error: true
|
|
18
|
-
}
|
|
19
|
-
}
|
|
18
|
+
error: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
export default BackButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import CoreButtonLink, {
|
|
2
|
+
ButtonLinkProps as CoreButtonLinkProps,
|
|
3
|
+
} from '@digigov/react-core/ButtonLink';
|
|
4
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
5
|
+
|
|
6
|
+
export type ButtonLinkProps = CoreButtonLinkProps;
|
|
7
|
+
export const ButtonLink = withDeprecation(CoreButtonLink, {
|
|
8
|
+
name: 'ButtonLink',
|
|
9
|
+
props: {
|
|
10
|
+
variant: {
|
|
11
|
+
error: true,
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
error: true,
|
|
15
|
+
},
|
|
16
|
+
xsFullWidth: {
|
|
17
|
+
error: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CoreCallToAction, {
|
|
3
|
+
CallToActionProps as CoreCallToActionProps,
|
|
4
|
+
} from '@digigov/react-core/CallToAction';
|
|
5
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
6
|
+
|
|
7
|
+
export interface CallToActionProps extends CoreCallToActionProps {
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const CallToAction: React.FC<CallToActionProps> = withDeprecation(
|
|
12
|
+
({ label = 'Start here', children, ...props }) => {
|
|
13
|
+
return <CoreCallToAction {...props}>{children || label}</CoreCallToAction>;
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'CallToAction',
|
|
17
|
+
props: {
|
|
18
|
+
variant: {
|
|
19
|
+
error: true,
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
error: true,
|
|
23
|
+
},
|
|
24
|
+
xsFullWidth: {
|
|
25
|
+
error: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default CallToAction;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CoreButton, {
|
|
3
|
+
ButtonProps as CoreButtonProps,
|
|
4
|
+
} from '@digigov/react-core/Button';
|
|
5
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
6
|
+
|
|
7
|
+
export type ButtonProps = CoreButtonProps;
|
|
8
|
+
|
|
9
|
+
export const Button = withDeprecation(CoreButton, {
|
|
10
|
+
name: 'Button',
|
|
11
|
+
props: {
|
|
12
|
+
href: {
|
|
13
|
+
error: 'To use a button with a link import ButtonLink instead',
|
|
14
|
+
},
|
|
15
|
+
/* variant: {
|
|
16
|
+
error: true,
|
|
17
|
+
}, */
|
|
18
|
+
size: {
|
|
19
|
+
error: true,
|
|
20
|
+
},
|
|
21
|
+
xsFullWidth: {
|
|
22
|
+
error: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default Button;
|
|
28
|
+
|
|
29
|
+
export interface ContinueButtonProps extends ButtonProps {
|
|
30
|
+
label?: string;
|
|
31
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const ContinueButton: React.FC<ContinueButtonProps> = ({
|
|
35
|
+
label = 'Continue',
|
|
36
|
+
children,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
return <Button {...props}>{label || children}</Button>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export * from '@digigov/ui/core/Button/BackButton';
|
|
43
|
+
export * from '@digigov/ui/core/Button/CallToAction';
|
|
44
|
+
export * from '@digigov/ui/core/Button/ButtonLink';
|
|
45
|
+
export * from '@digigov/ui/core/Button/Icon';
|
|
46
|
+
export * from '@digigov/react-core/ButtonGroup';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Details,
|
|
6
|
+
DetailsContent,
|
|
7
|
+
DetailsSummary,
|
|
8
|
+
} from '@digigov/ui/core/Details';
|
|
9
|
+
|
|
10
|
+
it('renders the closed Details component', () => {
|
|
11
|
+
expect(
|
|
12
|
+
mount(
|
|
13
|
+
<Details>
|
|
14
|
+
<DetailsSummary>Help with nationality</DetailsSummary>
|
|
15
|
+
<DetailsContent>
|
|
16
|
+
We need to know your nationality so we can work out which elections
|
|
17
|
+
you’re entitled to vote in. If you cannot provide your nationality,
|
|
18
|
+
you’ll have to send copies of identity documents through the post.
|
|
19
|
+
</DetailsContent>
|
|
20
|
+
</Details>
|
|
21
|
+
)
|
|
22
|
+
).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('renders the open Details component', () => {
|
|
26
|
+
expect(
|
|
27
|
+
mount(
|
|
28
|
+
<Details open>
|
|
29
|
+
<DetailsSummary>Help with nationality</DetailsSummary>
|
|
30
|
+
<DetailsContent>
|
|
31
|
+
We need to know your nationality so we can work out which elections
|
|
32
|
+
you’re entitled to vote in. If you cannot provide your nationality,
|
|
33
|
+
you’ll have to send copies of identity documents through the post.
|
|
34
|
+
</DetailsContent>
|
|
35
|
+
</Details>
|
|
36
|
+
)
|
|
37
|
+
).toMatchSnapshot();
|
|
38
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Details from '@digigov/react-core/Details';
|
|
2
2
|
import DetailsContent from '@digigov/react-core/DetailsContent';
|
|
3
3
|
import DetailsSummary from '@digigov/react-core/DetailsSummary';
|
|
4
|
+
|
|
4
5
|
export { Details, DetailsContent, DetailsSummary };
|
|
6
|
+
|
|
5
7
|
export default Details;
|