@qoretechnologies/reqore 0.25.10 → 0.26.1
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/.gitpod.yml +2 -2
- package/__tests__/effect.test.tsx +70 -0
- package/dist/components/Button/index.d.ts +3 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +19 -14
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +4 -1
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts +29 -0
- package/dist/components/Effect/index.d.ts.map +1 -0
- package/dist/components/Effect/index.js +118 -0
- package/dist/components/Effect/index.js.map +1 -0
- package/dist/components/Header/index.d.ts +14 -8
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +52 -33
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +3 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +8 -7
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts +5 -11
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +4 -4
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -6
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +3 -2
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +3 -2
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +17 -16
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +0 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +6 -5
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +6 -4
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +8 -7
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts +1 -0
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +4 -3
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +7 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +8 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -0
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts +2 -2
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +6 -5
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +9 -3
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +2 -2
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +2 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +4 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.js +1 -1
- package/dist/helpers/colors.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/Button/index.tsx +41 -25
- package/src/components/ControlGroup/index.tsx +1 -0
- package/src/components/Effect/index.tsx +137 -0
- package/src/components/Header/index.tsx +33 -28
- package/src/components/Input/index.tsx +15 -7
- package/src/components/Menu/index.tsx +1 -1
- package/src/components/Menu/item.tsx +8 -17
- package/src/components/Message/index.tsx +13 -5
- package/src/components/Notifications/notification.tsx +7 -4
- package/src/components/Panel/index.tsx +29 -26
- package/src/components/Popover/index.tsx +0 -13
- package/src/components/Tabs/item.tsx +92 -79
- package/src/components/Tag/index.tsx +16 -7
- package/src/components/Textarea/index.tsx +14 -7
- package/src/components/Tree/index.tsx +6 -2
- package/src/constants/sizes.ts +8 -0
- package/src/constants/theme.ts +1 -0
- package/src/containers/ReqoreProvider.tsx +14 -8
- package/src/containers/UIProvider.tsx +13 -13
- package/src/context/ReqoreContext.tsx +5 -0
- package/src/helpers/colors.ts +1 -1
- package/src/index.tsx +10 -1
- package/src/mock/collectionData.tsx +55 -2
- package/src/stories/Button/Button.stories.tsx +18 -2
- package/src/stories/Header/Header.stories.tsx +71 -0
- package/src/stories/Input/Input.stories.tsx +12 -0
- package/src/stories/Menu/Menu.stories.tsx +14 -0
- package/src/stories/Message/Message.stories.tsx +13 -0
- package/src/stories/Notifications/Notification.stories.tsx +7 -2
- package/src/stories/Panel/Panel.stories.tsx +37 -1
- package/src/stories/Tabs/Tabs.stories.tsx +23 -23
- package/src/stories/Tag/Tag.stories.tsx +16 -0
- package/src/stories/TextArea/TextArea.stories.tsx +18 -0
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { forwardRef, memo } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { IReqoreTabsListItem } from '.';
|
|
4
4
|
import { TABS_PADDING_TO_PX, TSizes } from '../../constants/sizes';
|
|
5
5
|
import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
6
|
+
import { changeLightness } from '../../helpers/colors';
|
|
6
7
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
7
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
8
9
|
import ReqoreButton from '../Button';
|
|
@@ -37,7 +38,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
37
38
|
padding: ${vertical ? `${TABS_PADDING_TO_PX[size!]}px` : `${TABS_PADDING_TO_PX[size!]}px`};
|
|
38
39
|
${active &&
|
|
39
40
|
css`
|
|
40
|
-
|
|
41
|
+
&:after {
|
|
42
|
+
width: ${vertical ? '5px' : '1px'};
|
|
43
|
+
height: ${vertical ? '1px' : '5px'};
|
|
44
|
+
left: ${vertical ? '0' : '50%'};
|
|
45
|
+
top: ${vertical ? '50%' : undefined};
|
|
46
|
+
bottom: ${vertical ? undefined : '0'};
|
|
47
|
+
content: '';
|
|
48
|
+
position: absolute;
|
|
49
|
+
background-color: ${activeColor};
|
|
50
|
+
}
|
|
41
51
|
`}
|
|
42
52
|
|
|
43
53
|
${fill &&
|
|
@@ -64,87 +74,90 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
64
74
|
}
|
|
65
75
|
`;
|
|
66
76
|
|
|
67
|
-
const ReqoreTabsListItem =
|
|
68
|
-
(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
const ReqoreTabsListItem = memo(
|
|
78
|
+
forwardRef(
|
|
79
|
+
(
|
|
80
|
+
{
|
|
81
|
+
tooltip,
|
|
82
|
+
label,
|
|
83
|
+
props,
|
|
84
|
+
icon,
|
|
85
|
+
active,
|
|
86
|
+
as,
|
|
87
|
+
disabled,
|
|
88
|
+
vertical,
|
|
89
|
+
onClick,
|
|
90
|
+
activeIntent,
|
|
91
|
+
onCloseClick,
|
|
92
|
+
fill,
|
|
93
|
+
intent,
|
|
94
|
+
size = 'normal',
|
|
95
|
+
closeIcon,
|
|
96
|
+
customTheme,
|
|
97
|
+
className,
|
|
98
|
+
}: IReqoreTabListItemProps,
|
|
99
|
+
ref
|
|
100
|
+
) => {
|
|
101
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
102
|
+
const theme = useReqoreTheme('main', customTheme);
|
|
103
|
+
const _intent = activeIntent || intent;
|
|
104
|
+
const activeColor = _intent ? theme.intents[_intent] : changeLightness(theme.main, 0.05);
|
|
94
105
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<ReqoreButton
|
|
114
|
-
flat
|
|
115
|
-
fluid={fill || vertical}
|
|
116
|
-
icon={icon}
|
|
117
|
-
minimal
|
|
118
|
-
intent={active ? activeIntent || intent : intent}
|
|
119
|
-
active={active}
|
|
120
|
-
disabled={disabled}
|
|
121
|
-
onClick={onClick}
|
|
122
|
-
tooltip={tooltip}
|
|
123
|
-
customTheme={customTheme}
|
|
124
|
-
className={`reqore-tabs-list-item ${active ? 'reqore-tabs-list-item-active' : ''}`}
|
|
125
|
-
>
|
|
126
|
-
{label}
|
|
127
|
-
</ReqoreButton>
|
|
128
|
-
{onCloseClick && !disabled ? (
|
|
106
|
+
return (
|
|
107
|
+
<StyledTabListItem
|
|
108
|
+
ref={targetRef}
|
|
109
|
+
{...props}
|
|
110
|
+
className={className}
|
|
111
|
+
intent={intent}
|
|
112
|
+
activeIntent={activeIntent}
|
|
113
|
+
activeColor={activeColor}
|
|
114
|
+
as={as}
|
|
115
|
+
size={size}
|
|
116
|
+
active={active}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
vertical={vertical}
|
|
119
|
+
theme={theme}
|
|
120
|
+
fill={fill}
|
|
121
|
+
>
|
|
122
|
+
{label || icon ? (
|
|
123
|
+
<ReqoreControlGroup stack size={size} fluid={fill || vertical}>
|
|
129
124
|
<ReqoreButton
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
icon={
|
|
133
|
-
intent={active ? activeIntent || intent : intent}
|
|
125
|
+
flat={!active && !intent}
|
|
126
|
+
fluid={fill || vertical}
|
|
127
|
+
icon={icon}
|
|
134
128
|
minimal
|
|
135
|
-
|
|
129
|
+
intent={active ? activeIntent || intent : intent}
|
|
130
|
+
active={active}
|
|
131
|
+
disabled={disabled}
|
|
132
|
+
onClick={onClick}
|
|
133
|
+
tooltip={tooltip}
|
|
136
134
|
customTheme={customTheme}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
135
|
+
className={`reqore-tabs-list-item ${active ? 'reqore-tabs-list-item-active' : ''}`}
|
|
136
|
+
>
|
|
137
|
+
{label}
|
|
138
|
+
</ReqoreButton>
|
|
139
|
+
{onCloseClick && !disabled ? (
|
|
140
|
+
<ReqoreButton
|
|
141
|
+
fixed
|
|
142
|
+
flat={!active && !intent}
|
|
143
|
+
icon={closeIcon || 'CloseLine'}
|
|
144
|
+
intent={active ? activeIntent || intent : intent}
|
|
145
|
+
minimal
|
|
146
|
+
active={active}
|
|
147
|
+
className='reqore-tabs-list-item-close'
|
|
148
|
+
customTheme={customTheme}
|
|
149
|
+
onClick={(event) => {
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
onCloseClick?.();
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
) : null}
|
|
155
|
+
</ReqoreControlGroup>
|
|
156
|
+
) : null}
|
|
157
|
+
</StyledTabListItem>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
)
|
|
148
161
|
);
|
|
149
162
|
|
|
150
163
|
export default ReqoreTabsListItem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _size from 'lodash/size';
|
|
2
|
+
import { rgba } from 'polished';
|
|
2
3
|
import React, { forwardRef, useContext } from 'react';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
4
5
|
import { ReqorePopover } from '../..';
|
|
@@ -14,8 +15,14 @@ import ThemeContext from '../../context/ThemeContext';
|
|
|
14
15
|
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
15
16
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
16
17
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
IReqoreDisabled,
|
|
20
|
+
IReqoreIntent,
|
|
21
|
+
IWithReqoreEffect,
|
|
22
|
+
IWithReqoreTooltip,
|
|
23
|
+
} from '../../types/global';
|
|
18
24
|
import { IReqoreIconName } from '../../types/icons';
|
|
25
|
+
import { StyledEffect } from '../Effect';
|
|
19
26
|
import ReqoreIcon from '../Icon';
|
|
20
27
|
|
|
21
28
|
export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
|
|
@@ -26,7 +33,8 @@ export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, I
|
|
|
26
33
|
export interface IReqoreTagProps
|
|
27
34
|
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'>,
|
|
28
35
|
IWithReqoreTooltip,
|
|
29
|
-
IReqoreDisabled
|
|
36
|
+
IReqoreDisabled,
|
|
37
|
+
IWithReqoreEffect {
|
|
30
38
|
size?: TSizes;
|
|
31
39
|
label?: string | number;
|
|
32
40
|
labelKey?: string | number;
|
|
@@ -47,7 +55,7 @@ export interface IReqoreTagStyle extends IReqoreTagProps {
|
|
|
47
55
|
interactive?: boolean;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
|
-
export const StyledTag = styled
|
|
58
|
+
export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
51
59
|
display: inline-flex;
|
|
52
60
|
justify-content: center;
|
|
53
61
|
flex-shrink: 0;
|
|
@@ -55,6 +63,7 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
55
63
|
font-family: system-ui;
|
|
56
64
|
font-weight: 600;
|
|
57
65
|
overflow: hidden;
|
|
66
|
+
vertical-align: middle;
|
|
58
67
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
59
68
|
height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
60
69
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
@@ -67,8 +76,8 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
67
76
|
background-color: ${color || changeLightness(theme.main, 0.1)};
|
|
68
77
|
color: ${color ? getReadableColorFrom(color) : getReadableColor(theme, undefined, undefined)};
|
|
69
78
|
|
|
70
|
-
${
|
|
71
|
-
background-color: ${labelKey ?
|
|
79
|
+
${StyledTagContentWrapper} {
|
|
80
|
+
background-color: ${labelKey ? rgba('#000000', 0.2) : undefined};
|
|
72
81
|
}
|
|
73
82
|
`}
|
|
74
83
|
|
|
@@ -130,14 +139,14 @@ const StyledButtonWrapper = styled.div<IReqoreTagStyle>`
|
|
|
130
139
|
align-items: center;
|
|
131
140
|
transition: all 0.2s ease-out;
|
|
132
141
|
|
|
133
|
-
${({
|
|
142
|
+
${({ color }) =>
|
|
134
143
|
css`
|
|
135
144
|
.reqore-icon {
|
|
136
145
|
transform: scale(0.85);
|
|
137
146
|
}
|
|
138
147
|
&:hover {
|
|
139
148
|
cursor: pointer;
|
|
140
|
-
background-color: ${changeLightness(color
|
|
149
|
+
background-color: ${color ? changeLightness(color, 0.09) : rgba('#000000', 0.2)};
|
|
141
150
|
|
|
142
151
|
.reqore-icon {
|
|
143
152
|
transform: scale(1);
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
IReqoreIntent,
|
|
14
14
|
IReqoreReadOnly,
|
|
15
15
|
IWithReqoreCustomTheme,
|
|
16
|
+
IWithReqoreEffect,
|
|
16
17
|
IWithReqoreTooltip,
|
|
17
18
|
} from '../../types/global';
|
|
19
|
+
import { StyledEffect } from '../Effect';
|
|
18
20
|
import { IReqoreInputStyle } from '../Input';
|
|
19
21
|
import ReqoreInputClearButton from '../InputClearButton';
|
|
20
22
|
|
|
@@ -24,7 +26,8 @@ export interface IReqoreTextareaProps
|
|
|
24
26
|
IReqoreDisabled,
|
|
25
27
|
IWithReqoreCustomTheme,
|
|
26
28
|
IWithReqoreTooltip,
|
|
27
|
-
IReqoreIntent
|
|
29
|
+
IReqoreIntent,
|
|
30
|
+
IWithReqoreEffect {
|
|
28
31
|
autoFocus?: boolean;
|
|
29
32
|
width?: number;
|
|
30
33
|
height?: number;
|
|
@@ -53,7 +56,7 @@ export const StyledTextareaWrapper = styled.div<IReqoreTextareaStyle>`
|
|
|
53
56
|
overflow: hidden;
|
|
54
57
|
`;
|
|
55
58
|
|
|
56
|
-
export const StyledTextarea = styled
|
|
59
|
+
export const StyledTextarea = styled(StyledEffect)<IReqoreTextareaStyle>`
|
|
57
60
|
height: 100%;
|
|
58
61
|
width: 100%;
|
|
59
62
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
@@ -62,15 +65,16 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
|
|
|
62
65
|
resize: none;
|
|
63
66
|
|
|
64
67
|
background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
|
|
65
|
-
minimal ? 'transparent' : rgba(theme.main, 0.
|
|
66
|
-
color: ${({ theme }: IReqoreInputStyle) =>
|
|
68
|
+
minimal ? 'transparent' : rgba(theme.main, 0.1)};
|
|
69
|
+
color: ${({ theme }: IReqoreInputStyle) =>
|
|
70
|
+
getReadableColor(theme, undefined, undefined, true, theme.originalMain)};
|
|
67
71
|
|
|
68
72
|
transition: all 0.2s ease-out;
|
|
69
73
|
|
|
70
74
|
&:active,
|
|
71
75
|
&:focus {
|
|
72
76
|
background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
|
|
73
|
-
minimal ? 'transparent' : rgba(theme.main, 0.
|
|
77
|
+
minimal ? 'transparent' : rgba(theme.main, 0.15)};
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
border-radius: ${({ minimal, rounded, _size }) =>
|
|
@@ -96,12 +100,14 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
|
|
|
96
100
|
|
|
97
101
|
&::placeholder {
|
|
98
102
|
transition: all 0.2s ease-out;
|
|
99
|
-
color: ${({ theme }) =>
|
|
103
|
+
color: ${({ theme }) =>
|
|
104
|
+
rgba(getReadableColor(theme, undefined, undefined, true, theme.originalMain), 0.3)};
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
&:focus {
|
|
103
108
|
&::placeholder {
|
|
104
|
-
color: ${({ theme }) =>
|
|
109
|
+
color: ${({ theme }) =>
|
|
110
|
+
rgba(getReadableColor(theme, undefined, undefined, true, theme.originalMain), 0.5)};
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -146,6 +152,7 @@ const ReqoreInput = forwardRef(
|
|
|
146
152
|
>
|
|
147
153
|
<StyledTextarea
|
|
148
154
|
{...rest}
|
|
155
|
+
as='textarea'
|
|
149
156
|
className={`${className || ''} reqore-control reqore-textarea`}
|
|
150
157
|
_size={size}
|
|
151
158
|
ref={targetRef}
|
|
@@ -30,6 +30,10 @@ export interface ITreeStyle {
|
|
|
30
30
|
theme: IReqoreTheme;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export const StyledTreeLabel = styled(ReqoreMessage)`
|
|
34
|
+
flex-shrink: 1;
|
|
35
|
+
`;
|
|
36
|
+
|
|
33
37
|
export const ReqoreTree = ({
|
|
34
38
|
data,
|
|
35
39
|
mode = 'tree',
|
|
@@ -135,13 +139,13 @@ export const ReqoreTree = ({
|
|
|
135
139
|
}
|
|
136
140
|
/>
|
|
137
141
|
{_showTypes ? <ReqoreTag className='reqore-tree-type' label={dataType} /> : null}
|
|
138
|
-
<
|
|
142
|
+
<StyledTreeLabel
|
|
139
143
|
flat
|
|
140
144
|
onClick={() => onItemClick(data[key], [...path, key])}
|
|
141
145
|
className='reqore-tree-label'
|
|
142
146
|
>
|
|
143
147
|
{JSON.stringify(data[key])}
|
|
144
|
-
</
|
|
148
|
+
</StyledTreeLabel>
|
|
145
149
|
</ReqoreControlGroup>
|
|
146
150
|
)}
|
|
147
151
|
{isExpandable && isObject
|
package/src/constants/sizes.ts
CHANGED
package/src/constants/theme.ts
CHANGED
|
@@ -2,10 +2,8 @@ import { size } from 'lodash';
|
|
|
2
2
|
import React, { useRef, useState } from 'react';
|
|
3
3
|
import { useMedia } from 'react-use';
|
|
4
4
|
import shortid from 'shortid';
|
|
5
|
-
import { ReqoreModal } from '..';
|
|
6
|
-
import ReqoreNotificationsWrapper
|
|
7
|
-
IReqoreNotificationsPosition,
|
|
8
|
-
} from '../components/Notifications';
|
|
5
|
+
import { ReqoreModal, ReqoreTextEffect } from '..';
|
|
6
|
+
import ReqoreNotificationsWrapper from '../components/Notifications';
|
|
9
7
|
import ReqoreNotification, {
|
|
10
8
|
IReqoreNotificationType,
|
|
11
9
|
} from '../components/Notifications/notification';
|
|
@@ -13,6 +11,7 @@ import { TSizes } from '../constants/sizes';
|
|
|
13
11
|
import { TReqoreIntent } from '../constants/theme';
|
|
14
12
|
import ReqoreContext from '../context/ReqoreContext';
|
|
15
13
|
import { IReqoreIconName } from '../types/icons';
|
|
14
|
+
import { IReqoreOptions } from './UIProvider';
|
|
16
15
|
|
|
17
16
|
export interface IReqoreNotificationData {
|
|
18
17
|
title?: string;
|
|
@@ -32,7 +31,7 @@ export interface IReqoreNotificationData {
|
|
|
32
31
|
|
|
33
32
|
export interface IReqoreNotifications {
|
|
34
33
|
children: any;
|
|
35
|
-
|
|
34
|
+
options?: IReqoreOptions;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export interface IReqoreConfirmationModal {
|
|
@@ -48,7 +47,7 @@ export interface IReqoreConfirmationModal {
|
|
|
48
47
|
intent?: TReqoreIntent;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children,
|
|
50
|
+
const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options }) => {
|
|
52
51
|
const [notifications, setNotifications] = useState<IReqoreNotificationData[] | null>([]);
|
|
53
52
|
const [confirmationModal, setConfirmationModal] = useState<IReqoreConfirmationModal>({});
|
|
54
53
|
const latestZIndex = useRef<number>(9000);
|
|
@@ -122,10 +121,11 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, position })
|
|
|
122
121
|
isTablet,
|
|
123
122
|
isMobileOrTablet,
|
|
124
123
|
getAndIncreaseZIndex,
|
|
124
|
+
animations: options?.animations || { buttons: true },
|
|
125
125
|
}}
|
|
126
126
|
>
|
|
127
127
|
{size(notifications) > 0 ? (
|
|
128
|
-
<ReqoreNotificationsWrapper position={
|
|
128
|
+
<ReqoreNotificationsWrapper position={options?.notificationsPosition}>
|
|
129
129
|
{notifications.map((notification) => (
|
|
130
130
|
<ReqoreNotification
|
|
131
131
|
{...notification}
|
|
@@ -159,6 +159,7 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, position })
|
|
|
159
159
|
flat
|
|
160
160
|
opacity={0.9}
|
|
161
161
|
blur={2}
|
|
162
|
+
width='500px'
|
|
162
163
|
intent={confirmationModal.intent}
|
|
163
164
|
label={confirmationModal.title || 'Confirm your action'}
|
|
164
165
|
icon='ErrorWarningFill'
|
|
@@ -184,7 +185,12 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, position })
|
|
|
184
185
|
},
|
|
185
186
|
]}
|
|
186
187
|
>
|
|
187
|
-
|
|
188
|
+
<ReqoreTextEffect
|
|
189
|
+
as='p'
|
|
190
|
+
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
191
|
+
>
|
|
192
|
+
{confirmationModal.description || 'Are you sure you want to proceed?'}
|
|
193
|
+
</ReqoreTextEffect>
|
|
188
194
|
</ReqoreModal>
|
|
189
195
|
</ReqoreContext.Provider>
|
|
190
196
|
</>
|
|
@@ -10,25 +10,25 @@ import { buildTheme } from '../helpers/colors';
|
|
|
10
10
|
import PopoverProvider from './PopoverProvider';
|
|
11
11
|
import ReqoreProvider from './ReqoreProvider';
|
|
12
12
|
|
|
13
|
+
export interface IReqoreOptions {
|
|
14
|
+
withSidebar?: boolean;
|
|
15
|
+
notificationsPosition?: IReqoreNotificationsPosition;
|
|
16
|
+
uiScale?: number;
|
|
17
|
+
animations?: {
|
|
18
|
+
buttons?: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
13
21
|
export interface IReqoreUIProviderProps {
|
|
14
22
|
children: any;
|
|
15
23
|
theme?: Partial<IReqoreTheme>;
|
|
16
|
-
|
|
17
|
-
withSidebar?: boolean;
|
|
18
|
-
uiScale?: number;
|
|
24
|
+
options?: IReqoreOptions;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
const StyledPortal = styled.div`
|
|
22
28
|
z-index: 9999;
|
|
23
29
|
`;
|
|
24
30
|
|
|
25
|
-
const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({
|
|
26
|
-
children,
|
|
27
|
-
theme,
|
|
28
|
-
notificationsPosition,
|
|
29
|
-
withSidebar,
|
|
30
|
-
uiScale,
|
|
31
|
-
}) => {
|
|
31
|
+
const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({ children, theme, options }) => {
|
|
32
32
|
const [modalPortal, setModalPortal] = useState<any>(false);
|
|
33
33
|
|
|
34
34
|
const _theme: Partial<IReqoreTheme> = cloneDeep(theme || {});
|
|
@@ -38,10 +38,10 @@ const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({
|
|
|
38
38
|
return (
|
|
39
39
|
<>
|
|
40
40
|
<ThemeContext.Provider value={{ ...rebuiltTheme }}>
|
|
41
|
-
<ReqoreLayoutWrapper withSidebar={withSidebar}>
|
|
41
|
+
<ReqoreLayoutWrapper withSidebar={options?.withSidebar}>
|
|
42
42
|
{modalPortal ? (
|
|
43
|
-
<ReqoreProvider
|
|
44
|
-
<PopoverProvider uiScale={uiScale}>{children}</PopoverProvider>
|
|
43
|
+
<ReqoreProvider options={options}>
|
|
44
|
+
<PopoverProvider uiScale={options?.uiScale}>{children}</PopoverProvider>
|
|
45
45
|
</ReqoreProvider>
|
|
46
46
|
) : null}
|
|
47
47
|
</ReqoreLayoutWrapper>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import { IReqoreConfirmationModal, IReqoreNotificationData } from '../containers/ReqoreProvider';
|
|
3
|
+
import { IReqoreOptions } from '../containers/UIProvider';
|
|
3
4
|
|
|
4
5
|
export interface IReqoreContext {
|
|
5
6
|
readonly confirmAction: (data: IReqoreConfirmationModal) => void;
|
|
@@ -10,6 +11,7 @@ export interface IReqoreContext {
|
|
|
10
11
|
readonly isTablet?: boolean;
|
|
11
12
|
readonly isMobileOrTablet?: boolean;
|
|
12
13
|
readonly getAndIncreaseZIndex?: () => number;
|
|
14
|
+
readonly animations?: IReqoreOptions['animations'];
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export default createContext<IReqoreContext>({
|
|
@@ -17,4 +19,7 @@ export default createContext<IReqoreContext>({
|
|
|
17
19
|
notifications: null,
|
|
18
20
|
addNotification: null,
|
|
19
21
|
removeNotification: null,
|
|
22
|
+
animations: {
|
|
23
|
+
buttons: true,
|
|
24
|
+
},
|
|
20
25
|
});
|
package/src/helpers/colors.ts
CHANGED
|
@@ -122,7 +122,7 @@ export const mergeThemes = (element: string, theme: IReqoreTheme, customTheme: a
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (element === 'main' && customTheme) {
|
|
125
|
-
merge(clonedTheme, { main: customTheme.main });
|
|
125
|
+
merge(clonedTheme, { main: customTheme.main, originalMain: clonedTheme.main });
|
|
126
126
|
} else {
|
|
127
127
|
merge(clonedTheme, { [element]: customTheme || {} });
|
|
128
128
|
}
|
package/src/index.tsx
CHANGED
|
@@ -12,7 +12,16 @@ export { default as ReqoreControlGroup } from './components/ControlGroup';
|
|
|
12
12
|
export { ReqoreDrawer } from './components/Drawer';
|
|
13
13
|
export { default as ReqoreDropdown } from './components/Dropdown';
|
|
14
14
|
export { ReqoreDropdownDivider, ReqoreDropdownItem } from './components/Dropdown/item';
|
|
15
|
-
export {
|
|
15
|
+
export { ReqoreEffect, ReqoreTextEffect } from './components/Effect';
|
|
16
|
+
export {
|
|
17
|
+
ReqoreH1,
|
|
18
|
+
ReqoreH2,
|
|
19
|
+
ReqoreH3,
|
|
20
|
+
ReqoreH4,
|
|
21
|
+
ReqoreH5,
|
|
22
|
+
ReqoreH6,
|
|
23
|
+
ReqoreHeading,
|
|
24
|
+
} from './components/Header';
|
|
16
25
|
export { default as ReqoreIcon } from './components/Icon';
|
|
17
26
|
export { default as ReqoreInput } from './components/Input';
|
|
18
27
|
export { default as ReqoreLayoutContent } from './components/Layout/content';
|
|
@@ -4,6 +4,7 @@ import { ReqoreH1 } from '../components/Header';
|
|
|
4
4
|
import ReqoreMessage from '../components/Message';
|
|
5
5
|
import { ReqoreP } from '../components/Paragraph';
|
|
6
6
|
import { ReqoreSpacer } from '../components/Spacer';
|
|
7
|
+
import ReqoreTag from '../components/Tag';
|
|
7
8
|
|
|
8
9
|
export default [
|
|
9
10
|
{
|
|
@@ -80,6 +81,15 @@ export default [
|
|
|
80
81
|
content:
|
|
81
82
|
'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',
|
|
82
83
|
expandable: true,
|
|
84
|
+
contentEffect: {
|
|
85
|
+
gradient: {
|
|
86
|
+
colors: { 0: '#3b065e', 100: '#00d3c8' },
|
|
87
|
+
direction: 'to right bottom',
|
|
88
|
+
},
|
|
89
|
+
uppercase: true,
|
|
90
|
+
weight: 'thin',
|
|
91
|
+
spaced: 2,
|
|
92
|
+
},
|
|
83
93
|
expandedContent: (
|
|
84
94
|
<>
|
|
85
95
|
<ReqoreMessage intent='info'>Hello I am a custom content</ReqoreMessage>
|
|
@@ -167,8 +177,51 @@ export default [
|
|
|
167
177
|
},
|
|
168
178
|
{
|
|
169
179
|
label: 'I have intent!',
|
|
170
|
-
content:
|
|
171
|
-
|
|
180
|
+
content: (
|
|
181
|
+
<p>
|
|
182
|
+
'Well would you look at that. Lorem ipsum dolor{' '}
|
|
183
|
+
<ReqoreTag label='dolor' icon='Briefcase3Line' /> <ReqoreTag label='sit amet' />,
|
|
184
|
+
consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
|
|
185
|
+
natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis,
|
|
186
|
+
ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec
|
|
187
|
+
pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
|
|
188
|
+
imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer
|
|
189
|
+
tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.
|
|
190
|
+
Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante,
|
|
191
|
+
dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius
|
|
192
|
+
laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur
|
|
193
|
+
ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget
|
|
194
|
+
condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam
|
|
195
|
+
quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante
|
|
196
|
+
tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam
|
|
197
|
+
sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh.
|
|
198
|
+
Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus
|
|
199
|
+
nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus
|
|
200
|
+
quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras
|
|
201
|
+
ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci
|
|
202
|
+
luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam
|
|
203
|
+
pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis,
|
|
204
|
+
ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget,
|
|
205
|
+
posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc
|
|
206
|
+
nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl
|
|
207
|
+
sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat,
|
|
208
|
+
pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque
|
|
209
|
+
facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non,
|
|
210
|
+
auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae,
|
|
211
|
+
posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis
|
|
212
|
+
vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante
|
|
213
|
+
ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi
|
|
214
|
+
quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus
|
|
215
|
+
consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non,
|
|
216
|
+
nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent
|
|
217
|
+
turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin
|
|
218
|
+
urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis.
|
|
219
|
+
Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat
|
|
220
|
+
nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci
|
|
221
|
+
luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero.
|
|
222
|
+
Phasellus dolor. Maecenas vestibulum mollis'
|
|
223
|
+
</p>
|
|
224
|
+
),
|
|
172
225
|
expandable: true,
|
|
173
226
|
intent: 'info',
|
|
174
227
|
},
|