@coopdigital/react 0.0.8 → 0.0.10
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/dist/components/Button/Button.e2e.test.d.ts +1 -0
- package/dist/components/Button/Button.test.d.ts +4 -0
- package/package.json +8 -6
- package/src/components/Button/Button.e2e.test.ts +8 -0
- package/src/components/Button/Button.stories.tsx +13 -0
- package/src/components/Button/Button.test.tsx +18 -0
- package/src/components/Button/Button.tsx +10 -0
- package/src/components/Button/index.ts +5 -0
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
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
# Experience Kit for React
|
|
10
|
+
|
|
11
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
12
|
+
[all_contributors_badge]: https://img.shields.io/badge/all_contributors-15-C08A00.svg ''
|
|
13
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
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)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
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:
|
|
61
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
62
|
+
<!-- prettier-ignore-start -->
|
|
63
|
+
<!-- markdownlint-disable -->
|
|
64
|
+
<table>
|
|
65
|
+
<tbody>
|
|
66
|
+
<tr>
|
|
67
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/aaronrleslie">
|
|
68
|
+
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-UKMP0F917-34a22da610d8-150" width="200px;" alt=""/></div>
|
|
69
|
+
<small>Aaron Leslie</small>
|
|
70
|
+
<div><a href="#infra-aaronrleslie" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></div>
|
|
71
|
+
</a></td>
|
|
72
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/catia.costa1">
|
|
73
|
+
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/25728410/avatar.png" width="200px;" alt=""/></div>
|
|
74
|
+
<small>Catia Costa</small>
|
|
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>
|
|
76
|
+
</a></td>
|
|
77
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/chris.latimer">
|
|
78
|
+
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/10570471/avatar.png" width="200px;" alt=""/></div>
|
|
79
|
+
<small>Chris Latimer</small>
|
|
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>
|
|
81
|
+
</a></td>
|
|
82
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/craig.mckay">
|
|
83
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
84
|
+
<small>Craig Mckay</small>
|
|
85
|
+
<div><a href="#projectManagement-craig.mckay" title="Project Management">📆</a></div>
|
|
86
|
+
</a></td>
|
|
87
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/daniel.lippross">
|
|
88
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
89
|
+
<small>Daniel Lippross</small>
|
|
90
|
+
<div><a href="#platform-daniel.lippross" title="Packaging/porting to new platform">📦</a></div>
|
|
91
|
+
</a></td>
|
|
92
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/emalin.matthews">
|
|
93
|
+
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-UMGDXU8JH-ade541a7f09e-150" width="200px;" alt=""/></div>
|
|
94
|
+
<small>Emalin Matthews</small>
|
|
95
|
+
<div><a href="#a11y-emalin.matthews" 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>
|
|
96
|
+
</a></td>
|
|
97
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/jelena.milosevic">
|
|
98
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
99
|
+
<small>Jelena Milosevic</small>
|
|
100
|
+
<div><a href="#infra-jelena.milosevic" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></div>
|
|
101
|
+
</a></td>
|
|
102
|
+
</tr><br />
|
|
103
|
+
<tr>
|
|
104
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/kamini.pagare">
|
|
105
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
106
|
+
<small>Kamini Pagare</small>
|
|
107
|
+
<div><a href="#a11y-kamini.pagare" 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>
|
|
108
|
+
</a></td>
|
|
109
|
+
<td align="center" valign="top" width="14.28%"><a href="">
|
|
110
|
+
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-U3AJ40BGS-ec515dc443cb-150" width="200px;" alt=""/></div>
|
|
111
|
+
<small>Lee Connolly</small>
|
|
112
|
+
<div><a href="#projectManagement-lee.connolly" title="Project Management">📆</a></div>
|
|
113
|
+
</a></td>
|
|
114
|
+
<td align="center" valign="top" width="14.28%"><a href="">
|
|
115
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
116
|
+
<small>Liam Hall</small>
|
|
117
|
+
<div><a href="#projectManagement-liam.hall" title="Project Management">📆</a></div>
|
|
118
|
+
</a></td>
|
|
119
|
+
<td align="center" valign="top" width="14.28%"><a href="">
|
|
120
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/meg.jpg" width="200px;" alt=""/></div>
|
|
121
|
+
<small>Meg White</small>
|
|
122
|
+
<div><a href="#projectManagement-meg.white" title="Project Management">📆</a></div>
|
|
123
|
+
</a></td>
|
|
124
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/omid.kashan">
|
|
125
|
+
<div><img src="https://secure.gravatar.com/avatar/faf90b70d749cf9460eb603fa1700add94fd7d3a32645b4be6fa12eb45c4ffa3?s=80&d=identicon" width="200px;" alt=""/></div>
|
|
126
|
+
<small>Omid Kashan</small>
|
|
127
|
+
<div><a href="#a11y-omid.kashan" 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>
|
|
128
|
+
</a></td>
|
|
129
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/sam.harden">
|
|
130
|
+
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-U03NT7D39L6-2fc82e7f7c6e-150" width="200px;" alt=""/></div>
|
|
131
|
+
<small>Sam Harden</small>
|
|
132
|
+
<div><a href="#a11y-sam.harden" 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>
|
|
133
|
+
</a></td>
|
|
134
|
+
<td align="center" valign="top" width="14.28%"><a href="">
|
|
135
|
+
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
136
|
+
<small>Shweta Jaju</small>
|
|
137
|
+
<div><a href="#userTesting-shweta.jaju" title="User Testing">📓</a></div>
|
|
138
|
+
</a></td>
|
|
139
|
+
</tr><br />
|
|
140
|
+
<tr>
|
|
141
|
+
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/theodore.kouzelis">
|
|
142
|
+
<div><img src="https://secure.gravatar.com/avatar/3988f940029d9053174ac68e7f5bfa8fd61f184872d46281f44e2e698711d37d?s=80&d=identicon" width="200px;" alt=""/></div>
|
|
143
|
+
<small>Theo Kouzelis</small>
|
|
144
|
+
<div><a href="#a11y-theodore.kouzelis" 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>
|
|
145
|
+
</a></td>
|
|
146
|
+
</tr>
|
|
147
|
+
</tbody></table>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<!-- markdownlint-restore -->
|
|
151
|
+
<!-- prettier-ignore-end -->
|
|
152
|
+
|
|
153
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
154
|
+
|
|
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,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"test": "vitest run",
|
|
15
16
|
"test:coverage": "vitest run --coverage",
|
|
16
|
-
"build-storybook": "storybook build",
|
|
17
17
|
"build": "tsx scripts build",
|
|
18
|
+
"build:storybook": "storybook build --disable-telemetry && npm run storybook:fix-paths",
|
|
18
19
|
"test:e2e": "npx playwright test",
|
|
19
20
|
"test:e2e:ui": "npx playwright test --ui",
|
|
20
21
|
"storybook": "storybook dev -p 6006",
|
|
21
|
-
"storybook:playwright": "storybook dev -p 9000"
|
|
22
|
+
"storybook:playwright": "storybook dev -p 9000",
|
|
23
|
+
"storybook:fix-paths": "tsx scripts/storybook-fix-paths.ts"
|
|
22
24
|
},
|
|
23
25
|
"author": "",
|
|
24
|
-
"license": "
|
|
26
|
+
"license": "MIT",
|
|
25
27
|
"description": "",
|
|
26
28
|
"devDependencies": {
|
|
27
29
|
"@axe-core/playwright": "^4.10.1",
|
|
@@ -49,5 +51,5 @@
|
|
|
49
51
|
"react": "^19.0.0",
|
|
50
52
|
"react-dom": "^19.0.0"
|
|
51
53
|
},
|
|
52
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "a8fc664a2f4931af694002d4fe3b7832cff99569"
|
|
53
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,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import Button from "./Button"
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
component: Button,
|
|
7
|
+
} satisfies Meta<typeof Button>
|
|
8
|
+
|
|
9
|
+
export default meta
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof meta>
|
|
12
|
+
|
|
13
|
+
export const Primary: Story = {}
|
|
@@ -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
|
+
})
|