@qoretechnologies/reqore 0.29.8 → 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.
- package/__tests__/popover.test.tsx +24 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +3 -6
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +3 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +5 -7
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +2 -3
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +8 -4
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +2 -0
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +8 -5
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +3 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +10 -6
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +2 -2
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +29 -20
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +3 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +8 -3
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +10 -3
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -0
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +3 -2
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +3 -1
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/sizes.js +7 -7
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +1 -0
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +1 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +4 -2
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +1 -2
- package/src/components/Collection/index.tsx +15 -2
- package/src/components/Collection/item.tsx +14 -6
- package/src/components/ControlGroup/index.tsx +10 -1
- package/src/components/Icon/index.tsx +78 -62
- package/src/components/Panel/index.tsx +46 -37
- package/src/components/Tabs/content.tsx +11 -3
- package/src/components/Tabs/index.tsx +11 -1
- package/src/components/Tabs/item.tsx +24 -1
- package/src/components/Tabs/list.tsx +3 -0
- package/src/components/Tag/index.tsx +25 -22
- package/src/constants/sizes.ts +7 -7
- package/src/containers/ReqoreProvider.tsx +1 -0
- package/src/containers/UIProvider.tsx +7 -0
- package/src/context/ReqoreContext.tsx +1 -0
- package/src/hooks/usePopover.tsx +4 -2
- package/src/mock/collectionData.tsx +21 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +13 -1
- package/src/stories/Icon/Icon.stories.tsx +1 -0
- package/src/stories/Input/Input.stories.tsx +2 -1
- package/src/stories/Panel/Panel.stories.tsx +39 -1
- package/src/stories/Tabs/Tabs.stories.tsx +30 -14
- package/src/stories/Tag/Tag.stories.tsx +12 -2
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { darken, rgba } from 'polished';
|
|
3
|
-
import {
|
|
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,
|
|
104
|
+
border: ${({ theme, flat, intent }) =>
|
|
103
105
|
flat && !intent
|
|
104
106
|
? undefined
|
|
105
|
-
: `1px solid ${
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
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: ${
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
: `${
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
0.25
|
|
139
|
-
),
|
|
140
|
-
opacity
|
|
140
|
+
: `${changeLightness(
|
|
141
|
+
intent ? theme.intents[intent] : getMainBackgroundColor(theme),
|
|
142
|
+
0.25
|
|
141
143
|
)}`};
|
|
142
144
|
|
|
143
|
-
${
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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 ?
|
|
229
|
-
padding-bottom: ${({ minimal, padded }) =>
|
|
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={
|
|
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={
|
|
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={
|
|
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:
|
|
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
|
|
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
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
package/src/constants/sizes.ts
CHANGED
|
@@ -37,19 +37,19 @@ export const HEADER_SIZE_TO_NUMBER = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SIZE_TO_PX = {
|
|
40
|
-
tiny:
|
|
41
|
-
small:
|
|
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:
|
|
49
|
-
small:
|
|
50
|
-
normal:
|
|
51
|
-
big:
|
|
52
|
-
huge:
|
|
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
|
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -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
|
}
|
|
@@ -104,6 +104,22 @@ export default [
|
|
|
104
104
|
weight: 'thin',
|
|
105
105
|
spaced: 2,
|
|
106
106
|
},
|
|
107
|
+
expandedActions: [
|
|
108
|
+
{
|
|
109
|
+
label: 'Action 1',
|
|
110
|
+
id: 'action1',
|
|
111
|
+
icon: 'CapsuleFill',
|
|
112
|
+
onClick: () => alert('Action 1 clicked'),
|
|
113
|
+
position: 'left',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: 'Action 2',
|
|
117
|
+
id: 'action2',
|
|
118
|
+
icon: 'CapsuleFill',
|
|
119
|
+
onClick: () => alert('Action 2 clicked'),
|
|
120
|
+
position: 'right',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
107
123
|
expandedContent: (
|
|
108
124
|
<>
|
|
109
125
|
<ReqoreMessage intent='info'>Hello I am a custom content</ReqoreMessage>
|
|
@@ -191,6 +207,9 @@ export default [
|
|
|
191
207
|
},
|
|
192
208
|
{
|
|
193
209
|
label: 'I have intent!',
|
|
210
|
+
transparent: true,
|
|
211
|
+
minimal: false,
|
|
212
|
+
flat: false,
|
|
194
213
|
content: (
|
|
195
214
|
<ReqoreP>
|
|
196
215
|
'Well would you look at that. Lorem ipsum dolor{' '}
|
|
@@ -242,13 +261,14 @@ export default [
|
|
|
242
261
|
{
|
|
243
262
|
label: 'I have actions',
|
|
244
263
|
content:
|
|
245
|
-
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
264
|
+
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
246
265
|
actions: [
|
|
247
266
|
{
|
|
248
267
|
label: 'Action 1',
|
|
249
268
|
id: 'action1',
|
|
250
269
|
icon: 'CapsuleFill',
|
|
251
270
|
onClick: () => alert('Action 1 clicked'),
|
|
271
|
+
show: false,
|
|
252
272
|
},
|
|
253
273
|
{
|
|
254
274
|
label: 'Action 2',
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ReqoreTag,
|
|
10
10
|
ReqoreVerticalSpacer,
|
|
11
11
|
} from '../../index';
|
|
12
|
-
import { GapSizeArg, MinimalArg, SizeArg
|
|
12
|
+
import { argManager, GapSizeArg, MinimalArg, SizeArg } from '../utils/args';
|
|
13
13
|
|
|
14
14
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
15
15
|
|
|
@@ -55,6 +55,7 @@ const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProp
|
|
|
55
55
|
icon='PictureInPictureLine'
|
|
56
56
|
flat={false}
|
|
57
57
|
effect={{ gradient: { colors: { 0: 'success', 100: 'info:darken:1' } } }}
|
|
58
|
+
description="With a description, it's a bit longer than the button itself"
|
|
58
59
|
>
|
|
59
60
|
Non flat Button
|
|
60
61
|
</ReqoreButton>
|
|
@@ -218,3 +219,14 @@ export const NoWrap = Template.bind({});
|
|
|
218
219
|
NoWrap.args = {
|
|
219
220
|
wrap: false,
|
|
220
221
|
};
|
|
222
|
+
|
|
223
|
+
export const HorizontalAlign = Template.bind({});
|
|
224
|
+
HorizontalAlign.args = {
|
|
225
|
+
vertical: true,
|
|
226
|
+
horizontalAlign: 'center',
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const VerticalAlign = Template.bind({});
|
|
230
|
+
VerticalAlign.args = {
|
|
231
|
+
verticalAlign: 'flex-end',
|
|
232
|
+
};
|
|
@@ -2,13 +2,14 @@ import { Meta, Story } from '@storybook/react/types-6-0';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import ReqoreInput, { IReqoreInputProps } from '../../components/Input';
|
|
4
4
|
import { ReqoreControlGroup } from '../../index';
|
|
5
|
-
import { FlatArg, IconArg, MinimalArg } from '../utils/args';
|
|
5
|
+
import { FlatArg, IconArg, MinimalArg, SizeArg } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'Components/Input',
|
|
9
9
|
argTypes: {
|
|
10
10
|
...MinimalArg,
|
|
11
11
|
...FlatArg,
|
|
12
|
+
...SizeArg,
|
|
12
13
|
...IconArg('icon', 'Icon', 'SearchLine'),
|
|
13
14
|
},
|
|
14
15
|
} as Meta<IReqoreInputProps>;
|