@coopdigital/react 1.7.2 → 1.8.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.
- package/dist/components/Dialog/Dialog.d.ts +3 -3
- package/dist/components/Dialog/Dialog.js +2 -2
- package/dist/components/Logo/Logo.d.ts +17 -0
- package/dist/components/Logo/index.d.ts +4 -0
- package/package.json +3 -3
- package/src/components/Dialog/Dialog.tsx +3 -3
- package/src/components/Logo/Logo.tsx +49 -0
- package/src/components/Logo/index.ts +5 -0
|
@@ -52,7 +52,7 @@ interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
52
52
|
*
|
|
53
53
|
* Default: `true`
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
closeButton?: boolean;
|
|
56
56
|
}
|
|
57
57
|
interface DialogBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
58
58
|
/** **(Optional)** Content inside the Dialog Body. */
|
|
@@ -66,7 +66,7 @@ declare const Dialog: {
|
|
|
66
66
|
name: string;
|
|
67
67
|
};
|
|
68
68
|
Header: {
|
|
69
|
-
({ children, className,
|
|
69
|
+
({ children, className, closeButton, ...props }: DialogHeaderProps): JSX.Element;
|
|
70
70
|
slot: {
|
|
71
71
|
name: string;
|
|
72
72
|
};
|
|
@@ -79,7 +79,7 @@ declare const Dialog: {
|
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
declare const DialogHeader: {
|
|
82
|
-
({ children, className,
|
|
82
|
+
({ children, className, closeButton, ...props }: DialogHeaderProps): JSX.Element;
|
|
83
83
|
slot: {
|
|
84
84
|
name: string;
|
|
85
85
|
};
|
|
@@ -85,13 +85,13 @@ const Dialog = ({ children, className, closedBy = "any", label, mode = "dialog",
|
|
|
85
85
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle(e);
|
|
86
86
|
}, ref: mergeRefs(dialogRef, ref), children: children }) }));
|
|
87
87
|
};
|
|
88
|
-
const DialogHeader = ({ children, className,
|
|
88
|
+
const DialogHeader = ({ children, className, closeButton = true, ...props }) => {
|
|
89
89
|
const componentProps = {
|
|
90
90
|
className: clsx("coop-dialog--header", !hasUserBg(className) && "bg-tint-grey", className),
|
|
91
91
|
...props,
|
|
92
92
|
};
|
|
93
93
|
const dialog = useDialog();
|
|
94
|
-
return (jsxs("div", { ...componentProps, children: [children,
|
|
94
|
+
return (jsxs("div", { ...componentProps, children: [children, closeButton && (jsxs("button", { "aria-label": "Close", className: "coop-dialog--close", onClick: () => { var _a, _b; return (_b = (_a = dialog.ref) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.close(); }, children: ["Close ", jsx(CrossIcon, { role: "presentation" })] }))] }));
|
|
95
95
|
};
|
|
96
96
|
const DialogBody = ({ children, className, ...props }) => {
|
|
97
97
|
const componentProps = {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
export interface LogoProps extends SVGProps<SVGSVGElement> {
|
|
3
|
+
/** **(Optional)** Specify the Logo alternative text. */
|
|
4
|
+
alt?: string;
|
|
5
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** **(Optional)** Specify the Logo fill color.
|
|
8
|
+
*
|
|
9
|
+
* Default: brand-blue. */
|
|
10
|
+
fill?: "white" | "black" | "brand-blue";
|
|
11
|
+
/** **(Optional)** Specify the Logo height. */
|
|
12
|
+
height?: number;
|
|
13
|
+
/** **(Optional)** Specify the Logo width. */
|
|
14
|
+
width?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const Logo: ({ alt, className, fill, height, id, ref, width, ...props }: LogoProps) => import("react").JSX.Element;
|
|
17
|
+
export default Logo;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"storybook": "$storybook"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@coopdigital/styles": "^1.
|
|
103
|
+
"@coopdigital/styles": "^1.5.0",
|
|
104
104
|
"@radix-ui/react-popover": "^1.1.17",
|
|
105
105
|
"clsx": "^2.1.1",
|
|
106
106
|
"merge-refs": "^2.0.0",
|
|
107
107
|
"react-day-picker": "^10.0.1"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "6a99f896553ea4541e8337bfa290d1838853a242"
|
|
110
110
|
}
|
|
@@ -84,7 +84,7 @@ interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
84
84
|
*
|
|
85
85
|
* Default: `true`
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
closeButton?: boolean
|
|
88
88
|
}
|
|
89
89
|
interface DialogBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
90
90
|
/** **(Optional)** Content inside the Dialog Body. */
|
|
@@ -211,7 +211,7 @@ const Dialog = ({
|
|
|
211
211
|
const DialogHeader = ({
|
|
212
212
|
children,
|
|
213
213
|
className,
|
|
214
|
-
|
|
214
|
+
closeButton = true,
|
|
215
215
|
...props
|
|
216
216
|
}: DialogHeaderProps): JSX.Element => {
|
|
217
217
|
const componentProps = {
|
|
@@ -224,7 +224,7 @@ const DialogHeader = ({
|
|
|
224
224
|
return (
|
|
225
225
|
<div {...componentProps}>
|
|
226
226
|
{children}
|
|
227
|
-
{
|
|
227
|
+
{closeButton && (
|
|
228
228
|
<button
|
|
229
229
|
aria-label="Close"
|
|
230
230
|
className="coop-dialog--close"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SVGProps } from "react"
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx"
|
|
4
|
+
export interface LogoProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
/** **(Optional)** Specify the Logo alternative text. */
|
|
6
|
+
alt?: string
|
|
7
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
8
|
+
className?: string
|
|
9
|
+
/** **(Optional)** Specify the Logo fill color.
|
|
10
|
+
*
|
|
11
|
+
* Default: brand-blue. */
|
|
12
|
+
fill?: "white" | "black" | "brand-blue"
|
|
13
|
+
/** **(Optional)** Specify the Logo height. */
|
|
14
|
+
height?: number
|
|
15
|
+
/** **(Optional)** Specify the Logo width. */
|
|
16
|
+
width?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Logo = ({
|
|
20
|
+
alt = "Co-op",
|
|
21
|
+
className,
|
|
22
|
+
fill = "brand-blue",
|
|
23
|
+
height,
|
|
24
|
+
id,
|
|
25
|
+
ref,
|
|
26
|
+
width,
|
|
27
|
+
...props
|
|
28
|
+
}: LogoProps) => {
|
|
29
|
+
const componentProps = {
|
|
30
|
+
alt,
|
|
31
|
+
className: clsx("coop-logo", className),
|
|
32
|
+
fill: fill === "brand-blue" ? undefined : `var(--color-${fill})`,
|
|
33
|
+
height,
|
|
34
|
+
id,
|
|
35
|
+
role: "img",
|
|
36
|
+
viewBox: "0 0 38 40",
|
|
37
|
+
width,
|
|
38
|
+
...props,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<svg {...componentProps} ref={ref}>
|
|
43
|
+
<title>{alt}</title>
|
|
44
|
+
<path d="M37.8 8.8c0-1.4-.2-2.8-.6-4.2-.5-1.7-1.8-3-3.4-3.7a14.9 14.9 0 0 0-10.2 0c-1.7.6-2.9 2-3.4 3.7-.8 2.8-.8 5.7 0 8.5.5 1.7 1.8 3 3.4 3.7 1.6.6 3.4.9 5.1.8 1.7 0 3.5-.3 5.1-.8 1.7-.6 2.9-2 3.4-3.7.4-1.5.6-2.9.6-4.3zm-5.5 0c0 .7-.1 1.4-.3 2-.3.9-1 1.6-2 1.8-.9.2-1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