@coopdigital/react 1.7.2 → 1.7.3
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.
|
@@ -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 = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"merge-refs": "^2.0.0",
|
|
107
107
|
"react-day-picker": "^10.0.1"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "3d1fc1ce73f079f93eeeb66292fb5d6534cdd27a"
|
|
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"
|