@coopdigital/react 1.0.1 → 1.1.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.
@@ -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. "Published". */
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 };
@@ -2,10 +2,10 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
  import { hasUserBg } from '../../utils/index.js';
4
4
 
5
- const Squircle = ({ children, className, ref, size = "lg", ...props }) => {
5
+ const Squircle = ({ children, className, ref, size = "md", ...props }) => {
6
6
  const componentProps = {
7
7
  className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer", className),
8
- "data-size": size.length && size !== "lg" ? size : undefined,
8
+ "data-size": size.length && size !== "md" ? size : undefined,
9
9
  ...props,
10
10
  };
11
11
  return (jsx("figure", { ...componentProps, ref: ref, children: jsx("figcaption", { children: children }) }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "1.1.0",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -60,10 +60,10 @@
60
60
  "devDependencies": {
61
61
  "@axe-core/playwright": "^4.11.1",
62
62
  "@playwright/test": "^1.58.2",
63
- "@storybook/addon-a11y": "^10.3.1",
64
- "@storybook/addon-docs": "^10.3.1",
65
- "@storybook/addon-onboarding": "^10.3.1",
66
- "@storybook/react-vite": "^10.3.1",
63
+ "@storybook/addon-a11y": "^10.3.3",
64
+ "@storybook/addon-docs": "^10.3.3",
65
+ "@storybook/addon-onboarding": "^10.3.3",
66
+ "@storybook/react-vite": "^10.3.3",
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.1",
75
+ "storybook": "^10.3.3",
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.0.0",
86
+ "@coopdigital/styles": "^1.1.0",
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": "77ac845f6c5c2da659feaeabbd40f0bf717892f5"
91
+ "gitHead": "2a6a622f990720478906f047340836affc49cd32"
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. "Published". */
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>
@@ -18,12 +18,12 @@ export const Squircle = ({
18
18
  children,
19
19
  className,
20
20
  ref,
21
- size = "lg",
21
+ size = "md",
22
22
  ...props
23
23
  }: SquircleProps): JSX.Element => {
24
24
  const componentProps = {
25
25
  className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer", className),
26
- "data-size": size.length && size !== "lg" ? size : undefined,
26
+ "data-size": size.length && size !== "md" ? size : undefined,
27
27
  ...props,
28
28
  }
29
29