@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.
Files changed (161) hide show
  1. package/dist/components/AlertBanner/AlertBanner.d.ts +3 -1
  2. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  3. package/dist/components/Button/Button.js +1 -1
  4. package/dist/components/Card/Card.d.ts +15 -5
  5. package/dist/components/Card/Card.js +6 -6
  6. package/dist/components/DatePicker/DatePicker.js +2 -2
  7. package/dist/components/Expandable/Expandable.d.ts +16 -2
  8. package/dist/components/Expandable/Expandable.js +9 -4
  9. package/dist/components/Field/Field.d.ts +15 -5
  10. package/dist/components/Field/Field.js +4 -4
  11. package/dist/components/Fieldset/Fieldset.d.ts +15 -5
  12. package/dist/components/Fieldset/Fieldset.js +4 -4
  13. package/dist/components/Pill/Pill.d.ts +3 -1
  14. package/dist/components/Pill/Pill.js +1 -1
  15. package/dist/components/Popover/Popover.d.ts +12 -4
  16. package/dist/components/Popover/Popover.js +5 -5
  17. package/dist/components/Searchbox/Searchbox.js +1 -1
  18. package/dist/components/Select/Select.d.ts +6 -2
  19. package/dist/components/Select/Select.js +2 -2
  20. package/dist/components/Signpost/Signpost.js +1 -1
  21. package/dist/hooks/useSlots.d.ts +2 -1
  22. package/dist/hooks/useSlots.js +8 -3
  23. package/dist/types/index.d.ts +1 -0
  24. package/package.json +16 -13
  25. package/src/components/AlertBanner/AlertBanner.tsx +1 -1
  26. package/src/components/Button/Button.tsx +1 -1
  27. package/src/components/Card/Card.tsx +6 -10
  28. package/src/components/DatePicker/DatePicker.tsx +1 -1
  29. package/src/components/Expandable/Expandable.tsx +22 -5
  30. package/src/components/Field/Field.tsx +4 -9
  31. package/src/components/Fieldset/Fieldset.tsx +4 -9
  32. package/src/components/Pill/Pill.tsx +1 -1
  33. package/src/components/Popover/Popover.tsx +4 -7
  34. package/src/components/Searchbox/Searchbox.tsx +1 -1
  35. package/src/components/Select/Select.tsx +2 -3
  36. package/src/components/Signpost/Signpost.tsx +1 -1
  37. package/src/hooks/useSlots.ts +12 -4
  38. package/src/types/index.ts +1 -0
  39. /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
  40. /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
  41. /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
  42. /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
  43. /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
  44. /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
  45. /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
  46. /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
  47. /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
  48. /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
  49. /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
  50. /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
  51. /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
  52. /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
  53. /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
  54. /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
  55. /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
  56. /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
  57. /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
  58. /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
  59. /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
  60. /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
  61. /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
  62. /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
  63. /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
  64. /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
  65. /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
  66. /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
  67. /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
  68. /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
  69. /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
  70. /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
  71. /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
  72. /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
  73. /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
  74. /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
  75. /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
  76. /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
  77. /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
  78. /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
  79. /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
  80. /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
  81. /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
  82. /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
  83. /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
  84. /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
  85. /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
  86. /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
  87. /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
  88. /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
  89. /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
  90. /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
  91. /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
  92. /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
  93. /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
  94. /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
  95. /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
  96. /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
  97. /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
  98. /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
  99. /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
  100. /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
  101. /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
  102. /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
  103. /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
  104. /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
  105. /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
  106. /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
  107. /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
  108. /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
  109. /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
  110. /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
  111. /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
  112. /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
  113. /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
  114. /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
  115. /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
  116. /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
  117. /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
  118. /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
  119. /package/dist/components/{Icon → icons}/index.d.ts +0 -0
  120. /package/dist/components/{Icon → icons}/index.js +0 -0
  121. /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
  122. /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
  123. /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
  124. /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
  125. /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
  126. /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
  127. /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
  128. /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
  129. /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
  130. /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
  131. /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
  132. /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
  133. /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
  134. /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
  135. /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
  136. /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
  137. /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
  138. /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
  139. /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
  140. /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
  141. /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
  142. /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
  143. /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
  144. /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
  145. /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
  146. /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
  147. /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
  148. /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
  149. /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
  150. /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
  151. /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
  152. /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
  153. /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
  154. /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
  155. /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
  156. /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
  157. /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
  158. /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
  159. /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
  160. /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
  161. /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
- displayName: string;
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.displayName = "AlertBanner.Heading";
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 '../Icon/LoadingIcon.js';
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
- displayName: string;
55
+ config: {
56
+ name: string;
57
+ };
56
58
  };
57
59
  Heading: {
58
60
  ({ as, children, className }: CardHeadingProps): JSX.Element;
59
- displayName: string;
61
+ config: {
62
+ name: string;
63
+ };
60
64
  };
