@inceptionbg/iui 2.0.35 → 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 (241) hide show
  1. package/package.json +4 -1
  2. package/idea/GridTable/GridTable.tsx +0 -119
  3. package/idea/GridTable/gridTable.scss +0 -42
  4. package/idea/Menu/Menu.tsx +0 -121
  5. package/idea/Menu/MenuItem.tsx +0 -75
  6. package/idea/Menu/hooks/useMenuControl.ts +0 -13
  7. package/idea/Menu.tsx +0 -133
  8. package/idea/NoAccessInfo.tsx +0 -193
  9. package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
  10. package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
  11. package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
  12. package/idea/Table/Components/FilterItem.tsx +0 -20
  13. package/idea/Table/Components/Header/TableHeader.tsx +0 -46
  14. package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
  15. package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
  16. package/idea/Table/Components/SetSortList.tsx +0 -30
  17. package/idea/Table/Components/SetTableFilter.tsx +0 -91
  18. package/idea/Table/Components/TableFooter.tsx +0 -137
  19. package/idea/Table/Components/TableOptions.tsx +0 -227
  20. package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
  21. package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
  22. package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
  23. package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
  24. package/idea/Table/Table.tsx +0 -528
  25. package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
  26. package/idea/Table/hooks/useTableKeyboard.ts +0 -137
  27. package/idea/Table/hooks/useTableSelect.ts +0 -11
  28. package/rollup.config.js +0 -52
  29. package/src/assets/icons/duotone/faBell.ts +0 -17
  30. package/src/assets/icons/duotone/faCircleUser.ts +0 -17
  31. package/src/assets/icons/regular/faArrowLeft.ts +0 -15
  32. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
  33. package/src/assets/icons/regular/faCircleCheck.ts +0 -15
  34. package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
  35. package/src/assets/icons/regular/faCircleInfo.ts +0 -15
  36. package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
  37. package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
  38. package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
  39. package/src/assets/icons/solid/faAngleLeft.ts +0 -15
  40. package/src/assets/icons/solid/faAngleRight.ts +0 -15
  41. package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
  42. package/src/assets/icons/solid/faCaretDown.ts +0 -15
  43. package/src/assets/icons/solid/faCheck.ts +0 -15
  44. package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
  45. package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
  46. package/src/assets/icons/solid/faFilter.ts +0 -15
  47. package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
  48. package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
  49. package/src/assets/icons/solid/faListUl.ts +0 -15
  50. package/src/assets/icons/solid/faMinus.ts +0 -15
  51. package/src/assets/icons/solid/faPlus.ts +0 -15
  52. package/src/assets/icons/solid/faPrint.ts +0 -15
  53. package/src/assets/icons/solid/faRotateRight.ts +0 -15
  54. package/src/assets/icons/solid/faXmark.ts +0 -15
  55. package/src/assets/images/logo/inception.svg +0 -22
  56. package/src/assets/images/logo/mts.svg +0 -5703
  57. package/src/assets/images/logo/paperless.svg +0 -21
  58. package/src/assets/images/logo/pismonosa.png +0 -0
  59. package/src/assets/images/not-found.svg +0 -19
  60. package/src/components/Accordions/Accordions.tsx +0 -74
  61. package/src/components/Alert/Alert.tsx +0 -31
  62. package/src/components/Badge/DotBadge.tsx +0 -16
  63. package/src/components/Badge/NotificationBadge.tsx +0 -29
  64. package/src/components/Badge/PillBadge.tsx +0 -13
  65. package/src/components/Button/Button.tsx +0 -56
  66. package/src/components/Button/IconButton.tsx +0 -51
  67. package/src/components/Button/SplitButton.tsx +0 -91
  68. package/src/components/Dashboard/Dashboard.tsx +0 -9
  69. package/src/components/Dashboard/DashboardWidget.tsx +0 -44
  70. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
  71. package/src/components/Dialog/Dialog.tsx +0 -178
  72. package/src/components/Dialog/components/DialogFooter.tsx +0 -100
  73. package/src/components/Header/Components/EnvBadge.tsx +0 -17
  74. package/src/components/Header/Components/ModuleSelect.tsx +0 -68
  75. package/src/components/Header/Components/Notifications.tsx +0 -204
  76. package/src/components/Header/Components/UserMenu.tsx +0 -52
  77. package/src/components/Header/Header.tsx +0 -45
  78. package/src/components/Helper/Collapse.tsx +0 -53
  79. package/src/components/Inputs/Checkbox.tsx +0 -53
  80. package/src/components/Inputs/CurrencyInput.tsx +0 -124
  81. package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
  82. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
  83. package/src/components/Inputs/InputWrapper.tsx +0 -95
  84. package/src/components/Inputs/NumberInput.tsx +0 -86
  85. package/src/components/Inputs/PasswordInput.tsx +0 -39
  86. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
  87. package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
  88. package/src/components/Inputs/Radio.tsx +0 -59
  89. package/src/components/Inputs/RadioGroup.tsx +0 -48
  90. package/src/components/Inputs/RadioLarge.tsx +0 -39
  91. package/src/components/Inputs/SearchInput.tsx +0 -46
  92. package/src/components/Inputs/Selects/Select.tsx +0 -17
  93. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
  94. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
  95. package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
  96. package/src/components/Inputs/TextAreaInput.tsx +0 -68
  97. package/src/components/Inputs/TextInput.tsx +0 -100
  98. package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
  99. package/src/components/List/List.tsx +0 -21
  100. package/src/components/List/ListItem.tsx +0 -70
  101. package/src/components/Loader/Loader.tsx +0 -66
  102. package/src/components/Loader/ProgressBar.tsx +0 -41
  103. package/src/components/Menu/Menu.tsx +0 -81
  104. package/src/components/Menu/MenuItem.tsx +0 -46
  105. package/src/components/Menu/NewMenu.tsx +0 -63
  106. package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
  107. package/src/components/PageComponents/ScrollableContent.tsx +0 -11
  108. package/src/components/Pullover/Pullover.tsx +0 -197
  109. package/src/components/Router/Router.tsx +0 -52
  110. package/src/components/Sidebar/AddButton.tsx +0 -22
  111. package/src/components/Sidebar/Sidebar.tsx +0 -85
  112. package/src/components/Sidebar/SidebarItem.tsx +0 -84
  113. package/src/components/Sidebar/types/ISidebar.ts +0 -28
  114. package/src/components/Table/Table.tsx +0 -258
  115. package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
  116. package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
  117. package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
  118. package/src/components/Table/components/filters/FilterItem.tsx +0 -15
  119. package/src/components/Table/components/filters/TableFilters.tsx +0 -126
  120. package/src/components/Table/components/footer/TableFooter.tsx +0 -126
  121. package/src/components/Table/components/header/TableHeader.tsx +0 -40
  122. package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
  123. package/src/components/Table/components/items/TableItemActions.tsx +0 -78
  124. package/src/components/Table/components/print/TablePrint.tsx +0 -200
  125. package/src/components/Table/components/select/TableSelect.tsx +0 -50
  126. package/src/components/Table/components/sort/TableSort.tsx +0 -75
  127. package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
  128. package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
  129. package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
  130. package/src/components/Table/contexts/TableContext.tsx +0 -117
  131. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
  132. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
  133. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
  134. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
  135. package/src/components/Table/hooks/useTableColumns.ts +0 -34
  136. package/src/components/Table/hooks/useTableEdit.tsx +0 -140
  137. package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
  138. package/src/components/Table/hooks/useTablePagination.ts +0 -19
  139. package/src/components/Table/hooks/useTablePrint.ts +0 -83
  140. package/src/components/Table/hooks/useTableSearch.ts +0 -31
  141. package/src/components/Table/hooks/useTableSelect.ts +0 -19
  142. package/src/components/Table/hooks/useTableSort.ts +0 -8
  143. package/src/components/Tabs/Tabs.tsx +0 -68
  144. package/src/components/Tooltip/Tooltip.tsx +0 -191
  145. package/src/components/Tree/Tree.tsx +0 -22
  146. package/src/components/Tree/TreeItem.tsx +0 -57
  147. package/src/components/Wrappers/AppLayout.tsx +0 -17
  148. package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
  149. package/src/components/Wrappers/FormWrapper.tsx +0 -84
  150. package/src/components/Wrappers/PageLayout.tsx +0 -168
  151. package/src/hooks/useBackgroundClose.ts +0 -19
  152. package/src/hooks/useGetFocusableElements.ts +0 -43
  153. package/src/hooks/useIsMenuOpen.ts +0 -11
  154. package/src/hooks/useLocalPopoverControl.ts +0 -63
  155. package/src/hooks/useOnEsc.ts +0 -14
  156. package/src/hooks/usePopupControl.ts +0 -22
  157. package/src/hooks/useZendesk.ts +0 -22
  158. package/src/index.ts +0 -387
  159. package/src/pages/NoAccessPage.tsx +0 -27
  160. package/src/pages/NotFoundPage.tsx +0 -26
  161. package/src/styles/App.scss +0 -47
  162. package/src/styles/common/_animations.scss +0 -58
  163. package/src/styles/common/_typography.scss +0 -91
  164. package/src/styles/common/helpers/_base.scss +0 -55
  165. package/src/styles/common/helpers/_color.scss +0 -10
  166. package/src/styles/common/helpers/_display.scss +0 -85
  167. package/src/styles/common/helpers/_size.scss +0 -25
  168. package/src/styles/common/maps/_align.scss +0 -21
  169. package/src/styles/common/maps/_buttonMaps.scss +0 -42
  170. package/src/styles/common/maps/_info-types.scss +0 -1
  171. package/src/styles/common/maps/_spacing.scss +0 -78
  172. package/src/styles/common/maps/_text.scss +0 -14
  173. package/src/styles/components/_accordions.scss +0 -51
  174. package/src/styles/components/_alert.scss +0 -23
  175. package/src/styles/components/_badge.scss +0 -84
  176. package/src/styles/components/_button.scss +0 -99
  177. package/src/styles/components/_buttonSplit.scss +0 -74
  178. package/src/styles/components/_card.scss +0 -24
  179. package/src/styles/components/_dialog.scss +0 -119
  180. package/src/styles/components/_form.scss +0 -8
  181. package/src/styles/components/_header.scss +0 -157
  182. package/src/styles/components/_input.scss +0 -167
  183. package/src/styles/components/_inputCheckbox.scss +0 -48
  184. package/src/styles/components/_inputDateTime.scss +0 -161
  185. package/src/styles/components/_inputRadio.scss +0 -83
  186. package/src/styles/components/_inputSelect.scss +0 -8
  187. package/src/styles/components/_list.scss +0 -58
  188. package/src/styles/components/_loader.scss +0 -55
  189. package/src/styles/components/_menu-v2.scss +0 -67
  190. package/src/styles/components/_menu.scss +0 -62
  191. package/src/styles/components/_notifications.scss +0 -71
  192. package/src/styles/components/_page.scss +0 -84
  193. package/src/styles/components/_portal.scss +0 -8
  194. package/src/styles/components/_print.scss +0 -77
  195. package/src/styles/components/_progressBar.scss +0 -83
  196. package/src/styles/components/_pullover.scss +0 -95
  197. package/src/styles/components/_scrollbar.scss +0 -18
  198. package/src/styles/components/_sidebar.scss +0 -204
  199. package/src/styles/components/_smallComponents.scss +0 -23
  200. package/src/styles/components/_table.scss +0 -340
  201. package/src/styles/components/_tabs.scss +0 -33
  202. package/src/styles/components/_tooltip.scss +0 -48
  203. package/src/styles/components/_tree.scss +0 -21
  204. package/src/styles/components/_widget.scss +0 -90
  205. package/src/styles/pages/_fullScreenPage.scss +0 -64
  206. package/src/styles/variables/_bp.scss +0 -6
  207. package/src/styles/variables/_variables.scss +0 -142
  208. package/src/types/Base/custom.d.ts +0 -9
  209. package/src/types/IBasic.ts +0 -32
  210. package/src/types/ICountryCode.ts +0 -5
  211. package/src/types/IError.ts +0 -5
  212. package/src/types/IHeader.ts +0 -40
  213. package/src/types/IInfo.ts +0 -1
  214. package/src/types/IKeyboard.ts +0 -33
  215. package/src/types/IMenu.ts +0 -19
  216. package/src/types/INotifications.ts +0 -15
  217. package/src/types/IPopup.ts +0 -17
  218. package/src/types/IRouter.ts +0 -6
  219. package/src/types/ISelect.ts +0 -54
  220. package/src/types/ITab.ts +0 -10
  221. package/src/types/ITable.ts +0 -291
  222. package/src/types/ITree.ts +0 -6
  223. package/src/utils/InputPatternValidation.ts +0 -12
  224. package/src/utils/dateUtils.ts +0 -32
  225. package/src/utils/fileUtils.ts +0 -177
  226. package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
  227. package/src/utils/i18n/i18nIUILatin.ts +0 -120
  228. package/src/utils/i18n/i18nIUIMe.ts +0 -118
  229. package/src/utils/icons.ts +0 -13
  230. package/src/utils/localStorageHelper.ts +0 -24
  231. package/src/utils/logoUtils.ts +0 -7
  232. package/src/utils/numberUtils.ts +0 -21
  233. package/src/utils/objectUtils.ts +0 -114
  234. package/src/utils/popupUtils.ts +0 -82
  235. package/src/utils/rootDir.ts +0 -1
  236. package/src/utils/stringUtils.ts +0 -18
  237. package/src/utils/tableUtils.ts +0 -130
  238. package/src/utils/toasts.ts +0 -6
  239. package/src/utils/urlUtils.ts +0 -4
  240. package/tsconfig.icons.json +0 -5
  241. package/tsconfig.json +0 -22
