@qoretechnologies/reqore 0.29.7 → 0.29.9

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 (90) hide show
  1. package/__tests__/popover.test.tsx +24 -2
  2. package/dist/components/Button/index.d.ts.map +1 -1
  3. package/dist/components/Button/index.js +3 -6
  4. package/dist/components/Button/index.js.map +1 -1
  5. package/dist/components/Collection/index.d.ts +3 -2
  6. package/dist/components/Collection/index.d.ts.map +1 -1
  7. package/dist/components/Collection/index.js +5 -7
  8. package/dist/components/Collection/index.js.map +1 -1
  9. package/dist/components/Collection/item.d.ts +2 -3
  10. package/dist/components/Collection/item.d.ts.map +1 -1
  11. package/dist/components/Collection/item.js +8 -4
  12. package/dist/components/Collection/item.js.map +1 -1
  13. package/dist/components/ControlGroup/index.d.ts +2 -0
  14. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  15. package/dist/components/ControlGroup/index.js +8 -5
  16. package/dist/components/ControlGroup/index.js.map +1 -1
  17. package/dist/components/Dropdown/index.d.ts +1 -0
  18. package/dist/components/Dropdown/index.d.ts.map +1 -1
  19. package/dist/components/Dropdown/index.js +1 -1
  20. package/dist/components/Dropdown/index.js.map +1 -1
  21. package/dist/components/Icon/index.d.ts +3 -5
  22. package/dist/components/Icon/index.d.ts.map +1 -1
  23. package/dist/components/Icon/index.js +10 -6
  24. package/dist/components/Icon/index.js.map +1 -1
  25. package/dist/components/Panel/index.d.ts +2 -2
  26. package/dist/components/Panel/index.d.ts.map +1 -1
  27. package/dist/components/Panel/index.js +29 -20
  28. package/dist/components/Panel/index.js.map +1 -1
  29. package/dist/components/Tabs/content.d.ts +3 -1
  30. package/dist/components/Tabs/content.d.ts.map +1 -1
  31. package/dist/components/Tabs/content.js +8 -3
  32. package/dist/components/Tabs/content.js.map +1 -1
  33. package/dist/components/Tabs/index.d.ts +4 -1
  34. package/dist/components/Tabs/index.d.ts.map +1 -1
  35. package/dist/components/Tabs/index.js +10 -3
  36. package/dist/components/Tabs/index.js.map +1 -1
  37. package/dist/components/Tabs/item.d.ts +1 -0
  38. package/dist/components/Tabs/item.d.ts.map +1 -1
  39. package/dist/components/Tabs/item.js +7 -7
  40. package/dist/components/Tabs/item.js.map +1 -1
  41. package/dist/components/Tabs/list.d.ts +1 -1
  42. package/dist/components/Tabs/list.d.ts.map +1 -1
  43. package/dist/components/Tabs/list.js +3 -2
  44. package/dist/components/Tabs/list.js.map +1 -1
  45. package/dist/components/Tag/index.d.ts +1 -0
  46. package/dist/components/Tag/index.d.ts.map +1 -1
  47. package/dist/components/Tag/index.js +3 -1
  48. package/dist/components/Tag/index.js.map +1 -1
  49. package/dist/constants/sizes.js +7 -7
  50. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  51. package/dist/containers/ReqoreProvider.js +1 -0
  52. package/dist/containers/ReqoreProvider.js.map +1 -1
  53. package/dist/containers/UIProvider.d.ts +7 -0
  54. package/dist/containers/UIProvider.d.ts.map +1 -1
  55. package/dist/containers/UIProvider.js.map +1 -1
  56. package/dist/context/ReqoreContext.d.ts +1 -0
  57. package/dist/context/ReqoreContext.d.ts.map +1 -1
  58. package/dist/context/ReqoreContext.js.map +1 -1
  59. package/dist/hooks/usePopover.d.ts.map +1 -1
  60. package/dist/hooks/usePopover.js +4 -2
  61. package/dist/hooks/usePopover.js.map +1 -1
  62. package/dist/types/global.d.ts +13 -0
  63. package/dist/types/global.d.ts.map +1 -1
  64. package/package.json +1 -1
  65. package/src/components/Button/index.tsx +1 -2
  66. package/src/components/Collection/index.tsx +15 -2
  67. package/src/components/Collection/item.tsx +14 -6
  68. package/src/components/ControlGroup/index.tsx +10 -1
  69. package/src/components/Dropdown/index.tsx +2 -1
  70. package/src/components/Icon/index.tsx +78 -62
  71. package/src/components/Panel/index.tsx +46 -37
  72. package/src/components/Tabs/content.tsx +11 -3
  73. package/src/components/Tabs/index.tsx +11 -1
  74. package/src/components/Tabs/item.tsx +24 -1
  75. package/src/components/Tabs/list.tsx +3 -0
  76. package/src/components/Tag/index.tsx +25 -22
  77. package/src/constants/sizes.ts +7 -7
  78. package/src/containers/ReqoreProvider.tsx +1 -0
  79. package/src/containers/UIProvider.tsx +7 -0
  80. package/src/context/ReqoreContext.tsx +1 -0
  81. package/src/hooks/usePopover.tsx +4 -2
  82. package/src/mock/collectionData.tsx +21 -1
  83. package/src/stories/ControlGroup/ControlGroup.stories.tsx +42 -1
  84. package/src/stories/Icon/Icon.stories.tsx +1 -0
  85. package/src/stories/Input/Input.stories.tsx +2 -1
  86. package/src/stories/Panel/Panel.stories.tsx +39 -1
  87. package/src/stories/Tabs/Tabs.stories.tsx +30 -14
  88. package/src/stories/Tag/Tag.stories.tsx +12 -2
  89. package/src/types/global.ts +14 -0
  90. package/tests.json +1 -1
