@4i/modal-manager 1.0.62 → 1.0.71

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.71",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -18,6 +18,8 @@ interface ModalProviderProps {
18
18
  data: TData[],
19
19
  names: string[]
20
20
  ) => void;
21
+ ignoreClickClassName?: string;
22
+ ignoreClickAttribute?: string;
21
23
  }
22
24
 
23
25
  type TData = { [key: string]: any };
@@ -32,6 +34,8 @@ const ModalProvider = ({
32
34
  isHaveBackdrop = true,
33
35
  isCloseOnBackdropClick = true,
34
36
  zIndex,
37
+ ignoreClickClassName,
38
+ ignoreClickAttribute,
35
39
  }: ModalProviderProps) => {
36
40
  const [data, setData] = useState<TData[]>([]);
37
41
  const [names, setNames] = useState<string[]>([]);
@@ -121,6 +125,13 @@ const ModalProvider = ({
121
125
 
122
126
  const handleCloseModal = (index: number, e: any) => {
123
127
  if (!isCloseOnBackdropClick) return;
128
+ if (
129
+ ignoreClickClassName &&
130
+ e.target.className.includes(ignoreClickClassName)
131
+ )
132
+ return;
133
+ if (ignoreClickAttribute && e.target.getAttribute(ignoreClickAttribute))
134
+ return;
124
135
  if (
125
136
  modalRef.current[index] &&
126
137
  !modalRef.current[index].contains(e.target)