@inceptionbg/iui 2.0.35 → 2.0.37

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 +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -1
  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 -22
  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 -74
  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,74 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITab } from '../../types/ITab';
3
- import { useState } from 'react';
4
- import { faArrowsToLine, faArrowsUpDown } from '@inceptionbg/icons';
5
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
6
- import clsx from 'clsx';
7
- import { Collapse } from '../Helper/Collapse';
8
-
9
- interface Props {
10
- tabs: ITab[];
11
- initialValue?: string;
12
- compact?: boolean;
13
- keepContentInDom?: boolean;
14
- control?: {
15
- value: string;
16
- setValue: (value: string) => void;
17
- };
18
- className?: string;
19
- classNameContent?: string;
20
- }
21
- export const Accordions: FC<Props> = ({
22
- tabs: allTabs,
23
- initialValue,
24
- compact,
25
- keepContentInDom,
26
- control,
27
- className,
28
- classNameContent,
29
- }) => {
30
- const tabs = allTabs.filter(tab => !tab.hidden);
31
- const [selected, setSelected] = useState(initialValue || '');
32
-
33
- return tabs.length > 0 ? (
34
- <div className={clsx('iui-accordions', className)}>
35
- {tabs.map(tab => {
36
- const isOpen = (control?.value ?? selected) === tab.value;
37
- return (
38
- <div
39
- key={tab.value}
40
- className={clsx('iui-accordion', {
41
- selected: isOpen,
42
- compact,
43
- })}
44
- >
45
- <div
46
- className={clsx('summary clickable', {
47
- disabled: tab.disabled,
48
- })}
49
- onClick={
50
- tab.disabled
51
- ? undefined
52
- : () => (control?.setValue ?? setSelected)(isOpen ? '' : tab.value)
53
- }
54
- >
55
- <div className="flex center">
56
- {tab.icon && <FontAwesomeIcon icon={tab.icon} className="iui-icon" />}
57
- {tab.label}
58
- </div>
59
- <FontAwesomeIcon
60
- icon={isOpen ? faArrowsToLine : faArrowsUpDown}
61
- className="collapse-icon"
62
- />
63
- </div>
64
- <Collapse isOpen={isOpen} keepContentInDom={keepContentInDom}>
65
- <div className={clsx('iui-accordion-content', classNameContent)}>
66
- {tab.component}
67
- </div>
68
- </Collapse>
69
- </div>
70
- );
71
- })}
72
- </div>
73
- ) : null;
74
- };
@@ -1,31 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import type { IInfoType } from '../../types/IInfo';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import clsx from 'clsx';
5
- import { infoIcons } from '../../utils/icons';
6
-
7
- export interface IAlertProps {
8
- text?: string;
9
- severity: IInfoType;
10
- fitContent?: boolean;
11
- className?: string;
12
- children?: ReactNode;
13
- }
14
-
15
- export const Alert: FC<IAlertProps> = ({
16
- text,
17
- severity,
18
- fitContent,
19
- className,
20
- children,
21
- }) => (
22
- <div
23
- className={clsx('iui-alert', severity, className, {
24
- 'width-fit': fitContent,
25
- })}
26
- >
27
- <FontAwesomeIcon icon={infoIcons[severity]} />
28
- {text && <p>{text}</p>}
29
- {children}
30
- </div>
31
- );
@@ -1,16 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IInfoType } from '../../types/IInfo';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- label: string;
7
- color: IInfoType | 'gray';
8
- className?: string;
9
- }
10
-
11
- export const DotBadge: FC<Props> = ({ label, color, className }) => (
12
- <div className="flex align-center gap-2">
13
- <div className={clsx('iui-dot-badge', color, className)} />
14
- {label}
15
- </div>
16
- );
@@ -1,29 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import type { IInfoType } from '../../types/IInfo';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- number?: number;
7
- className?: string;
8
- size?: 's' | 'm';
9
- children?: ReactNode;
10
- color?: IInfoType | 'primary';
11
- }
12
-
13
- export const NotificationBadge: FC<Props> = ({
14
- number,
15
- className,
16
- size = 'm',
17
- children,
18
- color = 'primary',
19
- }) =>
20
- !!number && number > 0 ? (
21
- <div className="iui-badge-parent">
22
- {children}
23
- <div className={clsx('iui-badge', color, className, size)}>
24
- {number > 99 ? '99+' : number}
25
- </div>
26
- </div>
27
- ) : (
28
- children
29
- );
@@ -1,13 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IInfoType } from '../../types/IInfo';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- label: string;
7
- color: IInfoType | 'gray';
8
- className?: string;
9
- }
10
-
11
- export const PillBadge: FC<Props> = ({ label, color, className }) => (
12
- <div className={clsx('iui-pill-badge', color, className)}>{label}</div>
13
- );
@@ -1,56 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { ButtonHTMLAttributes, FC, MouseEventHandler, Ref } from 'react';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import clsx from 'clsx';
5
-
6
- export type IButtonColor = 'primary' | 'neutral' | 'danger';
7
- export type IButtonVariant = 'solid' | 'outlined' | 'simple';
8
-
9
- export interface IButtonProps {
10
- label: string;
11
- icon?: IconDefinition;
12
- iconEnd?: IconDefinition;
13
- onClick?: MouseEventHandler<HTMLButtonElement>;
14
- variant?: IButtonVariant;
15
- color?: IButtonColor;
16
- size?: 'xs' | 's' | 'm' | 'l';
17
- disabled?: boolean;
18
- active?: boolean;
19
- type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
20
- className?: string;
21
- buttonProps?: ButtonHTMLAttributes<HTMLButtonElement>;
22
- ref?: Ref<HTMLButtonElement>;
23
- }
24
-
25
- export const Button: FC<IButtonProps> = ({
26
- label,
27
- icon,
28
- iconEnd,
29
- onClick,
30
- variant = 'solid',
31
- color,
32
- size = 'm',
33
- disabled,
34
- active,
35
- type = 'button',
36
- className,
37
- buttonProps,
38
- ref,
39
- }) => (
40
- <button
41
- ref={ref}
42
- disabled={disabled}
43
- className={clsx('iui-btn iui-text-btn', variant, color, size, className, {
44
- active,
45
- primary: !color && variant === 'solid',
46
- neutral: !color && variant !== 'solid',
47
- })}
48
- onClick={onClick}
49
- type={type}
50
- {...buttonProps}
51
- >
52
- {icon && <FontAwesomeIcon icon={icon} />}
53
- <div className="iui-btn-label">{label}</div>
54
- {iconEnd && <FontAwesomeIcon icon={iconEnd} />}
55
- </button>
56
- );
@@ -1,51 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { ButtonHTMLAttributes, FC, MouseEventHandler, Ref } from 'react';
3
- import type { IButtonColor, IButtonVariant } from './Button';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import clsx from 'clsx';
6
- import { Tooltip } from '../Tooltip/Tooltip';
7
-
8
- export interface IIconButtonProps {
9
- icon: IconDefinition;
10
- onClick?: MouseEventHandler<HTMLButtonElement>;
11
- variant?: IButtonVariant;
12
- color?: IButtonColor;
13
- size?: 's' | 'm' | 'l';
14
- disabled?: boolean;
15
- active?: boolean;
16
- tooltip?: string;
17
- type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
18
- className?: string;
19
- buttonProps?: ButtonHTMLAttributes<HTMLButtonElement>;
20
- ref?: Ref<HTMLButtonElement>;
21
- }
22
-
23
- export const IconButton: FC<IIconButtonProps> = ({
24
- icon,
25
- onClick,
26
- variant = 'simple',
27
- color = 'primary',
28
- size = 'm',
29
- disabled,
30
- active,
31
- tooltip,
32
- type = 'button',
33
- className,
34
- buttonProps,
35
- ref,
36
- }) => (
37
- <Tooltip label={tooltip} disabled={disabled}>
38
- <button
39
- ref={ref}
40
- disabled={disabled}
41
- className={clsx('iui-btn iui-icon-btn', variant, color, size, className, {
42
- active,
43
- })}
44
- onClick={onClick}
45
- type={type}
46
- {...buttonProps}
47
- >
48
- <FontAwesomeIcon icon={icon} />
49
- </button>
50
- </Tooltip>
51
- );
@@ -1,91 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { ButtonHTMLAttributes, FC, MouseEventHandler, Ref } from 'react';
3
- import type { IMenuItem, IMenuPlacement } from '../../types/IMenu';
4
- import { useMemo } from 'react';
5
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
6
- import clsx from 'clsx';
7
- import { faCaretDown } from '../../assets/icons/solid/faCaretDown';
8
- import { useIsMenuOpen } from '../../hooks/useIsMenuOpen';
9
- import { Menu } from '../Menu/Menu';
10
-
11
- export type ISplitAction = Pick<IMenuItem, 'label' | 'onClick'> &
12
- Partial<Pick<IMenuItem, 'icon' | 'active' | 'disabled' | 'hidden'>>;
13
-
14
- export interface IButtonProps {
15
- label: string;
16
- icon?: IconDefinition;
17
- onClick?: MouseEventHandler<HTMLButtonElement>;
18
- splitActions?: ISplitAction[];
19
- menuPlacement?: IMenuPlacement;
20
- variant?: 'solid' | 'outlined';
21
- size?: 'xs' | 's' | 'm' | 'l';
22
- disabled?: boolean;
23
- type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
24
- className?: string;
25
- fullWidth?: boolean;
26
- buttonProps?: ButtonHTMLAttributes<HTMLButtonElement>;
27
- ref?: Ref<HTMLButtonElement>;
28
- }
29
-
30
- export const SplitButton: FC<IButtonProps> = ({
31
- label,
32
- icon,
33
- onClick,
34
- splitActions,
35
- menuPlacement = 'bottom-right',
36
- variant = 'solid',
37
- size = 'm',
38
- disabled,
39
- type = 'button',
40
- className,
41
- fullWidth,
42
- buttonProps,
43
- ref,
44
- }) => {
45
- const { isOpen, onClose, onOpen } = useIsMenuOpen();
46
-
47
- const filteredActions = useMemo(
48
- () => splitActions?.filter(action => !action.hidden),
49
- [splitActions]
50
- );
51
-
52
- return (
53
- <button
54
- ref={ref}
55
- disabled={disabled}
56
- className={clsx('iui-btn iui-split-btn', variant, size, className, {
57
- primary: variant === 'solid',
58
- neutral: variant !== 'solid',
59
- })}
60
- onClick={onClick}
61
- type={type}
62
- {...buttonProps}
63
- >
64
- <div className={clsx('iui-btn-content', { 'full-width': fullWidth })}>
65
- {icon && <FontAwesomeIcon icon={icon} />}
66
- <div className="iui-btn-label">{label}</div>
67
- </div>
68
- {!!filteredActions?.length && (
69
- <Menu
70
- isOpen={isOpen}
71
- onClose={onClose}
72
- placement={menuPlacement}
73
- renderButton={ref => (
74
- <div
75
- className={clsx('btn-actions', { active: isOpen })}
76
- ref={ref}
77
- onMouseOver={e => e.stopPropagation()}
78
- onClick={e => {
79
- e.stopPropagation();
80
- onOpen();
81
- }}
82
- >
83
- <FontAwesomeIcon icon={faCaretDown} />
84
- </div>
85
- )}
86
- items={filteredActions}
87
- />
88
- )}
89
- </button>
90
- );
91
- };
@@ -1,9 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
-
3
- export const Dashboard: FC<{ children: ReactNode }> = ({ children }) => (
4
- <div className="page-container">
5
- <div className="page-content">
6
- <div className="widget-container">{children}</div>
7
- </div>
8
- </div>
9
- );
@@ -1,44 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import { faCircleInfo, faTriangleExclamation } from '@inceptionbg/icons';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import clsx from 'clsx';
5
- import { Loader } from '../Loader/Loader';
6
-
7
- const Icons = {
8
- warning: faTriangleExclamation,
9
- info: faCircleInfo,
10
- };
11
- interface Props {
12
- title: string;
13
- icon?: any;
14
- type?: 'warning' | 'info';
15
- span?: 2 | 3 | 4;
16
- isLoading?: boolean;
17
- children: ReactNode;
18
- }
19
- export const DashboardWidget: FC<Props> = ({
20
- title,
21
- icon,
22
- type,
23
- span,
24
- isLoading,
25
- children,
26
- }) => (
27
- <Loader isLoading={!!isLoading}>
28
- <div
29
- className={clsx('dashboard-widget', type, {
30
- [`grid-span${span}`]: !!span,
31
- })}
32
- >
33
- <div className="flex gap-3 mb-3">
34
- {icon && (
35
- <div className="widget-icon">
36
- <FontAwesomeIcon icon={icon || Icons[type!]} />
37
- </div>
38
- )}
39
- <h1>{title}</h1>
40
- </div>
41
- {children}
42
- </div>
43
- </Loader>
44
- );
@@ -1,36 +0,0 @@
1
- import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import type { FC } from 'react';
3
- import { faArrowUpRightFromSquare, faLink } from '@inceptionbg/icons';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import { useTranslation } from 'react-i18next';
6
- import { DashboardWidget } from '../DashboardWidget';
7
-
8
- interface Props {
9
- links: {
10
- icon?: IconDefinition;
11
- label: string;
12
- onClick: () => void;
13
- }[];
14
- }
15
-
16
- export const FastLinksWidget: FC<Props> = ({ links }) => {
17
- const { t } = useTranslation();
18
-
19
- return (
20
- <DashboardWidget title={t('FastLinks')} icon={faLink}>
21
- <div className="short-links-widget mt-4">
22
- <ul>
23
- {links.map((l, i) => (
24
- <li onClick={l.onClick} className="clickable" key={`short-links-${i}`}>
25
- <FontAwesomeIcon
26
- icon={l.icon || faArrowUpRightFromSquare}
27
- className="mr-3"
28
- />
29
- {l.label}
30
- </li>
31
- ))}
32
- </ul>
33
- </div>
34
- </DashboardWidget>
35
- );
36
- };
@@ -1,178 +0,0 @@
1
- import type { FC, KeyboardEventHandler, ReactNode } from 'react';
2
- import type { IInfoType } from '../../types/IInfo';
3
- import type { ILocalPopupControl } from '../../types/IPopup';
4
- import type { IDialogFooterActions } from './components/DialogFooter';
5
- import { useRef } from 'react';
6
- import { faXmark } from '@inceptionbg/icons';
7
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
- import clsx from 'clsx';
9
- import { createPortal } from 'react-dom';
10
- import { useBackgroundClose } from '../../hooks/useBackgroundClose';
11
- import { useGetFocusableElements } from '../../hooks/useGetFocusableElements';
12
- import { useLocalPopoverControl } from '../../hooks/useLocalPopoverControl';
13
- import { infoIcons } from '../../utils/icons';
14
- import { onPopupKeyDown } from '../../utils/popupUtils';
15
- import { rootDir } from '../../utils/rootDir';
16
- import { IconButton } from '../Button/IconButton';
17
- import { Loader } from '../Loader/Loader';
18
- import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
19
- import { DialogFooter } from './components/DialogFooter';
20
-
21
- type BaseProps = {
22
- title?: string;
23
- titleEl?: ReactNode;
24
- desc?: string;
25
- descEl?: ReactNode;
26
- onFormSubmit?: () => void;
27
- onCloseCallback?: () => void;
28
- isLoading?: boolean;
29
- footer?: IDialogFooterActions;
30
- isKeyboardDisabled?: boolean;
31
- noBackgroundClick?: boolean;
32
- noOverflow?: boolean;
33
- type?: IInfoType;
34
- size?: 'm' | 'l' | 'xl';
35
- className?: string;
36
- classNameContent?: string;
37
- children?: ReactNode;
38
- };
39
-
40
- export type ImperativeDialogProps = {
41
- control: ILocalPopupControl;
42
- isOpen?: never;
43
- onClose?: undefined;
44
- };
45
- export type DeclarativeDialogProps = {
46
- isOpen: boolean;
47
- onClose: () => void;
48
- control?: never;
49
- };
50
-
51
- type Props = BaseProps & (ImperativeDialogProps | DeclarativeDialogProps);
52
-
53
- export const Dialog: FC<Props> = ({
54
- title,
55
- titleEl,
56
- desc,
57
- descEl,
58
- onFormSubmit,
59
- onCloseCallback,
60
- isLoading,
61
- footer,
62
- isKeyboardDisabled,
63
- noBackgroundClick,
64
- noOverflow,
65
- type,
66
- size = 'm',
67
- className,
68
- classNameContent,
69
- children,
70
- ...rest
71
- }) => {
72
- const formRef = useRef<HTMLFormElement>(null);
73
-
74
- const { elementRef, isOpen, onClose } = useLocalPopoverControl({
75
- ...rest,
76
- onCloseCallback,
77
- });
78
-
79
- const focusableElements = useGetFocusableElements({
80
- elementRef,
81
- isOpen,
82
- });
83
-
84
- useBackgroundClose({
85
- portalRef: elementRef,
86
- disabled: noBackgroundClick || !isOpen,
87
- handleClose: onClose,
88
- });
89
-
90
- const onKeyDown: KeyboardEventHandler<HTMLDivElement> = event => {
91
- !isKeyboardDisabled &&
92
- onPopupKeyDown(event, {
93
- onClose,
94
- enter: {
95
- onAction: () => {
96
- footer?.confirmButton?.onClick?.();
97
- !footer?.confirmButton?.keepOpen && onClose();
98
- },
99
- disabled: !footer?.confirmButton?.onClick,
100
- },
101
- focusableElements,
102
- });
103
- };
104
-
105
- return isOpen
106
- ? createPortal(
107
- <div
108
- ref={elementRef}
109
- className="iui-dialog"
110
- aria-label="popup"
111
- onKeyDown={onKeyDown}
112
- tabIndex={-1}
113
- >
114
- <Loader isLoading={!!isLoading}>
115
- <ConditionalWrapper
116
- condition={!!onFormSubmit}
117
- wrapper={children => (
118
- <form
119
- ref={formRef}
120
- onSubmit={e => {
121
- e.preventDefault();
122
- e.stopPropagation();
123
- onFormSubmit?.();
124
- !footer?.confirmButton?.keepOpen && onClose();
125
- }}
126
- >
127
- {children}
128
- </form>
129
- )}
130
- >
131
- <div className={clsx('iui-dialog-container', size, type, className)}>
132
- <div className="iui-dialog-header">
133
- {type && (
134
- <FontAwesomeIcon
135
- icon={infoIcons[type]}
136
- className={clsx('dialog-type-icon', type)}
137
- />
138
- )}
139
- <div className="full-width">
140
- <div className="iui-dialog-title">
141
- {title ? <h4>{title}</h4> : titleEl}
142
- <IconButton
143
- icon={faXmark}
144
- onClick={onClose}
145
- color="neutral"
146
- size="l"
147
- className="close-icon"
148
- buttonProps={{ tabIndex: -1 }}
149
- />
150
- </div>
151
- {desc ? <p className="iui-dialog-desc">{desc}</p> : descEl}
152
- </div>
153
- </div>
154
- {children && (
155
- <div
156
- className={clsx('iui-dialog-content', classNameContent, {
157
- 'no-overflow': noOverflow,
158
- })}
159
- >
160
- {children}
161
- </div>
162
- )}
163
- {footer && (
164
- <DialogFooter
165
- {...footer}
166
- onClose={onClose}
167
- isForm={!!onFormSubmit}
168
- type={type}
169
- />
170
- )}
171
- </div>
172
- </ConditionalWrapper>
173
- </Loader>
174
- </div>,
175
- rootDir
176
- )
177
- : null;
178
- };