@coopdigital/react 1.0.2 → 1.1.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.
- package/dist/components/Author/Author.d.ts +4 -2
- package/dist/components/Author/Author.js +3 -2
- package/dist/components/Pill/Pill.d.ts +1 -1
- package/dist/hooks/useSlots.d.ts +1 -1
- package/package.json +9 -9
- package/src/components/Author/Author.tsx +7 -3
- package/src/components/Pill/Pill.tsx +1 -1
- package/src/hooks/useSlots.ts +2 -1
|
@@ -7,12 +7,14 @@ export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
/** **(Optional)** Specify the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
9
9
|
date?: string;
|
|
10
|
-
/** **(Optional)** Specify the text that will prefix the date, e.g. "
|
|
10
|
+
/** **(Optional)** Specify the text that will prefix the date, e.g. "Updated". */
|
|
11
11
|
datePrefix?: string;
|
|
12
12
|
/** **(Optional)** Specify properties of the Author Image. */
|
|
13
13
|
image?: ImageProps;
|
|
14
14
|
/** **(Optional)** Specify a custom React ref for this component. */
|
|
15
15
|
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
/** **(Optional)** Specify the Author size. */
|
|
17
|
+
size?: "sm" | "md";
|
|
16
18
|
}
|
|
17
|
-
export declare const Author: ({ author, className, date, datePrefix, image, ref, ...props }: AuthorProps) => JSX.Element;
|
|
19
|
+
export declare const Author: ({ author, className, date, datePrefix, image, ref, size, ...props }: AuthorProps) => JSX.Element;
|
|
18
20
|
export default Author;
|
|
@@ -5,16 +5,17 @@ import { Image } from '../Image/Image.js';
|
|
|
5
5
|
const Author = ({ author = "Co-op team", className, date, datePrefix = "", image = {
|
|
6
6
|
alt: "",
|
|
7
7
|
src: "https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg",
|
|
8
|
-
}, ref, ...props }) => {
|
|
8
|
+
}, ref, size = "md", ...props }) => {
|
|
9
9
|
const imageProps = {
|
|
10
10
|
width: "56px",
|
|
11
11
|
...image,
|
|
12
12
|
};
|
|
13
13
|
const componentProps = {
|
|
14
14
|
className: clsx("coop-author", className),
|
|
15
|
+
"data-size": size.length && size !== "md" ? size : undefined,
|
|
15
16
|
...props,
|
|
16
17
|
};
|
|
17
|
-
return (jsxs("div", { ...componentProps, ref: ref, children: [image && jsx(Image, { ...imageProps }), jsxs("div", { className: "coop-author--content", children: [jsxs("span", { children: [datePrefix ? datePrefix + " " : "", date] }), jsxs("span", { children: ["by ", author] })] })] }));
|
|
18
|
+
return (jsxs("div", { ...componentProps, ref: ref, children: [image && jsx(Image, { ...imageProps }), jsxs("div", { className: "coop-author--content", children: [jsxs("span", { children: [jsx("span", { children: datePrefix ? datePrefix + " " : "" }), jsx("span", { className: "coop-author--date", children: date })] }), jsxs("span", { children: ["by ", author] })] })] }));
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export { Author, Author as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { StandardSizes } from "
|
|
3
|
+
import { StandardSizes } from "../../types";
|
|
4
4
|
export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
5
5
|
/** **(Optional)** Specify a custom element to override default `a` or `span`. */
|
|
6
6
|
as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
|
package/dist/hooks/useSlots.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ReactNodeWithConfig } from "
|
|
2
|
+
import { ReactNodeWithConfig } from "../types";
|
|
3
3
|
type Slots<T> = Record<keyof T, React.ReactNode>;
|
|
4
4
|
export declare function isKey<T extends object>(x: T, k: PropertyKey): k is keyof T;
|
|
5
5
|
export declare function getSlotName(node: ReactNodeWithConfig): string | false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"description": "React components for the Experience Library design system",
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@axe-core/playwright": "^4.11.1",
|
|
62
|
-
"@playwright/test": "^1.
|
|
63
|
-
"@storybook/addon-a11y": "^10.3.
|
|
64
|
-
"@storybook/addon-docs": "^10.3.
|
|
65
|
-
"@storybook/addon-onboarding": "^10.3.
|
|
66
|
-
"@storybook/react-vite": "^10.3.
|
|
62
|
+
"@playwright/test": "^1.59.1",
|
|
63
|
+
"@storybook/addon-a11y": "^10.3.4",
|
|
64
|
+
"@storybook/addon-docs": "^10.3.4",
|
|
65
|
+
"@storybook/addon-onboarding": "^10.3.4",
|
|
66
|
+
"@storybook/react-vite": "^10.3.4",
|
|
67
67
|
"@testing-library/jest-dom": "^6.9.1",
|
|
68
68
|
"@testing-library/react": "^16.3.2",
|
|
69
69
|
"@types/react": "^19.2.14",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-dom": "^19.2.4",
|
|
73
73
|
"resize-observer-polyfill": "^1.5.1",
|
|
74
74
|
"serve": "^14.2.6",
|
|
75
|
-
"storybook": "^10.3.
|
|
75
|
+
"storybook": "^10.3.4",
|
|
76
76
|
"storybook-addon-tag-badges": "^3.1.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
"storybook": "$storybook"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@coopdigital/styles": "^1.
|
|
86
|
+
"@coopdigital/styles": "^1.1.1",
|
|
87
87
|
"@radix-ui/react-popover": "^1.1.15",
|
|
88
88
|
"clsx": "^2.1.1",
|
|
89
89
|
"react-day-picker": "^9.12.0"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "9a04874735f6af3ec583dd6960c7d3ef5446965f"
|
|
92
92
|
}
|
|
@@ -11,12 +11,14 @@ export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
className?: string
|
|
12
12
|
/** **(Optional)** Specify the date. Refer to Experience Library guidance on date formats. We advise using the following format (dd mmmm yyyy) eg: 1 January 2000. */
|
|
13
13
|
date?: string
|
|
14
|
-
/** **(Optional)** Specify the text that will prefix the date, e.g. "
|
|
14
|
+
/** **(Optional)** Specify the text that will prefix the date, e.g. "Updated". */
|
|
15
15
|
datePrefix?: string
|
|
16
16
|
/** **(Optional)** Specify properties of the Author Image. */
|
|
17
17
|
image?: ImageProps
|
|
18
18
|
/** **(Optional)** Specify a custom React ref for this component. */
|
|
19
19
|
ref?: Ref<HTMLDivElement>
|
|
20
|
+
/** **(Optional)** Specify the Author size. */
|
|
21
|
+
size?: "sm" | "md"
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export const Author = ({
|
|
@@ -29,6 +31,7 @@ export const Author = ({
|
|
|
29
31
|
src: "https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg",
|
|
30
32
|
},
|
|
31
33
|
ref,
|
|
34
|
+
size = "md",
|
|
32
35
|
...props
|
|
33
36
|
}: AuthorProps): JSX.Element => {
|
|
34
37
|
const imageProps: ImageProps = {
|
|
@@ -38,6 +41,7 @@ export const Author = ({
|
|
|
38
41
|
|
|
39
42
|
const componentProps = {
|
|
40
43
|
className: clsx("coop-author", className),
|
|
44
|
+
"data-size": size.length && size !== "md" ? size : undefined,
|
|
41
45
|
...props,
|
|
42
46
|
}
|
|
43
47
|
return (
|
|
@@ -45,8 +49,8 @@ export const Author = ({
|
|
|
45
49
|
{image && <Image {...imageProps} />}
|
|
46
50
|
<div className="coop-author--content">
|
|
47
51
|
<span>
|
|
48
|
-
{datePrefix ? datePrefix + " " : ""}
|
|
49
|
-
{date}
|
|
52
|
+
<span>{datePrefix ? datePrefix + " " : ""}</span>
|
|
53
|
+
<span className="coop-author--date">{date}</span>
|
|
50
54
|
</span>
|
|
51
55
|
<span>by {author}</span>
|
|
52
56
|
</div>
|
|
@@ -2,9 +2,9 @@ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react"
|
|
|
2
2
|
|
|
3
3
|
import clsx from "clsx"
|
|
4
4
|
import React from "react"
|
|
5
|
-
import { StandardSizes } from "src/types"
|
|
6
5
|
|
|
7
6
|
import { useSlots } from "../../hooks/useSlots"
|
|
7
|
+
import { StandardSizes } from "../../types"
|
|
8
8
|
import { hasUserBg } from "../../utils"
|
|
9
9
|
|
|
10
10
|
export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
|