@coopdigital/react 0.52.2 → 0.53.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.d.ts +3 -1
- package/dist/components/AlertBanner/AlertBanner.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Card/Card.d.ts +15 -5
- package/dist/components/Card/Card.js +6 -6
- package/dist/components/DatePicker/DatePicker.js +2 -2
- package/dist/components/Expandable/Expandable.d.ts +16 -2
- package/dist/components/Expandable/Expandable.js +9 -4
- package/dist/components/Field/Field.d.ts +15 -5
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.d.ts +15 -5
- package/dist/components/Fieldset/Fieldset.js +4 -4
- package/dist/components/Pill/Pill.d.ts +3 -1
- package/dist/components/Pill/Pill.js +1 -1
- package/dist/components/Popover/Popover.d.ts +12 -4
- package/dist/components/Popover/Popover.js +5 -5
- package/dist/components/Searchbox/Searchbox.js +1 -1
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Signpost/Signpost.js +1 -1
- package/dist/hooks/useSlots.d.ts +2 -1
- package/dist/hooks/useSlots.js +8 -3
- package/dist/types/index.d.ts +1 -0
- package/package.json +16 -13
- package/src/components/AlertBanner/AlertBanner.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +6 -10
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/Expandable/Expandable.tsx +22 -5
- package/src/components/Field/Field.tsx +4 -9
- package/src/components/Fieldset/Fieldset.tsx +4 -9
- package/src/components/Pill/Pill.tsx +1 -1
- package/src/components/Popover/Popover.tsx +4 -7
- package/src/components/Searchbox/Searchbox.tsx +1 -1
- package/src/components/Select/Select.tsx +2 -3
- package/src/components/Signpost/Signpost.tsx +1 -1
- package/src/hooks/useSlots.ts +12 -4
- package/src/types/index.ts +1 -0
- /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
- /package/dist/components/{Icon → icons}/index.d.ts +0 -0
- /package/dist/components/{Icon → icons}/index.js +0 -0
- /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/index.ts +0 -0
|
@@ -19,7 +19,9 @@ export declare const AlertBanner: {
|
|
|
19
19
|
({ children, className, ref, variant, ...props }: AlertBannerProps): JSX.Element;
|
|
20
20
|
Heading: {
|
|
21
21
|
({ children, className }: AlertBannerHeadingProps): JSX.Element;
|
|
22
|
-
|
|
22
|
+
config: {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
export default AlertBanner;
|
|
@@ -12,7 +12,7 @@ const AlertBanner = ({ children, className, ref, variant = "default", ...props }
|
|
|
12
12
|
const AlertBannerHeading = ({ children, className }) => {
|
|
13
13
|
return jsx("h2", { className: className, children: children });
|
|
14
14
|
};
|
|
15
|
-
AlertBannerHeading.
|
|
15
|
+
AlertBannerHeading.config = { name: "AlertBannerHeading" };
|
|
16
16
|
AlertBanner.Heading = AlertBannerHeading;
|
|
17
17
|
|
|
18
18
|
export { AlertBanner, AlertBanner as default };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import React__default, { useState, useCallback } from 'react';
|
|
6
|
-
import { LoadingIcon } from '../
|
|
6
|
+
import { LoadingIcon } from '../icons/LoadingIcon.js';
|
|
7
7
|
|
|
8
8
|
const Button = ({ as, children, className, href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, ref, size = "md", variant = "green", ...props }) => {
|
|
9
9
|
const element = as !== null && as !== void 0 ? as : (href ? "a" : "button");
|
|
@@ -52,23 +52,33 @@ export declare const Card: {
|
|
|
52
52
|
({ chevron, children, className, href, hrefAs, imagePosition, orientation, ref, ...props }: CardProps): JSX.Element;
|
|
53
53
|
Label: {
|
|
54
54
|
({ children, className }: CardLabelProps): JSX.Element;
|
|
55
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
56
58
|
};
|
|
57
59
|
Heading: {
|
|
58
60
|
({ as, children, className }: CardHeadingProps): JSX.Element;
|
|
59
|
-
|
|
61
|
+
config: {
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
60
64
|
};
|
|
61
65
|
Badge: {
|
|
62
66
|
({ align, children, position, ...props }: CardBadgeProps): JSX.Element;
|
|
63
|
-
|
|
67
|
+
config: {
|
|
68
|
+
name: string;
|
|
69
|
+
};
|
|
64
70
|
};
|
|
65
71
|
Body: {
|
|
66
72
|
({ children }: CardBodyProps): JSX.Element;
|
|
67
|
-
|
|
73
|
+
config: {
|
|
74
|
+
name: string;
|
|
75
|
+
};
|
|
68
76
|
};
|
|
69
77
|
Image: {
|
|
70
78
|
(props: CardImageProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
-
|
|
79
|
+
config: {
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
72
82
|
};
|
|
73
83
|
};
|
|
74
84
|
export default Card;
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
|
-
import { ChevronRightIcon } from '../
|
|
5
|
+
import { ChevronRightIcon } from '../icons/ChevronRightIcon.js';
|
|
6
6
|
import { Image } from '../Image/Image.js';
|
|
7
7
|
|
|
8
8
|
const componentSlots = {
|
|
@@ -41,24 +41,24 @@ const Card = ({ chevron = false, children, className, href, hrefAs, imagePositio
|
|
|
41
41
|
const CardHeading = ({ as = "h3", children, className }) => {
|
|
42
42
|
return React__default.createElement(as, { className: clsx("coop-card--heading", className) }, children);
|
|
43
43
|
};
|
|
44
|
-
CardHeading.displayName = "Card.Heading";
|
|
45
44
|
const CardLabel = ({ children, className }) => {
|
|
46
45
|
return jsx("span", { className: clsx("coop-card--label", className), children: children });
|
|
47
46
|
};
|
|
48
|
-
CardLabel.displayName = "Card.Label";
|
|
49
47
|
const CardBadge = ({ align = "right", children, position = "popout", ...props }) => {
|
|
50
48
|
return (jsx("div", { className: "coop-card--badge", "data-align": align, "data-position": position, ...props, children: children }));
|
|
51
49
|
};
|
|
52
|
-
CardBadge.displayName = "Card.Badge";
|
|
53
50
|
const CardBody = ({ children }) => {
|
|
54
51
|
return jsx(Fragment, { children: children });
|
|
55
52
|
};
|
|
56
|
-
CardBody.displayName = "Card.Body";
|
|
57
53
|
const CardImage = (props) => {
|
|
58
54
|
var _a;
|
|
59
55
|
return jsx(Image, { ...props, crop: (_a = props.crop) !== null && _a !== void 0 ? _a : "wide" });
|
|
60
56
|
};
|
|
61
|
-
|
|
57
|
+
CardLabel.config = { name: "CardLabel" };
|
|
58
|
+
CardHeading.config = { name: "CardHeading" };
|
|
59
|
+
CardBadge.config = { name: "CardBadge" };
|
|
60
|
+
CardBody.config = { name: "CardBody" };
|
|
61
|
+
CardImage.config = { name: "CardImage" };
|
|
62
62
|
Card.Label = CardLabel;
|
|
63
63
|
Card.Heading = CardHeading;
|
|
64
64
|
Card.Badge = CardBadge;
|
|
@@ -5,8 +5,8 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useMemo, useReducer, useCallback } from 'react';
|
|
6
6
|
import { useId } from '../../hooks/useId.js';
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
8
|
-
import { CloseIcon } from '../
|
|
9
|
-
import { TickIcon } from '../
|
|
8
|
+
import { CloseIcon } from '../icons/CloseIcon.js';
|
|
9
|
+
import { TickIcon } from '../icons/TickIcon.js';
|
|
10
10
|
import { Popover } from '../Popover/Popover.js';
|
|
11
11
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
12
12
|
import { getInitialDate, getStartDate, getEndDate, getDefaultMonth, getDateValues, shouldClose, shouldSkipParsing } from './datepicker-utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DetailsHTMLAttributes, HTMLAttributes, JSX, Ref } from "react";
|
|
2
2
|
export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
3
|
-
/** Main content inside the component
|
|
3
|
+
/** Main content inside the component. This should be an `Expandable.Summary` and `Expandable.Content`. */
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
6
6
|
className?: string;
|
|
@@ -13,11 +13,25 @@ interface ExpandableSummaryProps extends HTMLAttributes<HTMLElement> {
|
|
|
13
13
|
/** **(Optional)** Specify additional CSS classes to be applied to the Summary. */
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
+
interface ExpandableContentProps extends HTMLAttributes<HTMLElement> {
|
|
17
|
+
/** **(Optional)** Content inside the Expandable. */
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the content wrapper. */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
16
22
|
export declare const Expandable: {
|
|
17
23
|
({ children, className, ref, ...props }: ExpandableProps): JSX.Element;
|
|
18
24
|
Summary: {
|
|
19
25
|
({ children, className, ...props }: ExpandableSummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
|
|
26
|
+
config: {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
Content: {
|
|
31
|
+
({ children, className, ...props }: ExpandableContentProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
config: {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
21
35
|
};
|
|
22
36
|
};
|
|
23
37
|
export default Expandable;
|
|
@@ -3,10 +3,10 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
4
4
|
import { hasUserBg, bgClassToColor } from '../../utils/index.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import { ChevronDownIcon } from '../
|
|
6
|
+
import { ChevronDownIcon } from '../icons/ChevronDownIcon.js';
|
|
7
7
|
|
|
8
8
|
const componentSlots = {
|
|
9
|
-
|
|
9
|
+
ExpandableContent: null,
|
|
10
10
|
ExpandableSummary: null,
|
|
11
11
|
};
|
|
12
12
|
const Expandable = ({ children, className, ref, ...props }) => {
|
|
@@ -18,12 +18,17 @@ const Expandable = ({ children, className, ref, ...props }) => {
|
|
|
18
18
|
componentProps.style = {
|
|
19
19
|
"--bg": `var(--color-${bgClassToColor(componentProps.className)})`,
|
|
20
20
|
};
|
|
21
|
-
return (jsxs("details", { ...componentProps, ref: ref, children: [slots.ExpandableSummary,
|
|
21
|
+
return (jsxs("details", { ...componentProps, ref: ref, children: [slots.ExpandableSummary, slots.ExpandableContent] }));
|
|
22
22
|
};
|
|
23
23
|
const ExpandableSummary = ({ children, className, ...props }) => {
|
|
24
24
|
return (jsxs("summary", { ...props, className: className, children: [children, jsx(ChevronDownIcon, { className: "coop-expandable--icon", stroke: "currentColor", strokeWidth: 2, width: "12" })] }));
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const ExpandableContent = ({ children, className, ...props }) => {
|
|
27
|
+
return (jsx("div", { className: clsx("coop-expandable--content", className), ...props, children: children }));
|
|
28
|
+
};
|
|
29
|
+
ExpandableSummary.config = { name: "ExpandableSummary" };
|
|
30
|
+
ExpandableContent.config = { name: "ExpandableContent" };
|
|
27
31
|
Expandable.Summary = ExpandableSummary;
|
|
32
|
+
Expandable.Content = ExpandableContent;
|
|
28
33
|
|
|
29
34
|
export { Expandable, Expandable as default };
|
|
@@ -27,24 +27,34 @@ interface ControlProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
27
27
|
}
|
|
28
28
|
export declare const FieldControl: {
|
|
29
29
|
({ children, className, ...props }: ControlProps): JSX.Element;
|
|
30
|
-
|
|
30
|
+
config: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
31
33
|
};
|
|
32
34
|
export declare const Field: (({ boxed, children, className, error, hideErrorBar, ref, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
33
35
|
Control: {
|
|
34
36
|
({ children, className, ...props }: ControlProps): JSX.Element;
|
|
35
|
-
|
|
37
|
+
config: {
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
36
40
|
};
|
|
37
41
|
Error: {
|
|
38
42
|
(props: ErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
|
|
43
|
+
config: {
|
|
44
|
+
name: string;
|
|
45
|
+
};
|
|
40
46
|
};
|
|
41
47
|
Hint: {
|
|
42
48
|
(props: HintProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
|
|
49
|
+
config: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
44
52
|
};
|
|
45
53
|
Label: {
|
|
46
54
|
(props: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
48
58
|
};
|
|
49
59
|
};
|
|
50
60
|
export default Field;
|
|
@@ -61,13 +61,13 @@ const Root = ({ boxed = false, children, className, error = false, hideErrorBar
|
|
|
61
61
|
const FieldControl = ({ children, className, ...props }) => {
|
|
62
62
|
return (jsx("div", { className: clsx("coop-field-control ", className), ...props, children: children }));
|
|
63
63
|
};
|
|
64
|
-
FieldControl.displayName = "Field.Control";
|
|
65
64
|
const FieldLabel = (props) => jsx(Label, { ...props });
|
|
66
|
-
FieldLabel.displayName = "Field.Label";
|
|
67
65
|
const FieldHint = (props) => jsx(Hint, { ...props });
|
|
68
|
-
FieldHint.displayName = "Field.Hint";
|
|
69
66
|
const FieldError = (props) => jsx(Error, { ...props });
|
|
70
|
-
|
|
67
|
+
FieldControl.config = { name: "FieldControl" };
|
|
68
|
+
FieldLabel.config = { name: "FieldLabel" };
|
|
69
|
+
FieldHint.config = { name: "FieldHint" };
|
|
70
|
+
FieldError.config = { name: "FieldError" };
|
|
71
71
|
const Field = Object.assign(Root, {
|
|
72
72
|
Control: FieldControl,
|
|
73
73
|
Error: FieldError,
|
|
@@ -33,24 +33,34 @@ interface FieldsetFieldsProps {
|
|
|
33
33
|
}
|
|
34
34
|
export declare const FieldsetFields: {
|
|
35
35
|
({ boxed, children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
36
|
-
|
|
36
|
+
config: {
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
37
39
|
};
|
|
38
40
|
export declare const Fieldset: (({ children, className, disabled, error, hideErrorBar, ref, size, ...props }: FieldsetProps) => JSX.Element) & {
|
|
39
41
|
Error: {
|
|
40
42
|
(props: ErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
|
|
43
|
+
config: {
|
|
44
|
+
name: string;
|
|
45
|
+
};
|
|
42
46
|
};
|
|
43
47
|
Fields: {
|
|
44
48
|
({ boxed, children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
45
|
-
|
|
49
|
+
config: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
46
52
|
};
|
|
47
53
|
Hint: {
|
|
48
54
|
(props: HintProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
|
|
55
|
+
config: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
Legend: {
|
|
52
60
|
(props: LegendProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
|
|
61
|
+
config: {
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
54
64
|
};
|
|
55
65
|
};
|
|
56
66
|
export default Fieldset;
|
|
@@ -25,13 +25,13 @@ const FieldsetFields = ({ boxed = false, children, className, orientation = "ver
|
|
|
25
25
|
};
|
|
26
26
|
return jsx("div", { ...componentProps, children: children });
|
|
27
27
|
};
|
|
28
|
-
FieldsetFields.displayName = "Fieldset.Fields";
|
|
29
28
|
const FieldsetLegend = (props) => jsx(Legend, { ...props });
|
|
30
|
-
FieldsetLegend.displayName = "Fieldset.Legend";
|
|
31
29
|
const FieldsetHint = (props) => jsx(Hint, { ...props });
|
|
32
|
-
FieldsetHint.displayName = "Fieldset.Hint";
|
|
33
30
|
const FieldsetError = (props) => jsx(Error, { ...props });
|
|
34
|
-
|
|
31
|
+
FieldsetFields.config = { name: "FieldsetField" };
|
|
32
|
+
FieldsetLegend.config = { name: "FieldsetLegend" };
|
|
33
|
+
FieldsetHint.config = { name: "FieldsetHint" };
|
|
34
|
+
FieldsetError.config = { name: "FieldsetError" };
|
|
35
35
|
const Fieldset = Object.assign(Root, {
|
|
36
36
|
Error: FieldsetError,
|
|
37
37
|
Fields: FieldsetFields,
|
|
@@ -25,7 +25,9 @@ export declare const Pill: {
|
|
|
25
25
|
({ as, children, className, href, ref, size, ...props }: PillProps): JSX.Element;
|
|
26
26
|
Badge: {
|
|
27
27
|
({ children, className }: PillBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
|
|
28
|
+
config: {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
export default Pill;
|
|
@@ -24,7 +24,7 @@ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) =>
|
|
|
24
24
|
const PillBadge = ({ children, className }) => {
|
|
25
25
|
return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-offer-red", className), children: children }));
|
|
26
26
|
};
|
|
27
|
-
PillBadge.
|
|
27
|
+
PillBadge.config = { name: "PillBadge" };
|
|
28
28
|
Pill.Badge = PillBadge;
|
|
29
29
|
|
|
30
30
|
export { Pill, Pill as default };
|
|
@@ -56,19 +56,27 @@ export declare const Popover: {
|
|
|
56
56
|
({ children, ...props }: PopoverProps): JSX.Element;
|
|
57
57
|
Trigger: {
|
|
58
58
|
({ asChild, children, className, ...props }: PopoverTriggerProps): JSX.Element;
|
|
59
|
-
|
|
59
|
+
config: {
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
60
62
|
};
|
|
61
63
|
Content: {
|
|
62
64
|
({ align, alignOffset, asChild, avoidCollisions, children, className, collisionPadding, ref, side, sideOffset, style, ...props }: PopoverContentProps): JSX.Element;
|
|
63
|
-
|
|
65
|
+
config: {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
64
68
|
};
|
|
65
69
|
Close: {
|
|
66
70
|
({ asChild, children, className, ...props }: PopoverCloseProps): JSX.Element;
|
|
67
|
-
|
|
71
|
+
config: {
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
68
74
|
};
|
|
69
75
|
Anchor: {
|
|
70
76
|
({ asChild, children, ...props }: PopoverAnchorProps): JSX.Element;
|
|
71
|
-
|
|
77
|
+
config: {
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
72
80
|
};
|
|
73
81
|
};
|
|
74
82
|
export default Popover;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Root as Root2, Portal, Content as Content2, Arrow as Arrow2,
|
|
2
|
+
import { Root as Root2, Portal, Trigger, Content as Content2, Arrow as Arrow2, Close, Anchor as Anchor2 } from '../../node_modules/@radix-ui/react-popover/dist/index.js';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
5
|
import { hasUserBg, bgClassToColor } from '../../utils/index.js';
|
|
@@ -33,7 +33,6 @@ const PopoverContent = ({ align = "center", alignOffset = 0, asChild = false, av
|
|
|
33
33
|
};
|
|
34
34
|
return (jsxs(Content2, { ref: ref, ...componentProps, children: [children, jsx(Arrow2, { className: "coop-popover-arrow" })] }));
|
|
35
35
|
};
|
|
36
|
-
PopoverContent.displayName = "Popover.Content";
|
|
37
36
|
const PopoverTrigger = ({ asChild = false, children, className, ...props }) => {
|
|
38
37
|
const componentProps = {
|
|
39
38
|
// There is a known issue with aria-controls being set to target
|
|
@@ -49,7 +48,6 @@ const PopoverTrigger = ({ asChild = false, children, className, ...props }) => {
|
|
|
49
48
|
};
|
|
50
49
|
return jsx(Trigger, { ...componentProps, children: children });
|
|
51
50
|
};
|
|
52
|
-
PopoverTrigger.displayName = "Popover.Trigger";
|
|
53
51
|
const PopoverClose = ({ asChild = false, children, className, ...props }) => {
|
|
54
52
|
const componentProps = {
|
|
55
53
|
asChild,
|
|
@@ -58,7 +56,6 @@ const PopoverClose = ({ asChild = false, children, className, ...props }) => {
|
|
|
58
56
|
};
|
|
59
57
|
return (jsx(Close, { "aria-label": "Close", ...componentProps, children: children }));
|
|
60
58
|
};
|
|
61
|
-
PopoverClose.displayName = "Popover.Close";
|
|
62
59
|
const PopoverAnchor = ({ asChild = false, children, ...props }) => {
|
|
63
60
|
const componentProps = {
|
|
64
61
|
asChild,
|
|
@@ -66,7 +63,10 @@ const PopoverAnchor = ({ asChild = false, children, ...props }) => {
|
|
|
66
63
|
};
|
|
67
64
|
return jsx(Anchor2, { ...componentProps, children: children });
|
|
68
65
|
};
|
|
69
|
-
|
|
66
|
+
PopoverTrigger.config = { name: "PopoverTrigger" };
|
|
67
|
+
PopoverContent.config = { name: "PopoverContent" };
|
|
68
|
+
PopoverClose.config = { name: "PopoverClose" };
|
|
69
|
+
PopoverAnchor.config = { name: "PopoverAnchor" };
|
|
70
70
|
Popover.Trigger = PopoverTrigger;
|
|
71
71
|
Popover.Content = PopoverContent;
|
|
72
72
|
Popover.Close = PopoverClose;
|
|
@@ -7,7 +7,7 @@ import { useId } from '../../hooks/useId.js';
|
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
8
8
|
import { Field } from '../Field/Field.js';
|
|
9
9
|
import { Label } from '../FieldMarkers/Label.js';
|
|
10
|
-
import { SearchIcon } from '../
|
|
10
|
+
import { SearchIcon } from '../icons/SearchIcon.js';
|
|
11
11
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
12
12
|
|
|
13
13
|
const defaultButtonProps = {
|
|
@@ -36,11 +36,15 @@ export declare const Select: {
|
|
|
36
36
|
({ children, className, disabled, error, id, name, ref, size, ...props }: SelectProps): JSX.Element;
|
|
37
37
|
OptionGroup: {
|
|
38
38
|
({ children, ...props }: SelectOptionGroupProps): JSX.Element;
|
|
39
|
-
|
|
39
|
+
config: {
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
40
42
|
};
|
|
41
43
|
Option: {
|
|
42
44
|
({ children, className, ...props }: SelectOptionProps): JSX.Element;
|
|
43
|
-
|
|
45
|
+
config: {
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
config: {
|
|
46
50
|
isField: true;
|
|
@@ -18,11 +18,11 @@ const Select = ({ children, className, disabled, error, id, name, ref, size = "m
|
|
|
18
18
|
const SelectOptionGroup = ({ children, ...props }) => {
|
|
19
19
|
return jsx("optgroup", { ...props, children: children });
|
|
20
20
|
};
|
|
21
|
-
SelectOptionGroup.displayName = "Select.OptionGroup";
|
|
22
21
|
const SelectOption = ({ children, className, ...props }) => {
|
|
23
22
|
return (jsx("option", { className: clsx("coop-select--option", className), ...props, children: children }));
|
|
24
23
|
};
|
|
25
|
-
SelectOption.
|
|
24
|
+
SelectOption.config = { name: "SelectOption" };
|
|
25
|
+
SelectOptionGroup.config = { name: "SelectOptionGroup" };
|
|
26
26
|
Select.OptionGroup = SelectOptionGroup;
|
|
27
27
|
Select.Option = SelectOption;
|
|
28
28
|
Select.config = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { ChevronRightIcon } from '../
|
|
4
|
+
import { ChevronRightIcon } from '../icons/ChevronRightIcon.js';
|
|
5
5
|
import { Image } from '../Image/Image.js';
|
|
6
6
|
|
|
7
7
|
const Signpost = ({ as, children, className, headingLevel = "h3", href, image, ref, ...props }) => {
|
package/dist/hooks/useSlots.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ReactNodeWithConfig } from "src/types";
|
|
2
3
|
type Slots<T> = Record<keyof T, React.ReactNode>;
|
|
3
4
|
export declare function isKey<T extends object>(x: T, k: PropertyKey): k is keyof T;
|
|
4
|
-
export declare function getSlotName(node:
|
|
5
|
+
export declare function getSlotName(node: ReactNodeWithConfig): string | false;
|
|
5
6
|
export declare function useSlots<T>(componentSlots: Slots<T>, children: React.ReactNode, options?: {
|
|
6
7
|
collect?: string[];
|
|
7
8
|
}): Slots<T>;
|
package/dist/hooks/useSlots.js
CHANGED
|
@@ -4,9 +4,14 @@ function isKey(x, k) {
|
|
|
4
4
|
return k in x;
|
|
5
5
|
}
|
|
6
6
|
function getSlotName(node) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
if (React__default.isValidElement(node) &&
|
|
9
|
+
node.type &&
|
|
10
|
+
typeof node.type !== "string" &&
|
|
11
|
+
typeof node.type !== "symbol") {
|
|
12
|
+
return (_c = (_b = (_a = node.type) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : node.type.name;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
10
15
|
}
|
|
11
16
|
function useSlots(componentSlots, children, options) {
|
|
12
17
|
return React__default.Children.toArray(children).reduce((slots, child) => {
|
package/dist/types/index.d.ts
CHANGED
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.53.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
-
"./
|
|
15
|
-
"types": "./dist/components
|
|
16
|
-
"default": "./dist/components
|
|
14
|
+
"./components/*": {
|
|
15
|
+
"types": "./dist/components/*/*.d.ts",
|
|
16
|
+
"default": "./dist/components/*/*.js"
|
|
17
|
+
},
|
|
18
|
+
"./icons": {
|
|
19
|
+
"types": "./dist/components/icons/index.d.ts",
|
|
20
|
+
"default": "./dist/components/icons/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
@@ -43,13 +47,12 @@
|
|
|
43
47
|
"build": "tsx scripts build",
|
|
44
48
|
"build:docs": "tsx scripts build-docs",
|
|
45
49
|
"build:icons": "tsx scripts build-icons",
|
|
46
|
-
"build:storybook": "storybook build --disable-telemetry
|
|
50
|
+
"build:storybook": "storybook build --disable-telemetry",
|
|
47
51
|
"build:storybook:test": "storybook build --test --disable-telemetry --output-dir storybook-test",
|
|
48
52
|
"serve:storybook:test": "serve -p 9000 ./storybook-test",
|
|
49
53
|
"build:storybook:local": "storybook build --disable-telemetry",
|
|
50
54
|
"serve:storybook:local": "serve -p 9000 ./storybook-static",
|
|
51
|
-
"storybook": "storybook dev -p 6006"
|
|
52
|
-
"storybook:fix-paths": "tsx scripts/storybook-fix-paths.ts"
|
|
55
|
+
"storybook": "storybook dev -p 6006"
|
|
53
56
|
},
|
|
54
57
|
"author": "",
|
|
55
58
|
"license": "MIT",
|
|
@@ -57,10 +60,10 @@
|
|
|
57
60
|
"devDependencies": {
|
|
58
61
|
"@axe-core/playwright": "^4.11.0",
|
|
59
62
|
"@playwright/test": "^1.58.1",
|
|
60
|
-
"@storybook/addon-a11y": "^10.2.
|
|
61
|
-
"@storybook/addon-docs": "^10.2.
|
|
62
|
-
"@storybook/addon-onboarding": "^10.2.
|
|
63
|
-
"@storybook/react-vite": "^10.2.
|
|
63
|
+
"@storybook/addon-a11y": "^10.2.6",
|
|
64
|
+
"@storybook/addon-docs": "^10.2.6",
|
|
65
|
+
"@storybook/addon-onboarding": "^10.2.6",
|
|
66
|
+
"@storybook/react-vite": "^10.2.6",
|
|
64
67
|
"@testing-library/jest-dom": "^6.9.1",
|
|
65
68
|
"@testing-library/react": "^16.3.2",
|
|
66
69
|
"@types/react": "^19.2.10",
|
|
@@ -69,7 +72,7 @@
|
|
|
69
72
|
"react-dom": "^19.2.4",
|
|
70
73
|
"resize-observer-polyfill": "^1.5.1",
|
|
71
74
|
"serve": "^14.2.5",
|
|
72
|
-
"storybook": "^10.2.
|
|
75
|
+
"storybook": "^10.2.6",
|
|
73
76
|
"storybook-addon-tag-badges": "^3.0.5"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
@@ -85,5 +88,5 @@
|
|
|
85
88
|
"clsx": "^2.1.1",
|
|
86
89
|
"react-day-picker": "^9.12.0"
|
|
87
90
|
},
|
|
88
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "d8324f6ee7c544c37f752b5e6eeb67cffff20237"
|
|
89
92
|
}
|
|
@@ -44,7 +44,7 @@ const AlertBannerHeading = ({ children, className }: AlertBannerHeadingProps): J
|
|
|
44
44
|
return <h2 className={className}>{children}</h2>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
AlertBannerHeading.
|
|
47
|
+
AlertBannerHeading.config = { name: "AlertBannerHeading" }
|
|
48
48
|
|
|
49
49
|
AlertBanner.Heading = AlertBannerHeading
|
|
50
50
|
|
|
@@ -5,7 +5,7 @@ import type { ButtonHTMLAttributes, ForwardRefExoticComponent, JSX, Ref } from "
|
|
|
5
5
|
import clsx from "clsx"
|
|
6
6
|
import React, { useCallback, useState } from "react"
|
|
7
7
|
|
|
8
|
-
import { LoadingIcon } from "../
|
|
8
|
+
import { LoadingIcon } from "../icons"
|
|
9
9
|
|
|
10
10
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
11
|
/** **(Optional)** Specify a custom element to override default `a` or `button`. */
|
|
@@ -4,7 +4,7 @@ import clsx from "clsx"
|
|
|
4
4
|
import React from "react"
|
|
5
5
|
|
|
6
6
|
import { useSlots } from "../../hooks/useSlots"
|
|
7
|
-
import { ChevronRightIcon } from "../
|
|
7
|
+
import { ChevronRightIcon } from "../icons/ChevronRightIcon"
|
|
8
8
|
import { Image, ImageProps } from "../Image"
|
|
9
9
|
|
|
10
10
|
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -136,14 +136,10 @@ const CardHeading = ({ as = "h3", children, className }: CardHeadingProps): JSX.
|
|
|
136
136
|
return React.createElement(as, { className: clsx("coop-card--heading", className) }, children)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
CardHeading.displayName = "Card.Heading"
|
|
140
|
-
|
|
141
139
|
const CardLabel = ({ children, className }: CardLabelProps): JSX.Element => {
|
|
142
140
|
return <span className={clsx("coop-card--label", className)}>{children}</span>
|
|
143
141
|
}
|
|
144
142
|
|
|
145
|
-
CardLabel.displayName = "Card.Label"
|
|
146
|
-
|
|
147
143
|
const CardBadge = ({
|
|
148
144
|
align = "right",
|
|
149
145
|
children,
|
|
@@ -157,19 +153,19 @@ const CardBadge = ({
|
|
|
157
153
|
)
|
|
158
154
|
}
|
|
159
155
|
|
|
160
|
-
CardBadge.displayName = "Card.Badge"
|
|
161
|
-
|
|
162
156
|
const CardBody = ({ children }: CardBodyProps): JSX.Element => {
|
|
163
157
|
return <>{children}</>
|
|
164
158
|
}
|
|
165
159
|
|
|
166
|
-
CardBody.displayName = "Card.Body"
|
|
167
|
-
|
|
168
160
|
const CardImage = (props: CardImageProps) => {
|
|
169
161
|
return <Image {...{ ...props, crop: props.crop ?? "wide" }} />
|
|
170
162
|
}
|
|
171
163
|
|
|
172
|
-
|
|
164
|
+
CardLabel.config = { name: "CardLabel" }
|
|
165
|
+
CardHeading.config = { name: "CardHeading" }
|
|
166
|
+
CardBadge.config = { name: "CardBadge" }
|
|
167
|
+
CardBody.config = { name: "CardBody" }
|
|
168
|
+
CardImage.config = { name: "CardImage" }
|
|
173
169
|
|
|
174
170
|
Card.Label = CardLabel
|
|
175
171
|
Card.Heading = CardHeading
|