@mailstep/design-system 0.7.45 → 0.7.47-beta.1

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": "@mailstep/design-system",
3
- "version": "0.7.45",
3
+ "version": "0.7.47-beta.1",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -1,2 +1,8 @@
1
- import { ControlProps, ModalData } from '../types';
2
- export declare const useModal: <TData = ModalData>(initialState?: boolean) => ControlProps<TData>;
1
+ import type { ControlProps, ModalData } from '../types';
2
+ type UseModalProps = {
3
+ initialIsOpen?: boolean;
4
+ onCloseModal?: () => void;
5
+ };
6
+ /** @TODO This breaking change has to be fixed in WHM */
7
+ export declare const useModal: <TData = ModalData>(props?: UseModalProps) => ControlProps<TData>;
8
+ export {};
@@ -1,12 +1,14 @@
1
1
  import { useCallback, useState } from 'react';
2
- export var useModal = function (initialState) {
3
- if (initialState === void 0) { initialState = false; }
4
- var _a = useState(initialState), isOpen = _a[0], setIsOpen = _a[1];
5
- var _b = useState(), data = _b[0], setData = _b[1];
2
+ /** @TODO This breaking change has to be fixed in WHM */
3
+ export var useModal = function (props) {
4
+ var _a = props || {}, _b = _a.initialIsOpen, initialIsOpen = _b === void 0 ? false : _b, onCloseModal = _a.onCloseModal;
5
+ var _c = useState(initialIsOpen), isOpen = _c[0], setIsOpen = _c[1];
6
+ var _d = useState(), data = _d[0], setData = _d[1];
6
7
  var onClose = useCallback(function () {
7
8
  setIsOpen(false);
8
9
  setData(undefined);
9
- }, []);
10
+ onCloseModal === null || onCloseModal === void 0 ? void 0 : onCloseModal();
11
+ }, [onCloseModal]);
10
12
  var onOpen = useCallback(function (data) {
11
13
  data && setData(data);
12
14
  setIsOpen(true);
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
- import { SpaceAround } from '../SpaceAround/types';
3
2
  import { Theme, ControlProps, CSSObjectWithLabel } from 'react-select';
3
+ import { SpaceAround } from '../SpaceAround/types';
4
4
  export type Option<Value = string | number> = {
5
5
  value: Value;
6
6
  label: string | number;