@coopdigital/react 1.26.1 → 1.27.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.
|
@@ -3,25 +3,35 @@ import "../Image/index.js";
|
|
|
3
3
|
import { HTMLAttributes, JSX, Ref } from "react";
|
|
4
4
|
//#region src/components/Author/Author.d.ts
|
|
5
5
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Content inside the component.
|
|
7
|
+
*
|
|
8
|
+
* This should be a set of `<Author.Image>` and `<Author.Meta>`. */
|
|
9
|
+
children?: React.ReactNode;
|
|
8
10
|
/** Specify additional CSS classes. */
|
|
9
11
|
className?: string;
|
|
12
|
+
/** Specify a custom React ref for this component. */
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
/** Specify the component size. */
|
|
15
|
+
size?: "sm" | "md";
|
|
16
|
+
}
|
|
17
|
+
export interface AuthorMetaProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
18
|
/** Specify the date.
|
|
11
19
|
*
|
|
12
20
|
* Recommended format `dd mmmm yyyy` eg: 1 January 2000. */
|
|
13
21
|
date?: string;
|
|
14
22
|
/** Specify the text that will prefix the date, e.g. "Updated". */
|
|
15
23
|
datePrefix?: string;
|
|
16
|
-
/** Specify
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
/** Specify the Author name. */
|
|
25
|
+
name?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthorImageProps extends Partial<ImageProps> {
|
|
28
|
+
alt?: string;
|
|
29
|
+
src?: string;
|
|
22
30
|
}
|
|
23
31
|
declare const Author: {
|
|
24
|
-
({
|
|
32
|
+
({ children, className, ref, size, ...props }: AuthorProps): JSX.Element;
|
|
33
|
+
Image: ({ alt, src, ...props }: AuthorImageProps) => JSX.Element;
|
|
34
|
+
Meta: ({ date, datePrefix, name, ...props }: AuthorMetaProps) => JSX.Element;
|
|
25
35
|
slot: {
|
|
26
36
|
name: string;
|
|
27
37
|
};
|
|
@@ -2,31 +2,44 @@ import { Image } from "../Image/Image.js";
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Author/Author.tsx
|
|
5
|
-
const Author = ({
|
|
6
|
-
alt: "",
|
|
7
|
-
src: "https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg"
|
|
8
|
-
}, ref, size, ...props }) => {
|
|
9
|
-
const imageProps = {
|
|
10
|
-
width: "56px",
|
|
11
|
-
...image
|
|
12
|
-
};
|
|
5
|
+
const Author = ({ children, className, ref, size, ...props }) => {
|
|
13
6
|
const componentProps = {
|
|
14
7
|
className: clsx("coop-author", className),
|
|
15
8
|
"data-size": size ?? void 0,
|
|
16
9
|
...props
|
|
17
10
|
};
|
|
18
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
12
|
...componentProps,
|
|
20
13
|
ref,
|
|
21
|
-
children
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const COOP_LOGO_SRC = "https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg";
|
|
18
|
+
const AuthorImage = ({ alt = "", src = COOP_LOGO_SRC, ...props }) => {
|
|
19
|
+
const componentProps = {
|
|
20
|
+
alt,
|
|
21
|
+
src,
|
|
22
|
+
width: "56px",
|
|
23
|
+
...props
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(Image, { ...componentProps });
|
|
26
|
+
};
|
|
27
|
+
const AuthorMeta = ({ date, datePrefix, name = "Co-op team", ...props }) => {
|
|
28
|
+
const componentProps = {
|
|
29
|
+
name,
|
|
30
|
+
...props
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "coop-author--content",
|
|
34
|
+
...componentProps,
|
|
35
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [datePrefix && /* @__PURE__ */ jsx("span", { children: datePrefix + " " }), /* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "coop-author--date",
|
|
37
|
+
children: date
|
|
38
|
+
})] }), /* @__PURE__ */ jsxs("span", { children: ["by ", name] })]
|
|
28
39
|
});
|
|
29
40
|
};
|
|
41
|
+
Author.Image = AuthorImage;
|
|
42
|
+
Author.Meta = AuthorMeta;
|
|
30
43
|
Author.slot = { name: "Author" };
|
|
31
44
|
//#endregion
|
|
32
45
|
export { Author, Author as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Author, AuthorProps } from "./Author.js";
|
|
2
|
-
export { Author, Author as default, AuthorProps };
|
|
1
|
+
import { Author, AuthorImageProps, AuthorMetaProps, AuthorProps } from "./Author.js";
|
|
2
|
+
export { Author, Author as default, AuthorImageProps, AuthorMetaProps, AuthorProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AlertBanner, AlertBannerHeading, AlertBannerProps } from "./components/AlertBanner/AlertBanner.js";
|
|
2
2
|
import { Image, ImageProps } from "./components/Image/Image.js";
|
|
3
|
-
import { Author, AuthorProps } from "./components/Author/Author.js";
|
|
3
|
+
import { Author, AuthorImageProps, AuthorMetaProps, AuthorProps } from "./components/Author/Author.js";
|
|
4
4
|
import { Box, BoxProps } from "./components/Box/Box.js";
|
|
5
5
|
import "./components/Box/index.js";
|
|
6
6
|
import { Button, ButtonProps } from "./components/Button/Button.js";
|
|
@@ -38,4 +38,4 @@ import { Textarea, TextareaProps } from "./components/Textarea/Textarea.js";
|
|
|
38
38
|
import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps } from "./components/ValidationSummary/ValidationSummary.js";
|
|
39
39
|
import { Wrapper, WrapperProps } from "./components/Wrapper/Wrapper.js";
|
|
40
40
|
import "./components/Wrapper/index.js";
|
|
41
|
-
export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Box, BoxProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, Combobox, ComboboxControlsProps, ComboboxInputProps, ComboboxOptionsProps, ComboboxProps, DatePicker, DatePickerProps, type DateType, type DateTypeStr, Dialog, DialogBody, DialogHeader, DialogProps, Expandable, ExpandableContent, ExpandableProps, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, FieldsetProps, Flourish, FlourishProps, Form, FormProps, Image, ImageProps, LoadingSpinner, LoadingSpinnerProps, Logo, LogoProps, PasswordInput, PasswordInputProps, Picture, PictureProps, Pill, PillBadge, PillProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, PopoverTrigger, Radio, RadioProps, RootSVG, Searchbox, SearchboxButton, SearchboxInput, SearchboxProps, Section, SectionProps, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps, Wrapper, WrapperProps };
|
|
41
|
+
export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorImageProps, AuthorMetaProps, AuthorProps, Box, BoxProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, Combobox, ComboboxControlsProps, ComboboxInputProps, ComboboxOptionsProps, ComboboxProps, DatePicker, DatePickerProps, type DateType, type DateTypeStr, Dialog, DialogBody, DialogHeader, DialogProps, Expandable, ExpandableContent, ExpandableProps, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, FieldsetProps, Flourish, FlourishProps, Form, FormProps, Image, ImageProps, LoadingSpinner, LoadingSpinnerProps, Logo, LogoProps, PasswordInput, PasswordInputProps, Picture, PictureProps, Pill, PillBadge, PillProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, PopoverTrigger, Radio, RadioProps, RootSVG, Searchbox, SearchboxButton, SearchboxInput, SearchboxProps, Section, SectionProps, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps, Wrapper, WrapperProps };
|
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.27.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@axe-core/playwright": "^4.13.0",
|
|
71
71
|
"@playwright/test": "^1.63.0",
|
|
72
|
-
"@storybook/addon-a11y": "^10.6.
|
|
73
|
-
"@storybook/addon-docs": "^10.6.
|
|
74
|
-
"@storybook/addon-links": "^10.6.
|
|
75
|
-
"@storybook/addon-onboarding": "^10.6.
|
|
76
|
-
"@storybook/react-vite": "^10.6.
|
|
72
|
+
"@storybook/addon-a11y": "^10.6.1",
|
|
73
|
+
"@storybook/addon-docs": "^10.6.1",
|
|
74
|
+
"@storybook/addon-links": "^10.6.1",
|
|
75
|
+
"@storybook/addon-onboarding": "^10.6.1",
|
|
76
|
+
"@storybook/react-vite": "^10.6.1",
|
|
77
77
|
"@testing-library/jest-dom": "^7.0.1",
|
|
78
78
|
"@testing-library/react": "^16.3.3",
|
|
79
79
|
"@types/react": "^19.3.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react-dom": "^19.3.0",
|
|
84
84
|
"resize-observer-polyfill": "^1.5.1",
|
|
85
85
|
"serve": "^14.2.6",
|
|
86
|
-
"storybook": "^10.6.
|
|
86
|
+
"storybook": "^10.6.1",
|
|
87
87
|
"storybook-addon-tag-badges": "^3.1.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"downshift": "^9.4.0",
|
|
115
115
|
"match-sorter": "^8.3.0",
|
|
116
116
|
"merge-refs": "^2.0.0",
|
|
117
|
-
"react-day-picker": "^10.0.
|
|
117
|
+
"react-day-picker": "^10.0.2"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "9e3d7cf5e1e32c946117d5be84ed2a11d022f2f1"
|
|
120
120
|
}
|
|
@@ -5,61 +5,86 @@ import clsx from "clsx"
|
|
|
5
5
|
import { Image, ImageProps } from "@/components/Image"
|
|
6
6
|
|
|
7
7
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/** Content inside the component.
|
|
9
|
+
*
|
|
10
|
+
* This should be a set of `<Author.Image>` and `<Author.Meta>`. */
|
|
11
|
+
children?: React.ReactNode
|
|
10
12
|
/** Specify additional CSS classes. */
|
|
11
13
|
className?: string
|
|
14
|
+
/** Specify a custom React ref for this component. */
|
|
15
|
+
ref?: Ref<HTMLDivElement>
|
|
16
|
+
/** Specify the component size. */
|
|
17
|
+
size?: "sm" | "md"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AuthorMetaProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
21
|
/** Specify the date.
|
|
13
22
|
*
|
|
14
23
|
* Recommended format `dd mmmm yyyy` eg: 1 January 2000. */
|
|
15
24
|
date?: string
|
|
16
25
|
/** Specify the text that will prefix the date, e.g. "Updated". */
|
|
17
26
|
datePrefix?: string
|
|
18
|
-
/** Specify
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
/** Specify the Author name. */
|
|
28
|
+
name?: string
|
|
29
|
+
}
|
|
30
|
+
export interface AuthorImageProps extends Partial<ImageProps> {
|
|
31
|
+
alt?: string
|
|
32
|
+
src?: string
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
const Author = ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const Author = ({ children, className, ref, size, ...props }: AuthorProps): JSX.Element => {
|
|
36
|
+
const componentProps = {
|
|
37
|
+
className: clsx("coop-author", className),
|
|
38
|
+
"data-size": size ?? undefined,
|
|
39
|
+
...props,
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
<div {...componentProps} ref={ref}>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const COOP_LOGO_SRC =
|
|
49
|
+
"https://s3.eu-west-1.amazonaws.com/assets.digital.coop.co.uk/oneweb/coop-logo-inverted.svg"
|
|
50
|
+
|
|
51
|
+
const AuthorImage = ({
|
|
52
|
+
alt = "",
|
|
53
|
+
src = COOP_LOGO_SRC,
|
|
37
54
|
...props
|
|
38
|
-
}:
|
|
39
|
-
const
|
|
55
|
+
}: AuthorImageProps): JSX.Element => {
|
|
56
|
+
const componentProps = {
|
|
57
|
+
alt,
|
|
58
|
+
src,
|
|
40
59
|
width: "56px",
|
|
41
|
-
...
|
|
60
|
+
...props,
|
|
42
61
|
}
|
|
62
|
+
return <Image {...componentProps} />
|
|
63
|
+
}
|
|
43
64
|
|
|
65
|
+
const AuthorMeta = ({
|
|
66
|
+
date,
|
|
67
|
+
datePrefix,
|
|
68
|
+
name = "Co-op team",
|
|
69
|
+
...props
|
|
70
|
+
}: AuthorMetaProps): JSX.Element => {
|
|
44
71
|
const componentProps = {
|
|
45
|
-
|
|
46
|
-
"data-size": size ?? undefined,
|
|
72
|
+
name,
|
|
47
73
|
...props,
|
|
48
74
|
}
|
|
49
75
|
return (
|
|
50
|
-
<div {...componentProps}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<span>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</span>
|
|
57
|
-
<span>by {author}</span>
|
|
58
|
-
</div>
|
|
76
|
+
<div className="coop-author--content" {...componentProps}>
|
|
77
|
+
<span>
|
|
78
|
+
{datePrefix && <span>{datePrefix + " "}</span>}
|
|
79
|
+
<span className="coop-author--date">{date}</span>
|
|
80
|
+
</span>
|
|
81
|
+
<span>by {name}</span>
|
|
59
82
|
</div>
|
|
60
83
|
)
|
|
61
84
|
}
|
|
62
85
|
|
|
86
|
+
Author.Image = AuthorImage
|
|
87
|
+
Author.Meta = AuthorMeta
|
|
63
88
|
Author.slot = { name: "Author" }
|
|
64
89
|
|
|
65
90
|
export default Author
|