@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,191 +0,0 @@
1
- import type { Dispatch, FC, ReactElement, Ref, SetStateAction } from 'react';
2
- import { cloneElement, useEffect, useRef, useState } from 'react';
3
- import clsx from 'clsx';
4
- import { createPortal } from 'react-dom';
5
- import { rootDir } from '../../utils/rootDir';
6
-
7
- export type TooltipPosition = 'left' | 'right' | 'top' | 'bottom';
8
-
9
- interface Props {
10
- label?: string;
11
- position?: TooltipPosition;
12
- disabled?: boolean;
13
- singleLine?: boolean;
14
- className?: string;
15
- children: ReactElement;
16
- ref?: Ref<HTMLElement> | null;
17
- }
18
-
19
- export const Tooltip: FC<Props> = ({
20
- label,
21
- position = 'top',
22
- disabled,
23
- singleLine,
24
- className,
25
- children,
26
- ref,
27
- }) => {
28
- const [newPosition, setNewPosition] = useState<TooltipPosition | ''>('');
29
-
30
- const internalRef = useRef<HTMLElement>(null);
31
- const tooltipRef = useRef<HTMLDivElement>(null);
32
-
33
- useEffect(() => {
34
- if (!disabled && !!label) {
35
- const getContainer = () => {
36
- if (ref && 'current' in ref) {
37
- return ref.current;
38
- }
39
- return internalRef.current;
40
- };
41
-
42
- const container = getContainer();
43
- const tooltip = tooltipRef.current;
44
-
45
- const onMouseEnter = () => {
46
- if (container && tooltip) {
47
- setAbsolutePosition(container, tooltip, position, setNewPosition);
48
- tooltip.classList.add('visible');
49
- }
50
- };
51
- const onMouseLeave = () => tooltip?.classList.remove('visible');
52
-
53
- if (container) {
54
- container.addEventListener('mouseenter', onMouseEnter);
55
- container.addEventListener('mouseleave', onMouseLeave);
56
-
57
- return () => {
58
- container.removeEventListener('mouseenter', onMouseEnter);
59
- container.removeEventListener('mouseleave', onMouseLeave);
60
- };
61
- }
62
- }
63
- }, [disabled, label, position, ref]);
64
-
65
- return !!label && !disabled ? (
66
- <>
67
- {/* @ts-ignore */}
68
- {cloneElement(children, { ref: ref || internalRef })}
69
- {createPortal(
70
- <div
71
- ref={tooltipRef}
72
- className={clsx('tooltip-container', className, {
73
- 'no-wrap': singleLine,
74
- })}
75
- >
76
- <div className="tooltip">
77
- <div className={clsx('arrow', newPosition || position)} />
78
- <div>{label}</div>
79
- </div>
80
- </div>,
81
- rootDir
82
- )}
83
- </>
84
- ) : (
85
- children
86
- );
87
- };
88
-
89
- const setAbsolutePosition = (
90
- containerEl: HTMLElement,
91
- targetEl: HTMLDivElement,
92
- position: TooltipPosition,
93
- setNewPosition: Dispatch<SetStateAction<TooltipPosition | ''>>
94
- ) => {
95
- const containerRect = containerEl.getBoundingClientRect();
96
- const tooltipRect = targetEl.getBoundingClientRect();
97
- const margin = 16; // Distance from container
98
- const screenPadding = 8; // Minimum distance from screen edges
99
-
100
- if (position === 'bottom' || position === 'top') {
101
- const bottom = Math.floor(containerRect.bottom + margin);
102
- const top = Math.floor(containerRect.top - tooltipRect.height - margin);
103
- let leftCenter = Math.floor(
104
- containerRect.left + containerRect.width / 2 - tooltipRect.width / 2
105
- );
106
-
107
- // Check if tooltip overflows horizontally and adjust
108
- if (leftCenter < screenPadding) {
109
- targetEl.style.width = `${tooltipRect.width + leftCenter}px`;
110
- leftCenter = screenPadding;
111
- } else if (leftCenter + tooltipRect.width > window.innerWidth - screenPadding) {
112
- leftCenter = window.innerWidth - tooltipRect.width - screenPadding;
113
- }
114
-
115
- const reverse =
116
- position === 'top' ? top < 0 : bottom + tooltipRect.height > window.innerHeight;
117
-
118
- setNewPosition(reverse ? (position === 'bottom' ? 'top' : 'bottom') : '');
119
-
120
- let finalTop =
121
- position === 'bottom' ? (reverse ? top : bottom) : reverse ? bottom : top;
122
-
123
- // Ensure tooltip doesn't go above screen
124
- if (finalTop < screenPadding) {
125
- finalTop = screenPadding;
126
- }
127
- // Ensure tooltip doesn't go below screen
128
- if (finalTop + tooltipRect.height > window.innerHeight - screenPadding) {
129
- finalTop = window.innerHeight - tooltipRect.height - screenPadding;
130
- }
131
-
132
- targetEl.style.top = `${finalTop}px`;
133
- targetEl.style.left = `${leftCenter}px`;
134
- } else if (position === 'right') {
135
- let finalTop = Math.floor(
136
- containerRect.top + containerRect.height / 2 - tooltipRect.height / 2
137
- );
138
- let finalLeft = Math.floor(containerRect.right + margin);
139
-
140
- // Check if tooltip overflows vertically and adjust
141
- if (finalTop < screenPadding) {
142
- finalTop = screenPadding;
143
- } else if (finalTop + tooltipRect.height > window.innerHeight - screenPadding) {
144
- finalTop = window.innerHeight - tooltipRect.height - screenPadding;
145
- }
146
-
147
- // Check if tooltip overflows to the right and flip to left
148
- if (finalLeft + tooltipRect.width > window.innerWidth - screenPadding) {
149
- finalLeft = Math.floor(containerRect.left - tooltipRect.width - margin);
150
- setNewPosition('left');
151
-
152
- // If it still overflows on the left, position it at the edge
153
- if (finalLeft < screenPadding) {
154
- finalLeft = screenPadding;
155
- }
156
- } else {
157
- setNewPosition('');
158
- }
159
-
160
- targetEl.style.top = `${finalTop}px`;
161
- targetEl.style.left = `${finalLeft}px`;
162
- } else if (position === 'left') {
163
- let finalTop = Math.floor(
164
- containerRect.top + containerRect.height / 2 - tooltipRect.height / 2
165
- );
166
- let finalLeft = Math.floor(containerRect.left - tooltipRect.width - margin);
167
-
168
- // Check if tooltip overflows vertically and adjust
169
- if (finalTop < screenPadding) {
170
- finalTop = screenPadding;
171
- } else if (finalTop + tooltipRect.height > window.innerHeight - screenPadding) {
172
- finalTop = window.innerHeight - tooltipRect.height - screenPadding;
173
- }
174
-
175
- // Check if tooltip overflows to the left and flip to right
176
- if (finalLeft < screenPadding) {
177
- finalLeft = Math.floor(containerRect.right + margin);
178
- setNewPosition('right');
179
-
180
- // If it still overflows on the right, position it at the edge
181
- if (finalLeft + tooltipRect.width > window.innerWidth - screenPadding) {
182
- finalLeft = window.innerWidth - tooltipRect.width - screenPadding;
183
- }
184
- } else {
185
- setNewPosition('');
186
- }
187
-
188
- targetEl.style.top = `${finalTop}px`;
189
- targetEl.style.left = `${finalLeft}px`;
190
- }
191
- };
@@ -1,22 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITreeItem } from '../../types/ITree';
3
- import { TreeItem } from './TreeItem';
4
-
5
- interface Props {
6
- data: ITreeItem[];
7
- selectedItemUuid?: string;
8
- onClick: (itemUuid: string) => void;
9
- }
10
-
11
- export const Tree: FC<Props> = ({ data, selectedItemUuid, onClick }) => (
12
- <div>
13
- {data.map(item => (
14
- <TreeItem
15
- key={item.uuid}
16
- item={item}
17
- onClick={onClick}
18
- selectedItemUuid={selectedItemUuid}
19
- />
20
- ))}
21
- </div>
22
- );
@@ -1,57 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITreeItem } from '../../types/ITree';
3
- import { useState } from 'react';
4
- import { faChevronRight } from '@inceptionbg/icons';
5
- import clsx from 'clsx';
6
- import { IconButton } from '../Button/IconButton';
7
- import { Collapse } from '../Helper/Collapse';
8
-
9
- interface Props {
10
- item: ITreeItem;
11
- onClick: (itemUuid: string) => void;
12
- selectedItemUuid?: string;
13
- className?: string;
14
- }
15
-
16
- export const TreeItem: FC<Props> = ({ item, onClick, selectedItemUuid, className }) => {
17
- const [isOpen, setIsOpen] = useState(false);
18
-
19
- const hasChildren = !!item.children?.length;
20
- return (
21
- <div className={clsx('tree-item', className)}>
22
- <div className="flex align-center">
23
- <div className="extendable-icon">
24
- {hasChildren && (
25
- <IconButton
26
- icon={faChevronRight}
27
- onClick={() => setIsOpen(!isOpen)}
28
- size="s"
29
- className={clsx('rotate', { rotate90: isOpen })}
30
- />
31
- )}
32
- </div>
33
- <div
34
- className={clsx('tree-item-name clickable', {
35
- active: selectedItemUuid === item.uuid,
36
- })}
37
- onClick={() => onClick(item.uuid)}
38
- >
39
- {item.name}
40
- </div>
41
- </div>
42
- {hasChildren && (
43
- <Collapse isOpen={isOpen}>
44
- {item.children?.map((child: ITreeItem) => (
45
- <TreeItem
46
- key={child.uuid}
47
- item={child}
48
- onClick={onClick}
49
- className={clsx('ml-3', className)}
50
- selectedItemUuid={selectedItemUuid}
51
- />
52
- ))}
53
- </Collapse>
54
- )}
55
- </div>
56
- );
57
- };
@@ -1,17 +0,0 @@
1
- import type { ComponentProps, FC, ReactNode } from 'react';
2
- import { Header } from '../Header/Header';
3
- import { Sidebar } from '../Sidebar/Sidebar';
4
-
5
- interface Props {
6
- header: ComponentProps<typeof Header>;
7
- sidebar: ComponentProps<typeof Sidebar>;
8
- children: ReactNode;
9
- }
10
-
11
- export const AppLayout: FC<Props> = ({ header, sidebar, children }) => (
12
- <div className="app-layout">
13
- <Header {...header} />
14
- <Sidebar {...sidebar} />
15
- <div className="app-content">{children}</div>
16
- </div>
17
- );
@@ -1,10 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
-
3
- interface Props {
4
- condition: boolean;
5
- wrapper: (children: ReactNode) => ReactNode;
6
- children: ReactNode;
7
- }
8
-
9
- export const ConditionalWrapper: FC<Props> = ({ condition, wrapper, children }) =>
10
- condition ? wrapper(children) : children;
@@ -1,84 +0,0 @@
1
- import type { FC, FormEvent, ReactNode } from 'react';
2
- import type { IButtonColor, IButtonVariant } from '../Button/Button';
3
- import { useTranslation } from 'react-i18next';
4
- import { Button } from '../Button/Button';
5
- import { Loader } from '../Loader/Loader';
6
-
7
- export interface IFormWrapper {
8
- isLoading: boolean;
9
- className?: string;
10
- submitButton: {
11
- label?: string;
12
- icon?: any;
13
- disabled?: boolean;
14
- onSubmit: (e: FormEvent<HTMLFormElement>) => void;
15
- variant?: IButtonVariant;
16
- color?: IButtonColor;
17
- };
18
- otherButtons?: {
19
- label: string;
20
- icon?: any;
21
- onClick: () => void;
22
- variant?: IButtonVariant;
23
- color?: IButtonColor;
24
- disabled?: boolean;
25
- hidden?: boolean;
26
- }[];
27
- noAccess?: boolean;
28
- children: ReactNode;
29
- }
30
-
31
- export const FormWrapper: FC<IFormWrapper> = ({
32
- isLoading,
33
- noAccess,
34
- submitButton,
35
- otherButtons,
36
- className,
37
- children,
38
- }) => {
39
- const { t } = useTranslation();
40
-
41
- return (
42
- <Loader isLoading={isLoading}>
43
- <form
44
- className={className}
45
- onSubmit={e => {
46
- e.preventDefault();
47
- e.stopPropagation();
48
- !submitButton.disabled && submitButton.onSubmit(e);
49
- }}
50
- >
51
- {children}
52
- {(!noAccess || otherButtons) && (
53
- <div className="iui-form-actions">
54
- {otherButtons?.map(
55
- e =>
56
- !e.hidden && (
57
- <Button
58
- key={e.label}
59
- label={e.label}
60
- icon={e.icon}
61
- disabled={isLoading || e.disabled}
62
- variant={e.variant}
63
- color={e.color}
64
- onClick={e.onClick}
65
- type="button"
66
- />
67
- )
68
- )}
69
- {!noAccess && (
70
- <Button
71
- label={submitButton.label ?? t('Save')}
72
- // icon={submitButton.icon}
73
- disabled={isLoading || submitButton.disabled}
74
- variant={submitButton.variant}
75
- color={submitButton.color}
76
- type="submit"
77
- />
78
- )}
79
- </div>
80
- )}
81
- </form>
82
- </Loader>
83
- );
84
- };
@@ -1,168 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import type { IHeaderAction } from '../../types/IHeader';
3
- import type { IMenuItem } from '../../types/IMenu';
4
- import { useLayoutEffect, useState } from 'react';
5
- import { faArrowLeft, faEllipsisVertical, faQuestion } from '@inceptionbg/icons';
6
- import clsx from 'clsx';
7
- import { Trans } from 'react-i18next';
8
- import { Link, useNavigate } from 'react-router';
9
- import { usePopupControl } from '../../hooks/usePopupControl';
10
- import { Button } from '../Button/Button';
11
- import { IconButton } from '../Button/IconButton';
12
- import { Loader } from '../Loader/Loader';
13
- import { Menu } from '../Menu/Menu';
14
- import { Pullover } from '../Pullover/Pullover';
15
- import { ConditionalWrapper } from './ConditionalWrapper';
16
-
17
- export interface IPageLayoutProps {
18
- breadcrumbs?: (string | undefined)[];
19
- actions?: IHeaderAction[];
20
- moreActions?: IMenuItem[];
21
- backButton?: {
22
- url?: string;
23
- active: boolean;
24
- };
25
- help?: {
26
- title: string;
27
- descEl: ReactNode;
28
- };
29
- noAccess?: boolean;
30
- isInitiallyLoading?: boolean;
31
- isLoading?: boolean;
32
- footer?: {
33
- default?: boolean;
34
- text?: string;
35
- custom?: ReactNode;
36
- };
37
- children?: ReactNode;
38
- }
39
-
40
- export const PageLayout: FC<IPageLayoutProps> = ({
41
- breadcrumbs,
42
- actions,
43
- moreActions,
44
- backButton,
45
- help,
46
- noAccess,
47
- isLoading,
48
- isInitiallyLoading,
49
- footer,
50
- children,
51
- }) => {
52
- const [isMoreActionsOpen, setIsMoreActionsOpen] = useState(false);
53
- const helpControl = usePopupControl();
54
-
55
- const navigate = useNavigate();
56
- const filteredActions = moreActions?.filter(e => !e.hidden);
57
-
58
- useLayoutEffect(() => {
59
- noAccess && navigate('/no-access', { replace: true });
60
- }, [noAccess, navigate]);
61
-
62
- if (noAccess) {
63
- return null;
64
- }
65
-
66
- if (isInitiallyLoading) {
67
- return <Loader isLoading isFullPage />;
68
- }
69
-
70
- return (
71
- <Loader isLoading={!!isLoading}>
72
- <div className="page-container">
73
- {breadcrumbs && (
74
- <div className="page-header">
75
- <div className="flex align-center gap-2">
76
- {backButton?.active && (
77
- <IconButton
78
- icon={faArrowLeft}
79
- onClick={() =>
80
- backButton.url ? navigate(backButton.url) : navigate(-1)
81
- }
82
- // outlined
83
- // size="s"
84
- />
85
- )}
86
- {/* ////// BREADCRUMBS ////// */}
87
- <h3 className="breadcrumbs">
88
- {breadcrumbs.reduce(
89
- (acc: string, e) => (e ? (acc ? `${acc} / ${e}` : e) : acc),
90
- ''
91
- )}
92
- </h3>
93
- </div>
94
- {/* ////// ACTIONS ////// */}
95
- <div className="flex align-center gap-2">
96
- {help && (
97
- <>
98
- <IconButton
99
- icon={faQuestion}
100
- onClick={helpControl.onOpen}
101
- variant="outlined"
102
- size="s"
103
- />
104
- <Pullover
105
- control={helpControl.control}
106
- header={{
107
- title: help.title,
108
- }}
109
- size="vw50"
110
- >
111
- {help.descEl}
112
- </Pullover>
113
- </>
114
- )}
115
- {!!filteredActions?.length && (
116
- <Menu
117
- // id="page-more-actions"
118
- isOpen={isMoreActionsOpen}
119
- onClose={() => setIsMoreActionsOpen(false)}
120
- placement="bottom-right"
121
- renderButton={ref => (
122
- <IconButton
123
- ref={ref}
124
- icon={faEllipsisVertical}
125
- active={isMoreActionsOpen}
126
- onClick={() => setIsMoreActionsOpen(!isMoreActionsOpen)}
127
- variant="outlined"
128
- size="s"
129
- />
130
- )}
131
- items={filteredActions}
132
- />
133
- )}
134
- {actions?.map(
135
- action =>
136
- !action.hidden && (
137
- <ConditionalWrapper
138
- key={action.label}
139
- condition={!!action.to}
140
- wrapper={children => <Link to={action.to!}>{children}</Link>}
141
- >
142
- <Button key={action.label} {...action} />
143
- </ConditionalWrapper>
144
- )
145
- )}
146
- </div>
147
- </div>
148
- )}
149
- <div className="page-content">{children}</div>
150
- {footer && (
151
- <footer
152
- className={clsx('page-footer', {
153
- 'm-0': footer?.default || footer?.text,
154
- })}
155
- >
156
- {footer.custom ? (
157
- footer.custom
158
- ) : (
159
- <p className="page-footer-text">
160
- {footer.default ? <Trans i18nKey="FooterText" /> : footer.text}
161
- </p>
162
- )}
163
- </footer>
164
- )}
165
- </div>
166
- </Loader>
167
- );
168
- };
@@ -1,19 +0,0 @@
1
- import type { RefObject } from 'react';
2
- import { useEffect } from 'react';
3
-
4
- interface Props {
5
- disabled?: boolean;
6
- portalRef: RefObject<HTMLDivElement | null>;
7
- handleClose: () => void;
8
- }
9
-
10
- export const useBackgroundClose = ({ portalRef, disabled, handleClose }: Props) => {
11
- useEffect(() => {
12
- if (!disabled) {
13
- const portal = portalRef.current;
14
- const handleClick = (ev: MouseEvent) => ev.target === portal && handleClose();
15
- portal?.addEventListener('click', handleClick);
16
- return () => portal?.removeEventListener('click', handleClick);
17
- }
18
- }, [portalRef, disabled, handleClose]);
19
- };
@@ -1,43 +0,0 @@
1
- import type { RefObject } from 'react';
2
- import { useEffect, useState } from 'react';
3
-
4
- export const useGetFocusableElements = ({
5
- elementRef,
6
- isOpen,
7
- autoFocusIndex,
8
- }: {
9
- elementRef: RefObject<HTMLDivElement | null>;
10
- isOpen: boolean;
11
- autoFocusIndex?: number;
12
- }) => {
13
- const [focusableElements, setFocusableElements] = useState<HTMLElement[]>([]);
14
-
15
- useEffect(() => {
16
- const element = elementRef.current;
17
- if (!element || !isOpen) return;
18
-
19
- const focusableSelectors = [
20
- 'button:not([disabled]):not([tabindex="-1"])',
21
- 'input:not([disabled]):not([tabindex="-1"])',
22
- 'textarea:not([disabled]):not([tabindex="-1"])',
23
- // 'select:not([disabled]):not([tabindex="-1"])',
24
- ];
25
-
26
- const focusables = Array.from(
27
- element.querySelectorAll<HTMLElement>(focusableSelectors.join(','))
28
- );
29
-
30
- setFocusableElements(focusables);
31
-
32
- // Autofocus
33
- if (typeof autoFocusIndex === 'number' && focusables.length > autoFocusIndex) {
34
- setTimeout(() => {
35
- focusables[autoFocusIndex].focus();
36
- }, 200);
37
- } else {
38
- element.focus();
39
- }
40
- }, [elementRef, isOpen, autoFocusIndex]);
41
-
42
- return focusableElements;
43
- };
@@ -1,11 +0,0 @@
1
- import { useState } from 'react';
2
-
3
- export const useIsMenuOpen = () => {
4
- const [isOpen, setIsOpen] = useState(false);
5
-
6
- return {
7
- isOpen,
8
- onOpen: () => setIsOpen(true),
9
- onClose: () => setTimeout(() => setIsOpen(false)),
10
- };
11
- };
@@ -1,63 +0,0 @@
1
- import type {
2
- DeclarativeDialogProps,
3
- ImperativeDialogProps,
4
- } from '../components/Dialog/Dialog';
5
- import { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
6
-
7
- type Props = (ImperativeDialogProps | DeclarativeDialogProps) & {
8
- onCloseCallback?: () => void;
9
- };
10
-
11
- export const useLocalPopoverControl = (props: Props) => {
12
- const { control, onCloseCallback, isOpen: propsIsOpen, onClose } = props;
13
- const elementRef = useRef<HTMLDivElement>(null);
14
- const timeoutRef = useRef<NodeJS.Timeout | null>(null);
15
-
16
- // Determine the operation mode
17
- const isImperative = !!control;
18
- const shouldBeOpen = isImperative ? control.isOpen : propsIsOpen;
19
-
20
- const [isMounted, setIsMounted] = useState(shouldBeOpen);
21
-
22
- // 3. Handle State Synchronization and Animation
23
- useEffect(() => {
24
- if (shouldBeOpen && !isMounted) {
25
- timeoutRef.current && clearTimeout(timeoutRef.current);
26
- elementRef.current?.classList.remove('closing');
27
- setIsMounted(true);
28
- } else if (!shouldBeOpen && isMounted) {
29
- elementRef.current?.classList.add('closing');
30
- timeoutRef.current = setTimeout(() => {
31
- setIsMounted(false);
32
- onCloseCallback?.();
33
- }, 200);
34
- }
35
-
36
- return () => {
37
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
38
- };
39
- }, [shouldBeOpen, isMounted, onCloseCallback]);
40
-
41
- const handleCloseRequest = useCallback(() => {
42
- if (isImperative) {
43
- control.setIsOpen(false);
44
- } else {
45
- onClose();
46
- }
47
- }, [isImperative, control, onClose]);
48
-
49
- const handleOpenRequest = useCallback(() => {
50
- if (isImperative) control.setIsOpen(true);
51
- }, [isImperative, control]);
52
-
53
- useImperativeHandle(control?.controlRef, () => ({
54
- onOpen: handleOpenRequest,
55
- onClose: handleCloseRequest,
56
- }));
57
-
58
- return {
59
- isOpen: isMounted,
60
- onClose: handleCloseRequest,
61
- elementRef,
62
- };
63
- };