@coopdigital/react 0.52.3 → 0.54.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 (171) hide show
  1. package/README.md +3 -3
  2. package/dist/components/AlertBanner/AlertBanner.d.ts +3 -1
  3. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  4. package/dist/components/Button/Button.d.ts +1 -1
  5. package/dist/components/Button/Button.js +4 -3
  6. package/dist/components/Card/Card.d.ts +15 -5
  7. package/dist/components/Card/Card.js +8 -7
  8. package/dist/components/DatePicker/DatePicker.js +3 -3
  9. package/dist/components/Expandable/Expandable.d.ts +16 -2
  10. package/dist/components/Expandable/Expandable.js +13 -8
  11. package/dist/components/Field/Field.d.ts +15 -5
  12. package/dist/components/Field/Field.js +4 -4
  13. package/dist/components/Fieldset/Fieldset.d.ts +15 -5
  14. package/dist/components/Fieldset/Fieldset.js +4 -4
  15. package/dist/components/Pill/Pill.d.ts +3 -1
  16. package/dist/components/Pill/Pill.js +2 -2
  17. package/dist/components/Popover/Popover.d.ts +12 -4
  18. package/dist/components/Popover/Popover.js +5 -5
  19. package/dist/components/Searchbox/Searchbox.d.ts +20 -4
  20. package/dist/components/Searchbox/Searchbox.js +42 -28
  21. package/dist/components/Select/Select.d.ts +6 -2
  22. package/dist/components/Select/Select.js +2 -2
  23. package/dist/components/Signpost/Signpost.js +1 -1
  24. package/dist/components/Squircle/Squircle.js +1 -1
  25. package/dist/hooks/useSlots.d.ts +2 -1
  26. package/dist/hooks/useSlots.js +8 -3
  27. package/dist/types/colors.d.ts +1 -2
  28. package/dist/types/index.d.ts +1 -0
  29. package/dist/utils/index.d.ts +1 -0
  30. package/dist/utils/index.js +4 -1
  31. package/package.json +20 -17
  32. package/src/components/AlertBanner/AlertBanner.tsx +1 -1
  33. package/src/components/Button/Button.tsx +9 -13
  34. package/src/components/Card/Card.tsx +8 -11
  35. package/src/components/DatePicker/DatePicker.tsx +2 -2
  36. package/src/components/Expandable/Expandable.tsx +26 -9
  37. package/src/components/Field/Field.tsx +4 -9
  38. package/src/components/Fieldset/Fieldset.tsx +4 -9
  39. package/src/components/Pill/Pill.tsx +2 -2
  40. package/src/components/Popover/Popover.tsx +4 -7
  41. package/src/components/Searchbox/Searchbox.tsx +66 -56
  42. package/src/components/Select/Select.tsx +2 -3
  43. package/src/components/Signpost/Signpost.tsx +1 -1
  44. package/src/components/Squircle/Squircle.tsx +1 -1
  45. package/src/hooks/useSlots.ts +12 -4
  46. package/src/types/colors.ts +1 -3
  47. package/src/types/index.ts +1 -0
  48. package/src/utils/index.ts +4 -0
  49. /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
  50. /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
  51. /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
  52. /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
  53. /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
  54. /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
  55. /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
  56. /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
  57. /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
  58. /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
  59. /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
  60. /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
  61. /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
  62. /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
  63. /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
  64. /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
  65. /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
  66. /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
  67. /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
  68. /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
  69. /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
  70. /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
  71. /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
  72. /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
  73. /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
  74. /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
  75. /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
  76. /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
  77. /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
  78. /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
  79. /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
  80. /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
  81. /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
  82. /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
  83. /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
  84. /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
  85. /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
  86. /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
  87. /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
  88. /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
  89. /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
  90. /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
  91. /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
  92. /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
  93. /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
  94. /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
  95. /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
  96. /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
  97. /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
  98. /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
  99. /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
  100. /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
  101. /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
  102. /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
  103. /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
  104. /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
  105. /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
  106. /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
  107. /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
  108. /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
  109. /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
  110. /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
  111. /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
  112. /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
  113. /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
  114. /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
  115. /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
  116. /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
  117. /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
  118. /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
  119. /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
  120. /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
  121. /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
  122. /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
  123. /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
  124. /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
  125. /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
  126. /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
  127. /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
  128. /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
  129. /package/dist/components/{Icon → icons}/index.d.ts +0 -0
  130. /package/dist/components/{Icon → icons}/index.js +0 -0
  131. /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
  132. /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
  133. /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
  134. /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
  135. /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
  136. /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
  137. /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
  138. /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
  139. /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
  140. /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
  141. /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
  142. /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
  143. /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
  144. /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
  145. /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
  146. /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
  147. /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
  148. /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
  149. /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
  150. /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
  151. /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
  152. /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
  153. /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
  154. /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
  155. /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
  156. /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
  157. /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
  158. /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
  159. /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
  160. /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
  161. /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
  162. /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
  163. /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
  164. /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
  165. /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
  166. /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
  167. /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
  168. /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
  169. /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
  170. /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
  171. /package/src/components/{Icon → icons}/index.ts +0 -0
