@addev-be/ui 0.2.13 → 0.2.15

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 (114) hide show
  1. package/dist/Icons.d.ts +3 -1
  2. package/dist/Icons.js +5 -1
  3. package/dist/components/data/DataGrid/{FilterValuesScroller.d.ts → DataGridFilterMenu/FilterValuesScroller.d.ts} +1 -1
  4. package/dist/components/data/DataGrid/{FilterValuesScroller.js → DataGridFilterMenu/FilterValuesScroller.js} +6 -9
  5. package/dist/components/data/DataGrid/DataGridFilterMenu/index.js +3 -3
  6. package/dist/components/data/DataGrid/DataGridFilterMenu/styles.d.ts +9 -0
  7. package/dist/components/data/DataGrid/DataGridFilterMenu/styles.js +12 -2
  8. package/dist/components/data/DataGrid/FilterModalContent/index.js +18 -9
  9. package/dist/components/data/DataGrid/helpers/columns.d.ts +1 -0
  10. package/dist/components/data/DataGrid/helpers/columns.js +7 -6
  11. package/dist/components/data/DataGrid/helpers/filters.d.ts +1 -0
  12. package/dist/components/data/DataGrid/helpers/filters.js +71 -2
  13. package/dist/components/data/DataGrid/hooks/useDataGrid.js +2 -1
  14. package/dist/components/data/DataGrid/hooks/useDataGridCopy.js +2 -0
  15. package/dist/components/data/DataGrid/styles.d.ts +0 -9
  16. package/dist/components/data/DataGrid/styles.js +2 -12
  17. package/dist/components/data/DataGrid/types.d.ts +2 -0
  18. package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +6 -6
  19. package/dist/helpers/numbers.d.ts +1 -0
  20. package/dist/helpers/numbers.js +9 -1
  21. package/dist/services/globalSearch.d.ts +13 -0
  22. package/dist/services/globalSearch.js +8 -0
  23. package/package.json +18 -12
  24. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.d.ts +0 -9
  25. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.js +0 -171
  26. package/dist/components/data/DataGrid/helpers/advancedRequests.d.ts +0 -12
  27. package/dist/components/data/DataGrid/helpers/advancedRequests.js +0 -53
  28. package/eslint.config.js +0 -28
  29. package/src/Icons.tsx +0 -108
  30. package/src/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.ts +0 -93
  31. package/src/components/data/AdvancedRequestDataGrid/helpers/columns.tsx +0 -262
  32. package/src/components/data/AdvancedRequestDataGrid/helpers/index.ts +0 -2
  33. package/src/components/data/AdvancedRequestDataGrid/index.tsx +0 -267
  34. package/src/components/data/AdvancedRequestDataGrid/types.ts +0 -47
  35. package/src/components/data/DataGrid/DataGridCell.tsx +0 -73
  36. package/src/components/data/DataGrid/DataGridColumnsModal/helpers.ts +0 -14
  37. package/src/components/data/DataGrid/DataGridColumnsModal/hooks.tsx +0 -59
  38. package/src/components/data/DataGrid/DataGridColumnsModal/index.tsx +0 -181
  39. package/src/components/data/DataGrid/DataGridColumnsModal/styles.ts +0 -104
  40. package/src/components/data/DataGrid/DataGridEditableCell.tsx +0 -43
  41. package/src/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +0 -120
  42. package/src/components/data/DataGrid/DataGridFilterMenu/hooks.tsx +0 -75
  43. package/src/components/data/DataGrid/DataGridFilterMenu/index.tsx +0 -360
  44. package/src/components/data/DataGrid/DataGridFilterMenu/styles.ts +0 -96
  45. package/src/components/data/DataGrid/DataGridFooter.tsx +0 -42
  46. package/src/components/data/DataGrid/DataGridHeader.tsx +0 -126
  47. package/src/components/data/DataGrid/DataGridHeaderCell.tsx +0 -132
  48. package/src/components/data/DataGrid/FilterModalContent/index.tsx +0 -136
  49. package/src/components/data/DataGrid/FilterModalContent/styles.ts +0 -22
  50. package/src/components/data/DataGrid/VirtualScroller.tsx +0 -46
  51. package/src/components/data/DataGrid/helpers/columns.tsx +0 -295
  52. package/src/components/data/DataGrid/helpers/filters.ts +0 -287
  53. package/src/components/data/DataGrid/helpers/index.ts +0 -2
  54. package/src/components/data/DataGrid/hooks/index.ts +0 -30
  55. package/src/components/data/DataGrid/hooks/useDataGrid.tsx +0 -306
  56. package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +0 -175
  57. package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +0 -48
  58. package/src/components/data/DataGrid/index.tsx +0 -140
  59. package/src/components/data/DataGrid/styles.ts +0 -323
  60. package/src/components/data/DataGrid/types.ts +0 -267
  61. package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +0 -277
  62. package/src/components/data/SqlRequestDataGrid/helpers/index.ts +0 -2
  63. package/src/components/data/SqlRequestDataGrid/helpers/sqlRequests.ts +0 -16
  64. package/src/components/data/SqlRequestDataGrid/index.tsx +0 -347
  65. package/src/components/data/SqlRequestDataGrid/types.ts +0 -47
  66. package/src/components/data/index.ts +0 -8
  67. package/src/components/forms/Button.tsx +0 -99
  68. package/src/components/forms/IconButton.tsx +0 -56
  69. package/src/components/forms/IndeterminateCheckbox.tsx +0 -46
  70. package/src/components/forms/Select.tsx +0 -40
  71. package/src/components/forms/index.ts +0 -5
  72. package/src/components/forms/styles.ts +0 -20
  73. package/src/components/index.ts +0 -3
  74. package/src/components/layout/Dropdown/index.tsx +0 -79
  75. package/src/components/layout/Dropdown/styles.ts +0 -44
  76. package/src/components/layout/Loading/index.tsx +0 -29
  77. package/src/components/layout/Loading/styles.ts +0 -29
  78. package/src/components/layout/Modal/index.tsx +0 -51
  79. package/src/components/layout/Modal/styles.ts +0 -110
  80. package/src/components/layout/index.ts +0 -3
  81. package/src/components/ui/ContextMenu/index.tsx +0 -79
  82. package/src/components/ui/ContextMenu/styles.ts +0 -119
  83. package/src/config/index.ts +0 -14
  84. package/src/helpers/dates.ts +0 -9
  85. package/src/helpers/getScrollbarSize.ts +0 -14
  86. package/src/helpers/numbers.ts +0 -26
  87. package/src/hooks/index.ts +0 -2
  88. package/src/hooks/useElementSize.ts +0 -24
  89. package/src/hooks/useWindowSize.ts +0 -20
  90. package/src/index.ts +0 -7
  91. package/src/providers/PortalsProvider/index.tsx +0 -54
  92. package/src/providers/PortalsProvider/styles.ts +0 -27
  93. package/src/providers/SettingsProvider/index.tsx +0 -70
  94. package/src/providers/ThemeProvider/ThemeProvider.ts +0 -55
  95. package/src/providers/ThemeProvider/defaultTheme.ts +0 -444
  96. package/src/providers/ThemeProvider/index.ts +0 -3
  97. package/src/providers/ThemeProvider/types.ts +0 -123
  98. package/src/providers/UiProviders/index.tsx +0 -65
  99. package/src/providers/UiProviders/styles.ts +0 -10
  100. package/src/providers/hooks.ts +0 -8
  101. package/src/providers/index.ts +0 -5
  102. package/src/services/HttpService.ts +0 -80
  103. package/src/services/WebSocketService.ts +0 -147
  104. package/src/services/advancedRequests.ts +0 -101
  105. package/src/services/base.ts +0 -31
  106. package/src/services/globalSearch.ts +0 -27
  107. package/src/services/hooks.ts +0 -23
  108. package/src/services/index.ts +0 -2
  109. package/src/services/sqlRequests.ts +0 -110
  110. package/src/styles/animations.scss +0 -30
  111. package/src/styles/index.scss +0 -42
  112. package/src/typings.d.ts +0 -6
  113. package/tsconfig.json +0 -18
  114. package/tsconfig.tsbuildinfo +0 -1
