@coopdigital/react 0.17.0 → 0.18.1

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 (92) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Expandable/Expandable.d.ts +1 -1
  3. package/dist/components/Expandable/Expandable.js +1 -1
  4. package/dist/components/Icon/AddIcon.d.ts +6 -1
  5. package/dist/components/Icon/ArrowDownIcon.d.ts +6 -1
  6. package/dist/components/Icon/ArrowLeftIcon.d.ts +6 -1
  7. package/dist/components/Icon/ArrowRightIcon.d.ts +6 -1
  8. package/dist/components/Icon/ArrowUpIcon.d.ts +6 -1
  9. package/dist/components/Icon/AvatarAltIcon.d.ts +6 -1
  10. package/dist/components/Icon/AvatarIcon.d.ts +6 -1
  11. package/dist/components/Icon/BasketIcon.d.ts +6 -1
  12. package/dist/components/Icon/CalendarIcon.d.ts +6 -1
  13. package/dist/components/Icon/ChevronDownIcon.d.ts +6 -1
  14. package/dist/components/Icon/ChevronLeftIcon.d.ts +6 -1
  15. package/dist/components/Icon/ChevronRightIcon.d.ts +6 -1
  16. package/dist/components/Icon/ChevronUpIcon.d.ts +6 -1
  17. package/dist/components/Icon/ClockIcon.d.ts +6 -1
  18. package/dist/components/Icon/CloseAltIcon.d.ts +6 -1
  19. package/dist/components/Icon/CloseIcon.d.ts +6 -1
  20. package/dist/components/Icon/CoopCardIcon.d.ts +6 -1
  21. package/dist/components/Icon/CoopIcon.d.ts +6 -1
  22. package/dist/components/Icon/CoopLocationIcon.d.ts +6 -1
  23. package/dist/components/Icon/DownloadIcon.d.ts +6 -1
  24. package/dist/components/Icon/HomeIcon.d.ts +6 -1
  25. package/dist/components/Icon/InformationIcon.d.ts +6 -1
  26. package/dist/components/Icon/LocationIcon.d.ts +6 -1
  27. package/dist/components/Icon/MailIcon.d.ts +6 -1
  28. package/dist/components/Icon/MenuIcon.d.ts +6 -1
  29. package/dist/components/Icon/MessageIcon.d.ts +6 -1
  30. package/dist/components/Icon/MinusIcon.d.ts +6 -1
  31. package/dist/components/Icon/OpenNewIcon.d.ts +6 -1
  32. package/dist/components/Icon/PencilIcon.d.ts +6 -1
  33. package/dist/components/Icon/PhoneIcon.d.ts +6 -1
  34. package/dist/components/Icon/QuestionIcon.d.ts +6 -1
  35. package/dist/components/Icon/ScooterIcon.d.ts +6 -1
  36. package/dist/components/Icon/SearchIcon.d.ts +6 -1
  37. package/dist/components/Icon/SearchIcon.js +12 -0
  38. package/dist/components/Icon/SettingsIcon.d.ts +6 -1
  39. package/dist/components/Icon/TickAltIcon.d.ts +6 -1
  40. package/dist/components/Icon/TickIcon.d.ts +6 -1
  41. package/dist/components/Icon/VanIcon.d.ts +6 -1
  42. package/dist/components/Icon/WarningIcon.d.ts +6 -1
  43. package/dist/components/Icon/WriteIcon.d.ts +6 -1
  44. package/dist/components/SearchBox/SearchBox.d.ts +48 -0
  45. package/dist/components/SearchBox/SearchBox.js +67 -0
  46. package/dist/components/SearchBox/index.d.ts +4 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.js +1 -0
  49. package/package.json +10 -9
  50. package/src/components/Expandable/Expandable.tsx +13 -2
  51. package/src/components/Icon/AddIcon.tsx +19 -2
  52. package/src/components/Icon/ArrowDownIcon.tsx +19 -2
  53. package/src/components/Icon/ArrowLeftIcon.tsx +19 -2
  54. package/src/components/Icon/ArrowRightIcon.tsx +19 -2
  55. package/src/components/Icon/ArrowUpIcon.tsx +19 -2
  56. package/src/components/Icon/AvatarAltIcon.tsx +19 -2
  57. package/src/components/Icon/AvatarIcon.tsx +19 -2
  58. package/src/components/Icon/BasketIcon.tsx +19 -2
  59. package/src/components/Icon/CalendarIcon.tsx +19 -2
  60. package/src/components/Icon/ChevronDownIcon.tsx +19 -2
  61. package/src/components/Icon/ChevronLeftIcon.tsx +19 -2
  62. package/src/components/Icon/ChevronRightIcon.tsx +19 -2
  63. package/src/components/Icon/ChevronUpIcon.tsx +19 -2
  64. package/src/components/Icon/ClockIcon.tsx +19 -2
  65. package/src/components/Icon/CloseAltIcon.tsx +19 -2
  66. package/src/components/Icon/CloseIcon.tsx +19 -2
  67. package/src/components/Icon/CoopCardIcon.tsx +20 -2
  68. package/src/components/Icon/CoopIcon.tsx +20 -2
  69. package/src/components/Icon/CoopLocationIcon.tsx +19 -2
  70. package/src/components/Icon/DownloadIcon.tsx +19 -2
  71. package/src/components/Icon/HomeIcon.tsx +19 -2
  72. package/src/components/Icon/InformationIcon.tsx +19 -2
  73. package/src/components/Icon/LocationIcon.tsx +19 -2
  74. package/src/components/Icon/MailIcon.tsx +19 -2
  75. package/src/components/Icon/MenuIcon.tsx +19 -2
  76. package/src/components/Icon/MessageIcon.tsx +19 -2
  77. package/src/components/Icon/MinusIcon.tsx +19 -2
  78. package/src/components/Icon/OpenNewIcon.tsx +19 -2
  79. package/src/components/Icon/PencilIcon.tsx +19 -2
  80. package/src/components/Icon/PhoneIcon.tsx +19 -2
  81. package/src/components/Icon/QuestionIcon.tsx +19 -2
  82. package/src/components/Icon/ScooterIcon.tsx +19 -2
  83. package/src/components/Icon/SearchIcon.tsx +19 -2
  84. package/src/components/Icon/SettingsIcon.tsx +19 -2
  85. package/src/components/Icon/TickAltIcon.tsx +19 -2
  86. package/src/components/Icon/TickIcon.tsx +19 -2
  87. package/src/components/Icon/VanIcon.tsx +19 -2
  88. package/src/components/Icon/WarningIcon.tsx +19 -2
  89. package/src/components/Icon/WriteIcon.tsx +19 -2
  90. package/src/components/SearchBox/SearchBox.tsx +131 -0
  91. package/src/components/SearchBox/index.ts +5 -0
  92. package/src/index.ts +1 -0
