@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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes, JSX, ReactNode } from "react";
|
|
2
2
|
export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
4
|
-
ariaLabel?: string;
|
|
5
3
|
/** **(Optional)** Represents the content inside the AlertBanner component. It can be any valid JSX or string. */
|
|
6
4
|
children?: string | ReactNode;
|
|
7
5
|
/** **(Optional)** Receives any className to be applied to AlertBanner component. */
|
|
@@ -21,5 +19,5 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
21
19
|
* <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
|
|
22
20
|
*
|
|
23
21
|
*/
|
|
24
|
-
export declare const AlertBanner: ({
|
|
22
|
+
export declare const AlertBanner: ({ children, className, heading, variant, ...props }: AlertBannerProps) => JSX.Element;
|
|
25
23
|
export default AlertBanner;
|
|
@@ -12,8 +12,8 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
14
|
const AlertBanner = (_a) => {
|
|
15
|
-
var {
|
|
16
|
-
const componentProps = Object.assign({
|
|
15
|
+
var { children, className = "", heading, variant = "default" } = _a, props = __rest(_a, ["children", "className", "heading", "variant"]);
|
|
16
|
+
const componentProps = Object.assign({ className: `coop-alert-banner ${className}`, "data-variant": variant }, props);
|
|
17
17
|
return (jsx("aside", Object.assign({}, componentProps, { children: jsxs("div", { className: "coop-alert-banner--inner", children: [jsx("h2", { id: "coop-alert-banner--headline", children: heading }), children] }) })));
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -3,6 +3,8 @@ import { ImageProps } from "../Image";
|
|
|
3
3
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/** **(Optional)** Specifies the content author */
|
|
5
5
|
author?: string;
|
|
6
|
+
/** **(Optional)** Receives any className to be applied to Author component. */
|
|
7
|
+
className?: string;
|
|
6
8
|
/** **(Optional)** Specifies the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
7
9
|
date?: string;
|
|
8
10
|
/** **(Optional)** Specifies the text that will prefix the date, e.g. "Published" */
|
|
@@ -13,5 +15,5 @@ export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
15
|
/**
|
|
14
16
|
* Author is a component that can be used inside any article or Card component to communicate respective author and date of publication.
|
|
15
17
|
*/
|
|
16
|
-
export declare const Author: ({ author, date, datePrefix, image, ...props }: AuthorProps) => JSX.Element;
|
|
18
|
+
export declare const Author: ({ author, className, date, datePrefix, image, ...props }: AuthorProps) => JSX.Element;
|
|
17
19
|
export default Author;
|
|
@@ -6,12 +6,13 @@ import { Image } from '../Image/Image.js';
|
|
|
6
6
|
* Author is a component that can be used inside any article or Card component to communicate respective author and date of publication.
|
|
7
7
|
*/
|
|
8
8
|
const Author = (_a) => {
|
|
9
|
-
var { author = "Co-op team", date, datePrefix = "", image = {
|
|
9
|
+
var { author = "Co-op team", className = "", date, datePrefix = "", image = {
|
|
10
10
|
alt: "",
|
|
11
11
|
src: "https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg",
|
|
12
|
-
} } = _a, props = __rest(_a, ["author", "date", "datePrefix", "image"]);
|
|
12
|
+
} } = _a, props = __rest(_a, ["author", "className", "date", "datePrefix", "image"]);
|
|
13
13
|
const imageProps = Object.assign({ width: "56px" }, image);
|
|
14
|
-
|
|
14
|
+
const componentProps = Object.assign({ className: `coop-author ${className}` }, props);
|
|
15
|
+
return (jsxs("div", Object.assign({}, componentProps, { children: [image && jsx(Image, Object.assign({}, imageProps)), jsxs("div", { className: "coop-author--content", children: [jsxs("span", { children: [datePrefix ? datePrefix + " " : "", date] }), jsxs("span", { children: ["by ", author] })] })] })));
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export { Author, Author as default };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ForwardRefExoticComponent, JSX } from "react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
5
|
-
ariaLabel?: string;
|
|
6
4
|
/** **(Optional)** Specifies the custom element to override default `a` or `button`. */
|
|
7
5
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
|
|
8
6
|
/** **(Optional)** Represents the content inside the Button component. It can be any valid JSX or string. */
|
|
@@ -29,5 +27,5 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
29
27
|
/**
|
|
30
28
|
* The Button component is an interactive element that people can use to take an action.
|
|
31
29
|
*/
|
|
32
|
-
export declare const Button: ({
|
|
30
|
+
export declare const Button: ({ as, children, className, href, isDisabled, isFullWidth, isLoading, loadingText, onClick, size, variant, ...props }: ButtonProps) => JSX.Element;
|
|
33
31
|
export default Button;
|
|
@@ -9,7 +9,7 @@ const LoadingIcon = () => {
|
|
|
9
9
|
* The Button component is an interactive element that people can use to take an action.
|
|
10
10
|
*/
|
|
11
11
|
const Button = (_a) => {
|
|
12
|
-
var {
|
|
12
|
+
var { as, children, className = "", href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, size = "md", variant = "primary" } = _a, props = __rest(_a, ["as", "children", "className", "href", "isDisabled", "isFullWidth", "isLoading", "loadingText", "onClick", "size", "variant"]);
|
|
13
13
|
let element = href ? "a" : "button";
|
|
14
14
|
if (as) {
|
|
15
15
|
element = as;
|
|
@@ -26,7 +26,7 @@ const Button = (_a) => {
|
|
|
26
26
|
setIsPending(false);
|
|
27
27
|
}
|
|
28
28
|
}), [onClick, isPending]);
|
|
29
|
-
const componentProps = Object.assign({ "aria-disabled": isDisabled ? true : undefined, "aria-
|
|
29
|
+
const componentProps = Object.assign({ "aria-disabled": isDisabled ? true : undefined, "aria-live": "assertive", className: `${variant == "text" ? "coop-link" : "coop-button"} ${className}`, "data-loading": isLoading || isPending ? true : undefined, "data-size": size.length && size !== "md" ? size : undefined, "data-variant": variant !== "text" ? variant : undefined, "data-width": isFullWidth ? "full" : undefined, href, onClick: handleClick }, props);
|
|
30
30
|
const finalChildren = isPending || isLoading ? (jsxs(Fragment, { children: [loadingText, jsx(LoadingIcon, {})] })) : (children);
|
|
31
31
|
return React.createElement(element, Object.assign({}, componentProps), finalChildren);
|
|
32
32
|
};
|
|
@@ -14,6 +14,8 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
chevron?: boolean;
|
|
15
15
|
/** **(Optional)** Represents the content inside the Card component. It can be any valid JSX or string. */
|
|
16
16
|
children?: React.ReactNode;
|
|
17
|
+
/** **(Optional)** Receives any className to be applied to Card component. */
|
|
18
|
+
className?: string;
|
|
17
19
|
/** Specifies the heading of the Card */
|
|
18
20
|
heading: string;
|
|
19
21
|
/** **(Optional)** Specifies the heading level of the card's heading. */
|
|
@@ -34,5 +36,5 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
34
36
|
/**
|
|
35
37
|
* 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.
|
|
36
38
|
*/
|
|
37
|
-
export declare const Card: ({ as, background, badge, badgePosition, chevron, children, heading, headingLevel, href, image, imagePosition, label, labelBackground, layout, ...props }: CardProps) => JSX.Element;
|
|
39
|
+
export declare const Card: ({ as, background, badge, badgePosition, chevron, children, className, heading, headingLevel, href, image, imagePosition, label, labelBackground, layout, ...props }: CardProps) => JSX.Element;
|
|
38
40
|
export default Card;
|
|
@@ -20,10 +20,10 @@ function getCardLinkElement(as, href) {
|
|
|
20
20
|
* 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.
|
|
21
21
|
*/
|
|
22
22
|
const Card = (_a) => {
|
|
23
|
-
var { as, background, badge, badgePosition = "inset", chevron = false, children, heading, headingLevel = "h3", href, image, imagePosition = "left", label = "", labelBackground, layout = "vertical" } = _a, props = __rest(_a, ["as", "background", "badge", "badgePosition", "chevron", "children", "heading", "headingLevel", "href", "image", "imagePosition", "label", "labelBackground", "layout"]);
|
|
23
|
+
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"]);
|
|
24
24
|
const linkElement = getCardLinkElement(as, href);
|
|
25
25
|
const imageProps = Object.assign({ crop: "wide" }, image);
|
|
26
|
-
const componentProps = Object.assign({ className:
|
|
26
|
+
const componentProps = Object.assign({ className: `coop-card ${className}`, "data-badge-pos": badgePosition, "data-bg": background, "data-image-pos": imagePosition, "data-label-bg": labelBackground, "data-layout": layout !== "vertical" ? layout : undefined }, props);
|
|
27
27
|
return (jsxs("article", Object.assign({}, componentProps, { children: [image && jsx(Image, Object.assign({}, imageProps)), badge && jsx("div", { className: "coop-card--badge", children: badge }), jsxs("div", { className: "coop-card--inner", children: [jsxs("div", { className: "coop-card--content", children: [label && jsx("span", { className: "coop-card--label", children: label }), React.createElement(linkElement.element, linkElement.props, React.createElement(headingLevel, { className: "coop-card--heading" }, heading)), children] }), chevron && (jsx("span", { "aria-hidden": "true", className: "coop-card--icon", role: "presentation", children: jsx("svg", { viewBox: "0 0 16 29", children: jsx("path", { d: "M2 28.1a1.6 1.6 0 0 1-1.2-2.7l11-10.9-11-11A1.6 1.6 0 1 1 3 1.5l12 12a1.6 1.6 0 0 1 0 2.2l-12 12c-.3.4-.7.5-1 .5z" }) }) }))] })] })));
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -4,6 +4,8 @@ export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElemen
|
|
|
4
4
|
background?: "grey" | "purple" | "pink" | "green" | "orange" | "red" | "yellow" | "lilac" | "blue";
|
|
5
5
|
/** Represents the content inside the Expandable component, only visible when expanded. It can be any valid JSX or string. */
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
+
/** **(Optional)** Receives any className to be applied to Expandable component. */
|
|
8
|
+
className?: string;
|
|
7
9
|
/** Specifies summary for this component. It can be any valid JSX or string. */
|
|
8
10
|
summary: React.ReactNode;
|
|
9
11
|
}
|
|
@@ -6,7 +6,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
6
6
|
* It can be used to reveal more context for a specific issue or action.
|
|
7
7
|
*/
|
|
8
8
|
const Expandable = (_a) => {
|
|
9
|
-
var { background, children, className, summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
|
|
9
|
+
var { background, children, className = "", summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
|
|
10
10
|
const componentProps = Object.assign({ className: `coop-expandable ${className}`, "data-bg": background }, props);
|
|
11
11
|
return (jsxs("details", Object.assign({}, componentProps, { children: [jsxs("summary", { children: [summary, jsx("svg", { fill: "none", height: "24", width: "24", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "m20.25 9.75-6.22 6.22a.75.75 0 0 1-1.06 0L6.75 9.75", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) })] }), jsx("div", { className: "coop-expandable--content", children: children })] })));
|
|
12
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AddIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ArrowDownIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ArrowLeftIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ArrowRightIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ArrowUpIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AvatarAltIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AvatarIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BasketIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CalendarIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChevronDownIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChevronLeftIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChevronRightIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChevronUpIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ClockIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CloseAltIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CloseIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CoopCardIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CoopIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CoopLocationIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DownloadIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HomeIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const InformationIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LocationIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MailIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MenuIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MessageIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MinusIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OpenNewIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PencilIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PhoneIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const QuestionIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ScooterIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SearchIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SettingsIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TickAltIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TickIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VanIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WarningIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WriteIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
4
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
5
|
-
ariaLabel?: string;
|
|
6
4
|
/** **(Optional)** Specifies the custom element to override default `a` or `span`. */
|
|
7
5
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
|
|
8
6
|
/** **(Optional)** Specifies what text Pill should display on the badge. */
|
|
@@ -23,5 +21,5 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
23
21
|
/**
|
|
24
22
|
* 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.
|
|
25
23
|
*/
|
|
26
|
-
export declare const Pill: ({
|
|
24
|
+
export declare const Pill: ({ as, badge, badgeColor, children, className, href, pillColor, size, ...props }: PillProps) => JSX.Element;
|
|
27
25
|
export default Pill;
|
|
@@ -5,12 +5,12 @@ import React from 'react';
|
|
|
5
5
|
* 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.
|
|
6
6
|
*/
|
|
7
7
|
const Pill = (_a) => {
|
|
8
|
-
var {
|
|
8
|
+
var { as, badge, badgeColor = "red", children, className = "", href, pillColor = "blue", size = "md" } = _a, props = __rest(_a, ["as", "badge", "badgeColor", "children", "className", "href", "pillColor", "size"]);
|
|
9
9
|
let element = href ? "a" : "span";
|
|
10
10
|
if (as) {
|
|
11
11
|
element = as;
|
|
12
12
|
}
|
|
13
|
-
const componentProps = Object.assign({
|
|
13
|
+
const componentProps = Object.assign({ className: `coop-pill ${className}`, "data-badge": (badge === null || badge === void 0 ? void 0 : badge.length) ? badge : undefined, "data-badge-color": badgeColor, "data-pill-color": pillColor, "data-size": size.length && size !== "md" ? size : undefined, href }, props);
|
|
14
14
|
return React.createElement(element, Object.assign({}, componentProps), children);
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const RootSVG: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default RootSVG;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const RootSVG = () => {
|
|
4
4
|
return (jsx("svg", { height: "0", width: "0", xmlns: "http://www.w3.org/2000/svg", children: jsx("defs", { children: jsx("clipPath", { clipPathUnits: "objectBoundingBox", id: "squircle", children: jsx("path", { d: "M0,0.5 C0,0.165,0.165,0,0.5,0 S1,0.165,1,0.5 S0.835,1,0.5,1 S0,0.835,0,0.5" }) }) }) }));
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
|
|
7
|
-
export { RootSVG as default };
|
|
7
|
+
export { RootSVG, RootSVG as default };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, JSX } from "react";
|
|
1
|
+
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ImageProps } from "../Image";
|
|
4
|
-
export interface SignpostProps {
|
|
4
|
+
export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/** **(Optional)** Specifies the custom element to override default `a` */
|
|
6
6
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
|
|
7
7
|
/** Represents the heading inside the Signpost component. It can be any valid JSX or string. */
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
+
/** **(Optional)** Receives any className to be applied to Signpost component. */
|
|
10
|
+
className?: string;
|
|
9
11
|
/** **(Optional)** Specifies the heading level of the signpost's heading. */
|
|
10
12
|
headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6";
|
|
11
13
|
/** Specifies the URL that the Signpost component will link to when clicked. */
|
|
@@ -16,5 +18,5 @@ export interface SignpostProps {
|
|
|
16
18
|
/**
|
|
17
19
|
* Signposts allow you to create links to permanent content you think people are looking for.
|
|
18
20
|
*/
|
|
19
|
-
export declare const Signpost: ({ as, children, headingLevel, href, image, }: SignpostProps) => JSX.Element;
|
|
21
|
+
export declare const Signpost: ({ as, children, className, headingLevel, href, image, ...props }: SignpostProps) => JSX.Element;
|
|
20
22
|
export default Signpost;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
1
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Image } from '../Image/Image.js';
|
|
@@ -5,12 +6,14 @@ import { Image } from '../Image/Image.js';
|
|
|
5
6
|
/**
|
|
6
7
|
* Signposts allow you to create links to permanent content you think people are looking for.
|
|
7
8
|
*/
|
|
8
|
-
const Signpost = (
|
|
9
|
+
const Signpost = (_a) => {
|
|
10
|
+
var { as, children, className = "", headingLevel = "h3", href, image } = _a, props = __rest(_a, ["as", "children", "className", "headingLevel", "href", "image"]);
|
|
9
11
|
let element = "a";
|
|
10
12
|
if (as) {
|
|
11
13
|
element = as;
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
const componentProps = Object.assign({ className: `coop-signpost ${className}` }, props);
|
|
16
|
+
return (jsxs("div", Object.assign({}, componentProps, { children: [image && jsx(Image, Object.assign({ crop: "wide" }, image)), React.createElement(element, { href }, jsxs("div", { className: "coop-signpost--content", children: [React.createElement(headingLevel, { className: "coop-signpost--heading" }, children), jsx("span", { "aria-hidden": "true", className: "coop-signpost--icon", role: "presentation", children: jsx("svg", { viewBox: "0 0 16 29", children: jsx("path", { d: "M2 28.1a1.6 1.6 0 0 1-1.2-2.7l11-10.9-11-11A1.6 1.6 0 1 1 3 1.5l12 12a1.6 1.6 0 0 1 0 2.2l-12 12c-.3.4-.7.5-1 .5z" }) }) })] }))] })));
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
export { Signpost, Signpost as default };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HTMLAttributes, JSX } from "react";
|
|
2
2
|
interface SkipNavLink {
|
|
3
3
|
href: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
-
export interface SkipNavProps extends
|
|
7
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
8
|
-
ariaLabel?: string;
|
|
6
|
+
export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
7
|
/** **(Optional)** Receives any className to be applied to Skip Nav component. */
|
|
10
8
|
className?: string;
|
|
11
9
|
/** **(Optional)** Specifies if the component is visible straight away or only when pressing 'Tab'. */
|
|
@@ -33,5 +31,5 @@ export interface SkipNavProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
33
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.
|
|
34
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.
|
|
35
33
|
*/
|
|
36
|
-
export declare const SkipNav: ({
|
|
34
|
+
export declare const SkipNav: ({ className, isVisible, links, ...props }: SkipNavProps) => JSX.Element;
|
|
37
35
|
export default SkipNav;
|
|
@@ -20,11 +20,11 @@ const defaultLinks = [{ href: "#main", label: "Skip to main content" }];
|
|
|
20
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
21
|
*/
|
|
22
22
|
const SkipNav = (_a) => {
|
|
23
|
-
var {
|
|
23
|
+
var { className = "", isVisible = false, links = defaultLinks } = _a, props = __rest(_a, ["className", "isVisible", "links"]);
|
|
24
|
+
const componentProps = Object.assign({ className: `coop-skip-nav ${className}` }, props);
|
|
24
25
|
const navLinks = links.length > 0 ? links : defaultLinks;
|
|
25
|
-
return (jsx("nav", Object.assign({
|
|
26
|
+
return (jsx("nav", Object.assign({}, componentProps, { children: jsx("ul", { children: navLinks.map((link) => {
|
|
26
27
|
const linkProps = {
|
|
27
|
-
className: `${className}`,
|
|
28
28
|
"data-visible": isVisible,
|
|
29
29
|
href: link.href,
|
|
30
30
|
label: link.label,
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { Card } from './components/Card/Card.js';
|
|
|
5
5
|
export { Expandable } from './components/Expandable/Expandable.js';
|
|
6
6
|
export { Image } from './components/Image/Image.js';
|
|
7
7
|
export { Pill } from './components/Pill/Pill.js';
|
|
8
|
-
export {
|
|
8
|
+
export { RootSVG } from './components/RootSVG/RootSVG.js';
|
|
9
9
|
export { Signpost } from './components/Signpost/Signpost.js';
|
|
10
10
|
export { SkipNav } from './components/SkipNav/SkipNav.js';
|
|
11
11
|
export { Tag } from './components/Tag/Tag.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"description": "",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@axe-core/playwright": "^4.10.1",
|
|
47
|
-
"@coopdigital/styles": "^0.
|
|
47
|
+
"@coopdigital/styles": "^0.15.1",
|
|
48
48
|
"@playwright/test": "^1.51.1",
|
|
49
49
|
"@storybook/addon-a11y": "^8.6.12",
|
|
50
50
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react": "^19.0.0",
|
|
67
67
|
"react-dom": "^19.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "4a24650f72c010d21c1fccac53e6de59ec7c3e6e"
|
|
70
70
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes, JSX, ReactNode } from "react"
|
|
2
2
|
|
|
3
3
|
export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
5
|
-
ariaLabel?: string
|
|
6
4
|
/** **(Optional)** Represents the content inside the AlertBanner component. It can be any valid JSX or string. */
|
|
7
5
|
children?: string | ReactNode
|
|
8
6
|
/** **(Optional)** Receives any className to be applied to AlertBanner component. */
|
|
@@ -24,7 +22,6 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
22
|
*
|
|
25
23
|
*/
|
|
26
24
|
export const AlertBanner = ({
|
|
27
|
-
ariaLabel,
|
|
28
25
|
children,
|
|
29
26
|
className = "",
|
|
30
27
|
heading,
|
|
@@ -32,7 +29,6 @@ export const AlertBanner = ({
|
|
|
32
29
|
...props
|
|
33
30
|
}: AlertBannerProps): JSX.Element => {
|
|
34
31
|
const componentProps = {
|
|
35
|
-
"aria-label": ariaLabel,
|
|
36
32
|
className: `coop-alert-banner ${className}`,
|
|
37
33
|
"data-variant": variant,
|
|
38
34
|
...props,
|
|
@@ -5,6 +5,8 @@ import { Image, ImageProps } from "../Image"
|
|
|
5
5
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/** **(Optional)** Specifies the content author */
|
|
7
7
|
author?: string
|
|
8
|
+
/** **(Optional)** Receives any className to be applied to Author component. */
|
|
9
|
+
className?: string
|
|
8
10
|
/** **(Optional)** Specifies the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
9
11
|
date?: string
|
|
10
12
|
/** **(Optional)** Specifies the text that will prefix the date, e.g. "Published" */
|
|
@@ -19,6 +21,7 @@ export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
21
|
|
|
20
22
|
export const Author = ({
|
|
21
23
|
author = "Co-op team",
|
|
24
|
+
className = "",
|
|
22
25
|
date,
|
|
23
26
|
datePrefix = "",
|
|
24
27
|
image = {
|
|
@@ -32,8 +35,12 @@ export const Author = ({
|
|
|
32
35
|
...image,
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
const componentProps = {
|
|
39
|
+
className: `coop-author ${className}`,
|
|
40
|
+
...props,
|
|
41
|
+
}
|
|
35
42
|
return (
|
|
36
|
-
<div
|
|
43
|
+
<div {...componentProps}>
|
|
37
44
|
{image && <Image {...imageProps} />}
|
|
38
45
|
<div className="coop-author--content">
|
|
39
46
|
<span>
|
|
@@ -8,8 +8,6 @@ import type {
|
|
|
8
8
|
import React, { useCallback, useState } from "react"
|
|
9
9
|
|
|
10
10
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
|
-
/** **(Optional)** Specifies a custom aria-label. */
|
|
12
|
-
ariaLabel?: string
|
|
13
11
|
/** **(Optional)** Specifies the custom element to override default `a` or `button`. */
|
|
14
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
13
|
as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string
|
|
@@ -59,7 +57,6 @@ const LoadingIcon = () => {
|
|
|
59
57
|
* The Button component is an interactive element that people can use to take an action.
|
|
60
58
|
*/
|
|
61
59
|
export const Button = ({
|
|
62
|
-
ariaLabel,
|
|
63
60
|
as,
|
|
64
61
|
children,
|
|
65
62
|
className = "",
|
|
@@ -97,7 +94,6 @@ export const Button = ({
|
|
|
97
94
|
|
|
98
95
|
const componentProps = {
|
|
99
96
|
"aria-disabled": isDisabled ? true : undefined,
|
|
100
|
-
"aria-label": ariaLabel,
|
|
101
97
|
"aria-live": "assertive" as keyof ButtonHTMLAttributes<HTMLButtonElement>["aria-live"],
|
|
102
98
|
className: `${variant == "text" ? "coop-link" : "coop-button"} ${className}`,
|
|
103
99
|
"data-loading": isLoading || isPending ? true : undefined,
|