@qoretechnologies/reqore 0.25.3 → 0.25.5
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__/table.test.tsx +1 -1
- package/__tests__/tree.test.tsx +14 -19
- package/dist/components/Collection/item.d.ts +1 -1
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +7 -7
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +35 -21
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +26 -9
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -0
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +19 -11
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +2 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +11 -8
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +9 -8
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts +4 -2
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +26 -48
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +8 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +9 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +2 -0
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +4 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +36 -23
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useTooltip.js +1 -1
- package/dist/hooks/useTooltip.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Collection/item.tsx +3 -2
- package/src/components/InternalPopover/index.tsx +33 -7
- package/src/components/Message/index.tsx +18 -7
- package/src/components/Notifications/notification.tsx +11 -2
- package/src/components/Panel/index.tsx +22 -4
- package/src/components/Tag/index.tsx +23 -27
- package/src/components/Tree/index.tsx +95 -102
- package/src/constants/sizes.ts +9 -0
- package/src/containers/PopoverProvider.tsx +2 -0
- package/src/hooks/usePopover.tsx +20 -2
- package/src/hooks/useTooltip.ts +1 -1
- package/src/mock/collectionData.tsx +2 -0
- package/src/stories/Input/Input.stories.tsx +1 -1
- package/src/stories/Message/Message.stories.tsx +7 -0
- package/src/stories/Panel/Panel.stories.tsx +2 -1
- package/src/stories/Popover/Popover.stories.tsx +85 -16
- package/src/stories/Tag/Tag.stories.tsx +7 -4
- package/src/stories/Tree/Tree.stories.tsx +7 -1
- package/tests.json +1 -1
package/dist/hooks/usePopover.js
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
26
|
};
|
|
@@ -20,7 +42,7 @@ var endEvents = {
|
|
|
20
42
|
focus: null
|
|
21
43
|
};
|
|
22
44
|
var usePopover = function (_a) {
|
|
23
|
-
var targetElement = _a.targetElement, content = _a.content, _b = _a.handler, handler = _b === void 0 ? 'hover' : _b, placement = _a.placement, _c = _a.show, show = _c === void 0 ? true : _c, noArrow = _a.noArrow, useTargetWidth = _a.useTargetWidth, _d = _a.closeOnOutsideClick, closeOnOutsideClick = _d === void 0 ? true : _d, _e = _a.openOnMount, openOnMount = _e === void 0 ? false : _e, delay = _a.delay;
|
|
45
|
+
var targetElement = _a.targetElement, content = _a.content, _b = _a.handler, handler = _b === void 0 ? 'hover' : _b, placement = _a.placement, _c = _a.show, show = _c === void 0 ? true : _c, noArrow = _a.noArrow, useTargetWidth = _a.useTargetWidth, _d = _a.closeOnOutsideClick, closeOnOutsideClick = _d === void 0 ? true : _d, _e = _a.openOnMount, openOnMount = _e === void 0 ? false : _e, delay = _a.delay, rest = __rest(_a, ["targetElement", "content", "handler", "placement", "show", "noArrow", "useTargetWidth", "closeOnOutsideClick", "openOnMount", "delay"]);
|
|
24
46
|
var _f = (0, react_1.useContext)(PopoverContext_1["default"]), addPopover = _f.addPopover, removePopover = _f.removePopover, updatePopover = _f.updatePopover, popovers = _f.popovers;
|
|
25
47
|
var current = (0, react_1.useRef)(shortid_1["default"].generate()).current;
|
|
26
48
|
var timeout = (0, react_1.useRef)(0).current;
|
|
@@ -29,24 +51,25 @@ var usePopover = function (_a) {
|
|
|
29
51
|
var currentPopover = (0, react_1.useMemo)(function () { return popovers === null || popovers === void 0 ? void 0 : popovers.find(function (p) { return p.id === current; }); }, [popovers, current]);
|
|
30
52
|
var _addPopover = function () {
|
|
31
53
|
if (currentPopover) {
|
|
32
|
-
|
|
54
|
+
if (handler !== 'hoverStay') {
|
|
55
|
+
_removePopover === null || _removePopover === void 0 ? void 0 : _removePopover();
|
|
56
|
+
}
|
|
33
57
|
}
|
|
34
58
|
else if (show) {
|
|
35
59
|
timeout = setTimeout(function () {
|
|
36
|
-
addPopover === null || addPopover === void 0 ? void 0 : addPopover({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
targetElement
|
|
40
|
-
|
|
41
|
-
noArrow: noArrow,
|
|
42
|
-
useTargetWidth: useTargetWidth,
|
|
43
|
-
closeOnOutsideClick: closeOnOutsideClick,
|
|
44
|
-
closeOnAnyClick: handler === 'hover' || handler === 'hoverStay'
|
|
45
|
-
});
|
|
60
|
+
addPopover === null || addPopover === void 0 ? void 0 : addPopover(__assign({ id: current, content: content, targetElement: targetElement, placement: placement, noArrow: noArrow, useTargetWidth: useTargetWidth, closeOnOutsideClick: closeOnOutsideClick, closeOnAnyClick: handler === 'hover' || handler === 'hoverStay' }, rest));
|
|
61
|
+
if ((rest === null || rest === void 0 ? void 0 : rest.blur) > 0) {
|
|
62
|
+
targetElement.style.position = 'relative';
|
|
63
|
+
targetElement.style.zIndex = '999999';
|
|
64
|
+
}
|
|
46
65
|
}, delay || 0);
|
|
47
66
|
}
|
|
48
67
|
};
|
|
49
68
|
var _removePopover = function () {
|
|
69
|
+
if ((rest === null || rest === void 0 ? void 0 : rest.blur) > 0) {
|
|
70
|
+
targetElement.style.position = 'initial';
|
|
71
|
+
targetElement.style.zIndex = 'initial';
|
|
72
|
+
}
|
|
50
73
|
cancelTimeout();
|
|
51
74
|
removePopover === null || removePopover === void 0 ? void 0 : removePopover(current);
|
|
52
75
|
};
|
|
@@ -56,16 +79,7 @@ var usePopover = function (_a) {
|
|
|
56
79
|
};
|
|
57
80
|
(0, react_use_1.useUpdateEffect)(function () {
|
|
58
81
|
if (content && show) {
|
|
59
|
-
updatePopover === null || updatePopover === void 0 ? void 0 : updatePopover(current, {
|
|
60
|
-
id: current,
|
|
61
|
-
content: content,
|
|
62
|
-
targetElement: targetElement,
|
|
63
|
-
placement: placement,
|
|
64
|
-
noArrow: noArrow,
|
|
65
|
-
useTargetWidth: useTargetWidth,
|
|
66
|
-
closeOnOutsideClick: closeOnOutsideClick,
|
|
67
|
-
closeOnAnyClick: handler === 'hover' || handler === 'hoverStay'
|
|
68
|
-
});
|
|
82
|
+
updatePopover === null || updatePopover === void 0 ? void 0 : updatePopover(current, __assign({ id: current, content: content, targetElement: targetElement, placement: placement, noArrow: noArrow, useTargetWidth: useTargetWidth, closeOnOutsideClick: closeOnOutsideClick, closeOnAnyClick: handler === 'hover' || handler === 'hoverStay' }, rest));
|
|
69
83
|
}
|
|
70
84
|
}, [content === null || content === void 0 ? void 0 : content.toString()]);
|
|
71
85
|
(0, react_1.useEffect)(function () {
|
|
@@ -97,7 +111,6 @@ var usePopover = function (_a) {
|
|
|
97
111
|
};
|
|
98
112
|
}, [targetElement === null || targetElement === void 0 ? void 0 : targetElement.toString(), content === null || content === void 0 ? void 0 : content.toString(), current, currentPopover]);
|
|
99
113
|
(0, react_use_1.useUnmount)(function () {
|
|
100
|
-
console.log('UNMOUNTING POPOVER', content);
|
|
101
114
|
cancelTimeout();
|
|
102
115
|
});
|
|
103
116
|
return current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopover.js","sourceRoot":"","sources":["../../src/hooks/usePopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePopover.js","sourceRoot":"","sources":["../../src/hooks/usePopover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAAiF;AACjF,uCAAwD;AACxD,oDAA8B;AAC9B,6EAAuD;AAEvD,IAAM,WAAW,GAAG;IAClB,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,YA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AC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,EAAE,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAE9E,IAAA,sBAAU,EAAC;QACT,aAAa,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,qBAAe,UAAU,CAAC"}
|
package/dist/hooks/useTooltip.js
CHANGED
|
@@ -25,7 +25,7 @@ var useTooltip = function (targetElement, tooltip) {
|
|
|
25
25
|
setElement(targetElement);
|
|
26
26
|
setData(tooltip);
|
|
27
27
|
}
|
|
28
|
-
}, [targetElement === null || targetElement === void 0 ? void 0 : targetElement.toString(),
|
|
28
|
+
}, [targetElement === null || targetElement === void 0 ? void 0 : targetElement.toString(), tooltip === null || tooltip === void 0 ? void 0 : tooltip.toString()]);
|
|
29
29
|
var popoverData = typeof data === 'string' ? { content: data } : data;
|
|
30
30
|
(0, usePopover_1["default"])(__assign(__assign({}, popoverData), { targetElement: element, show: !!(popoverData === null || popoverData === void 0 ? void 0 : popoverData.content) }));
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","sourceRoot":"","sources":["../../src/hooks/useTooltip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA4C;AAE5C,4DAAsC;AAE/B,IAAM,UAAU,GAAG,UACxB,aAAsC,EACtC,OAA4B;IAEtB,IAAA,KAAwB,IAAA,gBAAQ,EAA0B,SAAS,CAAC,EAAnE,OAAO,QAAA,EAAE,UAAU,QAAgD,CAAC;IACrE,IAAA,KAAkB,IAAA,gBAAQ,EAAsC,SAAS,CAAC,EAAzE,IAAI,QAAA,EAAE,OAAO,QAA4D,CAAC;IAEjF,IAAA,iBAAS,EAAC;QACR,IAAI,aAAa,IAAI,OAAO,EAAE;YAC5B,UAAU,CAAC,aAAa,CAAC,CAAC;YAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"useTooltip.js","sourceRoot":"","sources":["../../src/hooks/useTooltip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA4C;AAE5C,4DAAsC;AAE/B,IAAM,UAAU,GAAG,UACxB,aAAsC,EACtC,OAA4B;IAEtB,IAAA,KAAwB,IAAA,gBAAQ,EAA0B,SAAS,CAAC,EAAnE,OAAO,QAAA,EAAE,UAAU,QAAgD,CAAC;IACrE,IAAA,KAAkB,IAAA,gBAAQ,EAAsC,SAAS,CAAC,EAAzE,IAAI,QAAA,EAAE,OAAO,QAA4D,CAAC;IAEjF,IAAA,iBAAS,EAAC;QACR,IAAI,aAAa,IAAI,OAAO,EAAE;YAC5B,UAAU,CAAC,aAAa,CAAC,CAAC;YAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,EAAE,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAErD,IAAM,WAAW,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAExE,IAAA,uBAAU,wBACL,WAAW,KACd,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,CAAC,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAA,IAC5B,CAAC;AACL,CAAC,CAAC;AArBW,QAAA,UAAU,cAqBrB"}
|
package/package.json
CHANGED
|
@@ -69,6 +69,7 @@ export const StyledCollectionItemContent = styled.div`
|
|
|
69
69
|
export const ReqoreCollectionItem = ({
|
|
70
70
|
flat = true,
|
|
71
71
|
minimal = true,
|
|
72
|
+
headerSize = 3,
|
|
72
73
|
style,
|
|
73
74
|
content,
|
|
74
75
|
actions,
|
|
@@ -195,11 +196,11 @@ export const ReqoreCollectionItem = ({
|
|
|
195
196
|
</>
|
|
196
197
|
)}
|
|
197
198
|
<ReqorePanel
|
|
198
|
-
{...rest}
|
|
199
199
|
flat={flat}
|
|
200
|
-
headerSize={
|
|
200
|
+
headerSize={headerSize}
|
|
201
201
|
ref={ref}
|
|
202
202
|
minimal={minimal}
|
|
203
|
+
{...rest}
|
|
203
204
|
bottomActions={isSelected ? expandedActions : undefined}
|
|
204
205
|
style={{
|
|
205
206
|
...style,
|
|
@@ -8,6 +8,7 @@ import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
|
8
8
|
import PopoverContext from '../../context/PopoverContext';
|
|
9
9
|
import { fadeIn } from '../../helpers/animations';
|
|
10
10
|
import { getReadableColor } from '../../helpers/colors';
|
|
11
|
+
import { StyledBackdrop } from '../Drawer';
|
|
11
12
|
|
|
12
13
|
const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
|
|
13
14
|
width: 10px;
|
|
@@ -23,19 +24,28 @@ const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
|
|
|
23
24
|
position: absolute;
|
|
24
25
|
z-index: -1;
|
|
25
26
|
transform: rotate(45deg);
|
|
26
|
-
${({ theme }) => css`
|
|
27
|
+
${({ theme, opaque }) => css`
|
|
27
28
|
background-color: ${theme.popover?.main || theme.main};
|
|
28
|
-
box-shadow: rgba(31, 26, 34, 0.6) 0px 0px 4px;
|
|
29
|
+
box-shadow: ${opaque ? undefined : 'rgba(31, 26, 34, 0.6) 0px 0px 4px'};
|
|
29
30
|
`}
|
|
30
31
|
}
|
|
31
32
|
`;
|
|
32
33
|
|
|
33
34
|
const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
34
35
|
animation: 0.2s ${fadeIn} ease-out;
|
|
36
|
+
max-width: ${({ maxWidth = '80vw' }) => maxWidth};
|
|
37
|
+
max-height: ${({ maxHeight = '80vh' }) => maxHeight};
|
|
35
38
|
|
|
36
|
-
${({ theme }) => {
|
|
39
|
+
${({ theme, opaque }) => {
|
|
37
40
|
const defaultColor: string = theme.popover?.main || theme.main;
|
|
38
41
|
|
|
42
|
+
if (opaque) {
|
|
43
|
+
return css`
|
|
44
|
+
z-index: 999999;
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
return css`
|
|
40
50
|
z-index: 999999;
|
|
41
51
|
background-color: ${defaultColor};
|
|
@@ -74,8 +84,9 @@ const StyledPopoverContent = styled.div<{ isString?: boolean }>`
|
|
|
74
84
|
z-index: 20;
|
|
75
85
|
position: relative;
|
|
76
86
|
overflow: hidden;
|
|
77
|
-
background-color: ${({ theme }) =>
|
|
78
|
-
|
|
87
|
+
background-color: ${({ theme, opaque }) =>
|
|
88
|
+
opaque ? 'transparent' : theme.popover?.main || theme.main};
|
|
89
|
+
border-radius: ${({ opaque }) => (opaque ? undefined : '3.5px')};
|
|
79
90
|
|
|
80
91
|
.reqore-popover-text {
|
|
81
92
|
font-size: 14px;
|
|
@@ -91,6 +102,10 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
91
102
|
placement,
|
|
92
103
|
noArrow,
|
|
93
104
|
useTargetWidth,
|
|
105
|
+
opaque,
|
|
106
|
+
maxWidth,
|
|
107
|
+
maxHeight,
|
|
108
|
+
blur,
|
|
94
109
|
}) => {
|
|
95
110
|
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
96
111
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -118,6 +133,8 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
118
133
|
],
|
|
119
134
|
});
|
|
120
135
|
|
|
136
|
+
console.log(opaque);
|
|
137
|
+
|
|
121
138
|
useEffect(() => {
|
|
122
139
|
if (popperRef.current) {
|
|
123
140
|
updatePopover?.(id, { popperRef });
|
|
@@ -145,7 +162,11 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
145
162
|
|
|
146
163
|
return (
|
|
147
164
|
<ReqoreThemeProvider>
|
|
165
|
+
{blur > 0 ? <StyledBackdrop zIndex={999998} blur={blur} closable /> : null}
|
|
148
166
|
<StyledPopoverWrapper
|
|
167
|
+
maxWidth={maxWidth}
|
|
168
|
+
maxHeight={maxHeight}
|
|
169
|
+
opaque={opaque}
|
|
149
170
|
className='reqore-popover-content'
|
|
150
171
|
ref={(el) => {
|
|
151
172
|
setPopperElement(el);
|
|
@@ -159,9 +180,14 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
159
180
|
{...attributes.popper}
|
|
160
181
|
>
|
|
161
182
|
{!noArrow && (
|
|
162
|
-
<StyledPopoverArrow
|
|
183
|
+
<StyledPopoverArrow
|
|
184
|
+
opaque={opaque}
|
|
185
|
+
ref={setArrowElement}
|
|
186
|
+
style={styles.arrow}
|
|
187
|
+
data-popper-arrow
|
|
188
|
+
/>
|
|
163
189
|
)}
|
|
164
|
-
<StyledPopoverContent isString={isString(content)}>
|
|
190
|
+
<StyledPopoverContent isString={isString(content)} opaque={opaque}>
|
|
165
191
|
{isString(content) ? (
|
|
166
192
|
<span className='reqore-popover-text'>{content}</span>
|
|
167
193
|
) : (
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { useMount, useUnmount } from 'react-use';
|
|
3
3
|
import { TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
4
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
5
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
|
+
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
7
|
+
import { IWithReqoreCustomTheme } from '../../types/global';
|
|
6
8
|
import { IReqoreIconName } from '../../types/icons';
|
|
7
9
|
import ReqoreIcon from '../Icon';
|
|
8
10
|
import {
|
|
@@ -14,7 +16,9 @@ import {
|
|
|
14
16
|
typeToIcon,
|
|
15
17
|
} from '../Notifications/notification';
|
|
16
18
|
|
|
17
|
-
export interface IReqoreMessageProps
|
|
19
|
+
export interface IReqoreMessageProps
|
|
20
|
+
extends IWithReqoreCustomTheme,
|
|
21
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
18
22
|
intent?: TReqoreIntent;
|
|
19
23
|
title?: string;
|
|
20
24
|
children: any;
|
|
@@ -48,10 +52,13 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
|
|
|
48
52
|
flat,
|
|
49
53
|
inverted,
|
|
50
54
|
size = 'normal',
|
|
55
|
+
customTheme,
|
|
56
|
+
...rest
|
|
51
57
|
},
|
|
52
58
|
ref: any
|
|
53
59
|
) => {
|
|
54
60
|
const [internalTimeout, setInternalTimeout] = useState<NodeJS.Timeout | null>(null);
|
|
61
|
+
const theme = useReqoreTheme('main', customTheme, intent);
|
|
55
62
|
|
|
56
63
|
useMount(() => {
|
|
57
64
|
if (duration) {
|
|
@@ -88,6 +95,7 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
|
|
|
88
95
|
return (
|
|
89
96
|
<ReqoreThemeProvider>
|
|
90
97
|
<StyledReqoreNotification
|
|
98
|
+
{...rest}
|
|
91
99
|
key={`${duration}${intent}${title}${children}`}
|
|
92
100
|
intent={intent}
|
|
93
101
|
timeout={duration}
|
|
@@ -95,13 +103,15 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
|
|
|
95
103
|
onClick={onClick}
|
|
96
104
|
flat={flat}
|
|
97
105
|
inverted={inverted}
|
|
106
|
+
asMessage
|
|
98
107
|
fluid
|
|
99
|
-
className='reqore-message
|
|
108
|
+
className={`${rest?.className || ''} reqore-message`}
|
|
100
109
|
ref={ref}
|
|
101
110
|
size={size}
|
|
111
|
+
theme={theme}
|
|
102
112
|
>
|
|
103
113
|
{leftIcon ? (
|
|
104
|
-
<StyledIconWrapper intent={intent} size={size}>
|
|
114
|
+
<StyledIconWrapper intent={intent} size={size} theme={theme}>
|
|
105
115
|
<ReqoreIcon
|
|
106
116
|
icon={leftIcon}
|
|
107
117
|
margin={flat && inverted ? undefined : 'left'}
|
|
@@ -109,12 +119,13 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
|
|
|
109
119
|
/>
|
|
110
120
|
</StyledIconWrapper>
|
|
111
121
|
) : null}
|
|
112
|
-
<StyledNotificationContentWrapper size={size}>
|
|
113
|
-
{title && <StyledNotificationTitle>{title}</StyledNotificationTitle>}
|
|
114
|
-
<StyledNotificationContent>{children}</StyledNotificationContent>
|
|
122
|
+
<StyledNotificationContentWrapper size={size} theme={theme}>
|
|
123
|
+
{title && <StyledNotificationTitle theme={theme}>{title}</StyledNotificationTitle>}
|
|
124
|
+
<StyledNotificationContent theme={theme}>{children}</StyledNotificationContent>
|
|
115
125
|
</StyledNotificationContentWrapper>
|
|
116
126
|
{onClose && (
|
|
117
127
|
<StyledIconWrapper
|
|
128
|
+
theme={theme}
|
|
118
129
|
size={size}
|
|
119
130
|
intent={intent}
|
|
120
131
|
clickable
|
|
@@ -46,6 +46,7 @@ export interface IReqoreNotificationStyle {
|
|
|
46
46
|
flat?: boolean;
|
|
47
47
|
inverted?: boolean;
|
|
48
48
|
size?: TSizes;
|
|
49
|
+
asMessage?: boolean;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const timeoutAnimation = keyframes`
|
|
@@ -67,11 +68,19 @@ export const StyledReqoreNotification = styled(animated.div)<IReqoreNotification
|
|
|
67
68
|
overflow: auto;
|
|
68
69
|
position: relative;
|
|
69
70
|
transition: all 0.2s ease-out;
|
|
70
|
-
|
|
71
|
+
|
|
72
|
+
// Do not fade in the component if it's a message
|
|
73
|
+
${({ asMessage }) =>
|
|
74
|
+
asMessage
|
|
75
|
+
? undefined
|
|
76
|
+
: css`
|
|
77
|
+
animation: 0.2s ${fadeIn} ease-in;
|
|
78
|
+
`};
|
|
79
|
+
|
|
71
80
|
font-size: ${({ size = 'normal' }) => TEXT_FROM_SIZE[size]}px;
|
|
72
81
|
|
|
73
82
|
&:not(:first-child) {
|
|
74
|
-
margin-top: 10px;
|
|
83
|
+
margin-top: ${({ asMessage }) => (asMessage ? undefined : `10px`)};
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
${({
|
|
@@ -3,7 +3,12 @@ import { rgba } from 'polished';
|
|
|
3
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
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ICON_FROM_HEADER_SIZE,
|
|
8
|
+
RADIUS_FROM_SIZE,
|
|
9
|
+
TEXT_FROM_SIZE,
|
|
10
|
+
TSizes,
|
|
11
|
+
} from '../../constants/sizes';
|
|
7
12
|
import { IReqoreTheme } from '../../constants/theme';
|
|
8
13
|
import {
|
|
9
14
|
changeDarkness,
|
|
@@ -68,6 +73,7 @@ export interface IReqorePanelProps
|
|
|
68
73
|
blur?: number;
|
|
69
74
|
minimal?: boolean;
|
|
70
75
|
headerSize?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
76
|
+
contentSize?: TSizes;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -96,7 +102,10 @@ export const StyledPanel = styled.div<IStyledPanel>`
|
|
|
96
102
|
cursor: pointer;
|
|
97
103
|
|
|
98
104
|
&:hover {
|
|
99
|
-
background-color: ${rgba(
|
|
105
|
+
background-color: ${rgba(
|
|
106
|
+
changeDarkness(getMainBackgroundColor(theme), 0.06),
|
|
107
|
+
opacity === 0 ? 0.2 : opacity
|
|
108
|
+
)};
|
|
100
109
|
|
|
101
110
|
${StyledCollectionItemContent}:after {
|
|
102
111
|
background: linear-gradient(
|
|
@@ -157,12 +166,13 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
|
157
166
|
export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
158
167
|
display: ${({ isCollapsed }) => (isCollapsed ? 'none' : undefined)};
|
|
159
168
|
min-height: ${({ isCollapsed }) => (isCollapsed ? undefined : '40px')};
|
|
160
|
-
padding: ${({ padded }) => (!padded ? undefined :
|
|
169
|
+
padding: ${({ padded, contentSize }) => (!padded ? undefined : TEXT_FROM_SIZE[contentSize])}px;
|
|
161
170
|
// The padding is not needed when the panel is minimal and has title, since
|
|
162
171
|
// the title already has padding and is transparent
|
|
163
172
|
padding-top: ${({ minimal, hasLabel }) => (minimal && hasLabel ? '0px' : undefined)};
|
|
164
173
|
flex: 1;
|
|
165
174
|
overflow: auto;
|
|
175
|
+
font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
|
|
166
176
|
`;
|
|
167
177
|
|
|
168
178
|
export const StyledPanelTitleLabel = styled.span`
|
|
@@ -205,6 +215,7 @@ export const ReqorePanel = forwardRef(
|
|
|
205
215
|
padded = true,
|
|
206
216
|
contentStyle,
|
|
207
217
|
headerSize = 4,
|
|
218
|
+
contentSize = 'normal',
|
|
208
219
|
minimal,
|
|
209
220
|
tooltip,
|
|
210
221
|
...rest
|
|
@@ -344,7 +355,13 @@ export const ReqorePanel = forwardRef(
|
|
|
344
355
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
345
356
|
>
|
|
346
357
|
<StyledPanelTitleHeader>
|
|
347
|
-
{icon &&
|
|
358
|
+
{icon && (
|
|
359
|
+
<ReqoreIcon
|
|
360
|
+
size={`${ICON_FROM_HEADER_SIZE[headerSize]}px`}
|
|
361
|
+
icon={icon}
|
|
362
|
+
margin='right'
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
348
365
|
{typeof label === 'string' ? (
|
|
349
366
|
<StyledPanelTitleLabel as={HTMLheaderElement}>{label}</StyledPanelTitleLabel>
|
|
350
367
|
) : (
|
|
@@ -382,6 +399,7 @@ export const ReqorePanel = forwardRef(
|
|
|
382
399
|
style={contentStyle}
|
|
383
400
|
padded={padded}
|
|
384
401
|
minimal={minimal}
|
|
402
|
+
contentSize={contentSize}
|
|
385
403
|
>
|
|
386
404
|
{children}
|
|
387
405
|
</StyledPanelContent>
|
|
@@ -67,15 +67,7 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
67
67
|
background-color: ${color || changeLightness(theme.main, 0.1)};
|
|
68
68
|
color: ${color ? getReadableColorFrom(color) : getReadableColor(theme, undefined, undefined)};
|
|
69
69
|
|
|
70
|
-
${StyledTagContentWrapper} {
|
|
71
|
-
background-color: ${labelKey ? changeLightness(color || theme.main, 0.05) : undefined};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
${StyledTagContent} {
|
|
75
|
-
background-color: ${labelKey ? changeLightness(color || theme.main, 0.1) : undefined};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
${StyledTagContentKey} {
|
|
70
|
+
${StyledTagContentKey}, ${StyledTagContentWrapper} {
|
|
79
71
|
background-color: ${labelKey ? changeLightness(color || theme.main, 0.05) : undefined};
|
|
80
72
|
}
|
|
81
73
|
`}
|
|
@@ -102,6 +94,8 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
102
94
|
`}
|
|
103
95
|
`;
|
|
104
96
|
|
|
97
|
+
const StyledTagRightIcon = styled(ReqoreIcon)``;
|
|
98
|
+
|
|
105
99
|
const StyledTagContentWrapper = styled.div<{ size: TSizes }>`
|
|
106
100
|
display: flex;
|
|
107
101
|
align-items: center;
|
|
@@ -192,24 +186,26 @@ const ReqoreTag = forwardRef(
|
|
|
192
186
|
removable={!!onRemoveClick}
|
|
193
187
|
interactive={!!onClick && !rest.disabled}
|
|
194
188
|
>
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
189
|
+
{icon || labelKey ? (
|
|
190
|
+
<StyledTagContentWrapper size={size} className='reqore-tag-content' onClick={onClick}>
|
|
191
|
+
{icon && (
|
|
192
|
+
<ReqoreIcon
|
|
193
|
+
icon={icon}
|
|
194
|
+
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
195
|
+
margin={label ? 'left' : 'both'}
|
|
196
|
+
/>
|
|
197
|
+
)}
|
|
198
|
+
{labelKey && <StyledTagContentKey size={size}>{labelKey}</StyledTagContentKey>}
|
|
199
|
+
</StyledTagContentWrapper>
|
|
200
|
+
) : null}
|
|
201
|
+
{label && <StyledTagContent size={size}>{label}</StyledTagContent>}
|
|
202
|
+
{rightIcon && (
|
|
203
|
+
<StyledTagRightIcon
|
|
204
|
+
icon={rightIcon}
|
|
205
|
+
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
206
|
+
margin={label || icon ? 'right' : 'both'}
|
|
207
|
+
/>
|
|
208
|
+
)}
|
|
213
209
|
{_size(actions)
|
|
214
210
|
? actions.map((action) => (
|
|
215
211
|
<>
|