@coopdigital/react 1.19.1 → 1.21.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/AlertBanner/AlertBanner.js +5 -2
- package/dist/components/Author/Author.js +5 -2
- package/dist/components/Card/Card.d.ts +96 -49
- package/dist/components/Card/Card.js +61 -60
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/Card/index.js +2 -2
- package/dist/components/Checkbox/Checkbox.js +5 -2
- package/dist/components/DatePicker/DatePicker.js +5 -4
- package/dist/components/DatePicker/datepicker-utils.js +12 -11
- package/dist/components/Dialog/Dialog.js +5 -2
- package/dist/components/Expandable/Expandable.js +5 -2
- package/dist/components/FieldMarkers/Error.js +5 -2
- package/dist/components/FieldMarkers/Hint.js +5 -2
- package/dist/components/FieldMarkers/Label.js +5 -2
- package/dist/components/Fieldset/Fieldset.js +10 -4
- package/dist/components/Flourish/Flourish.js +6 -3
- package/dist/components/Form/Form.js +5 -2
- package/dist/components/Image/Image.d.ts +3 -5
- package/dist/components/Image/Image.js +10 -7
- package/dist/components/LoadingSpinner/LoadingSpinner.js +5 -2
- package/dist/components/Logo/Logo.js +5 -2
- package/dist/components/Picture/Picture.d.ts +15 -0
- package/dist/components/Picture/Picture.js +17 -0
- package/dist/components/Picture/index.d.ts +2 -0
- package/dist/components/Picture/index.js +5 -0
- package/dist/components/Prose/Prose.js +5 -2
- package/dist/components/Radio/Radio.js +5 -2
- package/dist/components/Searchbox/Searchbox.js +3 -2
- package/dist/components/Select/Select.js +5 -2
- package/dist/components/Signpost/Signpost.js +6 -6
- package/dist/components/SkipNav/SkipNav.js +5 -2
- package/dist/components/Squircle/Squircle.d.ts +8 -4
- package/dist/components/Squircle/Squircle.js +39 -6
- package/dist/components/Squircle/index.d.ts +2 -2
- package/dist/components/ValidationSummary/ValidationSummary.js +5 -2
- package/dist/components/icons/AccountCircleFilledIcon.js +5 -2
- package/dist/components/icons/AccountCircleIcon.js +5 -2
- package/dist/components/icons/AccountFilledIcon.js +5 -2
- package/dist/components/icons/AccountIcon.js +5 -2
- package/dist/components/icons/AddIcon.js +5 -2
- package/dist/components/icons/AppsFilledIcon.js +5 -2
- package/dist/components/icons/AppsIcon.js +5 -2
- package/dist/components/icons/ArrowDownIcon.js +5 -2
- package/dist/components/icons/ArrowLeftIcon.js +5 -2
- package/dist/components/icons/ArrowRightIcon.js +5 -2
- package/dist/components/icons/ArrowUpIcon.js +5 -2
- package/dist/components/icons/BackspaceFilledIcon.js +5 -2
- package/dist/components/icons/BackspaceIcon.js +5 -2
- package/dist/components/icons/BasketFilledIcon.js +5 -2
- package/dist/components/icons/BasketIcon.js +5 -2
- package/dist/components/icons/BellFilledIcon.js +5 -2
- package/dist/components/icons/BellIcon.js +5 -2
- package/dist/components/icons/BroomIcon.js +5 -2
- package/dist/components/icons/CalendarFilledIcon.js +5 -2
- package/dist/components/icons/CalendarIcon.js +5 -2
- package/dist/components/icons/CashFilledIcon.js +5 -2
- package/dist/components/icons/CashIcon.js +5 -2
- package/dist/components/icons/ChevronDownIcon.js +5 -2
- package/dist/components/icons/ChevronLeftIcon.js +5 -2
- package/dist/components/icons/ChevronRightIcon.js +5 -2
- package/dist/components/icons/ChevronUpIcon.js +5 -2
- package/dist/components/icons/CircleBurgerFilledIcon.js +5 -2
- package/dist/components/icons/CircleBurgerIcon.js +5 -2
- package/dist/components/icons/ClipboardFilledIcon.js +5 -2
- package/dist/components/icons/ClipboardIcon.js +5 -2
- package/dist/components/icons/ClockFilledIcon.js +5 -2
- package/dist/components/icons/ClockIcon.js +5 -2
- package/dist/components/icons/CloseAltFilledIcon.js +5 -2
- package/dist/components/icons/CloseAltIcon.js +5 -2
- package/dist/components/icons/CogIcon.js +5 -2
- package/dist/components/icons/CommunityFilledIcon.js +5 -2
- package/dist/components/icons/CommunityIcon.js +5 -2
- package/dist/components/icons/ComputerIcon.js +5 -2
- package/dist/components/icons/ContactFilledIcon.js +5 -2
- package/dist/components/icons/ContactIcon.js +5 -2
- package/dist/components/icons/ContactlessFilledIcon.js +5 -2
- package/dist/components/icons/ContactlessIcon.js +5 -2
- package/dist/components/icons/CoopLiveIcon.js +5 -2
- package/dist/components/icons/CoopLocationFilledIcon.js +5 -2
- package/dist/components/icons/CoopLogoIcon.js +5 -2
- package/dist/components/icons/CoopMembershipCardFilledIcon.js +5 -2
- package/dist/components/icons/CreditCardFilledIcon.js +5 -2
- package/dist/components/icons/CreditCardIcon.js +5 -2
- package/dist/components/icons/CrossIcon.js +5 -2
- package/dist/components/icons/DocumentIcon.js +5 -2
- package/dist/components/icons/DownloadIcon.js +5 -2
- package/dist/components/icons/EnterStoreIcon.js +5 -2
- package/dist/components/icons/ExitStoreIcon.js +5 -2
- package/dist/components/icons/EyeFilledIcon.js +5 -2
- package/dist/components/icons/EyeIcon.js +5 -2
- package/dist/components/icons/EyeStrikeFilledIcon.js +5 -2
- package/dist/components/icons/EyeStrikeIcon.js +5 -2
- package/dist/components/icons/FeedbackFilledIcon.js +5 -2
- package/dist/components/icons/FeedbackIcon.js +5 -2
- package/dist/components/icons/FilterIcon.js +5 -2
- package/dist/components/icons/GiftCardFilledIcon.js +5 -2
- package/dist/components/icons/GiftCardIcon.js +5 -2
- package/dist/components/icons/GiftFilledIcon.js +5 -2
- package/dist/components/icons/GiftIcon.js +5 -2
- package/dist/components/icons/HelpFilledIcon.js +5 -2
- package/dist/components/icons/HelpIcon.js +5 -2
- package/dist/components/icons/HomeFilledIcon.js +5 -2
- package/dist/components/icons/HomeIcon.js +5 -2
- package/dist/components/icons/HowDoIAssistantIcon.js +5 -2
- package/dist/components/icons/InfoIcon.js +5 -2
- package/dist/components/icons/KebabIcon.js +5 -2
- package/dist/components/icons/LoadingIcon.js +5 -2
- package/dist/components/icons/LocationFilledIcon.js +5 -2
- package/dist/components/icons/LocationIcon.js +5 -2
- package/dist/components/icons/LogoutIcon.js +5 -2
- package/dist/components/icons/MailIcon.js +5 -2
- package/dist/components/icons/MenuIcon.js +5 -2
- package/dist/components/icons/MessageIcon.js +5 -2
- package/dist/components/icons/MinusIcon.js +5 -2
- package/dist/components/icons/NotesFilledIcon.js +5 -2
- package/dist/components/icons/NotesIcon.js +5 -2
- package/dist/components/icons/OpenNewIcon.js +5 -2
- package/dist/components/icons/OwnBagIcon.js +5 -2
- package/dist/components/icons/PadlockIcon.js +5 -2
- package/dist/components/icons/PencilIcon.js +5 -2
- package/dist/components/icons/PhoneIcon.js +5 -2
- package/dist/components/icons/PowerIcon.js +5 -2
- package/dist/components/icons/SaveFilledIcon.js +5 -2
- package/dist/components/icons/SaveIcon.js +5 -2
- package/dist/components/icons/ScooterIcon.js +5 -2
- package/dist/components/icons/SearchFilledIcon.js +5 -2
- package/dist/components/icons/SearchIcon.js +5 -2
- package/dist/components/icons/SendIcon.js +5 -2
- package/dist/components/icons/SpannerIcon.js +5 -2
- package/dist/components/icons/StarFilledIcon.js +5 -2
- package/dist/components/icons/StarIcon.js +5 -2
- package/dist/components/icons/TickAltFilledIcon.js +5 -2
- package/dist/components/icons/TickAltIcon.js +5 -2
- package/dist/components/icons/TickIcon.js +5 -2
- package/dist/components/icons/TruckIcon.js +5 -2
- package/dist/components/icons/UserWipeIcon.js +5 -2
- package/dist/components/icons/VoucherFilledIcon.js +5 -2
- package/dist/components/icons/VoucherIcon.js +5 -2
- package/dist/components/icons/WarningCircleFilledIcon.js +5 -2
- package/dist/components/icons/WarningCircleIcon.js +5 -2
- package/dist/components/icons/WarningFilledIcon.js +5 -2
- package/dist/components/icons/WarningIcon.js +5 -2
- package/dist/components/icons/WifiIcon.js +5 -2
- package/dist/components/icons/WriteIcon.js +5 -2
- package/dist/hooks/useSlots.js +4 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/package.json +10 -10
- package/src/components/Card/Card.tsx +146 -100
- package/src/components/Image/Image.tsx +15 -22
- package/src/components/Picture/Picture.tsx +36 -0
- package/src/components/Picture/index.ts +5 -0
- package/src/components/Signpost/Signpost.tsx +1 -1
- package/src/components/Squircle/Squircle.tsx +50 -13
- package/src/index.ts +1 -0
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/VoucherFilledIcon.tsx
|
|
5
5
|
const VoucherFilledIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "voucher-filled",
|
|
@@ -12,7 +12,10 @@ const VoucherFilledIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/VoucherIcon.tsx
|
|
5
5
|
const VoucherIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "voucher",
|
|
@@ -12,7 +12,10 @@ const VoucherIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WarningCircleFilledIcon.tsx
|
|
5
5
|
const WarningCircleFilledIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "warning-circle-filled",
|
|
@@ -12,7 +12,10 @@ const WarningCircleFilledIcon = ({ alt, className, fill, id, ref, ...props }) =>
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WarningCircleIcon.tsx
|
|
5
5
|
const WarningCircleIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "warning-circle",
|
|
@@ -12,7 +12,10 @@ const WarningCircleIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [
|
|
18
21
|
alt ? /* @__PURE__ */ jsx("title", {
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WarningFilledIcon.tsx
|
|
5
5
|
const WarningFilledIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "warning-filled",
|
|
@@ -12,7 +12,10 @@ const WarningFilledIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WarningIcon.tsx
|
|
5
5
|
const WarningIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "warning",
|
|
@@ -12,7 +12,10 @@ const WarningIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WifiIcon.tsx
|
|
5
5
|
const WifiIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "wifi",
|
|
@@ -12,7 +12,10 @@ const WifiIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/components/icons/WriteIcon.tsx
|
|
5
5
|
const WriteIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
6
6
|
const uid = useId(id);
|
|
7
|
-
|
|
7
|
+
const componentProps = {
|
|
8
8
|
"aria-labelledby": alt ? uid + "__title" : void 0,
|
|
9
9
|
className: clsx("coop-icon", className),
|
|
10
10
|
"data-icon": "write",
|
|
@@ -12,7 +12,10 @@ const WriteIcon = ({ alt, className, fill, id, ref, ...props }) => {
|
|
|
12
12
|
id: uid,
|
|
13
13
|
role: alt ? "img" : void 0,
|
|
14
14
|
viewBox: "0 0 32 32",
|
|
15
|
-
...props
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
...componentProps,
|
|
16
19
|
ref,
|
|
17
20
|
children: [alt ? /* @__PURE__ */ jsx("title", {
|
|
18
21
|
id: uid + "__title",
|
package/dist/hooks/useSlots.js
CHANGED
|
@@ -31,9 +31,10 @@ function getSlotName(node) {
|
|
|
31
31
|
function useSlots(componentSlots, children, options) {
|
|
32
32
|
return React.Children.toArray(children).reduce((slots, child) => {
|
|
33
33
|
const slotName = getSlotName(child);
|
|
34
|
-
if (child && slotName && isKey(componentSlots, slotName))
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (child && slotName && isKey(componentSlots, slotName)) {
|
|
35
|
+
if (options?.collect?.includes(slotName)) slots[slotName] = slots[slotName] ? [...[slots[slotName]].flat(), child] : [child];
|
|
36
|
+
else slots[slotName] = child;
|
|
37
|
+
} else if ("Children" in slots) slots.Children = slots.Children ? [...[slots.Children].flat(), child] : [child];
|
|
37
38
|
return slots;
|
|
38
39
|
}, { ...componentSlots });
|
|
39
40
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { AlertBanner, AlertBannerHeading, AlertBannerProps } from "./components/
|
|
|
2
2
|
import { Image, ImageProps } from "./components/Image/Image.js";
|
|
3
3
|
import { Author, AuthorProps } from "./components/Author/Author.js";
|
|
4
4
|
import { Button, ButtonProps } from "./components/Button/Button.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Picture, PictureProps } from "./components/Picture/Picture.js";
|
|
6
|
+
import "./components/Picture/index.js";
|
|
7
|
+
import { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps } from "./components/Card/Card.js";
|
|
6
8
|
import { Checkbox, CheckboxProps } from "./components/Checkbox/Checkbox.js";
|
|
7
9
|
import { DatePicker, DatePickerProps } from "./components/DatePicker/DatePicker.js";
|
|
8
10
|
import { Dialog, DialogBody, DialogHeader, DialogProps } from "./components/Dialog/Dialog.js";
|
|
@@ -23,8 +25,8 @@ import { Searchbox, SearchboxButton, SearchboxInput, SearchboxProps } from "./co
|
|
|
23
25
|
import { Select, SelectOption, SelectOptionGroup, SelectProps } from "./components/Select/Select.js";
|
|
24
26
|
import { Signpost, SignpostProps } from "./components/Signpost/Signpost.js";
|
|
25
27
|
import { SkipNav, SkipNavProps } from "./components/SkipNav/SkipNav.js";
|
|
26
|
-
import { Squircle, SquircleProps } from "./components/Squircle/Squircle.js";
|
|
28
|
+
import { Squircle, SquircleProps, SquircleSvgProps } from "./components/Squircle/Squircle.js";
|
|
27
29
|
import { Tag, TagProps } from "./components/Tag/Tag.js";
|
|
28
30
|
import { Textarea, TextareaProps } from "./components/Textarea/Textarea.js";
|
|
29
31
|
import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps } from "./components/ValidationSummary/ValidationSummary.js";
|
|
30
|
-
export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Button, ButtonProps, Card, CardBadge,
|
|
32
|
+
export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, DatePicker, DatePickerProps, 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, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,8 @@ import { Image } from "./components/Image/Image.js";
|
|
|
3
3
|
import { Author } from "./components/Author/Author.js";
|
|
4
4
|
import { LoadingSpinner } from "./components/LoadingSpinner/LoadingSpinner.js";
|
|
5
5
|
import { Button } from "./components/Button/Button.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Picture } from "./components/Picture/Picture.js";
|
|
7
|
+
import { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture } from "./components/Card/Card.js";
|
|
7
8
|
import { Checkbox } from "./components/Checkbox/Checkbox.js";
|
|
8
9
|
import { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger } from "./components/Popover/Popover.js";
|
|
9
10
|
import { TextInput } from "./components/TextInput/TextInput.js";
|
|
@@ -27,4 +28,4 @@ import { Squircle } from "./components/Squircle/Squircle.js";
|
|
|
27
28
|
import { Tag } from "./components/Tag/Tag.js";
|
|
28
29
|
import { Textarea } from "./components/Textarea/Textarea.js";
|
|
29
30
|
import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt } from "./components/ValidationSummary/ValidationSummary.js";
|
|
30
|
-
export { AlertBanner, AlertBannerHeading, Author, Button, Card, CardBadge,
|
|
31
|
+
export { AlertBanner, AlertBannerHeading, Author, Button, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Checkbox, DatePicker, Dialog, DialogBody, DialogHeader, Expandable, ExpandableContent, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, Flourish, Form, Image, LoadingSpinner, Logo, PasswordInput, Picture, Pill, PillBadge, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Radio, RootSVG, Searchbox, SearchboxButton, SearchboxInput, Select, SelectOption, SelectOptionGroup, Signpost, SkipNav, Squircle, Tag, TextInput, Textarea, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt };
|
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.21.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -66,20 +66,20 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@axe-core/playwright": "^4.13.0",
|
|
68
68
|
"@playwright/test": "^1.62.1",
|
|
69
|
-
"@storybook/addon-a11y": "^10.5.
|
|
70
|
-
"@storybook/addon-docs": "^10.5.
|
|
71
|
-
"@storybook/addon-onboarding": "^10.5.
|
|
72
|
-
"@storybook/react-vite": "^10.5.
|
|
69
|
+
"@storybook/addon-a11y": "^10.5.10",
|
|
70
|
+
"@storybook/addon-docs": "^10.5.10",
|
|
71
|
+
"@storybook/addon-onboarding": "^10.5.10",
|
|
72
|
+
"@storybook/react-vite": "^10.5.10",
|
|
73
73
|
"@testing-library/jest-dom": "^7.0.1",
|
|
74
|
-
"@testing-library/react": "^16.3.
|
|
74
|
+
"@testing-library/react": "^16.3.3",
|
|
75
75
|
"@types/react": "^19.2.18",
|
|
76
|
-
"@types/react-dom": "^19.2.
|
|
76
|
+
"@types/react-dom": "^19.2.5",
|
|
77
77
|
"@whitespace/storybook-addon-html": "^9.0.0",
|
|
78
78
|
"react": "^19.2.8",
|
|
79
79
|
"react-dom": "^19.2.8",
|
|
80
80
|
"resize-observer-polyfill": "^1.5.1",
|
|
81
81
|
"serve": "^14.2.6",
|
|
82
|
-
"storybook": "^10.5.
|
|
82
|
+
"storybook": "^10.5.10",
|
|
83
83
|
"storybook-addon-tag-badges": "^3.1.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"storybook": "$storybook"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@coopdigital/styles": "^1.
|
|
106
|
+
"@coopdigital/styles": "^1.15.0",
|
|
107
107
|
"@radix-ui/react-popover": "^1.1.23",
|
|
108
108
|
"clsx": "^2.1.1",
|
|
109
109
|
"date-fns": "^4.4.0",
|
|
110
110
|
"merge-refs": "^2.0.0",
|
|
111
111
|
"react-day-picker": "^10.0.1"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "a54fd337dade28ed2d1e1f7d4d0e2cfeb7b90c9e"
|
|
114
114
|
}
|
|
@@ -1,152 +1,153 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AnchorHTMLAttributes,
|
|
3
|
+
ForwardRefExoticComponent,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
JSX,
|
|
6
|
+
Ref,
|
|
7
|
+
} from "react"
|
|
2
8
|
|
|
3
9
|
import clsx from "clsx"
|
|
4
10
|
import React from "react"
|
|
5
11
|
|
|
6
|
-
import { ChevronRightIcon } from "@/components/icons/ChevronRightIcon"
|
|
7
12
|
import { Image, ImageProps } from "@/components/Image"
|
|
13
|
+
import Picture, { PictureProps } from "@/components/Picture"
|
|
8
14
|
import { useSlots } from "@/hooks/useSlots"
|
|
15
|
+
import { StandardSizes } from "@/types"
|
|
9
16
|
import { hasUserBg } from "@/utils"
|
|
10
17
|
|
|
11
18
|
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
-
/** **(Optional)** Specify how the
|
|
19
|
+
/** **(Optional)** Specify how the Card behaves across screen sizes.
|
|
13
20
|
*
|
|
14
|
-
*
|
|
21
|
+
* For finer control, use utility classes or custom CSS to control flex-direction. */
|
|
22
|
+
adaptive?: "sm" | "md"
|
|
23
|
+
/** **(Optional)** Specify an element to use for the container.
|
|
15
24
|
*
|
|
16
|
-
* Default:
|
|
25
|
+
* Default: `article`
|
|
17
26
|
*/
|
|
18
|
-
|
|
19
|
-
/** **(Optional)**
|
|
20
|
-
chevron?: boolean
|
|
21
|
-
/** **(Optional)** Content inside the component. Children that are not assigned to a slot will be grouped together and rendered under the main Card content. */
|
|
27
|
+
as?: "article" | "section" | "figure" | "div"
|
|
28
|
+
/** **(Optional)** Content inside the component. */
|
|
22
29
|
children?: React.ReactNode
|
|
23
|
-
/** **(Optional)** Specify additional CSS classes
|
|
30
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
24
31
|
className?: string
|
|
25
|
-
/** **(Optional)** Specify the
|
|
26
|
-
href?: string
|
|
27
|
-
/** **(Optional)** Specify a custom element to use instead of `a`. */
|
|
28
|
-
// oxlint-disable-next-line typescript/no-explicit-any
|
|
29
|
-
hrefAs?: React.FC<any> | ForwardRefExoticComponent<any> | string
|
|
30
|
-
/** **(Optional)** Specify the orientation of the Card.
|
|
31
|
-
*
|
|
32
|
-
* Default: vertical
|
|
33
|
-
*/
|
|
32
|
+
/** **(Optional)** Specify the Card orientation. */
|
|
34
33
|
orientation?: "vertical" | "horizontal"
|
|
34
|
+
/** **(Optional)** Specify the Card padding. */
|
|
35
|
+
padding?: StandardSizes
|
|
36
|
+
/** **(Optional)** Specify the Card border radius. */
|
|
37
|
+
radius?: StandardSizes
|
|
35
38
|
/** **(Optional)** Specify a custom React ref for this component. */
|
|
36
39
|
ref?: Ref<HTMLDivElement>
|
|
37
40
|
/** **(Optional)** Enable additional styles to use the Card as a signpost.
|
|
38
41
|
*
|
|
39
|
-
* Text is vertically aligned centrally and the
|
|
42
|
+
* Text is vertically aligned centrally and the Icon is enlarged. */
|
|
40
43
|
signpost?: boolean
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
interface
|
|
44
|
-
/** **(Optional)**
|
|
46
|
+
interface CardHeadingProps extends HTMLAttributes<HTMLDivElement> {
|
|
47
|
+
/** **(Optional)** Specify an element to use for the heading.
|
|
48
|
+
*
|
|
49
|
+
* Default: `h3`
|
|
50
|
+
*/
|
|
51
|
+
as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "strong" | "figcaption"
|
|
52
|
+
/** **(Optional)** Content inside the component. */
|
|
45
53
|
children?: React.ReactNode
|
|
46
|
-
/** **(Optional)** Specify additional CSS classes
|
|
54
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
47
55
|
className?: string
|
|
48
56
|
}
|
|
49
57
|
|
|
50
|
-
interface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
// interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
59
|
+
// /** **(Optional)** Content inside the Body. */
|
|
60
|
+
// children?: React.ReactNode
|
|
61
|
+
// }
|
|
62
|
+
|
|
63
|
+
interface CardIconProps extends HTMLAttributes<HTMLDivElement> {
|
|
64
|
+
/** **(Optional)** Content inside the component. */
|
|
54
65
|
children?: React.ReactNode
|
|
55
|
-
/** **(Optional)** Specify additional CSS classes
|
|
66
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
56
67
|
className?: string
|
|
57
68
|
}
|
|
58
69
|
|
|
59
|
-
interface
|
|
60
|
-
/** **(Optional)** Content inside the
|
|
70
|
+
interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
71
|
+
/** **(Optional)** Content inside the component. */
|
|
61
72
|
children?: React.ReactNode
|
|
73
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
74
|
+
className?: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface CardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
78
|
+
/** **(Optional)** Specify an element to use instead of native `a`. */
|
|
79
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
80
|
+
as?: React.FC<any> | ForwardRefExoticComponent<any> | string
|
|
81
|
+
/** **(Optional)** Content inside the component. */
|
|
82
|
+
children?: React.ReactNode
|
|
83
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
84
|
+
className?: string
|
|
62
85
|
}
|
|
63
86
|
|
|
64
87
|
interface CardBadgeProps extends HTMLAttributes<HTMLDivElement> {
|
|
65
|
-
/** **(Optional)** Specify
|
|
88
|
+
/** **(Optional)** Specify alignment relative to container.
|
|
89
|
+
*
|
|
90
|
+
* Default: `right`
|
|
91
|
+
*/
|
|
66
92
|
align?: "left" | "right"
|
|
67
|
-
/** **(Optional)** Content inside the
|
|
93
|
+
/** **(Optional)** Content inside the component. */
|
|
68
94
|
children?: React.ReactNode
|
|
69
|
-
/** **(Optional)** Specify additional CSS classes
|
|
95
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
70
96
|
className?: string
|
|
71
|
-
/** **(Optional)** Specify
|
|
97
|
+
/** **(Optional)** Specify position relative to top corner.
|
|
98
|
+
*
|
|
99
|
+
* Default: `popout`
|
|
100
|
+
*/
|
|
72
101
|
position?: "inset" | "popout"
|
|
73
102
|
}
|
|
74
103
|
|
|
75
|
-
|
|
76
|
-
/** **(Optional)** Specify on which side the
|
|
104
|
+
interface CardPictureProps extends PictureProps {
|
|
105
|
+
/** **(Optional)** Specify on which side the Picture should appear. */
|
|
77
106
|
align?: "left" | "right"
|
|
107
|
+
/** **(Optional)** Content inside the component. */
|
|
108
|
+
children?: React.ReactNode
|
|
109
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
110
|
+
className?: string
|
|
78
111
|
}
|
|
79
112
|
|
|
80
113
|
const componentSlots = {
|
|
81
114
|
CardBadge: null,
|
|
82
|
-
CardBody: null,
|
|
83
|
-
CardHeading: null,
|
|
84
|
-
CardImage: null,
|
|
85
|
-
CardLabel: null,
|
|
86
115
|
Children: null,
|
|
87
116
|
}
|
|
88
117
|
|
|
89
|
-
function getCardLinkElement(as: CardProps["hrefAs"], href?: string) {
|
|
90
|
-
return {
|
|
91
|
-
element: as ?? "a",
|
|
92
|
-
props: {
|
|
93
|
-
className: "coop-card--link",
|
|
94
|
-
href,
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
118
|
const Card = ({
|
|
100
119
|
adaptive,
|
|
101
|
-
|
|
120
|
+
as = "article",
|
|
102
121
|
children,
|
|
103
122
|
className,
|
|
104
|
-
href,
|
|
105
|
-
hrefAs,
|
|
106
123
|
orientation,
|
|
124
|
+
padding,
|
|
125
|
+
radius,
|
|
107
126
|
ref,
|
|
108
127
|
signpost,
|
|
109
128
|
...props
|
|
110
129
|
}: CardProps): JSX.Element => {
|
|
111
|
-
const { element: linkElement, props: linkProps } = getCardLinkElement(hrefAs, href)
|
|
112
|
-
|
|
113
130
|
const slots = { ...useSlots(componentSlots, children) }
|
|
114
|
-
const hasLinkWrapper = href && !slots.CardHeading
|
|
115
131
|
|
|
116
132
|
const componentProps = {
|
|
117
133
|
className: clsx("coop-card", !hasUserBg(className) && "bg-white", className),
|
|
118
134
|
"data-adaptive": adaptive ?? undefined,
|
|
119
135
|
"data-orientation": orientation ?? undefined,
|
|
136
|
+
"data-padding": padding ?? undefined,
|
|
137
|
+
"data-radius": radius ?? undefined,
|
|
120
138
|
"data-signpost": signpost ?? undefined,
|
|
121
139
|
...props,
|
|
122
140
|
}
|
|
123
141
|
|
|
124
|
-
|
|
125
|
-
slots.CardHeading = React.createElement(linkElement, linkProps, slots.CardHeading)
|
|
126
|
-
}
|
|
142
|
+
const cardContent = React.createElement(as, { ref, ...componentProps }, slots.Children)
|
|
127
143
|
|
|
128
|
-
return (
|
|
129
|
-
<
|
|
130
|
-
{
|
|
144
|
+
return slots.CardBadge ? (
|
|
145
|
+
<div className="coop-card-wrapper">
|
|
146
|
+
{cardContent}
|
|
131
147
|
{slots.CardBadge}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
? { className: "coop-card--content", href }
|
|
136
|
-
: { className: "coop-card--content" },
|
|
137
|
-
<>
|
|
138
|
-
{slots.CardLabel}
|
|
139
|
-
{slots.CardHeading}
|
|
140
|
-
{slots.CardBody}
|
|
141
|
-
{slots.Children}
|
|
142
|
-
</>
|
|
143
|
-
)}
|
|
144
|
-
{(chevron || signpost) && (
|
|
145
|
-
<span aria-hidden="true" className="coop-card--icon" role="presentation">
|
|
146
|
-
<ChevronRightIcon />
|
|
147
|
-
</span>
|
|
148
|
-
)}
|
|
149
|
-
</article>
|
|
148
|
+
</div>
|
|
149
|
+
) : (
|
|
150
|
+
cardContent
|
|
150
151
|
)
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -163,47 +164,92 @@ const CardHeading = ({
|
|
|
163
164
|
)
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
const CardIcon = ({ children, className, ...props }: CardIconProps): JSX.Element => {
|
|
168
|
+
const componentProps = {
|
|
169
|
+
className: clsx("coop-card--icon", className),
|
|
170
|
+
...props,
|
|
171
|
+
}
|
|
172
|
+
return <span {...componentProps}>{children}</span>
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
const CardBadge = ({
|
|
175
176
|
align = "right",
|
|
176
177
|
children,
|
|
178
|
+
className,
|
|
177
179
|
position = "popout",
|
|
178
180
|
...props
|
|
179
181
|
}: CardBadgeProps): JSX.Element => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
const componentProps = {
|
|
183
|
+
className: clsx("coop-card--badge", className),
|
|
184
|
+
"data-align": align,
|
|
185
|
+
"data-position": position,
|
|
186
|
+
...props,
|
|
187
|
+
}
|
|
188
|
+
return <div {...componentProps}>{children}</div>
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// const CardBody = ({ children }: CardBodyProps): JSX.Element => {
|
|
192
|
+
// return <>{children}</>
|
|
193
|
+
// }
|
|
194
|
+
|
|
195
|
+
const CardPicture = ({
|
|
196
|
+
align,
|
|
197
|
+
children,
|
|
198
|
+
className,
|
|
199
|
+
crop,
|
|
200
|
+
...props
|
|
201
|
+
}: CardPictureProps): JSX.Element => {
|
|
202
|
+
const componentProps = {
|
|
203
|
+
className: clsx("coop-card--picture", className),
|
|
204
|
+
"data-align": align ?? undefined,
|
|
205
|
+
"data-crop": crop ?? "wide",
|
|
206
|
+
...props,
|
|
207
|
+
}
|
|
208
|
+
return <Picture {...componentProps}>{children}</Picture>
|
|
185
209
|
}
|
|
186
210
|
|
|
187
|
-
const
|
|
188
|
-
|
|
211
|
+
const CardImage = (props: ImageProps): JSX.Element => <Image {...props} />
|
|
212
|
+
|
|
213
|
+
const CardContent = ({ children, className, ...props }: CardContentProps): JSX.Element => {
|
|
214
|
+
const componentProps = {
|
|
215
|
+
className: clsx("coop-card--content", className),
|
|
216
|
+
...props,
|
|
217
|
+
}
|
|
218
|
+
return <div {...componentProps}>{children}</div>
|
|
189
219
|
}
|
|
190
220
|
|
|
191
|
-
const
|
|
192
|
-
|
|
221
|
+
const CardLink = ({
|
|
222
|
+
as = "a",
|
|
223
|
+
children,
|
|
224
|
+
className,
|
|
225
|
+
href,
|
|
226
|
+
...props
|
|
227
|
+
}: CardLinkProps): JSX.Element => {
|
|
228
|
+
return React.createElement(
|
|
229
|
+
as,
|
|
230
|
+
{ className: clsx("coop-card--link", className), href, ...props },
|
|
231
|
+
children
|
|
232
|
+
)
|
|
193
233
|
}
|
|
194
234
|
|
|
195
235
|
Card.slot = { name: "Card" }
|
|
196
|
-
CardLabel.slot = { name: "CardLabel" }
|
|
197
236
|
CardHeading.slot = { name: "CardHeading" }
|
|
198
237
|
CardBadge.slot = { name: "CardBadge" }
|
|
199
|
-
|
|
238
|
+
CardIcon.slot = { name: "CardIcon" }
|
|
239
|
+
CardContent.slot = { name: "CardContent" }
|
|
200
240
|
CardImage.slot = { name: "CardImage" }
|
|
241
|
+
CardLink.slot = { name: "CardLink" }
|
|
242
|
+
|
|
243
|
+
CardPicture.slot = { name: "CardPicture" }
|
|
201
244
|
|
|
202
|
-
Card.
|
|
245
|
+
Card.Link = CardLink
|
|
203
246
|
Card.Heading = CardHeading
|
|
204
247
|
Card.Badge = CardBadge
|
|
205
|
-
Card.
|
|
248
|
+
Card.Content = CardContent
|
|
249
|
+
Card.Icon = CardIcon
|
|
206
250
|
Card.Image = CardImage
|
|
207
251
|
|
|
252
|
+
Card.Picture = CardPicture
|
|
253
|
+
|
|
208
254
|
export default Card
|
|
209
|
-
export { Card, CardBadge,
|
|
255
|
+
export { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture }
|