@inceptionbg/iui 2.0.6 → 2.0.7
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/dist/{NoAccessPage-C6nBt-PN.js → NoAccessPage-BozT_Suz.js} +2 -2
- package/dist/{NoAccessPage-C6nBt-PN.js.map → NoAccessPage-BozT_Suz.js.map} +1 -1
- package/dist/{NotFoundPage-DatmJOrr.js → NotFoundPage-WWiekDef.js} +2 -2
- package/dist/{NotFoundPage-DatmJOrr.js.map → NotFoundPage-WWiekDef.js.map} +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Header/Components/UserMenu.tsx +44 -36
- package/src/components/Header/Header.tsx +3 -8
- package/src/components/Inputs/DateInput/DateInput.tsx +5 -4
- package/src/types/IHeader.ts +10 -0
|
@@ -5,40 +5,48 @@ import { Tooltip } from '../../Tooltip/Tooltip';
|
|
|
5
5
|
import { Menu } from '../../Menu/Menu';
|
|
6
6
|
import { IHeaderUserMenuProps } from '../../../types/IHeader';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export const UserMenu: FC<IHeaderUserMenuProps> = ({
|
|
9
|
+
isOpen,
|
|
10
|
+
setIsOpen,
|
|
11
|
+
userName,
|
|
12
|
+
organizationName,
|
|
13
|
+
menuItems,
|
|
14
|
+
showBadge,
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
16
|
+
HeaderUserMenuDialogs,
|
|
17
|
+
openedDialog,
|
|
18
|
+
setOpenedDialog,
|
|
19
|
+
refetchOrganizationInvites,
|
|
20
|
+
}) => (
|
|
21
|
+
<>
|
|
22
|
+
<Menu
|
|
23
|
+
isOpen={isOpen}
|
|
24
|
+
onClose={() => setIsOpen(false)}
|
|
25
|
+
placement="bottom-right"
|
|
26
|
+
size="m"
|
|
27
|
+
items={menuItems}
|
|
28
|
+
renderButton={ref => (
|
|
29
|
+
<button ref={ref} className="user-box" onClick={() => setIsOpen(true)}>
|
|
30
|
+
{showBadge && <div className="user-badge" />}
|
|
31
|
+
<FontAwesomeIcon icon={faCircleUser} className="user-icon" />
|
|
32
|
+
<div className="user-info">
|
|
33
|
+
{userName && <p className="user-name">{userName}</p>}
|
|
34
|
+
{organizationName && (
|
|
35
|
+
<Tooltip
|
|
36
|
+
label={(organizationName?.length || 0) > 20 ? organizationName : ''}
|
|
37
|
+
position="bottom"
|
|
38
|
+
>
|
|
39
|
+
<p className="org-name">{organizationName}</p>
|
|
40
|
+
</Tooltip>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
</button>
|
|
44
|
+
)}
|
|
45
|
+
/>
|
|
46
|
+
<HeaderUserMenuDialogs
|
|
47
|
+
openedDialog={openedDialog}
|
|
48
|
+
setOpenedDialog={setOpenedDialog}
|
|
49
|
+
refetchOrganizationInvites={refetchOrganizationInvites}
|
|
50
|
+
/>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
@@ -9,17 +9,14 @@ interface Props {
|
|
|
9
9
|
// actions: {
|
|
10
10
|
// icon: IconDefinition;
|
|
11
11
|
// };
|
|
12
|
-
userMenuProps:
|
|
13
|
-
HeaderUserProvider: ({ children }: { children: ReactNode }) => React.JSX.Element;
|
|
14
|
-
useHeaderUserContext: () => IHeaderUserMenuProps;
|
|
15
|
-
};
|
|
12
|
+
userMenuProps: IHeaderUserMenuProps;
|
|
16
13
|
children?: ReactNode;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
export const Header: FC<Props> = ({
|
|
20
17
|
customTitle,
|
|
21
18
|
modulesProps,
|
|
22
|
-
userMenuProps
|
|
19
|
+
userMenuProps,
|
|
23
20
|
children,
|
|
24
21
|
}) => (
|
|
25
22
|
<div className="iui-header">
|
|
@@ -28,9 +25,7 @@ export const Header: FC<Props> = ({
|
|
|
28
25
|
<div className="flex gap-2 align-center">
|
|
29
26
|
{children}
|
|
30
27
|
{/* {!hideNotifications && <Notifications />} */}
|
|
31
|
-
<
|
|
32
|
-
<UserMenu useHeaderUserContext={useHeaderUserContext} />
|
|
33
|
-
</HeaderUserProvider>
|
|
28
|
+
<UserMenu {...userMenuProps} />
|
|
34
29
|
</div>
|
|
35
30
|
</div>
|
|
36
31
|
);
|
|
@@ -7,8 +7,8 @@ import { DatePartInput } from './components/DatePartInput';
|
|
|
7
7
|
import { faCalendarPlus } from '../../../assets/icons/light/faCalendarPlus';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import { IMenuPlacement } from '../../../types/IMenu';
|
|
10
|
-
import i18next from 'i18next';
|
|
11
10
|
import { formatDateYMD } from '../../../utils/DateUtils';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
12
|
|
|
13
13
|
export interface IDateInputProps {
|
|
14
14
|
label?: string;
|
|
@@ -42,6 +42,7 @@ export const DateInput: FC<IDateInputProps> = ({
|
|
|
42
42
|
const [day, setDay] = useState(date?.split('-')[2] ?? '');
|
|
43
43
|
const [month, setMonth] = useState(date?.split('-')[1] ?? '');
|
|
44
44
|
const [year, setYear] = useState(date?.split('-')[0] ?? '');
|
|
45
|
+
const { i18n } = useTranslation();
|
|
45
46
|
|
|
46
47
|
const [isCalendarOpen, setIsCalendarOpen] = useState(false);
|
|
47
48
|
|
|
@@ -116,11 +117,11 @@ export const DateInput: FC<IDateInputProps> = ({
|
|
|
116
117
|
setIsCalendarOpen(false);
|
|
117
118
|
}}
|
|
118
119
|
locale={
|
|
119
|
-
|
|
120
|
+
i18n.language === 'sr_RS_Latn'
|
|
120
121
|
? 'sr-Latn-RS'
|
|
121
|
-
:
|
|
122
|
+
: i18n.language === 'sr_RS_Cyrl'
|
|
122
123
|
? 'sr-RS'
|
|
123
|
-
:
|
|
124
|
+
: i18n.language
|
|
124
125
|
}
|
|
125
126
|
formatShortWeekday={(locale, date) =>
|
|
126
127
|
new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(date)
|
package/src/types/IHeader.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconDefinition, RotateProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
2
|
import { IButtonColor } from '../components/Button/Button';
|
|
3
3
|
import { IMenuItem } from './IMenu';
|
|
4
|
+
import { FC } from 'react';
|
|
4
5
|
|
|
5
6
|
export interface IHeaderAction {
|
|
6
7
|
label: string;
|
|
@@ -21,4 +22,13 @@ export type IHeaderUserMenuProps = {
|
|
|
21
22
|
organizationName?: string;
|
|
22
23
|
showBadge?: boolean;
|
|
23
24
|
menuItems?: IMenuItem[];
|
|
25
|
+
|
|
26
|
+
HeaderUserMenuDialogs: FC<{
|
|
27
|
+
openedDialog: string | null;
|
|
28
|
+
setOpenedDialog: (dialog: string | null) => void;
|
|
29
|
+
refetchOrganizationInvites?: () => void;
|
|
30
|
+
}>;
|
|
31
|
+
openedDialog: string | null;
|
|
32
|
+
setOpenedDialog: (dialog: string | null) => void;
|
|
33
|
+
refetchOrganizationInvites?: () => void;
|
|
24
34
|
};
|