@coopdigital/react 1.19.0 → 1.20.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 (288) hide show
  1. package/dist/components/AlertBanner/AlertBanner.js +5 -2
  2. package/dist/components/Author/Author.js +5 -2
  3. package/dist/components/Button/Button.js +1 -1
  4. package/dist/components/Card/Card.d.ts +96 -49
  5. package/dist/components/Card/Card.js +61 -60
  6. package/dist/components/Card/index.d.ts +2 -2
  7. package/dist/components/Card/index.js +2 -2
  8. package/dist/components/Checkbox/Checkbox.js +5 -2
  9. package/dist/components/DatePicker/DatePicker.js +5 -4
  10. package/dist/components/DatePicker/datepicker-utils.js +12 -11
  11. package/dist/components/Dialog/Dialog.js +6 -3
  12. package/dist/components/Expandable/Expandable.js +6 -3
  13. package/dist/components/Field/Field.js +1 -1
  14. package/dist/components/FieldMarkers/Error.js +5 -2
  15. package/dist/components/FieldMarkers/Hint.js +5 -2
  16. package/dist/components/FieldMarkers/Label.js +5 -2
  17. package/dist/components/Fieldset/Fieldset.js +10 -4
  18. package/dist/components/Flourish/Flourish.js +6 -3
  19. package/dist/components/Form/Form.js +5 -2
  20. package/dist/components/Image/Image.d.ts +3 -5
  21. package/dist/components/Image/Image.js +10 -7
  22. package/dist/components/LoadingSpinner/LoadingSpinner.js +5 -2
  23. package/dist/components/Logo/Logo.js +5 -2
  24. package/dist/components/Picture/Picture.d.ts +15 -0
  25. package/dist/components/Picture/Picture.js +17 -0
  26. package/dist/components/Picture/index.d.ts +2 -0
  27. package/dist/components/Picture/index.js +5 -0
  28. package/dist/components/Prose/Prose.js +5 -2
  29. package/dist/components/Radio/Radio.js +5 -2
  30. package/dist/components/Searchbox/Searchbox.js +6 -6
  31. package/dist/components/Select/Select.js +5 -2
  32. package/dist/components/Signpost/Signpost.js +6 -6
  33. package/dist/components/SkipNav/SkipNav.js +5 -2
  34. package/dist/components/Squircle/Squircle.js +5 -2
  35. package/dist/components/ValidationSummary/ValidationSummary.js +5 -2
  36. package/dist/components/icons/AccountCircleFilledIcon.js +5 -2
  37. package/dist/components/icons/AccountCircleIcon.js +5 -2
  38. package/dist/components/icons/AccountFilledIcon.js +5 -2
  39. package/dist/components/icons/AccountIcon.js +5 -2
  40. package/dist/components/icons/AddIcon.js +5 -2
  41. package/dist/components/icons/AppsFilledIcon.js +5 -2
  42. package/dist/components/icons/AppsIcon.js +5 -2
  43. package/dist/components/icons/ArrowDownIcon.js +5 -2
  44. package/dist/components/icons/ArrowLeftIcon.js +5 -2
  45. package/dist/components/icons/ArrowRightIcon.js +5 -2
  46. package/dist/components/icons/ArrowUpIcon.js +5 -2
  47. package/dist/components/icons/BackspaceFilledIcon.js +5 -2
  48. package/dist/components/icons/BackspaceIcon.js +5 -2
  49. package/dist/components/icons/BasketFilledIcon.js +5 -2
  50. package/dist/components/icons/BasketIcon.js +5 -2
  51. package/dist/components/icons/BellFilledIcon.js +5 -2
  52. package/dist/components/icons/BellIcon.js +5 -2
  53. package/dist/components/icons/BroomIcon.js +5 -2
  54. package/dist/components/icons/CalendarFilledIcon.js +5 -2
  55. package/dist/components/icons/CalendarIcon.js +5 -2
  56. package/dist/components/icons/CashFilledIcon.js +5 -2
  57. package/dist/components/icons/CashIcon.js +5 -2
  58. package/dist/components/icons/ChevronDownIcon.js +5 -2
  59. package/dist/components/icons/ChevronLeftIcon.js +5 -2
  60. package/dist/components/icons/ChevronRightIcon.js +5 -2
  61. package/dist/components/icons/ChevronUpIcon.js +5 -2
  62. package/dist/components/icons/CircleBurgerFilledIcon.js +5 -2
  63. package/dist/components/icons/CircleBurgerIcon.js +5 -2
  64. package/dist/components/icons/ClipboardFilledIcon.js +5 -2
  65. package/dist/components/icons/ClipboardIcon.js +5 -2
  66. package/dist/components/icons/ClockFilledIcon.js +5 -2
  67. package/dist/components/icons/ClockIcon.js +5 -2
  68. package/dist/components/icons/CloseAltFilledIcon.js +5 -2
  69. package/dist/components/icons/CloseAltIcon.js +5 -2
  70. package/dist/components/icons/CogIcon.js +5 -2
  71. package/dist/components/icons/CommunityFilledIcon.js +5 -2
  72. package/dist/components/icons/CommunityIcon.js +5 -2
  73. package/dist/components/icons/ComputerIcon.js +5 -2
  74. package/dist/components/icons/ContactFilledIcon.js +5 -2
  75. package/dist/components/icons/ContactIcon.js +5 -2
  76. package/dist/components/icons/ContactlessFilledIcon.js +5 -2
  77. package/dist/components/icons/ContactlessIcon.js +5 -2
  78. package/dist/components/icons/CoopLiveIcon.js +5 -2
  79. package/dist/components/icons/CoopLocationFilledIcon.js +5 -2
  80. package/dist/components/icons/CoopLogoIcon.js +5 -2
  81. package/dist/components/icons/CoopMembershipCardFilledIcon.js +5 -2
  82. package/dist/components/icons/CreditCardFilledIcon.js +5 -2
  83. package/dist/components/icons/CreditCardIcon.js +5 -2
  84. package/dist/components/icons/CrossIcon.js +5 -2
  85. package/dist/components/icons/DocumentIcon.js +5 -2
  86. package/dist/components/icons/DownloadIcon.js +5 -2
  87. package/dist/components/icons/EnterStoreIcon.js +5 -2
  88. package/dist/components/icons/ExitStoreIcon.js +5 -2
  89. package/dist/components/icons/EyeFilledIcon.js +5 -2
  90. package/dist/components/icons/EyeIcon.js +5 -2
  91. package/dist/components/icons/EyeStrikeFilledIcon.js +5 -2
  92. package/dist/components/icons/EyeStrikeIcon.js +5 -2
  93. package/dist/components/icons/FeedbackFilledIcon.js +5 -2
  94. package/dist/components/icons/FeedbackIcon.js +5 -2
  95. package/dist/components/icons/FilterIcon.js +5 -2
  96. package/dist/components/icons/GiftCardFilledIcon.js +5 -2
  97. package/dist/components/icons/GiftCardIcon.js +5 -2
  98. package/dist/components/icons/GiftFilledIcon.js +5 -2
  99. package/dist/components/icons/GiftIcon.js +5 -2
  100. package/dist/components/icons/HelpFilledIcon.js +5 -2
  101. package/dist/components/icons/HelpIcon.js +5 -2
  102. package/dist/components/icons/HomeFilledIcon.js +5 -2
  103. package/dist/components/icons/HomeIcon.js +5 -2
  104. package/dist/components/icons/HowDoIAssistantIcon.js +5 -2
  105. package/dist/components/icons/InfoIcon.js +5 -2
  106. package/dist/components/icons/KebabIcon.js +5 -2
  107. package/dist/components/icons/LoadingIcon.js +5 -2
  108. package/dist/components/icons/LocationFilledIcon.js +5 -2
  109. package/dist/components/icons/LocationIcon.js +5 -2
  110. package/dist/components/icons/LogoutIcon.js +5 -2
  111. package/dist/components/icons/MailIcon.js +5 -2
  112. package/dist/components/icons/MenuIcon.js +5 -2
  113. package/dist/components/icons/MessageIcon.js +5 -2
  114. package/dist/components/icons/MinusIcon.js +5 -2
  115. package/dist/components/icons/NotesFilledIcon.js +5 -2
  116. package/dist/components/icons/NotesIcon.js +5 -2
  117. package/dist/components/icons/OpenNewIcon.js +5 -2
  118. package/dist/components/icons/OwnBagIcon.js +5 -2
  119. package/dist/components/icons/PadlockIcon.js +5 -2
  120. package/dist/components/icons/PencilIcon.js +5 -2
  121. package/dist/components/icons/PhoneIcon.js +5 -2
  122. package/dist/components/icons/PowerIcon.js +5 -2
  123. package/dist/components/icons/SaveFilledIcon.js +5 -2
  124. package/dist/components/icons/SaveIcon.js +5 -2
  125. package/dist/components/icons/ScooterIcon.js +5 -2
  126. package/dist/components/icons/SearchFilledIcon.js +5 -2
  127. package/dist/components/icons/SearchIcon.js +5 -2
  128. package/dist/components/icons/SendIcon.js +5 -2
  129. package/dist/components/icons/SpannerIcon.js +5 -2
  130. package/dist/components/icons/StarFilledIcon.js +5 -2
  131. package/dist/components/icons/StarIcon.js +5 -2
  132. package/dist/components/icons/TickAltFilledIcon.js +5 -2
  133. package/dist/components/icons/TickAltIcon.js +5 -2
  134. package/dist/components/icons/TickIcon.js +5 -2
  135. package/dist/components/icons/TruckIcon.js +5 -2
  136. package/dist/components/icons/UserWipeIcon.js +5 -2
  137. package/dist/components/icons/VoucherFilledIcon.js +5 -2
  138. package/dist/components/icons/VoucherIcon.js +5 -2
  139. package/dist/components/icons/WarningCircleFilledIcon.js +5 -2
  140. package/dist/components/icons/WarningCircleIcon.js +5 -2
  141. package/dist/components/icons/WarningFilledIcon.js +5 -2
  142. package/dist/components/icons/WarningIcon.js +5 -2
  143. package/dist/components/icons/WifiIcon.js +5 -2
  144. package/dist/components/icons/WriteIcon.js +5 -2
  145. package/dist/hooks/useSlots.js +4 -3
  146. package/dist/index.d.ts +4 -2
  147. package/dist/index.js +3 -2
  148. package/package.json +11 -10
  149. package/src/components/Author/Author.tsx +1 -1
  150. package/src/components/Button/Button.tsx +2 -2
  151. package/src/components/Card/Card.tsx +149 -105
  152. package/src/components/Checkbox/Checkbox.tsx +2 -2
  153. package/src/components/DatePicker/DatePicker.tsx +8 -6
  154. package/src/components/Dialog/Dialog.tsx +2 -2
  155. package/src/components/Expandable/Expandable.tsx +3 -3
  156. package/src/components/Field/Field.tsx +7 -6
  157. package/src/components/FieldMarkers/Label.tsx +1 -1
  158. package/src/components/Fieldset/Fieldset.tsx +4 -4
  159. package/src/components/Flourish/Flourish.tsx +1 -1
  160. package/src/components/Image/Image.tsx +15 -22
  161. package/src/components/LoadingSpinner/LoadingSpinner.tsx +1 -1
  162. package/src/components/PasswordInput/PasswordInput.tsx +3 -3
  163. package/src/components/Picture/Picture.tsx +36 -0
  164. package/src/components/Picture/index.ts +5 -0
  165. package/src/components/Pill/Pill.tsx +3 -3
  166. package/src/components/Popover/Popover.tsx +2 -2
  167. package/src/components/Prose/Prose.tsx +1 -1
  168. package/src/components/Radio/Radio.tsx +2 -2
  169. package/src/components/Searchbox/Searchbox.context.tsx +1 -1
  170. package/src/components/Searchbox/Searchbox.tsx +9 -10
  171. package/src/components/Select/Select.tsx +2 -2
  172. package/src/components/Signpost/Signpost.tsx +3 -3
  173. package/src/components/Squircle/Squircle.tsx +2 -1
  174. package/src/components/Tag/Tag.tsx +1 -1
  175. package/src/components/TextInput/TextInput.tsx +2 -2
  176. package/src/components/Textarea/Textarea.tsx +3 -3
  177. package/src/components/ValidationSummary/ValidationSummary.tsx +5 -2
  178. package/src/components/icons/AccountCircleFilledIcon.tsx +1 -1
  179. package/src/components/icons/AccountCircleIcon.tsx +1 -1
  180. package/src/components/icons/AccountFilledIcon.tsx +1 -1
  181. package/src/components/icons/AccountIcon.tsx +1 -1
  182. package/src/components/icons/AddIcon.tsx +1 -1
  183. package/src/components/icons/AppsFilledIcon.tsx +1 -1
  184. package/src/components/icons/AppsIcon.tsx +1 -1
  185. package/src/components/icons/ArrowDownIcon.tsx +1 -1
  186. package/src/components/icons/ArrowLeftIcon.tsx +1 -1
  187. package/src/components/icons/ArrowRightIcon.tsx +1 -1
  188. package/src/components/icons/ArrowUpIcon.tsx +1 -1
  189. package/src/components/icons/BackspaceFilledIcon.tsx +1 -1
  190. package/src/components/icons/BackspaceIcon.tsx +1 -1
  191. package/src/components/icons/BasketFilledIcon.tsx +1 -1
  192. package/src/components/icons/BasketIcon.tsx +1 -1
  193. package/src/components/icons/BellFilledIcon.tsx +1 -1
  194. package/src/components/icons/BellIcon.tsx +1 -1
  195. package/src/components/icons/BroomIcon.tsx +1 -1
  196. package/src/components/icons/CalendarFilledIcon.tsx +1 -1
  197. package/src/components/icons/CalendarIcon.tsx +1 -1
  198. package/src/components/icons/CashFilledIcon.tsx +1 -1
  199. package/src/components/icons/CashIcon.tsx +1 -1
  200. package/src/components/icons/ChevronDownIcon.tsx +1 -1
  201. package/src/components/icons/ChevronLeftIcon.tsx +1 -1
  202. package/src/components/icons/ChevronRightIcon.tsx +1 -1
  203. package/src/components/icons/ChevronUpIcon.tsx +1 -1
  204. package/src/components/icons/CircleBurgerFilledIcon.tsx +1 -1
  205. package/src/components/icons/CircleBurgerIcon.tsx +1 -1
  206. package/src/components/icons/ClipboardFilledIcon.tsx +1 -1
  207. package/src/components/icons/ClipboardIcon.tsx +1 -1
  208. package/src/components/icons/ClockFilledIcon.tsx +1 -1
  209. package/src/components/icons/ClockIcon.tsx +1 -1
  210. package/src/components/icons/CloseAltFilledIcon.tsx +1 -1
  211. package/src/components/icons/CloseAltIcon.tsx +1 -1
  212. package/src/components/icons/CogIcon.tsx +1 -1
  213. package/src/components/icons/CommunityFilledIcon.tsx +1 -1
  214. package/src/components/icons/CommunityIcon.tsx +1 -1
  215. package/src/components/icons/ComputerIcon.tsx +1 -1
  216. package/src/components/icons/ContactFilledIcon.tsx +1 -1
  217. package/src/components/icons/ContactIcon.tsx +1 -1
  218. package/src/components/icons/ContactlessFilledIcon.tsx +1 -1
  219. package/src/components/icons/ContactlessIcon.tsx +1 -1
  220. package/src/components/icons/CoopLiveIcon.tsx +1 -1
  221. package/src/components/icons/CoopLocationFilledIcon.tsx +1 -1
  222. package/src/components/icons/CoopLogoIcon.tsx +1 -1
  223. package/src/components/icons/CoopMembershipCardFilledIcon.tsx +1 -1
  224. package/src/components/icons/CreditCardFilledIcon.tsx +1 -1
  225. package/src/components/icons/CreditCardIcon.tsx +1 -1
  226. package/src/components/icons/CrossIcon.tsx +1 -1
  227. package/src/components/icons/DocumentIcon.tsx +1 -1
  228. package/src/components/icons/DownloadIcon.tsx +1 -1
  229. package/src/components/icons/EnterStoreIcon.tsx +1 -1
  230. package/src/components/icons/ExitStoreIcon.tsx +1 -1
  231. package/src/components/icons/EyeFilledIcon.tsx +1 -1
  232. package/src/components/icons/EyeIcon.tsx +1 -1
  233. package/src/components/icons/EyeStrikeFilledIcon.tsx +1 -1
  234. package/src/components/icons/EyeStrikeIcon.tsx +1 -1
  235. package/src/components/icons/FeedbackFilledIcon.tsx +1 -1
  236. package/src/components/icons/FeedbackIcon.tsx +1 -1
  237. package/src/components/icons/FilterIcon.tsx +1 -1
  238. package/src/components/icons/GiftCardFilledIcon.tsx +1 -1
  239. package/src/components/icons/GiftCardIcon.tsx +1 -1
  240. package/src/components/icons/GiftFilledIcon.tsx +1 -1
  241. package/src/components/icons/GiftIcon.tsx +1 -1
  242. package/src/components/icons/HelpFilledIcon.tsx +1 -1
  243. package/src/components/icons/HelpIcon.tsx +1 -1
  244. package/src/components/icons/HomeFilledIcon.tsx +1 -1
  245. package/src/components/icons/HomeIcon.tsx +1 -1
  246. package/src/components/icons/HowDoIAssistantIcon.tsx +1 -1
  247. package/src/components/icons/InfoIcon.tsx +1 -1
  248. package/src/components/icons/KebabIcon.tsx +1 -1
  249. package/src/components/icons/LoadingIcon.tsx +1 -1
  250. package/src/components/icons/LocationFilledIcon.tsx +1 -1
  251. package/src/components/icons/LocationIcon.tsx +1 -1
  252. package/src/components/icons/LogoutIcon.tsx +1 -1
  253. package/src/components/icons/MailIcon.tsx +1 -1
  254. package/src/components/icons/MenuIcon.tsx +1 -1
  255. package/src/components/icons/MessageIcon.tsx +1 -1
  256. package/src/components/icons/MinusIcon.tsx +1 -1
  257. package/src/components/icons/NotesFilledIcon.tsx +1 -1
  258. package/src/components/icons/NotesIcon.tsx +1 -1
  259. package/src/components/icons/OpenNewIcon.tsx +1 -1
  260. package/src/components/icons/OwnBagIcon.tsx +1 -1
  261. package/src/components/icons/PadlockIcon.tsx +1 -1
  262. package/src/components/icons/PencilIcon.tsx +1 -1
  263. package/src/components/icons/PhoneIcon.tsx +1 -1
  264. package/src/components/icons/PowerIcon.tsx +1 -1
  265. package/src/components/icons/SaveFilledIcon.tsx +1 -1
  266. package/src/components/icons/SaveIcon.tsx +1 -1
  267. package/src/components/icons/ScooterIcon.tsx +1 -1
  268. package/src/components/icons/SearchFilledIcon.tsx +1 -1
  269. package/src/components/icons/SearchIcon.tsx +1 -1
  270. package/src/components/icons/SendIcon.tsx +1 -1
  271. package/src/components/icons/SpannerIcon.tsx +1 -1
  272. package/src/components/icons/StarFilledIcon.tsx +1 -1
  273. package/src/components/icons/StarIcon.tsx +1 -1
  274. package/src/components/icons/TickAltFilledIcon.tsx +1 -1
  275. package/src/components/icons/TickAltIcon.tsx +1 -1
  276. package/src/components/icons/TickIcon.tsx +1 -1
  277. package/src/components/icons/TruckIcon.tsx +1 -1
  278. package/src/components/icons/UserWipeIcon.tsx +1 -1
  279. package/src/components/icons/VoucherFilledIcon.tsx +1 -1
  280. package/src/components/icons/VoucherIcon.tsx +1 -1
  281. package/src/components/icons/WarningCircleFilledIcon.tsx +1 -1
  282. package/src/components/icons/WarningCircleIcon.tsx +1 -1
  283. package/src/components/icons/WarningFilledIcon.tsx +1 -1
  284. package/src/components/icons/WarningIcon.tsx +1 -1
  285. package/src/components/icons/WifiIcon.tsx +1 -1
  286. package/src/components/icons/WriteIcon.tsx +1 -1
  287. package/src/hooks/useSlots.ts +1 -1
  288. package/src/index.ts +1 -0
