@ogcio/design-system-react 1.10.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/LICENSE +21 -0
- package/README.md +160 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OGCIO (PER)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# govie-react
|
|
2
|
+
|
|
3
|
+
**This library should only be imported for departments actively working with the core design system team during its development. Do not use this library if you are not part of this development process, and contact the design system team instead if you interested in its use.**
|
|
4
|
+
|
|
5
|
+
Welcome to the GOV IE React component library, a collection of reusable React components designed to help you build modern React web applications utilising the GOV IE design system.
|
|
6
|
+
|
|
7
|
+
**Status: Alpha**
|
|
8
|
+
|
|
9
|
+
> Important Note: This library is currently in the **alpha** stage. As we continue to develop and improve the components, **frequent breaking changes are to be expected**. We appreciate your understanding and patience as we work towards a stable version 1.0.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
To install the library, use the following command:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install @ogcio/design-system-react @ogcio/theme-govie
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Pinning packages
|
|
20
|
+
|
|
21
|
+
We **strongly recommend** that you pin the GOV IE design system packages, so that any regressions are not automatically introduced during development. Regressions that will only be discoverable at runtime.
|
|
22
|
+
|
|
23
|
+
**Upgrades should be explicit version updates** in the `package.json` and then your application should be regression tested:
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
"dependencies": {
|
|
27
|
+
- "@ogcio/theme-govie": "^0.1.2",
|
|
28
|
+
+ "@ogcio/theme-govie": "0.1.2",
|
|
29
|
+
- "@ogcio/design-system-react": "^0.1.6",
|
|
30
|
+
+ "@ogcio/design-system-react": "0.1.6"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Usage
|
|
34
|
+
|
|
35
|
+
Import the GOV IE `theme.css` from the `@ogcio/theme-govie` theme package at the entry point of your application, for example:
|
|
36
|
+
|
|
37
|
+
```diff
|
|
38
|
+
+import '@ogcio/theme-govie/theme.css'
|
|
39
|
+
|
|
40
|
+
export function App() {
|
|
41
|
+
return (
|
|
42
|
+
...
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> Note that you should typically run some form of CSS reset or normalisation of styles as part of your application entry point, depending on your application styling solution. For example Tailwind includes [preflight](https://tailwindcss.com/docs/preflight), an optinionated set of base styles.
|
|
48
|
+
|
|
49
|
+
Use components within your application from the `@ogcio/design-system-react` component package:
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import { Header } from '@ogcio/design-system-react';
|
|
53
|
+
|
|
54
|
+
export function MyComponent() {
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<Header serviceName="My Service" />
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Typography
|
|
64
|
+
|
|
65
|
+
The `@ogcio/design-system-react` package contains `Heading` and `Paragraph` components that implement the GOV IE design system responsive text guidelines:
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
import { Heading, Paragraph } from '@ogcio/design-system-react';
|
|
69
|
+
|
|
70
|
+
function MyComponent() {
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<Heading>Heading</Heading>
|
|
74
|
+
<Paragraph>This is a paragraph</Paragraph>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The GOV IE design system uses the [Lato](https://fonts.google.com/specimen/Lato) Google font. The font should be added to your application, e.g. via [next/font](https://nextjs.org/docs/app/building-your-application/optimizing/fonts), [Fontsource](https://fontsource.org/docs/getting-started/install) or embed code.
|
|
81
|
+
|
|
82
|
+
### Internationalization (i18n) Guidelines
|
|
83
|
+
|
|
84
|
+
To support multiple languages across your application, we use the `initI18n` utility provided by `@ogcio/design-system-react`. This ensures consistency, accessibility, and localization across all components.
|
|
85
|
+
|
|
86
|
+
Before rendering your app, make sure to initialize i18n with your language resources:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import { initI18n } from '@ogcio/design-system-react';
|
|
90
|
+
|
|
91
|
+
initI18n({
|
|
92
|
+
resources: {
|
|
93
|
+
en: {
|
|
94
|
+
translation: {
|
|
95
|
+
// Component namespaces go here
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
fr: {
|
|
99
|
+
translation: {
|
|
100
|
+
// Component namespaces go here
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
ar: {
|
|
104
|
+
translation: {
|
|
105
|
+
// Component namespaces go here
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
lng: 'en', // Default language
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Example Localisation of Pagination
|
|
114
|
+
|
|
115
|
+
The pagination component uses the following i18n keys:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
resources: {
|
|
119
|
+
en: {
|
|
120
|
+
translation: {
|
|
121
|
+
pagination: {
|
|
122
|
+
previous: 'Previous',
|
|
123
|
+
next: 'Next',
|
|
124
|
+
page: 'Page {{currentPage}} of {{totalPages}}',
|
|
125
|
+
goToPage: 'Go to page {{page}}',
|
|
126
|
+
goToPrevious: 'Go to previous page',
|
|
127
|
+
goToNext: 'Go to next page',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
fr: {
|
|
132
|
+
translation: {
|
|
133
|
+
pagination: {
|
|
134
|
+
previous: 'Précédent:,
|
|
135
|
+
next: 'Suivant',
|
|
136
|
+
page: 'Page {{currentPage}} sur {{totalPages}}',
|
|
137
|
+
goToPage: 'Aller à la page {{page}}',
|
|
138
|
+
goToPrevious: 'Aller à la page précédente',
|
|
139
|
+
goToNext: 'Aller à la page suivante',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Note: Each component in the design system documents its relevant i18n keys under an **i18n Keys** heading, if available, for example [Pagination i18n Keys](http://ds.blocks.gov.ie/components/library/pagination/#i18n-keys). Be sure to refer to this section when using or implementing a component to ensure all necessary translations are provided.
|
|
147
|
+
|
|
148
|
+
## Contribution
|
|
149
|
+
|
|
150
|
+
We welcome contributions! If you have suggestions for improvements, please feel free to open an issue or submit a pull request.
|
|
151
|
+
|
|
152
|
+
## Feedback
|
|
153
|
+
|
|
154
|
+
Your feedback is invaluable to us. Please share your thoughts and experiences to help us make this library better.
|
|
155
|
+
|
|
156
|
+
## Roadmap
|
|
157
|
+
|
|
158
|
+
- Alpha: Frequent updates with breaking changes.
|
|
159
|
+
- Beta: Stabilizing the API and focusing on bug fixes.
|
|
160
|
+
- 1.0: Stable release with a solid API.
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ogcio/design-system-react",
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "The GOV IE design system React components.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./dist/index.js",
|
|
13
|
+
"./styles.css": "./dist/styles.css"
|
|
14
|
+
},
|
|
15
|
+
"prettier": "@ogcio/design-system-prettier-config",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"**/*.css"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"styles"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": "*",
|
|
28
|
+
"react-dom": "*"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@popperjs/core": "^2.11.8",
|
|
32
|
+
"@radix-ui/react-slot": "^1.1.2",
|
|
33
|
+
"clsx": "^2.1.1",
|
|
34
|
+
"rollup-preserve-directives": "^1.1.2",
|
|
35
|
+
"@ogcio/design-system-tokens": "1.4.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@percy/cli": "^1.30.7",
|
|
39
|
+
"@percy/storybook": "^6.0.3",
|
|
40
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
41
|
+
"@testing-library/react": "^16.0.1",
|
|
42
|
+
"@testing-library/user-event": "^14.5.2",
|
|
43
|
+
"@types/css-modules": "^1.0.5",
|
|
44
|
+
"autoprefixer": "^10.4.19",
|
|
45
|
+
"axe-core": "^4.10.0",
|
|
46
|
+
"eslint": "^9.23.0",
|
|
47
|
+
"eslint-plugin-storybook": "^0.12.0",
|
|
48
|
+
"glob": "^11.0.1",
|
|
49
|
+
"i18next": "^24.2.2",
|
|
50
|
+
"postcss": "^8.4.40",
|
|
51
|
+
"postcss-import": "^16.1.0",
|
|
52
|
+
"react": "19.0.0",
|
|
53
|
+
"react-dom": "19.0.0",
|
|
54
|
+
"@ogcio/design-system-eslint-config": "1.2.5",
|
|
55
|
+
"@ogcio/design-system-prettier-config": "1.0.5",
|
|
56
|
+
"@ogcio/theme-doete": "1.0.0",
|
|
57
|
+
"@ogcio/theme-govie": "1.4.1",
|
|
58
|
+
"@ogcio/design-system-tailwind": "1.9.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"format": "prettier 'src/**/*.{ts,tsx}' --write",
|
|
62
|
+
"format:check": "prettier 'src/**/*.{ts,tsx}' --check",
|
|
63
|
+
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"coverage": "vitest run --coverage",
|
|
67
|
+
"build": "pnpm build:ts && pnpm build:styles",
|
|
68
|
+
"build:styles": "tailwindcss -i ./styles.css -o ./dist/styles.css --minify",
|
|
69
|
+
"build:ts": "vite build",
|
|
70
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
71
|
+
"storybook:build": "storybook build --stats-json",
|
|
72
|
+
"storybook:test": "vitest --project=storybook",
|
|
73
|
+
"storybook:coverage": "vitest --project=storybook --coverage",
|
|
74
|
+
"percy": "pnpm storybook:build && percy storybook ./storybook-static --config percy.yaml"
|
|
75
|
+
}
|
|
76
|
+
}
|