package/README.md CHANGED
@@ -25,18 +25,18 @@ npm install @coopdigital/react
25
25
 
26
26
  ## Usage
27
27
 
28
- Import the components that you need, along with the main stylesheet and the corresponding component styles:
28
+ Import the components that you need, along with the foundations stylesheet and the corresponding component styles:
29
29
 
30
30
  ```
31
31
  import { Pill } from "@coopdigital/react"
32
- import "@coopdigital/styles/main.css"
32
+ import "@coopdigital/styles/foundations.css"
33
33
  import "@coopdigital/styles/components/Pill.css"
34
34
  ```
35
35
 
36
36
  Alternatively if your project uses SASS you can import the source stylesheets:
37
37
 
38
38
  ```
39
- @use "@coopdigital/styles/src/main.scss"
39
+ @use "@coopdigital/styles/src/foundations.scss"
40
40
  @use "@coopdigital/styles/src/components/Pill.scss"
41
41
  ```
42
42
 
@@ -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 };
@@ -24,7 +24,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
24
24
  /** **(Optional)** Specify the Button size. */
25
25
  size?: "sm" | "md" | "lg";
26
26
  /** **(Optional)** Specify the Button variant. */
27
- variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost" | "text";
27
+ variant?: "solid" | "ghost" | "text";
28
28
  }
29
29
  export declare const Button: ({ as, children, className, href, isDisabled, isFullWidth, isLoading, loadingText, onClick, ref, size, variant, ...props }: ButtonProps) => JSX.Element;
30
30
  export default Button;