@@ -1,197 +0,0 @@
1
- import type { FC, KeyboardEventHandler, ReactNode } from 'react';
2
- import type { ILocalPopupControl } from '../../types/IPopup';
3
- import type { IDialogFooterActions } from '../Dialog/components/DialogFooter';
4
- import { useEffect, useRef } from 'react';
5
- import { faXmark } from '@inceptionbg/icons';
6
- import clsx from 'clsx';
7
- import { createPortal } from 'react-dom';
8
- import { useTranslation } from 'react-i18next';
9
- import { useGetFocusableElements } from '../../hooks/useGetFocusableElements';
10
- import { useLocalPopoverControl } from '../../hooks/useLocalPopoverControl';
11
- import { onPopupKeyDown } from '../../utils/popupUtils';
12
- import { rootDir } from '../../utils/rootDir';
13
- import { Button } from '../Button/Button';
14
- import { IconButton } from '../Button/IconButton';
15
- import { SplitButton } from '../Button/SplitButton';
16
- import { SearchInput } from '../Inputs/SearchInput';
17
- import { Loader } from '../Loader/Loader';
18
- import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
19
-
20
- interface Props {
21
- id?: string;
22
- control: ILocalPopupControl;
23
- header?: {
24
- title: string;
25
- onSearch?: (search: string) => void;
26
- };
27
- isFetching?: boolean;
28
- isLoading?: boolean;
29
- onFormSubmit?: () => void;
30
- onContentClick?: () => void;
31
- onCloseCallback?: () => void;
32
- footer?: IDialogFooterActions;
33
- size?: 'vw25' | 'vw50' | 'vw75' | 'vw100' | 'w500' | 'w600';
34
- className?: string;
35
- contentClassName?: string;
36
- portalTarget?: HTMLElement;
37
- children: ReactNode;
38
- }
39
- export const Pullover: FC<Props> = ({
40
- id,
41
- control,
42
- header,
43
- isFetching = false,
44
- isLoading = false,
45
- onFormSubmit,
46
- onContentClick,
47
- onCloseCallback,
48
- footer,
49
- size = 'vw50',
50
- className,
51
- contentClassName,
52
- portalTarget,
53
- children,
54
- }) => {
55
- const { t } = useTranslation();
56
- const searchRef = useRef<HTMLInputElement>(null);
57
-
58
- const ConfirmButton = footer?.confirmButton?.splitActions ? SplitButton : Button;
59
-
60
- const { elementRef, isOpen, onClose } = useLocalPopoverControl({
61
- control,
62
- onCloseCallback,
63
- });
64
-
65
- const focusableElements = useGetFocusableElements({
66
- elementRef,
67
- isOpen,
68
- autoFocusIndex: header?.onSearch ? 1 : 0,
69
- });
70
-
71
- useEffect(() => {
72
- if (isOpen) {
73
- setTimeout(() => {
74
- elementRef.current?.classList.add('open');
75
- elementRef.current?.focus();
76
- });
77
- }
78
- }, [elementRef, isOpen]);
79
-
80
- const onKeyDown: KeyboardEventHandler<HTMLDivElement> = event => {
81
- onPopupKeyDown(event, {
82
- onClose,
83
- enter: {
84
- onAction: () => {
85
- footer?.confirmButton?.onClick?.();
86
- !footer?.confirmButton?.keepOpen && onClose();
87
- },
88
- disabled: !footer?.confirmButton?.onClick,
89
- },
90
- search: {
91
- onAction: () => searchRef.current?.focus(),
92
- disabled: !header?.onSearch,
93
- },
94
- focusableElements,
95
- });
96
- };
97
-
98
- return isOpen
99
- ? createPortal(
100
- <div
101
- id={id}
102
- ref={elementRef}
103
- className="pullover"
104
- onClick={onClose}
105
- aria-label="popup"
106
- tabIndex={-1}
107
- onKeyDown={onKeyDown}
108
- >
109
- <div className={clsx('container', size)} onClick={e => e.stopPropagation()}>
110
- <div className={clsx('content', className)}>
111
- {header && (
112
- <div className="pullover-header no-print">
113
- <h3>{header.title}</h3>
114
- <div className="flex gap-2">
115
- {header.onSearch && (
116
- <SearchInput
117
- ref={searchRef}
118
- onSearch={header.onSearch}
119
- className="search-input"
120
- />
121
- )}
122
- <IconButton icon={faXmark} onClick={onClose} color="neutral" />
123
- </div>
124
- </div>
125
- )}
126
- <ConditionalWrapper
127
- condition={!!onFormSubmit}
128
- wrapper={children => (
129
- <form
130
- className="pullover-form"
131
- onSubmit={e => {
132
- e.preventDefault();
133
- e.stopPropagation();
134
- onFormSubmit?.();
135
- }}
136
- >
137
- {children}
138
- </form>
139
- )}
140
- >
141
- {/* CONTENT */}
142
- {isLoading ? (
143
- <Loader isLoading isFullPage />
144
- ) : (
145
- <Loader isLoading={isFetching}>
146
- <div
147
- onClick={onContentClick}
148
- className={clsx('pullover-content', contentClassName)}
149
- >
150
- {children}
151
- </div>
152
- </Loader>
153
- )}
154
-
155
- {/* FOOTER */}
156
- {footer && (
157
- <div className={clsx('pullover-footer no-print', className)}>
158
- {footer.additionalButton && (
159
- <Button
160
- {...footer.additionalButton}
161
- disabled={
162
- footer.additionalButton.disabled || isFetching || isLoading
163
- }
164
- variant="simple"
165
- className="mr-auto"
166
- />
167
- )}
168
- <Button
169
- label={t('Close')}
170
- variant="outlined"
171
- onClick={onClose}
172
- disabled={isFetching || isLoading}
173
- />
174
- {footer.confirmButton && (
175
- <ConfirmButton
176
- {...footer.confirmButton}
177
- label={footer.confirmButton.label ?? t('Confirm')}
178
- disabled={
179
- footer.confirmButton.disabled || isFetching || isLoading
180
- }
181
- type={
182
- (footer.confirmButton.type ?? onFormSubmit)
183
- ? 'submit'
184
- : 'button'
185
- }
186
- />
187
- )}
188
- </div>
189
- )}
190
- </ConditionalWrapper>
191
- </div>
192
- </div>
193
- </div>,
194
- portalTarget ?? rootDir
195
- )
196
- : null;
197
- };
@@ -1,52 +0,0 @@
1
- import type { ComponentProps, FC } from 'react';
2
- import type { IRoute } from '../../types/IRouter';
3
- import type { Header } from '../Header/Header';
4
- import type { Sidebar } from '../Sidebar/Sidebar';
5
- import { lazy, Suspense } from 'react';
6
- import { Route, Routes } from 'react-router';
7
- import { FullScreenLoader, LazyLoader } from '../Loader/Loader';
8
- import { AppLayout } from '../Wrappers/AppLayout';
9
-
10
- const NoAccessPage = lazy(() => import('../../pages/NoAccessPage'));
11
- const NotFoundPage = lazy(() => import('../../pages/NotFoundPage'));
12
-
13
- const commonFullScreenRoutes: IRoute[] = [
14
- { path: '/*', element: <NotFoundPage /> },
15
- { path: '/no-access', element: <NoAccessPage /> },
16
- ];
17
-
18
- interface Props {
19
- fullScreenRoutes: IRoute[];
20
- appRoutes: IRoute[];
21
- header: ComponentProps<typeof Header>;
22
- sidebar: ComponentProps<typeof Sidebar>;
23
- }
24
-
25
- export const Router: FC<Props> = ({ fullScreenRoutes, appRoutes, header, sidebar }) => (
26
- <Routes>
27
- {fullScreenRoutes.concat(commonFullScreenRoutes).map(route => (
28
- <Route
29
- key={route.path}
30
- path={route.path}
31
- element={
32
- route.element && (
33
- <Suspense fallback={<FullScreenLoader isLoading />}>{route.element}</Suspense>
34
- )
35
- }
36
- />
37
- ))}
38
- {appRoutes.map(route => (
39
- <Route
40
- key={route.path}
41
- path={route.path}
42
- element={
43
- route.element && (
44
- <AppLayout header={header} sidebar={sidebar}>
45
- <Suspense fallback={<LazyLoader />}>{route.element}</Suspense>
46
- </AppLayout>
47
- )
48
- }
49
- />
50
- ))}
51
- </Routes>
52
- );
@@ -1,22 +0,0 @@
1
- import type { FC } from 'react';
2
- import { useNavigate } from 'react-router';
3
- import { faPlus } from '../../assets/icons/solid/faPlus';
4
- import { IconButton } from '../Button/IconButton';
5
-
6
- interface Props {
7
- link: string;
8
- }
9
- export const AddButton: FC<Props> = ({ link }) => {
10
- const navigate = useNavigate();
11
- return (
12
- <IconButton
13
- className="add-button"
14
- icon={faPlus}
15
- size="s"
16
- onClick={e => {
17
- e.preventDefault();
18
- navigate(link);
19
- }}
20
- />
21
- );
22
- };
@@ -1,85 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IOrgLogo } from '../../utils/logoUtils';
3
- import type { ISidebarItem } from './types/ISidebar';
4
- import { Fragment, useEffect, useRef, useState } from 'react';
5
- import clsx from 'clsx';
6
- import { faAngleLeft } from '../../assets/icons/solid/faAngleLeft';
7
- import { orgLogo } from '../../utils/logoUtils';
8
- import { IconButton } from '../Button/IconButton';
9
- import { SidebarItem } from './SidebarItem';
10
-
11
- export interface ISidebarProps {
12
- items: ISidebarItem[][];
13
- logo?: IOrgLogo;
14
- customLogo?: string;
15
- appVersion?: string;
16
- }
17
- export const Sidebar: FC<ISidebarProps> = ({ items, logo, customLogo, appVersion }) => {
18
- const [itemsList, setItemsList] = useState<ISidebarItem[][]>([]);
19
- const [collapsed, setCollapsed] = useState(false);
20
- const [openedMenu, setOpenedMenu] = useState('');
21
-
22
- const sidebarRef = useRef<HTMLDivElement | null>(null);
23
-
24
- useEffect(() => {
25
- // Filter out hidden items & items without visible content
26
- const newItems = items.map(list =>
27
- list.filter(
28
- item => !item.hidden && (item.to || item.content?.some(item => !item.hidden))
29
- )
30
- );
31
- setItemsList(newItems);
32
- }, [items, setItemsList]);
33
-
34
- return (
35
- <div ref={sidebarRef} className={clsx('iui-sidebar', { collapsed })}>
36
- {/* ////// TOGGLE ////// */}
37
- <IconButton
38
- icon={faAngleLeft}
39
- className={clsx('iui-collapse-btn', {
40
- 'fa-flip-horizontal': collapsed,
41
- collapsed,
42
- })}
43
- size="s"
44
- onClick={() => setCollapsed(!collapsed)}
45
- />
46
-
47
- <div className="iui-sidebar-content">
48
- {/* ////// SIDEBAR ITEMS ////// */}
49
- <div className="iui-sidebar-items">
50
- {itemsList.map((e, i) => (
51
- <Fragment key={i}>
52
- {i > 0 && !!e.length && <hr />}
53
- {e.map(
54
- item =>
55
- !item.hidden && (
56
- <SidebarItem
57
- {...item}
58
- key={item.label}
59
- menu={
60
- item.content
61
- ? { content: item.content, openedMenu, setOpenedMenu }
62
- : undefined
63
- }
64
- />
65
- )
66
- )}
67
- </Fragment>
68
- ))}
69
- </div>
70
- </div>
71
- {/* ////// FOOTER ////// */}
72
- <div className={clsx('sidebar-footer', { collapsed })}>
73
- {(logo ?? customLogo) && (
74
- <img
75
- className="sidebar-logo"
76
- // src={!!organization?.reseller ? orgLogo[organization?.reseller] : logo}
77
- src={customLogo || orgLogo[logo || 'INC']}
78
- alt="logo"
79
- />
80
- )}
81
- {appVersion && <p>{appVersion}</p>}
82
- </div>
83
- </div>
84
- );
85
- };
@@ -1,84 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ISidebarItem } from './types/ISidebar';
3
- import { faChevronDown } from '@inceptionbg/icons';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import clsx from 'clsx';
6
- import { Link, useLocation } from 'react-router';
7
- import { Collapse } from '../Helper/Collapse';
8
- import { Tooltip } from '../Tooltip/Tooltip';
9
- import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
10
- import { AddButton } from './AddButton';
11
-
12
- export const SidebarItem: FC<ISidebarItem> = ({ label, icon, to, badge, menu }) => {
13
- const { pathname } = useLocation();
14
-
15
- return (
16
- <>
17
- <ConditionalWrapper
18
- condition={!!to}
19
- wrapper={children => <Link to={to!}>{children}</Link>}
20
- >
21
- <div
22
- onClick={
23
- menu
24
- ? () => menu.setOpenedMenu(label !== menu.openedMenu ? label : '')
25
- : undefined
26
- }
27
- className={clsx('iui-sidebar-item item-only clickable', {
28
- active:
29
- to === pathname ||
30
- (menu?.content.find(e => e.to === pathname) && label !== menu?.openedMenu),
31
- })}
32
- >
33
- <FontAwesomeIcon icon={icon!} className="sidebar-item-icon" />
34
- <p className="sidebar-item-label">{label}</p>
35
- {!!badge && <div className="sidebar-badge">{badge > 99 ? '99+' : badge}</div>}
36
- {menu && (
37
- <FontAwesomeIcon
38
- icon={faChevronDown}
39
- className={clsx('sidebar-expand-icon', {
40
- rotate: label === menu.openedMenu,
41
- })}
42
- />
43
- )}
44
- </div>
45
- </ConditionalWrapper>
46
-
47
- {menu && (
48
- <Collapse isOpen={menu.openedMenu === label}>
49
- {menu.content.map(
50
- ({ hidden, label, to, primary, badge, addUrl, tooltip }) =>
51
- !hidden && (
52
- <ConditionalWrapper
53
- key={label}
54
- condition={!!to}
55
- wrapper={children => <Link to={to!}>{children}</Link>}
56
- >
57
- <Tooltip
58
- label={tooltip!}
59
- disabled={!tooltip}
60
- position="right"
61
- singleLine
62
- >
63
- <div
64
- className={clsx('iui-sidebar-item sub-item', {
65
- clickable: !!to,
66
- active: to === pathname,
67
- primary,
68
- })}
69
- >
70
- <p className="sidebar-item-label">{label}</p>
71
- {!!badge && (
72
- <div className="sidebar-badge">{badge > 99 ? '99+' : badge}</div>
73
- )}
74
- {!!addUrl && <AddButton link={addUrl} />}
75
- </div>
76
- </Tooltip>
77
- </ConditionalWrapper>
78
- )
79
- )}
80
- </Collapse>
81
- )}
82
- </>
83
- );
84
- };
@@ -1,28 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
-
3
- export interface ISidebarItem {
4
- label: string;
5
- icon?: IconDefinition;
6
- to?: string;
7
- content?: ISidebarSubItem[];
8
- menu?: {
9
- content: ISidebarSubItem[];
10
- openedMenu: string;
11
- setOpenedMenu: (label: string) => void;
12
- };
13
- hidden?: boolean;
14
- badge?: number;
15
- addUrl?: string;
16
- }
17
-
18
- export interface ISidebarSubItem {
19
- label: string;
20
- to?: string;
21
- content?: ISidebarItem[];
22
- hidden?: boolean;
23
- tooltip?: string;
24
- badge?: number;
25
- addUrl?: string;
26
- primary?: boolean;
27
- collapsed?: boolean;
28
- }