@coopdigital/react 0.5.2 → 0.5.3

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.
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from "react";
2
+ export interface AlertBannerProps {
3
+ /** **(Optional)** Specifies a custom aria-label. */
4
+ ariaLabel?: string;
5
+ /** **(Optional)** Represents the content inside the AlertBanner component. It can be any valid JSX or string. */
6
+ children?: string | ReactNode;
7
+ /** **(Optional)** Receives any className to be applied to AlertBanner component. */
8
+ className?: string;
9
+ /** Specifies the AlertBanner title. */
10
+ title: string;
11
+ /** **(Optional)** Specifies the AlertBanner variant. */
12
+ variant?: "black" | "default";
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
+ export declare const AlertBanner: ({ ariaLabel, children, className, title, variant, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
25
+ export default AlertBanner;
@@ -0,0 +1,4 @@
1
+ import AlertBanner from "./AlertBanner";
2
+ export default AlertBanner;
3
+ export { AlertBanner };
4
+ export * from "./AlertBanner";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "main": "dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -38,9 +38,9 @@
38
38
  "description": "",
39
39
  "devDependencies": {
40
40
  "@axe-core/playwright": "^4.10.1",
41
- "@coopdigital/styles": "^0.5.5",
42
- "@playwright/test": "^1.50.1",
43
- "@rollup/plugin-node-resolve": "^16.0.0",
41
+ "@coopdigital/styles": "^0.5.6",
42
+ "@playwright/test": "^1.51.0",
43
+ "@rollup/plugin-node-resolve": "^16.0.1",
44
44
  "@rollup/plugin-typescript": "^12.1.2",
45
45
  "@storybook/addon-a11y": "^8.6.4",
46
46
  "@storybook/addon-essentials": "^8.6.4",
@@ -57,12 +57,12 @@
57
57
  "@testing-library/react": "^16.2.0",
58
58
  "@types/react": "^19.0.10",
59
59
  "@types/react-dom": "^19.0.4",
60
- "rollup": "^4.34.8",
60
+ "rollup": "^4.35.0",
61
61
  "storybook": "^8.6.4"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "react": "^19.0.0",
65
65
  "react-dom": "^19.0.0"
66
66
  },
67
- "gitHead": "f292a4bba122b73db52ff17fa53eb90e7420c651"
67
+ "gitHead": "a275fea237a8e1f918e9fd4bd0f18ba114e7ab34"
68
68
  }
@@ -0,0 +1,48 @@
1
+ import { ReactNode } from "react"
2
+
3
+ export interface AlertBannerProps {
4
+ /** **(Optional)** Specifies a custom aria-label. */
5
+ ariaLabel?: string
6
+ /** **(Optional)** Represents the content inside the AlertBanner component. It can be any valid JSX or string. */
7
+ children?: string | ReactNode
8
+ /** **(Optional)** Receives any className to be applied to AlertBanner component. */
9
+ className?: string
10
+ /** Specifies the AlertBanner title. */
11
+ title: string
12
+ /** **(Optional)** Specifies the AlertBanner variant. */
13
+ variant?: "black" | "default"
14
+ }
15
+
16
+ /**
17
+ * The Alert Banner component is used to highlight events that might limit availability of a service we provide.
18
+ * <br />
19
+ * - the service the user is trying to access is experiencing problems
20
+ * - planned system maintenance is coming soon
21
+ * - the user’s login session is about to expire
22
+ * <br />
23
+ * <p>Only use alert notifications when absolutely necessary. Using them too often could make the problem worse.<p/>
24
+ *
25
+ */
26
+ export const AlertBanner = ({
27
+ ariaLabel,
28
+ children,
29
+ className = "",
30
+ title,
31
+ variant = "default",
32
+ }: AlertBannerProps) => {
33
+ const componentProps = {
34
+ "aria-label": ariaLabel,
35
+ className: `coop-alert-banner ${className}`,
36
+ "data-variant": variant,
37
+ }
38
+ return (
39
+ <aside {...componentProps}>
40
+ <div className="coop-alert-banner--inner">
41
+ <h3 id="coop-alert-banner--headline">{title}</h3>
42
+ {children}
43
+ </div>
44
+ </aside>
45
+ )
46
+ }
47
+
48
+ export default AlertBanner
@@ -0,0 +1,5 @@
1
+ import AlertBanner from "./AlertBanner"
2
+
3
+ export default AlertBanner
4
+ export { AlertBanner }
5
+ export * from "./AlertBanner"
@@ -42,22 +42,22 @@ export const SkipNav = ({
42
42
  links = defaultLinks,
43
43
  }: SkipNavProps) => {
44
44
  const navLinks = links.length > 0 ? links : defaultLinks
45
-
46
45
  return (
47
46
  <nav className="coop-skip-nav" aria-label={ariaLabel}>
48
- <ul className="coop-skip-nav__list">
49
- {navLinks.map((link) => (
50
- <li key={link.href}>
51
- <a
52
- href={link.href}
53
- title={link.title}
54
- className={`coop-skip-nav__link ${className}`}
55
- data-visible={isVisible}
56
- >
57
- {link.title}
58
- </a>
59
- </li>
60
- ))}
47
+ <ul>
48
+ {navLinks.map((link) => {
49
+ const linkProps = {
50
+ href: link.href,
51
+ title: link.title,
52
+ className: `${className}`,
53
+ "data-visible": isVisible,
54
+ }
55
+ return (
56
+ <li key={link.href}>
57
+ <a {...linkProps}>{link.title}</a>
58
+ </li>
59
+ )
60
+ })}
61
61
  </ul>
62
62
  </nav>
63
63
  )