@coopdigital/react 0.12.0 → 0.12.1

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.
@@ -6,8 +6,8 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
6
6
  children?: string | ReactNode;
7
7
  /** **(Optional)** Receives any className to be applied to AlertBanner component. */
8
8
  className?: string;
9
- /** Specifies the AlertBanner title. */
10
- title: string;
9
+ /** Specifies the AlertBanner heading. */
10
+ heading: string;
11
11
  /** **(Optional)** Specifies the AlertBanner variant. */
12
12
  variant?: "black" | "default";
13
13
  }
@@ -21,5 +21,5 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
21
21
  * <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
22
22
  *
23
23
  */
24
- export declare const AlertBanner: ({ ariaLabel, children, className, title, variant, ...props }: AlertBannerProps) => JSX.Element;
24
+ export declare const AlertBanner: ({ ariaLabel, children, className, heading, variant, ...props }: AlertBannerProps) => JSX.Element;
25
25
  export default AlertBanner;
@@ -12,9 +12,9 @@ import { jsx, jsxs } from 'react/jsx-runtime';
12
12
  *
13
13
  */
14
14
  const AlertBanner = (_a) => {
15
- var { ariaLabel, children, className = "", title, variant = "default" } = _a, props = __rest(_a, ["ariaLabel", "children", "className", "title", "variant"]);
15
+ var { ariaLabel, children, className = "", heading, variant = "default" } = _a, props = __rest(_a, ["ariaLabel", "children", "className", "heading", "variant"]);
16
16
  const componentProps = Object.assign({ "aria-label": ariaLabel, className: `coop-alert-banner ${className}`, "data-variant": variant }, props);
17
- return (jsx("aside", Object.assign({}, componentProps, { children: jsxs("div", { className: "coop-alert-banner--inner", children: [jsx("h2", { id: "coop-alert-banner--headline", children: title }), children] }) })));
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
 
20
20
  export { AlertBanner, AlertBanner as default };
@@ -14,7 +14,9 @@ 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)** Specifies the heading level of the card's title. */
17
+ /** Specifies the heading of the Card */
18
+ heading: string;
19
+ /** **(Optional)** Specifies the heading level of the card's heading. */
18
20
  headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6";
19
21
  /** **(Optional)** Specifies the URL that the Card component will link to when clicked. */
20
22
  href?: string;
@@ -28,11 +30,9 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
28
30
  labelBackground?: "yellow" | "green" | "pink" | "purple" | "orange" | "red" | "lilac" | "blue";
29
31
  /** **(Optional)** Specifies the layout of the Card */
30
32
  layout?: "vertical" | "horizontal";
31
- /** Specifies the title of the Card */
32
- title: string;
33
33
  }
34
34
  /**
35
- * A Card lets you highlight and link to more in-depth content on another page. The component typically includes a title, image, and an optional description.
35
+ * 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
36
  */
37
- export declare const Card: ({ as, background, badge, badgePosition, chevron, children, headingLevel, href, image, imagePosition, label, labelBackground, layout, title, ...props }: CardProps) => JSX.Element;
37
+ export declare const Card: ({ as, background, badge, badgePosition, chevron, children, heading, headingLevel, href, image, imagePosition, label, labelBackground, layout, ...props }: CardProps) => JSX.Element;
38
38
  export default Card;
@@ -16,14 +16,14 @@ function getCardLinkElement(as, href) {
16
16
  };
17
17
  }
18
18
  /**
19
- * A Card lets you highlight and link to more in-depth content on another page. The component typically includes a title, image, and an optional description.
19
+ * 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.
20
20
  */
21
21
  const Card = (_a) => {
22
- var { as, background, badge, badgePosition = "inset", chevron = false, children, headingLevel = "h3", href, image, imagePosition = "left", label = "", labelBackground, layout = "vertical", title } = _a, props = __rest(_a, ["as", "background", "badge", "badgePosition", "chevron", "children", "headingLevel", "href", "image", "imagePosition", "label", "labelBackground", "layout", "title"]);
22
+ 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
23
  const linkElement = getCardLinkElement(as, href);
24
24
  const imageProps = Object.assign({ crop: "wide" }, image);
25
25
  const componentProps = Object.assign({ className: "coop-card", "data-badge-pos": badgePosition, "data-bg": background, "data-image-pos": imagePosition, "data-label-bg": labelBackground, "data-layout": layout }, props);
26
- 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" }, title)), 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" }) }) }))] })] })));
26
+ 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" }) }) }))] })] })));
27
27
  };
