@coopdigital/react 0.19.2 → 0.19.4
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/README.md +1 -114
- package/dist/components/AlertBanner/AlertBanner.d.ts +4 -14
- package/dist/components/AlertBanner/AlertBanner.js +0 -10
- package/dist/components/Author/Author.d.ts +5 -8
- package/dist/components/Author/Author.js +0 -3
- package/dist/components/Button/Button.d.ts +0 -3
- package/dist/components/Button/Button.js +0 -3
- package/dist/components/Card/Card.d.ts +0 -3
- package/dist/components/Card/Card.js +0 -3
- package/dist/components/Expandable/Expandable.d.ts +0 -4
- package/dist/components/Expandable/Expandable.js +0 -4
- package/dist/components/Image/Image.d.ts +0 -3
- package/dist/components/Image/Image.js +0 -3
- package/dist/components/Pill/Pill.d.ts +0 -3
- package/dist/components/Pill/Pill.js +0 -3
- package/dist/components/SearchBox/SearchBox.d.ts +0 -17
- package/dist/components/SearchBox/SearchBox.js +0 -17
- package/dist/components/Signpost/Signpost.d.ts +0 -3
- package/dist/components/Signpost/Signpost.js +0 -3
- package/dist/components/SkipNav/SkipNav.d.ts +0 -17
- package/dist/components/SkipNav/SkipNav.js +0 -17
- package/dist/components/Squircle/Squircle.d.ts +2 -5
- package/dist/components/Squircle/Squircle.js +0 -3
- package/dist/components/Tag/Tag.d.ts +0 -10
- package/dist/components/Tag/Tag.js +0 -10
- package/package.json +4 -3
- package/src/components/AlertBanner/AlertBanner.tsx +4 -14
- package/src/components/Author/Author.tsx +5 -9
- package/src/components/Button/Button.tsx +0 -3
- package/src/components/Card/Card.tsx +0 -3
- package/src/components/Expandable/Expandable.tsx +0 -5
- package/src/components/Image/Image.tsx +0 -3
- package/src/components/Pill/Pill.tsx +0 -3
- package/src/components/SearchBox/SearchBox.tsx +0 -17
- package/src/components/Signpost/Signpost.tsx +0 -4
- package/src/components/SkipNav/SkipNav.tsx +0 -17
- package/src/components/Squircle/Squircle.tsx +2 -6
- package/src/components/Tag/Tag.tsx +0 -11
package/README.md
CHANGED
|
@@ -6,15 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
# Experience Kit for React
|
|
8
8
|
|
|
9
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
10
|
-
[all_contributors_badge]: https://img.shields.io/badge/all_contributors-17-C08A00.svg ''
|
|
11
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
12
|
-
|
|
13
9
|
<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>
|
|
14
10
|
<img alt="NPM Last Update" src="https://img.shields.io/npm/last-update/%40coopdigital%2Freact?label=published&color=6762F9">
|
|
15
11
|
<img alt="NPM Downloads" src="https://img.shields.io/npm/d18m/%40coopdigital%2Freact?color=819C00">
|
|
16
12
|
<a href="https://static.coop.co.uk/experience-kit-storybook-react"><img src="https://img.shields.io/badge/storybook-react-F85792" alt="storybook" /></a>
|
|
17
|
-
|
|
13
|
+
|
|
18
14
|
|
|
19
15
|
> React components for the Experience Library design system.
|
|
20
16
|
|
|
@@ -43,115 +39,6 @@ Alternatively if your project uses SASS you can import the source stylesheets:
|
|
|
43
39
|
@use "@coopdigital/styles/src/components/Pill.scss"
|
|
44
40
|
```
|
|
45
41
|
|
|
46
|
-
## Contributors ✨
|
|
47
|
-
|
|
48
|
-
Thanks goes to these wonderful people:
|
|
49
|
-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
50
|
-
<!-- prettier-ignore-start -->
|
|
51
|
-
<!-- markdownlint-disable -->
|
|
52
|
-
<table>
|
|
53
|
-
<tbody>
|
|
54
|
-
<tr>
|
|
55
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/aaronrleslie">
|
|
56
|
-
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-UKMP0F917-34a22da610d8-150" width="200px;" alt=""/></div>
|
|
57
|
-
<small>Aaron Leslie</small>
|
|
58
|
-
<div><a href="#infra-aaronrleslie" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></div>
|
|
59
|
-
</a></td>
|
|
60
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/catia.costa1">
|
|
61
|
-
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/25728410/avatar.png" width="200px;" alt=""/></div>
|
|
62
|
-
<small>Catia Costa</small>
|
|
63
|
-
<div><a href="#a11y-catia.costa1" title="Accessibility">️️️️♿️</a> <a href="#code-catia.costa1" title="Code">💻</a> <a href="#doc-catia.costa1" title="Documentation">📖</a> <a href="#test-catia.costa1" title="Tests">⚠️</a></div>
|
|
64
|
-
</a></td>
|
|
65
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/chris.latimer">
|
|
66
|
-
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/10570471/avatar.png" width="200px;" alt=""/></div>
|
|
67
|
-
<small>Chris Latimer</small>
|
|
68
|
-
<div><a href="#infra-chris.latimer" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#code-chris.latimer" title="Code">💻</a></div>
|
|
69
|
-
</a></td>
|
|
70
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/craig.mckay">
|
|
71
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
72
|
-
<small>Craig Mckay</small>
|
|
73
|
-
<div><a href="#projectManagement-craig.mckay" title="Project Management">📆</a></div>
|
|
74
|
-
</a></td>
|
|
75
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/daniel.lippross">
|
|
76
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
77
|
-
<small>Daniel Lippross</small>
|
|
78
|
-
<div><a href="#platform-daniel.lippross" title="Packaging/porting to new platform">📦</a></div>
|
|
79
|
-
</a></td>
|
|
80
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/emalin.matthews">
|
|
81
|
-
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-UMGDXU8JH-ade541a7f09e-150" width="200px;" alt=""/></div>
|
|
82
|
-
<small>Emalin Matthews</small>
|
|
83
|
-
<div><a href="#a11y-emalin.matthews" title="Accessibility">️️️️♿️</a> <a href="#code-emalin.matthews" title="Code">💻</a> <a href="#doc-emalin.matthews" title="Documentation">📖</a> <a href="#test-emalin.matthews" title="Tests">⚠️</a></div>
|
|
84
|
-
</a></td>
|
|
85
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/jelena.milosevic">
|
|
86
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
87
|
-
<small>Jelena Milosevic</small>
|
|
88
|
-
<div><a href="#infra-jelena.milosevic" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></div>
|
|
89
|
-
</a></td>
|
|
90
|
-
</tr><br />
|
|
91
|
-
<tr>
|
|
92
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/kamini.pagare">
|
|
93
|
-
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/23337489/avatar.png" width="200px;" alt=""/></div>
|
|
94
|
-
<small>Kamini Pagare</small>
|
|
95
|
-
<div><a href="#a11y-kamini.pagare" title="Accessibility">️️️️♿️</a> <a href="#code-kamini.pagare" title="Code">💻</a> <a href="#doc-kamini.pagare" title="Documentation">📖</a> <a href="#test-kamini.pagare" title="Tests">⚠️</a></div>
|
|
96
|
-
</a></td>
|
|
97
|
-
<td align="center" valign="top" width="14.28%"><a href="">
|
|
98
|
-
<div><img src="https://ca.slack-edge.com/T0C9E3ZF0-U3AJ40BGS-ec515dc443cb-150" width="200px;" alt=""/></div>
|
|
99
|
-
<small>Lee Connolly</small>
|
|
100
|
-
<div><a href="#projectManagement-lee.connolly" title="Project Management">📆</a></div>
|
|
101
|
-
</a></td>
|
|
102
|
-
<td align="center" valign="top" width="14.28%"><a href="">
|
|
103
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
104
|
-
<small>Liam Hall</small>
|
|
105
|
-
<div><a href="#projectManagement-liam.hall" title="Project Management">📆</a></div>
|
|
106
|
-
</a></td>
|
|
107
|
-
<td align="center" valign="top" width="14.28%"><a href="">
|
|
108
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/meg.jpg" width="200px;" alt=""/></div>
|
|
109
|
-
<small>Meg White</small>
|
|
110
|
-
<div><a href="#projectManagement-meg.white" title="Project Management">📆</a></div>
|
|
111
|
-
</a></td>
|
|
112
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/omid.kashan">
|
|
113
|
-
<div><img src="https://secure.gravatar.com/avatar/faf90b70d749cf9460eb603fa1700add94fd7d3a32645b4be6fa12eb45c4ffa3?s=80&d=identicon" width="200px;" alt=""/></div>
|
|
114
|
-
<small>Omid Kashan</small>
|
|
115
|
-
<div><a href="#a11y-omid.kashan" title="Accessibility">️️️️♿️</a> <a href="#code-omid.kashan" title="Code">💻</a> <a href="#doc-omid.kashan" title="Documentation">📖</a> <a href="#test-omid.kashan" title="Tests">⚠️</a></div>
|
|
116
|
-
</a></td>
|
|
117
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/phil.wolstenholme">
|
|
118
|
-
<div><img src="https://gitlab.com/uploads/-/system/user/avatar/25900363/avatar.png" width="200px;" alt=""/></div>
|
|
119
|
-
<small>Phil Wolstenholme</small>
|
|
120
|
-
<div><a href="#a11y-phil.wolstenholme" title="Accessibility">️️️️♿️</a></div>
|
|
121
|
-
</a></td>
|
|
122
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/romain.chen">
|
|
123
|
-
<div><img src="https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/blank.jpg" width="200px;" alt=""/></div>
|
|
124
|
-
<small>Romain Chen</small>
|
|
125
|
-
<div><a href="#design-romain.chen" title="Design">🎨</a></div>
|
|
126
|
-
</a></td>
|
|
127
|
-
</tr><br />
|
|
128
|
-
<tr>
|
|
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="#code-sam.harden" title="Code">💻</a> <a href="#doc-sam.harden" title="Documentation">📖</a> <a href="#test-sam.harden" 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
|
-
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/theodore.kouzelis">
|
|
140
|
-
<div><img src="https://secure.gravatar.com/avatar/3988f940029d9053174ac68e7f5bfa8fd61f184872d46281f44e2e698711d37d?s=80&d=identicon" width="200px;" alt=""/></div>
|
|
141
|
-
<small>Theo Kouzelis</small>
|
|
142
|
-
<div><a href="#a11y-theodore.kouzelis" title="Accessibility">️️️️♿️</a> <a href="#code-theodore.kouzelis" title="Code">💻</a> <a href="#doc-theodore.kouzelis" title="Documentation">📖</a> <a href="#test-theodore.kouzelis" title="Tests">⚠️</a></div>
|
|
143
|
-
</a></td>
|
|
144
|
-
</tr>
|
|
145
|
-
</tbody></table>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<!-- markdownlint-restore -->
|
|
149
|
-
<!-- prettier-ignore-end -->
|
|
150
|
-
|
|
151
|
-
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
152
|
-
|
|
153
|
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
|
|
154
|
-
|
|
155
42
|
## License
|
|
156
43
|
|
|
157
44
|
MIT License
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import type { HTMLAttributes, JSX, ReactNode } from "react";
|
|
2
2
|
export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/** **(Optional)**
|
|
3
|
+
/** **(Optional)** Main content inside the banner. It can be any valid JSX or string. */
|
|
4
4
|
children?: string | ReactNode;
|
|
5
|
-
/** **(Optional)**
|
|
5
|
+
/** **(Optional)** Additional CSS classes to be applied to the component. */
|
|
6
6
|
className?: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Main title of the banner, rendered as a `h2`. */
|
|
8
8
|
heading: string;
|
|
9
|
-
/** **(Optional)**
|
|
9
|
+
/** **(Optional)** Specify which banner variant to use. */
|
|
10
10
|
variant?: "black" | "default";
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* The Alert Banner component is used to highlight events that might limit availability of a service we provide.
|
|
14
|
-
* <br />
|
|
15
|
-
* - the service the user is trying to access is experiencing problems
|
|
16
|
-
* - planned system maintenance is coming soon
|
|
17
|
-
* - the user’s login session is about to expire
|
|
18
|
-
* <br />
|
|
19
|
-
* <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
12
|
export declare const AlertBanner: ({ children, className, heading, variant, ...props }: AlertBannerProps) => JSX.Element;
|
|
23
13
|
export default AlertBanner;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* The Alert Banner component is used to highlight events that might limit availability of a service we provide.
|
|
6
|
-
* <br />
|
|
7
|
-
* - the service the user is trying to access is experiencing problems
|
|
8
|
-
* - planned system maintenance is coming soon
|
|
9
|
-
* - the user’s login session is about to expire
|
|
10
|
-
* <br />
|
|
11
|
-
* <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
4
|
const AlertBanner = (_a) => {
|
|
15
5
|
var { children, className = "", heading, variant = "default" } = _a, props = __rest(_a, ["children", "className", "heading", "variant"]);
|
|
16
6
|
const componentProps = Object.assign({ className: `coop-alert-banner ${className}`, "data-variant": variant }, props);
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { HTMLAttributes, JSX } from "react";
|
|
2
2
|
import { ImageProps } from "../Image";
|
|
3
3
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** **(Optional)**
|
|
4
|
+
/** **(Optional)** Specify the content author. */
|
|
5
5
|
author?: string;
|
|
6
|
-
/** **(Optional)**
|
|
6
|
+
/** **(Optional)** Additional CSS classes to be applied to the component. */
|
|
7
7
|
className?: string;
|
|
8
|
-
/** **(Optional)**
|
|
8
|
+
/** **(Optional)** Specify the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
9
9
|
date?: string;
|
|
10
|
-
/** **(Optional)**
|
|
10
|
+
/** **(Optional)** Specify the text that will prefix the date, e.g. "Published". */
|
|
11
11
|
datePrefix?: string;
|
|
12
|
-
/** **(Optional)**
|
|
12
|
+
/** **(Optional)** Specify Image properties of the Author avatar. */
|
|
13
13
|
image?: ImageProps;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Author is a component that can be used inside any article or Card component to communicate respective author and date of publication.
|
|
17
|
-
*/
|
|
18
15
|
export declare const Author: ({ author, className, date, datePrefix, image, ...props }: AuthorProps) => JSX.Element;
|
|
19
16
|
export default Author;
|
|
@@ -2,9 +2,6 @@ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Image } from '../Image/Image.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Author is a component that can be used inside any article or Card component to communicate respective author and date of publication.
|
|
7
|
-
*/
|
|
8
5
|
const Author = (_a) => {
|
|
9
6
|
var { author = "Co-op team", className = "", date, datePrefix = "", image = {
|
|
10
7
|
alt: "",
|
|
@@ -24,8 +24,5 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
24
24
|
/** **(Optional)** Specifies the Button variant. */
|
|
25
25
|
variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost" | "text";
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
* The Button component is an interactive element that people can use to take an action.
|
|
29
|
-
*/
|
|
30
27
|
export declare const Button: ({ as, children, className, href, isDisabled, isFullWidth, isLoading, loadingText, onClick, size, variant, ...props }: ButtonProps) => JSX.Element;
|
|
31
28
|
export default Button;
|
|
@@ -3,9 +3,6 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import React, { useState, useCallback } from 'react';
|
|
4
4
|
import { LoadingIcon } from '../Icon/LoadingIcon.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The Button component is an interactive element that people can use to take an action.
|
|
8
|
-
*/
|
|
9
6
|
const Button = (_a) => {
|
|
10
7
|
var { as, children, className = "", href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, size = "md", variant = "green" } = _a, props = __rest(_a, ["as", "children", "className", "href", "isDisabled", "isFullWidth", "isLoading", "loadingText", "onClick", "size", "variant"]);
|
|
11
8
|
let element = href ? "a" : "button";
|
|
@@ -34,8 +34,5 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
34
34
|
/** **(Optional)** Specifies the layout of the Card */
|
|
35
35
|
layout?: "vertical" | "horizontal";
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* A Card lets you highlight and link to more in-depth content on another page. The component typically includes a heading, image, and an optional description.
|
|
39
|
-
*/
|
|
40
37
|
export declare const Card: ({ as, background, badge, badgePosition, chevron, children, className, heading, headingLevel, href, image, imagePosition, label, labelBackground, layout, ...props }: CardProps) => JSX.Element;
|
|
41
38
|
export default Card;
|
|
@@ -18,9 +18,6 @@ function getCardLinkElement(as, href) {
|
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* A Card lets you highlight and link to more in-depth content on another page. The component typically includes a heading, image, and an optional description.
|
|
23
|
-
*/
|
|
24
21
|
const Card = (_a) => {
|
|
25
22
|
var { as, background, badge, badgePosition = "inset", chevron = false, children, className = "", heading, headingLevel = "h3", href, image, imagePosition = "left", label = "", labelBackground, layout = "vertical" } = _a, props = __rest(_a, ["as", "background", "badge", "badgePosition", "chevron", "children", "className", "heading", "headingLevel", "href", "image", "imagePosition", "label", "labelBackground", "layout"]);
|
|
26
23
|
const linkElement = getCardLinkElement(as, href);
|
|
@@ -10,9 +10,5 @@ export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElemen
|
|
|
10
10
|
/** Specifies summary for this component. It can be any valid JSX or string. */
|
|
11
11
|
summary: React.ReactNode;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
15
|
-
* It can be used to reveal more context for a specific issue or action.
|
|
16
|
-
*/
|
|
17
13
|
export declare const Expandable: ({ background, children, className, summary, ...props }: ExpandableProps) => JSX.Element;
|
|
18
14
|
export default Expandable;
|
|
@@ -3,10 +3,6 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
4
4
|
import { bgPropToClass } from '../../utils/index.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
8
|
-
* It can be used to reveal more context for a specific issue or action.
|
|
9
|
-
*/
|
|
10
6
|
const Expandable = (_a) => {
|
|
11
7
|
var { background = "tint-grey", children, className = "", summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
|
|
12
8
|
const componentProps = Object.assign({ className: clsx("coop-expandable", bgPropToClass(background, className), className) }, props);
|
|
@@ -11,8 +11,5 @@ export interface ImageProps extends HTMLAttributes<HTMLImageElement> {
|
|
|
11
11
|
/** **(Optional)** Specifies width of the Image */
|
|
12
12
|
width?: string;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* A wrapper around the image HTML tag, to help implement best practices like lazy loading, and assist with cropping and sizing images.
|
|
16
|
-
*/
|
|
17
14
|
export declare const Image: ({ alt, crop, height, src, width, ...props }: ImageProps) => JSX.Element;
|
|
18
15
|
export default Image;
|
|
@@ -21,9 +21,6 @@ const getContentfulParams = (src, width, height) => {
|
|
|
21
21
|
width: (_b = url.searchParams.get("w")) !== null && _b !== void 0 ? _b : width,
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
25
|
-
* A wrapper around the image HTML tag, to help implement best practices like lazy loading, and assist with cropping and sizing images.
|
|
26
|
-
*/
|
|
27
24
|
const Image = (_a) => {
|
|
28
25
|
var { alt, crop, height, src, width = "640" } = _a, props = __rest(_a, ["alt", "crop", "height", "src", "width"]);
|
|
29
26
|
let params = { height, src, width };
|
|
@@ -19,8 +19,5 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
19
19
|
/** **(Optional)** Specifies what should be the Pill size. */
|
|
20
20
|
size?: "sm" | "md" | "lg" | "xl";
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* The Pill component is a small, sligtly rounded label used to link and highlight information such as categories or articles. It can be customised with different content and styles to suit various use cases.
|
|
24
|
-
*/
|
|
25
22
|
export declare const Pill: ({ as, background, badge, badgeBackground, children, className, href, size, ...props }: PillProps) => JSX.Element;
|
|
26
23
|
export default Pill;
|
|
@@ -4,9 +4,6 @@ import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { bgPropToClass } from '../../utils/index.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* The Pill component is a small, sligtly rounded label used to link and highlight information such as categories or articles. It can be customised with different content and styles to suit various use cases.
|
|
9
|
-
*/
|
|
10
7
|
const Pill = (_a) => {
|
|
11
8
|
var { as, background = "tint-grey", badge, badgeBackground = "offers-red", children, className = "", href, size = "md" } = _a, props = __rest(_a, ["as", "background", "badge", "badgeBackground", "children", "className", "href", "size"]);
|
|
12
9
|
let element = href ? "a" : "span";
|
|
@@ -27,22 +27,5 @@ export interface SearchBoxProps extends HTMLAttributes<HTMLInputElement> {
|
|
|
27
27
|
/** **(Optional)** Receives the variant to be applied to SearchBox component. */
|
|
28
28
|
variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost";
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* SearchBox component allows a person to enter a word or a phrase to find relevant content.
|
|
32
|
-
*
|
|
33
|
-
* The `label` prop is mandatory but not visible by default (it is visible for screen readers). You can make it visible to humans by setting `labelVisible` to true.
|
|
34
|
-
*
|
|
35
|
-
* If you are using a single icon with no text for `button.label`, ensure you pass an `alt` property to the icon for accessibility purposes.
|
|
36
|
-
*
|
|
37
|
-
* You can provide an `action` to submit input like a normal HTML form, or an `onSubmit` callback to handle submissions client-side.
|
|
38
|
-
*
|
|
39
|
-
* **Good to know:** SearchBox requires both `SearchBox` and `Button` css/scss files.
|
|
40
|
-
*
|
|
41
|
-
* ```
|
|
42
|
-
* import "@coopdigital/styles/components/Searchbox.css"
|
|
43
|
-
* import "@coopdigital/styles/components/Button.css"
|
|
44
|
-
*
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
30
|
export declare const SearchBox: ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize, autoComplete, button, className, label, labelVisible, name, onSubmit, placeholder, size, variant, ...props }: SearchBoxProps) => JSX.Element;
|
|
48
31
|
export default SearchBox;
|
|
@@ -8,23 +8,6 @@ const defaultButtonProps = {
|
|
|
8
8
|
label: React.createElement(SearchIcon, { alt: "Search", stroke: "currentColor", strokeWidth: 2 }),
|
|
9
9
|
loadingText: "",
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* SearchBox component allows a person to enter a word or a phrase to find relevant content.
|
|
13
|
-
*
|
|
14
|
-
* The `label` prop is mandatory but not visible by default (it is visible for screen readers). You can make it visible to humans by setting `labelVisible` to true.
|
|
15
|
-
*
|
|
16
|
-
* If you are using a single icon with no text for `button.label`, ensure you pass an `alt` property to the icon for accessibility purposes.
|
|
17
|
-
*
|
|
18
|
-
* You can provide an `action` to submit input like a normal HTML form, or an `onSubmit` callback to handle submissions client-side.
|
|
19
|
-
*
|
|
20
|
-
* **Good to know:** SearchBox requires both `SearchBox` and `Button` css/scss files.
|
|
21
|
-
*
|
|
22
|
-
* ```
|
|
23
|
-
* import "@coopdigital/styles/components/Searchbox.css"
|
|
24
|
-
* import "@coopdigital/styles/components/Button.css"
|
|
25
|
-
*
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
11
|
const SearchBox = (_a) => {
|
|
29
12
|
var _b, _c;
|
|
30
13
|
var { action, "aria-placeholder": ariaPlaceholder, autoCapitalize = "off", autoComplete = "off", button = defaultButtonProps, className, label, labelVisible = false, name = "query", onSubmit, placeholder, size = "md", variant = "green" } = _a, props = __rest(_a, ["action", "aria-placeholder", "autoCapitalize", "autoComplete", "button", "className", "label", "labelVisible", "name", "onSubmit", "placeholder", "size", "variant"]);
|
|
@@ -15,8 +15,5 @@ export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
/** **(Optional)** Specifies the image URL and alt text of the Signpost */
|
|
16
16
|
image?: ImageProps;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Signposts allow you to create links to permanent content you think people are looking for.
|
|
20
|
-
*/
|
|
21
18
|
export declare const Signpost: ({ as, children, className, headingLevel, href, image, ...props }: SignpostProps) => JSX.Element;
|
|
22
19
|
export default Signpost;
|
|
@@ -3,9 +3,6 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Image } from '../Image/Image.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Signposts allow you to create links to permanent content you think people are looking for.
|
|
8
|
-
*/
|
|
9
6
|
const Signpost = (_a) => {
|
|
10
7
|
var { as, children, className = "", headingLevel = "h3", href, image } = _a, props = __rest(_a, ["as", "children", "className", "headingLevel", "href", "image"]);
|
|
11
8
|
let element = "a";
|
|
@@ -14,22 +14,5 @@ export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
* Defaults to a single link anchored to `#main` */
|
|
15
15
|
links?: SkipNavLink[];
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* The Skip Nav component allows screen reader and keyboard users to go directly to the main content.
|
|
19
|
-
*
|
|
20
|
-
* ### Links
|
|
21
|
-
* Links within the skip navigation component should take the user directly to the main areas of the page. These are usually the:
|
|
22
|
-
* - navigation
|
|
23
|
-
* - main content
|
|
24
|
-
* - footer
|
|
25
|
-
* - search (if applicable)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* ### Using skip navigation on a page
|
|
29
|
-
* - The skip navigation function should be the first thing that appears on a page when it has loaded and a user presses the tab key.
|
|
30
|
-
* - Pressing the tab key again should then cycle through 'skip to main content', 'skip to navigation' and 'skip to footer' links.
|
|
31
|
-
* - Pressing enter will take the user to the correct part of the page and apply the focus ring to the first interactive element in that section.
|
|
32
|
-
* - If the user tabs through the skip navigation without selecting an option the Co‑op logo should be the next element that has the focus ring applied.
|
|
33
|
-
*/
|
|
34
17
|
export declare const SkipNav: ({ className, isVisible, links, ...props }: SkipNavProps) => JSX.Element;
|
|
35
18
|
export default SkipNav;
|
|
@@ -2,23 +2,6 @@ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
const defaultLinks = [{ href: "#main", label: "Skip to main content" }];
|
|
5
|
-
/**
|
|
6
|
-
* The Skip Nav component allows screen reader and keyboard users to go directly to the main content.
|
|
7
|
-
*
|
|
8
|
-
* ### Links
|
|
9
|
-
* Links within the skip navigation component should take the user directly to the main areas of the page. These are usually the:
|
|
10
|
-
* - navigation
|
|
11
|
-
* - main content
|
|
12
|
-
* - footer
|
|
13
|
-
* - search (if applicable)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* ### Using skip navigation on a page
|
|
17
|
-
* - The skip navigation function should be the first thing that appears on a page when it has loaded and a user presses the tab key.
|
|
18
|
-
* - Pressing the tab key again should then cycle through 'skip to main content', 'skip to navigation' and 'skip to footer' links.
|
|
19
|
-
* - Pressing enter will take the user to the correct part of the page and apply the focus ring to the first interactive element in that section.
|
|
20
|
-
* - If the user tabs through the skip navigation without selecting an option the Co‑op logo should be the next element that has the focus ring applied.
|
|
21
|
-
*/
|
|
22
5
|
const SkipNav = (_a) => {
|
|
23
6
|
var { className = "", isVisible = false, links = defaultLinks } = _a, props = __rest(_a, ["className", "isVisible", "links"]);
|
|
24
7
|
const componentProps = Object.assign({ className: `coop-skip-nav ${className}` }, props);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { JSX } from "react";
|
|
1
|
+
import type { HTMLAttributes, JSX } from "react";
|
|
2
2
|
import { CoopBlue, Green, OffersRed } from "../../types/colors";
|
|
3
|
-
export interface SquircleProps {
|
|
3
|
+
export interface SquircleProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/** **(Optional)** Specifies the background color of the Squircle. */
|
|
5
5
|
background?: OffersRed | CoopBlue | Green;
|
|
6
6
|
/** **(Optional)** Represents the content inside the Squircle component. It can be any valid JSX or string. */
|
|
@@ -10,8 +10,5 @@ export interface SquircleProps {
|
|
|
10
10
|
/** **(Optional)** Specifies what should be the Squircle size */
|
|
11
11
|
size?: "sm" | "md" | "lg";
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Squircle to use on components like Cards, etc.
|
|
15
|
-
*/
|
|
16
13
|
export declare const Squircle: ({ background, children, className, size, ...props }: SquircleProps) => JSX.Element;
|
|
17
14
|
export default Squircle;
|
|
@@ -2,9 +2,6 @@ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { bgPropToClass } from '../../utils/index.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Squircle to use on components like Cards, etc.
|
|
7
|
-
*/
|
|
8
5
|
const Squircle = (_a) => {
|
|
9
6
|
var { background = "offers-red", children, className, size = "lg" } = _a, props = __rest(_a, ["background", "children", "className", "size"]);
|
|
10
7
|
const componentProps = Object.assign({ className: `coop-squircle ${bgPropToClass(background, className)} ${className !== null && className !== void 0 ? className : ""}`, "data-size": size.length && size !== "lg" ? size : undefined }, props);
|
|
@@ -13,15 +13,5 @@ export interface TagProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
13
13
|
/** **(Optional)** Specifies the URL that the Tag component will link to when clicked. */
|
|
14
14
|
href?: string;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Tag is a simple component that is meant to communicate a brief message such as categories.
|
|
18
|
-
*
|
|
19
|
-
* It has similarities with Pill component but also has differences such as:
|
|
20
|
-
* - Tag doesn't accept a badge option
|
|
21
|
-
* - Tags have more rounded corners compared to Pill
|
|
22
|
-
* - Tags are more compact compared to Pill
|
|
23
|
-
* - Tag components should be used as tags to communicate brief message while Pill component is more versatile and has more styling options
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
16
|
export declare const Tag: ({ as, background, children, className, href, ...props }: TagProps) => JSX.Element;
|
|
27
17
|
export default Tag;
|
|
@@ -3,16 +3,6 @@ import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { bgPropToClass } from '../../utils/index.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Tag is a simple component that is meant to communicate a brief message such as categories.
|
|
8
|
-
*
|
|
9
|
-
* It has similarities with Pill component but also has differences such as:
|
|
10
|
-
* - Tag doesn't accept a badge option
|
|
11
|
-
* - Tags have more rounded corners compared to Pill
|
|
12
|
-
* - Tags are more compact compared to Pill
|
|
13
|
-
* - Tag components should be used as tags to communicate brief message while Pill component is more versatile and has more styling options
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
6
|
const Tag = (_a) => {
|
|
17
7
|
var { as, background = "tint-grey", children, className = "", href } = _a, props = __rest(_a, ["as", "background", "children", "className", "href"]);
|
|
18
8
|
let element = href ? "a" : "span";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"test:e2e:ui": "npx playwright test --ui",
|
|
39
39
|
"test:e2e:ci": "npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL",
|
|
40
40
|
"build": "tsx scripts build",
|
|
41
|
+
"build:docs": "tsx scripts build-docs",
|
|
41
42
|
"build:icons": "tsx scripts build-icons",
|
|
42
43
|
"build:storybook": "storybook build --disable-telemetry && npm run storybook:fix-paths",
|
|
43
44
|
"storybook": "storybook dev -p 6006",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"description": "",
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@axe-core/playwright": "^4.10.1",
|
|
52
|
-
"@coopdigital/styles": "^0.16.
|
|
53
|
+
"@coopdigital/styles": "^0.16.4",
|
|
53
54
|
"@playwright/test": "^1.52.0",
|
|
54
55
|
"@storybook/addon-a11y": "^8.6.12",
|
|
55
56
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -74,5 +75,5 @@
|
|
|
74
75
|
"dependencies": {
|
|
75
76
|
"clsx": "^2.1.1"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "7d7bc474a5da58c536c9579eec660106366f73ee"
|
|
78
79
|
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import type { HTMLAttributes, JSX, ReactNode } from "react"
|
|
2
2
|
|
|
3
3
|
export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** **(Optional)**
|
|
4
|
+
/** **(Optional)** Main content inside the banner. It can be any valid JSX or string. */
|
|
5
5
|
children?: string | ReactNode
|
|
6
|
-
/** **(Optional)**
|
|
6
|
+
/** **(Optional)** Additional CSS classes to be applied to the component. */
|
|
7
7
|
className?: string
|
|
8
|
-
/**
|
|
8
|
+
/** Main title of the banner, rendered as a `h2`. */
|
|
9
9
|
heading: string
|
|
10
|
-
/** **(Optional)**
|
|
10
|
+
/** **(Optional)** Specify which banner variant to use. */
|
|
11
11
|
variant?: "black" | "default"
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* The Alert Banner component is used to highlight events that might limit availability of a service we provide.
|
|
16
|
-
* <br />
|
|
17
|
-
* - the service the user is trying to access is experiencing problems
|
|
18
|
-
* - planned system maintenance is coming soon
|
|
19
|
-
* - the user’s login session is about to expire
|
|
20
|
-
* <br />
|
|
21
|
-
* <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
14
|
export const AlertBanner = ({
|
|
25
15
|
children,
|
|
26
16
|
className = "",
|
|
@@ -3,22 +3,18 @@ import type { HTMLAttributes, JSX } from "react"
|
|
|
3
3
|
import { Image, ImageProps } from "../Image"
|
|
4
4
|
|
|
5
5
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
/** **(Optional)**
|
|
6
|
+
/** **(Optional)** Specify the content author. */
|
|
7
7
|
author?: string
|
|
8
|
-
/** **(Optional)**
|
|
8
|
+
/** **(Optional)** Additional CSS classes to be applied to the component. */
|
|
9
9
|
className?: string
|
|
10
|
-
/** **(Optional)**
|
|
10
|
+
/** **(Optional)** Specify the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
11
11
|
date?: string
|
|
12
|
-
/** **(Optional)**
|
|
12
|
+
/** **(Optional)** Specify the text that will prefix the date, e.g. "Published". */
|
|
13
13
|
datePrefix?: string
|
|
14
|
-
/** **(Optional)**
|
|
14
|
+
/** **(Optional)** Specify Image properties of the Author avatar. */
|
|
15
15
|
image?: ImageProps
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Author is a component that can be used inside any article or Card component to communicate respective author and date of publication.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
18
|
export const Author = ({
|
|
23
19
|
author = "Co-op team",
|
|
24
20
|
className = "",
|
|
@@ -48,9 +48,6 @@ type OnClickHandler =
|
|
|
48
48
|
| React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>
|
|
49
49
|
| ((event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => Promise<void>)
|
|
50
50
|
|
|
51
|
-
/**
|
|
52
|
-
* The Button component is an interactive element that people can use to take an action.
|
|
53
|
-
*/
|
|
54
51
|
export const Button = ({
|
|
55
52
|
as,
|
|
56
53
|
children,
|
|
@@ -58,9 +58,6 @@ function getCardLinkElement(as: CardProps["as"], href?: string) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
* A Card lets you highlight and link to more in-depth content on another page. The component typically includes a heading, image, and an optional description.
|
|
63
|
-
*/
|
|
64
61
|
export const Card = ({
|
|
65
62
|
as,
|
|
66
63
|
background,
|
|
@@ -16,11 +16,6 @@ export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElemen
|
|
|
16
16
|
summary: React.ReactNode
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
21
|
-
* It can be used to reveal more context for a specific issue or action.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
19
|
export const Expandable = ({
|
|
25
20
|
background = "tint-grey",
|
|
26
21
|
children,
|
|
@@ -34,9 +34,6 @@ const getContentfulParams = (src: string, width: string, height: string | undefi
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* A wrapper around the image HTML tag, to help implement best practices like lazy loading, and assist with cropping and sizing images.
|
|
39
|
-
*/
|
|
40
37
|
export const Image = ({
|
|
41
38
|
alt,
|
|
42
39
|
crop,
|
|
@@ -26,9 +26,6 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
26
26
|
size?: "sm" | "md" | "lg" | "xl"
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* The Pill component is a small, sligtly rounded label used to link and highlight information such as categories or articles. It can be customised with different content and styles to suit various use cases.
|
|
31
|
-
*/
|
|
32
29
|
export const Pill = ({
|
|
33
30
|
as,
|
|
34
31
|
background = "tint-grey",
|
|
@@ -42,23 +42,6 @@ const defaultButtonProps: SearchBoxProps["button"] = {
|
|
|
42
42
|
loadingText: "",
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* SearchBox component allows a person to enter a word or a phrase to find relevant content.
|
|
47
|
-
*
|
|
48
|
-
* The `label` prop is mandatory but not visible by default (it is visible for screen readers). You can make it visible to humans by setting `labelVisible` to true.
|
|
49
|
-
*
|
|
50
|
-
* If you are using a single icon with no text for `button.label`, ensure you pass an `alt` property to the icon for accessibility purposes.
|
|
51
|
-
*
|
|
52
|
-
* You can provide an `action` to submit input like a normal HTML form, or an `onSubmit` callback to handle submissions client-side.
|
|
53
|
-
*
|
|
54
|
-
* **Good to know:** SearchBox requires both `SearchBox` and `Button` css/scss files.
|
|
55
|
-
*
|
|
56
|
-
* ```
|
|
57
|
-
* import "@coopdigital/styles/components/Searchbox.css"
|
|
58
|
-
* import "@coopdigital/styles/components/Button.css"
|
|
59
|
-
*
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
45
|
export const SearchBox = ({
|
|
63
46
|
action,
|
|
64
47
|
"aria-placeholder": ariaPlaceholder,
|
|
@@ -20,10 +20,6 @@ export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
image?: ImageProps
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Signposts allow you to create links to permanent content you think people are looking for.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
23
|
export const Signpost = ({
|
|
28
24
|
as,
|
|
29
25
|
children,
|
|
@@ -19,23 +19,6 @@ export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
19
|
|
|
20
20
|
const defaultLinks = [{ href: "#main", label: "Skip to main content" }]
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* The Skip Nav component allows screen reader and keyboard users to go directly to the main content.
|
|
24
|
-
*
|
|
25
|
-
* ### Links
|
|
26
|
-
* Links within the skip navigation component should take the user directly to the main areas of the page. These are usually the:
|
|
27
|
-
* - navigation
|
|
28
|
-
* - main content
|
|
29
|
-
* - footer
|
|
30
|
-
* - search (if applicable)
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* ### Using skip navigation on a page
|
|
34
|
-
* - The skip navigation function should be the first thing that appears on a page when it has loaded and a user presses the tab key.
|
|
35
|
-
* - Pressing the tab key again should then cycle through 'skip to main content', 'skip to navigation' and 'skip to footer' links.
|
|
36
|
-
* - Pressing enter will take the user to the correct part of the page and apply the focus ring to the first interactive element in that section.
|
|
37
|
-
* - If the user tabs through the skip navigation without selecting an option the Co‑op logo should be the next element that has the focus ring applied.
|
|
38
|
-
*/
|
|
39
22
|
export const SkipNav = ({
|
|
40
23
|
className = "",
|
|
41
24
|
isVisible = false,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { JSX } from "react"
|
|
1
|
+
import type { HTMLAttributes, JSX } from "react"
|
|
2
2
|
|
|
3
3
|
import { bgPropToClass } from "../../../src/utils"
|
|
4
4
|
import { CoopBlue, Green, OffersRed } from "../../types/colors"
|
|
5
5
|
|
|
6
|
-
export interface SquircleProps {
|
|
6
|
+
export interface SquircleProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
/** **(Optional)** Specifies the background color of the Squircle. */
|
|
8
8
|
background?: OffersRed | CoopBlue | Green
|
|
9
9
|
/** **(Optional)** Represents the content inside the Squircle component. It can be any valid JSX or string. */
|
|
@@ -14,10 +14,6 @@ export interface SquircleProps {
|
|
|
14
14
|
size?: "sm" | "md" | "lg"
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Squircle to use on components like Cards, etc.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
17
|
export const Squircle = ({
|
|
22
18
|
background = "offers-red",
|
|
23
19
|
children,
|
|
@@ -21,17 +21,6 @@ export interface TagProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
21
21
|
href?: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Tag is a simple component that is meant to communicate a brief message such as categories.
|
|
26
|
-
*
|
|
27
|
-
* It has similarities with Pill component but also has differences such as:
|
|
28
|
-
* - Tag doesn't accept a badge option
|
|
29
|
-
* - Tags have more rounded corners compared to Pill
|
|
30
|
-
* - Tags are more compact compared to Pill
|
|
31
|
-
* - Tag components should be used as tags to communicate brief message while Pill component is more versatile and has more styling options
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
24
|
export const Tag = ({
|
|
36
25
|
as,
|
|
37
26
|
background = "tint-grey",
|