@@ -3,9 +3,10 @@
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 { hasUserBg } from '../../utils/index.js';
7
+ import { LoadingIcon } from '../icons/LoadingIcon.js';
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
+ const Button = ({ as, children, className, href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, ref, size = "md", variant = "solid", ...props }) => {
9
10
  const element = as !== null && as !== void 0 ? as : (href ? "a" : "button");
10
11
  const [isPending, setIsPending] = useState(false);
11
12
  const handleClick = useCallback(async (event) => {
@@ -22,7 +23,7 @@ const Button = ({ as, children, className, href, isDisabled = false, isFullWidth
22
23
  const componentProps = {
23
24
  "aria-disabled": isDisabled ? true : undefined,
24
25
  "aria-live": "assertive",
25
- className: clsx(variant == "text" ? "coop-link" : "coop-button", className),
26
+ className: clsx(variant == "text" ? "coop-link" : "coop-button", !hasUserBg(className) && variant === "solid" && "bg-teal", className),
26
27
  "data-loading": isLoading || isPending ? true : undefined,
27
28
  "data-size": size.length && size !== "md" ? size : undefined,
28
29
  "data-variant": variant !== "text" ? variant : undefined,
@@ -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,8 @@ 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 { hasUserBg } from '../../utils/index.js';
6
+ import { ChevronRightIcon } from '../icons/ChevronRightIcon.js';
6
7
  import { Image } from '../Image/Image.js';
7
8
 
8
9
  const componentSlots = {
@@ -28,7 +29,7 @@ const Card = ({ chevron = false, children, className, href, hrefAs, imagePositio
28
29
  const innerProps = { className: "coop-card--inner" };
29
30
  const hasLinkWrapper = href && !slots.CardHeading;
30
31
  const componentProps = {
31
- className: clsx("coop-card", className),
32
+ className: clsx("coop-card", !hasUserBg(className) && "bg-white", className),
32
33
  "data-image-pos": imagePosition,
33
34
  "data-orientation": orientation !== "vertical" ? orientation : undefined,
34
35
  ...props,
@@ -41,24 +42,24 @@ const Card = ({ chevron = false, children, className, href, hrefAs, imagePositio
41
42
  const CardHeading = ({ as = "h3", children, className }) => {
42
43
  return React__default.createElement(as, { className: clsx("coop-card--heading", className) }, children);
43
44
  };
44
- CardHeading.displayName = "Card.Heading";
45
45
  const CardLabel = ({ children, className }) => {
46
46
  return jsx("span", { className: clsx("coop-card--label", className), children: children });
47
47
  };
48
- CardLabel.displayName = "Card.Label";
49
48
  const CardBadge = ({ align = "right", children, position = "popout", ...props }) => {
50
49
  return (jsx("div", { className: "coop-card--badge", "data-align": align, "data-position": position, ...props, children: children }));
51
50
  };
52
- CardBadge.displayName = "Card.Badge";
53
51
  const CardBody = ({ children }) => {
54
52
  return jsx(Fragment, { children: children });
55
53
  };
56
- CardBody.displayName = "Card.Body";
57
54
  const CardImage = (props) => {
58
55
  var _a;
59
56
  return jsx(Image, { ...props, crop: (_a = props.crop) !== null && _a !== void 0 ? _a : "wide" });
60
57
  };
61
- CardImage.displayName = "Card.Image";
58
+ CardLabel.config = { name: "CardLabel" };
59
+ CardHeading.config = { name: "CardHeading" };
60
+ CardBadge.config = { name: "CardBadge" };
61
+ CardBody.config = { name: "CardBody" };
62
+ CardImage.config = { name: "CardImage" };
62
63
  Card.Label = CardLabel;
63
64
  Card.Heading = CardHeading;
64
65
  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';
@@ -130,7 +130,7 @@ const DatePicker = ({ className, closeOnSelect = true, dateFormat = "dd/MM/yyyy"
130
130
  // eslint-disable-next-line jsx-a11y/no-autofocus
131
131
  autoFocus: true, captionLayout: "dropdown",
132
132
  //defaultMonth={defaultMonth}
133
- disabled: disabledDates, endMonth: endDate, month: state.view, onMonthChange: setView, onSelect: updateValues, startMonth: startDate, ...calendarProps[mode] }), jsxs("div", { className: "coop-datepicker-actions", children: [jsxs(Button, { "aria-label": "Cancel", onClick: resetState, size: "sm", variant: "grey", children: ["Clear ", jsx(CloseIcon, { stroke: "black", strokeWidth: 1 })] }), jsx(Popover.Close, { asChild: true, children: jsxs(Button, { "aria-label": "Accept", size: "sm", children: ["OK ", jsx(TickIcon, { stroke: "white", strokeWidth: 1 })] }) })] })] })] }), jsx("div", { "aria-live": "assertive", className: "sr-only coop-datepicker-status", role: "status", children: (_g = state.message) !== null && _g !== void 0 ? _g : footerMessage[mode] }), mode === "single" && jsx("input", { ...valueProps, value: (_j = (_h = state.single) === null || _h === void 0 ? void 0 : _h.field) !== null && _j !== void 0 ? _j : "" }), mode === "multiple" && jsx("input", { ...valueProps, value: (_l = (_k = state.multiple) === null || _k === void 0 ? void 0 : _k.field) !== null && _l !== void 0 ? _l : "" }), mode === "range" && (jsxs(Fragment, { children: [jsx("input", { ...baseValueProps, id: `${uid}_start`, name: `${name}_start`, value: (_p = (_o = (_m = state.range) === null || _m === void 0 ? void 0 : _m.field) === null || _o === void 0 ? void 0 : _o.from) !== null && _p !== void 0 ? _p : "" }), jsx("input", { ...baseValueProps, id: `${uid}_end`, name: `${name}_end`, value: (_s = (_r = (_q = state.range) === null || _q === void 0 ? void 0 : _q.field) === null || _r === void 0 ? void 0 : _r.to) !== null && _s !== void 0 ? _s : "" })] }))] }));
133
+ disabled: disabledDates, endMonth: endDate, month: state.view, onMonthChange: setView, onSelect: updateValues, startMonth: startDate, ...calendarProps[mode] }), jsxs("div", { className: "coop-datepicker-actions", children: [jsxs(Button, { "aria-label": "Cancel", className: "bg-tint-grey", onClick: resetState, size: "sm", children: ["Clear ", jsx(CloseIcon, { stroke: "black", strokeWidth: 1 })] }), jsx(Popover.Close, { asChild: true, children: jsxs(Button, { "aria-label": "Accept", size: "sm", children: ["OK ", jsx(TickIcon, { stroke: "white", strokeWidth: 1 })] }) })] })] })] }), jsx("div", { "aria-live": "assertive", className: "sr-only coop-datepicker-status", role: "status", children: (_g = state.message) !== null && _g !== void 0 ? _g : footerMessage[mode] }), mode === "single" && jsx("input", { ...valueProps, value: (_j = (_h = state.single) === null || _h === void 0 ? void 0 : _h.field) !== null && _j !== void 0 ? _j : "" }), mode === "multiple" && jsx("input", { ...valueProps, value: (_l = (_k = state.multiple) === null || _k === void 0 ? void 0 : _k.field) !== null && _l !== void 0 ? _l : "" }), mode === "range" && (jsxs(Fragment, { children: [jsx("input", { ...baseValueProps, id: `${uid}_start`, name: `${name}_start`, value: (_p = (_o = (_m = state.range) === null || _m === void 0 ? void 0 : _m.field) === null || _o === void 0 ? void 0 : _o.from) !== null && _p !== void 0 ? _p : "" }), jsx("input", { ...baseValueProps, id: `${uid}_end`, name: `${name}_end`, value: (_s = (_r = (_q = state.range) === null || _q === void 0 ? void 0 : _q.field) === null || _r === void 0 ? void 0 : _r.to) !== null && _s !== void 0 ? _s : "" })] }))] }));
134
134
  };
