@digigov/ui 0.12.2 → 0.13.0
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/CHANGELOG.md +8 -1
- package/{src/core/ServiceBadge/ServiceBadge.mdx → LICENSE} +0 -0
- package/api/APIErrors.d.ts +22 -0
- package/api/APIErrors.js +117 -0
- package/api/APIProvider.d.ts +15 -0
- package/api/APIProvider.js +43 -0
- package/api/fetchAPI.d.ts +18 -0
- package/api/fetchAPI.js +64 -0
- package/api/index.d.ts +9 -0
- package/api/index.js +104 -0
- package/api/index.spec.d.ts +1 -0
- package/api/index.spec.js +584 -0
- package/{src/api → api}/introduction.md +0 -0
- package/api/useResource.d.ts +11 -0
- package/api/useResource.js +144 -0
- package/api/useResourceAction.d.ts +2 -0
- package/api/useResourceAction.js +157 -0
- package/api/useResourceQuery.d.ts +18 -0
- package/api/useResourceQuery.js +229 -0
- package/api/utils.d.ts +6 -0
- package/api/utils.js +250 -0
- package/app/App.d.ts +14 -0
- package/app/App.js +49 -0
- package/{src/app/Confirmation/index.tsx → app/Confirmation/index.d.ts} +0 -0
- package/app/Confirmation/index.js +44 -0
- package/{src/app/Footer/index.tsx → app/Footer/index.d.ts} +0 -0
- package/app/Footer/index.js +200 -0
- package/app/Header/HeaderLogo.d.ts +3 -0
- package/app/Header/HeaderLogo.js +30 -0
- package/app/Header/HeaderSection.d.ts +5 -0
- package/app/Header/HeaderSection.js +20 -0
- package/app/Header/HeaderTitle.d.ts +5 -0
- package/app/Header/HeaderTitle.js +30 -0
- package/{src/app → app}/Header/__snapshots__/index.spec.tsx.snap +0 -0
- package/app/Header/index.d.ts +11 -0
- package/app/Header/index.js +106 -0
- package/{src/app → app}/Header/index.mdx +0 -0
- package/app/Header/index.spec.d.ts +1 -0
- package/app/Header/index.spec.js +45 -0
- package/app/NotFound/index.d.ts +3 -0
- package/app/NotFound/index.js +29 -0
- package/app/OutdatedBrowserBanner.d.ts +2 -0
- package/app/OutdatedBrowserBanner.js +41 -0
- package/app/PageTitle.d.ts +10 -0
- package/app/PageTitle.js +76 -0
- package/{src/app → app}/QrCodeScanner/__snapshots__/index.spec.tsx.snap +0 -0
- package/app/QrCodeScanner/index.d.ts +29 -0
- package/app/QrCodeScanner/index.js +85 -0
- package/{src/app → app}/QrCodeScanner/index.mdx +0 -0
- package/app/QrCodeScanner/index.spec.d.ts +1 -0
- package/app/QrCodeScanner/index.spec.js +26 -0
- package/app/i18n.d.ts +10 -0
- package/app/i18n.js +63 -0
- package/{src/app/index.ts → app/index.d.ts} +0 -0
- package/app/index.js +70 -0
- package/{src/core → core}/Accordion/__snapshots__/index.spec.tsx.snap +0 -0
- package/core/Accordion/index.d.ts +21 -0
- package/core/Accordion/index.js +127 -0
- package/{src/core → core}/Accordion/index.mdx +0 -0
- package/core/Accordion/index.spec.d.ts +1 -0
- package/core/Accordion/index.spec.js +19 -0
- package/{src/core → core}/Blockquote/__snapshots__/index.spec.tsx.snap +0 -0
- package/core/Blockquote/index.d.ts +3 -0
- package/core/Blockquote/index.js +29 -0
- package/{src/core → core}/Blockquote/index.mdx +0 -0
- package/core/Blockquote/index.spec.d.ts +1 -0
- package/core/Blockquote/index.spec.js +21 -0
- package/{src/core/Breadcrumbs/index.tsx → core/Breadcrumbs/index.d.ts} +0 -0
- package/core/Breadcrumbs/index.js +44 -0
- package/core/Button/BackButton.d.ts +3 -0
- package/core/Button/BackButton.js +34 -0
- package/core/Button/ButtonLink.d.ts +4 -0
- package/core/Button/ButtonLink.js +28 -0
- package/core/Button/CallToAction.d.ts +7 -0
- package/core/Button/CallToAction.js +41 -0
- package/core/Button/Icon.d.ts +2 -0
- package/core/Button/Icon.js +19 -0
- package/{src/core → core}/Button/__snapshots__/index.spec.tsx.snap +0 -0
- package/core/Button/index.d.ts +15 -0
- package/core/Button/index.js +122 -0
- package/{src/core → core}/Button/index.mdx +0 -0
- package/core/Button/index.spec.d.ts +1 -0
- package/core/Button/index.spec.js +21 -0
- package/{src/core/Card/index.tsx → core/Card/index.d.ts} +0 -0
- package/core/Card/index.js +57 -0
- package/{src/core → core}/Details/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/Details/index.tsx → core/Details/index.d.ts} +0 -2
- package/core/Details/index.js +35 -0
- package/{src/core → core}/Details/index.mdx +0 -0
- package/core/Details/index.spec.d.ts +1 -0
- package/core/Details/index.spec.js +27 -0
- package/core/Divider/index.d.ts +5 -0
- package/core/Divider/index.js +20 -0
- package/{src/core → core}/ErrorSummary/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/ErrorSummary/index.tsx → core/ErrorSummary/index.d.ts} +0 -1
- package/core/ErrorSummary/index.js +19 -0
- package/{src/core → core}/ErrorSummary/index.mdx +0 -0
- package/core/ErrorSummary/index.spec.d.ts +1 -0
- package/core/ErrorSummary/index.spec.js +21 -0
- package/{src/core/Hidden/index.tsx → core/Hidden/index.d.ts} +0 -0
- package/core/Hidden/index.js +18 -0
- package/{src/core → core}/Link/__snapshots__/index.spec.tsx.snap +0 -0
- package/core/Link/index.d.ts +12 -0
- package/core/Link/index.js +50 -0
- package/core/Link/index.spec.d.ts +1 -0
- package/core/Link/index.spec.js +31 -0
- package/{src/core/List/List.tsx → core/List/List.d.ts} +0 -2
- package/core/List/List.js +19 -0
- package/{src/core/List/ListItem.tsx → core/List/ListItem.d.ts} +0 -2
- package/core/List/ListItem.js +19 -0
- package/core/List/ListItemContent.d.ts +7 -0
- package/core/List/ListItemContent.js +45 -0
- package/core/List/ListItemIcon.d.ts +7 -0
- package/core/List/ListItemIcon.js +48 -0
- package/core/List/ListItemText.d.ts +8 -0
- package/core/List/ListItemText.js +36 -0
- package/core/List/ListItemTitle.d.ts +10 -0
- package/core/List/ListItemTitle.js +44 -0
- package/{src/core → core}/List/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/List/index.tsx → core/List/index.d.ts} +0 -0
- package/core/List/index.js +96 -0
- package/{src/core → core}/List/index.mdx +0 -0
- package/core/List/index.spec.d.ts +1 -0
- package/core/List/index.spec.js +21 -0
- package/core/NavList/NavList.d.ts +17 -0
- package/core/NavList/NavList.js +99 -0
- package/core/NavList/NavListContext.d.ts +20 -0
- package/core/NavList/NavListContext.js +102 -0
- package/core/NavList/NavListItem.d.ts +13 -0
- package/core/NavList/NavListItem.js +171 -0
- package/core/NavList/NavListItemBase.d.ts +16 -0
- package/core/NavList/NavListItemBase.js +161 -0
- package/core/NavList/NavListSubMenu.d.ts +8 -0
- package/core/NavList/NavListSubMenu.js +52 -0
- package/{src/core → core}/NavList/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/NavList/index.tsx → core/NavList/index.d.ts} +0 -0
- package/core/NavList/index.js +68 -0
- package/{src/core → core}/NavList/index.mdx +0 -0
- package/core/NavList/index.spec.d.ts +1 -0
- package/core/NavList/index.spec.js +21 -0
- package/{src/core → core}/NotificationBanner/__snapshots__/index.spec.tsx.snap +0 -0
- package/core/NotificationBanner/index.d.ts +18 -0
- package/core/NotificationBanner/index.js +78 -0
- package/{src/core → core}/NotificationBanner/index.mdx +0 -0
- package/core/NotificationBanner/index.spec.d.ts +1 -0
- package/core/NotificationBanner/index.spec.js +32 -0
- package/core/ServiceBadge/ServiceBadge.mdx +0 -0
- package/core/ServiceBadge/index.d.ts +9 -0
- package/core/ServiceBadge/index.js +36 -0
- package/{src/core → core}/ServiceBadge/index.mdx +0 -0
- package/{src/core → core}/SummaryList/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/SummaryList/index.tsx → core/SummaryList/index.d.ts} +0 -2
- package/core/SummaryList/index.js +79 -0
- package/{src/core → core}/SummaryList/index.mdx +0 -0
- package/core/SummaryList/index.spec.d.ts +1 -0
- package/core/SummaryList/index.spec.js +19 -0
- package/{src/core/Table/index.tsx → core/Table/index.d.ts} +0 -0
- package/core/Table/index.js +96 -0
- package/core/Tabs/index.d.ts +16 -0
- package/core/Tabs/index.js +88 -0
- package/{src/core → core}/Tabs/index.mdx +0 -0
- package/{src/core/VisuallyHidden/index.tsx → core/VisuallyHidden/index.d.ts} +0 -0
- package/core/VisuallyHidden/index.js +18 -0
- package/{src/core → core}/WarningText/__snapshots__/index.spec.tsx.snap +0 -0
- package/{src/core/WarningText/index.tsx → core/WarningText/index.d.ts} +0 -1
- package/core/WarningText/index.js +19 -0
- package/{src/core → core}/WarningText/index.mdx +0 -0
- package/core/WarningText/index.spec.d.ts +1 -0
- package/core/WarningText/index.spec.js +21 -0
- package/{src/core/index.ts → core/index.d.ts} +0 -0
- package/core/index.js +227 -0
- package/custom.d.js +1 -0
- package/es/api/APIErrors.js +96 -0
- package/es/api/APIProvider.js +25 -0
- package/es/api/fetchAPI.js +49 -0
- package/{src/api/index.tsx → es/api/index.js} +3 -6
- package/es/api/index.spec.js +546 -0
- package/es/api/introduction.md +6 -0
- package/es/api/useResource.js +128 -0
- package/es/api/useResourceAction.js +141 -0
- package/es/api/useResourceQuery.js +208 -0
- package/es/api/utils.js +233 -0
- package/es/app/App.js +27 -0
- package/es/app/Confirmation/index.js +3 -0
- package/es/app/Footer/index.js +15 -0
- package/{src/app/Header/HeaderLogo.tsx → es/app/Header/HeaderLogo.js} +7 -9
- package/es/app/Header/HeaderSection.js +7 -0
- package/es/app/Header/HeaderTitle.js +17 -0
- package/es/app/Header/__snapshots__/index.spec.tsx.snap +393 -0
- package/{src/app/Header/index.tsx → es/app/Header/index.js} +4 -10
- package/es/app/Header/index.mdx +50 -0
- package/es/app/Header/index.spec.js +32 -0
- package/es/app/NotFound/index.js +12 -0
- package/es/app/OutdatedBrowserBanner.js +24 -0
- package/es/app/PageTitle.js +57 -0
- package/es/app/QrCodeScanner/__snapshots__/index.spec.tsx.snap +22 -0
- package/es/app/QrCodeScanner/index.js +64 -0
- package/es/app/QrCodeScanner/index.mdx +22 -0
- package/es/app/QrCodeScanner/index.spec.js +13 -0
- package/es/app/i18n.js +42 -0
- package/es/app/index.js +5 -0
- package/es/core/Accordion/__snapshots__/index.spec.tsx.snap +78 -0
- package/es/core/Accordion/index.js +67 -0
- package/es/core/Accordion/index.mdx +104 -0
- package/es/core/Accordion/index.spec.js +9 -0
- package/es/core/Blockquote/__snapshots__/index.spec.tsx.snap +13 -0
- package/{src/core/Blockquote/index.tsx → es/core/Blockquote/index.js} +7 -9
- package/es/core/Blockquote/index.mdx +61 -0
- package/es/core/Blockquote/index.spec.js +9 -0
- package/es/core/Breadcrumbs/index.js +3 -0
- package/{src/core/Button/BackButton.tsx → es/core/Button/BackButton.js} +8 -10
- package/es/core/Button/ButtonLink.js +16 -0
- package/es/core/Button/CallToAction.js +27 -0
- package/es/core/Button/Icon.js +7 -0
- package/es/core/Button/__snapshots__/index.spec.tsx.snap +13 -0
- package/es/core/Button/index.js +37 -0
- package/es/core/Button/index.mdx +65 -0
- package/es/core/Button/index.spec.js +9 -0
- package/es/core/Card/index.js +4 -0
- package/es/core/Details/__snapshots__/index.spec.tsx.snap +50 -0
- package/es/core/Details/index.js +5 -0
- package/es/core/Details/index.mdx +34 -0
- package/es/core/Details/index.spec.js +17 -0
- package/es/core/Divider/index.js +7 -0
- package/es/core/ErrorSummary/__snapshots__/index.spec.tsx.snap +322 -0
- package/es/core/ErrorSummary/index.js +3 -0
- package/es/core/ErrorSummary/index.mdx +61 -0
- package/es/core/ErrorSummary/index.spec.js +9 -0
- package/es/core/Hidden/index.js +1 -0
- package/es/core/Link/__snapshots__/index.spec.tsx.snap +31 -0
- package/es/core/Link/index.js +26 -0
- package/es/core/Link/index.spec.js +21 -0
- package/es/core/List/List.js +3 -0
- package/es/core/List/ListItem.js +3 -0
- package/es/core/List/ListItemContent.js +27 -0
- package/es/core/List/ListItemIcon.js +29 -0
- package/es/core/List/ListItemText.js +19 -0
- package/es/core/List/ListItemTitle.js +25 -0
- package/es/core/List/__snapshots__/index.spec.tsx.snap +322 -0
- package/es/core/List/index.js +7 -0
- package/es/core/List/index.mdx +40 -0
- package/es/core/List/index.spec.js +9 -0
- package/es/core/NavList/NavList.js +78 -0
- package/es/core/NavList/NavListContext.js +80 -0
- package/es/core/NavList/NavListItem.js +141 -0
- package/es/core/NavList/NavListItemBase.js +133 -0
- package/es/core/NavList/NavListSubMenu.js +27 -0
- package/es/core/NavList/__snapshots__/index.spec.tsx.snap +334 -0
- package/es/core/NavList/index.js +5 -0
- package/es/core/NavList/index.mdx +185 -0
- package/es/core/NavList/index.spec.js +9 -0
- package/es/core/NotificationBanner/__snapshots__/index.spec.tsx.snap +737 -0
- package/es/core/NotificationBanner/index.js +35 -0
- package/es/core/NotificationBanner/index.mdx +77 -0
- package/es/core/NotificationBanner/index.spec.js +20 -0
- package/es/core/ServiceBadge/ServiceBadge.mdx +0 -0
- package/es/core/ServiceBadge/index.js +20 -0
- package/es/core/ServiceBadge/index.mdx +42 -0
- package/es/core/SummaryList/__snapshots__/index.spec.tsx.snap +57 -0
- package/es/core/SummaryList/index.js +7 -0
- package/es/core/SummaryList/index.mdx +82 -0
- package/es/core/SummaryList/index.spec.js +9 -0
- package/es/core/Table/index.js +7 -0
- package/es/core/Tabs/index.js +37 -0
- package/es/core/Tabs/index.mdx +54 -0
- package/es/core/VisuallyHidden/index.js +1 -0
- package/es/core/WarningText/__snapshots__/index.spec.tsx.snap +336 -0
- package/es/core/WarningText/index.js +3 -0
- package/es/core/WarningText/index.mdx +46 -0
- package/es/core/WarningText/index.spec.js +9 -0
- package/es/core/index.js +17 -0
- package/es/custom.d.js +0 -0
- package/{src → es}/form/inputs/Input/index.mdx +0 -0
- package/es/govgr/Footer/Copyright.js +37 -0
- package/es/govgr/Footer/HellenicRepublicLogo.js +3 -0
- package/es/govgr/Footer/LicenseCCSA.js +18 -0
- package/es/govgr/Footer/index.js +21 -0
- package/{src → es}/govgr/Footer/index.mdx +0 -0
- package/{src/govgr/Footer/logo.ts → es/govgr/Footer/logo.js} +1 -1
- package/{src/govgr/Footer/logos/logo-el.ts → es/govgr/Footer/logos/logo-el.js} +1 -1
- package/{src/govgr/Footer/logos/logo-en.ts → es/govgr/Footer/logos/logo-en.js} +1 -1
- package/{src → es}/govgr/Logo/govgr-logo.svg +0 -0
- package/es/govgr/Logo/index.js +3 -0
- package/{src/govgr/Logo/logo.ts → es/govgr/Logo/logo.js} +1 -1
- package/es/govgr/index.js +4 -0
- package/es/hooks/useDebounce.js +41 -0
- package/es/hooks/useLatest.js +12 -0
- package/{src/hooks/useOutdatedBrowserCheck.ts → es/hooks/useOutdatedBrowserCheck.js} +15 -16
- package/es/hooks/useSearch.js +25 -0
- package/es/hooks/useTogglableSections.js +96 -0
- package/es/index.js +5 -0
- package/es/layouts/Basic/Bottom/index.js +3 -0
- package/{src → es}/layouts/Basic/Bottom/index.mdx +0 -0
- package/es/layouts/Basic/Content/index.js +18 -0
- package/{src → es}/layouts/Basic/Content/index.mdx +0 -0
- package/es/layouts/Basic/Main/index.js +3 -0
- package/{src → es}/layouts/Basic/Main/index.mdx +0 -0
- package/es/layouts/Basic/Masthead/index.js +4 -0
- package/{src → es}/layouts/Basic/Masthead/index.mdx +0 -0
- package/{src/layouts/Basic/Side/index.tsx → es/layouts/Basic/Side/index.js} +3 -5
- package/{src → es}/layouts/Basic/Side/index.mdx +0 -0
- package/{src/layouts/Basic/Top/index.tsx → es/layouts/Basic/Top/index.js} +5 -7
- package/{src → es}/layouts/Basic/Top/index.mdx +0 -0
- package/{src → es}/layouts/Basic/__snapshots__/index.spec.tsx.snap +0 -0
- package/es/layouts/Basic/index.js +8 -0
- package/{src → es}/layouts/Basic/index.mdx +0 -0
- package/es/layouts/Basic/index.spec.js +10 -0
- package/es/layouts/Grid/index.js +1 -0
- package/es/layouts/index.js +2 -0
- package/{src/locales/el.ts → es/locales/el.js} +14 -19
- package/{src/locales/en.ts → es/locales/en.js} +13 -17
- package/es/router/index.js +15 -0
- package/{src → es}/router/index.mdx +0 -0
- package/es/test-utils/delay.js +31 -0
- package/es/test-utils/mountWithTheme.js +30 -0
- package/{src → es}/themes/govgr.js +29 -33
- package/es/themes/grnet.js +110 -0
- package/es/themes/index.js +2 -0
- package/es/typography/Caption.js +7 -0
- package/es/typography/NormalText.js +3 -0
- package/es/typography/Paragraph.js +2 -0
- package/es/typography/Title.js +48 -0
- package/es/typography/index.js +8 -0
- package/{src → es}/typography/index.mdx +0 -0
- package/es/utils/evaluateBrowserVersion.js +201 -0
- package/es/utils/withDeprecation.js +103 -0
- package/esm/api/APIErrors.js +96 -0
- package/esm/api/APIProvider.js +25 -0
- package/esm/api/fetchAPI.js +49 -0
- package/esm/api/index.js +13 -0
- package/esm/api/index.spec.js +546 -0
- package/esm/api/introduction.md +6 -0
- package/esm/api/useResource.js +128 -0
- package/esm/api/useResourceAction.js +141 -0
- package/esm/api/useResourceQuery.js +208 -0
- package/esm/api/utils.js +233 -0
- package/esm/app/App.js +27 -0
- package/esm/app/Confirmation/index.js +3 -0
- package/esm/app/Footer/index.js +15 -0
- package/esm/app/Header/HeaderLogo.js +17 -0
- package/esm/app/Header/HeaderSection.js +7 -0
- package/esm/app/Header/HeaderTitle.js +17 -0
- package/esm/app/Header/__snapshots__/index.spec.tsx.snap +393 -0
- package/esm/app/Header/index.js +13 -0
- package/esm/app/Header/index.mdx +50 -0
- package/esm/app/Header/index.spec.js +32 -0
- package/esm/app/NotFound/index.js +12 -0
- package/esm/app/OutdatedBrowserBanner.js +24 -0
- package/esm/app/PageTitle.js +57 -0
- package/esm/app/QrCodeScanner/__snapshots__/index.spec.tsx.snap +22 -0
- package/esm/app/QrCodeScanner/index.js +64 -0
- package/esm/app/QrCodeScanner/index.mdx +22 -0
- package/esm/app/QrCodeScanner/index.spec.js +13 -0
- package/esm/app/i18n.js +42 -0
- package/esm/app/index.js +5 -0
- package/esm/core/Accordion/__snapshots__/index.spec.tsx.snap +78 -0
- package/esm/core/Accordion/index.js +67 -0
- package/esm/core/Accordion/index.mdx +104 -0
- package/esm/core/Accordion/index.spec.js +9 -0
- package/esm/core/Blockquote/__snapshots__/index.spec.tsx.snap +13 -0
- package/esm/core/Blockquote/index.js +16 -0
- package/esm/core/Blockquote/index.mdx +61 -0
- package/esm/core/Blockquote/index.spec.js +9 -0
- package/esm/core/Breadcrumbs/index.js +3 -0
- package/esm/core/Button/BackButton.js +21 -0
- package/esm/core/Button/ButtonLink.js +16 -0
- package/esm/core/Button/CallToAction.js +27 -0
- package/esm/core/Button/Icon.js +7 -0
- package/esm/core/Button/__snapshots__/index.spec.tsx.snap +13 -0
- package/esm/core/Button/index.js +37 -0
- package/esm/core/Button/index.mdx +65 -0
- package/esm/core/Button/index.spec.js +9 -0
- package/esm/core/Card/index.js +4 -0
- package/esm/core/Details/__snapshots__/index.spec.tsx.snap +50 -0
- package/esm/core/Details/index.js +5 -0
- package/esm/core/Details/index.mdx +34 -0
- package/esm/core/Details/index.spec.js +17 -0
- package/esm/core/Divider/index.js +7 -0
- package/esm/core/ErrorSummary/__snapshots__/index.spec.tsx.snap +322 -0
- package/esm/core/ErrorSummary/index.js +3 -0
- package/esm/core/ErrorSummary/index.mdx +61 -0
- package/esm/core/ErrorSummary/index.spec.js +9 -0
- package/esm/core/Hidden/index.js +1 -0
- package/esm/core/Link/__snapshots__/index.spec.tsx.snap +31 -0
- package/esm/core/Link/index.js +26 -0
- package/esm/core/Link/index.spec.js +21 -0
- package/esm/core/List/List.js +3 -0
- package/esm/core/List/ListItem.js +3 -0
- package/esm/core/List/ListItemContent.js +27 -0
- package/esm/core/List/ListItemIcon.js +29 -0
- package/esm/core/List/ListItemText.js +19 -0
- package/esm/core/List/ListItemTitle.js +25 -0
- package/esm/core/List/__snapshots__/index.spec.tsx.snap +322 -0
- package/esm/core/List/index.js +7 -0
- package/esm/core/List/index.mdx +40 -0
- package/esm/core/List/index.spec.js +9 -0
- package/esm/core/NavList/NavList.js +78 -0
- package/esm/core/NavList/NavListContext.js +80 -0
- package/esm/core/NavList/NavListItem.js +141 -0
- package/esm/core/NavList/NavListItemBase.js +133 -0
- package/esm/core/NavList/NavListSubMenu.js +27 -0
- package/esm/core/NavList/__snapshots__/index.spec.tsx.snap +334 -0
- package/esm/core/NavList/index.js +5 -0
- package/esm/core/NavList/index.mdx +185 -0
- package/esm/core/NavList/index.spec.js +9 -0
- package/esm/core/NotificationBanner/__snapshots__/index.spec.tsx.snap +737 -0
- package/esm/core/NotificationBanner/index.js +35 -0
- package/esm/core/NotificationBanner/index.mdx +77 -0
- package/esm/core/NotificationBanner/index.spec.js +20 -0
- package/esm/core/ServiceBadge/ServiceBadge.mdx +0 -0
- package/esm/core/ServiceBadge/index.js +20 -0
- package/esm/core/ServiceBadge/index.mdx +42 -0
- package/esm/core/SummaryList/__snapshots__/index.spec.tsx.snap +57 -0
- package/esm/core/SummaryList/index.js +7 -0
- package/esm/core/SummaryList/index.mdx +82 -0
- package/esm/core/SummaryList/index.spec.js +9 -0
- package/esm/core/Table/index.js +7 -0
- package/esm/core/Tabs/index.js +37 -0
- package/esm/core/Tabs/index.mdx +54 -0
- package/esm/core/VisuallyHidden/index.js +1 -0
- package/esm/core/WarningText/__snapshots__/index.spec.tsx.snap +336 -0
- package/esm/core/WarningText/index.js +3 -0
- package/esm/core/WarningText/index.mdx +46 -0
- package/esm/core/WarningText/index.spec.js +9 -0
- package/esm/core/index.js +17 -0
- package/esm/custom.d.js +0 -0
- package/esm/form/inputs/Input/index.mdx +10 -0
- package/esm/govgr/Footer/Copyright.js +37 -0
- package/esm/govgr/Footer/HellenicRepublicLogo.js +3 -0
- package/esm/govgr/Footer/LicenseCCSA.js +18 -0
- package/esm/govgr/Footer/index.js +21 -0
- package/esm/govgr/Footer/index.mdx +97 -0
- package/esm/govgr/Footer/logo.js +1 -0
- package/esm/govgr/Footer/logos/logo-el.js +1 -0
- package/esm/govgr/Footer/logos/logo-en.js +1 -0
- package/esm/govgr/Logo/govgr-logo.svg +1 -0
- package/esm/govgr/Logo/index.js +3 -0
- package/esm/govgr/Logo/logo.js +1 -0
- package/esm/govgr/index.js +4 -0
- package/esm/hooks/useDebounce.js +41 -0
- package/esm/hooks/useLatest.js +12 -0
- package/esm/hooks/useOutdatedBrowserCheck.js +46 -0
- package/esm/hooks/useSearch.js +25 -0
- package/esm/hooks/useTogglableSections.js +96 -0
- package/esm/index.js +10 -0
- package/esm/layouts/Basic/Bottom/index.js +3 -0
- package/esm/layouts/Basic/Bottom/index.mdx +37 -0
- package/esm/layouts/Basic/Content/index.js +18 -0
- package/esm/layouts/Basic/Content/index.mdx +64 -0
- package/esm/layouts/Basic/Main/index.js +3 -0
- package/esm/layouts/Basic/Main/index.mdx +64 -0
- package/esm/layouts/Basic/Masthead/index.js +4 -0
- package/esm/layouts/Basic/Masthead/index.mdx +74 -0
- package/esm/layouts/Basic/Side/index.js +7 -0
- package/esm/layouts/Basic/Side/index.mdx +71 -0
- package/esm/layouts/Basic/Top/index.js +11 -0
- package/esm/layouts/Basic/Top/index.mdx +74 -0
- package/esm/layouts/Basic/__snapshots__/index.spec.tsx.snap +54 -0
- package/esm/layouts/Basic/index.js +8 -0
- package/esm/layouts/Basic/index.mdx +62 -0
- package/esm/layouts/Basic/index.spec.js +10 -0
- package/esm/layouts/Grid/index.js +1 -0
- package/esm/layouts/index.js +2 -0
- package/esm/locales/el.js +55 -0
- package/esm/locales/en.js +55 -0
- package/esm/router/index.js +15 -0
- package/esm/router/index.mdx +40 -0
- package/esm/test-utils/delay.js +31 -0
- package/esm/test-utils/mountWithTheme.js +30 -0
- package/esm/themes/govgr.js +79 -0
- package/esm/themes/grnet.js +110 -0
- package/esm/themes/index.js +2 -0
- package/esm/typography/Caption.js +7 -0
- package/esm/typography/NormalText.js +3 -0
- package/esm/typography/Paragraph.js +2 -0
- package/esm/typography/Title.js +48 -0
- package/esm/typography/index.js +8 -0
- package/esm/typography/index.mdx +32 -0
- package/esm/utils/evaluateBrowserVersion.js +201 -0
- package/esm/utils/withDeprecation.js +103 -0
- package/form/inputs/Input/index.mdx +10 -0
- package/govgr/Footer/Copyright.d.ts +8 -0
- package/govgr/Footer/Copyright.js +52 -0
- package/{src/govgr/Footer/HellenicRepublicLogo.tsx → govgr/Footer/HellenicRepublicLogo.d.ts} +0 -1
- package/govgr/Footer/HellenicRepublicLogo.js +19 -0
- package/govgr/Footer/LicenseCCSA.d.ts +3 -0
- package/govgr/Footer/LicenseCCSA.js +33 -0
- package/govgr/Footer/index.d.ts +13 -0
- package/govgr/Footer/index.js +39 -0
- package/govgr/Footer/index.mdx +97 -0
- package/govgr/Footer/logo.d.ts +2 -0
- package/govgr/Footer/logo.js +8 -0
- package/govgr/Footer/logos/logo-el.d.ts +2 -0
- package/govgr/Footer/logos/logo-el.js +8 -0
- package/govgr/Footer/logos/logo-en.d.ts +2 -0
- package/govgr/Footer/logos/logo-en.js +8 -0
- package/govgr/Logo/govgr-logo.svg +1 -0
- package/{src/govgr/Logo/index.tsx → govgr/Logo/index.d.ts} +0 -2
- package/govgr/Logo/index.js +19 -0
- package/govgr/Logo/logo.d.ts +2 -0
- package/govgr/Logo/logo.js +8 -0
- package/{src/govgr/index.ts → govgr/index.d.ts} +0 -0
- package/govgr/index.js +57 -0
- package/hooks/useDebounce.d.ts +3 -0
- package/hooks/useDebounce.js +63 -0
- package/hooks/useLatest.d.ts +3 -0
- package/hooks/useLatest.js +26 -0
- package/hooks/useOutdatedBrowserCheck.d.ts +2 -0
- package/hooks/useOutdatedBrowserCheck.js +60 -0
- package/hooks/useSearch.d.ts +4 -0
- package/hooks/useSearch.js +40 -0
- package/hooks/useTogglableSections.d.ts +18 -0
- package/hooks/useTogglableSections.js +108 -0
- package/{src/index.ts → index.d.ts} +0 -0
- package/index.js +70 -0
- package/{src/layouts/Basic/Bottom/index.tsx → layouts/Basic/Bottom/index.d.ts} +0 -1
- package/layouts/Basic/Bottom/index.js +19 -0
- package/layouts/Basic/Bottom/index.mdx +37 -0
- package/layouts/Basic/Content/index.d.ts +5 -0
- package/layouts/Basic/Content/index.js +31 -0
- package/layouts/Basic/Content/index.mdx +64 -0
- package/{src/layouts/Basic/Main/index.tsx → layouts/Basic/Main/index.d.ts} +0 -1
- package/layouts/Basic/Main/index.js +19 -0
- package/layouts/Basic/Main/index.mdx +64 -0
- package/{src/layouts/Basic/Masthead/index.tsx → layouts/Basic/Masthead/index.d.ts} +0 -2
- package/layouts/Basic/Masthead/index.js +27 -0
- package/layouts/Basic/Masthead/index.mdx +74 -0
- package/layouts/Basic/Side/index.d.ts +3 -0
- package/layouts/Basic/Side/index.js +20 -0
- package/layouts/Basic/Side/index.mdx +71 -0
- package/layouts/Basic/Top/index.d.ts +3 -0
- package/layouts/Basic/Top/index.js +24 -0
- package/layouts/Basic/Top/index.mdx +74 -0
- package/layouts/Basic/__snapshots__/index.spec.tsx.snap +54 -0
- package/{src/layouts/Basic/index.tsx → layouts/Basic/index.d.ts} +0 -2
- package/layouts/Basic/index.js +97 -0
- package/layouts/Basic/index.mdx +62 -0
- package/layouts/Basic/index.spec.d.ts +1 -0
- package/layouts/Basic/index.spec.js +20 -0
- package/{src/layouts/Grid/index.tsx → layouts/Grid/index.d.ts} +0 -0
- package/layouts/Grid/index.js +18 -0
- package/{src/layouts/index.ts → layouts/index.d.ts} +0 -0
- package/layouts/index.js +34 -0
- package/locales/el.d.ts +56 -0
- package/locales/el.js +62 -0
- package/locales/en.d.ts +56 -0
- package/locales/en.js +62 -0
- package/package.json +8 -31
- package/router/index.d.ts +9 -0
- package/router/index.js +37 -0
- package/router/index.mdx +40 -0
- package/test-utils/delay.d.ts +2 -0
- package/test-utils/delay.js +45 -0
- package/test-utils/mountWithTheme.d.ts +3 -0
- package/test-utils/mountWithTheme.js +43 -0
- package/themes/govgr.d.ts +3 -0
- package/themes/govgr.js +89 -0
- package/themes/grnet.d.ts +2 -0
- package/themes/grnet.js +128 -0
- package/themes/index.d.ts +32 -0
- package/themes/index.js +19 -0
- package/typography/Caption.d.ts +7 -0
- package/typography/Caption.js +20 -0
- package/typography/NormalText.d.ts +5 -0
- package/typography/NormalText.js +19 -0
- package/typography/Paragraph.d.ts +6 -0
- package/typography/Paragraph.js +13 -0
- package/typography/Title.d.ts +9 -0
- package/typography/Title.js +63 -0
- package/{src/typography/index.ts → typography/index.d.ts} +0 -0
- package/typography/index.js +97 -0
- package/typography/index.mdx +32 -0
- package/utils/evaluateBrowserVersion.d.ts +15 -0
- package/utils/evaluateBrowserVersion.js +216 -0
- package/utils/withDeprecation.d.ts +16 -0
- package/utils/withDeprecation.js +116 -0
- package/.eslintrc.js +0 -4
- package/.prettierrc.js +0 -3
- package/.rush/temp/package-deps_build.json +0 -176
- package/.rush/temp/shrinkwrap-deps.json +0 -278
- package/CHANGELOG.json +0 -796
- package/docs/components.mdx +0 -1
- package/docs/create-a-new-service.mdx +0 -93
- package/docs/create-common-page-layout.mdx +0 -205
- package/docs/create-static-page.mdx +0 -179
- package/docs/edit-start-page.mdx +0 -143
- package/docs/index.mdx +0 -66
- package/docs/introduction.mdx +0 -34
- package/src/api/APIErrors.tsx +0 -44
- package/src/api/APIProvider.tsx +0 -27
- package/src/api/fetchAPI.ts +0 -45
- package/src/api/index.spec.tsx +0 -419
- package/src/api/useResource.tsx +0 -96
- package/src/api/useResourceAction.tsx +0 -80
- package/src/api/useResourceQuery.tsx +0 -177
- package/src/api/utils.tsx +0 -156
- package/src/app/App.tsx +0 -33
- package/src/app/Header/HeaderSection.tsx +0 -13
- package/src/app/Header/HeaderTitle.tsx +0 -24
- package/src/app/Header/index.spec.tsx +0 -32
- package/src/app/NotFound/index.tsx +0 -21
- package/src/app/OutdatedBrowserBanner.tsx +0 -37
- package/src/app/PageTitle.tsx +0 -70
- package/src/app/QrCodeScanner/index.spec.tsx +0 -19
- package/src/app/QrCodeScanner/index.tsx +0 -90
- package/src/app/i18n.tsx +0 -44
- package/src/core/Accordion/index.spec.tsx +0 -30
- package/src/core/Accordion/index.tsx +0 -86
- package/src/core/Blockquote/index.spec.tsx +0 -10
- package/src/core/Button/ButtonLink.tsx +0 -20
- package/src/core/Button/CallToAction.tsx +0 -31
- package/src/core/Button/Icon.tsx +0 -9
- package/src/core/Button/index.spec.tsx +0 -8
- package/src/core/Button/index.tsx +0 -46
- package/src/core/Details/index.spec.tsx +0 -38
- package/src/core/Divider/index.tsx +0 -13
- package/src/core/ErrorSummary/index.spec.tsx +0 -10
- package/src/core/Link/index.spec.tsx +0 -22
- package/src/core/Link/index.tsx +0 -41
- package/src/core/List/ListItemContent.tsx +0 -32
- package/src/core/List/ListItemIcon.tsx +0 -31
- package/src/core/List/ListItemText.tsx +0 -23
- package/src/core/List/ListItemTitle.tsx +0 -37
- package/src/core/List/index.spec.tsx +0 -10
- package/src/core/NavList/NavList.tsx +0 -103
- package/src/core/NavList/NavListContext.tsx +0 -85
- package/src/core/NavList/NavListItem.tsx +0 -143
- package/src/core/NavList/NavListItemBase.tsx +0 -146
- package/src/core/NavList/NavListSubMenu.tsx +0 -33
- package/src/core/NavList/index.spec.tsx +0 -10
- package/src/core/NotificationBanner/index.spec.tsx +0 -27
- package/src/core/NotificationBanner/index.tsx +0 -52
- package/src/core/ServiceBadge/index.tsx +0 -35
- package/src/core/SummaryList/index.spec.tsx +0 -28
- package/src/core/Tabs/index.tsx +0 -36
- package/src/core/WarningText/index.spec.tsx +0 -10
- package/src/custom.d.ts +0 -8
- package/src/govgr/Footer/Copyright.tsx +0 -64
- package/src/govgr/Footer/LicenseCCSA.tsx +0 -24
- package/src/govgr/Footer/index.tsx +0 -49
- package/src/hooks/useDebounce.ts +0 -50
- package/src/hooks/useLatest.ts +0 -12
- package/src/hooks/useSearch.ts +0 -47
- package/src/hooks/useTogglableSections.tsx +0 -102
- package/src/layouts/Basic/Content/index.tsx +0 -24
- package/src/layouts/Basic/index.spec.tsx +0 -24
- package/src/router/index.tsx +0 -28
- package/src/test-utils/delay.ts +0 -9
- package/src/test-utils/mountWithTheme.tsx +0 -33
- package/src/themes/grnet.js +0 -109
- package/src/themes/index.tsx +0 -38
- package/src/typography/Caption.tsx +0 -15
- package/src/typography/NormalText.tsx +0 -7
- package/src/typography/Paragraph.tsx +0 -9
- package/src/typography/Title.tsx +0 -51
- package/src/utils/evaluateBrowserVersion.ts +0 -346
- package/src/utils/withDeprecation.tsx +0 -97
- package/tsconfig.json +0 -18
- package/tsconfig.production.json +0 -27
- package/ui.build.log +0 -17
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { RequestResponse } from '@digigov/ui/api/useResource';
|
|
3
|
-
import { getQueryKey, processResponse } from '@digigov/ui/api/utils';
|
|
4
|
-
import { useMutation } from 'react-query';
|
|
5
|
-
import { useAPI } from '@digigov/ui/api';
|
|
6
|
-
|
|
7
|
-
export function useResourceAction(
|
|
8
|
-
resource: string,
|
|
9
|
-
id?: (string | null | undefined) | number | ((...args: any) => void),
|
|
10
|
-
method = 'POST',
|
|
11
|
-
data?: Record<string, any> | null | ((...args: any) => void),
|
|
12
|
-
query?: Record<string, any> | null | ((...args: any) => void),
|
|
13
|
-
options?: RequestInit | null
|
|
14
|
-
): RequestResponse {
|
|
15
|
-
const {
|
|
16
|
-
config: { baseURL },
|
|
17
|
-
token,
|
|
18
|
-
} = useAPI();
|
|
19
|
-
const [{ url, dataSet }, setFetchOpts] = useState({
|
|
20
|
-
url: '',
|
|
21
|
-
dataSet: false,
|
|
22
|
-
});
|
|
23
|
-
const [consume, setConsume] = useState(false);
|
|
24
|
-
async function customFetcher(...args) {
|
|
25
|
-
const [fetchUrl, options] = args[0];
|
|
26
|
-
if (options.body) {
|
|
27
|
-
setFetchOpts({ url: fetchUrl, dataSet: true });
|
|
28
|
-
} else {
|
|
29
|
-
setFetchOpts({ url: fetchUrl, dataSet: false });
|
|
30
|
-
}
|
|
31
|
-
const response = await fetch(fetchUrl, options);
|
|
32
|
-
try {
|
|
33
|
-
const { data } = await processResponse(response, true);
|
|
34
|
-
if (data) {
|
|
35
|
-
return Promise.resolve(data);
|
|
36
|
-
}
|
|
37
|
-
} catch (error) {
|
|
38
|
-
return Promise.reject(error.error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const [mutate, { status, data: _data, error, reset }] = useMutation(
|
|
43
|
-
customFetcher,
|
|
44
|
-
{}
|
|
45
|
-
);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (consume) {
|
|
48
|
-
const queryKey = getQueryKey(
|
|
49
|
-
resource,
|
|
50
|
-
id,
|
|
51
|
-
query,
|
|
52
|
-
data,
|
|
53
|
-
options,
|
|
54
|
-
method,
|
|
55
|
-
baseURL,
|
|
56
|
-
token
|
|
57
|
-
);
|
|
58
|
-
if (typeof queryKey === 'function') {
|
|
59
|
-
mutate(queryKey());
|
|
60
|
-
} else {
|
|
61
|
-
mutate(queryKey);
|
|
62
|
-
}
|
|
63
|
-
setConsume(false);
|
|
64
|
-
}
|
|
65
|
-
}, [consume]);
|
|
66
|
-
return {
|
|
67
|
-
data: _data,
|
|
68
|
-
loading: status === 'loading',
|
|
69
|
-
loaded: ['success', 'error'].includes(status),
|
|
70
|
-
error,
|
|
71
|
-
invalidate: (): void => {
|
|
72
|
-
reset();
|
|
73
|
-
},
|
|
74
|
-
fetch() {
|
|
75
|
-
setConsume(true);
|
|
76
|
-
},
|
|
77
|
-
dataSet,
|
|
78
|
-
url,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState, useCallback } from 'react';
|
|
2
|
-
import { getQueryKey, processResponse } from '@digigov/ui/api/utils';
|
|
3
|
-
import { usePaginatedQuery, QueryFunction, queryCache } from 'react-query';
|
|
4
|
-
import { useAPI } from '@digigov/ui/api';
|
|
5
|
-
|
|
6
|
-
const DEFAULT_PAGINATION_LIMIT = 30;
|
|
7
|
-
const DEFAULT_LIMIT_OPTIONS = [10, 30, 60, 100];
|
|
8
|
-
|
|
9
|
-
export function useResourceManyBase(
|
|
10
|
-
resource: string,
|
|
11
|
-
query?: Record<string, any> | null | ((...args: any) => any),
|
|
12
|
-
options?: RequestInit | null
|
|
13
|
-
): any {
|
|
14
|
-
const {
|
|
15
|
-
config: { baseURL },
|
|
16
|
-
token,
|
|
17
|
-
} = useAPI();
|
|
18
|
-
const [{ url, dataSet }, setFetchOpts] = useState({
|
|
19
|
-
url: '',
|
|
20
|
-
dataSet: false,
|
|
21
|
-
});
|
|
22
|
-
const customFetcher: QueryFunction<any> = useCallback(
|
|
23
|
-
async (fetchUrl, options) => {
|
|
24
|
-
setFetchOpts({ url: fetchUrl, dataSet: false });
|
|
25
|
-
const response = await fetch(fetchUrl, options);
|
|
26
|
-
try {
|
|
27
|
-
const { data } = await processResponse(response, true);
|
|
28
|
-
if (data) {
|
|
29
|
-
return Promise.resolve(data);
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
return Promise.reject(error.error);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
[]
|
|
36
|
-
);
|
|
37
|
-
const queryKey = getQueryKey(
|
|
38
|
-
resource,
|
|
39
|
-
null,
|
|
40
|
-
query,
|
|
41
|
-
null,
|
|
42
|
-
options,
|
|
43
|
-
'GET',
|
|
44
|
-
baseURL,
|
|
45
|
-
token
|
|
46
|
-
);
|
|
47
|
-
let enabled = true;
|
|
48
|
-
let resolvedQueryKey;
|
|
49
|
-
if (typeof queryKey === 'function') {
|
|
50
|
-
try {
|
|
51
|
-
resolvedQueryKey = queryKey();
|
|
52
|
-
} catch (err) {
|
|
53
|
-
enabled = false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
resolvedData,
|
|
59
|
-
latestData: data,
|
|
60
|
-
error,
|
|
61
|
-
isFetching,
|
|
62
|
-
refetch,
|
|
63
|
-
} = usePaginatedQuery({
|
|
64
|
-
queryKey: resolvedQueryKey || queryKey,
|
|
65
|
-
queryFn: customFetcher,
|
|
66
|
-
config: {
|
|
67
|
-
enabled,
|
|
68
|
-
suspense: true,
|
|
69
|
-
cacheTime: 30000,
|
|
70
|
-
refetchOnMount: false,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
data: data || resolvedData,
|
|
76
|
-
loading: isFetching,
|
|
77
|
-
loaded: !!data || !!error,
|
|
78
|
-
error,
|
|
79
|
-
invalidate: (): void => {
|
|
80
|
-
queryCache.invalidateQueries(resolvedQueryKey || queryKey);
|
|
81
|
-
},
|
|
82
|
-
fetch: refetch,
|
|
83
|
-
dataSet,
|
|
84
|
-
url,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type UseResourceManyResponse = {
|
|
89
|
-
data?: any;
|
|
90
|
-
meta?: {
|
|
91
|
-
total?: number;
|
|
92
|
-
count?: number;
|
|
93
|
-
};
|
|
94
|
-
page: number;
|
|
95
|
-
limit: number;
|
|
96
|
-
totalPages: number;
|
|
97
|
-
total: number;
|
|
98
|
-
limitOptions: number[];
|
|
99
|
-
setPage: (page: number) => void;
|
|
100
|
-
setLimit: (limit: number) => void;
|
|
101
|
-
hasNext: boolean;
|
|
102
|
-
hasPrevious: boolean;
|
|
103
|
-
};
|
|
104
|
-
export function useResourceMany(
|
|
105
|
-
resource: string,
|
|
106
|
-
query?: Record<string, any> | null,
|
|
107
|
-
options?: RequestInit | null
|
|
108
|
-
): UseResourceManyResponse {
|
|
109
|
-
// allow developer to set a custom limit, fallback to a common value
|
|
110
|
-
const [limit, setLimit] = useState(
|
|
111
|
-
(query && query.limit) || DEFAULT_PAGINATION_LIMIT
|
|
112
|
-
);
|
|
113
|
-
const [pageParams, setPageParams] = useState({
|
|
114
|
-
offset: (query && query.offset) || 0,
|
|
115
|
-
limit,
|
|
116
|
-
});
|
|
117
|
-
// update options when limit is changed
|
|
118
|
-
useEffect(() => {
|
|
119
|
-
if (pageParams.limit !== limit) {
|
|
120
|
-
setPageParams({ ...pageParams, limit: limit });
|
|
121
|
-
}
|
|
122
|
-
}, [limit]);
|
|
123
|
-
// update user provided query with pagination params
|
|
124
|
-
const queryKey = JSON.stringify(query);
|
|
125
|
-
const pageParamsKey = JSON.stringify(pageParams);
|
|
126
|
-
const q = useMemo(() => {
|
|
127
|
-
return { ...pageParams, ...query };
|
|
128
|
-
}, [queryKey, pageParamsKey]);
|
|
129
|
-
const { data, ...rest } = useResourceManyBase(resource, q, options);
|
|
130
|
-
// extract data/metadata from response
|
|
131
|
-
const resp = data ? data.data : data;
|
|
132
|
-
const meta = data ? data.meta : data;
|
|
133
|
-
const totalPages = useMemo(
|
|
134
|
-
() => (data && data.meta && data.meta.total) || 1,
|
|
135
|
-
[data]
|
|
136
|
-
);
|
|
137
|
-
const total = useMemo(() => (data && data.meta && data.meta.count) || 0, [
|
|
138
|
-
data,
|
|
139
|
-
]);
|
|
140
|
-
const limitOptions = useMemo(() => DEFAULT_LIMIT_OPTIONS, []);
|
|
141
|
-
const page = useMemo(() => {
|
|
142
|
-
const offset = parseInt(pageParams.offset) || 0;
|
|
143
|
-
const _limit = parseInt(`${pageParams.limit}`) || parseInt(`${limit}`);
|
|
144
|
-
return offset / _limit;
|
|
145
|
-
}, [pageParams]);
|
|
146
|
-
// set params to specific page
|
|
147
|
-
const setPage = useCallback(
|
|
148
|
-
(page) => {
|
|
149
|
-
if (page > totalPages) {
|
|
150
|
-
page = totalPages;
|
|
151
|
-
}
|
|
152
|
-
if (page <= 0) {
|
|
153
|
-
page = 0;
|
|
154
|
-
}
|
|
155
|
-
const _limit = limit || DEFAULT_PAGINATION_LIMIT;
|
|
156
|
-
const offset = _limit * page;
|
|
157
|
-
setPageParams({ offset, limit });
|
|
158
|
-
},
|
|
159
|
-
[setPageParams]
|
|
160
|
-
);
|
|
161
|
-
const hasNext = page < totalPages - 1;
|
|
162
|
-
const hasPrevious = page > 0;
|
|
163
|
-
return {
|
|
164
|
-
data: resp,
|
|
165
|
-
meta,
|
|
166
|
-
page,
|
|
167
|
-
limit,
|
|
168
|
-
totalPages,
|
|
169
|
-
total,
|
|
170
|
-
limitOptions,
|
|
171
|
-
setPage,
|
|
172
|
-
setLimit,
|
|
173
|
-
hasNext,
|
|
174
|
-
hasPrevious,
|
|
175
|
-
...rest,
|
|
176
|
-
};
|
|
177
|
-
}
|
package/src/api/utils.tsx
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { APIError } from '@digigov/ui/api/APIErrors';
|
|
2
|
-
import { ProcessedResponse } from '@digigov/ui/api/fetchAPI';
|
|
3
|
-
import { ArrayQueryKey } from 'react-query/types';
|
|
4
|
-
|
|
5
|
-
export async function parseErrors(response: Response): Promise<string[]> {
|
|
6
|
-
const errors: string[] = [];
|
|
7
|
-
const error = {
|
|
8
|
-
message: response.statusText,
|
|
9
|
-
code: response.status,
|
|
10
|
-
meta: {},
|
|
11
|
-
};
|
|
12
|
-
// do our best to resolve as more specific details for the error
|
|
13
|
-
try {
|
|
14
|
-
const json: Record<string, string> = await response.json();
|
|
15
|
-
error.meta = json;
|
|
16
|
-
// this is the way synnefo reports errors
|
|
17
|
-
try {
|
|
18
|
-
const apiErrors = Object.keys(json);
|
|
19
|
-
apiErrors.forEach((key) => json[key] && errors.push(json[key]));
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.error('Cannot parse json error', json);
|
|
22
|
-
}
|
|
23
|
-
} catch (err) {
|
|
24
|
-
try {
|
|
25
|
-
const text = await response.text();
|
|
26
|
-
error.message = text;
|
|
27
|
-
// error.meta.statusText = response.statusText; // keep reference to statusText
|
|
28
|
-
} catch (err) {}
|
|
29
|
-
}
|
|
30
|
-
return errors;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function processResponse(
|
|
34
|
-
response,
|
|
35
|
-
raiseError = false
|
|
36
|
-
): Promise<ProcessedResponse> {
|
|
37
|
-
const status = response.status;
|
|
38
|
-
try {
|
|
39
|
-
if (!response.ok) {
|
|
40
|
-
const errors = await parseErrors(response);
|
|
41
|
-
if (raiseError) {
|
|
42
|
-
throw new APIError(errors, status);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
error: errors[0],
|
|
46
|
-
status,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const contentType = response.headers.get('content-type');
|
|
50
|
-
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51
|
-
const data = await response.json();
|
|
52
|
-
return {
|
|
53
|
-
data,
|
|
54
|
-
status,
|
|
55
|
-
};
|
|
56
|
-
} else {
|
|
57
|
-
const data = await response.text();
|
|
58
|
-
return {
|
|
59
|
-
data,
|
|
60
|
-
status,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
if (raiseError) {
|
|
65
|
-
throw new APIError([error], status);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
status,
|
|
69
|
-
error,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function getArgs(
|
|
75
|
-
resource: any,
|
|
76
|
-
id: any,
|
|
77
|
-
query: any,
|
|
78
|
-
data: any,
|
|
79
|
-
options,
|
|
80
|
-
method,
|
|
81
|
-
baseURL,
|
|
82
|
-
token
|
|
83
|
-
) {
|
|
84
|
-
let body, params;
|
|
85
|
-
if (typeof query === 'function') {
|
|
86
|
-
params = new URLSearchParams(query()).toString();
|
|
87
|
-
} else if (query) {
|
|
88
|
-
params = new URLSearchParams(query).toString();
|
|
89
|
-
}
|
|
90
|
-
if (typeof data === 'function') {
|
|
91
|
-
body = JSON.stringify(data());
|
|
92
|
-
} else if (data) {
|
|
93
|
-
body = JSON.stringify(data);
|
|
94
|
-
}
|
|
95
|
-
if (typeof id === 'function') {
|
|
96
|
-
id = id();
|
|
97
|
-
}
|
|
98
|
-
if (!options) {
|
|
99
|
-
options = {};
|
|
100
|
-
}
|
|
101
|
-
const url = `${baseURL}/${resource}${id ? `/${id}/` : ''}${
|
|
102
|
-
params ? `?${params}` : ''
|
|
103
|
-
}`;
|
|
104
|
-
const _options = {
|
|
105
|
-
headers: {
|
|
106
|
-
'content-type': 'application/json',
|
|
107
|
-
},
|
|
108
|
-
body,
|
|
109
|
-
method,
|
|
110
|
-
...options,
|
|
111
|
-
};
|
|
112
|
-
if (token) {
|
|
113
|
-
_options.headers.Authorization = `Token ${token}`;
|
|
114
|
-
}
|
|
115
|
-
return [url, _options];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function getQueryKey(
|
|
119
|
-
resource: string,
|
|
120
|
-
id: string | number | null | undefined | ((...args: any) => void),
|
|
121
|
-
query: Record<string, any> | null | undefined | ((...args: any) => void),
|
|
122
|
-
data: Record<string, any> | null | undefined | ((...args: any) => void),
|
|
123
|
-
options: RequestInit | null | undefined,
|
|
124
|
-
method: string | null | undefined,
|
|
125
|
-
baseURL: string,
|
|
126
|
-
token: string | null | undefined
|
|
127
|
-
): ArrayQueryKey | ((...args: any) => ArrayQueryKey) {
|
|
128
|
-
let queryKey;
|
|
129
|
-
|
|
130
|
-
if ([id, query, data].some((param) => typeof param === 'function')) {
|
|
131
|
-
queryKey = () => {
|
|
132
|
-
return getArgs(
|
|
133
|
-
resource,
|
|
134
|
-
id,
|
|
135
|
-
query,
|
|
136
|
-
data,
|
|
137
|
-
options,
|
|
138
|
-
method,
|
|
139
|
-
baseURL,
|
|
140
|
-
token
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
} else {
|
|
144
|
-
queryKey = getArgs(
|
|
145
|
-
resource,
|
|
146
|
-
id,
|
|
147
|
-
query,
|
|
148
|
-
data,
|
|
149
|
-
options,
|
|
150
|
-
method,
|
|
151
|
-
baseURL,
|
|
152
|
-
token
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
return queryKey;
|
|
156
|
-
}
|
package/src/app/App.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { Suspense } from 'react';
|
|
2
|
-
import CssBaseline from '@material-ui/core/CssBaseline';
|
|
3
|
-
import { BaseCSSProperties } from '@material-ui/core/styles/withStyles';
|
|
4
|
-
import { ThemeProvider, Theme, makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
|
|
6
|
-
export const useAppStyles = makeStyles({
|
|
7
|
-
root: {},
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export interface AppProps {
|
|
11
|
-
theme: Theme;
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
classes?: { root: BaseCSSProperties };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const App: React.FC<AppProps> = ({ theme, children }) => {
|
|
17
|
-
return (
|
|
18
|
-
<ThemeProvider theme={theme}>
|
|
19
|
-
<Suspense fallback={'loading...'}>{children}</Suspense>
|
|
20
|
-
</ThemeProvider>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const StaticApp: React.FC<AppProps> = ({ theme, children }) => {
|
|
25
|
-
return (
|
|
26
|
-
<ThemeProvider theme={theme}>
|
|
27
|
-
<CssBaseline />
|
|
28
|
-
{children}
|
|
29
|
-
</ThemeProvider>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default App;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import CoreHeaderSection, {
|
|
2
|
-
HeaderSectionProps as CoreHeaderSectionProps,
|
|
3
|
-
} from '@digigov/react-core/HeaderSection';
|
|
4
|
-
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
5
|
-
|
|
6
|
-
export type HeaderSectionProps = CoreHeaderSectionProps;
|
|
7
|
-
|
|
8
|
-
export const HeaderSection = withDeprecation(CoreHeaderSection, {
|
|
9
|
-
name: 'HeaderSection',
|
|
10
|
-
rename: 'HeaderSection',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default HeaderSection;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import CoreHeaderTitle, {
|
|
2
|
-
HeaderTitleProps as CoreHeaderTitleProps,
|
|
3
|
-
} from '@digigov/react-core/HeaderTitle';
|
|
4
|
-
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
5
|
-
|
|
6
|
-
export type HeaderTitleProps = CoreHeaderTitleProps;
|
|
7
|
-
|
|
8
|
-
export const HeaderTitle = withDeprecation(CoreHeaderTitle, {
|
|
9
|
-
name: 'Header',
|
|
10
|
-
props: {
|
|
11
|
-
xs: {
|
|
12
|
-
error: true,
|
|
13
|
-
},
|
|
14
|
-
linkProps: {
|
|
15
|
-
error:
|
|
16
|
-
'The `linkProps` property is deprecated. You can use native anchor link props instead.',
|
|
17
|
-
},
|
|
18
|
-
linkComponent: {
|
|
19
|
-
error: 'The `linkComponent` property is deprecated.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default HeaderTitle;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { mount } from 'enzyme';
|
|
3
|
-
import mountWithTheme from '@digigov/ui/test-utils/mountWithTheme';
|
|
4
|
-
|
|
5
|
-
import logo from '../../govgr/Logo/govgr-logo.svg';
|
|
6
|
-
import Header, {
|
|
7
|
-
HeaderTitle,
|
|
8
|
-
HeaderSubtitle,
|
|
9
|
-
HeaderLogo,
|
|
10
|
-
} from '@digigov/ui/app/Header';
|
|
11
|
-
|
|
12
|
-
it('renders the header with logo, title and subtitle ', () => {
|
|
13
|
-
expect(
|
|
14
|
-
mountWithTheme(
|
|
15
|
-
<Header>
|
|
16
|
-
<HeaderLogo src={logo} href="https://gov.gr" />
|
|
17
|
-
<HeaderTitle href="/some-url">A title</HeaderTitle>
|
|
18
|
-
<HeaderSubtitle>A subtitle</HeaderSubtitle>
|
|
19
|
-
</Header>
|
|
20
|
-
)
|
|
21
|
-
).toMatchSnapshot();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders the HeaderTitle component', () => {
|
|
25
|
-
expect(mount(<HeaderTitle>A title</HeaderTitle>)).toMatchSnapshot();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('renders the HeaderTitle component with custom href', () => {
|
|
29
|
-
expect(
|
|
30
|
-
mount(<HeaderTitle href={'/somelink'}>A title</HeaderTitle>)
|
|
31
|
-
).toMatchSnapshot();
|
|
32
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
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;
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|
package/src/app/PageTitle.tsx
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
});
|