@@ -1,23 +1,27 @@
1
- import React, { memo, useContext } from 'react';
1
+ import React, { forwardRef, 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 { TReqoreIntent } from '../../constants/theme';
9
8
  import { getColorFromMaybeString } from '../../helpers/colors';
10
9
  import { isStringSize } from '../../helpers/utils';
11
- import { IWithReqoreEffect } from '../../types/global';
10
+ import { useCombinedRefs } from '../../hooks/useCombinedRefs';
11
+ import { useTooltip } from '../../hooks/useTooltip';
12
+ import { IReqoreIntent, IWithReqoreEffect, IWithReqoreTooltip } from '../../types/global';
12
13
  import { IReqoreIconName } from '../../types/icons';
13
14
  import { StyledEffect, TReqoreEffectColor } from '../Effect';
14
15
 
15
- export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
16
+ export interface IReqoreIconProps
17
+ extends React.HTMLAttributes<HTMLSpanElement>,
18
+ IWithReqoreEffect,
19
+ IWithReqoreTooltip,
20
+ IReqoreIntent {
16
21
  icon?: IReqoreIconName;
17
22
  color?: TReqoreEffectColor;
18
23
  size?: TSizes | string;
19
24
  iconProps?: IconBaseProps;
20
- intent?: TReqoreIntent;
21
25
  margin?: 'right' | 'left' | 'both';
22
26
  image?: string;
23
27
  rounded?: boolean;
@@ -53,73 +57,85 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
53
57
  `;
54
58
 
55
59
  const ReqoreIcon = memo(
56
- ({
57
- icon,
58
- size = 'normal',
59
- className,
60
- color,
61
- margin,
62
- style = {},
63
- iconProps,
64
- intent,
65
- image,
66
- ...rest
67
- }: IReqoreIconProps) => {
68
- const theme = useContext(ReqoreThemeContext);
69
- const Icon: IconType = RemixIcons[`Ri${icon}`];
70
- const finalColor: string | undefined = intent
71
- ? theme.intents[intent]
72
- : getColorFromMaybeString(theme, color);
73
- const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
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
+ }
74
114
 
75
- if (image) {
76
115
  return (
77
116
  <StyledIconWrapper
78
117
  {...rest}
79
- size={size}
118
+ ref={targetRef}
80
119
  margin={margin}
81
- className={`${className || ''} reqore-icon`}
120
+ size={size}
82
121
  style={{ ...style, width: finalSize, height: finalSize }}
122
+ className={`${className || ''} reqore-icon`}
83
123
  >
84
- <img src={image} alt='' />
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>
85
135
  </StyledIconWrapper>
86
136
  );
87
137
  }
88
-
89
- if (!Icon) {
90
- return (
91
- <StyledIconWrapper
92
- {...rest}
93
- size={size}
94
- margin={margin}
95
- className={`${className || ''} reqore-icon`}
96
- style={{ ...style, width: finalSize, height: finalSize }}
97
- />
98
- );
99
- }
100
-
101
- return (
102
- <StyledIconWrapper
103
- {...rest}
104
- margin={margin}
105
- size={size}
106
- style={{ ...style, width: finalSize, height: finalSize }}
107
- className={`${className || ''} reqore-icon`}
108
- >
109
- <IconContext.Provider
110
- value={{
111
- color: finalColor || 'inherit',
112
- size: finalSize,
113
- style: {
114
- verticalAlign: 'super',
115
- },
116
- }}
117
- >
118
- <Icon {...iconProps} />
119
- </IconContext.Provider>
120
- </StyledIconWrapper>
121
- );
122
- }
138
+ )
123
139
  );
124
140
 
125
141
  export default ReqoreIcon;
@@ -1,6 +1,6 @@
1
1
  import { size } from 'lodash';
2
2
  import { darken, rgba } from 'polished';
3
- import { ReactElement, forwardRef, useCallback, useMemo, useState } from 'react';
3
+ import { forwardRef, ReactElement, useCallback, useMemo, useState } from 'react';
4
4
  import { useUpdateEffect } from 'react-use';
5
5
  import styled, { css } from 'styled-components';
6
6
  import {
@@ -25,6 +25,7 @@ import {
25
25
  IReqoreIntent,
26
26
  IWithReqoreCustomTheme,
27
27
  IWithReqoreFlat,
28
+ IWithReqoreFluid,
28
29
  IWithReqoreSize,
29
30
  IWithReqoreTooltip,
30
31
  } from '../../types/global';
@@ -62,6 +63,7 @@ export interface IReqorePanelProps
62
63
  IWithReqoreFlat,
63
64
  IReqoreIntent,
64
65
  IWithReqoreTooltip,
66
+ IWithReqoreFluid,
65
67
  React.HTMLAttributes<HTMLDivElement> {
66
68
  as?: any;
67
69
  children?: any;
@@ -99,12 +101,12 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
99
101
  background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
100
102
  rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)};
101
103
  border-radius: ${({ rounded }) => (rounded ? RADIUS_FROM_SIZE.normal : 0)}px;
102
- border: ${({ theme, flat, opacity = 1, intent }) =>
104
+ border: ${({ theme, flat, intent }) =>
103
105
  flat && !intent
104
106
  ? undefined
105
- : `1px solid ${rgba(
106
- changeLightness(intent ? theme.intents[intent] : getMainBackgroundColor(theme), 0.2),
107
- opacity
107
+ : `1px solid ${changeLightness(
108
+ intent ? theme.intents[intent] : getMainBackgroundColor(theme),
109
+ 0.2
108
110
  )}`};
109
111
  color: ${({ theme }) => getReadableColor(theme, undefined, undefined, true)};
110
112
  overflow: hidden;
@@ -113,7 +115,8 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
113
115
  position: relative;
114
116
  backdrop-filter: ${({ blur, opacity }) => (blur && opacity < 1 ? `blur(${blur}px)` : undefined)};
115
117
  transition: 0.2s ease-in-out;
116
- flex: auto;
118
+ width: ${({ fluid }) => (fluid ? '100%' : undefined)};
119
+ flex: ${({ fluid }) => (fluid ? '1 auto' : '0 0 auto')};
117
120
 
118
121
  ${({ interactive, theme, opacity = 1, flat, intent }) =>
119
122
  interactive
@@ -125,35 +128,37 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
125
128
  transform: scale(${ACTIVE_ICON_SCALE});
126
129
  }
127
130
 
128
- background-color: ${rgba(
129
- darken(0.025, rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)),
130
- opacity === 0 ? 0.2 : opacity
131
- )};
131
+ background-color: ${opacity === 0 && flat
132
+ ? undefined
133
+ : rgba(
134
+ darken(0.025, rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)),
135
+ opacity
136
+ )};
132
137
 
133
138
  border-color: ${flat && !intent
134
139
  ? undefined
135
- : `${rgba(
136
- changeLightness(
137
- intent ? theme.intents[intent] : getMainBackgroundColor(theme),
138
- 0.25
139
- ),
140
- opacity
140
+ : `${changeLightness(
141
+ intent ? theme.intents[intent] : getMainBackgroundColor(theme),
142
+ 0.25
141
143
  )}`};
142
144
 
143
- ${StyledCollectionItemContent}:after {
144
- background: linear-gradient(
145
- to top,
146
- ${rgba(
147
- darken(
148
- 0.025,
149
- rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)
150
- ),
151
- opacity === 0 ? 0.2 : opacity
152
- )}
153
- 0%,
154
- transparent 100%
155
- );
156
- }
145
+ ${opacity !== 0 &&
146
+ css`
147
+ ${StyledCollectionItemContent}:after {
148
+ background: linear-gradient(
149
+ to top,
150
+ ${rgba(
151
+ darken(
152
+ 0.025,
153
+ rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)
154
+ ),
155
+ opacity
156
+ )}
157
+ 0%,
158
+ transparent 100%
159
+ );
160
+ }
161
+ `}
157
162
  }
158
163
  `
159
164
  : undefined}
