@qoretechnologies/reqore 0.30.4 → 0.30.6

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 (214) hide show
  1. package/CODE_OF_CONDUCT.md +105 -0
  2. package/CONTRIBUTING.MD +78 -0
  3. package/LICENSE +1 -1
  4. package/README.md +44 -2
  5. package/SECURITY.md +5 -0
  6. package/__tests__/collection.test.tsx +1 -1
  7. package/__tests__/{control_group.test.tsx → control_group.text.tsx} +2 -4
  8. package/__tests__/modal.test.tsx +2 -74
  9. package/__tests__/panel.test.tsx +24 -96
  10. package/__tests__/popover.test.tsx +2 -24
  11. package/__tests__/tabs.test.tsx +0 -75
  12. package/dist/components/Button/index.d.ts +1 -4
  13. package/dist/components/Button/index.d.ts.map +1 -1
  14. package/dist/components/Button/index.js +7 -10
  15. package/dist/components/Button/index.js.map +1 -1
  16. package/dist/components/Checkbox/index.js +1 -1
  17. package/dist/components/Collection/index.d.ts +2 -7
  18. package/dist/components/Collection/index.d.ts.map +1 -1
  19. package/dist/components/Collection/index.js +53 -57
  20. package/dist/components/Collection/index.js.map +1 -1
  21. package/dist/components/Collection/item.d.ts +5 -5
  22. package/dist/components/Collection/item.d.ts.map +1 -1
  23. package/dist/components/Collection/item.js +4 -15
  24. package/dist/components/Collection/item.js.map +1 -1
  25. package/dist/components/Columns/column.d.ts.map +1 -1
  26. package/dist/components/Columns/column.js +1 -1
  27. package/dist/components/Columns/column.js.map +1 -1
  28. package/dist/components/ControlGroup/index.d.ts +4 -20
  29. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  30. package/dist/components/ControlGroup/index.js +55 -241
  31. package/dist/components/ControlGroup/index.js.map +1 -1
  32. package/dist/components/Drawer/index.d.ts +3 -3
  33. package/dist/components/Drawer/index.d.ts.map +1 -1
  34. package/dist/components/Drawer/index.js +16 -27
  35. package/dist/components/Drawer/index.js.map +1 -1
  36. package/dist/components/Dropdown/index.d.ts +0 -1
  37. package/dist/components/Dropdown/index.d.ts.map +1 -1
  38. package/dist/components/Dropdown/index.js +2 -2
  39. package/dist/components/Dropdown/index.js.map +1 -1
  40. package/dist/components/Dropdown/list.d.ts +3 -3
  41. package/dist/components/Dropdown/list.d.ts.map +1 -1
  42. package/dist/components/Effect/index.d.ts +9 -9
  43. package/dist/components/Effect/index.d.ts.map +1 -1
  44. package/dist/components/Effect/index.js +1 -1
  45. package/dist/components/Effect/index.js.map +1 -1
  46. package/dist/components/Icon/index.d.ts +6 -5
  47. package/dist/components/Icon/index.d.ts.map +1 -1
  48. package/dist/components/Icon/index.js +7 -14
  49. package/dist/components/Icon/index.js.map +1 -1
  50. package/dist/components/Input/index.d.ts +0 -2
  51. package/dist/components/Input/index.d.ts.map +1 -1
  52. package/dist/components/Input/index.js +6 -9
  53. package/dist/components/Input/index.js.map +1 -1
  54. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  55. package/dist/components/InternalPopover/index.js +10 -12
  56. package/dist/components/InternalPopover/index.js.map +1 -1
  57. package/dist/components/Menu/index.d.ts.map +1 -1
  58. package/dist/components/Menu/index.js +1 -1
  59. package/dist/components/Menu/index.js.map +1 -1
  60. package/dist/components/Message/index.d.ts +0 -2
  61. package/dist/components/Message/index.d.ts.map +1 -1
  62. package/dist/components/Message/index.js +2 -2
  63. package/dist/components/Message/index.js.map +1 -1
  64. package/dist/components/MultiSelect/index.d.ts +2 -2
  65. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  66. package/dist/components/MultiSelect/index.js +10 -10
  67. package/dist/components/MultiSelect/index.js.map +1 -1
  68. package/dist/components/Notifications/index.d.ts +1 -1
  69. package/dist/components/Notifications/index.d.ts.map +1 -1
  70. package/dist/components/Notifications/notification.d.ts +1 -1
  71. package/dist/components/Notifications/notification.d.ts.map +1 -1
  72. package/dist/components/Panel/index.d.ts +6 -13
  73. package/dist/components/Panel/index.d.ts.map +1 -1
  74. package/dist/components/Panel/index.js +44 -78
  75. package/dist/components/Panel/index.js.map +1 -1
  76. package/dist/components/Popover/index.d.ts +2 -1
  77. package/dist/components/Popover/index.d.ts.map +1 -1
  78. package/dist/components/Popover/index.js +2 -2
  79. package/dist/components/Popover/index.js.map +1 -1
  80. package/dist/components/Spacer/index.d.ts +0 -2
  81. package/dist/components/Spacer/index.d.ts.map +1 -1
  82. package/dist/components/Spacer/index.js +7 -29
  83. package/dist/components/Spacer/index.js.map +1 -1
  84. package/dist/components/Table/helpers.d.ts +2 -3
  85. package/dist/components/Table/helpers.d.ts.map +1 -1
  86. package/dist/components/Table/helpers.js +3 -6
  87. package/dist/components/Table/helpers.js.map +1 -1
  88. package/dist/components/Table/index.d.ts +3 -4
  89. package/dist/components/Table/index.d.ts.map +1 -1
  90. package/dist/components/Table/index.js.map +1 -1
  91. package/dist/components/Tabs/content.d.ts +1 -3
  92. package/dist/components/Tabs/content.d.ts.map +1 -1
  93. package/dist/components/Tabs/content.js +3 -8
  94. package/dist/components/Tabs/content.js.map +1 -1
  95. package/dist/components/Tabs/index.d.ts +1 -4
  96. package/dist/components/Tabs/index.d.ts.map +1 -1
  97. package/dist/components/Tabs/index.js +4 -12
  98. package/dist/components/Tabs/index.js.map +1 -1
  99. package/dist/components/Tabs/item.d.ts +0 -1
  100. package/dist/components/Tabs/item.d.ts.map +1 -1
  101. package/dist/components/Tabs/item.js +7 -7
  102. package/dist/components/Tabs/item.js.map +1 -1
  103. package/dist/components/Tabs/list.d.ts +1 -1
  104. package/dist/components/Tabs/list.d.ts.map +1 -1
  105. package/dist/components/Tabs/list.js +3 -4
  106. package/dist/components/Tabs/list.js.map +1 -1
  107. package/dist/components/Tag/group.d.ts +2 -2
  108. package/dist/components/Tag/group.d.ts.map +1 -1
  109. package/dist/components/Tag/group.js +8 -7
  110. package/dist/components/Tag/group.js.map +1 -1
  111. package/dist/components/Tag/index.d.ts +2 -6
  112. package/dist/components/Tag/index.d.ts.map +1 -1
  113. package/dist/components/Tag/index.js +12 -20
  114. package/dist/components/Tag/index.js.map +1 -1
  115. package/dist/components/Tree/index.js +1 -1
  116. package/dist/components/Tree/index.js.map +1 -1
  117. package/dist/constants/animations.js +1 -1
  118. package/dist/constants/sizes.d.ts +2 -2
  119. package/dist/constants/sizes.d.ts.map +1 -1
  120. package/dist/constants/sizes.js +10 -10
  121. package/dist/constants/sizes.js.map +1 -1
  122. package/dist/constants/theme.d.ts +1 -1
  123. package/dist/constants/theme.d.ts.map +1 -1
  124. package/dist/containers/PopoverProvider.d.ts.map +1 -1
  125. package/dist/containers/PopoverProvider.js +8 -10
  126. package/dist/containers/PopoverProvider.js.map +1 -1
  127. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  128. package/dist/containers/ReqoreProvider.js +2 -4
  129. package/dist/containers/ReqoreProvider.js.map +1 -1
  130. package/dist/containers/UIProvider.d.ts +0 -7
  131. package/dist/containers/UIProvider.d.ts.map +1 -1
  132. package/dist/containers/UIProvider.js.map +1 -1
  133. package/dist/context/ReqoreContext.d.ts +0 -2
  134. package/dist/context/ReqoreContext.d.ts.map +1 -1
  135. package/dist/context/ReqoreContext.js.map +1 -1
  136. package/dist/helpers/utils.d.ts +0 -2
  137. package/dist/helpers/utils.d.ts.map +1 -1
  138. package/dist/helpers/utils.js +2 -4
  139. package/dist/helpers/utils.js.map +1 -1
  140. package/dist/hooks/useLatestZIndex.js +2 -2
  141. package/dist/hooks/useLatestZIndex.js.map +1 -1
  142. package/dist/hooks/usePopover.d.ts +0 -1
  143. package/dist/hooks/usePopover.d.ts.map +1 -1
  144. package/dist/hooks/usePopover.js +6 -8
  145. package/dist/hooks/usePopover.js.map +1 -1
  146. package/dist/styles.d.ts +0 -1
  147. package/dist/styles.d.ts.map +1 -1
  148. package/dist/styles.js +5 -6
  149. package/dist/styles.js.map +1 -1
  150. package/dist/types/global.d.ts +1 -27
  151. package/dist/types/global.d.ts.map +1 -1
  152. package/dist/types/icons.d.ts +1 -1
  153. package/dist/types/icons.d.ts.map +1 -1
  154. package/package.json +1 -1
  155. package/public/logo-dark.png +0 -0
  156. package/public/logo.png +0 -0
  157. package/public/q-symbol.png +0 -0
  158. package/public/qoreLogo-dark.png +0 -0
  159. package/public/qoreLogo.png +0 -0
  160. package/src/components/Button/index.tsx +5 -17
  161. package/src/components/Checkbox/index.tsx +1 -1
  162. package/src/components/Collection/index.tsx +60 -93
  163. package/src/components/Collection/item.tsx +9 -29
  164. package/src/components/Columns/column.tsx +0 -1
  165. package/src/components/ControlGroup/index.tsx +103 -426
  166. package/src/components/Drawer/index.tsx +27 -28
  167. package/src/components/Dropdown/index.tsx +1 -3
  168. package/src/components/Effect/index.tsx +0 -1
  169. package/src/components/Icon/index.tsx +62 -81
  170. package/src/components/Input/index.tsx +4 -8
  171. package/src/components/InternalPopover/index.tsx +126 -131
  172. package/src/components/Menu/index.tsx +1 -7
  173. package/src/components/Message/index.tsx +1 -9
  174. package/src/components/MultiSelect/index.tsx +188 -180
  175. package/src/components/Panel/index.tsx +100 -227
  176. package/src/components/Popover/index.tsx +3 -1
  177. package/src/components/Spacer/index.tsx +14 -63
  178. package/src/components/Table/helpers.ts +6 -12
  179. package/src/components/Table/index.tsx +0 -1
  180. package/src/components/Tabs/content.tsx +3 -11
  181. package/src/components/Tabs/index.tsx +3 -14
  182. package/src/components/Tabs/item.tsx +5 -28
  183. package/src/components/Tabs/list.tsx +0 -4
  184. package/src/components/Tag/group.tsx +12 -6
  185. package/src/components/Tag/index.tsx +35 -67
  186. package/src/components/Tree/index.tsx +1 -1
  187. package/src/constants/animations.ts +1 -1
  188. package/src/constants/sizes.ts +10 -10
  189. package/src/containers/PopoverProvider.tsx +8 -11
  190. package/src/containers/ReqoreProvider.tsx +35 -40
  191. package/src/containers/UIProvider.tsx +0 -7
  192. package/src/context/ReqoreContext.tsx +0 -2
  193. package/src/helpers/utils.ts +0 -3
  194. package/src/hooks/useLatestZIndex.ts +2 -2
  195. package/src/hooks/usePopover.tsx +6 -9
  196. package/src/mock/collectionData.tsx +2 -33
  197. package/src/stories/Button/Button.stories.tsx +6 -14
  198. package/src/stories/Checkbox/Checkbox.stories.tsx +3 -6
  199. package/src/stories/Collection/Collection.stories.tsx +2 -18
  200. package/src/stories/ControlGroup/ControlGroup.stories.tsx +34 -220
  201. package/src/stories/Drawer/Drawer.stories.tsx +3 -70
  202. package/src/stories/Dropdown/Dropdown.stories.tsx +3 -13
  203. package/src/stories/Icon/Icon.stories.tsx +0 -1
  204. package/src/stories/Input/Input.stories.tsx +3 -5
  205. package/src/stories/Menu/Menu.stories.tsx +0 -2
  206. package/src/stories/Message/Message.stories.tsx +0 -7
  207. package/src/stories/Panel/Panel.stories.tsx +13 -147
  208. package/src/stories/Popover/Popover.stories.tsx +82 -88
  209. package/src/stories/Tabs/Tabs.stories.tsx +15 -32
  210. package/src/stories/Tag/Tag.stories.tsx +3 -23
  211. package/src/stories/TextArea/TextArea.stories.tsx +3 -3
  212. package/src/styles.ts +0 -6
  213. package/src/types/global.ts +0 -28
  214. package/tests.json +1 -1
