@citygross/components_v2 0.0.52 → 0.0.53

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.
@@ -13,6 +13,6 @@ declare type TModal = {
13
13
  isConfirm?: boolean;
14
14
  className?: string;
15
15
  };
16
- declare const Modal: ({ onBackdropClick, children, title, subTitle, hideCancel, isConfirm, background, querySelector, footer, className }: TModal) => React.ReactPortal;
16
+ declare const Modal: React.ForwardRefExoticComponent<TModal & React.RefAttributes<HTMLDivElement>>;
17
17
 
18
18
  export { Modal, TModal };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { Icons } from '@citygross/icons_v2';
4
4
  import { Spacer } from '../Spacer/Spacer.js';
@@ -6,49 +6,53 @@ import { modalOverlay, modalContainer, modalHeaderContainer, modalHeader, closeB
6
6
  import { H2 } from '../../typography/H2/H2.js';
7
7
  import { BodyText } from '../../typography/BodyText/BodyText.js';
8
8
 
9
- const Modal = ({
10
- onBackdropClick,
11
- children,
12
- title,
13
- subTitle,
14
- hideCancel = true,
15
- isConfirm,
16
- background = "white",
17
- querySelector = "#root",
18
- footer,
19
- className
20
- }) => {
21
- const domSafe = typeof document !== "undefined";
22
- return domSafe ? createPortal(
23
- /* @__PURE__ */ React.createElement(
24
- "div",
25
- {
26
- className: modalOverlay,
27
- onClick: () => onBackdropClick && onBackdropClick()
28
- },
9
+ const Modal = forwardRef(
10
+ ({
11
+ onBackdropClick,
12
+ children,
13
+ title,
14
+ subTitle,
15
+ hideCancel = true,
16
+ isConfirm,
17
+ background = "white",
18
+ querySelector = "#root",
19
+ footer,
20
+ className
21
+ }, ref) => {
22
+ const domSafe = typeof document !== "undefined";
23
+ return domSafe ? createPortal(
29
24
  /* @__PURE__ */ React.createElement(
30
25
  "div",
31
26
  {
32
- className: `${modalContainer({
33
- backgroundColor: background,
34
- maxWidth: isConfirm ? "confirm" : "regular"
35
- })} ${className}`,
36
- onClick: (e) => e.stopPropagation()
27
+ className: modalOverlay,
28
+ onClick: () => onBackdropClick && onBackdropClick(),
29
+ ref
37
30
  },
38
- title && /* @__PURE__ */ React.createElement("div", { className: modalHeaderContainer }, /* @__PURE__ */ React.createElement("div", { className: modalHeader }, /* @__PURE__ */ React.createElement(H2, null, title), !hideCancel && /* @__PURE__ */ React.createElement(
31
+ /* @__PURE__ */ React.createElement(
39
32
  "div",
40
33
  {
41
- className: closeButtonWrapper,
42
- onClick: () => onBackdropClick && onBackdropClick()
34
+ className: `${modalContainer({
35
+ backgroundColor: background,
36
+ maxWidth: isConfirm ? "confirm" : "regular"
37
+ })} ${className}`,
38
+ onClick: (e) => e.stopPropagation()
43
39
  },
44
- /* @__PURE__ */ React.createElement(Icons.Cross, null)
45
- )), /* @__PURE__ */ React.createElement(BodyText, null, subTitle)),
46
- children && /* @__PURE__ */ React.createElement("div", { className: childrenWrapper }, children),
47
- footer && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement("div", { className: footerWrapper }, footer))
48
- )
49
- ),
50
- document.querySelector(querySelector) || document.body
51
- ) : null;
52
- };
40
+ title && /* @__PURE__ */ React.createElement("div", { className: modalHeaderContainer }, /* @__PURE__ */ React.createElement("div", { className: modalHeader }, /* @__PURE__ */ React.createElement(H2, null, title), !hideCancel && /* @__PURE__ */ React.createElement(
41
+ "div",
42
+ {
43
+ className: closeButtonWrapper,
44
+ onClick: () => onBackdropClick && onBackdropClick()
45
+ },
46
+ /* @__PURE__ */ React.createElement(Icons.Cross, null)
47
+ )), /* @__PURE__ */ React.createElement(BodyText, null, subTitle)),
48
+ children && /* @__PURE__ */ React.createElement("div", { className: childrenWrapper }, children),
49
+ footer && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement("div", { className: footerWrapper }, footer))
50
+ )
51
+ ),
52
+ document.querySelector(querySelector) || document.body
53
+ ) : null;
54
+ }
55
+ );
56
+ Modal.displayName = "Modal";
53
57
 
54
58
  export { Modal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components_v2",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -79,5 +79,5 @@
79
79
  "react-slick": "^0.30.1",
80
80
  "slick-carousel": "^1.8.1"
81
81
  },
82
- "gitHead": "a4298a1e03299bbd713a152b1f723fc26a32b1cf"
82
+ "gitHead": "c3ba222ac06cddf16f1ecd0f381f22bc13ff0c21"
83
83
  }