@@ -215,7 +220,7 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
215
220
  `;
216
221
 
217
222
  export const StyledPanelContent = styled.div<IStyledPanel>`
218
- display: ${({ isCollapsed }) => (isCollapsed ? 'none' : undefined)};
223
+ display: ${({ isCollapsed }) => (isCollapsed ? 'none !important' : undefined)};
219
224
  padding: ${({ padded, contentSize, noHorizontalPadding }) =>
220
225
  !padded
221
226
  ? undefined
@@ -224,9 +229,10 @@ export const StyledPanelContent = styled.div<IStyledPanel>`
224
229
  : `${TEXT_FROM_SIZE[contentSize]}px`};
225
230
  // The padding is not needed when the panel is minimal and has title, since
226
231
  // the title already has padding and is transparent
227
- padding-top: ${({ minimal, hasLabel, padded }) =>
228
- minimal && hasLabel && padded ? '0px' : undefined};
229
- padding-bottom: ${({ minimal, padded }) => (minimal && padded ? '10px' : undefined)};
232
+ padding-top: ${({ minimal, hasLabel, padded, contentSize }) =>
233
+ minimal && hasLabel && padded ? `${TEXT_FROM_SIZE[contentSize] / 2}px` : undefined};
234
+ padding-bottom: ${({ minimal, padded, contentSize }) =>
235
+ minimal && padded ? `${TEXT_FROM_SIZE[contentSize]}px` : undefined};
230
236
  flex: 1;
231
237
  overflow: auto;
232
238
  font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
@@ -268,6 +274,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
268
274
  tooltip,
269
275
  badge,
270
276
  iconColor,
277
+ fluid,
271
278
  ...rest
272
279
  }: IReqorePanelProps,
273
280
  ref
@@ -423,6 +430,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
423
430
  }, [intent, theme, contentEffect, interactive]);
424
431
 
425
432
  const opacity = rest.transparent ? 0 : rest.opacity;
433
+ const noHorizontalPadding = opacity === 0 && flat && !intent;
426
434
 
427
435
  return (
428
436
  <StyledPanel
@@ -438,6 +446,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
438
446
  theme={theme}
439
447
  effect={transformedContentEffect}
440
448
  opacity={opacity}
449
+ fluid={fluid}
441
450
  >
442
451
  {hasTitleBar && (
443
452
  <StyledPanelTitle
@@ -449,7 +458,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
449
458
  theme={theme}
450
459
  contentSize={contentSize}
451
460
  opacity={opacity ?? (minimal ? 0 : 1)}
452
- noHorizontalPadding={opacity === 0}
461
+ noHorizontalPadding={noHorizontalPadding}
453
462
  >
454
463
  <StyledPanelTitleHeader>
455
464
  {icon && (
@@ -518,7 +527,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
518
527
  padded={padded}
519
528
  minimal={minimal}
520
529
  contentSize={contentSize}
521
- noHorizontalPadding={opacity === 0}
530
+ noHorizontalPadding={noHorizontalPadding}
522
531
  >
523
532
  {children}
524
533
  </StyledPanelContent>
@@ -529,7 +538,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
529
538
  className='reqore-panel-bottom-actions'
530
539
  theme={theme}
531
540
  opacity={opacity ?? (minimal ? 0 : 1)}
532
- noHorizontalPadding={opacity === 0}
541
+ noHorizontalPadding={noHorizontalPadding}
533
542
  >
534
543
  <ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
535
544
  <ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
+ export type TReqoreTabsContentPadding = 'horizontal' | 'vertical' | 'none' | 'both' | true | false;
5
+
4
6
  export interface IReqoreTabsContent extends React.HTMLAttributes<HTMLDivElement> {
5
7
  children?: any;
6
8
  tabId: string | number;
9
+ padded?: TReqoreTabsContentPadding;
7
10
  }
8
11
 
9
12
  const StyledTabsContent = styled.div`
@@ -11,11 +14,16 @@ const StyledTabsContent = styled.div`
11
14
  flex-flow: column;
12
15
  overflow: hidden;
13
16
  flex: 1;
14
- padding: 10px;
17
+ padding: ${({ padded }: IReqoreTabsContent) =>
18
+ padded === 'none' || padded === false
19
+ ? undefined
20
+ : `${padded === 'both' || padded === true || padded === 'vertical' ? 10 : 0}px ${
21
+ padded === 'both' || padded === true || padded === 'horizontal' ? 10 : 0
22
+ }px}`};
15
23
  `;
