@mantine/modals 5.10.4 → 5.10.5

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/cjs/reducer.js CHANGED
@@ -13,13 +13,13 @@ function modalsReducer(state, action) {
13
13
  case "CLOSE": {
14
14
  const modals = state.modals.filter((m) => m.id !== action.payload);
15
15
  return {
16
- current: modals[modals.length - 1] || null,
16
+ current: modals[modals.length - 1] || state.current,
17
17
  modals
18
18
  };
19
19
  }
20
20
  case "CLOSE_ALL": {
21
21
  return {
22
- current: null,
22
+ current: state.current,
23
23
  modals: []
24
24
  };
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.js","sources":["../src/reducer.ts"],"sourcesContent":["import { ModalState } from './context';\n\ninterface ModalsState {\n modals: ModalState[];\n current: ModalState | null;\n}\n\ninterface OpenAction {\n type: 'OPEN';\n payload: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n payload: string;\n}\n\ninterface CloseAllAction {\n type: 'CLOSE_ALL';\n}\n\nexport function modalsReducer(\n state: ModalsState,\n action: OpenAction | CloseAction | CloseAllAction\n): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n return {\n current: action.payload,\n modals: [...state.modals, action.payload],\n };\n }\n case 'CLOSE': {\n const modals = state.modals.filter((m) => m.id !== action.payload);\n return {\n current: modals[modals.length - 1] || null,\n modals,\n };\n }\n case 'CLOSE_ALL': {\n return {\n current: null,\n modals: [],\n };\n }\n default: {\n return state;\n }\n }\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,QAAQ,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;AACjD,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;AACzE,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI;AAClD,QAAQ,MAAM;AACd,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,WAAW,EAAE;AACtB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,MAAM,EAAE,EAAE;AAClB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,SAAS;AACb,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"reducer.js","sources":["../src/reducer.ts"],"sourcesContent":["import { ModalState } from './context';\n\ninterface ModalsState {\n modals: ModalState[];\n\n /**\n * Modal that is currently open or was the last open one.\n * Keeping the last one is necessary for providing a clean exit transition.\n */\n current: ModalState | null;\n}\n\ninterface OpenAction {\n type: 'OPEN';\n payload: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n payload: string;\n}\n\ninterface CloseAllAction {\n type: 'CLOSE_ALL';\n}\n\nexport function modalsReducer(\n state: ModalsState,\n action: OpenAction | CloseAction | CloseAllAction\n): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n return {\n current: action.payload,\n modals: [...state.modals, action.payload],\n };\n }\n case 'CLOSE': {\n const modals = state.modals.filter((m) => m.id !== action.payload);\n return {\n current: modals[modals.length - 1] || state.current,\n modals,\n };\n }\n case 'CLOSE_ALL': {\n return {\n current: state.current,\n modals: [],\n };\n }\n default: {\n return state;\n }\n }\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,QAAQ,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;AACjD,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;AACzE,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;AAC3D,QAAQ,MAAM;AACd,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,WAAW,EAAE;AACtB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,KAAK,CAAC,OAAO;AAC9B,QAAQ,MAAM,EAAE,EAAE;AAClB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,SAAS;AACb,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,GAAG;AACH;;;;"}
package/esm/reducer.js CHANGED
@@ -9,13 +9,13 @@ function modalsReducer(state, action) {
9
9
  case "CLOSE": {
10
10
  const modals = state.modals.filter((m) => m.id !== action.payload);
11
11
  return {
12
- current: modals[modals.length - 1] || null,
12
+ current: modals[modals.length - 1] || state.current,
13
13
  modals
14
14
  };
15
15
  }
16
16
  case "CLOSE_ALL": {
17
17
  return {
18
- current: null,
18
+ current: state.current,
19
19
  modals: []
20
20
  };
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.js","sources":["../src/reducer.ts"],"sourcesContent":["import { ModalState } from './context';\n\ninterface ModalsState {\n modals: ModalState[];\n current: ModalState | null;\n}\n\ninterface OpenAction {\n type: 'OPEN';\n payload: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n payload: string;\n}\n\ninterface CloseAllAction {\n type: 'CLOSE_ALL';\n}\n\nexport function modalsReducer(\n state: ModalsState,\n action: OpenAction | CloseAction | CloseAllAction\n): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n return {\n current: action.payload,\n modals: [...state.modals, action.payload],\n };\n }\n case 'CLOSE': {\n const modals = state.modals.filter((m) => m.id !== action.payload);\n return {\n current: modals[modals.length - 1] || null,\n modals,\n };\n }\n case 'CLOSE_ALL': {\n return {\n current: null,\n modals: [],\n };\n }\n default: {\n return state;\n }\n }\n}\n"],"names":[],"mappings":"AAAO,SAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,QAAQ,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;AACjD,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;AACzE,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI;AAClD,QAAQ,MAAM;AACd,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,WAAW,EAAE;AACtB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,MAAM,EAAE,EAAE;AAClB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,SAAS;AACb,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"reducer.js","sources":["../src/reducer.ts"],"sourcesContent":["import { ModalState } from './context';\n\ninterface ModalsState {\n modals: ModalState[];\n\n /**\n * Modal that is currently open or was the last open one.\n * Keeping the last one is necessary for providing a clean exit transition.\n */\n current: ModalState | null;\n}\n\ninterface OpenAction {\n type: 'OPEN';\n payload: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n payload: string;\n}\n\ninterface CloseAllAction {\n type: 'CLOSE_ALL';\n}\n\nexport function modalsReducer(\n state: ModalsState,\n action: OpenAction | CloseAction | CloseAllAction\n): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n return {\n current: action.payload,\n modals: [...state.modals, action.payload],\n };\n }\n case 'CLOSE': {\n const modals = state.modals.filter((m) => m.id !== action.payload);\n return {\n current: modals[modals.length - 1] || state.current,\n modals,\n };\n }\n case 'CLOSE_ALL': {\n return {\n current: state.current,\n modals: [],\n };\n }\n default: {\n return state;\n }\n }\n}\n"],"names":[],"mappings":"AAAO,SAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,OAAO;AAC/B,QAAQ,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;AACjD,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;AACzE,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;AAC3D,QAAQ,MAAM;AACd,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,WAAW,EAAE;AACtB,MAAM,OAAO;AACb,QAAQ,OAAO,EAAE,KAAK,CAAC,OAAO;AAC9B,QAAQ,MAAM,EAAE,EAAE;AAClB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,SAAS;AACb,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,GAAG;AACH;;;;"}
package/lib/reducer.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { ModalState } from './context';
2
2
  interface ModalsState {
3
3
  modals: ModalState[];
4
+ /**
5
+ * Modal that is currently open or was the last open one.
6
+ * Keeping the last one is necessary for providing a clean exit transition.
7
+ */
4
8
  current: ModalState | null;
5
9
  }
6
10
  interface OpenAction {
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,UAAU,WAAW;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,cAAc,GAChD,WAAW,CAyBb"}
1
+ {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,UAAU,WAAW;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;IAErB;;;OAGG;IACH,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,cAAc,GAChD,WAAW,CAyBb"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mantine/modals",
3
3
  "description": "Modals manager based on Mantine components",
4
- "version": "5.10.4",
4
+ "version": "5.10.5",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -27,13 +27,13 @@
27
27
  "confirm"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@mantine/core": "5.10.4",
31
- "@mantine/hooks": "5.10.4",
30
+ "@mantine/core": "5.10.5",
31
+ "@mantine/hooks": "5.10.5",
32
32
  "react": ">=16.8.0",
33
33
  "react-dom": ">=16.8.0"
34
34
  },
35
35
  "dependencies": {
36
- "@mantine/utils": "5.10.4"
36
+ "@mantine/utils": "5.10.5"
37
37
  },
38
38
  "devDependencies": {}
39
39
  }