@digigov/nextjs 0.6.6 → 0.6.7

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.
Files changed (55) hide show
  1. package/{dist/App.js → App.js} +0 -0
  2. package/CHANGELOG.md +6 -1
  3. package/{dist/Document.js → Document.js} +0 -0
  4. package/{dist/Image.js → Image.js} +0 -0
  5. package/{dist/LICENSE → LICENSE} +0 -0
  6. package/{dist/Link.js → Link.js} +0 -0
  7. package/{dist/es → es}/App.js +0 -0
  8. package/{dist/es → es}/Document.js +0 -0
  9. package/{dist/es → es}/Image.js +0 -0
  10. package/{dist/es → es}/Link.js +0 -0
  11. package/{dist/es → es}/hooks.js +0 -0
  12. package/{dist/es → es}/i18n.js +0 -0
  13. package/{dist/es → es}/index.js +0 -0
  14. package/{dist/esm → esm}/App.js +0 -0
  15. package/{dist/esm → esm}/Document.js +0 -0
  16. package/{dist/esm → esm}/Image.js +0 -0
  17. package/{dist/esm → esm}/Link.js +0 -0
  18. package/{dist/esm → esm}/hooks.js +0 -0
  19. package/{dist/esm → esm}/i18n.js +0 -0
  20. package/{dist/esm → esm}/index.js +1 -1
  21. package/{dist/hooks.js → hooks.js} +0 -0
  22. package/{dist/i18n.js → i18n.js} +0 -0
  23. package/{dist/index.js → index.js} +0 -0
  24. package/{dist/libs → libs}/nextjs/src/App.d.ts +0 -0
  25. package/{dist/libs → libs}/nextjs/src/Document.d.ts +0 -0
  26. package/{dist/libs → libs}/nextjs/src/Image.d.ts +0 -0
  27. package/{dist/libs → libs}/nextjs/src/Link.d.ts +0 -0
  28. package/{dist/libs → libs}/nextjs/src/hooks.d.ts +0 -0
  29. package/{dist/libs → libs}/nextjs/src/i18n.d.ts +0 -0
  30. package/{dist/libs → libs}/nextjs/src/index.d.ts +0 -0
  31. package/{dist/libs → libs}/ui/src/app/App.d.ts +0 -0
  32. package/{dist/libs → libs}/ui/src/app/i18n.d.ts +0 -0
  33. package/{dist/libs → libs}/ui/src/core/Link/index.d.ts +0 -0
  34. package/{dist/libs → libs}/ui/src/locales/el.d.ts +0 -0
  35. package/{dist/libs-ui → libs-ui}/react-core/src/Base/index.d.ts +0 -0
  36. package/{dist/libs-ui → libs-ui}/react-core/src/LinkBase/index.d.ts +0 -0
  37. package/package.json +24 -37
  38. package/.eslintrc.js +0 -3
  39. package/.prettierrc.js +0 -3
  40. package/.rush/temp/operation/build/state.json +0 -3
  41. package/.rush/temp/package-deps_build.json +0 -21
  42. package/.rush/temp/shrinkwrap-deps.json +0 -334
  43. package/CHANGELOG.json +0 -990
  44. package/dist/CHANGELOG.md +0 -275
  45. package/dist/README.md +0 -52
  46. package/dist/package.json +0 -26
  47. package/nextjs.build.log +0 -16
  48. package/src/App.tsx +0 -61
  49. package/src/Document.tsx +0 -73
  50. package/src/Image.tsx +0 -10
  51. package/src/Link.tsx +0 -33
  52. package/src/hooks.ts +0 -6
  53. package/src/i18n.tsx +0 -18
  54. package/src/index.ts +0 -0
  55. package/tsconfig.json +0 -14
