@inceptionbg/iui 2.0.34 → 2.0.36

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.
Files changed (244) hide show
  1. package/dist/index.d.ts +7 -6
  2. package/dist/index.js.map +1 -1
  3. package/dist/iui.css +1 -1
  4. package/package.json +25 -22
  5. package/idea/GridTable/GridTable.tsx +0 -119
  6. package/idea/GridTable/gridTable.scss +0 -42
  7. package/idea/Menu/Menu.tsx +0 -121
  8. package/idea/Menu/MenuItem.tsx +0 -75
  9. package/idea/Menu/hooks/useMenuControl.ts +0 -13
  10. package/idea/Menu.tsx +0 -133
  11. package/idea/NoAccessInfo.tsx +0 -193
  12. package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
  13. package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
  14. package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
  15. package/idea/Table/Components/FilterItem.tsx +0 -20
  16. package/idea/Table/Components/Header/TableHeader.tsx +0 -46
  17. package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
  18. package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
  19. package/idea/Table/Components/SetSortList.tsx +0 -30
  20. package/idea/Table/Components/SetTableFilter.tsx +0 -91
  21. package/idea/Table/Components/TableFooter.tsx +0 -137
  22. package/idea/Table/Components/TableOptions.tsx +0 -227
  23. package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
  24. package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
  25. package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
  26. package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
  27. package/idea/Table/Table.tsx +0 -528
  28. package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
  29. package/idea/Table/hooks/useTableKeyboard.ts +0 -137
  30. package/idea/Table/hooks/useTableSelect.ts +0 -11
  31. package/rollup.config.js +0 -52
  32. package/src/assets/icons/duotone/faBell.ts +0 -17
  33. package/src/assets/icons/duotone/faCircleUser.ts +0 -17
  34. package/src/assets/icons/regular/faArrowLeft.ts +0 -15
  35. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
  36. package/src/assets/icons/regular/faCircleCheck.ts +0 -15
  37. package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
  38. package/src/assets/icons/regular/faCircleInfo.ts +0 -15
  39. package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
  40. package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
  41. package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
  42. package/src/assets/icons/solid/faAngleLeft.ts +0 -15
  43. package/src/assets/icons/solid/faAngleRight.ts +0 -15
  44. package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
  45. package/src/assets/icons/solid/faCaretDown.ts +0 -15
  46. package/src/assets/icons/solid/faCheck.ts +0 -15
  47. package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
  48. package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
  49. package/src/assets/icons/solid/faFilter.ts +0 -15
  50. package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
  51. package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
  52. package/src/assets/icons/solid/faListUl.ts +0 -15
  53. package/src/assets/icons/solid/faMinus.ts +0 -15
  54. package/src/assets/icons/solid/faPlus.ts +0 -15
  55. package/src/assets/icons/solid/faPrint.ts +0 -15
  56. package/src/assets/icons/solid/faRotateRight.ts +0 -15
  57. package/src/assets/icons/solid/faXmark.ts +0 -15
  58. package/src/assets/images/logo/inception.svg +0 -22
  59. package/src/assets/images/logo/mts.svg +0 -5703
  60. package/src/assets/images/logo/paperless.svg +0 -21
  61. package/src/assets/images/logo/pismonosa.png +0 -0
  62. package/src/assets/images/not-found.svg +0 -19
  63. package/src/components/Accordions/Accordions.tsx +0 -74
  64. package/src/components/Alert/Alert.tsx +0 -31
  65. package/src/components/Badge/DotBadge.tsx +0 -16
  66. package/src/components/Badge/NotificationBadge.tsx +0 -29
  67. package/src/components/Badge/PillBadge.tsx +0 -13
  68. package/src/components/Button/Button.tsx +0 -56
  69. package/src/components/Button/IconButton.tsx +0 -51
  70. package/src/components/Button/SplitButton.tsx +0 -91
  71. package/src/components/Dashboard/Dashboard.tsx +0 -9
  72. package/src/components/Dashboard/DashboardWidget.tsx +0 -44
  73. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
  74. package/src/components/Dialog/Dialog.tsx +0 -178
  75. package/src/components/Dialog/components/DialogFooter.tsx +0 -100
  76. package/src/components/Header/Components/EnvBadge.tsx +0 -17
  77. package/src/components/Header/Components/ModuleSelect.tsx +0 -68
  78. package/src/components/Header/Components/Notifications.tsx +0 -204
  79. package/src/components/Header/Components/UserMenu.tsx +0 -52
  80. package/src/components/Header/Header.tsx +0 -45
  81. package/src/components/Helper/Collapse.tsx +0 -53
  82. package/src/components/Inputs/Checkbox.tsx +0 -53
  83. package/src/components/Inputs/CurrencyInput.tsx +0 -124
  84. package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
  85. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
  86. package/src/components/Inputs/InputWrapper.tsx +0 -95
  87. package/src/components/Inputs/NumberInput.tsx +0 -86
  88. package/src/components/Inputs/PasswordInput.tsx +0 -39
  89. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
  90. package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
  91. package/src/components/Inputs/Radio.tsx +0 -59
  92. package/src/components/Inputs/RadioGroup.tsx +0 -48
  93. package/src/components/Inputs/RadioLarge.tsx +0 -39
  94. package/src/components/Inputs/SearchInput.tsx +0 -46
  95. package/src/components/Inputs/Selects/Select.tsx +0 -17
  96. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
  97. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
  98. package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
  99. package/src/components/Inputs/TextAreaInput.tsx +0 -68
  100. package/src/components/Inputs/TextInput.tsx +0 -100
  101. package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
  102. package/src/components/List/List.tsx +0 -21
  103. package/src/components/List/ListItem.tsx +0 -70
  104. package/src/components/Loader/Loader.tsx +0 -66
  105. package/src/components/Loader/ProgressBar.tsx +0 -41
  106. package/src/components/Menu/Menu.tsx +0 -81
  107. package/src/components/Menu/MenuItem.tsx +0 -46
  108. package/src/components/Menu/NewMenu.tsx +0 -63
  109. package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
  110. package/src/components/PageComponents/ScrollableContent.tsx +0 -11
  111. package/src/components/Pullover/Pullover.tsx +0 -197
  112. package/src/components/Router/Router.tsx +0 -52
  113. package/src/components/Sidebar/AddButton.tsx +0 -22
  114. package/src/components/Sidebar/Sidebar.tsx +0 -85
  115. package/src/components/Sidebar/SidebarItem.tsx +0 -84
  116. package/src/components/Sidebar/types/ISidebar.ts +0 -28
  117. package/src/components/Table/Table.tsx +0 -258
  118. package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
  119. package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
  120. package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
  121. package/src/components/Table/components/filters/FilterItem.tsx +0 -15
  122. package/src/components/Table/components/filters/TableFilters.tsx +0 -126
  123. package/src/components/Table/components/footer/TableFooter.tsx +0 -126
  124. package/src/components/Table/components/header/TableHeader.tsx +0 -40
  125. package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
  126. package/src/components/Table/components/items/TableItemActions.tsx +0 -78
  127. package/src/components/Table/components/print/TablePrint.tsx +0 -200
  128. package/src/components/Table/components/select/TableSelect.tsx +0 -50
  129. package/src/components/Table/components/sort/TableSort.tsx +0 -75
  130. package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
  131. package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
  132. package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
  133. package/src/components/Table/contexts/TableContext.tsx +0 -117
  134. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
  135. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
  136. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
  137. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
  138. package/src/components/Table/hooks/useTableColumns.ts +0 -34
  139. package/src/components/Table/hooks/useTableEdit.tsx +0 -140
  140. package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
  141. package/src/components/Table/hooks/useTablePagination.ts +0 -19
  142. package/src/components/Table/hooks/useTablePrint.ts +0 -83
  143. package/src/components/Table/hooks/useTableSearch.ts +0 -31
  144. package/src/components/Table/hooks/useTableSelect.ts +0 -19
  145. package/src/components/Table/hooks/useTableSort.ts +0 -8
  146. package/src/components/Tabs/Tabs.tsx +0 -68
  147. package/src/components/Tooltip/Tooltip.tsx +0 -191
  148. package/src/components/Tree/Tree.tsx +0 -22
  149. package/src/components/Tree/TreeItem.tsx +0 -57
  150. package/src/components/Wrappers/AppLayout.tsx +0 -17
  151. package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
  152. package/src/components/Wrappers/FormWrapper.tsx +0 -84
  153. package/src/components/Wrappers/PageLayout.tsx +0 -168
  154. package/src/hooks/useBackgroundClose.ts +0 -19
  155. package/src/hooks/useGetFocusableElements.ts +0 -43
  156. package/src/hooks/useIsMenuOpen.ts +0 -11
  157. package/src/hooks/useLocalPopoverControl.ts +0 -63
  158. package/src/hooks/useOnEsc.ts +0 -14
  159. package/src/hooks/usePopupControl.ts +0 -22
  160. package/src/hooks/useZendesk.ts +0 -21
  161. package/src/index.ts +0 -387
  162. package/src/pages/NoAccessPage.tsx +0 -27
  163. package/src/pages/NotFoundPage.tsx +0 -26
  164. package/src/styles/App.scss +0 -47
  165. package/src/styles/common/_animations.scss +0 -58
  166. package/src/styles/common/_typography.scss +0 -91
  167. package/src/styles/common/helpers/_base.scss +0 -55
  168. package/src/styles/common/helpers/_color.scss +0 -10
  169. package/src/styles/common/helpers/_display.scss +0 -85
  170. package/src/styles/common/helpers/_size.scss +0 -25
  171. package/src/styles/common/maps/_align.scss +0 -21
  172. package/src/styles/common/maps/_buttonMaps.scss +0 -42
  173. package/src/styles/common/maps/_info-types.scss +0 -1
  174. package/src/styles/common/maps/_spacing.scss +0 -78
  175. package/src/styles/common/maps/_text.scss +0 -14
  176. package/src/styles/components/_accordions.scss +0 -51
  177. package/src/styles/components/_alert.scss +0 -23
  178. package/src/styles/components/_badge.scss +0 -84
  179. package/src/styles/components/_button.scss +0 -99
  180. package/src/styles/components/_buttonSplit.scss +0 -65
  181. package/src/styles/components/_card.scss +0 -24
  182. package/src/styles/components/_dialog.scss +0 -119
  183. package/src/styles/components/_form.scss +0 -8
  184. package/src/styles/components/_header.scss +0 -157
  185. package/src/styles/components/_input.scss +0 -167
  186. package/src/styles/components/_inputCheckbox.scss +0 -48
  187. package/src/styles/components/_inputDateTime.scss +0 -161
  188. package/src/styles/components/_inputRadio.scss +0 -83
  189. package/src/styles/components/_inputSelect.scss +0 -8
  190. package/src/styles/components/_list.scss +0 -58
  191. package/src/styles/components/_loader.scss +0 -55
  192. package/src/styles/components/_menu-v2.scss +0 -67
  193. package/src/styles/components/_menu.scss +0 -62
  194. package/src/styles/components/_notifications.scss +0 -71
  195. package/src/styles/components/_page.scss +0 -84
  196. package/src/styles/components/_portal.scss +0 -8
  197. package/src/styles/components/_print.scss +0 -77
  198. package/src/styles/components/_progressBar.scss +0 -83
  199. package/src/styles/components/_pullover.scss +0 -95
  200. package/src/styles/components/_scrollbar.scss +0 -18
  201. package/src/styles/components/_sidebar.scss +0 -204
  202. package/src/styles/components/_smallComponents.scss +0 -23
  203. package/src/styles/components/_table.scss +0 -340
  204. package/src/styles/components/_tabs.scss +0 -33
  205. package/src/styles/components/_tooltip.scss +0 -48
  206. package/src/styles/components/_tree.scss +0 -21
  207. package/src/styles/components/_widget.scss +0 -90
  208. package/src/styles/pages/_fullScreenPage.scss +0 -64
  209. package/src/styles/variables/_bp.scss +0 -6
  210. package/src/styles/variables/_variables.scss +0 -142
  211. package/src/types/Base/custom.d.ts +0 -9
  212. package/src/types/IBasic.ts +0 -32
  213. package/src/types/ICountryCode.ts +0 -5
  214. package/src/types/IError.ts +0 -5
  215. package/src/types/IHeader.ts +0 -40
  216. package/src/types/IInfo.ts +0 -1
  217. package/src/types/IKeyboard.ts +0 -33
  218. package/src/types/IMenu.ts +0 -19
  219. package/src/types/INotifications.ts +0 -15
  220. package/src/types/IPopup.ts +0 -17
  221. package/src/types/IRouter.ts +0 -6
  222. package/src/types/ISelect.ts +0 -54
  223. package/src/types/ITab.ts +0 -10
  224. package/src/types/ITable.ts +0 -291
  225. package/src/types/ITree.ts +0 -6
  226. package/src/utils/InputPatternValidation.ts +0 -12
  227. package/src/utils/dateUtils.ts +0 -32
  228. package/src/utils/fileUtils.ts +0 -177
  229. package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
  230. package/src/utils/i18n/i18nIUILatin.ts +0 -120
  231. package/src/utils/i18n/i18nIUIMe.ts +0 -118
  232. package/src/utils/icons.ts +0 -13
  233. package/src/utils/localStorageHelper.ts +0 -24
  234. package/src/utils/logoUtils.ts +0 -7
  235. package/src/utils/numberUtils.ts +0 -21
  236. package/src/utils/objectUtils.ts +0 -114
  237. package/src/utils/popupUtils.ts +0 -82
  238. package/src/utils/rootDir.ts +0 -1
  239. package/src/utils/stringUtils.ts +0 -18
  240. package/src/utils/tableUtils.ts +0 -130
  241. package/src/utils/toasts.ts +0 -6
  242. package/src/utils/urlUtils.ts +0 -4
  243. package/tsconfig.icons.json +0 -5
  244. package/tsconfig.json +0 -22
