@qoretechnologies/reqore 0.44.0 → 0.46.0

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 (226) hide show
  1. package/dist/constants/theme.d.ts +8 -1
  2. package/dist/constants/theme.d.ts.map +1 -1
  3. package/dist/constants/theme.js +16 -2
  4. package/dist/constants/theme.js.map +1 -1
  5. package/package.json +1 -1
  6. package/tests.json +1 -1
  7. package/.eslintrc.js +0 -40
  8. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  9. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  10. package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
  11. package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
  12. package/.github/workflows/beta_release.yml +0 -100
  13. package/.github/workflows/tests.yml +0 -84
  14. package/.gitpod.yml +0 -11
  15. package/.jest-test-results.json +0 -1
  16. package/.prettierrc +0 -7
  17. package/.vscode/settings.json +0 -0
  18. package/__tests__/breadcrumbs.test.tsx +0 -75
  19. package/__tests__/button.test.tsx +0 -218
  20. package/__tests__/checkbox.test.tsx +0 -45
  21. package/__tests__/collection.test.tsx +0 -243
  22. package/__tests__/containers/paging.test.tsx +0 -138
  23. package/__tests__/control_group.test.tsx +0 -32
  24. package/__tests__/drawer.test.tsx +0 -140
  25. package/__tests__/dropdown.test.tsx +0 -381
  26. package/__tests__/effect.test.tsx +0 -70
  27. package/__tests__/heading.test.tsx +0 -58
  28. package/__tests__/helpers/colors.test.tsx +0 -18
  29. package/__tests__/helpers/table.test.tsx +0 -67
  30. package/__tests__/hooks/useLatestZIndex.test.tsx +0 -10
  31. package/__tests__/hooks/useReqorePaging.test.tsx +0 -271
  32. package/__tests__/hooks/useTheme.test.tsx +0 -31
  33. package/__tests__/icon.test.tsx +0 -53
  34. package/__tests__/input.test.tsx +0 -482
  35. package/__tests__/layout.test.tsx +0 -37
  36. package/__tests__/menu.test.tsx +0 -65
  37. package/__tests__/messages.test.tsx +0 -79
  38. package/__tests__/modal.test.tsx +0 -204
  39. package/__tests__/multiselect.test.tsx +0 -458
  40. package/__tests__/navbar.test.tsx +0 -31
  41. package/__tests__/notifications.test.tsx +0 -178
  42. package/__tests__/pagination.test.tsx +0 -437
  43. package/__tests__/panel.test.tsx +0 -243
  44. package/__tests__/popover.test.tsx +0 -282
  45. package/__tests__/radiogroup.test.tsx +0 -47
  46. package/__tests__/setup.js +0 -8
  47. package/__tests__/stories/Collection.stories.tsx +0 -0
  48. package/__tests__/table.test.tsx +0 -647
  49. package/__tests__/tabs.test.tsx +0 -321
  50. package/__tests__/tag.test.tsx +0 -160
  51. package/__tests__/textarea.test.tsx +0 -467
  52. package/__tests__/timeAgo.test.tsx +0 -27
  53. package/__tests__/tree.test.tsx +0 -58
  54. package/build-storybook.log +0 -491
  55. package/chromatic.config.json +0 -1
  56. package/icons.ts +0 -1
  57. package/migration-storybook.log +0 -56
  58. package/public/logo-dark.png +0 -0
  59. package/public/logo.png +0 -0
  60. package/public/q-symbol-small.png +0 -0
  61. package/public/q-symbol.png +0 -0
  62. package/public/qoreLogo-dark.png +0 -0
  63. package/public/qoreLogo.png +0 -0
  64. package/src/components/Breadcrumbs/index.tsx +0 -254
  65. package/src/components/Breadcrumbs/item.tsx +0 -44
  66. package/src/components/Button/index.tsx +0 -633
  67. package/src/components/Checkbox/index.tsx +0 -388
  68. package/src/components/Collection/index.tsx +0 -426
  69. package/src/components/Collection/item.tsx +0 -267
  70. package/src/components/Columns/column.tsx +0 -27
  71. package/src/components/Columns/index.tsx +0 -41
  72. package/src/components/Comment/index.tsx +0 -141
  73. package/src/components/CommentFeed/index.tsx +0 -34
  74. package/src/components/Content/index.tsx +0 -34
  75. package/src/components/Content/wrapper.tsx +0 -36
  76. package/src/components/ControlGroup/index.tsx +0 -523
  77. package/src/components/DatePicker/index.tsx +0 -347
  78. package/src/components/Drawer/backdrop.tsx +0 -54
  79. package/src/components/Drawer/index.tsx +0 -365
  80. package/src/components/Dropdown/index.tsx +0 -153
  81. package/src/components/Dropdown/item.tsx +0 -33
  82. package/src/components/Dropdown/list.tsx +0 -222
  83. package/src/components/Effect/index.tsx +0 -464
  84. package/src/components/ExportModal/index.tsx +0 -99
  85. package/src/components/Header/index.tsx +0 -81
  86. package/src/components/Icon/index.tsx +0 -184
  87. package/src/components/Input/index.tsx +0 -295
  88. package/src/components/InputClearButton/index.tsx +0 -59
  89. package/src/components/InternalPopover/index.tsx +0 -303
  90. package/src/components/KeyValueTable/index.tsx +0 -192
  91. package/src/components/Label/index.tsx +0 -10
  92. package/src/components/Layout/content.tsx +0 -31
  93. package/src/components/Layout/index.tsx +0 -55
  94. package/src/components/Menu/divider.tsx +0 -92
  95. package/src/components/Menu/index.tsx +0 -141
  96. package/src/components/Menu/item.tsx +0 -137
  97. package/src/components/Menu/section.tsx +0 -81
  98. package/src/components/Message/index.tsx +0 -220
  99. package/src/components/Modal/index.tsx +0 -26
  100. package/src/components/MultiSelect/index.tsx +0 -288
  101. package/src/components/Navbar/divider.tsx +0 -50
  102. package/src/components/Navbar/group.tsx +0 -53
  103. package/src/components/Navbar/index.tsx +0 -82
  104. package/src/components/Navbar/item.tsx +0 -92
  105. package/src/components/Notifications/index.tsx +0 -57
  106. package/src/components/Notifications/notification.tsx +0 -362
  107. package/src/components/Paging/index.tsx +0 -321
  108. package/src/components/Panel/LabelEditor.tsx +0 -67
  109. package/src/components/Panel/NonResponsiveActions.tsx +0 -79
  110. package/src/components/Panel/__screenshots__/linux/panel-SomePanel.png +0 -0
  111. package/src/components/Panel/index.tsx +0 -912
  112. package/src/components/Panel/panel.screenshot.tsx +0 -29
  113. package/src/components/Paragraph/index.tsx +0 -43
  114. package/src/components/Popover/index.tsx +0 -68
  115. package/src/components/RadioGroup/index.tsx +0 -71
  116. package/src/components/Slider/index.tsx +0 -358
  117. package/src/components/Spacer/index.tsx +0 -142
  118. package/src/components/Spinner/index.tsx +0 -74
  119. package/src/components/Table/body.tsx +0 -109
  120. package/src/components/Table/cell.tsx +0 -136
  121. package/src/components/Table/header.tsx +0 -236
  122. package/src/components/Table/headerCell.tsx +0 -203
  123. package/src/components/Table/helpers.ts +0 -308
  124. package/src/components/Table/index.tsx +0 -797
  125. package/src/components/Table/row.tsx +0 -288
  126. package/src/components/Table/value.tsx +0 -28
  127. package/src/components/Tabs/content.tsx +0 -68
  128. package/src/components/Tabs/index.tsx +0 -124
  129. package/src/components/Tabs/item.tsx +0 -198
  130. package/src/components/Tabs/list.tsx +0 -381
  131. package/src/components/Tag/group.tsx +0 -73
  132. package/src/components/Tag/index.tsx +0 -463
  133. package/src/components/Textarea/index.tsx +0 -277
  134. package/src/components/TimeAgo/index.tsx +0 -15
  135. package/src/components/Tree/index.tsx +0 -271
  136. package/src/constants/animations.ts +0 -9
  137. package/src/constants/colors.ts +0 -13
  138. package/src/constants/paging.ts +0 -93
  139. package/src/constants/sizes.ts +0 -185
  140. package/src/constants/theme.ts +0 -122
  141. package/src/containers/Paging.tsx +0 -136
  142. package/src/containers/PopoverProvider.tsx +0 -124
  143. package/src/containers/ReqoreProvider.tsx +0 -289
  144. package/src/containers/ThemeProvider.tsx +0 -12
  145. package/src/containers/UIProvider.tsx +0 -101
  146. package/src/context/PopoverContext.tsx +0 -11
  147. package/src/context/ReqoreContext.tsx +0 -47
  148. package/src/context/ThemeContext.tsx +0 -4
  149. package/src/helpers/animations.ts +0 -13
  150. package/src/helpers/colors.ts +0 -335
  151. package/src/helpers/time.ts +0 -21
  152. package/src/helpers/utils.ts +0 -152
  153. package/src/hooks/useAutoFocus.ts +0 -106
  154. package/src/hooks/useCloneThroughFragments.ts +0 -39
  155. package/src/hooks/useCombinedRefs.ts +0 -26
  156. package/src/hooks/useLatestZIndex.ts +0 -13
  157. package/src/hooks/useOutsideClick.ts +0 -29
  158. package/src/hooks/usePaging.ts +0 -128
  159. package/src/hooks/usePopover.tsx +0 -220
  160. package/src/hooks/useQueryWithDelay.ts +0 -30
  161. package/src/hooks/useReqore.ts +0 -12
  162. package/src/hooks/useReqoreContext.ts +0 -16
  163. package/src/hooks/useReqoreEffect.ts +0 -49
  164. package/src/hooks/useTextareaAutoSize.ts +0 -22
  165. package/src/hooks/useTheme.ts +0 -48
  166. package/src/hooks/useTooltip.ts +0 -40
  167. package/src/hooks/useWhyDidYouUpdate.ts +0 -32
  168. package/src/icons.json +0 -2295
  169. package/src/index.tsx +0 -80
  170. package/src/mock/breadcrumbs.ts +0 -146
  171. package/src/mock/collectionData.tsx +0 -380
  172. package/src/mock/data.json +0 -11000
  173. package/src/mock/icons.ts +0 -32
  174. package/src/mock/menu.ts +0 -93
  175. package/src/mock/multiSelect.ts +0 -71
  176. package/src/mock/object.json +0 -317
  177. package/src/mock/styleMock.js +0 -1
  178. package/src/mock/tableData.ts +0 -64
  179. package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -27
  180. package/src/stories/Button/Button.stories.tsx +0 -405
  181. package/src/stories/Checkbox/Checkbox.stories.tsx +0 -75
  182. package/src/stories/Collection/Collection.stories.tsx +0 -317
  183. package/src/stories/Columns/Columns.stories.tsx +0 -158
  184. package/src/stories/Comment/Comment.stories.tsx +0 -136
  185. package/src/stories/ControlGroup/ControlGroup.stories.tsx +0 -399
  186. package/src/stories/DatePicker/DatePicker.stories.tsx +0 -348
  187. package/src/stories/Drawer/Drawer.stories.tsx +0 -294
  188. package/src/stories/Dropdown/Dropdown.stories.tsx +0 -375
  189. package/src/stories/Dropdown/DropdownTests.stories.tsx +0 -111
  190. package/src/stories/ExportModal/ExportModal.stories.tsx +0 -18
  191. package/src/stories/Header/Header.stories.tsx +0 -108
  192. package/src/stories/Icon/Icon.stories.tsx +0 -162
  193. package/src/stories/Input/Input.stories.tsx +0 -220
  194. package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +0 -346
  195. package/src/stories/Label/Label.stories.tsx +0 -33
  196. package/src/stories/Menu/Menu.stories.tsx +0 -367
  197. package/src/stories/Message/Message.stories.tsx +0 -167
  198. package/src/stories/Modal/Manager.stories.tsx +0 -192
  199. package/src/stories/Modal/Modal.stories.tsx +0 -252
  200. package/src/stories/MultiSelect/MultiSelect.stories.tsx +0 -140
  201. package/src/stories/Navbar/Navbar.stories.tsx +0 -119
  202. package/src/stories/Notifications/Interactive.stories.tsx +0 -117
  203. package/src/stories/Notifications/Notification.stories.tsx +0 -216
  204. package/src/stories/Notifications/Notifications.stories.tsx +0 -81
  205. package/src/stories/Paging/Paging.stories.tsx +0 -255
  206. package/src/stories/Panel/Panel.stories.tsx +0 -753
  207. package/src/stories/Paragraph/Paragraph.stories.tsx +0 -108
  208. package/src/stories/Popover/Popover.stories.tsx +0 -510
  209. package/src/stories/RadioGroup/RadioGroup.stories.tsx +0 -212
  210. package/src/stories/Slider/Slider.stories.tsx +0 -173
  211. package/src/stories/Spacer/Spacer.stories.tsx +0 -100
  212. package/src/stories/Spinner/Spinner.stories.tsx +0 -82
  213. package/src/stories/Table/Table.stories.tsx +0 -571
  214. package/src/stories/Tabs/Tabs.stories.tsx +0 -346
  215. package/src/stories/Tag/Tag.stories.tsx +0 -381
  216. package/src/stories/Tag/TagGroup.stories.tsx +0 -307
  217. package/src/stories/TextArea/TextArea.stories.tsx +0 -287
  218. package/src/stories/TextArea/TextAreaTests.stories.tsx +0 -108
  219. package/src/stories/Tree/Tree.stories.tsx +0 -124
  220. package/src/stories/Wrapper.tsx +0 -13
  221. package/src/stories/utils/args.ts +0 -151
  222. package/src/stories/utils.ts +0 -39
  223. package/src/styles.ts +0 -124
  224. package/src/types/global.ts +0 -211
  225. package/src/types/icons.ts +0 -2272
  226. package/tsconfig.prod.json +0 -26
