@qoretechnologies/reqore 0.34.10 → 0.34.12
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__/drawer.test.tsx +33 -1
- package/dist/components/Breadcrumbs/index.d.ts +2 -7
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +4 -5
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Breadcrumbs/item.d.ts +1 -1
- package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.js +17 -61
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +2 -2
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +3 -3
- package/dist/components/Drawer/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Breadcrumbs/index.tsx +7 -13
- package/src/components/Breadcrumbs/item.tsx +16 -134
- package/src/components/Button/index.tsx +3 -1
- package/src/components/Drawer/index.tsx +4 -3
- package/src/mock/breadcrumbs.ts +12 -4
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +3 -0
- package/src/stories/Drawer/Drawer.stories.tsx +2 -1
- package/tests.json +1 -1
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { forwardRef
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
1
|
+
import { forwardRef } from 'react';
|
|
3
2
|
import { IReqoreBreadcrumbItem } from '.';
|
|
4
|
-
import {
|
|
3
|
+
import { TSizes } from '../../constants/sizes';
|
|
5
4
|
import { IReqoreTheme } from '../../constants/theme';
|
|
6
|
-
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
7
|
-
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
8
5
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
|
-
import
|
|
10
|
-
import { ActiveIconScale, InactiveIconScale } from '../../styles';
|
|
11
|
-
import {
|
|
12
|
-
StyledActiveContent,
|
|
13
|
-
StyledAnimatedTextWrapper,
|
|
14
|
-
StyledInActiveContent,
|
|
15
|
-
StyledInvisibleContent,
|
|
16
|
-
} from '../Button';
|
|
17
|
-
import ReqoreIcon from '../Icon';
|
|
6
|
+
import ReqoreButton from '../Button';
|
|
18
7
|
|
|
19
8
|
export interface IReqoreBreadcrumbItemProps extends IReqoreBreadcrumbItem {
|
|
20
9
|
interactive?: boolean;
|
|
@@ -25,131 +14,24 @@ export interface IReqoreBreadcrumbItemStyle extends IReqoreBreadcrumbItemProps {
|
|
|
25
14
|
theme: IReqoreTheme;
|
|
26
15
|
}
|
|
27
16
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const textColor =
|
|
31
|
-
theme.breadcrumbs?.item?.color ||
|
|
32
|
-
(theme.breadcrumbs?.main
|
|
33
|
-
? getReadableColorFrom(theme.breadcrumbs.main, true)
|
|
34
|
-
: getReadableColor(theme, undefined, undefined, true));
|
|
35
|
-
|
|
36
|
-
return css`
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-shrink: 0;
|
|
39
|
-
height: 100%;
|
|
40
|
-
justify-content: space-evenly;
|
|
41
|
-
align-items: center;
|
|
42
|
-
padding: 0 ${PADDING_FROM_SIZE[size!]}px;
|
|
43
|
-
transition: background-color 0.15s ease-out;
|
|
44
|
-
font-size: ${TEXT_FROM_SIZE[size!]}px;
|
|
45
|
-
font-weight: 450;
|
|
46
|
-
position: relative;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
|
|
49
|
-
* {
|
|
50
|
-
color: ${textColor};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
${InactiveIconScale}
|
|
54
|
-
|
|
55
|
-
${active &&
|
|
56
|
-
css`
|
|
57
|
-
* {
|
|
58
|
-
font-weight: 600;
|
|
59
|
-
color: ${theme.breadcrumbs?.item?.activeColor ||
|
|
60
|
-
(theme.breadcrumbs?.main
|
|
61
|
-
? getReadableColorFrom(theme.breadcrumbs.main, true)
|
|
62
|
-
: getReadableColor(theme, undefined, undefined))};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
${ActiveIconScale}
|
|
66
|
-
`}
|
|
67
|
-
|
|
68
|
-
${interactive &&
|
|
69
|
-
css`
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
&:hover {
|
|
72
|
-
color: ${theme.breadcrumbs?.item?.hoverColor ||
|
|
73
|
-
(theme.breadcrumbs?.main
|
|
74
|
-
? getReadableColorFrom(theme.breadcrumbs.main)
|
|
75
|
-
: getReadableColor(theme, undefined, undefined))};
|
|
76
|
-
background-color: ${changeLightness(theme.breadcrumbs?.main || theme.main, 0.05)};
|
|
77
|
-
${ActiveIconScale}
|
|
78
|
-
|
|
79
|
-
${StyledActiveContent} {
|
|
80
|
-
transform: translateY(0px);
|
|
81
|
-
filter: blur(0);
|
|
82
|
-
opacity: 1;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
${StyledInActiveContent} {
|
|
86
|
-
transform: translateY(150%);
|
|
87
|
-
filter: blur(10px);
|
|
88
|
-
opacity: 0;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
`}
|
|
92
|
-
|
|
93
|
-
a:hover {
|
|
94
|
-
color: ${theme.breadcrumbs?.item?.hoverColor ||
|
|
95
|
-
(theme.breadcrumbs?.main
|
|
96
|
-
? getReadableColorFrom(theme.breadcrumbs?.main)
|
|
97
|
-
: getReadableColor(theme, undefined, undefined))};
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
}}
|
|
101
|
-
|
|
102
|
-
a {
|
|
103
|
-
text-decoration: none;
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
text-decoration: underline;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
const ReqoreBreadcrumbsItem = forwardRef<HTMLDivElement, IReqoreBreadcrumbItemProps>(
|
|
112
|
-
(
|
|
113
|
-
{
|
|
114
|
-
tooltip,
|
|
115
|
-
label,
|
|
116
|
-
props,
|
|
117
|
-
icon,
|
|
118
|
-
active,
|
|
119
|
-
as,
|
|
120
|
-
interactive,
|
|
121
|
-
customTheme,
|
|
122
|
-
size = 'normal',
|
|
123
|
-
}: IReqoreBreadcrumbItemProps,
|
|
124
|
-
ref
|
|
125
|
-
) => {
|
|
126
|
-
const { targetRef } = useCombinedRefs(ref);
|
|
127
|
-
const [itemRef, setItemRef] = useState(undefined);
|
|
17
|
+
const ReqoreBreadcrumbsItem = forwardRef<HTMLButtonElement, IReqoreBreadcrumbItemProps>(
|
|
18
|
+
({ label, props, as, customTheme, ...rest }: IReqoreBreadcrumbItemProps, ref) => {
|
|
128
19
|
const theme = useReqoreTheme('breadcrumbs', customTheme);
|
|
129
20
|
|
|
130
|
-
useTooltip(itemRef, tooltip);
|
|
131
|
-
|
|
132
21
|
return (
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}}
|
|
138
|
-
active={active}
|
|
139
|
-
interactive={interactive || !!props?.onClick}
|
|
22
|
+
<ReqoreButton
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
as={as}
|
|
25
|
+
ref={ref}
|
|
140
26
|
className='reqore-breadcrumbs-item'
|
|
141
|
-
|
|
142
|
-
|
|
27
|
+
customTheme={theme}
|
|
28
|
+
minimal
|
|
29
|
+
flat
|
|
30
|
+
{...rest}
|
|
31
|
+
{...props}
|
|
143
32
|
>
|
|
144
|
-
{
|
|
145
|
-
|
|
146
|
-
<StyledAnimatedTextWrapper as={as || 'span'} {...props}>
|
|
147
|
-
<StyledActiveContent>{label}</StyledActiveContent>
|
|
148
|
-
<StyledInActiveContent>{label}</StyledInActiveContent>
|
|
149
|
-
<StyledInvisibleContent>{label}</StyledInvisibleContent>
|
|
150
|
-
</StyledAnimatedTextWrapper>
|
|
151
|
-
)}
|
|
152
|
-
</StyledBreadcrumbItem>
|
|
33
|
+
{label}
|
|
34
|
+
</ReqoreButton>
|
|
153
35
|
);
|
|
154
36
|
}
|
|
155
37
|
);
|
|
@@ -76,6 +76,7 @@ export interface IReqoreButtonProps
|
|
|
76
76
|
labelEffect?: IReqoreEffect;
|
|
77
77
|
descriptionEffect?: IReqoreEffect;
|
|
78
78
|
label?: React.HTMLAttributes<HTMLButtonElement>['children'];
|
|
79
|
+
as?: string | React.ElementType;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
@@ -398,6 +399,7 @@ const ReqoreButton = memo(
|
|
|
398
399
|
iconColor,
|
|
399
400
|
iconsAlign,
|
|
400
401
|
label,
|
|
402
|
+
as,
|
|
401
403
|
...rest
|
|
402
404
|
}: IReqoreButtonProps,
|
|
403
405
|
ref
|
|
@@ -434,7 +436,7 @@ const ReqoreButton = memo(
|
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
438
|
tabindex={rest.disabled ? -1 : 0}
|
|
437
|
-
as='button'
|
|
439
|
+
as={as || 'button'}
|
|
438
440
|
theme={theme}
|
|
439
441
|
ref={(ref) => {
|
|
440
442
|
targetRef.current = ref;
|
|
@@ -210,8 +210,9 @@ export const ReqoreDrawer: React.FC<IReqoreDrawerProps> = ({
|
|
|
210
210
|
icon: getHideShowIcon(position, _isHidden),
|
|
211
211
|
onClick: () => {
|
|
212
212
|
setIsHidden(!_isHidden);
|
|
213
|
+
|
|
213
214
|
if (onHideToggle) {
|
|
214
|
-
onHideToggle(_isHidden);
|
|
215
|
+
onHideToggle(!_isHidden);
|
|
215
216
|
}
|
|
216
217
|
},
|
|
217
218
|
className: 'reqore-drawer-hide-button',
|
|
@@ -219,7 +220,7 @@ export const ReqoreDrawer: React.FC<IReqoreDrawerProps> = ({
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
return builtActions;
|
|
222
|
-
}, [hidable, position, onClose]);
|
|
223
|
+
}, [hidable, position, onClose, actions, _isHidden]);
|
|
223
224
|
|
|
224
225
|
const positions = useMemo(() => {
|
|
225
226
|
/* Centering the modal. */
|
|
@@ -345,7 +346,7 @@ export const ReqoreDrawer: React.FC<IReqoreDrawerProps> = ({
|
|
|
345
346
|
icon={getHideShowIcon(position, _isHidden)}
|
|
346
347
|
onClick={() => {
|
|
347
348
|
setIsHidden(!_isHidden);
|
|
348
|
-
onHideToggle
|
|
349
|
+
onHideToggle?.(!_isHidden);
|
|
349
350
|
}}
|
|
350
351
|
/>
|
|
351
352
|
</StyledCloseWrapper>
|
package/src/mock/breadcrumbs.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { noop } from 'lodash';
|
|
2
2
|
import { IReqoreBreadcrumbItem, IReqoreBreadcrumbItemTabs } from '../components/Breadcrumbs';
|
|
3
|
+
import { ReqoreH3 } from '../components/Header';
|
|
3
4
|
import { Icons } from './icons';
|
|
4
5
|
|
|
5
6
|
export default [
|
|
@@ -10,18 +11,21 @@ export default [
|
|
|
10
11
|
active: true,
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
|
-
label: 'Workflows',
|
|
14
|
-
icon: Icons.Workflow,
|
|
14
|
+
label: 'Workflows as Link',
|
|
15
15
|
tooltip: 'Opens in a new window',
|
|
16
16
|
as: 'a',
|
|
17
17
|
props: {
|
|
18
18
|
href: 'https://google.com',
|
|
19
19
|
},
|
|
20
|
+
icon: Icons.Workflows,
|
|
21
|
+
flat: false,
|
|
22
|
+
intent: 'info',
|
|
20
23
|
},
|
|
21
24
|
{
|
|
22
|
-
label: 'Services',
|
|
23
25
|
icon: Icons.Services,
|
|
24
|
-
tooltip: 'Services',
|
|
26
|
+
tooltip: 'Services as H3',
|
|
27
|
+
as: ReqoreH3,
|
|
28
|
+
label: 'Services as H3',
|
|
25
29
|
props: {
|
|
26
30
|
onClick: noop,
|
|
27
31
|
},
|
|
@@ -30,6 +34,10 @@ export default [
|
|
|
30
34
|
label: 'Jobs',
|
|
31
35
|
icon: Icons.Jobs,
|
|
32
36
|
customTheme: '#a9a9a9',
|
|
37
|
+
badge: 10,
|
|
38
|
+
description: 'Some item description',
|
|
39
|
+
intent: 'warning',
|
|
40
|
+
minimal: false,
|
|
33
41
|
},
|
|
34
42
|
{
|
|
35
43
|
tooltip: 'Connections',
|
|
@@ -3,6 +3,7 @@ import { IReqoreBreadcrumbItem, IReqoreBreadcrumbsProps } from '../../components
|
|
|
3
3
|
import { ReqoreBreadcrumbs } from '../../index';
|
|
4
4
|
import breadcrumbs, { breadcrumbsTabs } from '../../mock/breadcrumbs';
|
|
5
5
|
import { buildTemplate } from '../utils';
|
|
6
|
+
import { SizeArg } from '../utils/args';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: 'Components/Breadcrumbs',
|
|
@@ -13,6 +14,7 @@ export default {
|
|
|
13
14
|
description: 'Whether tabs should be shown alongside the breadcrumbs',
|
|
14
15
|
control: 'boolean',
|
|
15
16
|
},
|
|
17
|
+
...SizeArg,
|
|
16
18
|
},
|
|
17
19
|
parameters: {
|
|
18
20
|
jest: ['breadcrumbs.test.tsx'],
|
|
@@ -36,3 +38,4 @@ const Template: ComponentStory<typeof ReqoreBreadcrumbs & { withTabs?: boolean }
|
|
|
36
38
|
|
|
37
39
|
export const Default = buildTemplate(Template);
|
|
38
40
|
export const WithTabs = buildTemplate(Template, { withTabs: true });
|
|
41
|
+
export const Flat = buildTemplate(Template, { flat: true });
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ReqoreTabsContent,
|
|
11
11
|
useReqoreProperty,
|
|
12
12
|
} from '../../index';
|
|
13
|
-
import {
|
|
13
|
+
import { FlatArg, IntentArg, argManager } from '../utils/args';
|
|
14
14
|
|
|
15
15
|
const { createArg } = argManager<IReqoreDrawerProps>();
|
|
16
16
|
|
|
@@ -136,6 +136,7 @@ const Template: Story<IReqoreDrawerProps> = (args: IReqoreDrawerProps) => {
|
|
|
136
136
|
label='This is a test'
|
|
137
137
|
icon='EmphasisCn'
|
|
138
138
|
onClose={noop}
|
|
139
|
+
onHideToggle={(isHidden) => console.log(isHidden)}
|
|
139
140
|
actions={[
|
|
140
141
|
{
|
|
141
142
|
responsive: false,
|