morse-react-dialogs
Advanced tools
Comparing version 0.6.3 to 0.7.0
@@ -67,3 +67,2 @@ "use strict"; | ||
var morse_react_1 = require("morse-react"); | ||
var DialogManager_1 = require("../DialogManager"); | ||
var Dialog_1 = require("./Dialog"); | ||
@@ -102,3 +101,3 @@ exports.DecisionDialog = function (props) { | ||
return new Promise(function (resolve) { | ||
dialogBroker.show(react_1.default.createElement(exports.DecisionDialog, { key: DialogManager_1.DialogManager.getDialogCount(), title: dialogDetails.title, icon: dialogDetails.icon, onChosen: function (value) { return __awaiter(void 0, void 0, void 0, function () { | ||
dialogBroker.show(react_1.default.createElement(exports.DecisionDialog, { key: morse_react_1.PortalManager.getPortalCount(), title: dialogDetails.title, icon: dialogDetails.icon, onChosen: function (value) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -136,3 +135,2 @@ switch (_a.label) { | ||
})(DialogValues = exports.DialogValues || (exports.DialogValues = {})); | ||
; | ||
exports.useYesNo = function (yesNoDetails) { | ||
@@ -139,0 +137,0 @@ var yesButtonProps = yesNoDetails.yesButtonProps, noButtonProps = yesNoDetails.noButtonProps, rest = __rest(yesNoDetails, ["yesButtonProps", "noButtonProps"]); |
@@ -13,21 +13,2 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -44,7 +25,9 @@ var t = {}; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useDialog = exports.Dialog = void 0; | ||
var morse_react_1 = require("morse-react"); | ||
var react_1 = __importStar(require("react")); | ||
var DialogContext_1 = require("../DialogContext"); | ||
var react_1 = __importDefault(require("react")); | ||
exports.Dialog = function (props) { | ||
@@ -62,8 +45,7 @@ var buttons = props.buttons, title = props.title, icon = props.icon, onClosed = props.onDismissed, children = props.children, allowDismiss = props.allowDismiss, panelProps = __rest(props, ["buttons", "title", "icon", "onDismissed", "children", "allowDismiss"]); | ||
react_1.default.createElement("h2", { className: "c-dialog__heading c-heading +h3" }, title), | ||
allowDismiss && | ||
react_1.default.createElement("button", { className: "c-dialog__close", onClick: close }, | ||
react_1.default.createElement("svg", { height: "21", viewBox: "0 0 21 21", width: "21", xmlns: "http://www.w3.org/2000/svg" }, | ||
react_1.default.createElement("g", { fill: "none", fillRule: "evenodd", stroke: "#2a2e3b", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(5 5)" }, | ||
react_1.default.createElement("path", { d: "m.5 10.5 10-10" }), | ||
react_1.default.createElement("path", { d: "m10.5 10.5-10-10z" }))))), | ||
allowDismiss && (react_1.default.createElement("button", { className: "c-dialog__close", onClick: close }, | ||
react_1.default.createElement("svg", { height: "21", viewBox: "0 0 21 21", width: "21", xmlns: "http://www.w3.org/2000/svg" }, | ||
react_1.default.createElement("g", { fill: "none", fillRule: "evenodd", stroke: "#2a2e3b", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(5 5)" }, | ||
react_1.default.createElement("path", { d: "m.5 10.5 10-10" }), | ||
react_1.default.createElement("path", { d: "m10.5 10.5-10-10z" })))))), | ||
react_1.default.createElement("div", { className: "c-dialog__body" }, children), | ||
@@ -74,13 +56,13 @@ react_1.default.createElement("div", { className: "c-dialog__foot" }, | ||
exports.useDialog = function () { | ||
var dialogContext = react_1.useContext(DialogContext_1.DialogContext); | ||
var dialogContext = morse_react_1.usePortal(morse_react_1.PortalContext); | ||
var shownDialog; | ||
return { | ||
show: function (dialog) { | ||
shownDialog = dialogContext.openDialog(dialog); | ||
shownDialog = dialogContext.openPortal(dialog); | ||
}, | ||
close: function () { | ||
dialogContext.closeDialog(shownDialog); | ||
} | ||
dialogContext.closePortal(shownDialog); | ||
}, | ||
}; | ||
}; | ||
//# sourceMappingURL=Dialog.js.map |
@@ -32,3 +32,2 @@ "use strict"; | ||
var morse_react_1 = require("morse-react"); | ||
var DialogManager_1 = require("../DialogManager"); | ||
exports.MessageBoxDialog = function (props) { | ||
@@ -45,3 +44,3 @@ var dialogProps = __rest(props, []); | ||
return new Promise(function (resolve) { | ||
dialogBroker.show(react_1.default.createElement(exports.MessageBoxDialog, { key: DialogManager_1.DialogManager.getDialogCount(), title: dialogDetails.title, onDismissed: function () { | ||
dialogBroker.show(react_1.default.createElement(exports.MessageBoxDialog, { key: morse_react_1.PortalManager.getPortalCount(), title: dialogDetails.title, onDismissed: function () { | ||
dialogBroker.close(); | ||
@@ -48,0 +47,0 @@ resolve(); |
@@ -85,3 +85,2 @@ "use strict"; | ||
var yup_1 = require("yup"); | ||
var DialogManager_1 = require("../DialogManager"); | ||
exports.SingleInputDialog = function (props) { | ||
@@ -150,3 +149,3 @@ var message = props.message, inputProps = props.inputProps, submitButtonProps = props.submitButtonProps, cancelButtonProps = props.cancelButtonProps, validationSchema = props.validationSchema, validationAlertProps = props.validationAlertProps, onSubmit = props.onSubmit, dialogProps = __rest(props, ["message", "inputProps", "submitButtonProps", "cancelButtonProps", "validationSchema", "validationAlertProps", "onSubmit"]); | ||
react_1.default.createElement(morse_react_1.Button, __assign({ onClick: onClickSubmit }, props.submitButtonProps, { tabIndex: 1 })), | ||
react_1.default.createElement(morse_react_1.Button, __assign({ onClick: onClickCancel }, props.cancelButtonProps, { tabIndex: 2 })) | ||
react_1.default.createElement(morse_react_1.Button, __assign({ onClick: onClickCancel }, props.cancelButtonProps, { tabIndex: 2 })), | ||
] }), | ||
@@ -163,3 +162,3 @@ message && message, | ||
return new Promise(function (resolve, reject) { | ||
dialogBroker.show(react_1.default.createElement(exports.SingleInputDialog, __assign({ key: DialogManager_1.DialogManager.getDialogCount(), initialValue: initialValue }, props, { onSubmit: function (value) { return __awaiter(void 0, void 0, void 0, function () { | ||
dialogBroker.show(react_1.default.createElement(exports.SingleInputDialog, __assign({ key: morse_react_1.PortalManager.getPortalCount(), initialValue: initialValue }, props, { onSubmit: function (value) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -166,0 +165,0 @@ switch (_a.label) { |
export * from "./components/Dialog"; | ||
export * from "./components/DialogContainer"; | ||
export * from "./DialogContext"; | ||
export * from "./DialogManager"; | ||
export * from "./components/DecisionDialog"; | ||
export * from "./components/MessageBoxDialog"; | ||
export * from "./components/SingleInputDialog"; |
@@ -14,5 +14,2 @@ "use strict"; | ||
__exportStar(require("./components/Dialog"), exports); | ||
__exportStar(require("./components/DialogContainer"), exports); | ||
__exportStar(require("./DialogContext"), exports); | ||
__exportStar(require("./DialogManager"), exports); | ||
__exportStar(require("./components/DecisionDialog"), exports); | ||
@@ -19,0 +16,0 @@ __exportStar(require("./components/MessageBoxDialog"), exports); |
{ | ||
"name": "morse-react-dialogs", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"description": "Dialog patterns in React built for Morse", | ||
@@ -46,3 +46,3 @@ "repository": { | ||
], | ||
"gitHead": "3ae69bfae05308f169527ee74e90cad9d5e8ca63" | ||
"gitHead": "2a8b190cd2c38f912fd397f8406a6e210ba4e254" | ||
} |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36878
16
561