@panneau/modal-dialog 4.0.39 → 4.0.40-alpha.1

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/index.d.ts CHANGED
@@ -1,19 +1,24 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { Label, Button } from '@panneau/core';
4
+ import { ModalProps } from '@panneau/element-modal';
4
5
 
5
- interface ModalDialogProps {
6
- id: string | number;
6
+ interface ModalDialogProps extends Omit<ModalProps, 'title'> {
7
+ id: string;
7
8
  title?: Label | null;
8
9
  size?: string | null;
9
10
  header?: ReactNode | null;
10
11
  children?: ReactNode | null;
11
12
  footer?: ReactNode | null;
12
13
  buttons?: Button[] | null;
13
- onClose?: (() => void) | null;
14
14
  withCloseOutside?: boolean;
15
+ withoutClose?: boolean;
15
16
  className?: string | null;
17
+ headerClassName?: string | null;
18
+ bodyClassName?: string | null;
19
+ footerClassName?: string | null;
20
+ buttonsClassName?: string | null;
16
21
  }
17
- declare function ModalDialog({ id, title, size, header, children, buttons, footer, onClose, withCloseOutside, className, }: ModalDialogProps): react_jsx_runtime.JSX.Element;
22
+ declare function ModalDialog({ id, title, size, header, children, buttons, footer, requestClose, withoutClose, withCloseOutside, className, headerClassName, bodyClassName, footerClassName, buttonsClassName, ...props }: ModalDialogProps): react_jsx_runtime.JSX.Element;
18
23
 
19
24
  export { ModalDialog as default };
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import classNames from 'classnames';
3
2
  import { isMessage } from '@panneau/core/utils';
4
3
  import Button from '@panneau/element-button';
@@ -7,67 +6,64 @@ import Label from '@panneau/element-label';
7
6
  import Modal from '@panneau/element-modal';
8
7
  import { jsx, jsxs } from 'react/jsx-runtime';
9
8
 
10
- var styles = {"container":"panneau-modal-dialog-container","closeOutside":"panneau-modal-dialog-closeOutside","closeOutsideButton":"panneau-modal-dialog-closeOutsideButton"};
11
-
12
- function ModalDialog(_ref) {
13
- var id = _ref.id,
14
- _ref$title = _ref.title,
15
- title = _ref$title === void 0 ? null : _ref$title,
16
- _ref$size = _ref.size,
17
- size = _ref$size === void 0 ? null : _ref$size,
18
- _ref$header = _ref.header,
19
- header = _ref$header === void 0 ? null : _ref$header,
20
- _ref$children = _ref.children,
21
- children = _ref$children === void 0 ? null : _ref$children,
22
- _ref$buttons = _ref.buttons,
23
- buttons = _ref$buttons === void 0 ? null : _ref$buttons,
24
- _ref$footer = _ref.footer,
25
- footer = _ref$footer === void 0 ? null : _ref$footer,
26
- _ref$onClose = _ref.onClose,
27
- onClose = _ref$onClose === void 0 ? null : _ref$onClose,
28
- _ref$withCloseOutside = _ref.withCloseOutside,
29
- withCloseOutside = _ref$withCloseOutside === void 0 ? false : _ref$withCloseOutside,
30
- _ref$className = _ref.className,
31
- className = _ref$className === void 0 ? null : _ref$className;
32
- var onCloseButtonOutside = header === null && title === null && onClose !== null || withCloseOutside && onClose !== null;
9
+ function ModalDialog({
10
+ id,
11
+ title = null,
12
+ size = null,
13
+ header = null,
14
+ children = null,
15
+ buttons = null,
16
+ footer = null,
17
+ requestClose = null,
18
+ withoutClose = false,
19
+ withCloseOutside = false,
20
+ className = null,
21
+ headerClassName = null,
22
+ bodyClassName = null,
23
+ footerClassName = null,
24
+ buttonsClassName = null,
25
+ ...props
26
+ }) {
27
+ const onCloseButtonOutside = header === null && title === null || withCloseOutside;
33
28
  return /*#__PURE__*/jsx(Modal, {
34
29
  id: id,
35
- onClose: onClose,
30
+ requestClose: requestClose,
31
+ ...props,
36
32
  children: /*#__PURE__*/jsx("div", {
37
- className: classNames(['modal-dialog', styles.container, _defineProperty(_defineProperty({}, "modal-".concat(size), size !== null), styles.closeOutside, onCloseButtonOutside), className]),
33
+ className: classNames(['modal-dialog', {
34
+ [`modal-${size}`]: size !== null
35
+ }, className]),
38
36
  role: "dialog",
39
37
  children: /*#__PURE__*/jsxs("div", {
40
38
  className: "modal-content",
41
- children: [onCloseButtonOutside ? /*#__PURE__*/jsx(Button, {
39
+ children: [onCloseButtonOutside && !withoutClose ? /*#__PURE__*/jsx(Button, {
42
40
  type: "button",
43
- className: classNames([styles.closeOutsideButton, 'btn', 'btn-close', 'bg-light',
44
- // 'btn-close-white',
45
- 'btn-secondary', 'p-2']),
41
+ className: classNames(['btn', 'btn-close', 'bg-light', 'position-absolute', 'start-100', 'ms-1']),
46
42
  "aria-label": "Close",
47
- onClick: onClose
43
+ onClick: requestClose
48
44
  }) : null, header !== null ? header : /*#__PURE__*/jsxs("div", {
49
45
  className: classNames([{
50
46
  'modal-header': title !== null
51
- }]),
47
+ }, headerClassName]),
52
48
  children: [title !== null ? /*#__PURE__*/jsx("h5", {
53
49
  className: "modal-title pe-2",
54
50
  children: isMessage(title) ? /*#__PURE__*/jsx(Label, {
55
51
  children: title
56
52
  }) : title
57
- }) : null, title !== null && onClose !== null ? /*#__PURE__*/jsx(Button, {
53
+ }) : null, title !== null && !withoutClose && !onCloseButtonOutside ? /*#__PURE__*/jsx(Button, {
58
54
  type: "button",
59
- className: classNames(['btn-close', 'close']),
55
+ className: "btn-close",
60
56
  "aria-label": "Close",
61
- onClick: onClose
57
+ onClick: requestClose
62
58
  }) : null]
63
59
  }), /*#__PURE__*/jsx("div", {
64
- className: classNames(['modal-body', styles.body]),
60
+ className: classNames(['modal-body', bodyClassName]),
65
61
  children: children
66
62
  }), footer !== null || buttons !== null ? /*#__PURE__*/jsxs("div", {
67
- className: classNames(['modal-footer', styles.footer]),
63
+ className: classNames(['modal-footer', footerClassName]),
68
64
  children: [footer !== null ? footer : null, buttons !== null ? /*#__PURE__*/jsx(Buttons, {
69
65
  items: buttons,
70
- className: styles.buttons
66
+ className: buttonsClassName
71
67
  }) : null]
72
68
  }) : null]
73
69
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/modal-dialog",
3
- "version": "4.0.39",
3
+ "version": "4.0.40-alpha.1",
4
4
  "description": "Default modal",
5
5
  "keywords": [
6
6
  "javascript"
@@ -36,15 +36,11 @@
36
36
  "type": "module",
37
37
  "module": "dist/index.js",
38
38
  "types": "dist/index.d.ts",
39
- "style": "assets/css/styles.css",
40
39
  "exports": {
41
40
  ".": {
42
41
  "types": "./dist/index.d.ts",
43
- "style": "./assets/css/styles.css",
44
42
  "default": "./dist/index.js"
45
- },
46
- "./assets/css/styles": "./assets/css/styles.css",
47
- "./assets/css/styles.css": "./assets/css/styles.css"
43
+ }
48
44
  },
49
45
  "files": [
50
46
  "dist",
@@ -64,12 +60,12 @@
64
60
  },
65
61
  "dependencies": {
66
62
  "@babel/runtime": "^7.28.6",
67
- "@panneau/core": "^4.0.38",
68
- "@panneau/element-button": "^4.0.39",
69
- "@panneau/element-buttons": "^4.0.39",
70
- "@panneau/element-label": "^4.0.38",
71
- "@panneau/element-modal": "^4.0.39",
72
- "@panneau/themes": "^4.0.38",
63
+ "@panneau/core": "^4.0.40-alpha.1",
64
+ "@panneau/element-button": "^4.0.40-alpha.1",
65
+ "@panneau/element-buttons": "^4.0.40-alpha.1",
66
+ "@panneau/element-label": "^4.0.40-alpha.1",
67
+ "@panneau/element-modal": "^4.0.40-alpha.1",
68
+ "@panneau/themes": "^4.0.40-alpha.1",
73
69
  "classnames": "^2.5.1",
74
70
  "lodash": "^4.17.21",
75
71
  "react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
@@ -77,5 +73,5 @@
77
73
  "publishConfig": {
78
74
  "access": "public"
79
75
  },
80
- "gitHead": "621c5233f083c1ba95cd46cd427c38361723d5d6"
76
+ "gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
81
77
  }
@@ -1 +0,0 @@
1
- .panneau-modal-dialog-container{cursor:auto;display:block;margin:0 auto;opacity:1}.panneau-modal-dialog-container.panneau-modal-dialog-closeOutside{margin-top:20px}.panneau-modal-dialog-container .panneau-modal-dialog-closeOutsideButton{border:1px solid var(--bs-body-color);left:auto;position:absolute;right:-40px;top:0;-webkit-transform:translateZ(1px);transform:translateZ(1px);z-index:10002}