135
135
  DatePicker.config = componentConfig;
136
136
 
@@ -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;
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { clsx } from 'clsx';
3
3
  import { useSlots } from '../../hooks/useSlots.js';
4
- import { hasUserBg, bgClassToColor } from '../../utils/index.js';
4
+ import { hasUserBg } 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 }) => {
@@ -15,15 +15,20 @@ const Expandable = ({ children, className, ref, ...props }) => {
15
15
  className: clsx("coop-expandable", !hasUserBg(className) && "bg-tint-grey", className),
16
16
  ...props,
17
17
  };
18
- componentProps.style = {
19
- "--bg": `var(--color-${bgClassToColor(componentProps.className)})`,
20
- };
21
- return (jsxs("details", { ...componentProps, ref: ref, children: [slots.ExpandableSummary, jsx("div", { className: "coop-expandable--content", children: slots.Children })] }));
18
+ // componentProps.style = {
19
+ // "--bg": `var(--color-${bgClassToColor(componentProps.className)})`,
20
+ // }
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;
@@ -22,9 +22,9 @@ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) =>
22
22
  return React__default.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children);
23
23
  };
24
24
  const PillBadge = ({ children, className }) => {
25
- return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-offer-red", className), children: children }));
25
+ return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-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;
@@ -1,8 +1,9 @@
1
- import type { InputHTMLAttributes, JSX, Ref } from "react";
1
+ import type { FormHTMLAttributes, JSX, Ref } from "react";
2
2
  import React from "react";
3
3
  import { StandardSizes } from "../../types";
4
4
  import { type ButtonProps } from "../Button";
5
- export interface SearchboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
5
+ import { TextInputProps } from "../TextInput";
6
+ export interface SearchboxProps extends FormHTMLAttributes<HTMLFormElement> {
6
7
  /** **(Optional)** Specify a server endpoint to submit the form. Will be ignored if onSubmit is also set. */
7
8
  action?: string;
8
9
  /** **(Optional)** Specify props to forward to the Button element. Use `label` to set Button text. */
@@ -28,7 +29,22 @@ export interface SearchboxProps extends Omit<InputHTMLAttributes<HTMLInputElemen
28
29
  /** **(Optional)** Specify the Searchbox size. */
29
30
  size?: StandardSizes;
30
31
  /** **(Optional)** Specify the Searchbox variant. */
31
- variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost";
32
+ variant?: "solid" | "ghost";
32
33
  }
33
- export declare const Searchbox: ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize, autoComplete, button, className, id, label, labelVisible, name, onSubmit, placeholder, ref, size, variant, ...props }: SearchboxProps) => JSX.Element;
34
+ export declare const Searchbox: {
35
+ ({ action, children, className, id, label, labelVisible, onSubmit, ref, size, variant, ...props }: SearchboxProps): JSX.Element;
36
+ Button: {
37
+ ({ children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
38
+ config: {
39
+ name: string;
40
+ };
41
+ };
42
+ Input: {
43
+ (props: TextInputProps): import("react/jsx-runtime").JSX.Element;
44
+ config: {
45
+ isField: boolean;
46
+ name: string;
47
+ };
48
+ };
49
+ };
34
50
  export default Searchbox;
@@ -1,21 +1,27 @@
1
1
 
2
2
  "use client";
3
- import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import clsx from 'clsx';
5
5
  import React__default, { useState, useCallback } from 'react';
6
6
  import { useId } from '../../hooks/useId.js';
7
+ import { useSlots } from '../../hooks/useSlots.js';
8
+ import { hasUserBorder } from '../../utils/index.js';
7
9
  import { Button } from '../Button/Button.js';
8
10
  import { Field } from '../Field/Field.js';
9
- import { Label } from '../FieldMarkers/Label.js';
10
- import { SearchIcon } from '../Icon/SearchIcon.js';
11
+ import { SearchIcon } from '../icons/SearchIcon.js';
11
12
  import { TextInput } from '../TextInput/TextInput.js';
12
13
 
13
- const defaultButtonProps = {
14
- label: React__default.createElement(SearchIcon, { alt: "Search", stroke: "currentColor", strokeWidth: 2 }),
15
- loadingText: "",
14
+ const componentSlots = {
15
+ SearchboxButton: null,
16
+ SearchboxInput: null,
16
17
  };
17
- const Searchbox = ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize = "off", autoComplete = "off", button = defaultButtonProps, className, id, label, labelVisible = false, name = "query", onSubmit, placeholder, ref, size = "md", variant = "green", ...props }) => {
18
- var _a, _b;
18
+ const defaultButtonText = React__default.createElement(SearchIcon, {
19
+ alt: "Search",
20
+ stroke: "currentColor",
21
+ strokeWidth: 2,
22
+ });
23
+ const Searchbox = ({ action, children, className, id, label, labelVisible = false, onSubmit, ref, size = "md", variant = "solid", ...props }) => {
24
+ const slots = useSlots(componentSlots, children);
19
25
  const [isPending, setIsPending] = useState(false);
20
26
  const uid = useId(id);
21
27
  const handleSubmit = useCallback(async (event) => {
@@ -30,37 +36,45 @@ const Searchbox = ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize
30
36
  setIsPending(false);
31
37
  }
32
38
  }, [onSubmit, isPending]);
39
+ let borderClass = "";
40
+ if (!hasUserBorder(className)) {
41
+ borderClass = variant === "ghost" ? "border-teal" : "border-grey";
42
+ }
33
43
  const formProps = {
34
44
  action: action !== null && action !== void 0 ? action : undefined,
35
- className: clsx("coop-searchbox", className),
45
+ className: clsx("coop-searchbox", borderClass, className),
36
46
  "data-size": size && size !== "md" ? size : undefined,
37
- "data-variant": variant.length && variant !== "green" ? variant : undefined,
38
- id: uid,
47
+ "data-variant": variant.length && variant !== "solid" ? variant : undefined,
48
+ id: uid + "-form",
39
49
  onSubmit: onSubmit ? handleSubmit : undefined,
50
+ ...props,
40
51
  };
41
- const buttonProps = {
42
- className: button === null || button === void 0 ? void 0 : button.className,
52
+ slots.SearchboxButton = React__default.cloneElement(slots.SearchboxButton, {
43
53
  isLoading: isPending,
44
- loadingText: (_a = button === null || button === void 0 ? void 0 : button.loadingText) !== null && _a !== void 0 ? _a : "",
45
54
  size,
46
- variant,
47
- };
48
- const inputProps = {
49
- "aria-placeholder": (_b = placeholder !== null && placeholder !== void 0 ? placeholder : ariaPlaceholder) !== null && _b !== void 0 ? _b : undefined,
50
- autoCapitalize,
51
- autoComplete,
52
- id: uid + "--input",
53
- name,
54
- placeholder,
55
+ });
56
+ slots.SearchboxInput = React__default.cloneElement(slots.SearchboxInput, {
57
+ autoCapitalize: "off",
58
+ id: uid,
55
59
  size,
56
- type: "search",
57
- ...props,
58
- };
60
+ });
59
61
  const labelProps = {
60
- htmlFor: uid + "--input",
62
+ htmlFor: uid,
61
63
  isVisible: labelVisible,
62
64
  };
63
- return (jsxs("form", { ...formProps, ref: ref, children: [label && jsx(Label, { ...labelProps, children: label }), jsxs("div", { className: "coop-searchbox--inner", children: [jsx(Field, { children: jsx(TextInput, { ...inputProps }) }), jsx(Button, { ...buttonProps, children: button.label })] })] }));
65
+ return (jsxs("form", { ...formProps, ref: ref, children: [label && jsx(Field.Label, { ...labelProps, children: label }), jsxs("div", { className: clsx("coop-searchbox--inner"), children: [jsx(Field, { children: slots.SearchboxInput }), slots.SearchboxButton] })] }));
66
+ };
67
+ const SearchboxButton = ({ children, ...props }) => {
68
+ const buttonProps = {
69
+ children: children !== null && children !== void 0 ? children : defaultButtonText,
70
+ ...props,
71
+ };
72
+ return jsx(Button, { ...buttonProps });
64
73
  };
74
+ const SearchboxInput = (props) => jsx(TextInput, { ...props });
75
+ Searchbox.Button = SearchboxButton;
76
+ Searchbox.Input = SearchboxInput;
77
+ SearchboxButton.config = { name: "SearchboxButton" };
78
+ SearchboxInput.config = { isField: true, name: "SearchboxInput" };
65
79
 
66
80
  export { Searchbox, Searchbox as default };