@inceptionbg/iui 2.0.10 → 2.0.11

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.
@@ -1,13 +1,17 @@
1
- import { useRef } from 'react';
2
- import { PopupControlRef } from './useLocalPopoverControl';
1
+ import { useCallback, useRef, useState } from 'react';
2
+ import { IPopupControl, PopupControlRef } from '../types/IPopup';
3
+
4
+ export const usePopupControl: () => IPopupControl = () => {
5
+ const [isOpen, setIsOpen] = useState(false);
3
6
 
4
- export const usePopupControl = () => {
5
7
  const controlRef = useRef<PopupControlRef>(null);
6
8
 
9
+ const onOpen = useCallback(() => controlRef.current?.onOpen(), []);
10
+ const onClose = useCallback(() => controlRef.current?.onClose(), []);
11
+
7
12
  return {
8
- controlRef,
9
- isOpen: controlRef.current?.isOpen,
10
- onOpen: () => controlRef.current?.onOpen(),
11
- onClose: () => controlRef.current?.onClose(),
13
+ control: { controlRef, isOpen, setIsOpen },
14
+ onOpen,
15
+ onClose,
12
16
  };
13
17
  };
package/src/index.ts CHANGED
@@ -17,6 +17,7 @@ import type {
17
17
  } from './types/IBasic';
18
18
  import type { IKeyboardAction } from './types/IKeyboard';
19
19
  import type { IMenuItem, IMenuPlacement } from './types/IMenu';
20
+ import type { PopupControlRef, IPopupControl } from './types/IPopup';
20
21
  import type { IError } from './types/IError';
21
22
  import type { ISelectData } from './types/ISelect';
22
23
  import type { ITab } from './types/ITab';
@@ -244,6 +245,8 @@ export type {
244
245
  IKeyboardAction,
245
246
  IMenuItem,
246
247
  IMenuPlacement,
248
+ PopupControlRef,
249
+ IPopupControl as IPopupControl,
247
250
  IError,
248
251
  IFormWrapper,
249
252
  IHeaderAction,
@@ -38,7 +38,7 @@ h4 {
38
38
  }
39
39
 
40
40
  .bold {
41
- font-weight: bold !important;
41
+ font-weight: 600 !important;
42
42
  }
43
43
  .italic {
44
44
  font-style: italic !important;
@@ -2,6 +2,7 @@ import { IconDefinition, RotateProp } from '@fortawesome/fontawesome-svg-core';
2
2
  import { IButtonColor } from '../components/Button/Button';
3
3
  import { IMenuItem } from './IMenu';
4
4
  import { FC } from 'react';
5
+ import { IPopupControl } from './IPopup';
5
6
 
6
7
  export interface IHeaderAction {
7
8
  label: string;
@@ -20,15 +21,20 @@ export type IHeaderUserMenuProps = {
20
21
  setIsOpen: (isOpen: boolean) => void;
21
22
  userName?: string;
22
23
  organizationName?: string;
24
+ menuItems: IMenuItem[];
23
25
  showBadge?: boolean;
24
- menuItems?: IMenuItem[];
25
-
26
+ controls: {
27
+ myAccountControl: IPopupControl;
28
+ changeOrgControl: IPopupControl;
29
+ orgInvitesControl: IPopupControl;
30
+ };
31
+ refetchOrganizationInvites?: () => void;
26
32
  HeaderUserMenuDialogs: FC<{
27
- openedDialog: string | null;
28
- setOpenedDialog: (dialog: string | null) => void;
33
+ controls: {
34
+ myAccountControl: IPopupControl;
35
+ changeOrgControl: IPopupControl;
36
+ orgInvitesControl: IPopupControl;
37
+ };
29
38
  refetchOrganizationInvites?: () => void;
30
39
  }>;
31
- openedDialog: string | null;
32
- setOpenedDialog: (dialog: string | null) => void;
33
- refetchOrganizationInvites?: () => void;
34
40
  };
@@ -0,0 +1,17 @@
1
+ import { RefObject } from 'react';
2
+
3
+ export interface PopupControlRef {
4
+ onOpen: () => void;
5
+ onClose: () => void;
6
+ }
7
+
8
+ export interface ILocalPopupControl {
9
+ controlRef: RefObject<PopupControlRef | null>;
10
+ isOpen: boolean;
11
+ setIsOpen: (isOpen: boolean) => void;
12
+ }
13
+ export interface IPopupControl {
14
+ control: ILocalPopupControl;
15
+ onOpen: () => void;
16
+ onClose: () => void;
17
+ }