@@ -2,10 +2,13 @@ import clsx from "clsx";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/AlertBanner/AlertBanner.tsx
4
4
  const AlertBanner = ({ children, className, ref, variant = "default", ...props }) => {
5
- return /* @__PURE__ */ jsx("aside", {
5
+ const componentProps = {
6
6
  className: clsx("coop-alert-banner", className),
7
7
  "data-variant": variant,
8
- ...props,
8
+ ...props
9
+ };
10
+ return /* @__PURE__ */ jsx("aside", {
11
+ ...componentProps,
9
12
  ref,
10
13
  children
11
14
  });
@@ -10,10 +10,13 @@ const Author = ({ author = "Co-op team", className, date, datePrefix = "", image
10
10
  width: "56px",
11
11
  ...image
12
12
  };
13
- return /* @__PURE__ */ jsxs("div", {
13
+ const componentProps = {
14
14
  className: clsx("coop-author", className),
15
15
  "data-size": size?.length ? size : void 0,
16
- ...props,
16
+ ...props
17
+ };
18
+ return /* @__PURE__ */ jsxs("div", {
19
+ ...componentProps,
17
20
  ref,
18
21
  children: [image && /* @__PURE__ */ jsx(Image, { ...imageProps }), /* @__PURE__ */ jsxs("div", {
19
22
  className: "coop-author--content",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { hasUserBg } from "../../utils/index.js";
3
2
  import { LoadingSpinner } from "../LoadingSpinner/LoadingSpinner.js";
3
+ import { hasUserBg } from "../../utils/index.js";
4
4
  import clsx from "clsx";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import React, { useCallback, useState } from "react";
@@ -1,76 +1,99 @@
1
1
  import { ImageProps } from "../Image/Image.js";
2
2
  import "../Image/index.js";
3
- import React, { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
3
+ import { PictureProps } from "../Picture/Picture.js";
4
+ import "../Picture/index.js";
5
+ import { StandardSizes } from "../../types/index.js";
6
+ import React, { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
4
7
  //#region src/components/Card/Card.d.ts
5
8
  interface CardProps extends HTMLAttributes<HTMLDivElement> {
6
- /** **(Optional)** Specify how the card behaves across screen sizes.
9
+ /** **(Optional)** Specify how the Card behaves across screen sizes.
7
10
  *
8
- * When this is true, horizontal cards will switch to vertical on small screens, and vertical cards will switch to horizontal on small screens.
11
+ * For finer control, use utility classes or custom CSS to control flex-direction. */
12
+ adaptive?: "sm" | "md";
13
+ /** **(Optional)** Specify an element to use for the container.
9
14
  *
10
- * Default: false
15
+ * Default: `article`
11
16
  */
12
- adaptive?: boolean;
13
- /** **(Optional)** Specify whether chevron is visible. */
14
- chevron?: boolean;
15
- /** **(Optional)** Content inside the component. Children that are not assigned to a slot will be grouped together and rendered under the main Card content. */
17
+ as?: "article" | "section" | "figure" | "div";
18
+ /** **(Optional)** Content inside the component. */
16
19
  children?: React.ReactNode;
17
- /** **(Optional)** Specify additional CSS classes to be applied to the component. */
20
+ /** **(Optional)** Specify additional CSS classes. */
18
21
  className?: string;
19
- /** **(Optional)** Specify the URL that the Card will link to. */
20
- href?: string;
21
- /** **(Optional)** Specify a custom element to use instead of `a`. */
22
- hrefAs?: React.FC<any> | ForwardRefExoticComponent<any> | string;
23
- /** **(Optional)** Specify the orientation of the Card.
24
- *
25
- * Default: vertical
26
- */
22
+ /** **(Optional)** Specify the Card orientation. */
27
23
  orientation?: "vertical" | "horizontal";
24
+ /** **(Optional)** Specify the Card padding. */
25
+ padding?: StandardSizes;
26
+ /** **(Optional)** Specify the Card border radius. */
27
+ radius?: StandardSizes;
28
28
  /** **(Optional)** Specify a custom React ref for this component. */
29
29
  ref?: Ref<HTMLDivElement>;
30
30
  /** **(Optional)** Enable additional styles to use the Card as a signpost.
31
31
  *
32
- * Text is vertically aligned centrally and the chevron is enlarged. */
32
+ * Text is vertically aligned centrally and the Icon is enlarged. */
33
33
  signpost?: boolean;
34
34
  }
35
- interface CardLabelProps extends HTMLAttributes<HTMLSpanElement> {
36
- /** **(Optional)** Content inside the Label. */
35
+ interface CardHeadingProps extends HTMLAttributes<HTMLDivElement> {
36
+ /** **(Optional)** Specify an element to use for the heading.
37
+ *
38
+ * Default: `h3`
39
+ */
40
+ as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "strong" | "figcaption";
41
+ /** **(Optional)** Content inside the component. */
37
42
  children?: React.ReactNode;
38
- /** **(Optional)** Specify additional CSS classes to be applied to the Label. */
43
+ /** **(Optional)** Specify additional CSS classes. */
39
44
  className?: string;
40
45
  }
41
- interface CardHeadingProps extends HTMLAttributes<HTMLDivElement> {
42
- /** **(Optional)** Specify a custom element to use instead of `h3`. */
43
- as?: "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div";
44
- /** **(Optional)** Content inside the Heading. */
46
+ interface CardIconProps extends HTMLAttributes<HTMLDivElement> {
47
+ /** **(Optional)** Content inside the component. */
45
48
  children?: React.ReactNode;
46
- /** **(Optional)** Specify additional CSS classes to be applied to the Heading. */
49
+ /** **(Optional)** Specify additional CSS classes. */
47
50
  className?: string;
48
51
  }
49
- interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
50
- /** **(Optional)** Content inside the Body. */
52
+ interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
53
+ /** **(Optional)** Content inside the component. */
51
54
  children?: React.ReactNode;
55
+ /** **(Optional)** Specify additional CSS classes. */
56
+ className?: string;
57
+ }
58
+ interface CardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
59
+ /** **(Optional)** Specify an element to use instead of native `a`. */
60
+ as?: React.FC<any> | ForwardRefExoticComponent<any> | string;
61
+ /** **(Optional)** Content inside the component. */
62
+ children?: React.ReactNode;
63
+ /** **(Optional)** Specify additional CSS classes. */
64
+ className?: string;
52
65
  }
53
66
  interface CardBadgeProps extends HTMLAttributes<HTMLDivElement> {
54
- /** **(Optional)** Specify on which side the Badge should appear. */
67
+ /** **(Optional)** Specify alignment relative to container.
68
+ *
69
+ * Default: `right`
70
+ */
55
71
  align?: "left" | "right";
56
- /** **(Optional)** Content inside the Badge. */
72
+ /** **(Optional)** Content inside the component. */
57
73
  children?: React.ReactNode;
58
- /** **(Optional)** Specify additional CSS classes to be applied to the Badge. */
74
+ /** **(Optional)** Specify additional CSS classes. */
59
75
  className?: string;
60
- /** **(Optional)** Specify badge position relative to top right corner. */
76
+ /** **(Optional)** Specify position relative to top corner.
77
+ *
78
+ * Default: `popout`
79
+ */
61
80
  position?: "inset" | "popout";
62
81
  }
63
- type CardImageProps = ImageProps & {
64
- /** **(Optional)** Specify on which side the Image should appear. */
82
+ interface CardPictureProps extends PictureProps {
83
+ /** **(Optional)** Specify on which side the Picture should appear. */
65
84
  align?: "left" | "right";
66
- };
85
+ /** **(Optional)** Content inside the component. */
86
+ children?: React.ReactNode;
87
+ /** **(Optional)** Specify additional CSS classes. */
88
+ className?: string;
89
+ }
67
90
  declare const Card: {
68
- ({ adaptive, chevron, children, className, href, hrefAs, orientation, ref, signpost, ...props }: CardProps): JSX.Element;
91
+ ({ adaptive, as, children, className, orientation, padding, radius, ref, signpost, ...props }: CardProps): JSX.Element;
69
92
  slot: {
70
93
  name: string;
71
94
  };
72
- Label: {
73
- ({ children, className, ...props }: CardLabelProps): JSX.Element;
95
+ Link: {
96
+ ({ as, children, className, href, ...props }: CardLinkProps): JSX.Element;
74
97
  slot: {
75
98
  name: string;
76
99
  };
@@ -82,19 +105,31 @@ declare const Card: {
82
105
  };
83
106
  };
84
107
  Badge: {
85
- ({ align, children, position, ...props }: CardBadgeProps): JSX.Element;
108
+ ({ align, children, className, position, ...props }: CardBadgeProps): JSX.Element;
109
+ slot: {
110
+ name: string;
111
+ };
112
+ };
113
+ Content: {
114
+ ({ children, className, ...props }: CardContentProps): JSX.Element;
86
115
  slot: {
87
116
  name: string;
88
117
  };
89
118
  };
90
- Body: {
91
- ({ children }: CardBodyProps): JSX.Element;
119
+ Icon: {
120
+ ({ children, className, ...props }: CardIconProps): JSX.Element;
92
121
  slot: {
93
122
  name: string;
94
123
  };
95
124
  };
96
125
  Image: {
97
- ({ align, crop, ...props }: CardImageProps): JSX.Element;
126
+ (props: ImageProps): JSX.Element;
127
+ slot: {
128
+ name: string;
129
+ };
130
+ };
131
+ Picture: {
132
+ ({ align, children, className, crop, ...props }: CardPictureProps): JSX.Element;
98
133
  slot: {
99
134
  name: string;
100
135
  };
@@ -106,29 +141,41 @@ declare const CardHeading: {
106
141
  name: string;
107
142
  };
108
143
  };
109
- declare const CardLabel: {
110
- ({ children, className, ...props }: CardLabelProps): JSX.Element;
144
+ declare const CardIcon: {
145
+ ({ children, className, ...props }: CardIconProps): JSX.Element;
111
146
  slot: {
112
147
  name: string;
113
148
  };
114
149
  };
115
150
  declare const CardBadge: {
116
- ({ align, children, position, ...props }: CardBadgeProps): JSX.Element;
151
+ ({ align, children, className, position, ...props }: CardBadgeProps): JSX.Element;
117
152
  slot: {
118
153
  name: string;
119
154
  };
120
155
  };
121
- declare const CardBody: {
122
- ({ children }: CardBodyProps): JSX.Element;
156
+ declare const CardPicture: {
157
+ ({ align, children, className, crop, ...props }: CardPictureProps): JSX.Element;
123
158
  slot: {
124
159
  name: string;
125
160
  };
126
161
  };
127
162
  declare const CardImage: {
128
- ({ align, crop, ...props }: CardImageProps): JSX.Element;
163
+ (props: ImageProps): JSX.Element;
164
+ slot: {
165
+ name: string;
166
+ };
167
+ };
168
+ declare const CardContent: {
169
+ ({ children, className, ...props }: CardContentProps): JSX.Element;
170
+ slot: {
171
+ name: string;
172
+ };
173
+ };
174
+ declare const CardLink: {
175
+ ({ as, children, className, href, ...props }: CardLinkProps): JSX.Element;
129
176
  slot: {
130
177
  name: string;
131
178
  };
132
179
  };
133
180
  //#endregion
134
- export { Card, Card as default, CardBadge, CardBody, CardHeading, CardImage, CardLabel, CardProps };
181
+ export { Card, Card as default, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps };
@@ -1,63 +1,34 @@
1
1
  import { Image } from "../Image/Image.js";
2
2
  import { hasUserBg } from "../../utils/index.js";
3
- import { ChevronRightIcon } from "../icons/ChevronRightIcon.js";
3
+ import Picture_default from "../Picture/index.js";
4
4
  import { useSlots } from "../../hooks/useSlots.js";
5
5
  import clsx from "clsx";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import React from "react";
8
8
  //#region src/components/Card/Card.tsx
9
9
  const componentSlots = {
10
10
  CardBadge: null,
11
- CardBody: null,
12
- CardHeading: null,
13
- CardImage: null,
14
- CardLabel: null,
15
11
  Children: null
16
12
  };
17
- function getCardLinkElement(as, href) {
18
- return {
19
- element: as ?? "a",
20
- props: {
21
- className: "coop-card--link",
22
- href
23
- }
24
- };
25
- }
26
- const Card = ({ adaptive, chevron = false, children, className, href, hrefAs, orientation, ref, signpost, ...props }) => {
27
- const { element: linkElement, props: linkProps } = getCardLinkElement(hrefAs, href);
13
+ const Card = ({ adaptive, as = "article", children, className, orientation, padding, radius, ref, signpost, ...props }) => {
28
14
  const slots = { ...useSlots(componentSlots, children) };
29
- const hasLinkWrapper = href && !slots.CardHeading;
30
15
  const componentProps = {
31
16
  className: clsx("coop-card", !hasUserBg(className) && "bg-white", className),
32
17
  "data-adaptive": adaptive ?? void 0,
33
18
  "data-orientation": orientation ?? void 0,
19
+ "data-padding": padding ?? void 0,
20
+ "data-radius": radius ?? void 0,
34
21
  "data-signpost": signpost ?? void 0,
35
22
  ...props
36
23
  };
37
- if (href && slots.CardHeading) slots.CardHeading = React.createElement(linkElement, linkProps, slots.CardHeading);
38
- return /* @__PURE__ */ jsxs("article", {
24
+ const cardContent = React.createElement(as, {
39
25
  ref,
40
- ...componentProps,
41
- children: [
42
- slots.CardImage,
43
- slots.CardBadge,
44
- React.createElement(hasLinkWrapper ? linkElement : "div", hasLinkWrapper ? {
45
- className: "coop-card--content",
46
- href
47
- } : { className: "coop-card--content" }, /* @__PURE__ */ jsxs(Fragment, { children: [
48
- slots.CardLabel,
49
- slots.CardHeading,
50
- slots.CardBody,
51
- slots.Children
52
- ] })),
53
- (chevron || signpost) && /* @__PURE__ */ jsx("span", {
54
- "aria-hidden": "true",
55
- className: "coop-card--icon",
56
- role: "presentation",
57
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
58
- })
59
- ]
60
- });
26
+ ...componentProps
27
+ }, slots.Children);
28
+ return slots.CardBadge ? /* @__PURE__ */ jsxs("div", {
29
+ className: "coop-card-wrapper",
30
+ children: [cardContent, slots.CardBadge]
31
+ }) : cardContent;
61
32
  };
62
33
  const CardHeading = ({ as = "h3", children, className, ...props }) => {
63
34
  return React.createElement(as, {
@@ -65,42 +36,72 @@ const CardHeading = ({ as = "h3", children, className, ...props }) => {
65
36
  ...props
66
37
  }, children);
67
38
  };
68
- const CardLabel = ({ children, className, ...props }) => {
39
+ const CardIcon = ({ children, className, ...props }) => {
40
+ const componentProps = {
41
+ className: clsx("coop-card--icon", className),
42
+ ...props
43
+ };
69
44
  return /* @__PURE__ */ jsx("span", {
70
- className: clsx("coop-card--label", className),
71
- ...props,
45
+ ...componentProps,
72
46
  children
73
47
  });
74
48
  };
75
- const CardBadge = ({ align = "right", children, position = "popout", ...props }) => {
76
- return /* @__PURE__ */ jsx("div", {
77
- className: "coop-card--badge",
49
+ const CardBadge = ({ align = "right", children, className, position = "popout", ...props }) => {
50
+ const componentProps = {
51
+ className: clsx("coop-card--badge", className),
78
52
  "data-align": align,
79
53
  "data-position": position,
80
- ...props,
54
+ ...props
55
+ };
56
+ return /* @__PURE__ */ jsx("div", {
57
+ ...componentProps,
81
58
  children
82
59
  });
83
60
  };
84
- const CardBody = ({ children }) => {
85
- return /* @__PURE__ */ jsx(Fragment, { children });
61
+ const CardPicture = ({ align, children, className, crop, ...props }) => {
62
+ const componentProps = {
63
+ className: clsx("coop-card--picture", className),
64
+ "data-align": align ?? void 0,
65
+ "data-crop": crop ?? "wide",
66
+ ...props
67
+ };
68
+ return /* @__PURE__ */ jsx(Picture_default, {
69
+ ...componentProps,
70
+ children
71
+ });
86
72
  };
87
- const CardImage = ({ align, crop, ...props }) => {
88
- return /* @__PURE__ */ jsx(Image, {
89
- ...props,
90
- crop: crop ?? "wide",
91
- "data-align": align ?? void 0
73
+ const CardImage = (props) => /* @__PURE__ */ jsx(Image, { ...props });
74
+ const CardContent = ({ children, className, ...props }) => {
75
+ const componentProps = {
76
+ className: clsx("coop-card--content", className),
77
+ ...props
78
+ };
79
+ return /* @__PURE__ */ jsx("div", {
80
+ ...componentProps,
81
+ children
92
82
  });
93
83
  };
84
+ const CardLink = ({ as = "a", children, className, href, ...props }) => {
85
+ return React.createElement(as, {
86
+ className: clsx("coop-card--link", className),
87
+ href,
88
+ ...props
89
+ }, children);
90
+ };
94
91
  Card.slot = { name: "Card" };
95
- CardLabel.slot = { name: "CardLabel" };
96
92
  CardHeading.slot = { name: "CardHeading" };
97
93
  CardBadge.slot = { name: "CardBadge" };
98
- CardBody.slot = { name: "CardBody" };
94
+ CardIcon.slot = { name: "CardIcon" };
95
+ CardContent.slot = { name: "CardContent" };
99
96
  CardImage.slot = { name: "CardImage" };
100
- Card.Label = CardLabel;
97
+ CardLink.slot = { name: "CardLink" };
98
+ CardPicture.slot = { name: "CardPicture" };
99
+ Card.Link = CardLink;
101
100
  Card.Heading = CardHeading;
102
101
  Card.Badge = CardBadge;
103
- Card.Body = CardBody;
102
+ Card.Content = CardContent;
103
+ Card.Icon = CardIcon;
104
104
  Card.Image = CardImage;
105
+ Card.Picture = CardPicture;
105
106
  //#endregion
106
- export { Card, Card as default, CardBadge, CardBody, CardHeading, CardImage, CardLabel };
107
+ export { Card, Card as default, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture };
@@ -1,2 +1,2 @@
1
- import { Card, CardBadge, CardBody, CardHeading, CardImage, CardLabel, CardProps } from "./Card.js";
2
- export { Card, Card as default, CardBadge, CardBody, CardHeading, CardImage, CardLabel, CardProps };
1
+ import { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps } from "./Card.js";
2
+ export { Card, Card as default, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps };
@@ -1,5 +1,5 @@
1
- import { Card, CardBadge, CardBody, CardHeading, CardImage, CardLabel } from "./Card.js";
1
+ import { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture } from "./Card.js";
2
2
  //#region src/components/Card/index.ts
3
3
  var Card_default = Card;
4
4
  //#endregion
5
- export { Card, CardBadge, CardBody, CardHeading, CardImage, CardLabel, Card_default as default };
5
+ export { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Card_default as default };
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/Checkbox/Checkbox.tsx
6
6
  const Checkbox = ({ className, disabled, error = false, id, name, ref, size, ...props }) => {
7
7
  const field = useField();
8
- return /* @__PURE__ */ jsx("input", {
8
+ const componentProps = {
9
9
  className: clsx("coop-checkbox", className),
10
10
  "data-error": error || void 0,
11
11
  "data-size": size ?? void 0,
@@ -13,7 +13,10 @@ const Checkbox = ({ className, disabled, error = false, id, name, ref, size, ...
13
13
  id: id ?? field?.id,
14
14
  name,
15
15
  type: "checkbox",
16
- ...props,
16
+ ...props
17
+ };
18
+ return /* @__PURE__ */ jsx("input", {
19
+ ...componentProps,
17
20
  ref
18
21
  });
19
22
  };
@@ -28,15 +28,16 @@ const initialState = {
28
28
  };
29
29
  const defaultFormatters = { formatWeekdayName: (d) => d.toLocaleDateString("default", { weekday: "short" }).slice(0, 2) };
30
30
  const Calendar = ({ captionLayout = "label", className, disabled, endMonth, formatters, showOutsideDays = true, startMonth, ...props }) => {
31
+ const combinedFormatters = useMemo(() => ({
32
+ ...defaultFormatters,
33
+ ...formatters
34
+ }), [formatters]);
31
35
  return /* @__PURE__ */ jsx(DayPicker, {
32
36
  captionLayout,
33
37
  className,
34
38
  disabled,
35
39
  endMonth,
36
- formatters: useMemo(() => ({
37
- ...defaultFormatters,
38
- ...formatters
39
- }), [formatters]),
40
+ formatters: combinedFormatters,
40
41
  navLayout: "around",
41
42
  showOutsideDays,
42
43
  startMonth,
@@ -136,17 +136,18 @@ function getRangeDate(date, df, now) {
136
136
  };
137
137
  const formatted = {};
138
138
  let input = "";
139
- if (typeof date === "string") if (date.includes("-")) {
140
- const { from, to } = getRangeFromString(date);
141
- if (from && to) {
142
- parsed.from = parse(from, df, now);
143
- parsed.to = parse(to, df, now);
144
- formatted.from = from;
145
- formatted.to = to;
146
- }
147
- input = `${from} - ${to}`;
148
- } else input = date;
149
- else if (date?.from && date?.to && isValid(date.from) && isValid(date.to)) {
139
+ if (typeof date === "string") {
140
+ if (date.includes("-")) {
141
+ const { from, to } = getRangeFromString(date);
142
+ if (from && to) {
143
+ parsed.from = parse(from, df, now);
144
+ parsed.to = parse(to, df, now);
145
+ formatted.from = from;
146
+ formatted.to = to;
147
+ }
148
+ input = `${from} - ${to}`;
149
+ } else input = date;
150
+ } else if (date?.from && date?.to && isValid(date.from) && isValid(date.to)) {
150
151
  parsed.from = date.from;
151
152
  parsed.to = date.to;
152
153
  formatted.from = format(parsed.from, df);
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { hasUserBg } from "../../utils/index.js";
3
2
  import { CrossIcon } from "../icons/CrossIcon.js";
3
+ import { hasUserBg } from "../../utils/index.js";
4
4
  import clsx from "clsx";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createContext, useContext, useEffect, useRef } from "react";
@@ -98,9 +98,12 @@ const DialogHeader = ({ children, className, closeButton = true, ...props }) =>
98
98
  });
99
99
  };
100
100
  const DialogBody = ({ children, className, ...props }) => {
101
- return /* @__PURE__ */ jsx("div", {
101
+ const componentProps = {
102
102
  className: clsx("coop-dialog--body", className),
103
- ...props,
103
+ ...props
104
+ };
105
+ return /* @__PURE__ */ jsx("div", {
106
+ ...componentProps,
104
107
  children
105
108
  });
106
109
  };
@@ -1,5 +1,5 @@
1
- import { hasUserBg } from "../../utils/index.js";
2
1
  import { ChevronDownIcon } from "../icons/ChevronDownIcon.js";
2
+ import { hasUserBg } from "../../utils/index.js";
3
3
  import { useSlots } from "../../hooks/useSlots.js";
4
4
  import clsx from "clsx";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -10,9 +10,12 @@ const componentSlots = {
10
10
  };
11
11
  const Expandable = ({ children, className, ref, ...props }) => {
12
12
  const slots = useSlots(componentSlots, children);
13
- return /* @__PURE__ */ jsxs("details", {
13
+ const componentProps = {
14
14
  className: clsx("coop-expandable", !hasUserBg(className) && "bg-tint-grey", className),
15
- ...props,
15
+ ...props
16
+ };
17
+ return /* @__PURE__ */ jsxs("details", {
18
+ ...componentProps,
16
19
  ref,
17
20
  children: [slots.ExpandableSummary, slots.ExpandableContent]
18
21
  });
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { getSlotProp } from "../../utils/index.js";
3
2
  import { useId as useId$1 } from "../../hooks/useId.js";
3
+ import { getSlotProp } from "../../utils/index.js";
4
4
  import { FieldContext } from "./Field.context.js";
5
5
  import { Error } from "../FieldMarkers/Error.js";
6
6
  import { Hint } from "../FieldMarkers/Hint.js";
@@ -2,9 +2,12 @@ import clsx from "clsx";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/FieldMarkers/Error.tsx
4
4
  const Error = ({ children, className, ref, ...props }) => {
5
- return /* @__PURE__ */ jsx("span", {
5
+ const componentProps = {
6
6
  className: clsx("coop-field-error ", className),
7
- ...props,
7
+ ...props
8
+ };
9
+ return /* @__PURE__ */ jsx("span", {
10
+ ...componentProps,
8
11
  ref,
9
12
  children
10
13
  });
@@ -2,9 +2,12 @@ import clsx from "clsx";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/FieldMarkers/Hint.tsx
4
4
  const Hint = ({ children, className, ref, ...props }) => {
5
- return /* @__PURE__ */ jsx("div", {
5
+ const componentProps = {
6
6
  className: clsx("coop-field-hint ", className),
7
- ...props,
7
+ ...props
8
+ };
9
+ return /* @__PURE__ */ jsx("div", {
10
+ ...componentProps,
8
11
  ref,
9
12
  children
10
13
  });
@@ -4,10 +4,13 @@ import { jsx } from "react/jsx-runtime";
4
4
  //#region src/components/FieldMarkers/Label.tsx
5
5
  const Label = ({ children, className, isVisible = true, ref, ...props }) => {
6
6
  const field = useField();
7
- return /* @__PURE__ */ jsx("label", {
7
+ const componentProps = {
8
8
  className: clsx("coop-field-label", !isVisible && "sr-only", className),
9
9
  htmlFor: props.htmlFor ?? (field?.id ? field.id + (field?.suffix ?? "") : void 0),
10
- ...props,
10
+ ...props
11
+ };
12
+ return /* @__PURE__ */ jsx("label", {
13
+ ...componentProps,
11
14
  ref,
12
15
  children: /* @__PURE__ */ jsx("span", { children })
13
16
  });