@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.
- package/README.md +2 -2
- package/dist/components/Expandable/Expandable.d.ts +1 -1
- package/dist/components/Expandable/Expandable.js +1 -1
- package/dist/components/Icon/AddIcon.d.ts +6 -1
- package/dist/components/Icon/ArrowDownIcon.d.ts +6 -1
- package/dist/components/Icon/ArrowLeftIcon.d.ts +6 -1
- package/dist/components/Icon/ArrowRightIcon.d.ts +6 -1
- package/dist/components/Icon/ArrowUpIcon.d.ts +6 -1
- package/dist/components/Icon/AvatarAltIcon.d.ts +6 -1
- package/dist/components/Icon/AvatarIcon.d.ts +6 -1
- package/dist/components/Icon/BasketIcon.d.ts +6 -1
- package/dist/components/Icon/CalendarIcon.d.ts +6 -1
- package/dist/components/Icon/ChevronDownIcon.d.ts +6 -1
- package/dist/components/Icon/ChevronLeftIcon.d.ts +6 -1
- package/dist/components/Icon/ChevronRightIcon.d.ts +6 -1
- package/dist/components/Icon/ChevronUpIcon.d.ts +6 -1
- package/dist/components/Icon/ClockIcon.d.ts +6 -1
- package/dist/components/Icon/CloseAltIcon.d.ts +6 -1
- package/dist/components/Icon/CloseIcon.d.ts +6 -1
- package/dist/components/Icon/CoopCardIcon.d.ts +6 -1
- package/dist/components/Icon/CoopIcon.d.ts +6 -1
- package/dist/components/Icon/CoopLocationIcon.d.ts +6 -1
- package/dist/components/Icon/DownloadIcon.d.ts +6 -1
- package/dist/components/Icon/HomeIcon.d.ts +6 -1
- package/dist/components/Icon/InformationIcon.d.ts +6 -1
- package/dist/components/Icon/LocationIcon.d.ts +6 -1
- package/dist/components/Icon/MailIcon.d.ts +6 -1
- package/dist/components/Icon/MenuIcon.d.ts +6 -1
- package/dist/components/Icon/MessageIcon.d.ts +6 -1
- package/dist/components/Icon/MinusIcon.d.ts +6 -1
- package/dist/components/Icon/OpenNewIcon.d.ts +6 -1
- package/dist/components/Icon/PencilIcon.d.ts +6 -1
- package/dist/components/Icon/PhoneIcon.d.ts +6 -1
- package/dist/components/Icon/QuestionIcon.d.ts +6 -1
- package/dist/components/Icon/ScooterIcon.d.ts +6 -1
- package/dist/components/Icon/SearchIcon.d.ts +6 -1
- package/dist/components/Icon/SearchIcon.js +12 -0
- package/dist/components/Icon/SettingsIcon.d.ts +6 -1
- package/dist/components/Icon/TickAltIcon.d.ts +6 -1
- package/dist/components/Icon/TickIcon.d.ts +6 -1
- package/dist/components/Icon/VanIcon.d.ts +6 -1
- package/dist/components/Icon/WarningIcon.d.ts +6 -1
- package/dist/components/Icon/WriteIcon.d.ts +6 -1
- package/dist/components/SearchBox/SearchBox.d.ts +48 -0
- package/dist/components/SearchBox/SearchBox.js +67 -0
- package/dist/components/SearchBox/index.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +10 -9
- package/src/components/Expandable/Expandable.tsx +13 -2
- package/src/components/Icon/AddIcon.tsx +19 -2
- package/src/components/Icon/ArrowDownIcon.tsx +19 -2
- package/src/components/Icon/ArrowLeftIcon.tsx +19 -2
- package/src/components/Icon/ArrowRightIcon.tsx +19 -2
- package/src/components/Icon/ArrowUpIcon.tsx +19 -2
- package/src/components/Icon/AvatarAltIcon.tsx +19 -2
- package/src/components/Icon/AvatarIcon.tsx +19 -2
- package/src/components/Icon/BasketIcon.tsx +19 -2
- package/src/components/Icon/CalendarIcon.tsx +19 -2
- package/src/components/Icon/ChevronDownIcon.tsx +19 -2
- package/src/components/Icon/ChevronLeftIcon.tsx +19 -2
- package/src/components/Icon/ChevronRightIcon.tsx +19 -2
- package/src/components/Icon/ChevronUpIcon.tsx +19 -2
- package/src/components/Icon/ClockIcon.tsx +19 -2
- package/src/components/Icon/CloseAltIcon.tsx +19 -2
- package/src/components/Icon/CloseIcon.tsx +19 -2
- package/src/components/Icon/CoopCardIcon.tsx +20 -2
- package/src/components/Icon/CoopIcon.tsx +20 -2
- package/src/components/Icon/CoopLocationIcon.tsx +19 -2
- package/src/components/Icon/DownloadIcon.tsx +19 -2
- package/src/components/Icon/HomeIcon.tsx +19 -2
- package/src/components/Icon/InformationIcon.tsx +19 -2
- package/src/components/Icon/LocationIcon.tsx +19 -2
- package/src/components/Icon/MailIcon.tsx +19 -2
- package/src/components/Icon/MenuIcon.tsx +19 -2
- package/src/components/Icon/MessageIcon.tsx +19 -2
- package/src/components/Icon/MinusIcon.tsx +19 -2
- package/src/components/Icon/OpenNewIcon.tsx +19 -2
- package/src/components/Icon/PencilIcon.tsx +19 -2
- package/src/components/Icon/PhoneIcon.tsx +19 -2
- package/src/components/Icon/QuestionIcon.tsx +19 -2
- package/src/components/Icon/ScooterIcon.tsx +19 -2
- package/src/components/Icon/SearchIcon.tsx +19 -2
- package/src/components/Icon/SettingsIcon.tsx +19 -2
- package/src/components/Icon/TickAltIcon.tsx +19 -2
- package/src/components/Icon/TickIcon.tsx +19 -2
- package/src/components/Icon/VanIcon.tsx +19 -2
- package/src/components/Icon/WarningIcon.tsx +19 -2
- package/src/components/Icon/WriteIcon.tsx +19 -2
- package/src/components/SearchBox/SearchBox.tsx +131 -0
- package/src/components/SearchBox/index.ts +5 -0
- 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/
|
|
37
|
-
import "@coopdigital/styles/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
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.
|
|
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.
|
|
48
|
-
"@playwright/test": "^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.
|
|
61
|
-
"@types/react": "^19.
|
|
62
|
-
"@types/react-dom": "^19.
|
|
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.
|
|
67
|
-
"react-dom": "^19.
|
|
67
|
+
"react": "^19.1.0",
|
|
68
|
+
"react-dom": "^19.1.0"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "3bad30dd8fdb2c160a2f71e0c95c1da38d12b0ab"
|
|
70
71
|
}
|