package/README.md CHANGED
@@ -33,8 +33,8 @@ npm install @coopdigital/react @coopdigital/styles
33
33
  Import the components that you need, along with the main stylesheet and the corresponding component styles:
34
34
  ```
35
35
  import { Pill } from "@coopdigital/react"
36
- import "@coopdigital/styles/dist/main.css"
37
- import "@coopdigital/styles/dist/components/Pill.css"
36
+ import "@coopdigital/styles/main.css"
37
+ import "@coopdigital/styles/components/Pill.css"
38
38
  ```
39
39
 
40
40
  Alternatively if your project uses SASS you can import the source stylesheets:
@@ -1,7 +1,7 @@
1
1
  import type { DetailsHTMLAttributes, JSX } from "react";
2
2
  export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
3
3
  /** **(Optional)** Specifies the Expandable background color from the available options. */
4
- background?: "grey" | "purple" | "pink" | "green" | "orange" | "red" | "yellow" | "lilac" | "blue";
4
+ background?: "grey" | "purple" | "pink" | "green" | "orange" | "red" | "yellow" | "lilac" | "blue" | "white" | "transparent";
5
5
  /** Represents the content inside the Expandable component, only visible when expanded. It can be any valid JSX or string. */
6
6
  children: React.ReactNode;
7
7
  /** **(Optional)** Receives any className to be applied to Expandable component. */
@@ -6,7 +6,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
6
6
  * It can be used to reveal more context for a specific issue or action.
7
7
  */