@@ -1,79 +0,0 @@
1
- import * as styles from './styles';
2
-
3
- import { CSSProperties, FC, PropsWithChildren, useMemo } from 'react';
4
-
5
- import { usePortals } from '../../../providers';
6
-
7
- type DropdownProps = PropsWithChildren<
8
- styles.DropdownContainerProps & {
9
- $sourceRect: DOMRect;
10
- $autoPositionX?: boolean;
11
- $autoPositionY?: boolean;
12
- onClose?: () => void;
13
- style?: CSSProperties;
14
- }
15
- >;
16
-
17
- const getDropdownStyle = (dropdown: DropdownProps): CSSProperties => {
18
- const minHeight = Array.isArray(dropdown.$height)
19
- ? dropdown.$height[0]
20
- : dropdown.$height;
21
- const maxHeight = Array.isArray(dropdown.$height)
22
- ? dropdown.$height[1]
23
- : dropdown.$height;
24
- const bottomSpace = document.body.scrollHeight - dropdown.$sourceRect.bottom;
25
- const topSpace = dropdown.$sourceRect.top;
26
- const isDropdownBelow =
27
- !dropdown.$autoPositionY ||
28
- bottomSpace > topSpace ||
29
- bottomSpace >= minHeight;
30
- const height = Math.max(
31
- Math.min(maxHeight, isDropdownBelow ? bottomSpace : topSpace),
32
- minHeight
33
- );
34
-
35
- const rightSpace = document.body.scrollWidth - dropdown.$sourceRect.right;
36
- const leftSpace = dropdown.$sourceRect.left;
37
- const isDropdownRight =
38
- !dropdown.$autoPositionX ||
39
- rightSpace > leftSpace ||
40
- rightSpace >= dropdown.$width;
41
-
42
- const dropdownStyle: CSSProperties = {
43
- ...(isDropdownBelow
44
- ? { top: topSpace + dropdown.$sourceRect.height }
45
- : { bottom: bottomSpace + dropdown.$sourceRect.height }),
46
- ...(isDropdownRight ? { left: leftSpace } : { right: rightSpace }),
47
- width: dropdown.$width,
48
- height,
49
- minHeight,
50
- maxHeight,
51
- boxSizing: 'border-box',
52
- ...dropdown.style,
53
- };
54
- return dropdownStyle;
55
- };
56
-
57
- export const Dropdown: FC<DropdownProps> = ({
58
- children,
59
- onClose,
60
- ...props
61
- }) => {
62
- const { createPortal } = usePortals();
63
-
64
- const style = useMemo(() => getDropdownStyle(props), [props]);
65
-
66
- const modalPortal = useMemo(
67
- () =>
68
- createPortal(
69
- <styles.DropdownBackdrop onClick={onClose}>
70
- <styles.DropdownContainer {...props} style={style}>
71
- {children}
72
- </styles.DropdownContainer>
73
- </styles.DropdownBackdrop>
74
- ),
75
- [children, createPortal, onClose, props, style]
76
- );
77
-
78
- return <>{modalPortal}</>;
79
- };
@@ -1,44 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
-
3
- export const DropdownBackdrop = styled.div.attrs({
4
- className: 'DropdownBackdrop',
5
- })`
6
- position: absolute;
7
- z-index: 1000;
8
- top: 0;
9
- left: 0;
10
- right: 0;
11
- bottom: 0;
12
- background-color: rgba(0, 0, 0, 0.5);
13
- display: flex;
14
- justify-content: center;
15
- align-items: center;
16
- `;
17
-
18
- export type DropdownContainerProps = {
19
- $width: number;
20
- $height: number | number[];
21
- $zIndex?: number;
22
- };
23
-
24
- export const DropdownContainer = styled.div.attrs({
25
- className: 'DropdownContainer',
26
- })<DropdownContainerProps>`
27
- background: var(--color-neutral-0);
28
- border-radius: var(--rounded-md);
29
- box-shadow: var(--shadow-lg);
30
- outline: 1px solid var(--color-neutral-200);
31
-
32
- position: absolute;
33
- z-index: 1001;
34
- ${({ $width }) => ($width ? `${$width}px` : 'auto')};
35
- ${({ $height }) =>
36
- Array.isArray($height)
37
- ? css`
38
- min-height: ${$height[0]}px;
39
- max-height: ${$height[1]}px;
40
- `
41
- : css`
42
- height: ${$height ? `${$height}px` : 'auto'};
43
- `}
44
- `;
@@ -1,29 +0,0 @@
1
- import * as styles from './styles';
2
-
3
- import { FC, PropsWithChildren, useMemo } from 'react';
4
-
5
- import { LoadingIcon } from '../../../Icons';
6
- import { usePortals } from '../../../providers';
7
-
8
- type LoadingProps = PropsWithChildren<{
9
- visible?: boolean;
10
- }>;
11
-
12
- export const Loading: FC<LoadingProps> = ({ visible, children }) => {
13
- const { createPortal } = usePortals();
14
- const loadingPortal = useMemo(
15
- () =>
16
- visible
17
- ? createPortal(
18
- <styles.LoadingBackdrop>
19
- <LoadingIcon />
20
- <styles.LoadingContainer>
21
- {children || 'Loading ...'}
22
- </styles.LoadingContainer>
23
- </styles.LoadingBackdrop>
24
- )
25
- : null,
26
- [children, createPortal, visible]
27
- );
28
- return <>{loadingPortal}</>;
29
- };
@@ -1,29 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const LoadingContainer = styled.div.attrs({
4
- className: 'LoadingContent',
5
- })`
6
- padding: var(--space-4);
7
- `;
8
-
9
- export const LoadingBackdrop = styled.div.attrs({
10
- className: 'LoadingBackdrop',
11
- })`
12
- position: fixed;
13
- z-index: 1100;
14
- top: 0;
15
- left: 0;
16
- right: 0;
17
- bottom: 0;
18
- background-color: rgba(0, 0, 0, 0.5);
19
- display: flex;
20
- flex-direction: column;
21
- justify-content: center;
22
- align-items: center;
23
- color: var(--color-gray-50);
24
- fill: var(--color-gray-50);
25
- & > svg {
26
- width: var(--space-8);
27
- height: var(--space-8);
28
- }
29
- `;
@@ -1,51 +0,0 @@
1
- import * as styles from './styles';
2
-
3
- import { FC, PropsWithChildren, useMemo } from 'react';
4
-
5
- import { usePortals } from '../../../providers';
6
-
7
- type ModalProps = PropsWithChildren<
8
- styles.ModalContainerProps & {
9
- closeOnBackdropClick?: boolean;
10
- onClose?: () => void;
11
- }
12
- >;
13
-
14
- type ModalFC = FC<ModalProps> & {
15
- Header: typeof styles.ModalHeader;
16
- Message: typeof styles.ModalMessage;
17
- Content: typeof styles.ModalContent;
18
- ContentWithIcon: typeof styles.ModalContentWithIcon;
19
- Footer: typeof styles.ModalFooter;
20
- Buttons: typeof styles.ModalButtons;
21
- };
22
-
23
- export const Modal: ModalFC = ({
24
- children,
25
- closeOnBackdropClick,
26
- onClose,
27
- ...props
28
- }) => {
29
- const { createPortal } = usePortals();
30
-
31
- const modalPortal = useMemo(
32
- () =>
33
- createPortal(
34
- <styles.ModalBackdrop
35
- onClick={closeOnBackdropClick ? onClose : undefined}
36
- >
37
- <styles.ModalContainer {...props}>{children}</styles.ModalContainer>
38
- </styles.ModalBackdrop>
39
- ),
40
- [children, closeOnBackdropClick, createPortal, onClose, props]
41
- );
42
-
43
- return <>{modalPortal}</>;
44
- };
45
-
46
- Modal.Header = styles.ModalHeader;
47
- Modal.Message = styles.ModalMessage;
48
- Modal.Content = styles.ModalContent;
49
- Modal.ContentWithIcon = styles.ModalContentWithIcon;
50
- Modal.Footer = styles.ModalFooter;
51
- Modal.Buttons = styles.ModalButtons;
@@ -1,110 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
-
3
- export const ModalBackdrop = styled.div.attrs({
4
- className: 'ModalBackdrop',
5
- })`
6
- position: fixed;
7
- z-index: 1000;
8
- top: 0;
9
- left: 0;
10
- right: 0;
11
- bottom: 0;
12
- background-color: rgba(0, 0, 0, 0.5);
13
- display: flex;
14
- justify-content: center;
15
- align-items: center;
16
- `;
17
-
18
- export type ModalContainerProps = {
19
- $width?: number;
20
- $height?: number;
21
- $zIndex?: number;
22
- $fullscreen?: boolean;
23
- };
24
-
25
- export const ModalContainer = styled.div.attrs({
26
- className: 'ModalContainer',
27
- })<ModalContainerProps>`
28
- background: var(--color-neutral-100);
29
- border-radius: var(--rounded-lg);
30
- box-shadow: var(--shadow-lg);
31
- display: flex;
32
- flex-direction: column;
33
- max-height: 100vh;
34
- overflow: hidden;
35
-
36
- position: fixed;
37
- z-index: 1001;
38
- ${({ $fullscreen, $width, $height }) =>
39
- $fullscreen
40
- ? css`
41
- top: 0;
42
- left: 0;
43
- right: 0;
44
- bottom: 0;
45
- margin: var(--space-4);
46
- `
47
- : css`
48
- top: 50%;
49
- left: 50%;
50
- transform: translate(-50%, -50%);
51
- width: ${$width ? `${$width}px` : 'auto'};
52
- height: ${$height ? `${$height}px` : 'auto'};
53
- `}
54
- `;
55
-
56
- export const ModalHeader = styled.div.attrs({ className: 'ModalHeader' })`
57
- font-weight: bold;
58
- font-size: var(--text-lg);
59
- padding: var(--space-2);
60
- background-color: var(--color-neutral-200);
61
- padding: var(--space-4);
62
- `;
63
-
64
- export const ModalMessage = styled.p.attrs({ className: 'ModalMessage' })`
65
- margin-bottom: 1rem;
66
- `;
67
-
68
- export const ModalContent = styled.div.attrs({ className: 'ModalContent' })`
69
- display: flex;
70
- flex-direction: column;
71
- flex: 1;
72
- overflow: auto;
73
- padding: var(--space-4);
74
- `;
75
-
76
- export const ModalContentWithIcon = styled.div.attrs({
77
- className: 'ModalContentWithIcon',
78
- })`
79
- display: flex;
80
- flex-direction: row;
81
- padding: var(--space-4);
82
- gap: var(--space-2);
83
-
84
- & > svg {
85
- margin: var(--space-2);
86
- width: var(--space-8);
87
- height: var(--space-8);
88
- }
89
- `;
90
-
91
- export const ModalFooter = styled.div.attrs({ className: 'ModalFooter' })`
92
- display: flex;
93
- flex-direction: row;
94
- justify-content: space-between;
95
- padding: var(--space-2);
96
- background-color: var(--color-neutral-200);
97
- padding: var(--space-4);
98
- `;
99
-
100
- export const ModalButtons = styled(ModalFooter).attrs({
101
- className: 'ModalButtons',
102
- })`
103
- display: flex;
104
- flex-direction: row;
105
- gap: var(--space-2);
106
-
107
- button.right:first-of-type {
108
- margin-left: auto;
109
- }
110
- `;
@@ -1,3 +0,0 @@
1
- export * from './Dropdown';
2
- export * from './Modal';
3
- export * from './Loading';
@@ -1,79 +0,0 @@
1
- import { Divider, MenuContainer, MenuItemContainer, SubMenu } from './styles';
2
- import {
3
- FC,
4
- HTMLAttributes,
5
- PropsWithChildren,
6
- useCallback,
7
- useRef,
8
- useState,
9
- } from 'react';
10
-
11
- type ContextMenuFC = FC<PropsWithChildren<HTMLAttributes<HTMLDivElement>>> & {
12
- Item: typeof MenuItemContainer;
13
- ParentItem: typeof ParentMenuItem;
14
- Divider: typeof Divider;
15
- SubMenu: typeof SubMenu;
16
- };
17
-
18
- export const ContextMenu: ContextMenuFC = ({ children }) => {
19
- return (
20
- <MenuContainer onClick={(e) => e.stopPropagation()}>
21
- {children}
22
- </MenuContainer>
23
- );
24
- };
25
-
26
- export const ParentMenuItem: FC<HTMLAttributes<HTMLDivElement>> = ({
27
- children,
28
- ...props
29
- }) => {
30
- const [isOpened, setIsOpened] = useState(false);
31
- const [isSubMenuLeft, setIsSubMenuLeft] = useState(false);
32
- const [currentTimeout, setCurrentTimeout] = useState<number | null>(null);
33
- const containerRef = useRef<HTMLDivElement | null>(null);
34
-
35
- const stopTimeout = useCallback(() => {
36
- if (currentTimeout) {
37
- clearTimeout(currentTimeout);
38
- }
39
- setCurrentTimeout(null);
40
- }, [currentTimeout]);
41
-
42
- const startTimeout = useCallback(
43
- (open: boolean) => {
44
- stopTimeout();
45
- setCurrentTimeout(
46
- window.setTimeout(
47
- () => {
48
- const rect = containerRef.current?.getBoundingClientRect();
49
- setIsSubMenuLeft(!!rect && rect.right + 280 > window.innerWidth);
50
- setIsOpened(open);
51
- },
52
- open ? 100 : 300
53
- )
54
- );
55
- },
56
- [stopTimeout]
57
- );
58
-
59
- const open = useCallback(() => startTimeout(true), [startTimeout]);
60
- const close = useCallback(() => startTimeout(false), [startTimeout]);
61
-
62
- return (
63
- <MenuItemContainer
64
- ref={containerRef}
65
- {...props}
66
- className={`${isOpened ? 'opened' : ''} ${isSubMenuLeft ? 'left' : ''}`}
67
- onMouseEnter={open}
68
- onMouseLeave={close}
69
- $withArrow
70
- >
71
- {children}
72
- </MenuItemContainer>
73
- );
74
- };
75
-
76
- ContextMenu.Item = MenuItemContainer;
77
- ContextMenu.ParentItem = ParentMenuItem;
78
- ContextMenu.Divider = Divider;
79
- ContextMenu.SubMenu = SubMenu;
@@ -1,119 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
-
3
- import { ThemeColor } from '../../../providers/ThemeProvider/types';
4
-
5
- const menuContainerCss = css`
6
- position: absolute;
7
- color: var(--color-neutral-900);
8
- border-radius: var(--rounded-md);
9
- padding: var(--space-1) 0;
10
- box-shadow: var(--shadow-lg);
11
- background-color: var(--color-neutral-100);
12
- min-width: 20em;
13
- outline: 1px solid var(--color-neutral-200);
14
- display: flex;
15
- flex-direction: column;
16
- `;
17
-
18
- export const MenuContainer = styled.div.attrs({
19
- className: 'MenuContainer',
20
- })`
21
- ${menuContainerCss}
22
- inset: 0;
23
- `;
24
- MenuContainer.displayName = 'MenuContainer';
25
-
26
- export const SubMenu = styled.div.attrs({
27
- className: 'SubMenu',
28
- })`
29
- ${menuContainerCss}
30
- top: 0;
31
- left: 100%;
32
- margin-top: -var(--space-1);
33
- `;
34
- SubMenu.displayName = 'SubMenu';
35
-
36
- export const MenuItemContainer = styled.div.attrs({
37
- className: 'MenuItemContainer',
38
- })<{
39
- $color?: ThemeColor;
40
- disabled?: boolean;
41
- $withArrow?: boolean;
42
- $opened?: boolean;
43
- }>`
44
- position: relative;
45
- display: flex;
46
- align-items: center;
47
- font-family: var(--font-sans);
48
- font-weight: normal;
49
- text-align: left;
50
- padding: var(--space-1) var(--space-2);
51
- font-size: var(--text-base);
52
- line-height: var(--leading-6);
53
- border: none;
54
- cursor: pointer;
55
-
56
- ${({ $withArrow }) =>
57
- $withArrow &&
58
- css`
59
- &::after {
60
- content: '';
61
- position: absolute;
62
- right: var(--space-2);
63
- top: 50%;
64
- transform: translateY(-50%);
65
- border: 4px solid transparent;
66
- border-left-color: var(--color-neutral-600);
67
- }
68
- `}
69
-
70
- ${({ $color, disabled }) =>
71
- disabled
72
- ? css`
73
- color: var(--color-neutral-300);
74
- background-color: var(--color-neutral-100);
75
- cursor: default;
76
- `
77
- : $color
78
- ? css`
79
- color: var(--color-${$color}-600);
80
- background-color: var(--color-neutral-100);
81
- &:hover {
82
- background-color: var(--color-${$color}-200);
83
- }
84
- `
85
- : css`
86
- color: var(--color-neutral-900);
87
- background-color: var(--color-neutral-100);
88
- &:hover {
89
- background-color: var(--color-neutral-200);
90
- }
91
- `}
92
-
93
- svg {
94
- fill: currentColor;
95
- width: var(--space-4);
96
- height: var(--space-4);
97
- margin-right: var(--space-2);
98
- }
99
-
100
- & > ${SubMenu} {
101
- display: none;
102
- margin-top: calc(0px - var(--space-1));
103
- }
104
- &.opened > ${SubMenu} {
105
- display: block;
106
- }
107
- &.opened.left > ${SubMenu} {
108
- left: auto;
109
- right: 100%;
110
- }
111
- `;
112
- MenuItemContainer.displayName = 'MenuItemContainer';
113
-
114
- export const Divider = styled.div.attrs({
115
- className: 'Divider',
116
- })`
117
- border-top: 1px solid var(--color-neutral-200);
118
- margin: var(--space-1) 0;
119
- `;
@@ -1,14 +0,0 @@
1
- export type EnvType = 'dev' | 'test' | 'staging' | 'prod';
2
-
3
- export type Config = {
4
- webSocketUrl: string;
5
- httpServerUrl: `${string}/`;
6
- };
7
-
8
- type DeepPartial<T> = T extends object
9
- ? {
10
- [P in keyof T]?: DeepPartial<T[P]>;
11
- }
12
- : T;
13
-
14
- export type PartialConfig = DeepPartial<Config>;
@@ -1,9 +0,0 @@
1
- import moment from 'moment';
2
-
3
- export const formatDate = (
4
- date: moment.MomentInput,
5
- format: string = 'DD/MM/YYYY'
6
- ): string => {
7
- const m = moment.utc(date);
8
- return m.isValid() ? m.format(format) : '';
9
- };
@@ -1,14 +0,0 @@
1
- let scrollBarSize: number[] | undefined = undefined;
2
-
3
- export const getScrollBarSize = () => {
4
- if (!scrollBarSize) {
5
- const el = document.createElement('div');
6
- el.style.cssText = 'overflow:scroll; visibility:hidden; position:absolute;';
7
- document.body.appendChild(el);
8
- const width = el.offsetWidth - el.clientWidth;
9
- const height = el.offsetHeight - el.clientHeight;
10
- el.remove();
11
- scrollBarSize = [width, height];
12
- }
13
- return scrollBarSize;
14
- };
@@ -1,26 +0,0 @@
1
- export const formatMoney = (number: number, decimals = 2, currency = 'EUR') =>
2
- new Intl.NumberFormat(navigator.language, {
3
- style: 'currency',
4
- currency,
5
- minimumFractionDigits: decimals,
6
- maximumFractionDigits: decimals,
7
- }).format(number);
8
-
9
- export const formatPercentage = (number: number, decimals = 2) =>
10
- new Intl.NumberFormat(navigator.language, {
11
- style: 'percent',
12
- minimumFractionDigits: decimals,
13
- maximumFractionDigits: decimals,
14
- }).format(number);
15
-
16
- export const formatNumber = (number: number, decimals = 2) =>
17
- new Intl.NumberFormat(navigator.language, {
18
- minimumFractionDigits: decimals,
19
- maximumFractionDigits: decimals,
20
- }).format(number);
21
-
22
- export const formatNumberInvariant = (number: number, decimals = 2) =>
23
- new Intl.NumberFormat('es-US', {
24
- minimumFractionDigits: decimals,
25
- maximumFractionDigits: decimals,
26
- }).format(number);
@@ -1,2 +0,0 @@
1
- export * from './useElementSize';
2
- export * from './useWindowSize';
@@ -1,24 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- export const useElementSize = (element: HTMLElement | null) => {
4
- const [size, setSize] = useState({ width: 0, height: 0 });
5
-
6
- useEffect(() => {
7
- if (!element) {
8
- return;
9
- }
10
-
11
- const observer = new ResizeObserver((entries) => {
12
- const entry = entries[0];
13
- const { width, height } = entry.contentRect;
14
- setSize({ width, height });
15
- });
16
-
17
- observer.observe(element);
18
- return () => {
19
- observer.disconnect();
20
- };
21
- }, [element]);
22
-
23
- return size;
24
- };
@@ -1,20 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- export const useWindowSize = () => {
4
- const [size, setSize] = useState({ width: 0, height: 0 });
5
-
6
- useEffect(() => {
7
- const handleResize = () => {
8
- setSize({ width: window.outerWidth, height: window.outerHeight });
9
- };
10
-
11
- window.addEventListener('resize', handleResize);
12
- handleResize();
13
-
14
- return () => {
15
- window.removeEventListener('resize', handleResize);
16
- };
17
- }, []);
18
-
19
- return size;
20
- };
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './components';
2
- export * from './providers';
3
-
4
- export * from './Icons';
5
-
6
- export * from './config';
7
- export * from './services';