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