28
28
 
29
29
  export { Card, Card as default };
@@ -4,9 +4,9 @@ import { ImageProps } from "../Image";
4
4
  export interface SignpostProps {
5
5
  /** **(Optional)** Specifies the custom element to override default `a` */
6
6
  as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
7
- /** Represents the title inside the Signpost component. It can be any valid JSX or string. */
7
+ /** Represents the heading inside the Signpost component. It can be any valid JSX or string. */
8
8
  children: React.ReactNode;
9
- /** **(Optional)** Specifies the heading level of the signpost's title. */
9
+ /** **(Optional)** Specifies the heading level of the signpost's heading. */
10
10
  headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6";
11
11
  /** Specifies the URL that the Signpost component will link to when clicked. */
12
12
  href: string;
@@ -1,7 +1,7 @@
1
1
  import type { AnchorHTMLAttributes, JSX } from "react";
2
2
  interface SkipNavLink {
3
3
  href: string;
4
- title: string;
4
+ label: string;
5
5
  }
6
6
  export interface SkipNavProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
7
7
  /** **(Optional)** Specifies a custom aria-label. */
@@ -11,7 +11,7 @@ export interface SkipNavProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
11
11
  /** **(Optional)** Specifies if the component is visible straight away or only when pressing 'Tab'. */
12
12
  isVisible?: boolean;
13
13
  /** **(Optional)** Specifies the links that are going to be shown on the Skip Nav.
14
- * It is an `array` of items and each item should have `href` and `title` information.
14
+ * It is an `array` of items and each item should have `href` and `label` information.
15
15
  *
16
16
  * Defaults to a single link anchored to `#main` */
17
17
  links?: SkipNavLink[];
@@ -1,7 +1,7 @@
1
1
  import { __rest } from '../../node_modules/tslib/tslib.es6.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
- const defaultLinks = [{ href: "#main", title: "Skip to main content" }];
4
+ const defaultLinks = [{ href: "#main", label: "Skip to main content" }];
5
5
  /**
6
6
  * The Skip Nav component allows screen reader and keyboard users to go directly to the main content.
7
7
  *
@@ -27,9 +27,9 @@ const SkipNav = (_a) => {
27
27
  className: `${className}`,
28
28
  "data-visible": isVisible,
29
29
  href: link.href,
30
- title: link.title,
30
+ label: link.label,
31
31
  };
32
- return (jsx("li", { children: jsx("a", Object.assign({}, linkProps, { children: link.title })) }, link.href));
32
+ return (jsx("li", { children: jsx("a", Object.assign({}, linkProps, { children: link.label })) }, link.href));
33
33
  }) }) })));
34
34
  };
35
35
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -66,5 +66,5 @@
66
66
  "react": "^19.0.0",
67
67
  "react-dom": "^19.0.0"
68
68
  },
69
- "gitHead": "02effb2492f1d3ee2c0772ee19e6c49bd057dab3"
69
+ "gitHead": "c4995d875a4e9d54ef3c23c8652902fe6f1068cc"
70
70
  }
@@ -7,8 +7,8 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
7
7
  children?: string | ReactNode
8
8
  /** **(Optional)** Receives any className to be applied to AlertBanner component. */
9
9
  className?: string
10
- /** Specifies the AlertBanner title. */
11
- title: string
10
+ /** Specifies the AlertBanner heading. */
11
+ heading: string
12
12
  /** **(Optional)** Specifies the AlertBanner variant. */
13
13
  variant?: "black" | "default"
14
14
  }
