@coopdigital/react 0.0.9 → 0.1.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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Co-operative Group Limited
|
|
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
CHANGED
|
@@ -1,17 +1,63 @@
|
|
|
1
|
-
<
|
|
1
|
+
<nav>
|
|
2
|
+
<img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/logos/coopeng-logo.svg" alt="Co-op logo" width="100"/>
|
|
3
|
+
<br />
|
|
4
|
+
<br />
|
|
5
|
+
</nav>
|
|
6
|
+
|
|
7
|
+
|
|
2
8
|
|
|
3
9
|
# Experience Kit for React
|
|
4
10
|
|
|
5
11
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
6
|
-
[
|
|
12
|
+
[all_contributors_badge]: https://img.shields.io/badge/all_contributors-15-C08A00.svg ''
|
|
7
13
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
8
14
|
|
|
15
|
+
<a href="https://www.npmjs.com/package/@coopdigital/react"><img src="https://img.shields.io/npm/v/%40coopdigital%2Freact?color=E85A00" alt="npm version" /></a>
|
|
16
|
+
<img alt="NPM Last Update" src="https://img.shields.io/npm/last-update/%40coopdigital%2Freact?label=published&color=6762F9">
|
|
17
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/d18m/%40coopdigital%2Freact?color=819C00">
|
|
18
|
+
<a href="https://static.coop.co.uk/experience-kit-storybook-react"><img src="https://img.shields.io/badge/storybook-react-F85792" alt="storybook" /></a>
|
|
19
|
+
[![All Contributors][all_contributors_badge]](#contributors)
|
|
9
20
|
|
|
10
21
|
|
|
11
|
-
## Contributors ✨
|
|
12
22
|
|
|
13
|
-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
14
23
|
|
|
24
|
+
## Getting started
|
|
25
|
+
|
|
26
|
+
Install the package from NPM:
|
|
27
|
+
```
|
|
28
|
+
npm install @coopdigital/react
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import the components that you need:
|
|
32
|
+
```
|
|
33
|
+
import { Button } from "@coopdigital/react"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Developing
|
|
37
|
+
|
|
38
|
+
Refer to the [root README](https://gitlab.com/coopeng/sds/oneweb/experience-kit/-/blob/main/README.md) for general development setup and usage instructions (lint, formatting, etc).
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Package Scripts
|
|
42
|
+
|
|
43
|
+
The following scripts should be run inside the react package folder.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
| Script | Action |
|
|
47
|
+
| -------------------- | ---------------------------------------- |
|
|
48
|
+
| `npm run test` | To run vitest |
|
|
49
|
+
| `npm run test:coverage` | To run vitest test coverage |
|
|
50
|
+
| `npm run test:e2e` | To run playwright in headless mode |
|
|
51
|
+
| `npm run test:e2e:ui` | To run playwright with UI |
|
|
52
|
+
| `npm run build` | To run build script |
|
|
53
|
+
| `npm run build:storybook` | To build storybook |
|
|
54
|
+
| `npm run storybook` | To run storybook |
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Contributors ✨
|
|
59
|
+
|
|
60
|
+
Thanks goes to these wonderful people:
|
|
15
61
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
16
62
|
<!-- prettier-ignore-start -->
|
|
17
63
|
<!-- markdownlint-disable -->
|
|
@@ -29,9 +75,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
29
75
|
<div><a href="#a11y-catia.costa1" title="Accessibility">️️️️♿️</a> <a href="https://gitlab.com/coopeng/sds/oneweb/experience-kit/commits/master" title="Code">💻</a> <a href="https://gitlab.com/coopeng/sds/oneweb/experience-kit/commits/master" title="Documentation">📖</a> <a href="https://gitlab.com/coopeng/sds/oneweb/experience-kit/commits/master" title="Tests">⚠️</a></div>
|
|
30
76
|
</a></td>
|
|
31
77
|
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/chris.latimer">
|
|
32
|
-
<div><img src="https://
|
|
78
|
+
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/10570471/avatar.png" width="200px;" alt=""/></div>
|
|
33
79
|
<small>Chris Latimer</small>
|
|
34
|
-
<div><a href="https://gitlab.com/coopeng/sds/oneweb/experience-kit/commits/master" title="Code">💻</a
|
|
80
|
+
<div><a href="#infra-chris.latimer" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://gitlab.com/coopeng/sds/oneweb/experience-kit/commits/master" title="Code">💻</a></div>
|
|
35
81
|
</a></td>
|
|
36
82
|
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/craig.mckay">
|
|
37
83
|
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
@@ -106,4 +152,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
106
152
|
|
|
107
153
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
108
154
|
|
|
109
|
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
155
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Check out the [contributing guidelines](https://gitlab.com/coopeng/sds/oneweb/experience-kit/-/blob/main/CONTRIBUTING.md) to add new people. Contributions of any kind welcome!
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
This is still a work in progress, we appreciate feedback. If you have any issues, please get in touch via [tech query channel on slack](https://co-opdigital.slack.com/archives/C0167V69R8W).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist
|
|
12
|
-
"src
|
|
13
|
-
"README.md"
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
14
13
|
],
|
|
15
14
|
"scripts": {
|
|
16
15
|
"test": "vitest run",
|
|
@@ -24,33 +23,33 @@
|
|
|
24
23
|
"storybook:fix-paths": "tsx scripts/storybook-fix-paths.ts"
|
|
25
24
|
},
|
|
26
25
|
"author": "",
|
|
27
|
-
"license": "
|
|
26
|
+
"license": "MIT",
|
|
28
27
|
"description": "",
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@axe-core/playwright": "^4.10.1",
|
|
31
30
|
"@chromatic-com/storybook": "^3.2.4",
|
|
32
|
-
"@playwright/test": "^1.50.
|
|
31
|
+
"@playwright/test": "^1.50.1",
|
|
33
32
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
34
33
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
35
|
-
"@storybook/addon-essentials": "^8.5.
|
|
36
|
-
"@storybook/addon-interactions": "^8.5.
|
|
37
|
-
"@storybook/addon-onboarding": "^8.5.
|
|
38
|
-
"@storybook/blocks": "^8.5.
|
|
39
|
-
"@storybook/manager-api": "^8.5.
|
|
40
|
-
"@storybook/react": "^8.5.
|
|
41
|
-
"@storybook/react-vite": "^8.5.
|
|
42
|
-
"@storybook/test": "^8.5.
|
|
43
|
-
"@storybook/theming": "^8.5.
|
|
34
|
+
"@storybook/addon-essentials": "^8.5.8",
|
|
35
|
+
"@storybook/addon-interactions": "^8.5.8",
|
|
36
|
+
"@storybook/addon-onboarding": "^8.5.8",
|
|
37
|
+
"@storybook/blocks": "^8.5.8",
|
|
38
|
+
"@storybook/manager-api": "^8.5.8",
|
|
39
|
+
"@storybook/react": "^8.5.8",
|
|
40
|
+
"@storybook/react-vite": "^8.5.8",
|
|
41
|
+
"@storybook/test": "^8.5.8",
|
|
42
|
+
"@storybook/theming": "^8.5.8",
|
|
44
43
|
"@testing-library/jest-dom": "^6.6.3",
|
|
45
44
|
"@testing-library/react": "^16.2.0",
|
|
46
|
-
"@types/react": "^19.0.
|
|
47
|
-
"@types/react-dom": "^19.0.
|
|
48
|
-
"rollup": "^4.
|
|
49
|
-
"storybook": "^8.5.
|
|
45
|
+
"@types/react": "^19.0.10",
|
|
46
|
+
"@types/react-dom": "^19.0.4",
|
|
47
|
+
"rollup": "^4.34.8",
|
|
48
|
+
"storybook": "^8.5.8"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
51
|
"react": "^19.0.0",
|
|
53
52
|
"react-dom": "^19.0.0"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "52c2b7a0bd9ddde9ee7203b6961940bafe84b61a"
|
|
56
55
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test"
|
|
2
|
+
|
|
3
|
+
const server_url = "/iframe.html?viewMode=story&id=components-button--primary&args=&globals="
|
|
4
|
+
|
|
5
|
+
test("Add to basket button visibility", async ({ page }) => {
|
|
6
|
+
await page.goto(server_url)
|
|
7
|
+
await expect(page.getByRole("button", { name: "Add to basket" })).toBeVisible()
|
|
8
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { render } from "@testing-library/react"
|
|
6
|
+
import { describe, it, afterEach } from "vitest"
|
|
7
|
+
import { Button } from "."
|
|
8
|
+
import { cleanup } from "@testing-library/react"
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
cleanup()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
describe("Button", () => {
|
|
14
|
+
it("renders button", () => {
|
|
15
|
+
render(<Button />)
|
|
16
|
+
//screen.debug()
|
|
17
|
+
})
|
|
18
|
+
})
|