16
24
 
17
- const ReqoreTabsContent = ({ children, className, ...rest }: IReqoreTabsContent) => (
18
- <StyledTabsContent {...rest} className={`${className || ''} reqore-tabs-content`}>
25
+ const ReqoreTabsContent = ({ children, className, padded = true, ...rest }: IReqoreTabsContent) => (
26
+ <StyledTabsContent {...rest} padded={padded} className={`${className || ''} reqore-tabs-content`}>
19
27
  {children}
20
28
  </StyledTabsContent>
21
29
  );
@@ -4,6 +4,7 @@ import { TSizes } from '../../constants/sizes';
4
4
  import { IReqoreCustomTheme, TReqoreIntent } from '../../constants/theme';
5
5
  import { IReqoreIconName } from '../../types/icons';
6
6
  import { IReqoreButtonProps } from '../Button';
7
+ import { TReqoreTabsContentPadding } from './content';
7
8
  import ReqoreTabsList from './list';
8
9
 
9
10
  export interface IReqoreTabsListItem extends Omit<IReqoreButtonProps, 'id'> {
@@ -26,6 +27,8 @@ export interface IReqoreTabsProps extends React.HTMLAttributes<HTMLDivElement> {
26
27
  fillParent?: boolean;
27
28
  vertical?: boolean;
28
29
  activeTabIntent?: TReqoreIntent;
30
+ padded?: boolean;
31
+ tabsPadding?: TReqoreTabsContentPadding;
29
32
  wrapTabNames?: boolean;
30
33
  flat?: boolean;
31
34
  size?: TSizes;
@@ -61,6 +64,8 @@ const ReqoreTabs = ({
61
64
  wrapTabNames,
62
65
  customTheme,
63
66
  intent,
67
+ padded,
68
+ tabsPadding,
64
69
  ...rest
65
70
  }: IReqoreTabsProps) => {
66
71
  const [_activeTab, setActiveTab] = useState<string | number>(activeTab || tabs[0].id);
@@ -84,6 +89,7 @@ const ReqoreTabs = ({
84
89
  >
85
90
  <ReqoreTabsList
86
91
  tabs={tabs}
92
+ padded={padded}
87
93
  flat={flat}
88
94
  fill={fill}
89
95
  size={size}
@@ -104,7 +110,11 @@ const ReqoreTabs = ({
104
110
  }}
105
111
  />
106
112
  {React.Children.map(children, (child) =>
107
- child && child.props?.tabId === _activeTab ? child : null
113
+ child && child.props?.tabId === _activeTab
114
+ ? React.cloneElement(child, {
115
+ padded: child.props?.padded || tabsPadding,
116
+ })
117
+ : null
108
118
  )}
109
119
  </StyledTabs>
110
120
  );
@@ -18,6 +18,7 @@ export interface IReqoreTabListItemProps extends IReqoreTabsListItem, IWithReqor
18
18
  wrapTabNames?: boolean;
19
19
  fill?: boolean;
20
20
  className?: string;
21
+ padded?: boolean;
21
22
  }
22
23
 
23
24
  export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
@@ -27,7 +28,7 @@ export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
27
28
  }
28
29
 
29
30
  export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
30
- ${({ disabled, vertical, size, fill }: IReqoreTabListItemStyle) => {
31
+ ${({ disabled, vertical, size, fill, padded }: IReqoreTabListItemStyle) => {
31
32
  return css`
32
33
  display: flex;
33
34
  flex-shrink: 0;
@@ -48,6 +49,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
48
49
  border-top-right-radius: 0 !important;
49
50
  border-bottom-right-radius: 0 !important;
50
51
  }
52
+
53
+ ${padded === false &&
54
+ css`
55
+ &:first-child {
56
+ padding-top: 0;
57
+ }
58
+ &:last-child {
59
+ padding-bottom: 0;
60
+ }
61
+ `}
51
62
  `
52
63
  : css`
53
64
  ${StyledButton} {
@@ -59,6 +70,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
59
70
  ${StyledButton}:last-child {
60
71
  border-bottom-right-radius: 0 !important;
61
72
  }
73
+
74
+ ${padded === false &&
75
+ css`
76
+ &:first-child {
77
+ padding-left: 0;
78
+ }
79
+ &:last-child {
80
+ padding-right: 0;
81
+ }
82
+ `}
62
83
  `}
63
84
 
64
85
  ${fill &&
@@ -109,6 +130,7 @@ const ReqoreTabsListItem = memo(
109
130
  flat = true,
110
131
  wrapTabNames,
111
132
  id,
133
+ padded,
112
134
  ...rest
113
135
  }: IReqoreTabListItemProps,
114
136
  ref
@@ -129,6 +151,7 @@ const ReqoreTabsListItem = memo(
129
151
  vertical={vertical}
130
152
  theme={theme}
131
153
  fill={fill}
154
+ padded={padded}
132
155
  >
133
156
  {label || icon ? (
134
157
  <ReqoreControlGroup stack size={size} fluid={fill || vertical}>
@@ -162,6 +162,7 @@ const ReqoreTabsList = ({
162
162
  flat,
163
163
  size,
164
164
  intent,
165
+ padded,
165
166
  ...rest
166
167
  }: IReqoreTabsListProps) => {
167
168
  const [ref, { width }] = useMeasure();
@@ -211,6 +212,7 @@ const ReqoreTabsList = ({
211
212
  vertical,
212
213
  flat,
213
214
  size,
215
+ padded,
214
216
  className: 'reqore-tabs-list-item-menu',
215
217
  } as IReqoreTabListItemProps
216
218
  }
@@ -279,6 +281,7 @@ const ReqoreTabsList = ({
279
281
  fill={fill}
280
282
  size={size}
281
283
  flat={flat}
284
+ padded={padded}
282
285
  activeIntent={activeTabIntent}
283
286
  wrapTabNames={wrapTabNames}
284
287
  {...item}
@@ -35,6 +35,7 @@ import ReqoreIcon from '../Icon';
35
35
 
36
36
  export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
37
37
  icon: IReqoreIconName;
38
+ show?: boolean;
38
39
  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
39
40
  }
40
41
 
@@ -331,28 +332,30 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
331
332
  </StyledTagContentWrapper>
332
333
  ) : null}
333
334
  {_size(actions)
334
- ? actions.map((action, index) => (
335
- <React.Fragment key={index}>
336
- <ReqorePopover
337
- component={StyledButtonWrapper}
338
- componentProps={{
339
- size,
340
- color: getCustomColor(action.intent),
341
- className: 'reqore-tag-action',
342
- onClick: action.onClick,
343
- effect: rest.effect,
344
- }}
345
- {...(action.tooltip
346
- ? typeof action.tooltip === 'string'
347
- ? { tooltip: action.tooltip }
348
- : action.tooltip
349
- : {})}
350
- isReqoreComponent
351
- >
352
- <ReqoreIcon icon={action.icon} size={size} />
353
- </ReqorePopover>
354
- </React.Fragment>
355
- ))
335
+ ? actions
336
+ .filter((action) => action.show !== false)
337
+ .map((action, index) => (
338
+ <React.Fragment key={index}>
339
+ <ReqorePopover
340
+ component={StyledButtonWrapper}
341
+ componentProps={{
342
+ size,
343
+ color: getCustomColor(action.intent),
344
+ className: 'reqore-tag-action',
345
+ onClick: action.onClick,
346
+ effect: rest.effect,
347
+ }}
348
+ {...(action.tooltip
349
+ ? typeof action.tooltip === 'string'
350
+ ? { tooltip: action.tooltip }
351
+ : action.tooltip
352
+ : {})}
353
+ isReqoreComponent
354
+ >
355
+ <ReqoreIcon icon={action.icon} size={size} />
356
+ </ReqorePopover>
357
+ </React.Fragment>
358
+ ))
356
359
  : null}
357
360
  {onRemoveClick && !rest.disabled ? (
358
361
  <ReqorePopover
@@ -37,19 +37,19 @@ export const HEADER_SIZE_TO_NUMBER = {
37
37
  };
38
38
 
39
39
  export const SIZE_TO_PX = {
40
- tiny: 10,
41
- small: 20,
40
+ tiny: 18,
41
+ small: 24,
42
42
  normal: 30,
43
43
  big: 40,
44
44
  huge: 50,
45
45
  };
46
46
 
47
47
  export const BADGE_SIZE_TO_PX = {
48
- tiny: 10,
49
- small: 18,
50
- normal: 24,
51
- big: 30,
52
- huge: 36,
48
+ tiny: 14,
49
+ small: 20,
50
+ normal: 26,
51
+ big: 32,
52
+ huge: 38,
53
53
  };
54
54
 
55
55
  export const TABS_SIZE_TO_PX = {
@@ -122,6 +122,7 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
122
122
  isMobileOrTablet,
123
123
  getAndIncreaseZIndex,
124
124
  animations: options.animations || { buttons: true, dialogs: true },
125
+ tooltips: options.tooltips || { delay: 0 },
125
126
  closePopoversOnEscPress:
126
127
  'closePopoversOnEscPress' in options ? options.closePopoversOnEscPress : true,
127
128
  }}
@@ -18,6 +18,13 @@ export interface IReqoreOptions {
18
18
  buttons?: boolean;
19
19
  dialogs?: boolean;
20
20
  };
21
+ tooltips?: {
22
+ /**
23
+ * Delay in ms before showing the tooltip
24
+ * @default 0
25
+ * */
26
+ delay?: number;
27
+ };
21
28
  closePopoversOnEscPress?: boolean;
22
29
  }
23
30
  export interface IReqoreUIProviderProps {
@@ -12,6 +12,7 @@ export interface IReqoreContext {
12
12
  readonly isMobileOrTablet?: boolean;
13
13
  readonly getAndIncreaseZIndex?: () => number;
14
14
  readonly animations?: IReqoreOptions['animations'];
15
+ readonly tooltips?: IReqoreOptions['tooltips'];
15
16
  readonly closePopoversOnEscPress?: boolean;
16
17
  }
17
18
 
@@ -11,6 +11,7 @@ import {
11
11
  IWithReqoreMinimal,
12
12
  } from '../types/global';
13
13
  import { IReqoreIconName } from '../types/icons';
14
+ import { useReqore } from './useReqore';
14
15
 
15
16
  const startEvents = {
16
17
  hover: 'mouseenter',
@@ -77,6 +78,7 @@ const usePopover = ({
77
78
  }: IPopoverOptions): IPopoverControls => {
78
79
  const { addPopover, removePopover, updatePopover, popovers, isPopoverOpen } =
79
80
  useContext(PopoverContext);
81
+ const { tooltips } = useReqore();
80
82
  const { current }: MutableRefObject<string> = useRef(shortid.generate());
81
83
  let { current: timeout }: MutableRefObject<any> = useRef(0);
82
84
 
@@ -112,10 +114,10 @@ const usePopover = ({
112
114
  _removePopover?.();
113
115
  }
114
116
  } else if (show) {
115
- if (delay) {
117
+ if (delay || tooltips.delay) {
116
118
  timeout = setTimeout(() => {
117
119
  openPopover();
118
- }, delay);
120
+ }, delay || tooltips.delay);
119
121
  } else {
120
122
  openPopover();
121
123
  }