@4i/modal-manager 1.0.62 → 1.0.70

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4i/modal-manager",
3
- "version": "1.0.62",
3
+ "version": "1.0.70",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -18,6 +18,7 @@ interface ModalProviderProps {
18
18
  data: TData[],
19
19
  names: string[]
20
20
  ) => void;
21
+ ignoreClickElement?: Element;
21
22
  }
22
23
 
23
24
  type TData = { [key: string]: any };
@@ -32,6 +33,7 @@ const ModalProvider = ({
32
33
  isHaveBackdrop = true,
33
34
  isCloseOnBackdropClick = true,
34
35
  zIndex,
36
+ ignoreClickElement,
35
37
  }: ModalProviderProps) => {
36
38
  const [data, setData] = useState<TData[]>([]);
37
39
  const [names, setNames] = useState<string[]>([]);
@@ -121,6 +123,7 @@ const ModalProvider = ({
121
123
 
122
124
  const handleCloseModal = (index: number, e: any) => {
123
125
  if (!isCloseOnBackdropClick) return;
126
+ if (ignoreClickElement && ignoreClickElement.contains(e.target)) return;
124
127
  if (
125
128
  modalRef.current[index] &&
126
129
  !modalRef.current[index].contains(e.target)