61
65
  Badge: {
62
66
  ({ align, children, position, ...props }: CardBadgeProps): JSX.Element;
63
- displayName: string;
67
+ config: {
68
+ name: string;
69
+ };
64
70
  };
65
71
  Body: {
66
72
  ({ children }: CardBodyProps): JSX.Element;
67
- displayName: string;
73
+ config: {
74
+ name: string;
75
+ };
68
76
  };
69
77
  Image: {
70
78
  (props: CardImageProps): import("react/jsx-runtime").JSX.Element;
71
- displayName: string;
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 '../Icon/ChevronRightIcon.js';
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
- CardImage.displayName = "Card.Image";
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 '../Icon/CloseIcon.js';
9
- import { TickIcon } from '../Icon/TickIcon.js';
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, only visible when it is open. It can be any valid JSX or string. */
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
- displayName: string;
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 '../Icon/ChevronDownIcon.js';
6
+ import { ChevronDownIcon } from '../icons/ChevronDownIcon.js';
7
7
 
8
8
  const componentSlots = {
9
- Children: null,
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, jsx("div", { className: "coop-expandable--content", children: slots.Children })] }));
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
- ExpandableSummary.displayName = "Expandable.Summary";
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
- displayName: string;
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
- displayName: string;
37
+ config: {
38
+ name: string;
39
+ };
36
40
  };
37
41
  Error: {
38
42
  (props: ErrorProps): import("react/jsx-runtime").JSX.Element;
39
- displayName: string;
43
+ config: {
44
+ name: string;
45
+ };
40
46
  };
41
47
  Hint: {
42
48
  (props: HintProps): import("react/jsx-runtime").JSX.Element;
43
- displayName: string;
49
+ config: {
50
+ name: string;
51
+ };
44
52
  };
45
53
  Label: {
46
54
  (props: LabelProps): import("react/jsx-runtime").JSX.Element;
47
- displayName: string;
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
- FieldError.displayName = "Field.Error";
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
- displayName: string;
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
- displayName: string;
43
+ config: {
44
+ name: string;
45
+ };
42
46
  };
43
47
  Fields: {
44
48
  ({ boxed, children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
45
- displayName: string;
49
+ config: {
50
+ name: string;
51
+ };
46
52
  };
47
53
  Hint: {
48
54
  (props: HintProps): import("react/jsx-runtime").JSX.Element;
49
- displayName: string;
55
+ config: {
56
+ name: string;
57
+ };
50
58
  };
51
59
  Legend: {
52
60
  (props: LegendProps): import("react/jsx-runtime").JSX.Element;
53
- displayName: string;
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
- FieldsetError.displayName = "Fieldset.Error";
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
- displayName: string;
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.displayName = "Pill.Badge";
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
- displayName: string;
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
- displayName: string;
65
+ config: {
66
+ name: string;
67
+ };
64
68
  };
65
69
  Close: {
66
70
  ({ asChild, children, className, ...props }: PopoverCloseProps): JSX.Element;
67
- displayName: string;
71
+ config: {
72
+ name: string;
73
+ };
68
74
  };
69
75
  Anchor: {
70
76
  ({ asChild, children, ...props }: PopoverAnchorProps): JSX.Element;
71
- displayName: string;
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, Trigger, Close, Anchor as Anchor2 } from '../../node_modules/@radix-ui/react-popover/dist/index.js';
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
- PopoverAnchor.displayName = "Popover.Anchor";
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 '../Icon/SearchIcon.js';
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
- displayName: string;
39
+ config: {
40
+ name: string;
41
+ };
40
42
  };
41
43
  Option: {
42
44
  ({ children, className, ...props }: SelectOptionProps): JSX.Element;
43
- displayName: string;
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.displayName = "Select.Option";
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 '../Icon/ChevronRightIcon.js';
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 }) => {
@@ -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: React.ReactNode): string | false;
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>;
@@ -4,9 +4,14 @@ function isKey(x, k) {
4
4
  return k in x;
5
5
  }
6
6
  function getSlotName(node) {
7
- return React__default.isValidElement(node) && node.type && typeof node.type !== "string"
8
- ? node.type.name
9
- : false;
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) => {
@@ -12,4 +12,5 @@ export interface ComponentConfig {
12
12
  fieldSuffix?: string;
13
13
  isField?: boolean;
14
14
  isInline?: boolean;
15
+ name?: string;
15
16
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.52.2",
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
- "./Icon": {
15
- "types": "./dist/components/Icon/index.d.ts",
16
- "default": "./dist/components/Icon/index.js"
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 && npm run storybook:fix-paths",
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.3",
61
- "@storybook/addon-docs": "^10.2.3",
62
- "@storybook/addon-onboarding": "^10.2.3",
63
- "@storybook/react-vite": "^10.2.3",
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.3",
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": "0dc65b79845a688be75d0b5c6118d2d2a727f7c5"
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.displayName = "AlertBanner.Heading"
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 "../Icon"
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 "../Icon/ChevronRightIcon"
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
- CardImage.displayName = "Card.Image"
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