@coopdigital/react 0.15.0 → 0.17.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/dist/components/AlertBanner/AlertBanner.d.ts +1 -3
- package/dist/components/AlertBanner/AlertBanner.js +2 -2
- package/dist/components/Author/Author.d.ts +3 -1
- package/dist/components/Author/Author.js +4 -3
- package/dist/components/Button/Button.d.ts +1 -3
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Card/Card.d.ts +3 -1
- package/dist/components/Card/Card.js +2 -2
- package/dist/components/Expandable/Expandable.d.ts +2 -0
- package/dist/components/Expandable/Expandable.js +1 -1
- package/dist/components/Icon/AddIcon.d.ts +1 -0
- package/dist/components/Icon/ArrowDownIcon.d.ts +1 -0
- package/dist/components/Icon/ArrowLeftIcon.d.ts +1 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +1 -0
- package/dist/components/Icon/ArrowUpIcon.d.ts +1 -0
- package/dist/components/Icon/AvatarAltIcon.d.ts +1 -0
- package/dist/components/Icon/AvatarIcon.d.ts +1 -0
- package/dist/components/Icon/BasketIcon.d.ts +1 -0
- package/dist/components/Icon/CalendarIcon.d.ts +1 -0
- package/dist/components/Icon/ChevronDownIcon.d.ts +1 -0
- package/dist/components/Icon/ChevronLeftIcon.d.ts +1 -0
- package/dist/components/Icon/ChevronRightIcon.d.ts +1 -0
- package/dist/components/Icon/ChevronUpIcon.d.ts +1 -0
- package/dist/components/Icon/ClockIcon.d.ts +1 -0
- package/dist/components/Icon/CloseAltIcon.d.ts +1 -0
- package/dist/components/Icon/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/CoopCardIcon.d.ts +1 -0
- package/dist/components/Icon/CoopIcon.d.ts +1 -0
- package/dist/components/Icon/CoopLocationIcon.d.ts +1 -0
- package/dist/components/Icon/DownloadIcon.d.ts +1 -0
- package/dist/components/Icon/HomeIcon.d.ts +1 -0
- package/dist/components/Icon/InformationIcon.d.ts +1 -0
- package/dist/components/Icon/LocationIcon.d.ts +1 -0
- package/dist/components/Icon/MailIcon.d.ts +1 -0
- package/dist/components/Icon/MenuIcon.d.ts +1 -0
- package/dist/components/Icon/MessageIcon.d.ts +1 -0
- package/dist/components/Icon/MinusIcon.d.ts +1 -0
- package/dist/components/Icon/OpenNewIcon.d.ts +1 -0
- package/dist/components/Icon/PencilIcon.d.ts +1 -0
- package/dist/components/Icon/PhoneIcon.d.ts +1 -0
- package/dist/components/Icon/QuestionIcon.d.ts +1 -0
- package/dist/components/Icon/ScooterIcon.d.ts +1 -0
- package/dist/components/Icon/SearchIcon.d.ts +1 -0
- package/dist/components/Icon/SettingsIcon.d.ts +1 -0
- package/dist/components/Icon/TickAltIcon.d.ts +1 -0
- package/dist/components/Icon/TickIcon.d.ts +1 -0
- package/dist/components/Icon/VanIcon.d.ts +1 -0
- package/dist/components/Icon/WarningIcon.d.ts +1 -0
- package/dist/components/Icon/WriteIcon.d.ts +1 -0
- package/dist/components/Icon/index.d.ts +39 -0
- package/dist/components/Pill/Pill.d.ts +1 -3
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/RootSVG/RootSVG.d.ts +2 -1
- package/dist/components/RootSVG/RootSVG.js +3 -3
- package/dist/components/Signpost/Signpost.d.ts +5 -3
- package/dist/components/Signpost/Signpost.js +5 -2
- package/dist/components/SkipNav/SkipNav.d.ts +3 -5
- package/dist/components/SkipNav/SkipNav.js +3 -3
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/components/AlertBanner/AlertBanner.tsx +0 -4
- package/src/components/Author/Author.tsx +8 -1
- package/src/components/Button/Button.tsx +0 -4
- package/src/components/Card/Card.tsx +4 -1
- package/src/components/Expandable/Expandable.tsx +3 -1
- package/src/components/Icon/AddIcon.tsx +14 -0
- package/src/components/Icon/ArrowDownIcon.tsx +11 -0
- package/src/components/Icon/ArrowLeftIcon.tsx +11 -0
- package/src/components/Icon/ArrowRightIcon.tsx +11 -0
- package/src/components/Icon/ArrowUpIcon.tsx +11 -0
- package/src/components/Icon/AvatarAltIcon.tsx +18 -0
- package/src/components/Icon/AvatarIcon.tsx +14 -0
- package/src/components/Icon/BasketIcon.tsx +14 -0
- package/src/components/Icon/CalendarIcon.tsx +14 -0
- package/src/components/Icon/ChevronDownIcon.tsx +10 -0
- package/src/components/Icon/ChevronLeftIcon.tsx +10 -0
- package/src/components/Icon/ChevronRightIcon.tsx +10 -0
- package/src/components/Icon/ChevronUpIcon.tsx +10 -0
- package/src/components/Icon/ClockIcon.tsx +14 -0
- package/src/components/Icon/CloseAltIcon.tsx +18 -0
- package/src/components/Icon/CloseIcon.tsx +14 -0
- package/src/components/Icon/CoopCardIcon.tsx +10 -0
- package/src/components/Icon/CoopIcon.tsx +10 -0
- package/src/components/Icon/CoopLocationIcon.tsx +18 -0
- package/src/components/Icon/DownloadIcon.tsx +15 -0
- package/src/components/Icon/HomeIcon.tsx +18 -0
- package/src/components/Icon/InformationIcon.tsx +14 -0
- package/src/components/Icon/LocationIcon.tsx +14 -0
- package/src/components/Icon/MailIcon.tsx +10 -0
- package/src/components/Icon/MenuIcon.tsx +10 -0
- package/src/components/Icon/MessageIcon.tsx +10 -0
- package/src/components/Icon/MinusIcon.tsx +10 -0
- package/src/components/Icon/OpenNewIcon.tsx +14 -0
- package/src/components/Icon/PencilIcon.tsx +10 -0
- package/src/components/Icon/PhoneIcon.tsx +10 -0
- package/src/components/Icon/QuestionIcon.tsx +14 -0
- package/src/components/Icon/ScooterIcon.tsx +26 -0
- package/src/components/Icon/SearchIcon.tsx +14 -0
- package/src/components/Icon/SettingsIcon.tsx +10 -0
- package/src/components/Icon/TickAltIcon.tsx +14 -0
- package/src/components/Icon/TickIcon.tsx +10 -0
- package/src/components/Icon/VanIcon.tsx +10 -0
- package/src/components/Icon/WarningIcon.tsx +14 -0
- package/src/components/Icon/WriteIcon.tsx +22 -0
- package/src/components/Icon/index.tsx +39 -0
- package/src/components/Pill/Pill.tsx +0 -4
- package/src/components/RootSVG/RootSVG.tsx +3 -1
- package/src/components/Signpost/Signpost.tsx +12 -3
- package/src/components/SkipNav/SkipNav.tsx +7 -7
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const WriteIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg className="coop-icon" fill="none" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path
|
|
5
|
+
d="M19.67 10.13 17.9 11.9H7a1 1 0 0 1 0-2h12a1 1 0 0 1 .67.23M14.9 14.9l-2 2H7a1 1 0 0 1 0-2ZM20 15.9a1 1 0 0 1-1 1h-1.87l2-2a1 1 0 0 1 .82.59.85.85 0 0 1 .05.41M19 21.9H7a1 1 0 0 1 0-2h12a1 1 0 1 1 0 2"
|
|
6
|
+
fill="currentColor"
|
|
7
|
+
/>
|
|
8
|
+
<path
|
|
9
|
+
d="M24.08 10v20h-22V6h21.73l1.54-1.54a1.9 1.9 0 0 0-1-.44H2.07a2 2 0 0 0-2 2V30a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V8Z"
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
/>
|
|
12
|
+
<path
|
|
13
|
+
d="M30.62 3.41 28.5 1.29a1 1 0 0 0-1.42 0L22.38 6l-3.9 3.9-5 5-1.33 1.33a1 1 0 0 0-.27.48v.19l-.6 2.57a.8.8 0 0 0 0 .43 1 1 0 0 0 1.19.77l2.74-.67a.64.64 0 0 0 .29-.13.6.6 0 0 0 .19-.14l2.85-2.86 1.4-1.39L30.62 4.82a1 1 0 0 0 0-1.41M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M31.33 2.7 29.21.58a2.06 2.06 0 0 0-2.83 0L11.44 15.52a2.1 2.1 0 0 0-.54 1l-.09.41-.54 2.34a2.18 2.18 0 0 0 .54 1.87 2 2 0 0 0 1.4.58 1.8 1.8 0 0 0 .46-.05l2.75-.67a2.1 2.1 0 0 0 1-.54L31.33 5.53a2 2 0 0 0 0-2.83M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z"
|
|
18
|
+
fill="currentColor"
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export { AddIcon } from "./AddIcon"
|
|
2
|
+
export { ArrowDownIcon } from "./ArrowDownIcon"
|
|
3
|
+
export { ArrowLeftIcon } from "./ArrowLeftIcon"
|
|
4
|
+
export { ArrowRightIcon } from "./ArrowRightIcon"
|
|
5
|
+
export { ArrowUpIcon } from "./ArrowUpIcon"
|
|
6
|
+
export { AvatarAltIcon } from "./AvatarAltIcon"
|
|
7
|
+
export { AvatarIcon } from "./AvatarIcon"
|
|
8
|
+
export { BasketIcon } from "./BasketIcon"
|
|
9
|
+
export { CalendarIcon } from "./CalendarIcon"
|
|
10
|
+
export { ChevronDownIcon } from "./ChevronDownIcon"
|
|
11
|
+
export { ChevronLeftIcon } from "./ChevronLeftIcon"
|
|
12
|
+
export { ChevronRightIcon } from "./ChevronRightIcon"
|
|
13
|
+
export { ChevronUpIcon } from "./ChevronUpIcon"
|
|
14
|
+
export { ClockIcon } from "./ClockIcon"
|
|
15
|
+
export { CloseAltIcon } from "./CloseAltIcon"
|
|
16
|
+
export { CloseIcon } from "./CloseIcon"
|
|
17
|
+
export { CoopCardIcon } from "./CoopCardIcon"
|
|
18
|
+
export { CoopIcon } from "./CoopIcon"
|
|
19
|
+
export { CoopLocationIcon } from "./CoopLocationIcon"
|
|
20
|
+
export { DownloadIcon } from "./DownloadIcon"
|
|
21
|
+
export { HomeIcon } from "./HomeIcon"
|
|
22
|
+
export { InformationIcon } from "./InformationIcon"
|
|
23
|
+
export { LocationIcon } from "./LocationIcon"
|
|
24
|
+
export { MailIcon } from "./MailIcon"
|
|
25
|
+
export { MenuIcon } from "./MenuIcon"
|
|
26
|
+
export { MessageIcon } from "./MessageIcon"
|
|
27
|
+
export { MinusIcon } from "./MinusIcon"
|
|
28
|
+
export { OpenNewIcon } from "./OpenNewIcon"
|
|
29
|
+
export { PencilIcon } from "./PencilIcon"
|
|
30
|
+
export { PhoneIcon } from "./PhoneIcon"
|
|
31
|
+
export { QuestionIcon } from "./QuestionIcon"
|
|
32
|
+
export { ScooterIcon } from "./ScooterIcon"
|
|
33
|
+
export { SearchIcon } from "./SearchIcon"
|
|
34
|
+
export { SettingsIcon } from "./SettingsIcon"
|
|
35
|
+
export { TickAltIcon } from "./TickAltIcon"
|
|
36
|
+
export { TickIcon } from "./TickIcon"
|
|
37
|
+
export { VanIcon } from "./VanIcon"
|
|
38
|
+
export { WarningIcon } from "./WarningIcon"
|
|
39
|
+
export { WriteIcon } from "./WriteIcon"
|
|
@@ -3,8 +3,6 @@ import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, J
|
|
|
3
3
|
import React from "react"
|
|
4
4
|
|
|
5
5
|
export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
6
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
7
|
-
ariaLabel?: string
|
|
8
6
|
/** **(Optional)** Specifies the custom element to override default `a` or `span`. */
|
|
9
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
8
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string
|
|
@@ -28,7 +26,6 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
28
26
|
* 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.
|
|
29
27
|
*/
|
|
30
28
|
export const Pill = ({
|
|
31
|
-
ariaLabel,
|
|
32
29
|
as,
|
|
33
30
|
badge,
|
|
34
31
|
badgeColor = "red",
|
|
@@ -46,7 +43,6 @@ export const Pill = ({
|
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
const componentProps = {
|
|
49
|
-
"aria-label": ariaLabel,
|
|
50
46
|
className: `coop-pill ${className}`,
|
|
51
47
|
"data-badge": badge?.length ? badge : undefined,
|
|
52
48
|
"data-badge-color": badgeColor,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, JSX } from "react"
|
|
1
|
+
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react"
|
|
2
2
|
|
|
3
3
|
import React from "react"
|
|
4
4
|
|
|
5
5
|
import { Image, ImageProps } from "../Image"
|
|
6
6
|
|
|
7
|
-
export interface SignpostProps {
|
|
7
|
+
export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
/** **(Optional)** Specifies the custom element to override default `a` */
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string
|
|
11
11
|
/** Represents the heading inside the Signpost component. It can be any valid JSX or string. */
|
|
12
12
|
children: React.ReactNode
|
|
13
|
+
/** **(Optional)** Receives any className to be applied to Signpost component. */
|
|
14
|
+
className?: string
|
|
13
15
|
/** **(Optional)** Specifies the heading level of the signpost's heading. */
|
|
14
16
|
headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6"
|
|
15
17
|
/** Specifies the URL that the Signpost component will link to when clicked. */
|
|
@@ -25,17 +27,24 @@ export interface SignpostProps {
|
|
|
25
27
|
export const Signpost = ({
|
|
26
28
|
as,
|
|
27
29
|
children,
|
|
30
|
+
className = "",
|
|
28
31
|
headingLevel = "h3",
|
|
29
32
|
href,
|
|
30
33
|
image,
|
|
34
|
+
...props
|
|
31
35
|
}: SignpostProps): JSX.Element => {
|
|
32
36
|
let element: SignpostProps["as"] = "a"
|
|
33
37
|
if (as) {
|
|
34
38
|
element = as
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
const componentProps = {
|
|
42
|
+
className: `coop-signpost ${className}`,
|
|
43
|
+
...props,
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
return (
|
|
38
|
-
<div
|
|
47
|
+
<div {...componentProps}>
|
|
39
48
|
{image && <Image crop="wide" {...image} />}
|
|
40
49
|
{React.createElement(
|
|
41
50
|
element,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HTMLAttributes, JSX } from "react"
|
|
2
2
|
|
|
3
3
|
interface SkipNavLink {
|
|
4
4
|
href: string
|
|
5
5
|
label: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export interface SkipNavProps extends
|
|
9
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
10
|
-
ariaLabel?: string
|
|
8
|
+
export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
9
|
/** **(Optional)** Receives any className to be applied to Skip Nav component. */
|
|
12
10
|
className?: string
|
|
13
11
|
/** **(Optional)** Specifies if the component is visible straight away or only when pressing 'Tab'. */
|
|
@@ -39,19 +37,21 @@ const defaultLinks = [{ href: "#main", label: "Skip to main content" }]
|
|
|
39
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.
|
|
40
38
|
*/
|
|
41
39
|
export const SkipNav = ({
|
|
42
|
-
ariaLabel = "",
|
|
43
40
|
className = "",
|
|
44
41
|
isVisible = false,
|
|
45
42
|
links = defaultLinks,
|
|
46
43
|
...props
|
|
47
44
|
}: SkipNavProps): JSX.Element => {
|
|
45
|
+
const componentProps = {
|
|
46
|
+
className: `coop-skip-nav ${className}`,
|
|
47
|
+
...props,
|
|
48
|
+
}
|
|
48
49
|
const navLinks = links.length > 0 ? links : defaultLinks
|
|
49
50
|
return (
|
|
50
|
-
<nav
|
|
51
|
+
<nav {...componentProps}>
|
|
51
52
|
<ul>
|
|
52
53
|
{navLinks.map((link) => {
|
|
53
54
|
const linkProps = {
|
|
54
|
-
className: `${className}`,
|
|
55
55
|
"data-visible": isVisible,
|
|
56
56
|
href: link.href,
|
|
57
57
|
label: link.label,
|