8
8
  const Expandable = (_a) => {
9
- var { background, children, className = "", summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
9
+ var { background = "grey", children, className = "", summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
10
10
  const componentProps = Object.assign({ className: `coop-expandable ${className}`, "data-bg": background }, props);
11
11
  return (jsxs("details", Object.assign({}, componentProps, { children: [jsxs("summary", { children: [summary, jsx("svg", { fill: "none", height: "24", width: "24", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "m20.25 9.75-6.22 6.22a.75.75 0 0 1-1.06 0L6.75 9.75", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) })] }), jsx("div", { className: "coop-expandable--content", children: children })] })));
12
12
  };
@@ -1 +1,6 @@
1
- export declare const AddIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const AddIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ArrowDownIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ArrowDownIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ArrowLeftIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ArrowLeftIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ArrowRightIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ArrowRightIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ArrowUpIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ArrowUpIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const AvatarAltIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const AvatarAltIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const AvatarIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const AvatarIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const BasketIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const BasketIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CalendarIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CalendarIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ChevronDownIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ChevronDownIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ChevronLeftIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ChevronLeftIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ChevronRightIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ChevronRightIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ChevronUpIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ChevronUpIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ClockIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ClockIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CloseAltIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CloseAltIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CloseIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CloseIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CoopCardIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CoopCardIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CoopIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CoopIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const CoopLocationIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const CoopLocationIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const DownloadIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const DownloadIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const HomeIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const HomeIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const InformationIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const InformationIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const LocationIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const LocationIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const MailIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const MailIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const MenuIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const MenuIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const MessageIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const MessageIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const MinusIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const MinusIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const OpenNewIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const OpenNewIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const PencilIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const PencilIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const PhoneIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const PhoneIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const QuestionIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const QuestionIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const ScooterIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const ScooterIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const SearchIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const SearchIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useId } from 'react';
4
+
5
+ const SearchIcon = (_a) => {
6
+ var { alt, className } = _a, props = __rest(_a, ["alt", "className"]);
7
+ const id = useId();
8
+ const componentProps = Object.assign({ "aria-labelledby": alt ? id : undefined, className: `coop-icon ${className !== null && className !== void 0 ? className : ""}`.trim(), "data-icon": "search", fill: "none", role: alt ? "img" : undefined, viewBox: "0 0 32 32" }, props);
9
+ return (jsxs("svg", Object.assign({}, componentProps, { children: [alt ? jsx("title", { id: id, children: alt }) : null, jsx("path", { d: "M13.25 25.49a12.25 12.25 0 1 1 12.24-12.24 12.25 12.25 0 0 1-12.24 12.24m0-22.61a10.37 10.37 0 1 0 10.36 10.37A10.38 10.38 0 0 0 13.25 2.88", fill: "currentColor" }), jsx("path", { d: "M30.06 31a.94.94 0 0 1-.67-.28l-8.81-8.81a.94.94 0 1 1 1.33-1.33l8.81 8.81a.94.94 0 0 1 0 1.33.9.9 0 0 1-.66.28", fill: "currentColor" })] })));
10
+ };
11
+
12
+ export { SearchIcon };
@@ -1 +1,6 @@
1
- export declare const SettingsIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const SettingsIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const TickAltIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const TickAltIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const TickIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const TickIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const VanIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const VanIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const WarningIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const WarningIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,6 @@
1
- export declare const WriteIcon: () => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from "react";
2
+ interface IconProps extends SVGProps<SVGSVGElement> {
3
+ alt?: string;
4
+ }
5
+ export declare const WriteIcon: ({ alt, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,48 @@
1
+ import React, { HTMLAttributes } from "react";
2
+ import { type JSX } from "react";
3
+ import { type ButtonProps } from "../Button";
4
+ export interface SearchBoxProps extends HTMLAttributes<HTMLInputElement> {
5
+ /** **(Optional)** Server endpoint to submit the form. Will be ignored if onSubmit is also set. */
6
+ action?: string;
7
+ /** **(Optional)** Whether or not to enable auto complete on the input field. Default: `off`. */
8
+ autoComplete?: "off" | "on";
9
+ /** **(Optional)** Props to forward to the Button element. Use `label` to set Button text. */
10
+ button?: Pick<ButtonProps, "className" | "loadingText"> & {
11
+ label?: React.ReactNode;
12
+ };
13
+ /** **(Optional)** Receives any className to be applied to SearchBox component. */
14
+ className?: string;
15
+ /** Receives the label to be applied to SearchBox component. */
16
+ label: string;
17
+ /** **(Optional)** Receives whether label is visible to human or only screen readers. */
18
+ labelVisible?: boolean;
19
+ /** **(Optional)** Name of the input element, also used as the URL search parameter. Defaults to `query` */
20
+ name?: string;
21
+ /** **(Optional)** Callback to run when the form is submitted. If this is an async function, it will be awaited and the SearchBox will be in a pending state until the promise is resolved. */
22
+ onSubmit?: React.FormEventHandler<HTMLElement> | undefined;
23
+ /** **(Optional)** Receives any placeholder for SearchBox component. */
24
+ placeholder?: string;
25
+ /** **(Optional)** Receives any size to be applied to SearchBox component. */
26
+ size?: string;
27
+ /** **(Optional)** Receives the variant to be applied to SearchBox component. */
28
+ variant?: "primary" | "secondary" | "ghost";
29
+ }
30
+ /**
31
+ * SearchBox component allows a person to enter a word or a phrase to find relevant content.
32
+ *
33
+ * The `label` prop is mandatory but not visible by default (it is visible for screen readers). You can make it visible to humans by setting `labelVisible` to true.
34
+ *
35
+ * If you are using a single icon with no text for `button.label`, ensure you pass an `alt` property to the icon for accessibility purposes.
36
+ *
37
+ * You can provide an `action` to submit input like a normal HTML form, or an `onSubmit` callback to handle submissions client-side.
38
+ *
39
+ * **Good to know:** SearchBox requires both `SearchBox` and `Button` css/scss files.
40
+ *
41
+ * ```
42
+ * import "@coopdigital/styles/components/Searchbox.css"
43
+ * import "@coopdigital/styles/components/Button.css"
44
+ *
45
+ * ```
46
+ */
47
+ export declare const SearchBox: ({ action, "aria-placeholder": ariaPlaceholder, autoCapitalize, autoComplete, button, className, label, labelVisible, name, onSubmit, placeholder, size, variant, ...props }: SearchBoxProps) => JSX.Element;
48
+ export default SearchBox;
@@ -0,0 +1,67 @@
1
+ import { __rest, __awaiter } from '../../node_modules/tslib/tslib.es6.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import React, { useState, useCallback, useId } from 'react';
4
+ import { Button } from '../Button/Button.js';
5
+ import { SearchIcon } from '../Icon/SearchIcon.js';
6
+
7
+ const defaultButtonProps = {
8
+ label: React.createElement(SearchIcon, { alt: "Search", stroke: "currentColor", strokeWidth: 2 }),
9
+ loadingText: "",
10
+ };
11
+ /**
12
+ * SearchBox component allows a person to enter a word or a phrase to find relevant content.
13
+ *
14
+ * The `label` prop is mandatory but not visible by default (it is visible for screen readers). You can make it visible to humans by setting `labelVisible` to true.
15
+ *
16
+ * If you are using a single icon with no text for `button.label`, ensure you pass an `alt` property to the icon for accessibility purposes.
17
+ *
18
+ * You can provide an `action` to submit input like a normal HTML form, or an `onSubmit` callback to handle submissions client-side.
19
+ *
20
+ * **Good to know:** SearchBox requires both `SearchBox` and `Button` css/scss files.
21
+ *
22
+ * ```
23
+ * import "@coopdigital/styles/components/Searchbox.css"
24
+ * import "@coopdigital/styles/components/Button.css"
25
+ *
26
+ * ```
27
+ */
28
+ const SearchBox = (_a) => {
29
+ var _b, _c;
30
+ var { action, "aria-placeholder": ariaPlaceholder, autoCapitalize = "off", autoComplete = "off", button = defaultButtonProps, className, label, labelVisible = false, name = "query", onSubmit, placeholder, size = "md", variant = "primary" } = _a, props = __rest(_a, ["action", "aria-placeholder", "autoCapitalize", "autoComplete", "button", "className", "label", "labelVisible", "name", "onSubmit", "placeholder", "size", "variant"]);
31
+ const [isPending, setIsPending] = useState(false);
32
+ const handleSubmit = useCallback((event) => __awaiter(void 0, void 0, void 0, function* () {
33
+ event.preventDefault();
34
+ if (isPending || !onSubmit)
35
+ return;
36
+ setIsPending(true);
37
+ try {
38
+ yield Promise.resolve(onSubmit(event));
39
+ }
40
+ finally {
41
+ setIsPending(false);
42
+ }
43
+ }), [onSubmit, isPending]);
44
+ const id = useId();
45
+ const formProps = {
46
+ action: action !== null && action !== void 0 ? action : undefined,
47
+ className: `coop-search-box ${className !== null && className !== void 0 ? className : ""}`.trim(),
48
+ "data-size": size.length && size !== "md" ? size : undefined,
49
+ "data-variant": variant.length && variant !== "primary" ? variant : undefined,
50
+ onSubmit: onSubmit ? handleSubmit : undefined,
51
+ };
52
+ const buttonProps = {
53
+ className: button === null || button === void 0 ? void 0 : button.className,
54
+ isLoading: isPending,
55
+ loadingText: (_b = button === null || button === void 0 ? void 0 : button.loadingText) !== null && _b !== void 0 ? _b : "",
56
+ size: size,
57
+ variant: variant,
58
+ };
59
+ const inputProps = Object.assign({ "aria-placeholder": (_c = placeholder !== null && placeholder !== void 0 ? placeholder : ariaPlaceholder) !== null && _c !== void 0 ? _c : undefined, autoCapitalize,
60
+ autoComplete,
61
+ id,
62
+ name,
63
+ placeholder, type: "search" }, props);
64
+ return (jsxs("form", Object.assign({}, formProps, { children: [jsx("label", { className: labelVisible ? "" : "sr-only", htmlFor: id, children: label }), jsxs("div", { className: "coop-search-box--inner", children: [jsx("input", Object.assign({}, inputProps)), jsx(Button, Object.assign({}, buttonProps, { children: button.label }))] })] })));
65
+ };
66
+
67
+ export { SearchBox, SearchBox as default };
@@ -0,0 +1,4 @@
1
+ import SearchBox from "./SearchBox";
2
+ export default SearchBox;
3
+ export { SearchBox };
4
+ export * from "./SearchBox";
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./components/Expandable";
6
6
  export * from "./components/Image";
7
7
  export * from "./components/Pill";
8
8
  export * from "./components/RootSVG";
9
+ export * from "./components/SearchBox";
9
10
  export * from "./components/Signpost";
10
11
  export * from "./components/SkipNav";
11
12
  export * from "./components/Tag";
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { Expandable } from './components/Expandable/Expandable.js';
6
6
  export { Image } from './components/Image/Image.js';
7
7
  export { Pill } from './components/Pill/Pill.js';
8
8
  export { RootSVG } from './components/RootSVG/RootSVG.js';
9
+ export { SearchBox } from './components/SearchBox/SearchBox.js';
9
10
  export { Signpost } from './components/Signpost/Signpost.js';
10
11
  export { SkipNav } from './components/SkipNav/SkipNav.js';
11
12
  export { Tag } from './components/Tag/Tag.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.17.0",
4
+ "version": "0.18.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -34,6 +34,7 @@
34
34
  "test:e2e:ui": "npx playwright test --ui",
35
35
  "test:e2e:ci": "npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL",
36
36
  "build": "tsx scripts build",
37
+ "build:icons": "tsx scripts build-icons",
37
38
  "build:storybook": "storybook build --disable-telemetry && npm run storybook:fix-paths",
38
39
  "storybook": "storybook dev -p 6006",
39
40
  "storybook:playwright": "storybook dev -p 9000",
@@ -44,8 +45,8 @@
44
45
  "description": "",
45
46
  "devDependencies": {
46
47
  "@axe-core/playwright": "^4.10.1",
47
- "@coopdigital/styles": "^0.15.1",
48
- "@playwright/test": "^1.51.1",
48
+ "@coopdigital/styles": "^0.15.3",
49
+ "@playwright/test": "^1.52.0",
49
50
  "@storybook/addon-a11y": "^8.6.12",
50
51
  "@storybook/addon-essentials": "^8.6.12",
51
52
  "@storybook/addon-interactions": "^8.6.12",
@@ -57,14 +58,14 @@
57
58
  "@storybook/test": "^8.6.12",
58
59
  "@storybook/theming": "^8.6.12",
59
60
  "@testing-library/jest-dom": "^6.6.3",
60
- "@testing-library/react": "^16.2.0",
61
- "@types/react": "^19.0.12",
62
- "@types/react-dom": "^19.0.4",
61
+ "@testing-library/react": "^16.3.0",
62
+ "@types/react": "^19.1.2",
63
+ "@types/react-dom": "^19.1.2",
63
64
  "storybook": "^8.6.12"
64
65
  },
65
66
  "peerDependencies": {
66
- "react": "^19.0.0",
67
- "react-dom": "^19.0.0"
67
+ "react": "^19.1.0",
68
+ "react-dom": "^19.1.0"
68
69
  },
69
- "gitHead": "4a24650f72c010d21c1fccac53e6de59ec7c3e6e"
70
+ "gitHead": "3bad30dd8fdb2c160a2f71e0c95c1da38d12b0ab"
70
71
  }