@@ -1,92 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { PADDING_FROM_SIZE } from '../../constants/sizes';
4
- import { getReadableColor } from '../../helpers/colors';
5
- import { getOneLessSize, isStringSize } from '../../helpers/utils';
6
- import { IWithReqoreEffect, IWithReqoreSize } from '../../types/global';
7
- import { IReqoreEffect, StyledTextEffect } from '../Effect';
8
- import { ReqoreVerticalSpacer } from '../Spacer';
9
-
10
- export interface IReqoreMenuDividerProps
11
- extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,
12
- IWithReqoreEffect,
13
- IWithReqoreSize {
14
- label?: string | number;
15
- margin?: 'left' | 'right' | 'both' | 'none';
16
- align?: 'left' | 'center' | 'right';
17
- padded?: 'top' | 'bottom' | 'both' | 'none';
18
- line?: boolean;
19
- }
20
-
21
- export const StyledMenuDivider = styled(StyledTextEffect)`
22
- width: 100%;
23
- padding: 0;
24
- padding-top: ${({ padded, size }) =>
25
- padded === 'top' || padded === 'both' ? `${PADDING_FROM_SIZE[size]}px` : undefined};
26
- padding-bottom: ${({ padded, size }) =>
27
- padded === 'bottom' || padded === 'both' ? `${PADDING_FROM_SIZE[size]}px` : undefined};
28
- background-color: transparent;
29
-
30
- ${({ margin, size }) =>
31
- margin &&
32
- css`
33
- margin-left: ${margin === 'left' || margin === 'both'
34
- ? isStringSize(size)
35
- ? `${PADDING_FROM_SIZE[size]}px`
36
- : '10px'
37
- : undefined};
38
- margin-right: ${margin === 'right' || margin === 'both'
39
- ? isStringSize(size)
40
- ? `${PADDING_FROM_SIZE[size]}px`
41
- : '10px'
42
- : undefined};
43
- `}
44
-
45
- color: ${({ theme }) => getReadableColor(theme, undefined, undefined)};
46
- `;
47
-
48
- const ReqoreMenuDivider = forwardRef<HTMLDivElement, IReqoreMenuDividerProps>(
49
- (
50
- {
51
- label,
52
- className,
53
- effect,
54
- size = 'normal',
55
- align = 'center',
56
- padded = 'both',
57
- line,
58
- ...rest
59
- }: IReqoreMenuDividerProps,
60
- ref: any
61
- ) =>
62
- line ? (
63
- <ReqoreVerticalSpacer
64
- className={`${className || ''} reqore-menu-divider`}
65
- height={PADDING_FROM_SIZE[size]}
66
- lineSize={size}
67
- />
68
- ) : (
69
- <StyledMenuDivider
70
- as='div'
71
- {...rest}
72
- padded={padded}
73
- size={size}
74
- className={`${className || ''} reqore-menu-divider`}
75
- ref={ref}
76
- effect={
77
- {
78
- uppercase: true,
79
- spaced: 2,
80
- textAlign: align,
81
- textSize: getOneLessSize(size),
82
- weight: 'bold',
83
- ...effect,
84
- } as IReqoreEffect
85
- }
86
- >
87
- {label}
88
- </StyledMenuDivider>
89
- )
90
- );
91
-
92
- export default ReqoreMenuDivider;
@@ -1,141 +0,0 @@
1
- import { Resizable, ResizableProps } from 're-resizable';
2
- import React, { forwardRef } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { HALF_PADDING_FROM_SIZE, RADIUS_FROM_SIZE } from '../../constants/sizes';
5
- import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../../constants/theme';
6
- import ReqoreThemeProvider from '../../containers/ThemeProvider';
7
- import { changeDarkness, changeLightness, getMainBackgroundColor } from '../../helpers/colors';
8
- import { useCloneThroughFragments } from '../../hooks/useCloneThroughFragments';
9
- import { useCombinedRefs } from '../../hooks/useCombinedRefs';
10
- import { useReqoreTheme } from '../../hooks/useTheme';
11
- import {
12
- IReqoreComponent,
13
- IWithReqoreMinimal,
14
- IWithReqoreSize,
15
- IWithReqoreTransparent,
16
- } from '../../types/global';
17
- import ReqoreControlGroup, { IReqoreControlGroupProps } from '../ControlGroup';
18
-
19
- export interface IReqoreMenuProps
20
- extends IReqoreComponent,
21
- IWithReqoreMinimal,
22
- IWithReqoreTransparent,
23
- IWithReqoreSize,
24
- React.HTMLAttributes<HTMLDivElement> {
25
- children: any;
26
- position?: 'left' | 'right';
27
- width?: string;
28
- maxHeight?: string;
29
- customTheme?: IReqoreCustomTheme;
30
- intent?: TReqoreIntent;
31
- wrapText?: boolean;
32
- flat?: boolean;
33
- rounded?: boolean;
34
- padded?: boolean;
35
- itemGap?: IReqoreControlGroupProps['gapSize'];
36
- resizable?: Omit<ResizableProps, 'enable'> & {
37
- enable?: Pick<ResizableProps['enable'], 'left' | 'right'>;
38
- };
39
- showResizableBorder?: boolean;
40
- }
41
-
42
- export interface IReqoreMenuStyle extends IReqoreMenuProps {
43
- theme: IReqoreTheme;
44
- }
45
-
46
- const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
47
- width: ${({ width }) => width || undefined};
48
- min-width: ${({ width }) => (width ? undefined : '160px')};
49
- padding: ${({ padded = true, _size }) =>
50
- padded ? `${HALF_PADDING_FROM_SIZE[_size]}px` : undefined};
51
- max-height: ${({ maxHeight }) => maxHeight || undefined};
52
- overflow-y: auto;
53
- overflow-x: hidden;
54
-
55
- background-color: ${({ theme, transparent }) =>
56
- transparent ? 'transparent' : changeDarkness(getMainBackgroundColor(theme), 0.03)};
57
- border-radius: ${({ rounded, _size }) => (rounded ? `${RADIUS_FROM_SIZE[_size]}px` : `0`)};
58
-
59
- ${({ theme, position, _size, padded, isResizableLeft, showResizableBorder }) =>
60
- position === 'right' || (isResizableLeft && showResizableBorder)
61
- ? css`
62
- border-left: 1px ${isResizableLeft && showResizableBorder ? 'dashed' : 'solid'}
63
- ${changeLightness(theme.main, 0.05)};
64
- padding-left: ${!padded ? `${HALF_PADDING_FROM_SIZE[_size]}px` : undefined};
65
- `
66
- : undefined}
67
-
68
- ${({ theme, position, _size, padded, isResizableRight, showResizableBorder }) =>
69
- position === 'left' || (isResizableRight && showResizableBorder)
70
- ? css`
71
- border-right: 1px ${isResizableRight && showResizableBorder ? 'dashed' : 'solid'}
72
- ${changeLightness(theme.main, 0.05)};
73
- padding-right: ${!padded ? `${HALF_PADDING_FROM_SIZE[_size]}px` : undefined};
74
- `
75
- : undefined}
76
- `;
77
-
78
- const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
79
- (
80
- {
81
- children,
82
- position,
83
- _insidePopover,
84
- _popoverId,
85
- customTheme,
86
- intent,
87
- wrapText,
88
- flat = true,
89
- minimal,
90
- size = 'normal',
91
- itemGap,
92
- resizable,
93
- ...rest
94
- }: IReqoreMenuProps,
95
- ref
96
- ) => {
97
- const theme = useReqoreTheme('main', customTheme, intent);
98
- const { targetRef } = useCombinedRefs(ref);
99
- const { clone } = useCloneThroughFragments((props) => ({
100
- _insidePopover: props?._insidePopover ?? _insidePopover,
101
- _popoverId: props?._popoverId ?? _popoverId,
102
- customTheme: props?.customTheme || theme,
103
- wrap: 'wrap' in (props || {}) ? props.wrap : wrapText,
104
- flat: 'flat' in (props || {}) ? props.flat : flat,
105
- minimal: 'minimal' in (props || {}) ? props.minimal : minimal,
106
- size: 'size' in (props || {}) ? props.size : size,
107
- }));
108
-
109
- return (
110
- <ReqoreThemeProvider theme={theme}>
111
- <StyledReqoreMenu
112
- {...rest}
113
- {...resizable}
114
- as={!!resizable ? Resizable : 'div'}
115
- isResizableRight={resizable?.enable?.right}
116
- isResizableLeft={resizable?.enable?.left}
117
- flat={flat}
118
- position={position}
119
- _size={size}
120
- className={`${rest.className || ''} reqore-menu`}
121
- theme={theme}
122
- ref={(curRef) => {
123
- let _ref = curRef;
124
-
125
- if (curRef?.resizable) {
126
- _ref = curRef.resizable;
127
- }
128
-
129
- targetRef.current = _ref;
130
- }}
131
- >
132
- <ReqoreControlGroup vertical gapSize={itemGap} fluid>
133
- {clone(children)}
134
- </ReqoreControlGroup>
135
- </StyledReqoreMenu>
136
- </ReqoreThemeProvider>
137
- );
138
- }
139
- );
140
-
141
- export default ReqoreMenu;
@@ -1,137 +0,0 @@
1
- import React, { forwardRef, memo, useCallback, useEffect, useState } from 'react';
2
- import { useContext } from 'use-context-selector';
3
- import { ReqoreButton, ReqoreControlGroup } from '../..';
4
- import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
5
- import PopoverContext from '../../context/PopoverContext';
6
- import { useCombinedRefs } from '../../hooks/useCombinedRefs';
7
- import { IReqoreComponent } from '../../types/global';
8
- import { IReqoreButtonProps } from '../Button';
9
-
10
- export interface IReqoreMenuItemProps extends IReqoreComponent, IReqoreButtonProps {
11
- label?: string | number;
12
- selected?: boolean;
13
- itemId?: string;
14
- onRightIconClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
15
- onClick?: (event: React.MouseEvent<HTMLElement>, itemId?: string) => void;
16
- scrollIntoView?: boolean;
17
- }
18
-
19
- export interface IReqoreMenuItemStyle {
20
- theme: IReqoreTheme;
21
- selected: boolean;
22
- disabled: boolean;
23
- intent?: TReqoreIntent;
24
- }
25
-
26
- export interface IReqoreMenuItemRightIconStyle {
27
- theme: IReqoreTheme;
28
- interactive?: boolean;
29
- intent?: TReqoreIntent;
30
- }
31
-
32
- const ReqoreMenuItem = memo(
33
- forwardRef<HTMLButtonElement, IReqoreMenuItemProps>(
34
- (
35
- {
36
- children,
37
- label,
38
- icon,
39
- rightIcon,
40
- as,
41
- selected,
42
- onClick,
43
- onRightIconClick,
44
- disabled,
45
- itemId,
46
- _insidePopover,
47
- _popoverId,
48
- tooltip,
49
- intent,
50
- flat = true,
51
- scrollIntoView,
52
- ...rest
53
- }: IReqoreMenuItemProps,
54
- ref
55
- ) => {
56
- const { removePopover } = useContext(PopoverContext);
57
- const { targetRef } = useCombinedRefs<HTMLButtonElement>(ref);
58
- const [itemRef, setItemRef] = useState<HTMLButtonElement | null>(null);
59
-
60
- const handleClick = useCallback(
61
- (event: React.MouseEvent<HTMLButtonElement>) => {
62
- event.persist();
63
-
64
- onClick?.(event, itemId);
65
-
66
- if (_insidePopover && _popoverId) {
67
- removePopover!(_popoverId);
68
- }
69
- },
70
- [itemId, _insidePopover, _popoverId, onClick, removePopover]
71
- );
72
-
73
- const handleRightIconClick = useCallback(
74
- (event: React.MouseEvent<HTMLSpanElement>) => {
75
- event.persist();
76
- event.stopPropagation();
77
-
78
- if (onRightIconClick) {
79
- onRightIconClick(itemId, event);
80
-
81
- if (_insidePopover && _popoverId) {
82
- removePopover!(_popoverId);
83
- }
84
- }
85
- },
86
- [itemId, _insidePopover, _popoverId, onRightIconClick, removePopover]
87
- );
88
-
89
- useEffect(() => {
90
- if (scrollIntoView && itemRef) {
91
- itemRef.scrollIntoView?.({ behavior: 'smooth', block: 'center', inline: 'center' });
92
- }
93
- }, [itemRef, scrollIntoView]);
94
-
95
- return (
96
- <ReqoreControlGroup stack={!!onRightIconClick} fluid fill>
97
- <ReqoreButton
98
- as={as}
99
- {...rest}
100
- flat={flat}
101
- className={`${rest.className || ''} reqore-menu-item`}
102
- fluid
103
- onClick={handleClick}
104
- active={selected}
105
- ref={(ref) => {
106
- targetRef.current = ref || undefined;
107
- setItemRef(ref);
108
- }}
109
- disabled={disabled}
110
- intent={intent}
111
- icon={icon}
112
- rightIcon={onRightIconClick ? undefined : rightIcon}
113
- tooltip={tooltip}
114
- >
115
- {label || children}
116
- </ReqoreButton>
117
- {rightIcon && onRightIconClick ? (
118
- <ReqoreButton
119
- icon={rightIcon}
120
- flat={flat}
121
- fixed
122
- minimal={!onRightIconClick}
123
- customTheme={rest.customTheme}
124
- className='reqore-menu-item-right-icon'
125
- onClick={handleRightIconClick}
126
- readOnly={!onRightIconClick}
127
- intent={intent}
128
- active={selected && !!onRightIconClick}
129
- />
130
- ) : null}
131
- </ReqoreControlGroup>
132
- );
133
- }
134
- )
135
- );
136
-
137
- export default ReqoreMenuItem;
@@ -1,81 +0,0 @@
1
- import React, { useCallback, useEffect, useState } from 'react';
2
- import { TReqoreIntent } from '../../constants/theme';
3
- import { useCloneThroughFragments } from '../../hooks/useCloneThroughFragments';
4
- import { IReqoreComponent } from '../../types/global';
5
- import ReqoreButton, { IReqoreButtonProps } from '../Button';
6
- import ReqoreControlGroup from '../ControlGroup';
7
-
8
- export interface IReqoreMenuSectionProps extends IReqoreComponent, IReqoreButtonProps {
9
- children: any;
10
- collapsible?: boolean;
11
- isCollapsed?: boolean;
12
- onCollapseChange?: (collapsed: boolean) => void;
13
- activeIntent?: TReqoreIntent;
14
- }
15
-
16
- export const ReqoreMenuSection = ({
17
- children,
18
- _insidePopover,
19
- _popoverId,
20
- customTheme,
21
- wrap,
22
- flat,
23
- minimal,
24
- collapsible = true,
25
- isCollapsed,
26
- activeIntent,
27
- onCollapseChange,
28
- ...rest
29
- }: IReqoreMenuSectionProps) => {
30
- const [_isCollapsed, setIsCollapsed] = useState(isCollapsed);
31
-
32
- useEffect(() => {
33
- setIsCollapsed(isCollapsed);
34
- }, [isCollapsed]);
35
-
36
- const handleCollapseChange = useCallback(
37
- (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
38
- if (collapsible) {
39
- setIsCollapsed(!_isCollapsed);
40
- onCollapseChange?.(!_isCollapsed);
41
- }
42
-
43
- rest.onClick?.(event);
44
- },
45
- [_isCollapsed, onCollapseChange, collapsible, rest.onClick]
46
- );
47
-
48
- const { clone } = useCloneThroughFragments((props) => ({
49
- _insidePopover: props?._insidePopover ?? _insidePopover,
50
- _popoverId: props?._popoverId ?? _popoverId,
51
- customTheme: props?.customTheme || customTheme,
52
- wrap: 'wrap' in (props || {}) ? props.wrap : wrap,
53
- flat: 'flat' in (props || {}) ? props.flat : flat,
54
- minimal: 'minimal' in (props || {}) ? props.minimal : minimal,
55
- }));
56
-
57
- return (
58
- <ReqoreControlGroup vertical fluid className='reqore-menu-section'>
59
- <ReqoreButton
60
- wrap={wrap}
61
- flat={flat}
62
- minimal={minimal}
63
- active={collapsible && !_isCollapsed}
64
- {...rest}
65
- className={`${rest.className || ''} reqore-menu-section-toggle`}
66
- intent={collapsible && !_isCollapsed ? activeIntent : rest.intent}
67
- fluid
68
- onClick={handleCollapseChange}
69
- rightIcon={rest.rightIcon || (collapsible ? 'ArrowRightSLine' : 'ArrowDownSLine')}
70
- rightIconProps={{
71
- rotation: collapsible && !_isCollapsed ? 90 : 0,
72
- }}
73
- />
74
- {!_isCollapsed || !collapsible ? (
75
- <ReqoreControlGroup vertical fluid style={{ paddingLeft: '10px' }}>
76
- {clone(children)}
77
- </ReqoreControlGroup>
78
- ) : null}
79
- </ReqoreControlGroup>
80
- );
81
- };
@@ -1,220 +0,0 @@
1
- import { animated } from '@react-spring/web';
2
- import React, { forwardRef, memo, useEffect, useMemo, useState } from 'react';
3
- import { useMount, useUnmount } from 'react-use';
4
- import { IReqoreTheme } from '../../constants/theme';
5
- import ReqoreThemeProvider from '../../containers/ThemeProvider';
6
- import { getColorFromMaybeString } from '../../helpers/colors';
7
- import { useCombinedRefs } from '../../hooks/useCombinedRefs';
8
- import { useReqoreTheme } from '../../hooks/useTheme';
9
- import { useTooltip } from '../../hooks/useTooltip';
10
- import {
11
- IReqoreIntent,
12
- IWithReqoreCustomTheme,
13
- IWithReqoreEffect,
14
- IWithReqoreFixed,
15
- IWithReqoreFluid,
16
- IWithReqoreMinimal,
17
- IWithReqoreOpaque,
18
- IWithReqoreSize,
19
- IWithReqoreTooltip,
20
- } from '../../types/global';
21
- import { IReqoreIconName } from '../../types/icons';
22
- import { TReqoreEffectColor } from '../Effect';
23
- import { ReqoreHeading } from '../Header';
24
- import ReqoreIcon, { IReqoreIconProps } from '../Icon';
25
- import {
26
- StyledIconWrapper,
27
- StyledNotificationContent,
28
- StyledNotificationContentWrapper,
29
- StyledNotificationInnerContent,
30
- StyledReqoreNotification,
31
- typeToIcon,
32
- } from '../Notifications/notification';
33
- import { ReqoreSpinner } from '../Spinner';
34
-
35
- export interface IReqoreMessageProps
36
- extends IWithReqoreCustomTheme,
37
- IWithReqoreEffect,
38
- IWithReqoreSize,
39
- IReqoreIntent,
40
- IWithReqoreMinimal,
41
- IWithReqoreOpaque,
42
- IWithReqoreTooltip,
43
- IWithReqoreFixed,
44
- IWithReqoreFluid,
45
- React.HTMLAttributes<HTMLDivElement> {
46
- title?: string;
47
- children: any;
48
- icon?: IReqoreIconName;
49
- iconColor?: TReqoreEffectColor;
50
- iconProps?: IReqoreIconProps;
51
- onClose?: () => any;
52
- onClick?: () => any;
53
- duration?: number;
54
- onFinish?: () => any;
55
- flat?: boolean;
56
- hasShadow?: boolean;
57
- margin?: 'top' | 'bottom' | 'both' | 'none';
58
- }
59
-
60
- export interface IReqoreNotificationStyle extends IReqoreMessageProps {
61
- theme: IReqoreTheme;
62
- clickable?: boolean;
63
- timeout?: number;
64
- }
65
-
66
- const ReqoreMessage = memo(
67
- forwardRef<HTMLDivElement, IReqoreMessageProps>(
68
- (
69
- {
70
- intent,
71
- icon,
72
- title,
73
- children,
74
- onClose,
75
- onClick,
76
- duration,
77
- onFinish,
78
- flat,
79
- minimal,
80
- size = 'normal',
81
- customTheme,
82
- iconColor,
83
- tooltip,
84
- fixed,
85
- fluid,
86
- iconProps,
87
- ...rest
88
- },
89
- ref
90
- ) => {
91
- const [internalTimeout, setInternalTimeout] = useState<NodeJS.Timeout | null>(null);
92
- const theme = useReqoreTheme('main', customTheme, intent);
93
- const { targetRef } = useCombinedRefs(ref);
94
- const [itemRef, setItemRef] = useState<HTMLDivElement>(undefined);
95
-
96
- useTooltip(itemRef, tooltip);
97
-
98
- useMount(() => {
99
- if (duration) {
100
- setInternalTimeout(
101
- setTimeout(() => {
102
- onFinish && onFinish();
103
- }, duration)
104
- );
105
- }
106
- });
107
-
108
- useEffect(() => {
109
- if (internalTimeout) {
110
- clearTimeout(internalTimeout);
111
- setInternalTimeout(
112
- setTimeout(() => {
113
- onFinish && onFinish();
114
- }, duration)
115
- );
116
- }
117
- }, [duration, intent, children, title]);
118
-
119
- useUnmount(() => {
120
- if (internalTimeout) {
121
- clearTimeout(internalTimeout);
122
- }
123
- });
124
-
125
- const leftIcon: IReqoreIconName | undefined = useMemo(
126
- () => icon || (intent ? typeToIcon[intent] : undefined),
127
- [icon, intent]
128
- );
129
-
130
- return (
131
- <ReqoreThemeProvider>
132
- <StyledReqoreNotification
133
- {...rest}
134
- effect={{
135
- interactive: !!onClick,
136
- ...rest?.effect,
137
- }}
138
- as={animated.div}
139
- key={`${duration}${intent}${title}${children}`}
140
- intent={intent}
141
- timeout={duration}
142
- clickable={!!onClick}
143
- onClick={onClick}
144
- flat={flat}
145
- minimal={minimal}
146
- asMessage
147
- fluid={fluid}
148
- fixed={fixed}
149
- className={`${rest?.className || ''} reqore-message`}
150
- ref={(ref) => {
151
- targetRef.current = ref;
152
- setItemRef(ref);
153
- }}
154
- size={size}
155
- theme={theme}
156
- >
157
- <StyledNotificationContentWrapper size={size} theme={theme}>
158
- {leftIcon ? (
159
- <>
160
- {intent === 'pending' ? (
161
- <ReqoreSpinner
162
- size={size}
163
- iconColor={iconColor}
164
- type={5}
165
- iconMargin={'right'}
166
- iconProps={iconProps}
167
- />
168
- ) : (
169
- <ReqoreIcon
170
- icon={leftIcon}
171
- margin={'right'}
172
- size={size}
173
- color={iconColor}
174
- {...iconProps}
175
- />
176
- )}
177
- </>
178
- ) : null}
179
- <StyledNotificationInnerContent>
180
- {title && (
181
- <ReqoreHeading
182
- size={size}
183
- customTheme={
184
- rest.effect?.color
185
- ? { text: { color: getColorFromMaybeString(theme, rest.effect.color) } }
186
- : undefined
187
- }
188
- >
189
- {title}
190
- </ReqoreHeading>
191
- )}
192
-
193
- <StyledNotificationContent theme={theme} hasTitle={!!title} size={size}>
194
- {children}
195
- </StyledNotificationContent>
196
- </StyledNotificationInnerContent>
197
- </StyledNotificationContentWrapper>
198
- {onClose && (
199
- <StyledIconWrapper
200
- theme={theme}
201
- size={size}
202
- intent={intent}
203
- clickable
204
- className='reqore-message-close'
205
- onClick={(event) => {
206
- event.stopPropagation();
207
- onClose && onClose();
208
- }}
209
- >
210
- <ReqoreIcon icon='CloseFill' margin='both' size={size} />
211
- </StyledIconWrapper>
212
- )}
213
- </StyledReqoreNotification>
214
- </ReqoreThemeProvider>
215
- );
216
- }
217
- )
218
- );
219
-
220
- export default ReqoreMessage;
@@ -1,26 +0,0 @@
1
- import { IReqoreTheme } from '../../constants/theme';
2
- import { IReqoreDrawerProps, ReqoreDrawer } from '../Drawer';
3
-
4
- export interface IReqoreModalProps extends Omit<IReqoreDrawerProps, 'position'> {
5
- position?: 'top' | 'center' | 'bottom';
6
- width?: string;
7
- height?: string;
8
- }
9
-
10
- export interface IReqoreModalStyle extends IReqoreModalProps {
11
- theme: IReqoreTheme;
12
- zIndex?: number;
13
- }
14
-
15
- export const ReqoreModal = ({ width = '80vw', height = 'auto', ...rest }: IReqoreModalProps) => {
16
- return (
17
- <ReqoreDrawer
18
- {...rest}
19
- width={width}
20
- height={height}
21
- position='left'
22
- _isModal
23
- className={`${rest.className || ''} reqore-modal`}
24
- />
25
- );
26
- };