@@ -1,100 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { ButtonHTMLAttributes, FC } from 'react';
3
- import type { IInfoType } from '../../../types/IInfo';
4
- import type { IButtonColor } from '../../Button/Button';
5
- import type { ISplitAction } from '../../Button/SplitButton';
6
- import { useTranslation } from 'react-i18next';
7
- import { Button } from '../../Button/Button';
8
- import { SplitButton } from '../../Button/SplitButton';
9
-
10
- export interface IDialogFooterActions {
11
- confirmButton?: {
12
- label?: string;
13
- icon?: IconDefinition;
14
- onClick?: () => void;
15
- disabled?: boolean;
16
- keepOpen?: boolean;
17
- color?: IButtonColor;
18
- isKeyboardDisabled?: boolean;
19
- type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
20
- splitActions?: ISplitAction[];
21
- };
22
- cancelButton?: {
23
- label?: string;
24
- icon?: IconDefinition;
25
- onClick?: () => void;
26
- hidden?: boolean;
27
- };
28
- additionalButton?: {
29
- label: string;
30
- icon?: IconDefinition;
31
- onClick: () => void;
32
- disabled?: boolean;
33
- keepOpen?: boolean;
34
- color?: IButtonColor;
35
- };
36
- }
37
-
38
- interface Props extends IDialogFooterActions {
39
- onClose: () => void;
40
- isForm?: boolean;
41
- type?: IInfoType;
42
- }
43
-
44
- export const DialogFooter: FC<Props> = ({
45
- confirmButton,
46
- cancelButton,
47
- additionalButton,
48
- onClose,
49
- isForm,
50
- type,
51
- }) => {
52
- const { t } = useTranslation();
53
- const ConfirmButton = confirmButton?.splitActions ? SplitButton : Button;
54
-
55
- return (
56
- <div className="iui-dialog-actions">
57
- {additionalButton && (
58
- <Button
59
- {...additionalButton}
60
- onClick={e => {
61
- e.stopPropagation();
62
- additionalButton.onClick!();
63
- !additionalButton.keepOpen && onClose();
64
- }}
65
- variant="simple"
66
- className="mr-auto"
67
- />
68
- )}
69
- {!cancelButton?.hidden && (
70
- <Button
71
- label={cancelButton?.label ?? t('Close')}
72
- icon={cancelButton?.icon}
73
- variant="outlined"
74
- onClick={e => {
75
- e.stopPropagation();
76
- cancelButton?.onClick?.();
77
- onClose();
78
- }}
79
- type="button"
80
- />
81
- )}
82
- {confirmButton && (
83
- <ConfirmButton
84
- label={confirmButton.label || t('Confirm')}
85
- icon={confirmButton.icon}
86
- variant="solid"
87
- type={confirmButton.type ?? (isForm ? 'submit' : 'button')}
88
- onClick={e => {
89
- e.stopPropagation();
90
- confirmButton.onClick?.();
91
- !confirmButton.keepOpen && !isForm && onClose();
92
- }}
93
- color={(confirmButton.color ?? type === 'danger') ? 'danger' : undefined}
94
- disabled={confirmButton.disabled}
95
- splitActions={confirmButton.splitActions}
96
- />
97
- )}
98
- </div>
99
- );
100
- };
@@ -1,17 +0,0 @@
1
- import type { FC } from 'react';
2
- import { PillBadge } from '../../Badge/PillBadge';
3
-
4
- export const EnvBadge: FC = () => {
5
- // @ts-ignore
6
- const env = import.meta.env.VITE_ENV ?? globalThis.environment;
7
- const isTest = env.includes('TEST');
8
- const isUAT = env.includes('UAT');
9
-
10
- if (!isTest && !isUAT) {
11
- return null;
12
- }
13
-
14
- return (
15
- <PillBadge label={isTest ? 'Test' : 'UAT'} color="warning" className="env-badge" />
16
- );
17
- };
@@ -1,68 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { FC } from 'react';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import clsx from 'clsx';
5
- import { Link } from 'react-router';
6
- import { useIsMenuOpen } from '../../../hooks/useIsMenuOpen';
7
- import { Menu } from '../../Menu/Menu';
8
-
9
- interface Props {
10
- modules: { name: string; icon: IconDefinition; disabled?: boolean; url: string }[];
11
- activeModule: { name: string; icon: IconDefinition } | null;
12
- }
13
-
14
- export const ModuleSelect: FC<Props> = ({ modules, activeModule }) => {
15
- const { isOpen, onOpen, onClose } = useIsMenuOpen();
16
-
17
- return (
18
- <div className="flex align-center gap-1">
19
- {!!modules.length && (
20
- <Menu
21
- isOpen={isOpen}
22
- onClose={onClose}
23
- renderButton={ref => (
24
- <button
25
- ref={ref}
26
- className={clsx('header-button clickable', { active: isOpen })}
27
- onClick={onOpen}
28
- >
29
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
30
- <rect width="256" height="256" fill="none" />
31
- <circle cx="60" cy="60" r="20" />
32
- <circle cx="128" cy="60" r="20" />
33
- <circle cx="196" cy="60" r="20" />
34
- <circle cx="60" cy="128" r="20" />
35
- <circle cx="128" cy="128" r="20" />
36
- <circle cx="196" cy="128" r="20" />
37
- <circle cx="60" cy="196" r="20" />
38
- <circle cx="128" cy="196" r="20" />
39
- <circle cx="196" cy="196" r="20" />
40
- </svg>
41
- </button>
42
- )}
43
- className="modules-menu"
44
- >
45
- {modules.map(e => (
46
- <Link to={e.url} key={e.name}>
47
- <div className="module-item clickable hover-neutral">
48
- <div className="menu-item-icon">
49
- <FontAwesomeIcon icon={e.icon} />
50
- </div>
51
- <p className="menu-item-label">{e.name}</p>
52
- </div>
53
- </Link>
54
- ))}
55
- </Menu>
56
- )}
57
-
58
- {activeModule && (
59
- <Link className="module-name clickable" to="/">
60
- <div className="module-icon">
61
- <FontAwesomeIcon icon={activeModule.icon} />
62
- </div>
63
- <h3>{activeModule.name}</h3>
64
- </Link>
65
- )}
66
- </div>
67
- );
68
- };
@@ -1,204 +0,0 @@
1
- import type { Dispatch, FC, SetStateAction } from 'react';
2
- import type { INotification } from '../../../types/INotifications';
3
- import type { ISelectData } from '../../../types/ISelect';
4
- import { useCallback, useEffect, useState } from 'react';
5
- import {
6
- faBell as faBellLight,
7
- faEllipsisVertical,
8
- faEnvelope,
9
- } from '@inceptionbg/icons';
10
- import clsx from 'clsx';
11
- import { Trans, useTranslation } from 'react-i18next';
12
- import { Link } from 'react-router';
13
- import { faBell } from '../../../assets/icons/duotone/faBell';
14
- import { faEnvelopeDot } from '../../../assets/icons/solid/faEnvelopeDot';
15
- import { useIsMenuOpen } from '../../../hooks/useIsMenuOpen';
16
- import { formatDateAndTime } from '../../../utils/dateUtils';
17
- import { getNotificationValues } from '../../../utils/objectUtils';
18
- import { NotificationBadge } from '../../Badge/NotificationBadge';
19
- import { IconButton } from '../../Button/IconButton';
20
- import { SearchInput } from '../../Inputs/SearchInput';
21
- import { Loader } from '../../Loader/Loader';
22
- import { Menu } from '../../Menu/Menu';
23
-
24
- export interface INotificationsProps {
25
- notificationCount: number;
26
- notifications: INotification[];
27
- isLoading: boolean;
28
- menuControl: { isOpen: boolean; onClose: () => void; onOpen: () => void };
29
- seen: boolean | null;
30
- setSeen: Dispatch<SetStateAction<boolean | null>>;
31
- markAsSeen: (uuid: string) => void;
32
- markAllAsSeen: () => void;
33
- }
34
-
35
- export const Notifications: FC<INotificationsProps> = ({
36
- notificationCount,
37
- notifications = [],
38
- isLoading,
39
- menuControl,
40
- seen,
41
- setSeen,
42
- markAsSeen,
43
- markAllAsSeen,
44
- }) => {
45
- const { t } = useTranslation();
46
- const { isOpen, onClose, onOpen } = menuControl;
47
- const {
48
- isOpen: isOpenOptions,
49
- onClose: onCloseOptions,
50
- onOpen: onOpenOptions,
51
- } = useIsMenuOpen();
52
-
53
- const seenOptions: ISelectData[] = [
54
- { label: t('NotificationsAll'), value: null },
55
- { label: t('NotificationsUnread'), value: false },
56
- { label: t('NotificationsRead'), value: true },
57
- ];
58
-
59
- const [filteredNotifications, setFilteredNotifications] = useState<INotification[]>([]);
60
-
61
- useEffect(() => {
62
- setFilteredNotifications(notifications);
63
- }, [notifications]);
64
-
65
- const onSearch = useCallback(
66
- (e: string) =>
67
- setFilteredNotifications(
68
- !e
69
- ? notifications
70
- : notifications.filter(notification => {
71
- const title = t(`NTitle${notification.event}`);
72
- const description = t(`NContent${notification.event}`, {
73
- ...getNotificationValues(t, notification.values),
74
- });
75
-
76
- const searchContent = `${title} ${description}`.toLowerCase();
77
- const searchWords = e.toLowerCase().trim().split(/\s+/);
78
-
79
- return searchWords.every(word => searchContent.includes(word));
80
- })
81
- ),
82
- [notifications, t]
83
- );
84
-
85
- return (
86
- <Menu
87
- isOpen={isOpen}
88
- onClose={onClose}
89
- placement="bottom-right"
90
- size="m"
91
- className="header-user-menu"
92
- renderButton={ref => (
93
- <NotificationBadge
94
- number={notificationCount}
95
- className="header-btn-badge"
96
- size="s"
97
- >
98
- <IconButton
99
- ref={ref}
100
- icon={!!notificationCount ? faBell : faBellLight}
101
- onClick={onOpen}
102
- className="header-button notification-button"
103
- active={isOpen}
104
- variant="solid"
105
- />
106
- </NotificationBadge>
107
- )}
108
- >
109
- <div className="notifications">
110
- <div className="notifications-content-header">
111
- <h3>{t('Notifications')}</h3>
112
- <SearchInput onSearch={onSearch} />
113
- </div>
114
- <div className="notifications-options">
115
- <div className="flex gap-2">
116
- {seenOptions.map(({ label, value }) => (
117
- <div
118
- key={label}
119
- className={clsx('link fs-13', {
120
- inactive: seen !== value,
121
- })}
122
- onClick={() => setSeen(value)}
123
- >
124
- {label}
125
- </div>
126
- ))}
127
- </div>
128
- <Menu
129
- isOpen={isOpenOptions}
130
- onClose={onCloseOptions}
131
- placement="bottom-right"
132
- size="m"
133
- renderButton={ref => (
134
- <IconButton
135
- ref={ref}
136
- icon={faEllipsisVertical}
137
- onClick={onOpenOptions}
138
- className="header-button notification-button"
139
- active={isOpenOptions}
140
- size="s"
141
- />
142
- )}
143
- items={[{ label: t('MarkAllAsRead'), onClick: markAllAsSeen }]}
144
- />
145
- </div>
146
- <Loader isLoading={isLoading}>
147
- <div className="notifications-container">
148
- {!!filteredNotifications.length ? (
149
- filteredNotifications.map(notification => (
150
- <div
151
- key={notification.uuid}
152
- className={clsx('notification', { seen: notification.seen })}
153
- >
154
- <div className="notification-header">
155
- <div>
156
- <p className="title">{t(`NTitle${notification.event}`)}</p>
157
- <p className="date">{formatDateAndTime(notification.createdAt)}</p>
158
- </div>
159
- <IconButton
160
- // tooltip={t('MarkAsRead')}
161
- icon={notification.seen ? faEnvelope : faEnvelopeDot}
162
- disabled={notification.seen}
163
- onClick={() => markAsSeen(notification.uuid)}
164
- size="s"
165
- />
166
- </div>
167
- <p className="desc">
168
- <Trans
169
- i18nKey={`NContent${notification.event}`}
170
- values={getNotificationValues(t, notification.values)}
171
- t={t}
172
- components={notification.values?.reduce(
173
- (obj, e) =>
174
- e.url
175
- ? {
176
- ...obj,
177
- [e.key]: (
178
- <Link
179
- to={e.url}
180
- className="link"
181
- onClick={() =>
182
- !notification.seen && markAsSeen(notification.uuid)
183
- }
184
- />
185
- ),
186
- }
187
- : obj,
188
- {
189
- bold: <span className="bold" />,
190
- }
191
- )}
192
- />
193
- </p>
194
- </div>
195
- ))
196
- ) : (
197
- <p className="text-center fs-13 pt-2">{t('NoNewNotifications')}</p>
198
- )}
199
- </div>
200
- </Loader>
201
- </div>
202
- </Menu>
203
- );
204
- };
@@ -1,52 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IHeaderUserMenuProps } from '../../../types/IHeader';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import { faCircleUser } from '../../../assets/icons/duotone/faCircleUser';
5
- import { NotificationBadge } from '../../Badge/NotificationBadge';
6
- import { Menu } from '../../Menu/Menu';
7
- import { Tooltip } from '../../Tooltip/Tooltip';
8
-
9
- export const UserMenu: FC<IHeaderUserMenuProps> = ({
10
- isOpen,
11
- setIsOpen,
12
- userName,
13
- organizationName,
14
- menuItems,
15
- inviteCount,
16
- HeaderUserMenuDialogs,
17
- controls,
18
- refetchOrganizationInvites,
19
- }) => (
20
- <>
21
- <Menu
22
- isOpen={isOpen}
23
- onClose={() => setIsOpen(false)}
24
- placement="bottom-right"
25
- size="m"
26
- className="header-user-menu"
27
- items={menuItems}
28
- renderButton={ref => (
29
- <button ref={ref} className="user-box" onClick={() => setIsOpen(true)}>
30
- <FontAwesomeIcon icon={faCircleUser} className="user-icon" />
31
- <NotificationBadge number={inviteCount} className="user-notif-badge" size="s">
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
- </NotificationBadge>
44
- </button>
45
- )}
46
- />
47
- <HeaderUserMenuDialogs
48
- controls={controls}
49
- refetchOrganizationInvites={refetchOrganizationInvites}
50
- />
51
- </>
52
- );
@@ -1,45 +0,0 @@
1
- import type { ComponentProps, FC, ReactElement, ReactNode } from 'react';
2
- import type { IHeaderUserMenuProps } from '../../types/IHeader';
3
- import type { INotificationsProps } from './Components/Notifications';
4
- import { EnvBadge } from './Components/EnvBadge';
5
- import { ModuleSelect } from './Components/ModuleSelect';
6
- import { Notifications } from './Components/Notifications';
7
- import { UserMenu } from './Components/UserMenu';
8
-
9
- interface Props {
10
- customAppProps?: {
11
- title?: string;
12
- logo?: ReactElement;
13
- };
14
- modulesProps?: ComponentProps<typeof ModuleSelect>;
15
- // actions: { icon: IconDefinition };
16
- userMenuProps: IHeaderUserMenuProps;
17
- notificationsProps?: INotificationsProps;
18
- children?: ReactNode;
19
- }
20
-
21
- export const Header: FC<Props> = ({
22
- customAppProps,
23
- modulesProps,
24
- userMenuProps,
25
- notificationsProps,
26
- children,
27
- }) => (
28
- <div className="iui-header">
29
- <div className="flex align-center gap-2">
30
- {modulesProps && <ModuleSelect {...modulesProps} />}
31
- {customAppProps && (
32
- <div className="flex align-center gap-2 ml-2">
33
- {customAppProps?.logo}
34
- {customAppProps?.title && <h3>{customAppProps.title}</h3>}
35
- </div>
36
- )}
37
- <EnvBadge />
38
- </div>
39
- <div className="flex align-center gap-2 ">
40
- {children}
41
- {notificationsProps && <Notifications {...notificationsProps} />}
42
- <UserMenu {...userMenuProps} />
43
- </div>
44
- </div>
45
- );
@@ -1,53 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import { useEffect, useRef, useState } from 'react';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- isOpen: boolean;
7
- children: ReactNode;
8
- keepContentInDom?: boolean;
9
- className?: string;
10
- }
11
-
12
- export const Collapse: FC<Props> = ({
13
- isOpen,
14
- children,
15
- keepContentInDom,
16
- className,
17
- }) => {
18
- const [height, setHeight] = useState<number>();
19
- const [isVisible, setIsVisible] = useState(isOpen);
20
-
21
- const ref = useRef<HTMLDivElement>(null);
22
-
23
- useEffect(() => {
24
- isOpen && setIsVisible(true);
25
- }, [isOpen]);
26
-
27
- useEffect(() => {
28
- const observer = new ResizeObserver(entries => {
29
- const newHeight = Math.ceil(entries[0].contentRect.height);
30
- setHeight(newHeight);
31
- });
32
-
33
- let observerRefValue: HTMLDivElement;
34
- if (ref.current) {
35
- observerRefValue = ref.current;
36
- observer.observe(observerRefValue);
37
- }
38
-
39
- return () => {
40
- observerRefValue && observer.unobserve(observerRefValue);
41
- };
42
- }, [ref]);
43
-
44
- return (
45
- <div
46
- className={clsx('iui-collapse', className)}
47
- style={{ maxHeight: isOpen ? height : 0 }}
48
- onTransitionEnd={() => !isOpen && setIsVisible(false)}
49
- >
50
- <div ref={ref}>{(keepContentInDom || isVisible) && children}</div>
51
- </div>
52
- );
53
- };
@@ -1,53 +0,0 @@
1
- import type { FC, ReactNode, Ref } from 'react';
2
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
- import clsx from 'clsx';
4
- import { faCheck } from '../../assets/icons/solid/faCheck';
5
- import { faMinus } from '../../assets/icons/solid/faMinus';
6
- import { Tooltip } from '../Tooltip/Tooltip';
7
-
8
- export interface ICheckboxProps {
9
- label?: string;
10
- value?: boolean | 'middle';
11
- setValue: (checked: boolean) => void;
12
- required?: boolean;
13
- disabled?: boolean;
14
- className?: string;
15
- tooltip?: string;
16
- children?: ReactNode;
17
- ref?: Ref<HTMLLabelElement>;
18
- }
19
-
20
- export const Checkbox: FC<ICheckboxProps> = ({
21
- label,
22
- value = false,
23
- setValue,
24
- required,
25
- disabled,
26
- className,
27
- tooltip,
28
- children,
29
- ref,
30
- }) => (
31
- <Tooltip label={tooltip || ''}>
32
- <label ref={ref} className={clsx('iui-checkbox', className, { disabled })}>
33
- <div className={clsx('box', { selected: value })}>
34
- {value && (
35
- <FontAwesomeIcon
36
- icon={value === 'middle' ? faMinus : faCheck}
37
- height={14}
38
- width={14}
39
- />
40
- )}
41
- <input
42
- required={required}
43
- disabled={disabled}
44
- className="fake-input"
45
- type="checkbox"
46
- checked={value && value !== 'middle'}
47
- onChange={() => setValue(!value)}
48
- />
49
- </div>
50
- {label ? <p>{label}</p> : children}
51
- </label>
52
- </Tooltip>
53
- );