@coopdigital/react 0.46.0 → 0.48.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 (198) hide show
  1. package/dist/components/AlertBanner/AlertBanner.d.ts +16 -4
  2. package/dist/components/AlertBanner/AlertBanner.js +8 -3
  3. package/dist/components/Author/Author.d.ts +4 -2
  4. package/dist/components/Author/Author.js +2 -2
  5. package/dist/components/Button/Button.d.ts +1 -1
  6. package/dist/components/Button/Button.js +1 -2
  7. package/dist/components/Card/Card.d.ts +4 -2
  8. package/dist/components/Card/Card.js +2 -2
  9. package/dist/components/Checkbox/Checkbox.d.ts +4 -2
  10. package/dist/components/Checkbox/Checkbox.js +3 -3
  11. package/dist/components/Expandable/Expandable.d.ts +4 -2
  12. package/dist/components/Expandable/Expandable.js +2 -2
  13. package/dist/components/Field/Field.d.ts +4 -2
  14. package/dist/components/Field/Field.js +4 -4
  15. package/dist/components/FieldMarkers/Error.d.ts +4 -2
  16. package/dist/components/FieldMarkers/Error.js +2 -2
  17. package/dist/components/FieldMarkers/Hint.d.ts +5 -3
  18. package/dist/components/FieldMarkers/Hint.js +2 -2
  19. package/dist/components/FieldMarkers/Label.d.ts +4 -2
  20. package/dist/components/FieldMarkers/Label.js +6 -2
  21. package/dist/components/FieldMarkers/Legend.d.ts +4 -2
  22. package/dist/components/FieldMarkers/Legend.js +2 -2
  23. package/dist/components/Fieldset/Fieldset.d.ts +4 -2
  24. package/dist/components/Fieldset/Fieldset.js +2 -4
  25. package/dist/components/Flourish/Flourish.d.ts +4 -2
  26. package/dist/components/Flourish/Flourish.js +2 -2
  27. package/dist/components/Icon/AddIcon.d.ts +1 -1
  28. package/dist/components/Icon/AddIcon.js +6 -5
  29. package/dist/components/Icon/ArrowDownIcon.d.ts +1 -1
  30. package/dist/components/Icon/ArrowDownIcon.js +6 -5
  31. package/dist/components/Icon/ArrowLeftIcon.d.ts +1 -1
  32. package/dist/components/Icon/ArrowLeftIcon.js +6 -5
  33. package/dist/components/Icon/ArrowRightIcon.d.ts +1 -1
  34. package/dist/components/Icon/ArrowRightIcon.js +6 -5
  35. package/dist/components/Icon/ArrowUpIcon.d.ts +1 -1
  36. package/dist/components/Icon/ArrowUpIcon.js +6 -5
  37. package/dist/components/Icon/AvatarAltIcon.d.ts +1 -1
  38. package/dist/components/Icon/AvatarAltIcon.js +6 -5
  39. package/dist/components/Icon/AvatarIcon.d.ts +1 -1
  40. package/dist/components/Icon/AvatarIcon.js +6 -5
  41. package/dist/components/Icon/BasketIcon.d.ts +1 -1
  42. package/dist/components/Icon/BasketIcon.js +6 -5
  43. package/dist/components/Icon/CalendarIcon.d.ts +1 -1
  44. package/dist/components/Icon/CalendarIcon.js +6 -5
  45. package/dist/components/Icon/ChevronDownIcon.d.ts +1 -1
  46. package/dist/components/Icon/ChevronDownIcon.js +6 -5
  47. package/dist/components/Icon/ChevronLeftIcon.d.ts +1 -1
  48. package/dist/components/Icon/ChevronLeftIcon.js +6 -5
  49. package/dist/components/Icon/ChevronRightIcon.d.ts +1 -1
  50. package/dist/components/Icon/ChevronRightIcon.js +6 -5
  51. package/dist/components/Icon/ChevronUpIcon.d.ts +1 -1
  52. package/dist/components/Icon/ChevronUpIcon.js +6 -5
  53. package/dist/components/Icon/ClockIcon.d.ts +1 -1
  54. package/dist/components/Icon/ClockIcon.js +6 -5
  55. package/dist/components/Icon/CloseAltIcon.d.ts +1 -1
  56. package/dist/components/Icon/CloseAltIcon.js +6 -5
  57. package/dist/components/Icon/CloseIcon.d.ts +1 -1
  58. package/dist/components/Icon/CloseIcon.js +6 -5
  59. package/dist/components/Icon/CoopCardIcon.d.ts +1 -1
  60. package/dist/components/Icon/CoopCardIcon.js +6 -5
  61. package/dist/components/Icon/CoopIcon.d.ts +1 -1
  62. package/dist/components/Icon/CoopIcon.js +6 -5
  63. package/dist/components/Icon/CoopLocationIcon.d.ts +1 -1
  64. package/dist/components/Icon/CoopLocationIcon.js +6 -5
  65. package/dist/components/Icon/DownloadIcon.d.ts +1 -1
  66. package/dist/components/Icon/DownloadIcon.js +6 -5
  67. package/dist/components/Icon/HomeIcon.d.ts +1 -1
  68. package/dist/components/Icon/HomeIcon.js +6 -5
  69. package/dist/components/Icon/InformationIcon.d.ts +1 -1
  70. package/dist/components/Icon/InformationIcon.js +6 -5
  71. package/dist/components/Icon/LoadingIcon.d.ts +1 -1
  72. package/dist/components/Icon/LoadingIcon.js +6 -5
  73. package/dist/components/Icon/LocationIcon.d.ts +1 -1
  74. package/dist/components/Icon/LocationIcon.js +6 -5
  75. package/dist/components/Icon/MailIcon.d.ts +1 -1
  76. package/dist/components/Icon/MailIcon.js +6 -5
  77. package/dist/components/Icon/MenuIcon.d.ts +1 -1
  78. package/dist/components/Icon/MenuIcon.js +6 -5
  79. package/dist/components/Icon/MessageIcon.d.ts +1 -1
  80. package/dist/components/Icon/MessageIcon.js +6 -5
  81. package/dist/components/Icon/MinusIcon.d.ts +1 -1
  82. package/dist/components/Icon/MinusIcon.js +6 -5
  83. package/dist/components/Icon/OpenNewIcon.d.ts +1 -1
  84. package/dist/components/Icon/OpenNewIcon.js +6 -5
  85. package/dist/components/Icon/PencilIcon.d.ts +1 -1
  86. package/dist/components/Icon/PencilIcon.js +6 -5
  87. package/dist/components/Icon/PhoneIcon.d.ts +1 -1
  88. package/dist/components/Icon/PhoneIcon.js +6 -5
  89. package/dist/components/Icon/QuestionIcon.d.ts +1 -1
  90. package/dist/components/Icon/QuestionIcon.js +6 -5
  91. package/dist/components/Icon/ScooterIcon.d.ts +1 -1
  92. package/dist/components/Icon/ScooterIcon.js +6 -5
  93. package/dist/components/Icon/SearchIcon.d.ts +1 -1
  94. package/dist/components/Icon/SearchIcon.js +6 -5
  95. package/dist/components/Icon/SettingsIcon.d.ts +1 -1
  96. package/dist/components/Icon/SettingsIcon.js +6 -5
  97. package/dist/components/Icon/TickAltIcon.d.ts +1 -1
  98. package/dist/components/Icon/TickAltIcon.js +6 -5
  99. package/dist/components/Icon/TickIcon.d.ts +1 -1
  100. package/dist/components/Icon/TickIcon.js +6 -5
  101. package/dist/components/Icon/VanIcon.d.ts +1 -1
  102. package/dist/components/Icon/VanIcon.js +6 -5
  103. package/dist/components/Icon/WarningIcon.d.ts +1 -1
  104. package/dist/components/Icon/WarningIcon.js +6 -5
  105. package/dist/components/Icon/WriteIcon.d.ts +1 -1
  106. package/dist/components/Icon/WriteIcon.js +6 -5
  107. package/dist/components/Image/Image.d.ts +4 -2
  108. package/dist/components/Image/Image.js +2 -2
  109. package/dist/components/Pill/Pill.d.ts +4 -2
  110. package/dist/components/Pill/Pill.js +5 -6
  111. package/dist/components/Radio/Radio.d.ts +5 -3
  112. package/dist/components/Radio/Radio.js +6 -7
  113. package/dist/components/Searchbox/Searchbox.d.ts +4 -2
  114. package/dist/components/Searchbox/Searchbox.js +14 -9
  115. package/dist/components/Select/Select.d.ts +46 -0
  116. package/dist/components/Select/Select.js +29 -0
  117. package/dist/components/Select/index.d.ts +4 -0
  118. package/dist/components/Signpost/Signpost.d.ts +6 -4
  119. package/dist/components/Signpost/Signpost.js +3 -6
  120. package/dist/components/SkipNav/SkipNav.d.ts +4 -2
  121. package/dist/components/SkipNav/SkipNav.js +2 -2
  122. package/dist/components/Squircle/Squircle.d.ts +4 -2
  123. package/dist/components/Squircle/Squircle.js +2 -2
  124. package/dist/components/Tag/Tag.d.ts +5 -3
  125. package/dist/components/Tag/Tag.js +3 -6
  126. package/dist/components/TextInput/TextInput.d.ts +4 -2
  127. package/dist/components/TextInput/TextInput.js +3 -3
  128. package/dist/components/Textarea/Textarea.d.ts +4 -2
  129. package/dist/components/Textarea/Textarea.js +5 -6
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +1 -0
  132. package/package.json +10 -10
  133. package/src/components/AlertBanner/AlertBanner.tsx +22 -9
  134. package/src/components/Author/Author.tsx +5 -2
  135. package/src/components/Button/Button.tsx +2 -3
  136. package/src/components/Card/Card.tsx +5 -2
  137. package/src/components/Checkbox/Checkbox.tsx +11 -5
  138. package/src/components/Expandable/Expandable.tsx +10 -3
  139. package/src/components/Field/Field.tsx +7 -5
  140. package/src/components/FieldMarkers/Error.tsx +9 -3
  141. package/src/components/FieldMarkers/Hint.tsx +10 -4
  142. package/src/components/FieldMarkers/Label.tsx +9 -3
  143. package/src/components/FieldMarkers/Legend.tsx +9 -3
  144. package/src/components/Fieldset/Fieldset.tsx +9 -4
  145. package/src/components/Flourish/Flourish.tsx +5 -2
  146. package/src/components/Icon/AddIcon.tsx +9 -6
  147. package/src/components/Icon/ArrowDownIcon.tsx +9 -6
  148. package/src/components/Icon/ArrowLeftIcon.tsx +9 -6
  149. package/src/components/Icon/ArrowRightIcon.tsx +9 -6
  150. package/src/components/Icon/ArrowUpIcon.tsx +9 -6
  151. package/src/components/Icon/AvatarAltIcon.tsx +9 -6
  152. package/src/components/Icon/AvatarIcon.tsx +9 -6
  153. package/src/components/Icon/BasketIcon.tsx +9 -6
  154. package/src/components/Icon/CalendarIcon.tsx +9 -6
  155. package/src/components/Icon/ChevronDownIcon.tsx +9 -6
  156. package/src/components/Icon/ChevronLeftIcon.tsx +9 -6
  157. package/src/components/Icon/ChevronRightIcon.tsx +9 -6
  158. package/src/components/Icon/ChevronUpIcon.tsx +9 -6
  159. package/src/components/Icon/ClockIcon.tsx +9 -6
  160. package/src/components/Icon/CloseAltIcon.tsx +9 -6
  161. package/src/components/Icon/CloseIcon.tsx +9 -6
  162. package/src/components/Icon/CoopCardIcon.tsx +9 -6
  163. package/src/components/Icon/CoopIcon.tsx +9 -6
  164. package/src/components/Icon/CoopLocationIcon.tsx +9 -6
  165. package/src/components/Icon/DownloadIcon.tsx +9 -6
  166. package/src/components/Icon/HomeIcon.tsx +9 -6
  167. package/src/components/Icon/InformationIcon.tsx +9 -6
  168. package/src/components/Icon/LoadingIcon.tsx +9 -6
  169. package/src/components/Icon/LocationIcon.tsx +9 -6
  170. package/src/components/Icon/MailIcon.tsx +9 -6
  171. package/src/components/Icon/MenuIcon.tsx +9 -6
  172. package/src/components/Icon/MessageIcon.tsx +9 -6
  173. package/src/components/Icon/MinusIcon.tsx +9 -6
  174. package/src/components/Icon/OpenNewIcon.tsx +9 -6
  175. package/src/components/Icon/PencilIcon.tsx +9 -6
  176. package/src/components/Icon/PhoneIcon.tsx +9 -6
  177. package/src/components/Icon/QuestionIcon.tsx +9 -6
  178. package/src/components/Icon/ScooterIcon.tsx +9 -6
  179. package/src/components/Icon/SearchIcon.tsx +9 -6
  180. package/src/components/Icon/SettingsIcon.tsx +9 -6
  181. package/src/components/Icon/TickAltIcon.tsx +9 -6
  182. package/src/components/Icon/TickIcon.tsx +9 -6
  183. package/src/components/Icon/VanIcon.tsx +9 -6
  184. package/src/components/Icon/WarningIcon.tsx +9 -6
  185. package/src/components/Icon/WriteIcon.tsx +9 -6
  186. package/src/components/Image/Image.tsx +5 -2
  187. package/src/components/Pill/Pill.tsx +8 -7
  188. package/src/components/Radio/Radio.tsx +11 -8
  189. package/src/components/Searchbox/Searchbox.tsx +26 -21
  190. package/src/components/Select/Select.tsx +97 -0
  191. package/src/components/Select/index.ts +5 -0
  192. package/src/components/Signpost/Signpost.tsx +8 -8
  193. package/src/components/SkipNav/SkipNav.tsx +5 -2
  194. package/src/components/Squircle/Squircle.tsx +5 -2
  195. package/src/components/Tag/Tag.tsx +9 -8
  196. package/src/components/TextInput/TextInput.tsx +10 -5
  197. package/src/components/Textarea/Textarea.tsx +9 -7
  198. package/src/index.ts +1 -0
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const TickAltIcon = ({ alt, className, fill, ...props }) => {
6
- const id = useId();
5
+ const TickAltIcon = ({ alt, className, fill, id, ref, ...props }) => {
6
+ const uid = useId(id);
7
7
  const componentProps = {
8
- "aria-labelledby": alt ? id : undefined,
8
+ "aria-labelledby": alt ? uid + "-title" : undefined,
9
9
  className: clsx("coop-icon", className),
10
10
  "data-icon": "tick-alt",
11
11
  fill: fill !== null && fill !== void 0 ? fill : "none",
12
+ id: uid,
12
13
  role: alt ? "img" : undefined,
13
14
  viewBox: "0 0 32 32",
14
15
  ...props,
15
16
  };
16
- return (jsxs("svg", { ...componentProps, children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M12.7 22a1 1 0 0 1-.71-.29L8.3 18a1 1 0 0 1 0-1.42 1 1 0 0 1 1.41 0l3 3 9.41-9.38a1 1 0 0 1 1.42 0 1 1 0 0 1 0 1.41L13.4 21.69a1 1 0 0 1-.7.31", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M16 2A14 14 0 1 1 2 16 14 14 0 0 1 16 2m0-2a16 16 0 1 0 16 16A16 16 0 0 0 16 0", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
+ return (jsxs("svg", { ...componentProps, ref: ref, children: [alt ? jsx("title", { id: uid + "-title", children: alt }) : null, jsx("path", { d: "M12.7 22a1 1 0 0 1-.71-.29L8.3 18a1 1 0 0 1 0-1.42 1 1 0 0 1 1.41 0l3 3 9.41-9.38a1 1 0 0 1 1.42 0 1 1 0 0 1 0 1.41L13.4 21.69a1 1 0 0 1-.7.31", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M16 2A14 14 0 1 1 2 16 14 14 0 0 1 16 2m0-2a16 16 0 1 0 16 16A16 16 0 0 0 16 0", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
18
  };
18
19
 
19
20
  export { TickAltIcon };
@@ -2,5 +2,5 @@ import { type SVGProps } from "react";
2
2
  interface IconProps extends SVGProps<SVGSVGElement> {
3
3
  alt?: string;
4
4
  }
5
- export declare const TickIcon: ({ alt, className, fill, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const TickIcon: ({ alt, className, fill, id, ref, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const TickIcon = ({ alt, className, fill, ...props }) => {
6
- const id = useId();
5
+ const TickIcon = ({ alt, className, fill, id, ref, ...props }) => {
6
+ const uid = useId(id);
7
7
  const componentProps = {
8
- "aria-labelledby": alt ? id : undefined,
8
+ "aria-labelledby": alt ? uid + "-title" : undefined,
9
9
  className: clsx("coop-icon", className),
10
10
  "data-icon": "tick",
11
11
  fill: fill !== null && fill !== void 0 ? fill : "none",
12
+ id: uid,
12
13
  role: alt ? "img" : undefined,
13
14
  viewBox: "0 0 32 32",
14
15
  ...props,
15
16
  };
16
- return (jsxs("svg", { ...componentProps, children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M10.41 26a1 1 0 0 1-.71-.3l-6.42-6.59a1 1 0 0 1 1.44-1.39l5.69 5.85L27.28 6.3a1 1 0 1 1 1.44 1.4l-17.59 18a1 1 0 0 1-.72.3", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
+ return (jsxs("svg", { ...componentProps, ref: ref, children: [alt ? jsx("title", { id: uid + "-title", children: alt }) : null, jsx("path", { d: "M10.41 26a1 1 0 0 1-.71-.3l-6.42-6.59a1 1 0 0 1 1.44-1.39l5.69 5.85L27.28 6.3a1 1 0 1 1 1.44 1.4l-17.59 18a1 1 0 0 1-.72.3", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
18
  };
18
19
 
19
20
  export { TickIcon };
@@ -2,5 +2,5 @@ import { type SVGProps } from "react";
2
2
  interface IconProps extends SVGProps<SVGSVGElement> {
3
3
  alt?: string;
4
4
  }
5
- export declare const VanIcon: ({ alt, className, fill, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const VanIcon: ({ alt, className, fill, id, ref, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const VanIcon = ({ alt, className, fill, ...props }) => {
6
- const id = useId();
5
+ const VanIcon = ({ alt, className, fill, id, ref, ...props }) => {
6
+ const uid = useId(id);
7
7
  const componentProps = {
8
- "aria-labelledby": alt ? id : undefined,
8
+ "aria-labelledby": alt ? uid + "-title" : undefined,
9
9
  className: clsx("coop-icon", className),
10
10
  "data-icon": "van",
11
11
  fill: fill !== null && fill !== void 0 ? fill : "none",
12
+ id: uid,
12
13
  role: alt ? "img" : undefined,
13
14
  viewBox: "0 0 32 32",
14
15
  ...props,
15
16
  };
16
- return (jsxs("svg", { ...componentProps, children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M31.05 3H9.8a1 1 0 0 0-1 1v.2H3.06a1 1 0 0 0-1 .86L.89 12.64a1 1 0 0 0-.89 1v10a1 1 0 0 0 1 1h3a5 5 0 0 0 9.9 0H18a5 5 0 0 0 9.89 0h3.21a1 1 0 0 0 .72-.3 1 1 0 0 0 .18-.72V4a1 1 0 0 0-.95-1M3.91 6.24H8.8v6.38H2.93ZM8.92 27A3 3 0 0 1 6 24.71a2.9 2.9 0 0 1-.12-.83 3.1 3.1 0 0 1 .25-1.22 3 3 0 0 1 5.53 0 3.3 3.3 0 0 1 .24 1.22 3.3 3.3 0 0 1-.11.83A3 3 0 0 1 8.92 27M23 27a3 3 0 0 1-2.89-2.24 2.9 2.9 0 0 1-.12-.83 3.1 3.1 0 0 1 .25-1.22 3 3 0 0 1 5.53 0 3.3 3.3 0 0 1 .23 1.17 3.3 3.3 0 0 1-.11.83A3 3 0 0 1 23 27m4.87-4.29a5 5 0 0 0-9.74 0H13.8a5 5 0 0 0-9.75 0H2v-8h7.8a1 1 0 0 0 1-1V5.05H30v17.61Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
+ return (jsxs("svg", { ...componentProps, ref: ref, children: [alt ? jsx("title", { id: uid + "-title", children: alt }) : null, jsx("path", { d: "M31.05 3H9.8a1 1 0 0 0-1 1v.2H3.06a1 1 0 0 0-1 .86L.89 12.64a1 1 0 0 0-.89 1v10a1 1 0 0 0 1 1h3a5 5 0 0 0 9.9 0H18a5 5 0 0 0 9.89 0h3.21a1 1 0 0 0 .72-.3 1 1 0 0 0 .18-.72V4a1 1 0 0 0-.95-1M3.91 6.24H8.8v6.38H2.93ZM8.92 27A3 3 0 0 1 6 24.71a2.9 2.9 0 0 1-.12-.83 3.1 3.1 0 0 1 .25-1.22 3 3 0 0 1 5.53 0 3.3 3.3 0 0 1 .24 1.22 3.3 3.3 0 0 1-.11.83A3 3 0 0 1 8.92 27M23 27a3 3 0 0 1-2.89-2.24 2.9 2.9 0 0 1-.12-.83 3.1 3.1 0 0 1 .25-1.22 3 3 0 0 1 5.53 0 3.3 3.3 0 0 1 .23 1.17 3.3 3.3 0 0 1-.11.83A3 3 0 0 1 23 27m4.87-4.29a5 5 0 0 0-9.74 0H13.8a5 5 0 0 0-9.75 0H2v-8h7.8a1 1 0 0 0 1-1V5.05H30v17.61Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
18
  };
18
19
 
19
20
  export { VanIcon };
@@ -2,5 +2,5 @@ import { type SVGProps } from "react";
2
2
  interface IconProps extends SVGProps<SVGSVGElement> {
3
3
  alt?: string;
4
4
  }
5
- export declare const WarningIcon: ({ alt, className, fill, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const WarningIcon: ({ alt, className, fill, id, ref, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const WarningIcon = ({ alt, className, fill, ...props }) => {
6
- const id = useId();
5
+ const WarningIcon = ({ alt, className, fill, id, ref, ...props }) => {
6
+ const uid = useId(id);
7
7
  const componentProps = {
8
- "aria-labelledby": alt ? id : undefined,
8
+ "aria-labelledby": alt ? uid + "-title" : undefined,
9
9
  className: clsx("coop-icon", className),
10
10
  "data-icon": "warning",
11
11
  fill: fill !== null && fill !== void 0 ? fill : "none",
12
+ id: uid,
12
13
  role: alt ? "img" : undefined,
13
14
  viewBox: "0 0 32 32",
14
15
  ...props,
15
16
  };
16
- return (jsxs("svg", { ...componentProps, children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M2.35 28.08 16.06 4.46l13.71 23.62Zm29.32-.7L17.56 3.07A1.73 1.73 0 0 0 16.06 2a1.94 1.94 0 0 0-1.5 1.1L.35 27.38C-.45 28.77.15 30 1.85 30h28.32a1.6 1.6 0 0 0 1.5-2.62", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M14.52 24.19A1.44 1.44 0 0 1 15 23.1a1.54 1.54 0 0 1 1.13-.46 1.63 1.63 0 0 1 1.12.44 1.39 1.39 0 0 1 .48 1.07 1.48 1.48 0 0 1-.47 1.1 1.62 1.62 0 0 1-1.74.34 1.6 1.6 0 0 1-.51-.32 1.3 1.3 0 0 1-.35-.48 1.3 1.3 0 0 1-.14-.6m2.8-3h-2.4v-9.71h2.4Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
+ return (jsxs("svg", { ...componentProps, ref: ref, children: [alt ? jsx("title", { id: uid + "-title", children: alt }) : null, jsx("path", { d: "M2.35 28.08 16.06 4.46l13.71 23.62Zm29.32-.7L17.56 3.07A1.73 1.73 0 0 0 16.06 2a1.94 1.94 0 0 0-1.5 1.1L.35 27.38C-.45 28.77.15 30 1.85 30h28.32a1.6 1.6 0 0 0 1.5-2.62", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M14.52 24.19A1.44 1.44 0 0 1 15 23.1a1.54 1.54 0 0 1 1.13-.46 1.63 1.63 0 0 1 1.12.44 1.39 1.39 0 0 1 .48 1.07 1.48 1.48 0 0 1-.47 1.1 1.62 1.62 0 0 1-1.74.34 1.6 1.6 0 0 1-.51-.32 1.3 1.3 0 0 1-.35-.48 1.3 1.3 0 0 1-.14-.6m2.8-3h-2.4v-9.71h2.4Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
18
  };
18
19
 
19
20
  export { WarningIcon };
@@ -2,5 +2,5 @@ import { type SVGProps } from "react";
2
2
  interface IconProps extends SVGProps<SVGSVGElement> {
3
3
  alt?: string;
4
4
  }
5
- export declare const WriteIcon: ({ alt, className, fill, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const WriteIcon: ({ alt, className, fill, id, ref, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const WriteIcon = ({ alt, className, fill, ...props }) => {
6
- const id = useId();
5
+ const WriteIcon = ({ alt, className, fill, id, ref, ...props }) => {
6
+ const uid = useId(id);
7
7
  const componentProps = {
8
- "aria-labelledby": alt ? id : undefined,
8
+ "aria-labelledby": alt ? uid + "-title" : undefined,
9
9
  className: clsx("coop-icon", className),
10
10
  "data-icon": "write",
11
11
  fill: fill !== null && fill !== void 0 ? fill : "none",
12
+ id: uid,
12
13
  role: alt ? "img" : undefined,
13
14
  viewBox: "0 0 32 32",
14
15
  ...props,
15
16
  };
16
- return (jsxs("svg", { ...componentProps, children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M19.67 10.13 17.9 11.9H7a1 1 0 0 1 0-2h12a1 1 0 0 1 .67.23M14.9 14.9l-2 2H7a1 1 0 0 1 0-2ZM20 15.9a1 1 0 0 1-1 1h-1.87l2-2a1 1 0 0 1 .82.59.85.85 0 0 1 .05.41M19 21.9H7a1 1 0 0 1 0-2h12a1 1 0 1 1 0 2", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M24.08 10v20h-22V6h21.73l1.54-1.54a1.9 1.9 0 0 0-1-.44H2.07a2 2 0 0 0-2 2V30a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V8Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M30.62 3.41 28.5 1.29a1 1 0 0 0-1.42 0L22.38 6l-3.9 3.9-5 5-1.33 1.33a1 1 0 0 0-.27.48v.19l-.6 2.57a.8.8 0 0 0 0 .43 1 1 0 0 0 1.19.77l2.74-.67a.64.64 0 0 0 .29-.13.6.6 0 0 0 .19-.14l2.85-2.86 1.4-1.39L30.62 4.82a1 1 0 0 0 0-1.41M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M31.33 2.7 29.21.58a2.06 2.06 0 0 0-2.83 0L11.44 15.52a2.1 2.1 0 0 0-.54 1l-.09.41-.54 2.34a2.18 2.18 0 0 0 .54 1.87 2 2 0 0 0 1.4.58 1.8 1.8 0 0 0 .46-.05l2.75-.67a2.1 2.1 0 0 0 1-.54L31.33 5.53a2 2 0 0 0 0-2.83M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
+ return (jsxs("svg", { ...componentProps, ref: ref, children: [alt ? jsx("title", { id: uid + "-title", children: alt }) : null, jsx("path", { d: "M19.67 10.13 17.9 11.9H7a1 1 0 0 1 0-2h12a1 1 0 0 1 .67.23M14.9 14.9l-2 2H7a1 1 0 0 1 0-2ZM20 15.9a1 1 0 0 1-1 1h-1.87l2-2a1 1 0 0 1 .82.59.85.85 0 0 1 .05.41M19 21.9H7a1 1 0 0 1 0-2h12a1 1 0 1 1 0 2", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M24.08 10v20h-22V6h21.73l1.54-1.54a1.9 1.9 0 0 0-1-.44H2.07a2 2 0 0 0-2 2V30a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V8Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M30.62 3.41 28.5 1.29a1 1 0 0 0-1.42 0L22.38 6l-3.9 3.9-5 5-1.33 1.33a1 1 0 0 0-.27.48v.19l-.6 2.57a.8.8 0 0 0 0 .43 1 1 0 0 0 1.19.77l2.74-.67a.64.64 0 0 0 .29-.13.6.6 0 0 0 .19-.14l2.85-2.86 1.4-1.39L30.62 4.82a1 1 0 0 0 0-1.41M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" }), jsx("path", { d: "M31.33 2.7 29.21.58a2.06 2.06 0 0 0-2.83 0L11.44 15.52a2.1 2.1 0 0 0-.54 1l-.09.41-.54 2.34a2.18 2.18 0 0 0 .54 1.87 2 2 0 0 0 1.4.58 1.8 1.8 0 0 0 .46-.05l2.75-.67a2.1 2.1 0 0 0 1-.54L31.33 5.53a2 2 0 0 0 0-2.83M15 19.06l-2.75.63.62-2.75 6.82-6.81L23.81 6l1.54-1.54L27.79 2l2.13 2.12Z", fill: fill !== null && fill !== void 0 ? fill : "currentColor" })] }));
17
18
  };
18
19
 
19
20
  export { WriteIcon };
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, JSX } from "react";
1
+ import type { HTMLAttributes, JSX, Ref } from "react";
2
2
  export interface ImageProps extends HTMLAttributes<HTMLImageElement> {
3
3
  /** Specify text to describe the image. Refer to Experience Library guidelines on writing good alt text. */
4
4
  alt: string;
@@ -6,10 +6,12 @@ export interface ImageProps extends HTMLAttributes<HTMLImageElement> {
6
6
  crop?: "square" | "wide" | "none";
7
7
  /** **(Optional)** Specify the height of the image. */
8
8
  height?: string;
9
+ /** **(Optional)** Specify a custom React ref for this component. */
10
+ ref?: Ref<HTMLImageElement>;
9
11
  /** Specify the Image source URL. */
10
12
  src: string;
11
13
  /** **(Optional)** Specify the width of the image. */
12
14
  width?: string;
13
15
  }
14
- export declare const Image: ({ alt, crop, height, src, width, ...props }: ImageProps) => JSX.Element;
16
+ export declare const Image: ({ alt, crop, height, ref, src, width, ...props }: ImageProps) => JSX.Element;
15
17
  export default Image;
@@ -20,7 +20,7 @@ const getContentfulParams = (src, width, height) => {
20
20
  width: (_b = url.searchParams.get("w")) !== null && _b !== void 0 ? _b : width,
21
21
  };
22
22
  };
23
- const Image = ({ alt, crop, height, src, width = "640", ...props }) => {
23
+ const Image = ({ alt, crop, height, ref, src, width = "640", ...props }) => {
24
24
  let params = { height, src, width };
25
25
  if (src.includes("images.ctfassets.net")) {
26
26
  params = getContentfulParams(src, width, height);
@@ -30,7 +30,7 @@ const Image = ({ alt, crop, height, src, width = "640", ...props }) => {
30
30
  height: params.height,
31
31
  width: params.width,
32
32
  };
33
- return (jsx("picture", { children: jsx("img", { alt: alt, loading: "lazy", src: params.src, ...dimensions, ...props }) }));
33
+ return (jsx("picture", { children: jsx("img", { alt: alt, loading: "lazy", src: params.src, ...dimensions, ...props, ref: ref }) }));
34
34
  };
35
35
 
36
36
  export { Image, Image as default };
@@ -1,4 +1,4 @@
1
- import type { ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
1
+ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
2
2
  import React from "react";
3
3
  import { StandardSizes } from "src/types";
4
4
  export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
@@ -10,6 +10,8 @@ export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
10
10
  className?: string;
11
11
  /** **(Optional)** Specify the URL that the Pill component will link to when clicked. */
12
12
  href?: string;
13
+ /** **(Optional)** Specify a custom React ref for this component. */
14
+ ref?: Ref<HTMLElement>;
13
15
  /** **(Optional)** Specify the Pill size. */
14
16
  size?: StandardSizes;
15
17
  }
@@ -20,7 +22,7 @@ interface PillBadgeProps extends HTMLAttributes<HTMLSpanElement> {
20
22
  className?: string;
21
23
  }
22
24
  export declare const Pill: {
23
- ({ as, children, className, href, size, ...props }: PillProps): JSX.Element;
25
+ ({ as, children, className, href, ref, size, ...props }: PillProps): JSX.Element;
24
26
  Badge: {
25
27
  ({ children, className }: PillBadgeProps): import("react/jsx-runtime").JSX.Element;
26
28
  displayName: string;
@@ -8,19 +8,18 @@ const componentSlots = {
8
8
  Children: null,
9
9
  PillBadge: null,
10
10
  };
11
- const Pill = ({ as, children, className, href, size = "md", ...props }) => {
12
- let element = href ? "a" : "span";
11
+ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) => {
12
+ const element = as !== null && as !== void 0 ? as : (href ? "a" : "span");
13
13
  const slots = useSlots(componentSlots, children);
14
- if (as) {
15
- element = as;
16
- }
17
14
  const componentProps = {
18
15
  className: clsx("coop-pill", !hasUserBg(className) && "bg-tint-grey", className),
19
16
  "data-size": size.length && size !== "md" ? size : undefined,
20
17
  href,
21
18
  ...props,
22
19
  };
23
- return React.createElement(element, { ...componentProps }, slots.PillBadge, slots.Children);
20
+ // https://github.com/facebook/react/issues/34775
21
+ // eslint-disable-next-line react-hooks/refs
22
+ return React.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children);
24
23
  };
25
24
  const PillBadge = ({ children, className }) => {
26
25
  return (jsx("span", { className: clsx("coop-pill--badge", !hasUserBg(className) && "bg-offer-red", className), children: children }));
@@ -1,5 +1,5 @@
1
- import { type InputHTMLAttributes, type JSX } from "react";
2
- import { StandardSizes } from "src/types";
1
+ import { type InputHTMLAttributes, type JSX, Ref } from "react";
2
+ import { StandardSizes } from "../../types";
3
3
  export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
4
4
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
5
5
  className?: string;
@@ -11,8 +11,10 @@ export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
11
11
  id?: string;
12
12
  /** Specify the Radio name. */
13
13
  name: string;
14
+ /** **(Optional)** Specify a custom React ref for this component. */
15
+ ref?: Ref<HTMLInputElement>;
14
16
  /** **(Optional)** Specify the Radio size. */
15
17
  size?: StandardSizes;
16
18
  }
17
- export declare const Radio: ({ className, disabled, error, id, name, size, ...props }: RadioProps) => JSX.Element;
19
+ export declare const Radio: ({ className, disabled, error, id, name, ref, size, ...props }: RadioProps) => JSX.Element;
18
20
  export default Radio;
@@ -1,22 +1,21 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { useId } from 'react';
3
+ import { useId } from '../../hooks/useId.js';
4
4
 
5
- const Radio = ({ className, disabled, error = false, id, name, size = "md", ...props }) => {
6
- const internalId = useId();
7
- id = id !== null && id !== void 0 ? id : internalId;
5
+ const Radio = ({ className, disabled, error = false, id, name, ref, size = "md", ...props }) => {
6
+ const uid = useId(id);
8
7
  const componentProps = {
9
- className: clsx("coop-radio", className),
8
+ className: clsx("coop-radio", "coop-field-element", className),
10
9
  "data-error": error || undefined,
11
10
  "data-size": size.length && size !== "md" ? size : undefined,
12
11
  disabled,
13
- id,
12
+ id: uid,
14
13
  name,
15
14
  type: "radio",
16
15
  ...props,
17
16
  };
18
17
  //const formItemProps = { "aria-disabled": disabled ? true : undefined }
19
- return jsx("input", { ...componentProps });
18
+ return jsx("input", { ...componentProps, ref: ref });
20
19
  };
21
20
 
22
21
  export { Radio, Radio as default };
@@ -1,4 +1,4 @@
1
- import type { InputHTMLAttributes, JSX } from "react";
1
+ import type { InputHTMLAttributes, JSX, Ref } from "react";
2
2
  import React from "react";
3
3
  import { StandardSizes } from "../../types";
4
4
  import { type ButtonProps } from "../Button";
@@ -23,10 +23,12 @@ export interface SearchboxProps extends Omit<InputHTMLAttributes<HTMLInputElemen
23
23
  onSubmit?: React.FormEventHandler<HTMLElement> | undefined;
24
24
  /** **(Optional)** Specify the TextInput placeholder text Do not use in place of a form label. */
25
25
  placeholder?: string;
26
+ /** **(Optional)** Specify a custom React ref for this component. */
27
+ ref?: Ref<HTMLFormElement>;
26
28
  /** **(Optional)** Specify the Searchbox size. */
27
29
  size?: StandardSizes;
28
30
  /** **(Optional)** Specify the Searchbox variant. */
29
31
  variant?: "green" | "blue" | "white" | "grey" | "green-ghost" | "blue-ghost" | "white-ghost" | "grey-ghost";
30
32
  }
31
- export declare const Searchbox: ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize, autoComplete, button, className, id, label, labelVisible, name, onSubmit, placeholder, size, variant, ...props }: SearchboxProps) => JSX.Element;
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;
32
34
  export default Searchbox;
@@ -2,7 +2,8 @@
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import clsx from 'clsx';
5
- import React, { useState, useId, useCallback } from 'react';
5
+ import React, { useState, useCallback } from 'react';
6
+ import { useId } from '../../hooks/useId.js';
6
7
  import { Button } from '../Button/Button.js';
7
8
  import { Label } from '../FieldMarkers/Label.js';
8
9
  import { SearchIcon } from '../Icon/SearchIcon.js';
@@ -12,11 +13,10 @@ const defaultButtonProps = {
12
13
  label: React.createElement(SearchIcon, { alt: "Search", stroke: "currentColor", strokeWidth: 2 }),
13
14
  loadingText: "",
14
15
  };
15
- const Searchbox = ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize = "off", autoComplete = "off", button = defaultButtonProps, className, id, label, labelVisible = false, name = "query", onSubmit, placeholder, size = "md", variant = "green", ...props }) => {
16
+ 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 }) => {
16
17
  var _a, _b;
17
18
  const [isPending, setIsPending] = useState(false);
18
- const internalId = useId();
19
- id = id !== null && id !== void 0 ? id : internalId;
19
+ const uid = useId(id);
20
20
  const handleSubmit = useCallback(async (event) => {
21
21
  event.preventDefault();
22
22
  if (isPending || !onSubmit)
@@ -34,27 +34,32 @@ const Searchbox = ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize
34
34
  className: clsx("coop-searchbox", className),
35
35
  "data-size": size && size !== "md" ? size : undefined,
36
36
  "data-variant": variant.length && variant !== "green" ? variant : undefined,
37
+ id: uid,
37
38
  onSubmit: onSubmit ? handleSubmit : undefined,
38
39
  };
39
40
  const buttonProps = {
40
41
  className: button === null || button === void 0 ? void 0 : button.className,
41
42
  isLoading: isPending,
42
43
  loadingText: (_a = button === null || button === void 0 ? void 0 : button.loadingText) !== null && _a !== void 0 ? _a : "",
43
- size: size,
44
- variant: variant,
44
+ size,
45
+ variant,
45
46
  };
46
47
  const inputProps = {
47
48
  "aria-placeholder": (_b = placeholder !== null && placeholder !== void 0 ? placeholder : ariaPlaceholder) !== null && _b !== void 0 ? _b : undefined,
48
49
  autoCapitalize,
49
50
  autoComplete,
50
- id,
51
+ id: uid + "--input",
51
52
  name,
52
53
  placeholder,
53
- size: size,
54
+ size,
54
55
  type: "search",
55
56
  ...props,
56
57
  };
57
- return (jsxs("form", { ...formProps, children: [label && (jsx(Label, { htmlFor: id, isVisible: labelVisible, children: label })), jsxs("div", { className: "coop-searchbox--inner", children: [jsx(TextInput, { ...inputProps }), jsx(Button, { ...buttonProps, children: button.label })] })] }));
58
+ const labelProps = {
59
+ htmlFor: uid + "--input",
60
+ isVisible: labelVisible,
61
+ };
62
+ return (jsxs("form", { ...formProps, ref: ref, children: [label && jsx(Label, { ...labelProps, children: label }), jsxs("div", { className: "coop-searchbox--inner", children: [jsx(TextInput, { ...inputProps }), jsx(Button, { ...buttonProps, children: button.label })] })] }));
58
63
  };
59
64
 
60
65
  export { Searchbox, Searchbox as default };
@@ -0,0 +1,46 @@
1
+ import type { JSX, OptgroupHTMLAttributes, OptionHTMLAttributes, ReactNode, Ref, SelectHTMLAttributes } from "react";
2
+ import { StandardSizes } from "../../../src/types";
3
+ export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
4
+ /** **(Optional)** Options inside the Select. This should be a set of `Select.Option` or `Select.OptionGroup` components. */
5
+ children?: ReactNode;
6
+ /** **(Optional)** Specify additional CSS classes to be applied to the component. */
7
+ className?: string;
8
+ /** **(Optional)** Specify whether the Select should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
9
+ disabled?: boolean;
10
+ /** **(Optional)** Specify the Select error state. */
11
+ error?: boolean;
12
+ /** **(Optional)** Specify the Select id. Will be auto-generated if not set. */
13
+ id?: string;
14
+ /** Specify the Select name. */
15
+ name: string;
16
+ /** **(Optional)** Specify a custom React ref for this component. */
17
+ ref?: Ref<HTMLSelectElement>;
18
+ /** **(Optional)** Specify the Select size. */
19
+ size?: StandardSizes;
20
+ }
21
+ interface SelectOptionGroupProps extends OptgroupHTMLAttributes<HTMLOptGroupElement> {
22
+ /** **(Optional)** Main content inside the Select option. It can be any valid JSX or string. */
23
+ children?: ReactNode;
24
+ /** Specify the Select option group label. */
25
+ label: string;
26
+ }
27
+ interface SelectOptionProps extends OptionHTMLAttributes<HTMLOptionElement> {
28
+ /** **(Optional)** Main content inside the Select option. It can be any valid JSX or string. */
29
+ children?: ReactNode;
30
+ /** **(Optional)** Specify additional CSS classes to be applied to the Select option. */
31
+ className?: string;
32
+ /** Value of Select option. */
33
+ value: string;
34
+ }
35
+ export declare const Select: {
36
+ ({ children, className, disabled, error, id, name, ref, size, ...props }: SelectProps): JSX.Element;
37
+ OptionGroup: {
38
+ ({ children, ...props }: SelectOptionGroupProps): JSX.Element;
39
+ displayName: string;
40
+ };
41
+ Option: {
42
+ ({ children, className, ...props }: SelectOptionProps): JSX.Element;
43
+ displayName: string;
44
+ };
45
+ };
46
+ export default Select;
@@ -0,0 +1,29 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import { useId } from '../../hooks/useId.js';
4
+
5
+ const Select = ({ children, className, disabled, error, id, name, ref, size = "md", ...props }) => {
6
+ const uid = useId(id);
7
+ const componentProps = {
8
+ className: clsx("coop-select", "coop-field-element", className),
9
+ "data-error": error !== null && error !== void 0 ? error : undefined,
10
+ "data-size": size.length && size !== "md" ? size : undefined,
11
+ disabled,
12
+ id: uid,
13
+ name,
14
+ ...props,
15
+ };
16
+ return (jsx("select", { ...componentProps, ref: ref, children: children }));
17
+ };
18
+ const SelectOptionGroup = ({ children, ...props }) => {
19
+ return jsx("optgroup", { ...props, children: children });
20
+ };
21
+ const SelectOption = ({ children, className, ...props }) => {
22
+ return (jsx("option", { className: clsx("coop-select--option", className), ...props, children: children }));
23
+ };
24
+ SelectOptionGroup.displayName = "Select.OptionGroup";
25
+ SelectOption.displayName = "Select.Option";
26
+ Select.OptionGroup = SelectOptionGroup;
27
+ Select.Option = SelectOption;
28
+
29
+ export { Select, Select as default };
@@ -0,0 +1,4 @@
1
+ import Select from "./Select";
2
+ export default Select;
3
+ export { Select };
4
+ export * from "./Select";
@@ -1,9 +1,9 @@
1
- import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
1
+ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
2
2
  import React from "react";
3
3
  import { ImageProps } from "../Image";
4
4
  export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
5
5
  /** **(Optional)** Specify a custom element to override default `a`. */
6
- as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
6
+ as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
7
7
  /** Main content inside the component. It can be any valid JSX or string. */
8
8
  children: React.ReactNode;
9
9
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
@@ -11,9 +11,11 @@ export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
11
11
  /** **(Optional)** Specify the level of the Signpost heading. */
12
12
  headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6";
13
13
  /** Specify the URL that the Signpost component will link to when clicked. */
14
- href: string;
14
+ href?: string;
15
15
  /** **(Optional)** Specify properties of the Signpost Image. */
16
16
  image?: ImageProps;
17
+ /** **(Optional)** Specify a custom React ref for this component. */
18
+ ref?: Ref<HTMLDivElement>;
17
19
  }
18
- export declare const Signpost: ({ as, children, className, headingLevel, href, image, ...props }: SignpostProps) => JSX.Element;
20
+ export declare const Signpost: ({ as, children, className, headingLevel, href, image, ref, ...props }: SignpostProps) => JSX.Element;
19
21
  export default Signpost;
@@ -4,16 +4,13 @@ import React from 'react';
4
4
  import { ChevronRightIcon } from '../Icon/ChevronRightIcon.js';
5
5
  import { Image } from '../Image/Image.js';
6
6
 
7
- const Signpost = ({ as, children, className, headingLevel = "h3", href, image, ...props }) => {
8
- let element = "a";
9
- if (as) {
10
- element = as;
11
- }
7
+ const Signpost = ({ as, children, className, headingLevel = "h3", href, image, ref, ...props }) => {
8
+ const element = as !== null && as !== void 0 ? as : "a";
12
9
  const componentProps = {
13
10
  className: clsx("coop-signpost", className),
14
11
  ...props,
15
12
  };
16
- return (jsxs("div", { ...componentProps, children: [image && jsx(Image, { crop: "wide", ...image }), React.createElement(element, { href }, jsxs("div", { className: "coop-signpost--content", children: [React.createElement(headingLevel, { className: "coop-signpost--heading" }, children), jsx("span", { "aria-hidden": "true", className: "coop-signpost--icon", role: "presentation", children: jsx(ChevronRightIcon, {}) })] }))] }));
13
+ return (jsxs("div", { ...componentProps, ref: ref, children: [image && jsx(Image, { crop: "wide", ...image }), React.createElement(element, { href }, jsxs("div", { className: "coop-signpost--content", children: [React.createElement(headingLevel, { className: "coop-signpost--heading" }, children), jsx("span", { "aria-hidden": "true", className: "coop-signpost--icon", role: "presentation", children: jsx(ChevronRightIcon, {}) })] }))] }));
17
14
  };
18
15
 
19
16
  export { Signpost, Signpost as default };
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, JSX } from "react";
1
+ import type { HTMLAttributes, JSX, Ref } from "react";
2
2
  interface SkipNavLink {
3
3
  href: string;
4
4
  label: string;
@@ -11,6 +11,8 @@ export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
11
11
  /** **(Optional)** Specify links to show in the SkipNav.
12
12
  * Each item needs a `href` and `label`. Defaults to a single link anchored to `#main`. */
13
13
  links?: SkipNavLink[];
14
+ /** **(Optional)** Specify a custom React ref for this component. */
15
+ ref?: Ref<HTMLDivElement>;
14
16
  }
15
- export declare const SkipNav: ({ className, isVisible, links, ...props }: SkipNavProps) => JSX.Element;
17
+ export declare const SkipNav: ({ className, isVisible, links, ref, ...props }: SkipNavProps) => JSX.Element;
16
18
  export default SkipNav;
@@ -2,13 +2,13 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
 
4
4
  const defaultLinks = [{ href: "#main", label: "Skip to main content" }];
5
- const SkipNav = ({ className, isVisible = false, links = defaultLinks, ...props }) => {
5
+ const SkipNav = ({ className, isVisible = false, links = defaultLinks, ref, ...props }) => {
6
6
  const componentProps = {
7
7
  className: clsx("coop-skip-nav", className),
8
8
  ...props,
9
9
  };
10
10
  const navLinks = links.length > 0 ? links : defaultLinks;
11
- return (jsx("nav", { ...componentProps, children: jsx("ul", { children: navLinks.map((link) => {
11
+ return (jsx("nav", { ...componentProps, ref: ref, children: jsx("ul", { children: navLinks.map((link) => {
12
12
  const linkProps = {
13
13
  "data-visible": isVisible,
14
14
  href: link.href,
@@ -1,11 +1,13 @@
1
- import type { HTMLAttributes, JSX } from "react";
1
+ import type { HTMLAttributes, JSX, Ref } from "react";
2
2
  export interface SquircleProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
4
4
  children?: React.ReactNode;
5
5
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
6
6
  className?: string;
7
+ /** **(Optional)** Specify a custom React ref for this component. */
8
+ ref?: Ref<HTMLDivElement>;
7
9
  /** **(Optional)** Specify the Squircle size. */
8
10
  size?: "sm" | "md" | "lg";
9
11
  }
10
- export declare const Squircle: ({ children, className, size, ...props }: SquircleProps) => JSX.Element;
12
+ export declare const Squircle: ({ children, className, ref, size, ...props }: SquircleProps) => JSX.Element;
11
13
  export default Squircle;
@@ -2,13 +2,13 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
3
  import { hasUserBg } from '../../utils/index.js';
4
4
 
5
- const Squircle = ({ children, className, size = "lg", ...props }) => {
5
+ const Squircle = ({ children, className, ref, size = "lg", ...props }) => {
6
6
  const componentProps = {
7
7
  className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer-red", className),
8
8
  "data-size": size.length && size !== "lg" ? size : undefined,
9
9
  ...props,
10
10
  };
11
- return (jsx("figure", { ...componentProps, children: jsx("figcaption", { children: children }) }));
11
+ return (jsx("figure", { ...componentProps, ref: ref, children: jsx("figcaption", { children: children }) }));
12
12
  };
13
13
 
14
14
  export { Squircle, Squircle as default };
@@ -1,16 +1,18 @@
1
- import type { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX } from "react";
1
+ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
2
2
  import React from "react";
3
3
  export interface TagProps extends HTMLAttributes<HTMLAnchorElement> {
4
4
  /** **(Optional)** Specify a custom element to override default `a` or `span`. */
5
- as?: React.FC<AnchorHTMLAttributes<HTMLElement>> | ForwardRefExoticComponent<any> | string;
5
+ as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
6
6
  /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
7
7
  children?: React.ReactNode;
8
8
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
9
9
  className?: string;
10
10
  /** **(Optional)** Specify the URL that the Tag component will link to when clicked. */
11
11
  href?: string;
12
+ /** **(Optional)** Specify a custom React ref for this component. */
13
+ ref?: Ref<HTMLElement>;
12
14
  /** **(Optional)** Specify the Tag size. */
13
15
  size?: "sm" | "md";
14
16
  }
15
- export declare const Tag: ({ as, children, className, href, size, ...props }: TagProps) => JSX.Element;
17
+ export declare const Tag: ({ as, children, className, href, ref, size, ...props }: TagProps) => JSX.Element;
16
18
  export default Tag;