@coopdigital/react 0.39.0 → 0.40.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 (72) hide show
  1. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  2. package/dist/components/Author/Author.js +1 -1
  3. package/dist/components/Button/Button.js +1 -1
  4. package/dist/components/Card/Card.js +1 -1
  5. package/dist/components/Checkbox/Checkbox.d.ts +8 -1
  6. package/dist/components/Checkbox/Checkbox.js +5 -3
  7. package/dist/components/Checkbox/CheckboxGroup.d.ts +3 -1
  8. package/dist/components/Checkbox/CheckboxGroup.js +3 -2
  9. package/dist/components/Expandable/Expandable.js +1 -1
  10. package/dist/components/Field/Field.js +1 -1
  11. package/dist/components/FieldError/FieldError.js +1 -1
  12. package/dist/components/FieldHint/FieldHint.js +1 -1
  13. package/dist/components/FieldLabel/FieldLabel.js +1 -1
  14. package/dist/components/Flourish/Flourish.d.ts +2 -2
  15. package/dist/components/Flourish/Flourish.js +1 -1
  16. package/dist/components/Icon/AddIcon.js +1 -1
  17. package/dist/components/Icon/ArrowDownIcon.js +1 -1
  18. package/dist/components/Icon/ArrowLeftIcon.js +1 -1
  19. package/dist/components/Icon/ArrowRightIcon.js +1 -1
  20. package/dist/components/Icon/ArrowUpIcon.js +1 -1
  21. package/dist/components/Icon/AvatarAltIcon.js +1 -1
  22. package/dist/components/Icon/AvatarIcon.js +1 -1
  23. package/dist/components/Icon/BasketIcon.js +1 -1
  24. package/dist/components/Icon/CalendarIcon.js +1 -1
  25. package/dist/components/Icon/ChevronDownIcon.js +1 -1
  26. package/dist/components/Icon/ChevronLeftIcon.js +1 -1
  27. package/dist/components/Icon/ChevronRightIcon.js +1 -1
  28. package/dist/components/Icon/ChevronUpIcon.js +1 -1
  29. package/dist/components/Icon/ClockIcon.js +1 -1
  30. package/dist/components/Icon/CloseAltIcon.js +1 -1
  31. package/dist/components/Icon/CloseIcon.js +1 -1
  32. package/dist/components/Icon/CoopCardIcon.js +1 -1
  33. package/dist/components/Icon/CoopIcon.js +1 -1
  34. package/dist/components/Icon/CoopLocationIcon.js +1 -1
  35. package/dist/components/Icon/DownloadIcon.js +1 -1
  36. package/dist/components/Icon/HomeIcon.js +1 -1
  37. package/dist/components/Icon/InformationIcon.js +1 -1
  38. package/dist/components/Icon/LoadingIcon.js +1 -1
  39. package/dist/components/Icon/LocationIcon.js +1 -1
  40. package/dist/components/Icon/MailIcon.js +1 -1
  41. package/dist/components/Icon/MenuIcon.js +1 -1
  42. package/dist/components/Icon/MessageIcon.js +1 -1
  43. package/dist/components/Icon/MinusIcon.js +1 -1
  44. package/dist/components/Icon/OpenNewIcon.js +1 -1
  45. package/dist/components/Icon/PencilIcon.js +1 -1
  46. package/dist/components/Icon/PhoneIcon.js +1 -1
  47. package/dist/components/Icon/QuestionIcon.js +1 -1
  48. package/dist/components/Icon/ScooterIcon.js +1 -1
  49. package/dist/components/Icon/SearchIcon.js +1 -1
  50. package/dist/components/Icon/SettingsIcon.js +1 -1
  51. package/dist/components/Icon/TickAltIcon.js +1 -1
  52. package/dist/components/Icon/TickIcon.js +1 -1
  53. package/dist/components/Icon/VanIcon.js +1 -1
  54. package/dist/components/Icon/WarningIcon.js +1 -1
  55. package/dist/components/Icon/WriteIcon.js +1 -1
  56. package/dist/components/Pill/Pill.js +1 -1
  57. package/dist/components/RadioButton/RadioButton.d.ts +1 -3
  58. package/dist/components/RadioButton/RadioButton.js +3 -4
  59. package/dist/components/RadioButton/RadioButtonGroup.js +1 -1
  60. package/dist/components/SearchBox/SearchBox.js +1 -1
  61. package/dist/components/Signpost/Signpost.js +1 -1
  62. package/dist/components/SkipNav/SkipNav.js +1 -1
  63. package/dist/components/Squircle/Squircle.js +1 -1
  64. package/dist/components/Tag/Tag.js +1 -1
  65. package/dist/components/TextInput/TextInput.js +1 -1
  66. package/dist/components/Textarea/Textarea.js +1 -1
  67. package/package.json +4 -5
  68. package/src/components/Checkbox/Checkbox.tsx +24 -6
  69. package/src/components/Checkbox/CheckboxGroup.tsx +4 -0
  70. package/src/components/Flourish/Flourish.tsx +2 -2
  71. package/src/components/RadioButton/RadioButton.tsx +13 -15
  72. package/dist/node_modules/clsx/dist/clsx.js +0 -3
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const AlertBanner = ({ children, className, heading, variant = "default", ...props }) => {
5
5
  const componentProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { Image } from '../Image/Image.js';
4
4
 
5
5
  const Author = ({ author = "Co-op team", className, date, datePrefix = "", image = {
@@ -1,7 +1,7 @@
1
1
 
2
2
  "use client";
3
3
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
4
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
4
+ import clsx from 'clsx';
5
5
  import React, { useState, useCallback } from 'react';
6
6
  import { LoadingIcon } from '../Icon/LoadingIcon.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import React from 'react';
4
4
  import { bgPropToClass } from '../../utils/index.js';
5
5
  import { ChevronRightIcon } from '../Icon/ChevronRightIcon.js';
@@ -1,5 +1,6 @@
1
1
  import type { InputHTMLAttributes, JSX } from "react";
2
2
  import { FormFieldError, StandardSizes } from "../../../src/types";
3
+ import { TagProps } from "../Tag";
3
4
  export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
4
5
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
5
6
  className?: string;
@@ -27,6 +28,12 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement
27
28
  name: string;
28
29
  /** **(Optional)** Specify the Checkbox size. */
29
30
  size?: StandardSizes;
31
+ /** **(Optional)** Specify the Checkbox tag text. */
32
+ tag?: string;
33
+ /** **(Optional)** Specify the Checkbox tag background color. */
34
+ tagBackground?: TagProps["background"];
35
+ /** **(Optional)** Specify the Checkbox variant. */
36
+ variant?: "default" | "boxed";
30
37
  }
31
- export declare const Checkbox: ({ className, disabled, error, hint, id, label, labelVisible, name, size, ...props }: CheckboxProps) => JSX.Element;
38
+ export declare const Checkbox: ({ className, disabled, error, hint, id, label, labelVisible, name, size, tag, tagBackground, variant, ...props }: CheckboxProps) => JSX.Element;
32
39
  export default Checkbox;
@@ -1,17 +1,19 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
  import { FieldError } from '../FieldError/FieldError.js';
5
5
  import { FieldHint } from '../FieldHint/FieldHint.js';
6
6
  import { FieldLabel } from '../FieldLabel/FieldLabel.js';
7
+ import { Tag } from '../Tag/Tag.js';
7
8
 
8
- const Checkbox = ({ className, disabled, error = false, hint, id, label, labelVisible = true, name, size = "md", ...props }) => {
9
+ const Checkbox = ({ className, disabled, error = false, hint, id, label, labelVisible = true, name, size = "md", tag, tagBackground, variant = "default", ...props }) => {
9
10
  const internalId = useId();
10
11
  id = id !== null && id !== void 0 ? id : internalId;
11
12
  const componentProps = {
12
13
  className: clsx("coop-checkbox", className),
13
14
  "data-error": error ? "" : undefined,
14
15
  "data-size": size.length && size !== "md" ? size : undefined,
16
+ "data-variant": variant !== "default" ? variant : undefined,
15
17
  disabled,
16
18
  id,
17
19
  name,
@@ -19,7 +21,7 @@ const Checkbox = ({ className, disabled, error = false, hint, id, label, labelVi
19
21
  ...props,
20
22
  };
21
23
  const formItemProps = { "aria-disabled": disabled ? true : undefined };
22
- return (jsxs("div", { className: "coop-form-item", ...formItemProps, children: [jsxs("div", { className: "coop-checkbox-wrapper", children: [jsx("input", { ...componentProps }), label && (jsx(FieldLabel, { htmlFor: id, isVisible: labelVisible, children: label })), hint && jsx(FieldHint, { children: hint })] }), typeof error === "object" && (error === null || error === void 0 ? void 0 : error.message) && jsx(FieldError, { children: error.message })] }));
24
+ return (jsxs("div", { className: "coop-form-item", ...formItemProps, children: [jsxs("div", { className: "coop-checkbox-wrapper", children: [jsxs("div", { className: "coop-checkbox-input-wrapper", children: [jsx("input", { ...componentProps }), label && (jsxs(FieldLabel, { htmlFor: id, isVisible: labelVisible, children: [jsx("span", { children: label }), " ", tag && (jsx(Tag, { background: tagBackground, size: "sm", children: tag }))] }))] }), hint && jsx(FieldHint, { children: hint })] }), typeof error === "object" && (error === null || error === void 0 ? void 0 : error.message) && jsx(FieldError, { children: error.message })] }));
23
25
  };
24
26
 
25
27
  export { Checkbox, Checkbox as default };
@@ -25,6 +25,8 @@ export interface CheckboxGroupProps extends FieldsetHTMLAttributes<HTMLFieldSetE
25
25
  orientation?: "horizontal" | "vertical";
26
26
  /** **(Optional)** Specify the CheckboxGroup size. */
27
27
  size?: StandardSizes;
28
+ /** **(Optional)** Specify the CheckboxGroup variant. */
29
+ variant?: "default" | "boxed";
28
30
  }
29
- export declare const CheckboxGroup: ({ children, className, error, hint, label, labelVisible, orientation, size, ...props }: CheckboxGroupProps) => JSX.Element;
31
+ export declare const CheckboxGroup: ({ children, className, error, hint, label, labelVisible, orientation, size, variant, ...props }: CheckboxGroupProps) => JSX.Element;
30
32
  export default CheckboxGroup;
@@ -1,14 +1,15 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { FieldError } from '../FieldError/FieldError.js';
4
4
  import { FieldHint } from '../FieldHint/FieldHint.js';
5
5
 
6
- const CheckboxGroup = ({ children, className, error = false, hint, label, labelVisible = true, orientation = "vertical", size = "md", ...props }) => {
6
+ const CheckboxGroup = ({ children, className, error = false, hint, label, labelVisible = true, orientation = "vertical", size = "md", variant = "default", ...props }) => {
7
7
  const componentProps = {
8
8
  className: clsx("coop-fieldset", "coop-checkbox-group", className),
9
9
  "data-error": error ? "" : undefined,
10
10
  "data-orientation": orientation !== "vertical" ? orientation : undefined,
11
11
  "data-size": size.length && size !== "md" ? size : undefined,
12
+ "data-variant": variant !== "default" ? variant : undefined,
12
13
  ...props,
13
14
  };
14
15
  const legendProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import { clsx } from 'clsx';
3
3
  import { bgPropToClass } from '../../utils/index.js';
4
4
  import 'react';
5
5
  import { ChevronDownIcon } from '../Icon/ChevronDownIcon.js';
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const Field = ({ children, className, ...props }) => {
5
5
  const componentProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const FieldError = ({ children, className, ...props }) => {
5
5
  const componentProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const FieldHint = ({ children, className, ...props }) => {
5
5
  const componentProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const FieldLabel = ({ children, className, htmlFor, isVisible = true, ...props }) => {
5
5
  const componentProps = {
@@ -1,12 +1,12 @@
1
1
  import type { JSX, ReactNode, SVGProps } from "react";
2
- import { Darks, Lights } from "../../types/colors";
2
+ import { BrandBlue, Darks, Lights, OfferRed } from "../../types/colors";
3
3
  export interface FlourishProps extends SVGProps<SVGSVGElement> {
4
4
  /** Specify the text to be highlighted by the Flourish. */
5
5
  children: string | ReactNode;
6
6
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
7
7
  className?: string;
8
8
  /** **(Optional)** Specify the Flourish color. */
9
- fill?: Darks | Lights;
9
+ fill?: Darks | Lights | OfferRed | BrandBlue;
10
10
  }
11
11
  export declare const Flourish: ({ children, className, fill, ...props }: FlourishProps) => JSX.Element;
12
12
  export default Flourish;
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const Flourish = ({ children, className, fill = "light-yellow", ...props }) => {
5
5
  const componentProps = {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const AddIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ArrowDownIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ArrowLeftIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ArrowRightIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ArrowUpIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const AvatarAltIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const AvatarIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const BasketIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CalendarIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ChevronDownIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ChevronLeftIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ChevronRightIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ChevronUpIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ClockIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CloseAltIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CloseIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CoopCardIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CoopIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const CoopLocationIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const DownloadIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const HomeIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const InformationIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const LoadingIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const LocationIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const MailIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const MenuIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const MessageIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const MinusIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const OpenNewIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const PencilIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const PhoneIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const QuestionIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const ScooterIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const SearchIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const SettingsIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const TickAltIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const TickIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const VanIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const WarningIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
 
5
5
  const WriteIcon = ({ alt, className, fill, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import React from 'react';
4
4
  import { bgPropToClass } from '../../utils/index.js';
5
5
 
@@ -32,8 +32,6 @@ export interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElem
32
32
  tag?: string;
33
33
  /** **(Optional)** Specify the RadioButton tag background color. */
34
34
  tagBackground?: TagProps["background"];
35
- /** **(Optional)** Specify the RadioButton variant. */
36
- variant?: "default" | "boxed";
37
35
  }
38
- export declare const RadioButton: ({ className, disabled, error, hint, id, label, labelVisible, name, size, tag, tagBackground, variant, ...props }: RadioButtonProps) => JSX.Element;
36
+ export declare const RadioButton: ({ className, disabled, error, hint, id, label, labelVisible, name, size, tag, tagBackground, ...props }: RadioButtonProps) => JSX.Element;
39
37
  export default RadioButton;
@@ -1,19 +1,18 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
  import { FieldError } from '../FieldError/FieldError.js';
5
5
  import { FieldHint } from '../FieldHint/FieldHint.js';
6
6
  import { FieldLabel } from '../FieldLabel/FieldLabel.js';
7
7
  import { Tag } from '../Tag/Tag.js';
8
8
 
9
- const RadioButton = ({ className, disabled, error = false, hint, id, label, labelVisible = true, name, size = "md", tag, tagBackground, variant = "default", ...props }) => {
9
+ const RadioButton = ({ className, disabled, error = false, hint, id, label, labelVisible = true, name, size = "md", tag, tagBackground, ...props }) => {
10
10
  const internalId = useId();
11
11
  id = id !== null && id !== void 0 ? id : internalId;
12
12
  const componentProps = {
13
13
  className: clsx("coop-radio-button", className),
14
14
  "data-error": error ? "" : undefined,
15
15
  "data-size": size.length && size !== "md" ? size : undefined,
16
- "data-variant": variant !== "default" ? variant : undefined,
17
16
  disabled,
18
17
  id,
19
18
  name,
@@ -21,7 +20,7 @@ const RadioButton = ({ className, disabled, error = false, hint, id, label, labe
21
20
  ...props,
22
21
  };
23
22
  const formItemProps = { "aria-disabled": disabled ? true : undefined };
24
- return (jsxs("div", { className: "coop-form-item", ...formItemProps, children: [jsxs("div", { className: "coop-radio-button-wrapper", children: [jsx("input", { ...componentProps }), label && (jsxs(FieldLabel, { htmlFor: id, isVisible: labelVisible, children: [jsx("span", { children: label }), " ", tag && (jsx(Tag, { background: tagBackground, size: "sm", children: tag }))] })), hint && jsx(FieldHint, { children: hint })] }), typeof error === "object" && (error === null || error === void 0 ? void 0 : error.message) && jsx(FieldError, { children: error.message })] }));
23
+ return (jsxs("div", { className: "coop-form-item", ...formItemProps, children: [jsxs("div", { className: "coop-radio-button-wrapper", children: [jsxs("div", { className: "coop-radio-button-input-wrapper", children: [jsx("input", { ...componentProps }), label && (jsxs(FieldLabel, { htmlFor: id, isVisible: labelVisible, children: [jsx("span", { children: label }), " ", tag && (jsx(Tag, { background: tagBackground, size: "sm", children: tag }))] }))] }), hint && jsx(FieldHint, { children: hint })] }), typeof error === "object" && (error === null || error === void 0 ? void 0 : error.message) && jsx(FieldError, { children: error.message })] }));
25
24
  };
26
25
 
27
26
  export { RadioButton, RadioButton as default };
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { FieldError } from '../FieldError/FieldError.js';
4
4
  import { FieldHint } from '../FieldHint/FieldHint.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
4
+ import clsx from 'clsx';
5
5
  import React, { useState, useId, useCallback } from 'react';
6
6
  import { Button } from '../Button/Button.js';
7
7
  import { FieldLabel } from '../FieldLabel/FieldLabel.js';
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import React from 'react';
4
4
  import { ChevronRightIcon } from '../Icon/ChevronRightIcon.js';
5
5
  import { Image } from '../Image/Image.js';
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
 
4
4
  const defaultLinks = [{ href: "#main", label: "Skip to main content" }];
5
5
  const SkipNav = ({ className, isVisible = false, links = defaultLinks, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { bgPropToClass } from '../../utils/index.js';
4
4
 
5
5
  const Squircle = ({ background = "offer-red", children, className, size = "lg", ...props }) => {
@@ -1,4 +1,4 @@
1
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
1
+ import clsx from 'clsx';
2
2
  import React from 'react';
3
3
  import { bgPropToClass } from '../../utils/index.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId } from 'react';
4
4
  import { FieldError } from '../FieldError/FieldError.js';
5
5
  import { FieldHint } from '../FieldHint/FieldHint.js';
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
2
+ import clsx from 'clsx';
3
3
  import { useId, useState } from 'react';
4
4
  import { useDebounce } from '../../hooks/useDebounce.js';
5
5
  import { FieldError } from '../FieldError/FieldError.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.39.0",
4
+ "version": "0.40.0",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -65,14 +65,12 @@
65
65
  "@testing-library/react": "^16.3.0",
66
66
  "@types/react": "^19.2.2",
67
67
  "@types/react-dom": "^19.2.1",
68
- "clsx": "^2.1.1",
69
68
  "react": "^19.2.0",
70
69
  "react-dom": "^19.2.0",
71
70
  "serve": "^14.2.5",
72
71
  "storybook": "^9.1.10"
73
72
  },
74
73
  "peerDependencies": {
75
- "clsx": "^2.1.1",
76
74
  "react": "^19.1.0",
77
75
  "react-dom": "^19.1.0"
78
76
  },
@@ -80,7 +78,8 @@
80
78
  "storybook": "$storybook"
81
79
  },
82
80
  "dependencies": {
83
- "@coopdigital/styles": "^0.34.0"
81
+ "@coopdigital/styles": "^0.35.0",
82
+ "clsx": "^2.1.1"
84
83
  },
85
- "gitHead": "4cfcb7cf937b00fcc45f830b41c01bf705cdd1fd"
84
+ "gitHead": "86e50cd4304b4cc5e0f308a825727ff5659c7da9"
86
85
  }
@@ -7,6 +7,7 @@ import { FormFieldError, StandardSizes } from "../../../src/types"
7
7
  import { FieldError } from "../FieldError"
8
8
  import { FieldHint } from "../FieldHint"
9
9
  import { FieldLabel } from "../FieldLabel"
10
+ import Tag, { TagProps } from "../Tag"
10
11
 
11
12
  export interface CheckboxProps
12
13
  extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
@@ -36,6 +37,12 @@ export interface CheckboxProps
36
37
  name: string
37
38
  /** **(Optional)** Specify the Checkbox size. */
38
39
  size?: StandardSizes
40
+ /** **(Optional)** Specify the Checkbox tag text. */
41
+ tag?: string
42
+ /** **(Optional)** Specify the Checkbox tag background color. */
43
+ tagBackground?: TagProps["background"]
44
+ /** **(Optional)** Specify the Checkbox variant. */
45
+ variant?: "default" | "boxed"
39
46
  }
40
47
 
41
48
  export const Checkbox = ({
@@ -48,6 +55,9 @@ export const Checkbox = ({
48
55
  labelVisible = true,
49
56
  name,
50
57
  size = "md",
58
+ tag,
59
+ tagBackground,
60
+ variant = "default",
51
61
  ...props
52
62
  }: CheckboxProps): JSX.Element => {
53
63
  const internalId = useId()
@@ -58,6 +68,7 @@ export const Checkbox = ({
58
68
  className: clsx("coop-checkbox", className),
59
69
  "data-error": error ? "" : undefined,
60
70
  "data-size": size.length && size !== "md" ? size : undefined,
71
+ "data-variant": variant !== "default" ? variant : undefined,
61
72
  disabled,
62
73
  id,
63
74
  name,
@@ -68,13 +79,20 @@ export const Checkbox = ({
68
79
  return (
69
80
  <div className="coop-form-item" {...formItemProps}>
70
81
  <div className="coop-checkbox-wrapper">
71
- <input {...componentProps} />
82
+ <div className="coop-checkbox-input-wrapper">
83
+ <input {...componentProps} />
72
84
 
73
- {label && (
74
- <FieldLabel htmlFor={id} isVisible={labelVisible}>
75
- {label}
76
- </FieldLabel>
77
- )}
85
+ {label && (
86
+ <FieldLabel htmlFor={id} isVisible={labelVisible}>
87
+ <span>{label}</span>{" "}
88
+ {tag && (
89
+ <Tag background={tagBackground} size="sm">
90
+ {tag}
91
+ </Tag>
92
+ )}
93
+ </FieldLabel>
94
+ )}
95
+ </div>
78
96
  {hint && <FieldHint>{hint}</FieldHint>}
79
97
  </div>
80
98
  {typeof error === "object" && error?.message && <FieldError>{error.message}</FieldError>}
@@ -31,6 +31,8 @@ export interface CheckboxGroupProps extends FieldsetHTMLAttributes<HTMLFieldSetE
31
31
  orientation?: "horizontal" | "vertical"
32
32
  /** **(Optional)** Specify the CheckboxGroup size. */
33
33
  size?: StandardSizes
34
+ /** **(Optional)** Specify the CheckboxGroup variant. */
35
+ variant?: "default" | "boxed"
34
36
  }
35
37
 
36
38
  export const CheckboxGroup = ({
@@ -42,6 +44,7 @@ export const CheckboxGroup = ({
42
44
  labelVisible = true,
43
45
  orientation = "vertical",
44
46
  size = "md",
47
+ variant = "default",
45
48
  ...props
46
49
  }: CheckboxGroupProps): JSX.Element => {
47
50
  const componentProps = {
@@ -49,6 +52,7 @@ export const CheckboxGroup = ({
49
52
  "data-error": error ? "" : undefined,
50
53
  "data-orientation": orientation !== "vertical" ? orientation : undefined,
51
54
  "data-size": size.length && size !== "md" ? size : undefined,
55
+ "data-variant": variant !== "default" ? variant : undefined,
52
56
  ...props,
53
57
  }
54
58
 
@@ -2,7 +2,7 @@ import type { JSX, ReactNode, SVGProps } from "react"
2
2
 
3
3
  import clsx from "clsx"
4
4
 
5
- import { Darks, Lights } from "../../types/colors"
5
+ import { BrandBlue, Darks, Lights, OfferRed } from "../../types/colors"
6
6
 
7
7
  export interface FlourishProps extends SVGProps<SVGSVGElement> {
8
8
  /** Specify the text to be highlighted by the Flourish. */
@@ -10,7 +10,7 @@ export interface FlourishProps extends SVGProps<SVGSVGElement> {
10
10
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
11
11
  className?: string
12
12
  /** **(Optional)** Specify the Flourish color. */
13
- fill?: Darks | Lights
13
+ fill?: Darks | Lights | OfferRed | BrandBlue
14
14
  }
15
15
 
16
16
  export const Flourish = ({
@@ -39,8 +39,6 @@ export interface RadioButtonProps
39
39
  tag?: string
40
40
  /** **(Optional)** Specify the RadioButton tag background color. */
41
41
  tagBackground?: TagProps["background"]
42
- /** **(Optional)** Specify the RadioButton variant. */
43
- variant?: "default" | "boxed"
44
42
  }
45
43
 
46
44
  export const RadioButton = ({
@@ -55,7 +53,6 @@ export const RadioButton = ({
55
53
  size = "md",
56
54
  tag,
57
55
  tagBackground,
58
- variant = "default",
59
56
  ...props
60
57
  }: RadioButtonProps): JSX.Element => {
61
58
  const internalId = useId()
@@ -66,7 +63,6 @@ export const RadioButton = ({
66
63
  className: clsx("coop-radio-button", className),
67
64
  "data-error": error ? "" : undefined,
68
65
  "data-size": size.length && size !== "md" ? size : undefined,
69
- "data-variant": variant !== "default" ? variant : undefined,
70
66
  disabled,
71
67
  id,
72
68
  name,
@@ -77,18 +73,20 @@ export const RadioButton = ({
77
73
  return (
78
74
  <div className="coop-form-item" {...formItemProps}>
79
75
  <div className="coop-radio-button-wrapper">
80
- <input {...componentProps} />
76
+ <div className="coop-radio-button-input-wrapper">
77
+ <input {...componentProps} />
81
78
 
82
- {label && (
83
- <FieldLabel htmlFor={id} isVisible={labelVisible}>
84
- <span>{label}</span>{" "}
85
- {tag && (
86
- <Tag background={tagBackground} size="sm">
87
- {tag}
88
- </Tag>
89
- )}
90
- </FieldLabel>
91
- )}
79
+ {label && (
80
+ <FieldLabel htmlFor={id} isVisible={labelVisible}>
81
+ <span>{label}</span>{" "}
82
+ {tag && (
83
+ <Tag background={tagBackground} size="sm">
84
+ {tag}
85
+ </Tag>
86
+ )}
87
+ </FieldLabel>
88
+ )}
89
+ </div>
92
90
  {hint && <FieldHint>{hint}</FieldHint>}
93
91
  </div>
94
92
  {typeof error === "object" && error?.message && <FieldError>{error.message}</FieldError>}
@@ -1,3 +0,0 @@
1
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
2
-
3
- export { clsx, clsx as default };