dry-ux 1.25.0 → 1.26.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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const React = require("react");
4
4
  const react_bootstrap_1 = require("react-bootstrap");
5
- const Modal = React.memo(({ handleClose, shown, options: { content, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true } }) => {
5
+ const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true }, }) => {
6
6
  React.useEffect(() => {
7
7
  if (shown) {
8
8
  $(".modal-dialog").css("width", width);
@@ -15,10 +15,13 @@ const Modal = React.memo(({ handleClose, shown, options: { content, cssClass, cl
15
15
  onClose && onClose();
16
16
  };
17
17
  const contentToRender = typeof content == "string" ? React.createElement("div", { dangerouslySetInnerHTML: { __html: content } }) : content;
18
+ const showFooter = closeBtn || footerContent;
18
19
  return (React.createElement(react_bootstrap_1.Modal, { onHide: hide, show: shown, animation: true, autoFocus: true, keyboard: false, className: cssClass, backdropStyle: { zIndex: 1040, opacity: 0.5 }, backdrop: "static" },
19
20
  !!title && (React.createElement(react_bootstrap_1.Modal.Header, { closeButton: titleCloseBtn, onHide: hide },
20
21
  React.createElement(react_bootstrap_1.Modal.Title, null, title))),
21
22
  React.createElement(react_bootstrap_1.Modal.Body, null, contentToRender),
22
- React.createElement(react_bootstrap_1.Modal.Footer, null, closeBtn && (React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: hide }, "Close")))));
23
+ showFooter && (React.createElement(react_bootstrap_1.Modal.Footer, null,
24
+ footerContent,
25
+ closeBtn && (React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: hide }, "Close"))))));
23
26
  });
24
27
  exports.default = Modal;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UIUtilProvider = exports.useUIUtilContext = exports.UIUtilContext = void 0;
4
4
  const React = require("react");
5
5
  require("../types");
6
+ const react_bootstrap_1 = require("react-bootstrap");
6
7
  const defaultState = {
7
8
  modal: {
8
9
  show: null,
@@ -41,16 +42,15 @@ class UIUtilProvider extends React.PureComponent {
41
42
  destroyOnClose: true,
42
43
  closeBtn: true,
43
44
  width: 400,
44
- }), showConfirm: (options, onYes, onNo) => this.createModal("confirm", Object.assign(Object.assign({}, options), { content: (React.createElement("div", null,
45
- options.content,
46
- React.createElement("div", { className: "text-center mtop" },
47
- React.createElement("button", { className: "btn btn-success mright", onClick: onYes }, "Yes"),
48
- React.createElement("button", { className: "btn btn-danger", onClick: () => (onNo ? onNo() : this.toggleModalInstance("confirm", false, true)) }, "No")))) })), showActions: (options, actions) => this.createModal("actions", Object.assign(Object.assign({}, options), { content: (React.createElement("div", null,
49
- options.content,
50
- React.createElement("div", { className: "text-center mtop" }, actions.map(({ content, type = "success", closeOnClick, onClick }, index) => (React.createElement("button", { className: `btn btn-${type} mright`, onClick: () => {
45
+ }), showConfirm: (options, onYes, onNo) => this.createModal("confirm", Object.assign(Object.assign({}, options), { footerContent: (React.createElement(React.Fragment, null,
46
+ options.footerContent,
47
+ React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-success mright", onClick: onYes }, "Yes"),
48
+ React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: () => (onNo ? onNo() : this.toggleModalInstance("confirm", false, true)) }, "No"))) })), showActions: (options, actions) => this.createModal("actions", Object.assign(Object.assign({}, options), { footerContent: (React.createElement(React.Fragment, null,
49
+ options.footerContent,
50
+ actions.map(({ content, type = "success", closeOnClick, onClick }, index) => (React.createElement(react_bootstrap_1.Button, { bsClass: `btn btn-${type} mright`, onClick: () => {
51
51
  onClick && onClick();
52
52
  closeOnClick && this.toggleModalInstance("actions", false, true);
53
- } }, content)))))) })) });
53
+ } }, content))))) })) });
54
54
  }
55
55
  get alertDefaults() {
56
56
  return {
@@ -18,6 +18,10 @@ export declare type ModalOptions = {
18
18
  * The content of the modal.
19
19
  */
20
20
  content: JSX.Element | string;
21
+ /**
22
+ * Footer content of the modal.
23
+ */
24
+ footerContent?: JSX.Element | string;
21
25
  /**
22
26
  * The class to apply to the modal.
23
27
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {