@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,59 +0,0 @@
1
- import { animated, useTransition } from '@react-spring/web';
2
- import styled from 'styled-components';
3
- import { SPRING_CONFIG } from '../../constants/animations';
4
- import { SIZE_TO_PX } from '../../constants/sizes';
5
- import { IReqoreButtonProps } from '../Button';
6
- import ReqoreIcon from '../Icon';
7
-
8
- export interface IReqoreInputClearButtonProps extends IReqoreButtonProps {
9
- show: boolean;
10
- enabled: boolean;
11
- hasRightIcon?: boolean;
12
- }
13
-
14
- export const StyledInputClearButton = styled(ReqoreIcon)<{ show?: boolean }>`
15
- position: absolute;
16
- right: ${({ size, hasRightIcon }) => (hasRightIcon ? SIZE_TO_PX[size] : 0)}px;
17
- top: 0;
18
- justify-content: center;
19
- align-items: center;
20
- transition: all 0.1s ease-out;
21
- cursor: pointer;
22
-
23
- &:hover {
24
- opacity: 1 !important;
25
- }
26
- `;
27
-
28
- const ReqoreInputClearButton = ({
29
- show,
30
- enabled,
31
- size = 'normal',
32
- ...rest
33
- }: IReqoreInputClearButtonProps) => {
34
- const transitions = useTransition(show && enabled, {
35
- from: { opacity: 0, filter: 'blur(10px)' },
36
- enter: { opacity: 0.5, filter: 'blur(0px)' },
37
- leave: { opacity: 0, filter: 'blur(10px)' },
38
- config: SPRING_CONFIG,
39
- });
40
-
41
- return transitions((styles, item) =>
42
- item ? (
43
- <StyledInputClearButton
44
- {...rest}
45
- className='reqore-clear-input-button'
46
- icon='CloseLine'
47
- wrapperElement={animated.span}
48
- size={size}
49
- wrapperSize={SIZE_TO_PX[size]}
50
- show={show}
51
- style={{
52
- opacity: styles.opacity,
53
- }}
54
- />
55
- ) : null
56
- );
57
- };
58
-
59
- export default ReqoreInputClearButton;
@@ -1,303 +0,0 @@
1
- import { cloneDeep, isString } from 'lodash';
2
- import { rgba } from 'polished';
3
- import React, { MutableRefObject, memo, useEffect, useRef, useState } from 'react';
4
- import { createPortal } from 'react-dom';
5
- import { usePopper } from 'react-popper';
6
- import { useUnmount, useUpdateEffect } from 'react-use';
7
- import styled, { css } from 'styled-components';
8
- import { useContext } from 'use-context-selector';
9
- import { RADIUS_FROM_SIZE } from '../../constants/sizes';
10
- import { IReqoreTheme } from '../../constants/theme';
11
- import { IPopoverData } from '../../containers/PopoverProvider';
12
- import ReqoreThemeProvider from '../../containers/ThemeProvider';
13
- import PopoverContext from '../../context/PopoverContext';
14
- import { fadeIn } from '../../helpers/animations';
15
- import {
16
- changeLightness,
17
- getColorFromMaybeString,
18
- getNotificationIntent,
19
- } from '../../helpers/colors';
20
- import ReqoreMessage from '../Message';
21
-
22
- const getPopoverArrowColor = ({ theme, dim, intent, flat, effect, isOpaque }) =>
23
- rgba(
24
- effect
25
- ? changeLightness(
26
- getColorFromMaybeString(
27
- theme,
28
- effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
29
- ),
30
- 0.04
31
- )
32
- : intent
33
- ? changeLightness(getNotificationIntent(theme, intent), flat ? 0.1 : 0.2)
34
- : theme.popover?.main ||
35
- rgba(
36
- changeLightness(
37
- flat ? theme.main : getNotificationIntent(theme, intent),
38
- flat ? 0.1 : 0.2
39
- ),
40
- isOpaque ? 1 : 0.3
41
- ),
42
- dim ? 0.3 : 1
43
- );
44
-
45
- const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
46
- width: 10px;
47
- height: 10px;
48
- position: absolute;
49
- z-index: -1;
50
-
51
- &:before {
52
- content: '';
53
- display: block;
54
- width: 0;
55
- height: 0;
56
- position: absolute;
57
- z-index: -1;
58
- }
59
- `;
60
-
61
- export const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
62
- animation: 0.2s ${fadeIn} ease-out;
63
- max-width: ${({ maxWidth }) => maxWidth};
64
- max-height: ${({ maxHeight }) => maxHeight};
65
- z-index: 999999;
66
- border-radius: ${RADIUS_FROM_SIZE.normal}px;
67
- border: ${({ flat, noWrapper, ...rest }: any) =>
68
- !flat && noWrapper ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
69
-
70
- ${({ transparent }) =>
71
- !transparent &&
72
- css`
73
- box-shadow: rgba(31, 26, 34, 0.7) 0px 0px 10px;
74
- `}
75
-
76
- &[data-popper-placement^='top'] > ${StyledPopoverArrow} {
77
- bottom: -5px;
78
-
79
- &:before {
80
- border-left: 10px solid transparent;
81
- border-right: 10px solid transparent;
82
- border-top: 10px solid ${(props) => getPopoverArrowColor(props)};
83
-
84
- top: 5px;
85
- left: -5px;
86
- }
87
- }
88
-
89
- &[data-popper-placement^='bottom'] > ${StyledPopoverArrow} {
90
- top: -5px;
91
-
92
- &:before {
93
- border-left: 10px solid transparent;
94
- border-right: 10px solid transparent;
95
- border-bottom: 10px solid ${(props) => getPopoverArrowColor(props)};
96
-
97
- top: -5px;
98
- left: -5px;
99
- }
100
- }
101
-
102
- &[data-popper-placement^='left'] > ${StyledPopoverArrow} {
103
- right: -5px;
104
-
105
- &:before {
106
- border-top: 10px solid transparent;
107
- border-bottom: 10px solid transparent;
108
- border-left: 10px solid ${(props) => getPopoverArrowColor(props)};
109
-
110
- top: -5px;
111
- left: 5px;
112
- }
113
- }
114
-
115
- &[data-popper-placement^='right'] > ${StyledPopoverArrow} {
116
- left: -5px;
117
-
118
- &:before {
119
- border-top: 10px solid transparent;
120
- border-bottom: 10px solid transparent;
121
- border-right: 10px solid ${(props) => getPopoverArrowColor(props)};
122
-
123
- top: -5px;
124
- left: -5px;
125
- }
126
- }
127
-
128
- &[data-popper-reference-hidden='true'] {
129
- visibility: hidden;
130
- pointer-events: none;
131
- }
132
- `;
133
-
134
- export const StyledPopoverContent = styled.div`
135
- width: 100%;
136
- height: 100%;
137
- z-index: 20;
138
- position: relative;
139
- overflow: hidden;
140
- `;
141
-
142
- export interface IReqoreInternalPopoverProps extends IPopoverData {}
143
-
144
- const InternalPopover: React.FC<IReqoreInternalPopoverProps> = memo(
145
- ({
146
- targetElement,
147
- content,
148
- id,
149
- placement,
150
- noArrow,
151
- noWrapper,
152
- useTargetWidth,
153
- transparent,
154
- maxWidth,
155
- maxHeight,
156
- intent,
157
- title,
158
- icon,
159
- minimal,
160
- flat = true,
161
- uiScale,
162
- effect,
163
- }) => {
164
- const { removePopover, updatePopover, uiScale: globalUiScale } = useContext(PopoverContext);
165
- const [popperElement, setPopperElement] = useState(null);
166
- const [arrowElement, setArrowElement] = useState(null);
167
- const popperRef: MutableRefObject<any> = useRef(null);
168
- const mutationObserber: MutableRefObject<any> = useRef(null);
169
- const { styles, attributes, forceUpdate, state } = usePopper(targetElement, popperElement, {
170
- placement,
171
- modifiers: [
172
- {
173
- name: 'offset',
174
- options: {
175
- offset: [0, noArrow ? 5 : 10],
176
- },
177
- },
178
- {
179
- name: 'arrow',
180
- options: {
181
- element: arrowElement,
182
- },
183
- },
184
- {
185
- name: 'hide',
186
- enabled: true,
187
- },
188
- ],
189
- });
190
-
191
- useUpdateEffect(() => {
192
- if (!mutationObserber.current && targetElement && state) {
193
- // Watch for changes in the target element
194
- const observer = new MutationObserver(() => {
195
- forceUpdate();
196
- });
197
-
198
- observer.observe(document, {
199
- attributes: true,
200
- childList: true,
201
- subtree: true,
202
- });
203
-
204
- mutationObserber.current = observer;
205
- }
206
- }, [styles, attributes, state]);
207
-
208
- useUnmount(() => {
209
- mutationObserber.current?.disconnect();
210
- });
211
-
212
- useEffect(() => {
213
- if (popperRef.current) {
214
- updatePopover?.(id, { popperRef: cloneDeep(popperRef) });
215
- }
216
- }, [popperRef]);
217
-
218
- useEffect(() => {
219
- if (attributes.popper?.['data-popper-reference-hidden']) {
220
- removePopover?.(id);
221
- }
222
- }, [attributes.popper]);
223
-
224
- /* Getting the x and y values from the transform property of the popper element. */
225
- const translateValues = styles.popper.transform
226
- ?.replace('translate3d(', '')
227
- .replace('translate(', '')
228
- .replace(')', '')
229
- .split(',')
230
- .map((axis) => {
231
- const scale = uiScale || globalUiScale;
232
- let modifiedAxis = parseInt(axis, 10);
233
-
234
- if (scale || scale === 0) {
235
- modifiedAxis =
236
- parseInt(axis, 10) < 0 ? parseInt(axis, 10) * scale : parseInt(axis, 10) / scale;
237
- }
238
-
239
- return modifiedAxis;
240
- });
241
-
242
- return createPortal(
243
- <ReqoreThemeProvider>
244
- <StyledPopoverWrapper
245
- maxWidth={maxWidth}
246
- maxHeight={maxHeight}
247
- transparent={transparent}
248
- effect={effect}
249
- isOpaque={!transparent && !minimal}
250
- intent={intent}
251
- flat={flat}
252
- noWrapper={noWrapper}
253
- dim={flat && !transparent && !effect && minimal}
254
- className='reqore-popover-content'
255
- ref={(el) => {
256
- setPopperElement(el);
257
- popperRef.current = el;
258
- }}
259
- style={{
260
- ...styles.popper,
261
- transform: `translate(${translateValues?.[0] || 0}px, ${translateValues?.[1] || 0}px)`,
262
- width: useTargetWidth && (targetElement?.getBoundingClientRect()?.width || undefined),
263
- }}
264
- {...attributes.popper}
265
- >
266
- {!noArrow && !transparent ? (
267
- <StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
268
- ) : null}
269
- <StyledPopoverContent>
270
- {!noWrapper || isString(content) ? (
271
- <ReqoreMessage
272
- opaque={!transparent && !minimal}
273
- className='reqore-popover-text'
274
- intent={intent}
275
- title={title}
276
- icon={icon}
277
- minimal={transparent}
278
- flat={flat || transparent}
279
- effect={effect}
280
- >
281
- {content}
282
- </ReqoreMessage>
283
- ) : (
284
- <>
285
- {React.Children.map(content, (child) =>
286
- child
287
- ? React.cloneElement(child, {
288
- _insidePopover: true,
289
- _popoverId: id,
290
- })
291
- : null
292
- )}
293
- </>
294
- )}
295
- </StyledPopoverContent>
296
- </StyledPopoverWrapper>
297
- </ReqoreThemeProvider>,
298
- document.querySelector('#reqore-portal')!
299
- );
300
- }
301
- );
302
-
303
- export default InternalPopover;
@@ -1,192 +0,0 @@
1
- import { keys, omit } from 'lodash';
2
- import { useMemo } from 'react';
3
- import { TReqoreIntent } from '../../constants/theme';
4
- import { IReqoreTooltip } from '../../types/global';
5
- import { IReqoreIconName } from '../../types/icons';
6
- import { IReqoreButtonProps } from '../Button';
7
- import { IReqoreExportModalProps } from '../ExportModal';
8
- import { IReqorePanelProps } from '../Panel';
9
- import ReqoreTable, {
10
- IReqoreTableColumn,
11
- IReqoreTableProps,
12
- IReqoreTableRowData,
13
- TReqoreTableColumnContent,
14
- } from '../Table';
15
- import { IReqoreTableValueProps, ReqoreTableValue } from '../Table/value';
16
-
17
- export type TReqoreKeyValueTablePrimitiveValue = string | number | boolean | null | undefined;
18
- export type TReqoreKeyValueTableValue =
19
- | TReqoreKeyValueTablePrimitiveValue
20
- | TReqoreKeyValueTablePrimitiveValue[]
21
- | { [key: string]: TReqoreKeyValueTableValue };
22
- export type TReqoreKeyValueTableExportMapper = (
23
- data: { tableKey: TReqoreTableColumnContent; value: TReqoreTableColumnContent }[]
24
- ) => IReqoreExportModalProps['data'];
25
-
26
- export interface IReqoreKeyValueTableProps
27
- extends IReqorePanelProps,
28
- Pick<
29
- IReqoreTableProps,
30
- | 'striped'
31
- | 'width'
32
- | 'height'
33
- | 'fill'
34
- | 'filterable'
35
- | 'exportable'
36
- | 'filter'
37
- | 'onFilterChange'
38
- | 'filterProps'
39
- | 'zoomable'
40
- | 'wrapperSize'
41
- | 'paging'
42
- | 'onRowClick'
43
- > {
44
- data: { [key: string | number]: TReqoreKeyValueTableValue };
45
-
46
- keyLabel?: string;
47
- keyIcon?: IReqoreIconName;
48
- keyTooltip?: (key: string | number) => string | IReqoreTooltip;
49
- keyColumnIntent?: TReqoreIntent;
50
- keyAlign?: IReqoreTableColumn['align'];
51
- maxKeyWidth?: number;
52
-
53
- sortable?: boolean;
54
-
55
- rowActions?: Partial<Omit<IReqoreTableColumn, 'cell'>> & {
56
- actions: (
57
- key: string,
58
- value: TReqoreKeyValueTableValue
59
- ) => Omit<IReqoreButtonProps, 'rightIcon' | 'label' | 'children'>[];
60
- };
61
-
62
- valueLabel?: string;
63
- valueIcon?: IReqoreIconName;
64
- valueTooltip?: (value: TReqoreKeyValueTableValue) => string | IReqoreTooltip;
65
- valueAlign?: IReqoreTableColumn['align'];
66
- minValueWidth?: number;
67
- defaultValueFilter?: string | number;
68
-
69
- keyRenderer?: (keyLabel: string | number) => string | number;
70
-
71
- valueRenderer?: (
72
- data: IReqoreTableRowData,
73
- defaultComponent?: ({ value }: IReqoreTableValueProps) => any
74
- ) => any;
75
-
76
- exportMapper?: TReqoreKeyValueTableExportMapper;
77
- }
78
-
79
- export const ReqoreKeyValueTable = ({
80
- data,
81
- keyLabel,
82
- keyIcon,
83
- keyRenderer,
84
- keyTooltip,
85
- valueLabel,
86
- valueIcon,
87
- valueTooltip,
88
- valueRenderer,
89
- keyColumnIntent,
90
- minValueWidth = 100,
91
- maxKeyWidth = 200,
92
- keyAlign = 'left',
93
- valueAlign = 'left',
94
- defaultValueFilter,
95
- sortable,
96
- rowActions,
97
- ...rest
98
- }: IReqoreKeyValueTableProps) => {
99
- const { columns, items } = useMemo(() => {
100
- const columns: IReqoreTableColumn[] = [
101
- {
102
- dataId: 'tableKey',
103
- grow: 1,
104
- sortable,
105
- width: maxKeyWidth < 150 ? maxKeyWidth : 150,
106
- pin: 'left',
107
- hideable: false,
108
- intent: keyColumnIntent,
109
- maxWidth: maxKeyWidth,
110
- align: keyAlign,
111
-
112
- header: {
113
- icon: keyIcon,
114
- label: keyLabel,
115
- },
116
-
117
- cell: {
118
- tooltip: keyTooltip ? (cellValue) => keyTooltip(cellValue) : undefined,
119
- content: keyRenderer ? ({ tableKey }) => keyRenderer(tableKey) : 'title',
120
- },
121
- },
122
- {
123
- dataId: 'value',
124
- grow: 3,
125
- sortable,
126
- hideable: false,
127
- filterable: true,
128
- pinnable: false,
129
- minWidth: minValueWidth,
130
- filter: defaultValueFilter,
131
- align: valueAlign,
132
-
133
- header: {
134
- icon: valueIcon,
135
- label: valueLabel,
136
- },
137
-
138
- cell: {
139
- tooltip: valueTooltip ? (cellValue) => valueTooltip(cellValue) : undefined,
140
- content: (data) =>
141
- valueRenderer?.(data, ReqoreTableValue) || <ReqoreTableValue value={data.value} />,
142
- },
143
- },
144
- ];
145
-
146
- if (rowActions) {
147
- columns.push({
148
- dataId: 'actions',
149
- hideable: false,
150
- pin: 'right',
151
- header: {
152
- icon: 'SettingsLine',
153
- },
154
- align: 'center',
155
- ...omit(rowActions, ['actions']),
156
- cell: {
157
- padded: 'none',
158
- actions: (data) => rowActions.actions(data.tableKey, data.value),
159
- },
160
- });
161
- }
162
-
163
- const items: IReqoreTableRowData[] = [];
164
-
165
- keys(data).map((key) => {
166
- items.push({
167
- tableKey: key,
168
- value: data[key],
169
- });
170
- });
171
-
172
- return { columns, items };
173
- }, [data]);
174
-
175
- return (
176
- <ReqoreTable
177
- columns={columns}
178
- data={items}
179
- {...rest}
180
- sort={
181
- sortable
182
- ? {
183
- by: 'tableKey',
184
- thenBy: 'value',
185
- direction: 'asc',
186
- }
187
- : undefined
188
- }
189
- className={`${rest.className || ''} reqore-key-value-table`}
190
- />
191
- );
192
- };
@@ -1,10 +0,0 @@
1
- import React, { forwardRef, Ref } from 'react';
2
- import ReqoreTag, { IReqoreCustomTagProps } from '../Tag';
3
-
4
- export interface IReqoreLabelProps
5
- extends IReqoreCustomTagProps,
6
- Omit<React.ComponentPropsWithoutRef<'label'>, 'color'> {}
7
-
8
- export const ReqoreLabel = forwardRef((props: IReqoreLabelProps, ref: Ref<HTMLLabelElement>) => {
9
- return <ReqoreTag as='label' color='transparent' {...props} ref={ref} />;
10
- });
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
-
4
- export interface IReqoreLayoutContentProps
5
- extends React.HTMLAttributes<HTMLDivElement> {
6
- children?: any;
7
- withSidebar?: boolean;
8
- }
9
-
10
- const StyledReqoreLayoutContent = styled.div`
11
- display: flex;
12
- height: 100%;
13
- flex: 1;
14
- overflow: hidden;
15
- flex-flow: column;
16
- `;
17
-
18
- const ReqoreLayoutWrapper = ({
19
- children,
20
- className,
21
- ...rest
22
- }: IReqoreLayoutContentProps) => (
23
- <StyledReqoreLayoutContent
24
- {...rest}
25
- className={`${className || ""} reqore-layout-content`}
26
- >
27
- {children}
28
- </StyledReqoreLayoutContent>
29
- );
30
-
31
- export default ReqoreLayoutWrapper;
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { IReqoreTheme } from '../../constants/theme';
4
- import ReqoreThemeProvider from '../../containers/ThemeProvider';
5
- import { changeLightness, getReadableColor } from '../../helpers/colors';
6
-
7
- export interface IReqoreLayoutWrapperProps
8
- extends React.HTMLAttributes<HTMLDivElement> {
9
- children?: any;
10
- withSidebar?: boolean;
11
- }
12
-
13
- const StyledReqoreLayoutWrapper = styled.div<{
14
- withSidebar: boolean;
15
- theme: IReqoreTheme;
16
- }>`
17
- display: flex;
18
- width: 100%;
19
- height: 100%;
20
- overflow: hidden;
21
- font-size: 14px;
22
-
23
- * {
24
- box-sizing: border-box;
25
- }
26
-
27
- a {
28
- text-decoration: none;
29
- }
30
-
31
- ${({ withSidebar, theme }) => css`
32
- flex-flow: ${withSidebar ? 'row' : 'column'};
33
- background-color: ${changeLightness(theme.main, 0.02)};
34
- color: ${getReadableColor(theme, undefined, undefined, true)};
35
- `}
36
- `;
37
-
38
- const ReqoreLayoutWrapper = ({
39
- withSidebar,
40
- children,
41
- className,
42
- ...rest
43
- }: IReqoreLayoutWrapperProps) => (
44
- <ReqoreThemeProvider>
45
- <StyledReqoreLayoutWrapper
46
- {...rest}
47
- className={`${className || ''} reqore-layout-wrapper`}
48
- withSidebar={withSidebar}
49
- >
50
- {children}
51
- </StyledReqoreLayoutWrapper>
52
- </ReqoreThemeProvider>
53
- );
54
-
55
- export default ReqoreLayoutWrapper;