package/dist/CHANGELOG.md DELETED
@@ -1,275 +0,0 @@
1
- # Change Log - @digigov/nextjs
2
-
3
- This log was last generated on Fri, 18 Nov 2022 08:33:43 GMT and should not be manually modified.
4
-
5
- ## 0.6.6
6
- Fri, 18 Nov 2022 08:33:43 GMT
7
-
8
- ### Patches
9
-
10
- - Update imports of renamed react components
11
-
12
- ## 0.6.5
13
- Wed, 16 Nov 2022 14:27:34 GMT
14
-
15
- _Version update only_
16
-
17
- ## 0.6.4
18
- Tue, 27 Sep 2022 14:49:37 GMT
19
-
20
- ### Patches
21
-
22
- - add default lang to html tag in DOM
23
- - specify the peerDependencies range in a better way
24
-
25
- ## 0.6.3
26
- Tue, 27 Sep 2022 10:00:49 GMT
27
-
28
- ### Patches
29
-
30
- - increase the range of accepted react version specified in peerDependencies
31
-
32
- ## 0.6.2
33
- Tue, 06 Sep 2022 08:27:15 GMT
34
-
35
- ### Patches
36
-
37
- - remove theme material-ui from App.tsx
38
-
39
- ## 0.6.1
40
- Wed, 31 Aug 2022 16:10:12 GMT
41
-
42
- _Version update only_
43
-
44
- ## 0.6.0
45
- Tue, 16 Aug 2022 14:59:01 GMT
46
-
47
- ### Minor changes
48
-
49
- - add new Image wrapper with built-in basePath support
50
-
51
- ## 0.5.4
52
- Wed, 08 Jun 2022 13:32:34 GMT
53
-
54
- ### Patches
55
-
56
- - Fix i18NProvider string interpolation support
57
-
58
- ## 0.5.3
59
- Tue, 17 May 2022 11:04:22 GMT
60
-
61
- _Version update only_
62
-
63
- ## 0.5.2
64
- Mon, 16 May 2022 14:42:45 GMT
65
-
66
- ### Patches
67
-
68
- - Change MIT License to BSD-2-Clause
69
-
70
- ## 0.5.1
71
- Tue, 19 Apr 2022 12:17:34 GMT
72
-
73
- ### Patches
74
-
75
- - Fix a bug where using target=_blank would not open the link at all. Now it opens in a new window using our CoreLink.
76
-
77
- ## 0.5.0
78
- Mon, 18 Apr 2022 13:00:33 GMT
79
-
80
- ### Minor changes
81
-
82
- - Upgrade @types/node version
83
-
84
- ## 0.4.6
85
- Thu, 14 Apr 2022 12:32:51 GMT
86
-
87
- _Version update only_
88
-
89
- ## 0.4.5
90
- Wed, 30 Mar 2022 13:17:56 GMT
91
-
92
- ### Patches
93
-
94
- - incorrect regex pattern was causing build failure
95
-
96
- ## 0.4.4
97
- Wed, 30 Mar 2022 12:28:30 GMT
98
-
99
- ### Patches
100
-
101
- - allow file links to be used with internal Nextjs router
102
-
103
- ## 0.4.2
104
- Thu, 24 Feb 2022 14:51:06 GMT
105
-
106
- _Version update only_
107
-
108
- ## 0.4.1
109
- Wed, 16 Feb 2022 12:49:28 GMT
110
-
111
- _Version update only_
112
-
113
- ## 0.4.0
114
- Mon, 14 Feb 2022 09:56:29 GMT
115
-
116
- ### Minor changes
117
-
118
- - Replace <a> with Link from @digigov/react-core
119
-
120
- ## 0.3.6
121
- Thu, 10 Feb 2022 13:45:56 GMT
122
-
123
- _Version update only_
124
-
125
- ## 0.3.5
126
- Tue, 08 Feb 2022 15:21:11 GMT
127
-
128
- _Version update only_
129
-
130
- ## 0.3.4
131
- Thu, 03 Feb 2022 15:47:05 GMT
132
-
133
- _Version update only_
134
-
135
- ## 0.3.3
136
- Wed, 02 Feb 2022 15:44:29 GMT
137
-
138
- ### Patches
139
-
140
- - fix package.json inconsistencies by running cli-lab verify-and-update-local-package-versions
141
-
142
- ## 0.3.2
143
- Thu, 30 Dec 2021 12:54:03 GMT
144
-
145
- _Version update only_
146
-
147
- ## 0.3.1
148
- Tue, 02 Nov 2021 13:03:39 GMT
149
-
150
- _Version update only_
151
-
152
- ## 0.3.0
153
- Tue, 12 Oct 2021 09:13:08 GMT
154
-
155
- ### Minor changes
156
-
157
- - Warn if browser is IE
158
-
159
- ## 0.2.27
160
- Wed, 22 Sep 2021 10:15:42 GMT
161
-
162
- ### Patches
163
-
164
- - Add missing props to the Link component
165
-
166
- ## 0.2.26
167
- Thu, 12 Aug 2021 08:56:35 GMT
168
-
169
- _Version update only_
170
-
171
- ## 0.2.25
172
- Thu, 12 Aug 2021 06:18:14 GMT
173
-
174
- _Version update only_
175
-
176
- ## 0.2.24
177
- Tue, 03 Aug 2021 12:09:02 GMT
178
-
179
- _Version update only_
180
-
181
- ## 0.2.23
182
- Tue, 03 Aug 2021 10:22:51 GMT
183
-
184
- _Version update only_
185
-
186
- ## 0.2.22
187
- Fri, 30 Jul 2021 13:01:30 GMT
188
-
189
- _Version update only_
190
-
191
- ## 0.2.21
192
- Fri, 30 Jul 2021 11:35:29 GMT
193
-
194
- _Version update only_
195
-
196
- ## 0.2.20
197
- Fri, 30 Jul 2021 10:46:37 GMT
198
-
199
- _Version update only_
200
-
201
- ## 0.2.19
202
- Fri, 30 Jul 2021 08:49:46 GMT
203
-
204
- _Version update only_
205
-
206
- ## 0.2.18
207
- Fri, 30 Jul 2021 07:46:24 GMT
208
-
209
- _Version update only_
210
-
211
- ## 0.2.17
212
- Tue, 27 Jul 2021 10:14:43 GMT
213
-
214
- _Version update only_
215
-
216
- ## 0.2.16
217
- Thu, 15 Jul 2021 11:16:22 GMT
218
-
219
- _Version update only_
220
-
221
- ## 0.2.15
222
- Fri, 09 Jul 2021 08:59:32 GMT
223
-
224
- _Version update only_
225
-
226
- ## 0.2.14
227
- Thu, 08 Jul 2021 15:08:50 GMT
228
-
229
- _Version update only_
230
-
231
- ## 0.2.13
232
- Wed, 30 Jun 2021 12:09:21 GMT
233
-
234
- _Version update only_
235
-
236
- ## 0.2.12
237
- Wed, 23 Jun 2021 13:04:19 GMT
238
-
239
- _Version update only_
240
-
241
- ## 0.2.11
242
- Wed, 02 Jun 2021 12:04:27 GMT
243
-
244
- _Version update only_
245
-
246
- ## 0.2.10
247
- Wed, 02 Jun 2021 08:33:44 GMT
248
-
249
- _Version update only_
250
-
251
- ## 0.2.9
252
- Wed, 05 May 2021 14:11:41 GMT
253
-
254
- _Version update only_
255
-
256
- ## 0.2.8
257
- Thu, 22 Apr 2021 15:04:42 GMT
258
-
259
- _Version update only_
260
-
261
- ## 0.2.7
262
- Thu, 22 Apr 2021 14:39:18 GMT
263
-
264
- _Version update only_
265
-
266
- ## 0.2.6
267
- Thu, 22 Apr 2021 14:06:40 GMT
268
-
269
- _Version update only_
270
-
271
- ## 0.2.5
272
- Thu, 22 Apr 2021 12:56:25 GMT
273
-
274
- _Initial release_
275
-
package/dist/README.md DELETED
@@ -1,52 +0,0 @@
1
- # @digigov/nextjs
2
-
3
- Next.js utilities for @digigov projects.
4
-
5
- Included,
6
-
7
- * common `_app` and `_document` components with support for,
8
- - SSR style handling.
9
- - `@digigov/ui/app/App` component.
10
- - use `@digigov/ui/core/Link/LinkProvider` to set `next/Link` as the default
11
- Link component across app.
12
-
13
- * react-i18next initializer
14
-
15
-
16
- ## Usage
17
-
18
- ```shell
19
- $ yarn add @digigov/nextjs
20
- ```
21
-
22
- Create `_app` and `_document` components,
23
-
24
- **pages/_app.js**
25
-
26
- ```js
27
- import initI18n from '@digigov/nextjs/i18n';
28
- import el from '../locales/el';
29
- initI18n({
30
- el: {
31
- translation: el
32
- }
33
- });
34
-
35
- import App from '@digigov/nextjs/App';
36
- export default App;
37
- ```
38
-
39
- **pages/_document.js**
40
- ```js
41
- import Document from '@digigov/nextjs/Document';
42
- export default Document;
43
- ```
44
-
45
-
46
- ## Drawbacks
47
-
48
- `next.js` spawns two transpilation processes for SSR and client code using
49
- different configuration options. `_app`, `_doc` are provided as raw `.tsx`
50
- modules to prevent transpilation conflicts. You need to modify `next.js`
51
- webpack configuration to include `@digigov/nextjs` components as though they
52
- where located in locally in your project.
package/dist/package.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "name": "@digigov/nextjs",
3
- "version": "0.6.6",
4
- "description": "next specific utilities for @digigov apps",
5
- "author": "GRNET Developers <devs@lists.grnet.gr>",
6
- "license": "BSD-2-Clause",
7
- "main": "./index.js",
8
- "module": "./esm/index.js",
9
- "publishConfig": {
10
- "main": "dist/index.js"
11
- },
12
- "peerDependencies": {
13
- "@digigov/ui": "0.28.2",
14
- "@material-ui/core": "4.11.3",
15
- "@material-ui/icons": "4.11.2",
16
- "clsx": "1.1.1",
17
- "i18next": "19.1.0",
18
- "react": "^16.8.0 || ^17.0.0",
19
- "react-dom": "^16.8.0 || ^17.0.0",
20
- "next": "10.0.9",
21
- "react-i18next": "11.3.3"
22
- },
23
- "gitHead": "7237a2d58c6b30979837579e51251543aff0c240",
24
- "private": false,
25
- "typings": "./index.d.ts"
26
- }
package/nextjs.build.log DELETED
@@ -1,16 +0,0 @@
1
- Invoking: digigov build --subpackages
2
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/rimraf dist
3
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/tsc --emitDeclarationOnly --outDir dist
4
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist/esm
5
- Successfully compiled 7 files with Babel (2112ms).
6
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist/es
7
- Successfully compiled 7 files with Babel (1829ms).
8
- Created package.json in /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/package.json
9
- Copied /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/README.md to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/README.md
10
- Copied /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/CHANGELOG.md to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/CHANGELOG.md
11
- Copied /Users/dimitristsironis/grnet/digigov-sdk/LICENSE to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/LICENSE
12
- Skipped license for ./index.js
13
- Skipped license for ./umd/digigov-ui.development.js
14
- Skipped license for ./umd/digigov-ui.production.min.js
15
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist
16
- Successfully compiled 7 files with Babel (1557ms).
package/src/App.tsx DELETED
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import App from 'next/app';
3
- import Head from 'next/head';
4
- import { LinkProvider } from '@digigov/ui/core/Link';
5
- import NextLink from '@digigov/nextjs/Link';
6
- import dynamic from 'next/dynamic';
7
- import type { AppProps } from '@digigov/ui/app/App';
8
- import { I18NProvider } from '@digigov/ui/app/i18n';
9
- import { withTranslation, WithTranslation } from 'react-i18next';
10
- import { i18n } from 'i18next';
11
-
12
- const DigiGOVApp = dynamic(() => import('@digigov/ui/app/App'), {
13
- ssr: false,
14
- }) as React.FC<AppProps>;
15
- export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
16
- children?: React.ReactNode;
17
- t: (string) => string;
18
- i18n: i18n;
19
- }
20
- class DigiGOVNextApp extends App<DigiGOVNextAppProps> {
21
- componentDidMount(): void {
22
- // Remove the server-side injected CSS.
23
- const jssStyles = document.querySelector('#jss-server-side');
24
- if (jssStyles && jssStyles.parentElement) {
25
- jssStyles.parentElement.removeChild(jssStyles);
26
- }
27
- this.updateHtmlLang();
28
- }
29
-
30
- componentDidUpdate(): void {
31
- this.updateHtmlLang();
32
- }
33
-
34
- updateHtmlLang(): void {
35
- document.documentElement.lang = this.props.i18n.language;
36
- }
37
-
38
- render(): React.ReactElement {
39
- const { Component, pageProps, t, i18n } = this.props;
40
- return (
41
- <I18NProvider
42
- t={(str) => (typeof str === 'string' ? t(str) : str)}
43
- i18n={i18n}
44
- >
45
- <LinkProvider component={NextLink}>
46
- <Head>
47
- <meta
48
- name="viewport"
49
- content="minimum-scale=1, initial-scale=1, width=device-width"
50
- />
51
- </Head>
52
- <DigiGOVApp>
53
- <Component {...pageProps} />
54
- </DigiGOVApp>
55
- </LinkProvider>
56
- </I18NProvider>
57
- );
58
- }
59
- }
60
- const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
61
- export default DigiGOVNextAppWithTranslation;
package/src/Document.tsx DELETED
@@ -1,73 +0,0 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
- import React from 'react';
3
- import Document, { Html, Head, Main, NextScript } from 'next/document';
4
-
5
- export function Fonts() {
6
- return (
7
- <>
8
- <link
9
- rel="stylesheet"
10
- href="https://fonts.googleapis.com/icon?family=Material+Icons"
11
- />
12
- <link
13
- rel="stylesheet"
14
- href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
15
- />
16
- </>
17
- );
18
- }
19
- export default class DigiGOVDocument extends Document {
20
- render() {
21
- return (
22
- <Html>
23
- <Head>
24
- <script
25
- type="text/javascript"
26
- dangerouslySetInnerHTML={{
27
- __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
28
- `,
29
- }}
30
- ></script>
31
- {/* PWA primary color */}
32
- <Fonts />
33
- </Head>
34
- <body>
35
- <Main />
36
- <NextScript />
37
- </body>
38
- </Html>
39
- );
40
- }
41
- }
42
-
43
- DigiGOVDocument.getInitialProps = async (ctx) => {
44
- // Resolution order
45
- //
46
- // On the server:
47
- // 1. app.getInitialProps
48
- // 2. page.getInitialProps
49
- // 3. document.getInitialProps
50
- // 4. app.render
51
- // 5. page.render
52
- // 6. document.render
53
- //
54
- // On the server with error:
55
- // 1. document.getInitialProps
56
- // 2. app.render
57
- // 3. page.render
58
- // 4. document.render
59
- //
60
- // On the client
61
- // 1. app.getInitialProps
62
- // 2. page.getInitialProps
63
- // 3. app.render
64
- // 4. page.render
65
-
66
- // Render app and page and get the context of the page with collected side effects.
67
- const initialProps = await Document.getInitialProps(ctx);
68
-
69
- return {
70
- ...initialProps,
71
- // Styles fragment is rendered after the app and page rendering finish.
72
- };
73
- };
package/src/Image.tsx DELETED
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import NextImage, { ImageProps } from 'next/image';
3
- import { useBasePath } from '@digigov/nextjs/hooks';
4
-
5
- const Image: React.FC<ImageProps> = ({ src, ...rest }) => {
6
- const basePathSrc = useBasePath(src);
7
- return <NextImage src={basePathSrc} {...rest} />;
8
- };
9
-
10
- export default Image;
package/src/Link.tsx DELETED
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { LinkProps } from '@digigov/ui/core/Link';
3
- import Link from 'next/link';
4
- import LinkBase from '@digigov/react-core/LinkBase';
5
-
6
- const NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (
7
- props,
8
- ref
9
- ) => {
10
- const { href, ...other } = props;
11
- const isExternalLink =
12
- //check if url has a file extension
13
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
14
- // or if props has a target or rel
15
- other.target === '_blank';
16
-
17
- if (isExternalLink) {
18
- return (
19
- <LinkBase ref={ref} href={href || '#'} {...other}>
20
- {props.children}
21
- </LinkBase>
22
- );
23
- }
24
- return (
25
- <Link href={href || '#'} {...other}>
26
- <LinkBase ref={ref} {...other}>
27
- {props.children}
28
- </LinkBase>
29
- </Link>
30
- );
31
- };
32
-
33
- export default React.forwardRef(NextLink);
package/src/hooks.ts DELETED
@@ -1,6 +0,0 @@
1
- import { useRouter } from 'next/router';
2
-
3
- export function useBasePath(src: string): string {
4
- const router = useRouter();
5
- return router.basePath + src;
6
- }
package/src/i18n.tsx DELETED
@@ -1,18 +0,0 @@
1
- import i18n, { Resource, TFunction } from 'i18next';
2
- import { initReactI18next } from 'react-i18next';
3
-
4
- export default function initI18n(
5
- resources: Resource,
6
- language = 'el'
7
- ): Promise<TFunction> {
8
- return i18n
9
- .use(initReactI18next) // passes i18n down to react-i18next
10
- .init({
11
- resources: resources,
12
- lng: language,
13
- keySeparator: '.', // we use keys in form messages.welcome
14
- interpolation: {
15
- escapeValue: false, // react already safes from xss
16
- },
17
- });
18
- }
package/src/index.ts DELETED
File without changes
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@digigov/cli-build/tsconfig.base",
3
- "compilerOptions": {
4
- "outDir": "dist"
5
- },
6
- "include": [
7
- "./src"
8
- ],
9
- "exclude": [
10
- "node_modules",
11
- "dist",
12
- "*.svg"
13
- ]
14
- }