@coopdigital/react 0.19.6 → 0.20.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/Button/Button.d.ts +1 -1
- package/dist/components/Card/Card.js +2 -1
- package/dist/components/Pill/Pill.d.ts +2 -1
- package/dist/components/SearchBox/SearchBox.d.ts +2 -1
- package/dist/components/Signpost/Signpost.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +11 -6
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Pill/Pill.tsx +2 -1
- package/src/components/SearchBox/SearchBox.tsx +2 -1
- package/src/types/index.ts +1 -0
|
@@ -20,7 +20,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
20
20
|
/** **(Optional)** Callback to run when the button is pressed. If this is an async function, it will be awaited and the button will be in a pending state until the promise is resolved. */
|
|
21
21
|
onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
22
22
|
/** **(Optional)** Specify the Button size. */
|
|
23
|
-
size?: "sm" | "md" | "lg"
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
24
|
/** **(Optional)** Specify the Button variant. */
|
|
25
25
|
variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost" | "text";
|
|
26
26
|
}
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { bgPropToClass } from '../../utils/index.js';
|
|
6
|
+
import { ChevronRightIcon } from '../Icon/ChevronRightIcon.js';
|
|
6
7
|
import { Image } from '../Image/Image.js';
|
|
7
8
|
|
|
8
9
|
function getCardLinkElement(as, href) {
|
|
@@ -23,7 +24,7 @@ const Card = (_a) => {
|
|
|
23
24
|
const linkElement = getCardLinkElement(as, href);
|
|
24
25
|
const imageProps = Object.assign({ crop: "wide" }, image);
|
|
25
26
|
const componentProps = Object.assign({ className: clsx("coop-card", background && bgPropToClass(background, className), className), "data-badge-pos": badgePosition, "data-image-pos": imagePosition, "data-layout": layout !== "vertical" ? layout : undefined }, 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: clsx("coop-card--label", labelBackground && bgPropToClass(labelBackground, className)), 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(
|
|
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: clsx("coop-card--label", labelBackground && bgPropToClass(labelBackground, className)), 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(ChevronRightIcon, {}) }))] })] })));
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export { Card, Card as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { StandardSizes } from "src/types";
|
|
3
4
|
import { Darks, OfferRed, Tints } from "../../types/colors";
|
|
4
5
|
export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
5
6
|
/** **(Optional)** Specify a custom element to override default `a` or `span`. */
|
|
@@ -17,7 +18,7 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
17
18
|
/** **(Optional)** Specify the URL that the Pill component will link to when clicked. */
|
|
18
19
|
href?: string;
|
|
19
20
|
/** **(Optional)** Specify the Pill size. */
|
|
20
|
-
size?:
|
|
21
|
+
size?: StandardSizes;
|
|
21
22
|
}
|
|
22
23
|
export declare const Pill: ({ as, background, badge, badgeBackground, children, className, href, size, ...props }: PillProps) => JSX.Element;
|
|
23
24
|
export default Pill;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
2
|
import { type JSX } from "react";
|
|
3
|
+
import { StandardSizes } from "src/types";
|
|
3
4
|
import { type ButtonProps } from "../Button";
|
|
4
5
|
export interface SearchBoxProps extends HTMLAttributes<HTMLInputElement> {
|
|
5
6
|
/** **(Optional)** Specify a server endpoint to submit the form. Will be ignored if onSubmit is also set. */
|
|
@@ -23,7 +24,7 @@ export interface SearchBoxProps extends HTMLAttributes<HTMLInputElement> {
|
|
|
23
24
|
/** **(Optional)** Specify placeholder text for the search field. Do not in place of a form label. */
|
|
24
25
|
placeholder?: string;
|
|
25
26
|
/** **(Optional)** Specify the SearchBox size. */
|
|
26
|
-
size?:
|
|
27
|
+
size?: StandardSizes;
|
|
27
28
|
/** **(Optional)** Specify the SearchBox variant. */
|
|
28
29
|
variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost";
|
|
29
30
|
}
|
|
@@ -2,6 +2,7 @@ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { ChevronRightIcon } from '../Icon/ChevronRightIcon.js';
|
|
5
6
|
import { Image } from '../Image/Image.js';
|
|
6
7
|
|
|
7
8
|
const Signpost = (_a) => {
|
|
@@ -11,7 +12,7 @@ const Signpost = (_a) => {
|
|
|
11
12
|
element = as;
|
|
12
13
|
}
|
|
13
14
|
const componentProps = Object.assign({ className: clsx("coop-signpost", className) }, props);
|
|
14
|
-
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(
|
|
15
|
+
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(ChevronRightIcon, {}) })] }))] })));
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export { Signpost, Signpost as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StandardSizes = "sm" | "md" | "lg";
|
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.20.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -34,15 +34,19 @@
|
|
|
34
34
|
"test": "vitest run",
|
|
35
35
|
"test:watch": "vitest",
|
|
36
36
|
"test:coverage": "vitest run --coverage",
|
|
37
|
-
"test:
|
|
38
|
-
"test:
|
|
37
|
+
"test:avt": "./test-utils/run-playwright-tests.sh -g avt",
|
|
38
|
+
"test:avt:ui": "npm run test:avt -- --ui",
|
|
39
|
+
"test:vrt": "ENVIRONMENT=docker ./test-utils/run-playwright-tests.sh -g vrt --workers 4 --timeout 5000 --fully-parallel",
|
|
40
|
+
"test:vrt:ui": "npm run test:vrt -- --ui",
|
|
41
|
+
"test:e2e": "./test-utils/run-e2e-tests.sh",
|
|
39
42
|
"test:e2e:ci": "npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL",
|
|
40
43
|
"build": "tsx scripts build",
|
|
41
44
|
"build:docs": "tsx scripts build-docs",
|
|
42
45
|
"build:icons": "tsx scripts build-icons",
|
|
43
46
|
"build:storybook": "storybook build --disable-telemetry && npm run storybook:fix-paths",
|
|
47
|
+
"build:storybook:test": "storybook build --test --disable-telemetry --output-dir storybook-test",
|
|
48
|
+
"serve:storybook:test": "serve -p 9000 ./storybook-test",
|
|
44
49
|
"storybook": "storybook dev -p 6006",
|
|
45
|
-
"storybook:playwright": "storybook dev -p 9000",
|
|
46
50
|
"storybook:fix-paths": "tsx scripts/storybook-fix-paths.ts"
|
|
47
51
|
},
|
|
48
52
|
"author": "",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"description": "",
|
|
51
55
|
"devDependencies": {
|
|
52
56
|
"@axe-core/playwright": "^4.10.1",
|
|
53
|
-
"@coopdigital/styles": "^0.
|
|
57
|
+
"@coopdigital/styles": "^0.18.0",
|
|
54
58
|
"@playwright/test": "^1.52.0",
|
|
55
59
|
"@storybook/addon-a11y": "^8.6.12",
|
|
56
60
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -66,6 +70,7 @@
|
|
|
66
70
|
"@testing-library/react": "^16.3.0",
|
|
67
71
|
"@types/react": "^19.1.2",
|
|
68
72
|
"@types/react-dom": "^19.1.2",
|
|
73
|
+
"serve": "^14.2.4",
|
|
69
74
|
"storybook": "^8.6.12"
|
|
70
75
|
},
|
|
71
76
|
"peerDependencies": {
|
|
@@ -75,5 +80,5 @@
|
|
|
75
80
|
"dependencies": {
|
|
76
81
|
"clsx": "^2.1.1"
|
|
77
82
|
},
|
|
78
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "b01e10d738d118e3b84b8e70e00ed27471109131"
|
|
79
84
|
}
|
|
@@ -31,7 +31,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
31
31
|
/** **(Optional)** Callback to run when the button is pressed. If this is an async function, it will be awaited and the button will be in a pending state until the promise is resolved. */
|
|
32
32
|
onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void
|
|
33
33
|
/** **(Optional)** Specify the Button size. */
|
|
34
|
-
size?: "sm" | "md" | "lg"
|
|
34
|
+
size?: "sm" | "md" | "lg"
|
|
35
35
|
/** **(Optional)** Specify the Button variant. */
|
|
36
36
|
variant?:
|
|
37
37
|
| "green"
|
|
@@ -2,6 +2,7 @@ import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, J
|
|
|
2
2
|
|
|
3
3
|
import clsx from "clsx"
|
|
4
4
|
import React from "react"
|
|
5
|
+
import { StandardSizes } from "src/types"
|
|
5
6
|
|
|
6
7
|
import { bgPropToClass } from "../../../src/utils"
|
|
7
8
|
import { Darks, OfferRed, Tints } from "../../types/colors"
|
|
@@ -23,7 +24,7 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
23
24
|
/** **(Optional)** Specify the URL that the Pill component will link to when clicked. */
|
|
24
25
|
href?: string
|
|
25
26
|
/** **(Optional)** Specify the Pill size. */
|
|
26
|
-
size?:
|
|
27
|
+
size?: StandardSizes
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const Pill = ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React, { HTMLAttributes, useCallback, useId, useState } from "react"
|
|
3
3
|
import { type JSX } from "react"
|
|
4
|
+
import { StandardSizes } from "src/types"
|
|
4
5
|
|
|
5
6
|
import { Button, type ButtonProps } from "../Button"
|
|
6
7
|
import { SearchIcon } from "../Icon"
|
|
@@ -25,7 +26,7 @@ export interface SearchBoxProps extends HTMLAttributes<HTMLInputElement> {
|
|
|
25
26
|
/** **(Optional)** Specify placeholder text for the search field. Do not in place of a form label. */
|
|
26
27
|
placeholder?: string
|
|
27
28
|
/** **(Optional)** Specify the SearchBox size. */
|
|
28
|
-
size?:
|
|
29
|
+
size?: StandardSizes
|
|
29
30
|
/** **(Optional)** Specify the SearchBox variant. */
|
|
30
31
|
variant?:
|
|
31
32
|
| "green"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StandardSizes = "sm" | "md" | "lg"
|