@@ -27,7 +27,7 @@ export interface IReqoreDrawerProps extends Omit<IReqorePanelProps, 'size'> {
27
27
  onClose?: () => void;
28
28
  onHideToggle?: (isHidden: boolean) => void;
29
29
  hasBackdrop?: boolean;
30
- size?: string | 'auto';
30
+ size?: string;
31
31
  maxSize?: string;
32
32
  minSize?: string;
33
33
  opacity?: number;
@@ -170,7 +170,6 @@ export const ReqoreDrawer = ({
170
170
  _isModal,
171
171
  width,
172
172
  height,
173
- actions = [],
174
173
  ...rest
175
174
  }: IReqoreDrawerProps) => {
176
175
  const { animations } = useContext(ReqoreContext);
@@ -200,13 +199,12 @@ export const ReqoreDrawer = ({
200
199
 
201
200
  const zIndex = useLatestZIndex();
202
201
  const wrapperZIndex = useLatestZIndex();
203
- const _actions: IReqorePanelAction[] = useMemo(() => {
204
- const builtActions: IReqorePanelAction[] = [...actions];
202
+ const actions: IReqorePanelAction[] = useMemo(() => {
203
+ const actions: IReqorePanelAction[] = [];
205
204
 
206
205
  /* Adding a hide/show button to the drawer. */
207
206
  if (hidable) {
208
- builtActions.push({
209
- responsive: false,
207
+ actions.push({
210
208
  icon: getHideShowIcon(position, _isHidden),
211
209
  onClick: () => {
212
210
  setIsHidden(!_isHidden);
@@ -220,15 +218,14 @@ export const ReqoreDrawer = ({
220
218
 
221
219
  /* Adding a close button to the drawer. */
222
220
  if (onClose) {
223
- builtActions.push({
224
- responsive: false,
221
+ actions.push({
225
222
  icon: 'CloseLine',
226
223
  onClick: onClose,
227
224
  className: 'reqore-drawer-close-button',
228
225
  });
229
226
  }
230
227
 
231
- return builtActions;
228
+ return actions;
232
229
  }, [hidable, position, onClose]);
233
230
 
234
231
  const positions = useMemo(() => {
@@ -266,27 +263,27 @@ export const ReqoreDrawer = ({
266
263
  />
267
264
  ) : null}
268
265
  <Resizable
269
- className={`${className || ''} reqore-drawer-resizable`}
266
+ className='reqore-drawer-resizable'
270
267
  maxHeight={
271
268
  layout === 'horizontal' || layout === 'center' ? maxSize || '90vh' : undefined
272
269
  }
273
270
  minHeight={
274
271
  layout === 'center'
275
- ? '40px'
272
+ ? '140px'
276
273
  : layout === 'horizontal'
277
274
  ? _isHidden
278
275
  ? 0
279
- : minSize || '40px'
276
+ : minSize || '140px'
280
277
  : undefined
281
278
  }
282
279
  maxWidth={layout === 'vertical' || layout === 'center' ? maxSize || '90vw' : undefined}
283
280
  minWidth={
284
281
  layout === 'center'
285
- ? '40px'
282
+ ? '140px'
286
283
  : layout === 'vertical'
287
284
  ? _isHidden
288
285
  ? 0
289
- : minSize || '40px'
286
+ : minSize || '140px'
290
287
  : undefined
291
288
  }
292
289
  as={StyledDrawerResizable}
@@ -345,19 +342,21 @@ export const ReqoreDrawer = ({
345
342
  <StyledCloseWrapper
346
343
  className='reqore-drawer-controls'
347
344
  position={position}
348
- w={layout === 'vertical' ? 0 : _size.width}
349
- h={layout === 'horizontal' ? 0 : _size.height}
345
+ w={layout === 'vertical' && _isHidden ? 0 : _size.width}
346
+ h={layout === 'horizontal' && _isHidden ? 0 : _size.height}
350
347
  >
351
- <ReqoreButton
352
- flat
353
- customTheme={theme}
354
- className='reqore-drawer-control reqore-drawer-hide-button'
355
- icon={getHideShowIcon(position, _isHidden)}
356
- onClick={() => {
357
- setIsHidden(!_isHidden);
358
- onHideToggle && onHideToggle(!_isHidden);
359
- }}
360
- />
348
+ {hidable && (
349
+ <ReqoreButton
350
+ flat
351
+ customTheme={theme}
352
+ className='reqore-drawer-control reqore-drawer-hide-button'
353
+ icon={getHideShowIcon(position, _isHidden)}
354
+ onClick={() => {
355
+ setIsHidden(!_isHidden);
356
+ onHideToggle && onHideToggle(!_isHidden);
357
+ }}
358
+ />
359
+ )}
361
360
  </StyledCloseWrapper>
362
361
  ) : null}
363
362
  {!_isHidden && (
@@ -365,12 +364,12 @@ export const ReqoreDrawer = ({
365
364
  {...rest}
366
365
  opacity={opacity}
367
366
  blur={hasBackdrop ? 0 : blur}
368
- actions={_actions}
367
+ actions={actions}
369
368
  customTheme={customTheme}
370
369
  intent={intent}
371
370
  rounded={floating || _isModal ? true : false}
372
371
  flat={flat}
373
- className={`reqore-drawer`}
372
+ className={`${className || ''} reqore-drawer`}
374
373
  style={{
375
374
  width: '100%',
376
375
  maxHeight: '100%',
@@ -22,7 +22,6 @@ export interface IReqoreDropdownProps extends Partial<IPopoverOptions> {
22
22
  caretPosition?: 'left' | 'right';
23
23
  isDefaultOpen?: boolean;
24
24
  onItemSelect?: TDropdownItemOnClick;
25
- style?: React.CSSProperties;
26
25
  }
27
26
 
28
27
  function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
@@ -65,7 +64,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
65
64
  ...rest,
66
65
  icon: caretPosition === 'left' ? icon || 'ArrowDownSFill' : rightIcon,
67
66
  rightIcon: caretPosition === 'right' ? icon || 'ArrowDownSFill' : rightIcon,
68
- style: buttonStyle || rest.style,
67
+ style: buttonStyle,
69
68
  disabled: !size(items),
70
69
  className: `${(rest as any)?.className || ''} reqore-dropdown-control`,
71
70
  } as T),
@@ -99,7 +98,6 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
99
98
  useTargetWidth={useTargetWidth}
100
99
  component={component || ReqoreButton}
101
100
  componentProps={componentProps}
102
- isReqoreComponent
103
101
  noWrapper
104
102
  placement={placement || 'bottom-start'}
105
103
  handler={handler || 'click'}
@@ -269,7 +269,6 @@ export const StyledEffect = styled.span`
269
269
  white-space: nowrap;
270
270
  text-overflow: ellipsis;
271
271
  overflow: hidden;
272
- min-width: 30px;
273
272
  `
274
273
  : undefined}
275
274
 
@@ -1,27 +1,22 @@
1
- import React, { forwardRef, memo, useContext } from 'react';
1
+ import React, { memo, useContext } from 'react';
2
2
  import { IconContext } from 'react-icons';
3
3
  import { IconBaseProps, IconType } from 'react-icons/lib';
4
4
  import * as RemixIcons from 'react-icons/ri';
5
5
  import styled, { css } from 'styled-components';
6
6
  import { ReqoreThemeContext } from '../..';
7
7
  import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
8
- import { getColorFromMaybeString } from '../../helpers/colors';
8
+ import { TReqoreIntent } from '../../constants/theme';
9
9
  import { isStringSize } from '../../helpers/utils';
10
- import { useCombinedRefs } from '../../hooks/useCombinedRefs';
11
- import { useTooltip } from '../../hooks/useTooltip';
12
- import { IReqoreIntent, IWithReqoreEffect, IWithReqoreTooltip } from '../../types/global';
10
+ import { IWithReqoreEffect } from '../../types/global';
13
11
  import { IReqoreIconName } from '../../types/icons';
14
- import { StyledEffect, TReqoreEffectColor } from '../Effect';
12
+ import { StyledEffect } from '../Effect';
15
13
 
16
- export interface IReqoreIconProps
17
- extends React.HTMLAttributes<HTMLSpanElement>,
18
- IWithReqoreEffect,
19
- IWithReqoreTooltip,
20
- IReqoreIntent {
14
+ export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
21
15
  icon?: IReqoreIconName;
22
- color?: TReqoreEffectColor;
16
+ color?: string;
23
17
  size?: TSizes | string;
24
18
  iconProps?: IconBaseProps;
19
+ intent?: TReqoreIntent;
25
20
  margin?: 'right' | 'left' | 'both';
26
21
  image?: string;
27
22
  rounded?: boolean;
@@ -57,85 +52,71 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
57
52
  `;
58
53
 
59
54
  const ReqoreIcon = memo(
60
- forwardRef<HTMLSpanElement, IReqoreIconProps>(
61
- (
62
- {
63
- icon,
64
- size = 'normal',
65
- className,
66
- color,
67
- margin,
68
- style = {},
69
- iconProps,
70
- intent,
71
- image,
72
- tooltip,
73
- ...rest
74
- }: IReqoreIconProps,
75
- ref
76
- ) => {
77
- const { targetRef } = useCombinedRefs(ref);
78
- const theme = useContext(ReqoreThemeContext);
79
- const Icon: IconType = RemixIcons[`Ri${icon}`];
80
- const finalColor: string | undefined = intent
81
- ? theme.intents[intent]
82
- : getColorFromMaybeString(theme, color);
83
- const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
84
-
85
- useTooltip(targetRef.current, tooltip);
86
-
87
- if (image) {
88
- return (
89
- <StyledIconWrapper
90
- {...rest}
91
- ref={targetRef}
92
- size={size}
93
- margin={margin}
94
- className={`${className || ''} reqore-icon`}
95
- style={{ ...style, width: finalSize, height: finalSize }}
96
- >
97
- <img src={image} alt='' />
98
- </StyledIconWrapper>
99
- );
100
- }
101
-
102
- if (!Icon) {
103
- return (
104
- <StyledIconWrapper
105
- {...rest}
106
- ref={targetRef}
107
- size={size}
108
- margin={margin}
109
- className={`${className || ''} reqore-icon`}
110
- style={{ ...style, width: finalSize, height: finalSize }}
111
- />
112
- );
113
- }
55
+ ({
56
+ icon,
57
+ size = 'normal',
58
+ className,
59
+ color,
60
+ margin,
61
+ style = {},
62
+ iconProps,
63
+ intent,
64
+ image,
65
+ ...rest
66
+ }: IReqoreIconProps) => {
67
+ const theme = useContext(ReqoreThemeContext);
68
+ const Icon: IconType = RemixIcons[`Ri${icon}`];
69
+ const finalColor: string | undefined = intent ? theme.intents[intent] : color;
70
+ const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
114
71
 
72
+ if (image) {
115
73
  return (
116
74
  <StyledIconWrapper
117
75
  {...rest}
118
- ref={targetRef}
119
- margin={margin}
120
76
  size={size}
121
- style={{ ...style, width: finalSize, height: finalSize }}
77
+ margin={margin}
122
78
  className={`${className || ''} reqore-icon`}
79
+ style={{ ...style, width: finalSize, height: finalSize }}
123
80
  >
124
- <IconContext.Provider
125
- value={{
126
- color: finalColor || 'inherit',
127
- size: finalSize,
128
- style: {
129
- verticalAlign: 'super',
130
- },
131
- }}
132
- >
133
- <Icon {...iconProps} />
134
- </IconContext.Provider>
81
+ <img src={image} alt='' />
135
82
  </StyledIconWrapper>
136
83
  );
137
84
  }
138
- )
85
+
86
+ if (!Icon) {
87
+ return (
88
+ <StyledIconWrapper
89
+ {...rest}
90
+ size={size}
91
+ margin={margin}
92
+ className={`${className || ''} reqore-icon`}
93
+ style={{ ...style, width: finalSize, height: finalSize }}
94
+ />
95
+ );
96
+ }
97
+
98
+ return (
99
+ <StyledIconWrapper
100
+ {...rest}
101
+ margin={margin}
102
+ size={size}
103
+ style={{ ...style, width: finalSize, height: finalSize }}
104
+ className={`${className || ''} reqore-icon`}
105
+ >
106
+ <IconContext.Provider
107
+ value={{
108
+ color: finalColor || 'inherit',
109
+ size: finalSize,
110
+ style: {
111
+ verticalAlign: 'super',
112
+ },
113
+ }}
114
+ >
115
+ <Icon {...iconProps} />
116
+ </IconContext.Provider>
117
+ </StyledIconWrapper>
118
+ );
119
+ }
139
120
  );
140
121
 
141
122
  export default ReqoreIcon;
@@ -22,7 +22,7 @@ import {
22
22
  IWithReqoreEffect,
23
23
  } from '../../types/global';
24
24
  import { IReqoreIconName } from '../../types/icons';
25
- import { StyledEffect, TReqoreEffectColor } from '../Effect';
25
+ import { StyledEffect } from '../Effect';
26
26
  import ReqoreIcon from '../Icon';
27
27
  import ReqoreInputClearButton from '../InputClearButton';
28
28
 
@@ -48,7 +48,6 @@ export interface IReqoreInputProps
48
48
  rounded?: boolean;
49
49
  type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
50
50
  wrapperStyle?: React.CSSProperties;
51
- iconColor?: TReqoreEffectColor;
52
51
  }
53
52
 
54
53
  export interface IReqoreInputStyle extends IReqoreInputProps {
@@ -60,10 +59,8 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
60
59
 
61
60
  export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
62
61
  height: ${({ _size }) => SIZE_TO_PX[_size]}px;
63
- width: ${({ width, fluid, fixed }) => (width ? `${width}px` : fluid && !fixed ? '100%' : 'auto')};
64
- max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
65
- min-width: 60px;
66
- flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
62
+ width: ${({ width }) => (width ? `${width}px` : 'auto')};
63
+ flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 0 auto' : '0 0 auto')};
67
64
  font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
68
65
  position: relative;
69
66
  overflow: hidden;
@@ -153,7 +150,6 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
153
150
  className,
154
151
  onClearClick,
155
152
  icon,
156
- iconColor,
157
153
  flat,
158
154
  rounded = true,
159
155
  minimal,
@@ -189,7 +185,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
189
185
  >
190
186
  {icon && (
191
187
  <StyledIconWrapper _size={size}>
192
- <ReqoreIcon size={size} icon={icon} color={iconColor} />
188
+ <ReqoreIcon size={size} icon={icon} />
193
189
  </StyledIconWrapper>
194
190
  )}
195
191
  <StyledInput
@@ -1,6 +1,6 @@
1
- import { cloneDeep, isString } from 'lodash';
1
+ import { isString } from 'lodash';
2
2
  import { rgba } from 'polished';
3
- import React, { MutableRefObject, memo, useContext, useEffect, useRef, useState } from 'react';
3
+ import React, { MutableRefObject, useContext, useEffect, useRef, useState } from 'react';
4
4
  import { usePopper } from 'react-popper';
5
5
  import styled, { css } from 'styled-components';
6
6
  import { RADIUS_FROM_SIZE } from '../../constants/sizes';
@@ -62,8 +62,8 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
62
62
  max-height: ${({ maxHeight = '80vh' }) => maxHeight};
63
63
  z-index: 999999;
64
64
  border-radius: ${RADIUS_FROM_SIZE.normal}px;
65
- border: ${({ flat, noWrapper, ...rest }: any) =>
66
- !flat && noWrapper ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
65
+ border: ${({ flat, isString, ...rest }: any) =>
66
+ !flat && !isString ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
67
67
 
68
68
  ${({ transparent }) =>
69
69
  !transparent &&
@@ -129,7 +129,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
129
129
  }
130
130
  `;
131
131
 
132
- const StyledPopoverContent = styled.div`
132
+ const StyledPopoverContent = styled.div<{ isString?: boolean }>`
133
133
  width: 100%;
134
134
  height: 100%;
135
135
  z-index: 20;
@@ -139,138 +139,133 @@ const StyledPopoverContent = styled.div`
139
139
 
140
140
  export interface IReqoreInternalPopoverProps extends IPopoverData {}
141
141
 
142
- const InternalPopover: React.FC<IReqoreInternalPopoverProps> = memo(
143
- ({
144
- targetElement,
145
- content,
146
- id,
142
+ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
143
+ targetElement,
144
+ content,
145
+ id,
146
+ placement,
147
+ noArrow,
148
+ useTargetWidth,
149
+ transparent,
150
+ maxWidth,
151
+ maxHeight,
152
+ blur,
153
+ intent,
154
+ title,
155
+ icon,
156
+ minimal,
157
+ flat = true,
158
+ effect,
159
+ }) => {
160
+ const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
161
+ const [popperElement, setPopperElement] = useState(null);
162
+ const [arrowElement, setArrowElement] = useState(null);
163
+ const popperRef: MutableRefObject<any> = useRef(null);
164
+ const { styles, attributes } = usePopper(targetElement, popperElement, {
147
165
  placement,
148
- noArrow,
149
- noWrapper,
150
- useTargetWidth,
151
- transparent,
152
- maxWidth,
153
- maxHeight,
154
- blur,
155
- intent,
156
- title,
157
- icon,
158
- minimal,
159
- flat = true,
160
- effect,
161
- }) => {
162
- const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
163
- const [popperElement, setPopperElement] = useState(null);
164
- const [arrowElement, setArrowElement] = useState(null);
165
- const popperRef: MutableRefObject<any> = useRef(null);
166
- const { styles, attributes } = usePopper(targetElement, popperElement, {
167
- placement,
168
- modifiers: [
169
- {
170
- name: 'offset',
171
- options: {
172
- offset: [0, noArrow ? 5 : 10],
173
- },
166
+ modifiers: [
167
+ {
168
+ name: 'offset',
169
+ options: {
170
+ offset: [0, noArrow ? 5 : 10],
174
171
  },
175
- {
176
- name: 'arrow',
177
- options: {
178
- element: arrowElement,
179
- },
172
+ },
173
+ {
174
+ name: 'arrow',
175
+ options: {
176
+ element: arrowElement,
180
177
  },
181
- {
182
- name: 'hide',
183
- enabled: true,
184
- },
185
- ],
186
- });
178
+ },
179
+ {
180
+ name: 'hide',
181
+ enabled: true,
182
+ },
183
+ ],
184
+ });
187
185
 
188
- useEffect(() => {
189
- if (popperRef.current) {
190
- updatePopover?.(id, { popperRef: cloneDeep(popperRef) });
191
- }
192
- }, [popperRef]);
186
+ useEffect(() => {
187
+ if (popperRef.current) {
188
+ updatePopover?.(id, { popperRef });
189
+ }
190
+ }, [popperRef]);
193
191
 
194
- useEffect(() => {
195
- if (attributes.popper?.['data-popper-reference-hidden']) {
196
- removePopover?.(id);
197
- }
198
- }, [attributes.popper]);
192
+ useEffect(() => {
193
+ if (attributes.popper?.['data-popper-reference-hidden']) {
194
+ removePopover?.(id);
195
+ }
196
+ }, [attributes.popper]);
199
197
 
200
- /* Getting the x and y values from the transform property of the popper element. */
201
- const translateValues = styles.popper.transform
202
- ?.replace('translate3d(', '')
203
- .replace('translate(', '')
204
- .replace(')', '')
205
- .split(',')
206
- .map((axis) => {
207
- if (uiScale || uiScale === 0) {
208
- return parseInt(axis, 10) < 0
209
- ? parseInt(axis, 10) * uiScale
210
- : parseInt(axis, 10) / uiScale;
211
- }
212
- return parseInt(axis, 10);
213
- });
198
+ /* Getting the x and y values from the transform property of the popper element. */
199
+ const translateValues = styles.popper.transform
200
+ ?.replace('translate3d(', '')
201
+ .replace('translate(', '')
202
+ .replace(')', '')
203
+ .split(',')
204
+ .map((axis) => {
205
+ if (uiScale || uiScale === 0) {
206
+ return parseInt(axis, 10) < 0 ? parseInt(axis, 10) * uiScale : parseInt(axis, 10) / uiScale;
207
+ }
208
+ return parseInt(axis, 10);
209
+ });
214
210
 
215
- return (
216
- <ReqoreThemeProvider>
217
- {blur > 0 ? <StyledBackdrop zIndex={999998} blur={blur} closable /> : null}
218
- <StyledPopoverWrapper
219
- maxWidth={maxWidth}
220
- maxHeight={maxHeight}
221
- transparent={transparent}
222
- effect={effect}
223
- isOpaque={!transparent && !minimal}
224
- intent={intent}
225
- flat={flat}
226
- noWrapper={noWrapper}
227
- dim={flat && !transparent && !effect && minimal}
228
- className='reqore-popover-content'
229
- ref={(el) => {
230
- setPopperElement(el);
231
- popperRef.current = el;
232
- }}
233
- style={{
234
- ...styles.popper,
235
- transform: `translate(${translateValues?.[0] || 0}px, ${translateValues?.[1] || 0}px)`,
236
- width: useTargetWidth && (targetElement?.getBoundingClientRect()?.width || undefined),
237
- }}
238
- {...attributes.popper}
239
- >
240
- {!noArrow && !transparent ? (
241
- <StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
242
- ) : null}
243
- <StyledPopoverContent>
244
- {!noWrapper || isString(content) ? (
245
- <ReqoreMessage
246
- opaque={!transparent && !minimal}
247
- className='reqore-popover-text'
248
- intent={intent}
249
- title={title}
250
- icon={icon}
251
- minimal={transparent}
252
- flat={flat || transparent}
253
- effect={effect}
254
- >
255
- {content}
256
- </ReqoreMessage>
257
- ) : (
258
- <>
259
- {React.Children.map(content, (child) =>
260
- child
261
- ? React.cloneElement(child, {
262
- _insidePopover: true,
263
- _popoverId: id,
264
- })
265
- : null
266
- )}
267
- </>
268
- )}
269
- </StyledPopoverContent>
270
- </StyledPopoverWrapper>
271
- </ReqoreThemeProvider>
272
- );
273
- }
274
- );
211
+ return (
212
+ <ReqoreThemeProvider>
213
+ {blur > 0 ? <StyledBackdrop zIndex={999998} blur={blur} closable /> : null}
214
+ <StyledPopoverWrapper
215
+ maxWidth={maxWidth}
216
+ maxHeight={maxHeight}
217
+ transparent={transparent}
218
+ effect={effect}
219
+ isOpaque={!transparent && !minimal}
220
+ intent={intent}
221
+ flat={flat}
222
+ isString={isString(content)}
223
+ dim={flat && !transparent && !effect && minimal}
224
+ className='reqore-popover-content'
225
+ ref={(el) => {
226
+ setPopperElement(el);
227
+ popperRef.current = el;
228
+ }}
229
+ style={{
230
+ ...styles.popper,
231
+ transform: `translate(${translateValues?.[0] || 0}px, ${translateValues?.[1] || 0}px)`,
232
+ width: useTargetWidth && (targetElement?.getBoundingClientRect()?.width || undefined),
233
+ }}
234
+ {...attributes.popper}
235
+ >
236
+ {!noArrow && !transparent ? (
237
+ <StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
238
+ ) : null}
239
+ <StyledPopoverContent isString={isString(content)}>
240
+ {isString(content) ? (
241
+ <ReqoreMessage
242
+ opaque={!transparent && !minimal}
243
+ className='reqore-popover-text'
244
+ intent={intent}
245
+ title={title}
246
+ icon={icon}
247
+ minimal={transparent}
248
+ flat={flat || transparent}
249
+ effect={effect}
250
+ >
251
+ {content}
252
+ </ReqoreMessage>
253
+ ) : (
254
+ <>
255
+ {React.Children.map(content, (child) =>
256
+ child
257
+ ? React.cloneElement(child, {
258
+ _insidePopover: true,
259
+ _popoverId: id,
260
+ })
261
+ : null
262
+ )}
263
+ </>
264
+ )}
265
+ </StyledPopoverContent>
266
+ </StyledPopoverWrapper>
267
+ </ReqoreThemeProvider>
268
+ );
269
+ };
275
270
 
276
271
  export default InternalPopover;