@coopdigital/react 0.13.0 → 0.14.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.
|
@@ -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-label": ariaLabel, "aria-live": "assertive", className: `${variant == "text" ? "coop-link" : "coop-button"} ${className}`, "data-loading": isLoading || isPending ? true : undefined, "data-size": size.length && size
|
|
29
|
+
const componentProps = Object.assign({ "aria-disabled": isDisabled ? true : undefined, "aria-label": ariaLabel, "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
|
};
|
|
@@ -11,6 +11,7 @@ function getCardLinkElement(as, href) {
|
|
|
11
11
|
return {
|
|
12
12
|
element,
|
|
13
13
|
props: {
|
|
14
|
+
className: "coop-card--link",
|
|
14
15
|
href,
|
|
15
16
|
},
|
|
16
17
|
};
|
|
@@ -22,7 +23,7 @@ const Card = (_a) => {
|
|
|
22
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
24
|
const linkElement = getCardLinkElement(as, href);
|
|
24
25
|
const imageProps = Object.assign({ crop: "wide" }, image);
|
|
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
|
+
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 !== "vertical" ? layout : undefined }, props);
|
|
26
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" }) }) }))] })] })));
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -10,7 +10,7 @@ const Pill = (_a) => {
|
|
|
10
10
|
if (as) {
|
|
11
11
|
element = as;
|
|
12
12
|
}
|
|
13
|
-
const componentProps = Object.assign({ "aria-label": ariaLabel, 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
|
|
13
|
+
const componentProps = Object.assign({ "aria-label": ariaLabel, 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
|
|
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.14.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.13.0",
|
|
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": "4bcb898b00d73469db81f28e2fee06d8556f7ed7"
|
|
70
70
|
}
|
|
@@ -101,7 +101,7 @@ export const Button = ({
|
|
|
101
101
|
"aria-live": "assertive" as keyof ButtonHTMLAttributes<HTMLButtonElement>["aria-live"],
|
|
102
102
|
className: `${variant == "text" ? "coop-link" : "coop-button"} ${className}`,
|
|
103
103
|
"data-loading": isLoading || isPending ? true : undefined,
|
|
104
|
-
"data-size": size.length && size
|
|
104
|
+
"data-size": size.length && size !== "md" ? size : undefined,
|
|
105
105
|
"data-variant": variant !== "text" ? variant : undefined,
|
|
106
106
|
"data-width": isFullWidth ? "full" : undefined,
|
|
107
107
|
href,
|
|
@@ -47,6 +47,7 @@ function getCardLinkElement(as: CardProps["as"], href?: string) {
|
|
|
47
47
|
return {
|
|
48
48
|
element,
|
|
49
49
|
props: {
|
|
50
|
+
className: "coop-card--link",
|
|
50
51
|
href,
|
|
51
52
|
},
|
|
52
53
|
}
|
|
@@ -85,7 +86,7 @@ export const Card = ({
|
|
|
85
86
|
"data-bg": background,
|
|
86
87
|
"data-image-pos": imagePosition,
|
|
87
88
|
"data-label-bg": labelBackground,
|
|
88
|
-
"data-layout": layout,
|
|
89
|
+
"data-layout": layout !== "vertical" ? layout : undefined,
|
|
89
90
|
...props,
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -51,7 +51,7 @@ export const Pill = ({
|
|
|
51
51
|
"data-badge": badge?.length ? badge : undefined,
|
|
52
52
|
"data-badge-color": badgeColor,
|
|
53
53
|
"data-pill-color": pillColor,
|
|
54
|
-
"data-size": size.length && size
|
|
54
|
+
"data-size": size.length && size !== "md" ? size : undefined,
|
|
55
55
|
href,
|
|
56
56
|
...props,
|
|
57
57
|
}
|