@@ -27,7 +27,7 @@ export const AlertBanner = ({
27
27
  ariaLabel,
28
28
  children,
29
29
  className = "",
30
- title,
30
+ heading,
31
31
  variant = "default",
32
32
  ...props
33
33
  }: AlertBannerProps): JSX.Element => {
@@ -40,7 +40,7 @@ export const AlertBanner = ({
40
40
  return (
41
41
  <aside {...componentProps}>
42
42
  <div className="coop-alert-banner--inner">
43
- <h2 id="coop-alert-banner--headline">{title}</h2>
43
+ <h2 id="coop-alert-banner--headline">{heading}</h2>
44
44
  {children}
45
45
  </div>
46
46
  </aside>
@@ -19,7 +19,9 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
19
19
  chevron?: boolean
20
20
  /** **(Optional)** Represents the content inside the Card component. It can be any valid JSX or string. */
21
21
  children?: React.ReactNode
22
- /** **(Optional)** Specifies the heading level of the card's title. */
22
+ /** Specifies the heading of the Card */
23
+ heading: string
24
+ /** **(Optional)** Specifies the heading level of the card's heading. */
23
25
  headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6"
24
26
  /** **(Optional)** Specifies the URL that the Card component will link to when clicked. */
25
27
  href?: string
@@ -33,8 +35,6 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
33
35
  labelBackground?: "yellow" | "green" | "pink" | "purple" | "orange" | "red" | "lilac" | "blue"
34
36
  /** **(Optional)** Specifies the layout of the Card */
35
37
  layout?: "vertical" | "horizontal"
36
- /** Specifies the title of the Card */
37
- title: string
38
38
  }
39
39
 
40
40
  function getCardLinkElement(as: CardProps["as"], href?: string) {
@@ -53,7 +53,7 @@ function getCardLinkElement(as: CardProps["as"], href?: string) {
53
53
  }
54
54
 
55
55
  /**
56
- * A Card lets you highlight and link to more in-depth content on another page. The component typically includes a title, image, and an optional description.
56
+ * 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.
57
57
  */
58
58
  export const Card = ({
59
59
  as,
@@ -62,6 +62,7 @@ export const Card = ({
62
62
  badgePosition = "inset",
63
63
  chevron = false,
64
64
  children,
65
+ heading,
65
66
  headingLevel = "h3",
66
67
  href,
67
68
  image,
@@ -69,7 +70,6 @@ export const Card = ({
69
70
  label = "",
70
71
  labelBackground,
71
72
  layout = "vertical",
72
- title,
73
73
  ...props
74
74
  }: CardProps): JSX.Element => {
75
75
  const linkElement = getCardLinkElement(as, href)
@@ -99,7 +99,7 @@ export const Card = ({
99
99
  {React.createElement(
100
100
  linkElement.element,
101
101
  linkElement.props,
102
- React.createElement(headingLevel, { className: "coop-card--heading" }, title)
102
+ React.createElement(headingLevel, { className: "coop-card--heading" }, heading)
103
103
  )}
104
104
  {children}
105
105
  </div>
@@ -8,9 +8,9 @@ export interface SignpostProps {
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
- /** Represents the title inside the Signpost component. It can be any valid JSX or string. */
11
+ /** Represents the heading inside the Signpost component. It can be any valid JSX or string. */
12
12
  children: React.ReactNode
13
- /** **(Optional)** Specifies the heading level of the signpost's title. */
13
+ /** **(Optional)** Specifies the heading level of the signpost's heading. */
14
14
  headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6"
15
15
  /** Specifies the URL that the Signpost component will link to when clicked. */
16
16
  href: string
@@ -2,7 +2,7 @@ import type { AnchorHTMLAttributes, JSX } from "react"
2
2
 
3
3
  interface SkipNavLink {
4
4
  href: string
5
- title: string
5
+ label: string
6
6
  }
7
7
 
8
8
  export interface SkipNavProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
@@ -13,13 +13,13 @@ export interface SkipNavProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
13
13
  /** **(Optional)** Specifies if the component is visible straight away or only when pressing 'Tab'. */
14
14
  isVisible?: boolean
15
15
  /** **(Optional)** Specifies the links that are going to be shown on the Skip Nav.
16
- * It is an `array` of items and each item should have `href` and `title` information.
16
+ * It is an `array` of items and each item should have `href` and `label` information.
17
17
  *
18
18
  * Defaults to a single link anchored to `#main` */
19
19
  links?: SkipNavLink[]
20
20
  }
21
21
 
22
- const defaultLinks = [{ href: "#main", title: "Skip to main content" }]
22
+ const defaultLinks = [{ href: "#main", label: "Skip to main content" }]
23
23
 
24
24
  /**
25
25
  * The Skip Nav component allows screen reader and keyboard users to go directly to the main content.
@@ -54,11 +54,11 @@ export const SkipNav = ({
54
54
  className: `${className}`,
55
55
  "data-visible": isVisible,
56
56
  href: link.href,
57
- title: link.title,
57
+ label: link.label,
58
58
  }
59
59
  return (
60
60
  <li key={link.href}>
61
- <a {...linkProps}>{link.title}</a>
61
+ <a {...linkProps}>{link.label}</a>
62
62
  </li>
63
63
  )
64
64
  })}