@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,100 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { FC, FocusEventHandler, InputHTMLAttributes, Ref } from 'react';
3
- import { useState } from 'react';
4
- import { InputWrapper } from './InputWrapper';
5
-
6
- export interface ITextInputProps {
7
- id?: string;
8
- label?: string;
9
- value?: string;
10
- setValue?: (value: string) => void;
11
- required?: boolean;
12
- disabled?: boolean;
13
- endText?: string;
14
- endButton?: {
15
- icon: IconDefinition;
16
- onClick: () => void;
17
- disabled?: boolean;
18
- };
19
- isClearable?: boolean;
20
- onClear?: () => void;
21
- autoFocus?: boolean;
22
- placeholder?: string;
23
- pattern?: string;
24
- helperText?: string;
25
- errorText?: string;
26
- onBlur?: FocusEventHandler<HTMLInputElement>;
27
- onFocus?: FocusEventHandler<HTMLInputElement>;
28
- error?: boolean;
29
- inputProps?: InputHTMLAttributes<HTMLInputElement>;
30
- className?: string;
31
- ref?: Ref<HTMLInputElement>;
32
- }
33
-
34
- export const TextInput: FC<ITextInputProps> = ({
35
- id,
36
- label,
37
- value,
38
- setValue,
39
- required,
40
- disabled,
41
- endText,
42
- endButton,
43
- isClearable = true,
44
- onClear,
45
- autoFocus,
46
- placeholder,
47
- pattern,
48
- helperText,
49
- errorText,
50
- onBlur,
51
- onFocus,
52
- error,
53
- inputProps,
54
- className,
55
- ref,
56
- }) => {
57
- const [isAutoFill, setIsAutoFill] = useState(false);
58
- return (
59
- <InputWrapper
60
- label={label}
61
- required={required}
62
- disabled={disabled}
63
- endText={endText}
64
- endButton={endButton}
65
- onClearInput={
66
- isClearable && value
67
- ? () => {
68
- setValue?.('');
69
- onClear?.();
70
- }
71
- : undefined
72
- }
73
- helperText={helperText}
74
- errorText={errorText}
75
- // error={error || !!(pattern && value && !new RegExp(pattern).test(value))}
76
- error={error}
77
- className={className}
78
- >
79
- <input
80
- id={id}
81
- ref={ref}
82
- autoFocus={autoFocus}
83
- onFocus={e => {
84
- isAutoFill && setIsAutoFill(false);
85
- onFocus?.(e);
86
- }}
87
- onBlur={onBlur}
88
- placeholder={placeholder}
89
- value={value || ''}
90
- onChange={setValue ? e => setValue(e.target.value) : undefined}
91
- required={required}
92
- disabled={disabled}
93
- onAnimationStart={() => setIsAutoFill(true)}
94
- pattern={pattern}
95
- spellCheck={inputProps?.spellCheck ?? false}
96
- {...inputProps}
97
- />
98
- </InputWrapper>
99
- );
100
- };
@@ -1,81 +0,0 @@
1
- import type { FC } from 'react';
2
- import clsx from 'clsx';
3
- import { InputWrapper } from '../InputWrapper';
4
-
5
- export interface ITimeInputProps {
6
- time: string;
7
- setTime: (newTime: string) => void;
8
- label?: string;
9
- disabled?: boolean;
10
- required?: boolean;
11
- isClearable?: boolean;
12
- className?: string;
13
- }
14
-
15
- export const TimeInput: FC<ITimeInputProps> = ({
16
- time = '00:00',
17
- setTime,
18
- label,
19
- disabled,
20
- required,
21
- isClearable = true,
22
- className,
23
- }) => {
24
- const [hours, minutes] = time.split(':').map(t => t.padStart(2, '0'));
25
-
26
- const handleChange = (e: string, type: 'hh' | 'mm') => {
27
- let value = isNaN(+e) || e === '-1' ? '00' : e.replace(/\D/g, '');
28
- if (value.length > 2) {
29
- value = value.substring(1);
30
- }
31
-
32
- if (type === 'hh') {
33
- const newHours = Math.min(23, parseInt(value) || 0)
34
- .toString()
35
- .padStart(2, '0');
36
- setTime(`${newHours}:${minutes}`);
37
- } else {
38
- const newMinutes = Math.min(59, parseInt(value) || 0)
39
- .toString()
40
- .padStart(2, '0');
41
- setTime(`${hours}:${newMinutes}`);
42
- }
43
- };
44
-
45
- return (
46
- <InputWrapper
47
- label={label}
48
- required={required}
49
- disabled={disabled}
50
- onClearInput={isClearable && time && !disabled ? () => setTime('00:00') : undefined}
51
- className={clsx(className, 'time-input-wrapper')}
52
- >
53
- <div className="time-input">
54
- <input
55
- type="number"
56
- value={hours}
57
- onChange={e => handleChange(e.target.value, 'hh')}
58
- onClick={e => {
59
- const input = e.target as HTMLInputElement;
60
- input.select();
61
- }}
62
- disabled={disabled}
63
- required={required}
64
- style={{ textAlign: 'right' }}
65
- />
66
- <span className="fs-m">:</span>
67
- <input
68
- type="number"
69
- value={minutes}
70
- onChange={e => handleChange(e.target.value, 'mm')}
71
- onClick={e => {
72
- const input = e.target as HTMLInputElement;
73
- input.select();
74
- }}
75
- disabled={disabled}
76
- required={required}
77
- />
78
- </div>
79
- </InputWrapper>
80
- );
81
- };
@@ -1,21 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IListItem } from './ListItem';
3
- import { ListItem } from './ListItem';
4
-
5
- interface Props {
6
- items?: IListItem[];
7
- noItemsMessage?: string;
8
- }
9
-
10
- export const List: FC<Props> = ({ items, noItemsMessage }) => {
11
- if (!items || items.length === 0)
12
- return noItemsMessage ? <p className="fs-16 new-line">{noItemsMessage}</p> : null;
13
-
14
- return (
15
- <div className="iui-list">
16
- {items.map(item => (
17
- <ListItem key={item.id ?? item.label} {...item} />
18
- ))}
19
- </div>
20
- );
21
- };
@@ -1,70 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { FC } from 'react';
3
- import type { IButtonColor } from '../Button/Button';
4
- import { useMemo } from 'react';
5
- import clsx from 'clsx';
6
- import { IconButton } from '../Button/IconButton';
7
-
8
- export interface IListItemAction {
9
- icon: IconDefinition;
10
- onClick: () => void;
11
- disabled?: boolean;
12
- color?: IButtonColor;
13
- hidden?: boolean;
14
- }
15
-
16
- export interface IListItem {
17
- id?: string;
18
- label: string;
19
- desc?: string;
20
- actions?: IListItemAction[];
21
- onClick?: () => void;
22
- active?: boolean;
23
- disabled?: boolean;
24
- }
25
-
26
- export const ListItem: FC<IListItem> = ({
27
- label,
28
- desc,
29
- actions,
30
- onClick,
31
- active,
32
- disabled,
33
- }) => {
34
- const filteredActions = useMemo(
35
- () => actions?.filter(action => !action.hidden),
36
- [actions]
37
- );
38
-
39
- return (
40
- <div
41
- className={clsx('iui-list-item', { active, disabled, clickable: !!onClick })}
42
- onClick={e => {
43
- e.stopPropagation();
44
- onClick?.();
45
- }}
46
- >
47
- <div>
48
- <p className="bold">{label}</p>
49
- {desc && <div className="iui-list-item-desc">{desc}</div>}
50
- </div>
51
- {filteredActions && filteredActions.length > 0 && (
52
- <div className="iui-list-item-actions">
53
- {filteredActions.map((action, index) => (
54
- <IconButton
55
- key={index}
56
- icon={action.icon}
57
- onClick={e => {
58
- e.stopPropagation();
59
- action.onClick();
60
- }}
61
- size="s"
62
- color={action.color}
63
- disabled={action.disabled}
64
- />
65
- ))}
66
- </div>
67
- )}
68
- </div>
69
- );
70
- };
@@ -1,66 +0,0 @@
1
- import type { FC, ReactElement, ReactNode } from 'react';
2
- import { Children, cloneElement } from 'react';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- isLoading: boolean;
7
- isFullPage?: boolean;
8
- classNameLoader?: string;
9
- children?: ReactElement<{ className: string; children: ReactElement | ReactNode }>;
10
- }
11
-
12
- export const Loader: FC<Props> = ({
13
- isLoading,
14
- isFullPage,
15
- classNameLoader,
16
- children,
17
- }) =>
18
- children ? (
19
- Children.map(children, child =>
20
- cloneElement(child, {
21
- className: clsx(child.props.className, { relative: isLoading }),
22
- children: (
23
- <>
24
- {child.props.children}
25
- {isLoading && (
26
- <div className={clsx('loader', classNameLoader)}>
27
- <span className="spinner" />
28
- </div>
29
- )}
30
- </>
31
- ),
32
- })
33
- )
34
- ) : isLoading ? (
35
- <div className={`${isFullPage ? 'full-page-loader' : 'empty-loader'} relative`}>
36
- <div className={clsx('loader', classNameLoader)}>
37
- <span className="spinner" />
38
- </div>
39
- </div>
40
- ) : (
41
- <></>
42
- );
43
-
44
- export const SimpleLoader: FC<{ isLoading?: boolean }> = ({ isLoading = true }) =>
45
- isLoading ? (
46
- <div className="simple-loader">
47
- <span className="spinner" />
48
- </div>
49
- ) : null;
50
-
51
- export const FullScreenLoader: FC<{ isLoading: boolean }> = ({ isLoading }) =>
52
- isLoading ? (
53
- <div className="full-screen-loader">
54
- <div className="loader">
55
- <span className="spinner" />
56
- </div>
57
- </div>
58
- ) : null;
59
-
60
- export const LazyLoader: FC = () => (
61
- <div className="lazy-loader">
62
- <div className="loader">
63
- <span className="spinner" />
64
- </div>
65
- </div>
66
- );
@@ -1,41 +0,0 @@
1
- import type { CSSProperties, FC } from 'react';
2
- import clsx from 'clsx';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- interface Props {
6
- progress?: number;
7
- label?: string;
8
- }
9
-
10
- export const ProgressBar: FC<Props> = ({ progress, label }) => {
11
- const { t } = useTranslation();
12
-
13
- if (progress === undefined) return null;
14
-
15
- const now = Math.round(Math.min(Math.max(progress, 0), 100)); // Ensure percentage is between 0 and 100
16
-
17
- return (
18
- <div className="progress-bar-container">
19
- <div className="progress-label">{label ?? t('LoadingProgress')}</div>
20
- <div
21
- className="progress-bar-bg"
22
- role="progressbar"
23
- aria-valuemin={0}
24
- aria-valuemax={100}
25
- aria-valuenow={now}
26
- style={
27
- {
28
- '--progress-clip': `${now}%`,
29
- '--progress-text': `'${now}%'`,
30
- } as CSSProperties & { [key: string]: string }
31
- }
32
- >
33
- <div
34
- className={clsx('progress-bar-fill', { loading: now < 100 })}
35
- style={{ width: `${now}%` }}
36
- />
37
- <span className="progress-bar-text">{now}%</span>
38
- </div>
39
- </div>
40
- );
41
- };
@@ -1,81 +0,0 @@
1
- import type { FC, ReactNode, RefObject } from 'react';
2
- import type { IMenuItem, IMenuPlacement } from '../../types/IMenu';
3
- import { useRef } from 'react';
4
- import clsx from 'clsx';
5
- import { createPortal } from 'react-dom';
6
- import { useBackgroundClose } from '../../hooks/useBackgroundClose';
7
- import { rootDir } from '../../utils/rootDir';
8
- import { useMenuPosition } from './hooks/useMenuPosition';
9
- import { MenuItem } from './MenuItem';
10
-
11
- interface Props {
12
- id?: string;
13
- isOpen: boolean;
14
- onClose: () => void;
15
- renderButton: (ref: RefObject<any>) => ReactNode;
16
- items?: IMenuItem[];
17
- placement?: IMenuPlacement;
18
- size?: 's' | 'm' | 'l';
19
- className?: string;
20
- children?: ReactNode;
21
- }
22
-
23
- export const Menu: FC<Props> = ({
24
- id,
25
- isOpen,
26
- onClose,
27
- renderButton,
28
- items,
29
- placement = 'bottom-left',
30
- size,
31
- className,
32
- children,
33
- }) => {
34
- const menuRef = useRef<HTMLDivElement>(null);
35
- const portalRef = useRef<HTMLDivElement>(null);
36
- const containerRef = useRef<Element>(null);
37
-
38
- const menuStyle = useMenuPosition({
39
- isOpen,
40
- placement,
41
- containerRef,
42
- menuRef,
43
- });
44
-
45
- useBackgroundClose({ portalRef, disabled: !isOpen, handleClose: onClose });
46
-
47
- return (
48
- <>
49
- {renderButton(containerRef)}
50
- {isOpen
51
- ? createPortal(
52
- <div
53
- id={id}
54
- ref={portalRef}
55
- className="portal-background"
56
- onClick={e => e.stopPropagation()}
57
- >
58
- <div
59
- ref={menuRef}
60
- className={clsx('iui-menu', className, size)}
61
- style={menuStyle}
62
- >
63
- {items?.map(item => (
64
- <MenuItem
65
- {...item}
66
- key={item.label}
67
- onClick={e => {
68
- item.onClick?.(e);
69
- !item.keepOpen && onClose();
70
- }}
71
- />
72
- ))}
73
- {children}
74
- </div>
75
- </div>,
76
- rootDir
77
- )
78
- : null}
79
- </>
80
- );
81
- };
@@ -1,46 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IMenuItem } from '../../types/IMenu.js';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import clsx from 'clsx';
5
- import { Link } from 'react-router';
6
- import { NotificationBadge } from '../Badge/NotificationBadge.js';
7
- import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper.js';
8
-
9
- export const MenuItem: FC<IMenuItem> = ({
10
- label,
11
- icon,
12
- iconRotation,
13
- onClick,
14
- to,
15
- badge,
16
- active,
17
- disabled,
18
- hidden,
19
- withDevider,
20
- className,
21
- }) =>
22
- hidden ? null : (
23
- <ConditionalWrapper
24
- condition={!disabled && !!to}
25
- wrapper={children => <Link to={to!}>{children}</Link>}
26
- >
27
- <div
28
- className={clsx('iui-menu-item', className, {
29
- clickable: !!onClick || !!to,
30
- disabled,
31
- active,
32
- 'with-devider': withDevider,
33
- })}
34
- onClick={disabled ? undefined : onClick}
35
- >
36
- {icon && (
37
- <div className="menu-item-icon">
38
- <FontAwesomeIcon icon={icon} rotation={iconRotation} />
39
- </div>
40
- )}
41
- <NotificationBadge number={badge} size="s" className="menu-item-badge">
42
- <p className="menu-item-label">{label}</p>
43
- </NotificationBadge>
44
- </div>
45
- </ConditionalWrapper>
46
- );
@@ -1,63 +0,0 @@
1
- // import '@oddbird/popover-polyfill';
2
- // import polyfill from 'https://unpkg.com/@oddbird/css-anchor-positioning/fn';
3
- import '../../styles/components/_menu-v2.scss';
4
- import type { FC, ReactNode, RefObject } from 'react';
5
- import type { IMenuItem, IMenuPlacement } from '../../types/IMenu';
6
- import { useEffect, useRef } from 'react';
7
- import clsx from 'clsx';
8
- import { MenuItem } from './MenuItem';
9
-
10
- interface Props {
11
- id: string;
12
- renderButton: (ref: RefObject<any>) => ReactNode;
13
- items: IMenuItem[];
14
- placement?: IMenuPlacement;
15
- size?: 's' | 'm' | 'l';
16
- className?: string;
17
- }
18
-
19
- export const MenuV2: FC<Props> = ({
20
- id,
21
- renderButton,
22
- items,
23
- placement = 'bottom-left',
24
- size,
25
- className,
26
- }) => {
27
- const buttonRef = useRef<HTMLButtonElement>(null);
28
- const popoverRef = useRef<HTMLDivElement>(null);
29
-
30
- useEffect(() => {
31
- // polyfill();
32
- buttonRef.current?.setAttribute('popovertarget', id);
33
- buttonRef.current?.style.setProperty('anchor-name', `--${id}`);
34
- popoverRef.current?.style.setProperty('position-anchor', `--${id}`);
35
- }, [id]);
36
-
37
- return (
38
- <>
39
- {renderButton(buttonRef)}
40
- <div
41
- ref={popoverRef}
42
- role="menu"
43
- // @ts-ignore
44
- popover="auto"
45
- className={clsx('iui-menu-v2', size, placement)}
46
- id={id}
47
- >
48
- <div className={className}>
49
- {items.map(item => (
50
- <MenuItem
51
- {...item}
52
- key={item.label}
53
- onClick={e => {
54
- item.onClick?.(e);
55
- !item.keepOpen && popoverRef.current?.hidePopover();
56
- }}
57
- />
58
- ))}
59
- </div>
60
- </div>
61
- </>
62
- );
63
- };
@@ -1,116 +0,0 @@
1
- import type { RefObject } from 'react';
2
- import type { IAnyObject } from '../../../types/IBasic';
3
- import type { IMenuPlacement } from '../../../types/IMenu';
4
- import { useCallback, useLayoutEffect, useState } from 'react';
5
-
6
- interface Offsets {
7
- offsetTop: number;
8
- offsetLeft: number;
9
- }
10
-
11
- interface Props {
12
- isOpen: boolean;
13
- placement: IMenuPlacement;
14
- containerRef: RefObject<Element | null>;
15
- menuRef: RefObject<Element | null>;
16
- withMinWidth?: boolean;
17
- }
18
-
19
- export const useMenuPosition = ({
20
- isOpen,
21
- placement,
22
- containerRef,
23
- menuRef,
24
- withMinWidth,
25
- }: Props) => {
26
- const [offsets, setOffsets] = useState<Offsets>({
27
- offsetLeft: 0,
28
- offsetTop: 0,
29
- });
30
- const [maxHeight, setMaxHeight] = useState<number>();
31
- const [minWidth, setMinWidth] = useState(200);
32
-
33
- const recalculatePosition = useCallback(() => {
34
- if (containerRef.current && menuRef.current) {
35
- const containerRect = containerRef.current.getBoundingClientRect();
36
- const menuRect = menuRef.current.getBoundingClientRect();
37
- let [placementY, placementX] = placement.split('-');
38
-
39
- setMinWidth(containerRect.width);
40
-
41
- let offsetTop = containerRect.bottom + 5;
42
-
43
- let offsetLeft =
44
- containerRect.left +
45
- (placementX === 'right' ? containerRect.width - menuRect.width : 0);
46
- // + document.documentElement.scrollLeft;
47
-
48
- // Check for horizontal overflow and adjust placement
49
- if (placementX === 'right' && offsetLeft < 0) {
50
- placementX = 'left';
51
- offsetLeft = containerRect.left;
52
- } else if (
53
- placementX === 'left' &&
54
- offsetLeft + menuRect.width > window.innerWidth
55
- ) {
56
- placementX = 'right';
57
- offsetLeft = containerRect.left + containerRect.width - menuRect.width;
58
- }
59
-
60
- if (placementY === 'bottom') {
61
- setMaxHeight(window.innerHeight - containerRect.bottom - 20);
62
- }
63
-
64
- if (placementY === 'top') {
65
- setMaxHeight(
66
- window.innerHeight - containerRect.top + 40
67
- // - 2 * document.documentElement.scrollTop
68
- );
69
- }
70
-
71
- // Check for vertical overflow and adjust placement
72
- if (placementY === 'bottom' && offsetTop + menuRect.height > window.innerHeight) {
73
- placementY = 'top';
74
- offsetTop = containerRect.top - menuRect.height - 5;
75
- setMaxHeight(containerRect.top - 20);
76
- } else if (placementY === 'top' && offsetTop < 0) {
77
- placementY = 'bottom';
78
- offsetTop = containerRect.bottom + 5;
79
- setMaxHeight(window.innerHeight - containerRect.bottom - 20);
80
- }
81
-
82
- // check for space on the bottom
83
- if (
84
- (placementY === 'auto' && offsetTop + menuRect.height > window.innerHeight) ||
85
- (placement.split('-')[0] === 'top' && placementY !== 'bottom')
86
- ) {
87
- offsetTop = containerRect.top - menuRect.height - 5; //+ document.documentElement.scrollTop
88
- }
89
-
90
- setOffsets({ offsetTop, offsetLeft });
91
- }
92
- }, [menuRef, containerRef, placement]);
93
-
94
- useLayoutEffect(() => {
95
- isOpen
96
- ? document.addEventListener('resize', recalculatePosition)
97
- : document.removeEventListener('resize', recalculatePosition);
98
-
99
- recalculatePosition();
100
- return () => {
101
- window.removeEventListener('resize', recalculatePosition);
102
- };
103
- }, [isOpen, recalculatePosition]);
104
-
105
- const data: IAnyObject = {
106
- top: offsets.offsetTop + 'px',
107
- left: offsets.offsetLeft + 'px',
108
- maxHeight,
109
- };
110
-
111
- if (withMinWidth) {
112
- data.minWidth = minWidth;
113
- }
114
-
115
- return data;
116
- };
@@ -1,11 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import clsx from 'clsx';
3
-
4
- interface Props {
5
- className?: string;
6
- children: ReactNode;
7
- }
8
-
9
- export const ScrollableContent: FC<Props> = ({ className, children }) => (
10
- <div className={clsx('scrollable-content', className)}>{children}</div>
11
- );