morse-react-dialogs
Advanced tools
Comparing version
@@ -1,7 +0,8 @@ | ||
/// <reference types="react" /> | ||
import { ReactNode } from "react"; | ||
import { DialogProps } from "./Dialog"; | ||
import { DialogTitleProps } from "./DialogTitle"; | ||
export declare type AutoDialogProps = DialogProps & DialogTitleProps & { | ||
export declare type AutoDialogProps = DialogProps & Omit<DialogTitleProps, 'children'> & { | ||
title?: ReactNode; | ||
buttons?: JSX.Element[] | JSX.Element; | ||
}; | ||
export declare const AutoDialog: (props: AutoDialogProps) => JSX.Element; |
@@ -28,3 +28,3 @@ "use strict"; | ||
react_1.default.createElement(Dialog_1.Dialog.Header, null, | ||
react_1.default.createElement(Dialog_1.Dialog.Title, { title: title, icon: icon, onDismissed: onDismissed, showClose: allowDismiss, closeIcon: closeIcon, closeText: closeText, closeButtonClassName: closeButtonClassName })), | ||
react_1.default.createElement(Dialog_1.Dialog.Title, { icon: icon, onDismissed: onDismissed, showClose: allowDismiss, closeIcon: closeIcon, closeText: closeText, closeButtonClassName: closeButtonClassName }, title)), | ||
react_1.default.createElement(Dialog_1.Dialog.Body, null, props.children), | ||
@@ -31,0 +31,0 @@ react_1.default.createElement(Dialog_1.Dialog.Footer, null, |
import { ReactElement, ReactNode } from "react"; | ||
export declare type DialogIcon = ReactElement<SVGElement> | ReactElement<HTMLImageElement> | string; | ||
export declare type DialogTitleProps = { | ||
title?: ReactNode; | ||
children?: ReactNode; | ||
icon?: DialogIcon; | ||
@@ -6,0 +6,0 @@ closeIcon?: string; |
@@ -10,6 +10,6 @@ "use strict"; | ||
var DialogTitle = function (props) { | ||
var title = props.title, icon = props.icon, closeIcon = props.closeIcon, closeText = props.closeText, closeButtonClassName = props.closeButtonClassName, onDismissed = props.onDismissed, showClose = props.showClose; | ||
var children = props.children, icon = props.icon, closeIcon = props.closeIcon, closeText = props.closeText, closeButtonClassName = props.closeButtonClassName, onDismissed = props.onDismissed, showClose = props.showClose; | ||
return (react_1.default.createElement(morse_react_1.ModalContext.Consumer, null, function (modalContext) { return (react_1.default.createElement(react_1.default.Fragment, null, | ||
react_1.default.createElement("span", { className: "c-dialog__icon c-icon" }, typeof icon === "string" ? react_1.default.createElement("img", { src: icon }) : icon), | ||
typeof title === "string" ? (react_1.default.createElement(morse_react_1.Heading, { level: morse_react_1.Heading.Level.H2, className: "c-dialog__heading" }, title)) : (title), | ||
typeof children === "string" ? (react_1.default.createElement(morse_react_1.Heading, { level: morse_react_1.Heading.Level.H2, className: "c-dialog__heading" }, children)) : (react_1.default.createElement(react_1.default.Fragment, null, children)), | ||
showClose && (react_1.default.createElement(morse_react_1.Button, { appearance: morse_react_1.Button.Appearance.Text, icon: true, className: "c-dialog__close ".concat(closeButtonClassName ? closeButtonClassName : ""), onClick: function () { | ||
@@ -16,0 +16,0 @@ if (modalContext.close()) { |
{ | ||
"name": "morse-react-dialogs", | ||
"version": "3.0.0-alpha.2", | ||
"version": "3.0.0-alpha.4", | ||
"description": "Dialog patterns in React built for Morse", | ||
@@ -49,3 +49,3 @@ "repository": { | ||
], | ||
"gitHead": "49c33841ca31e141dd4029809dafc429816d0ef2" | ||
"gitHead": "b4ff7c5f1915c937b6880f367a894b70ac041261" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69979
0.3%1230
0.08%