@stack-spot/portal-components 2.14.0 → 2.15.0
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/CHANGELOG.md +19 -0
- package/dist/components/FadingOverflow.d.ts +38 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -0
- package/dist/components/FadingOverflow.js +226 -0
- package/dist/components/FadingOverflow.js.map +1 -0
- package/dist/components/notification/NotificationItem.d.ts.map +1 -1
- package/dist/components/notification/NotificationItem.js +5 -7
- package/dist/components/notification/NotificationItem.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/FadingOverflow.tsx +263 -0
- package/src/components/notification/NotificationItem.tsx +8 -7
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.15.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.14.1...portal-components@v2.15.0) (2025-02-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* adds component FadingOverflow ([#760](https://github.com/stack-spot/portal-commons/issues/760)) ([c70834d](https://github.com/stack-spot/portal-commons/commit/c70834dc836e3c0ec87cf160c694ba730a11a4a7))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* re-exports FadingOverflow in package.json ([#762](https://github.com/stack-spot/portal-commons/issues/762)) ([c647054](https://github.com/stack-spot/portal-commons/commit/c6470548bbf7ad09e44fd45498c5d5f3abd3abc4))
|
|
14
|
+
|
|
15
|
+
## [2.14.1](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.14.0...portal-components@v2.14.1) (2025-02-10)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Fix text notification when markdown ([#716](https://github.com/stack-spot/portal-commons/issues/716)) ([92196ab](https://github.com/stack-spot/portal-commons/commit/92196ab463d34b65d0b4952baa4720ff54181b45))
|
|
21
|
+
|
|
3
22
|
## [2.14.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.13.0...portal-components@v2.14.0) (2025-02-10)
|
|
4
23
|
|
|
5
24
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WithStyle } from '@stack-spot/portal-theme';
|
|
3
|
+
type Side = 'top' | 'right' | 'left' | 'bottom';
|
|
4
|
+
type ScrollType = 'none' | 'wheel' | 'bar' | 'arrows';
|
|
5
|
+
interface Props extends WithStyle {
|
|
6
|
+
/**
|
|
7
|
+
* How to scroll the content.
|
|
8
|
+
* - none: overflow is hidden. No scrolling.
|
|
9
|
+
* - wheel: the content is solely scrollable through the mouse wheel and keyboard arrows, no scroll bars are rendered.
|
|
10
|
+
* - bar: this is the normal browser scroll. The content will be scrollable through the mouse wheel, keyboard and scrollbar.
|
|
11
|
+
* - arrows: arrows will be placed in the far edges of the sides that must be scrolled. The content is scrolled through the mouse wheel,
|
|
12
|
+
* keyboard and these arrows. Hovering an arrow slowly scrolls the content, clicking the arrow fully scrolls the content in its direction.
|
|
13
|
+
* There are no scrollbars in this scenario.
|
|
14
|
+
* @default 'none'
|
|
15
|
+
*/
|
|
16
|
+
scroll?: ScrollType;
|
|
17
|
+
/**
|
|
18
|
+
* If true, a horizontal scroll can be performed by using the vertical mouse wheel.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
enableHorizontalScrollWithVerticalWheel?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Which sides to fade when the content overflows.
|
|
24
|
+
*
|
|
25
|
+
* Important: it seems the current solution doesn't support mixing vertical and horizontal scrolls. I'm not sure if this is possible, I
|
|
26
|
+
* believed combining linear gradients would work, but it doesn't.
|
|
27
|
+
*/
|
|
28
|
+
sides?: Side[];
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This component applies a fading graphical effect to its content if it overflows in any of the sides specified by the props.
|
|
33
|
+
*
|
|
34
|
+
* This also controls how this overflow is scrolled, introducing a new scrolling technique, which applies arrows to the overflowing side.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FadingOverflow: ({ children, scroll, sides, enableHorizontalScrollWithVerticalWheel, className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=FadingOverflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadingOverflow.d.ts","sourceRoot":"","sources":["../../src/components/FadingOverflow.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKxE,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAC/C,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;AAErD,UAAU,KAAM,SAAQ,SAAS;IAC/B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,uCAAuC,CAAC,EAAE,OAAO,CAAC;IAClD;;;;;OAKG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAwFD;;;;GAIG;AACH,eAAO,MAAM,cAAc,8FAC2E,KAAK,4CAqI1G,CAAA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconBox } from '@citric/core';
|
|
3
|
+
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from '@citric/icons';
|
|
4
|
+
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
5
|
+
import { debounce } from 'lodash';
|
|
6
|
+
import { useEffect, useRef } from 'react';
|
|
7
|
+
import { styled } from 'styled-components';
|
|
8
|
+
// Scrolling can be very fast, this sets a lower limit for us to run listeners without impacting performance.
|
|
9
|
+
const MIN_CHECK_INTERVAL_MS = 20;
|
|
10
|
+
// The interval which to scroll the content when a scroll arrow is hovered.
|
|
11
|
+
const SCROLL_INTERVAL_MS = 20;
|
|
12
|
+
// This sets the speed of the scroll when the user hovers a scroll arrow.
|
|
13
|
+
const SCROLL_PX = 4;
|
|
14
|
+
// Fade masks
|
|
15
|
+
const masks = {
|
|
16
|
+
right: 'linear-gradient(to left, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
17
|
+
left: 'linear-gradient(to right, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
18
|
+
top: 'linear-gradient(to bottom, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
19
|
+
bottom: 'linear-gradient(to top, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
20
|
+
horizontal: 'linear-gradient(to left, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgb(0, 0, 0) max(70%, calc(100% - 100px)), rgba(0, 0, 0, 0) 100%)',
|
|
21
|
+
vertical: 'linear-gradient(to top, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgb(0, 0, 0) max(70%, calc(100% - 100px)), rgba(0, 0, 0, 0) 100%)',
|
|
22
|
+
};
|
|
23
|
+
const OverflowBox = styled.div `
|
|
24
|
+
&.hidden-scroll-bars::-webkit-scrollbar, &.scroll-arrows ::-webkit-scrollbar {
|
|
25
|
+
width: 0;
|
|
26
|
+
height: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.scroll-arrows {
|
|
30
|
+
position: relative;
|
|
31
|
+
|
|
32
|
+
> .content {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.scroll-to-left, .scroll-to-right, .scroll-to-top, .scroll-to-bottom {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
width: 30px;
|
|
44
|
+
height: 30px;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
opacity: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
transition: opacity 0.3s;
|
|
51
|
+
|
|
52
|
+
${IconBox} {
|
|
53
|
+
background-color: ${theme.color.light[300]};
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
width: 16px;
|
|
56
|
+
height: 16px;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.visible {
|
|
63
|
+
opacity: 0.6;
|
|
64
|
+
pointer-events: auto;
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.scroll-to-left {
|
|
73
|
+
right: unset;
|
|
74
|
+
height: unset;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.scroll-to-right {
|
|
78
|
+
left: unset;
|
|
79
|
+
height: unset;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.scroll-to-top {
|
|
83
|
+
bottom: unset;
|
|
84
|
+
width: unset;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.scroll-to-bottom {
|
|
88
|
+
top: unset;
|
|
89
|
+
width: unset;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
/**
|
|
93
|
+
* This component applies a fading graphical effect to its content if it overflows in any of the sides specified by the props.
|
|
94
|
+
*
|
|
95
|
+
* This also controls how this overflow is scrolled, introducing a new scrolling technique, which applies arrows to the overflowing side.
|
|
96
|
+
*/
|
|
97
|
+
export const FadingOverflow = ({ children, scroll = 'none', sides, enableHorizontalScrollWithVerticalWheel, className, ...props }) => {
|
|
98
|
+
const ref = useRef(null);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (!ref.current)
|
|
101
|
+
return;
|
|
102
|
+
const element = ref.current;
|
|
103
|
+
const fadeTop = !sides || sides.includes('top');
|
|
104
|
+
const fadeRight = !sides || sides.includes('right');
|
|
105
|
+
const fadeBottom = !sides || sides.includes('bottom');
|
|
106
|
+
const fadeLeft = !sides || sides.includes('left');
|
|
107
|
+
let intervalId;
|
|
108
|
+
const overflow = scroll === 'none' ? 'clip' : 'auto';
|
|
109
|
+
element.style.overflowX = (fadeLeft || fadeRight) ? overflow : '';
|
|
110
|
+
element.style.overflowY = (fadeTop || fadeBottom) ? overflow : '';
|
|
111
|
+
if (scroll === 'arrows' || scroll === 'wheel')
|
|
112
|
+
element.classList.add('hidden-scroll-bars');
|
|
113
|
+
function stopScrolling() {
|
|
114
|
+
clearInterval(intervalId);
|
|
115
|
+
}
|
|
116
|
+
function checkOverflow() {
|
|
117
|
+
// masking (fading)
|
|
118
|
+
const overflowsRight = element.clientWidth < element.scrollWidth && element.scrollLeft < (element.scrollWidth - element.clientWidth);
|
|
119
|
+
const overflowsLeft = element.scrollLeft > 0;
|
|
120
|
+
const overflowsBottom = element.clientHeight < element.scrollHeight
|
|
121
|
+
&& element.scrollTop < (element.scrollHeight - element.clientHeight);
|
|
122
|
+
const overflowsTop = element.scrollTop > 0;
|
|
123
|
+
const masksToApply = [];
|
|
124
|
+
if (overflowsLeft && fadeLeft && overflowsRight && fadeRight)
|
|
125
|
+
masksToApply.push(masks.horizontal);
|
|
126
|
+
else {
|
|
127
|
+
if (overflowsRight && fadeRight)
|
|
128
|
+
masksToApply.push(masks.right);
|
|
129
|
+
if (overflowsLeft && fadeLeft)
|
|
130
|
+
masksToApply.push(masks.left);
|
|
131
|
+
}
|
|
132
|
+
if (overflowsTop && fadeTop && overflowsBottom && fadeBottom)
|
|
133
|
+
masksToApply.push(masks.vertical);
|
|
134
|
+
else {
|
|
135
|
+
if (overflowsTop && fadeTop)
|
|
136
|
+
masksToApply.push(masks.top);
|
|
137
|
+
if (overflowsBottom && fadeBottom)
|
|
138
|
+
masksToApply.push(masks.bottom);
|
|
139
|
+
}
|
|
140
|
+
element.style.maskImage = masksToApply.join(', ');
|
|
141
|
+
// arrow buttons
|
|
142
|
+
if (scroll !== 'arrows')
|
|
143
|
+
return;
|
|
144
|
+
function startScrolling(side) {
|
|
145
|
+
stopScrolling();
|
|
146
|
+
const direction = side === 'bottom' || side === 'top' ? 'scrollTop' : 'scrollLeft';
|
|
147
|
+
const multiplier = side === 'bottom' || side === 'right' ? 1 : -1;
|
|
148
|
+
intervalId = window.setInterval(() => {
|
|
149
|
+
element[direction] += SCROLL_PX * multiplier;
|
|
150
|
+
}, SCROLL_INTERVAL_MS);
|
|
151
|
+
}
|
|
152
|
+
const startScrollingBySide = {
|
|
153
|
+
left: () => startScrolling('left'),
|
|
154
|
+
right: () => startScrolling('right'),
|
|
155
|
+
top: () => startScrolling('top'),
|
|
156
|
+
bottom: () => startScrolling('bottom'),
|
|
157
|
+
};
|
|
158
|
+
const scrollToMaxBySide = {
|
|
159
|
+
left: () => element.scrollLeft = 0,
|
|
160
|
+
right: () => element.scrollLeft = element.scrollWidth - element.clientWidth,
|
|
161
|
+
top: () => element.scrollTop = 0,
|
|
162
|
+
bottom: () => element.scrollTop = element.scrollHeight - element.clientHeight,
|
|
163
|
+
};
|
|
164
|
+
function enableArrowButton(side) {
|
|
165
|
+
const button = element.parentNode?.querySelector(`.scroll-to-${side}`);
|
|
166
|
+
if (button?.classList.contains('visible'))
|
|
167
|
+
return;
|
|
168
|
+
button?.classList.add('visible');
|
|
169
|
+
button?.addEventListener('mouseenter', startScrollingBySide[side]);
|
|
170
|
+
button?.addEventListener('mouseleave', stopScrolling);
|
|
171
|
+
button?.addEventListener('click', scrollToMaxBySide[side]);
|
|
172
|
+
}
|
|
173
|
+
function disableArrowButton(side) {
|
|
174
|
+
const button = element.parentNode?.querySelector(`.scroll-to-${side}`);
|
|
175
|
+
if (!button?.classList.contains('visible'))
|
|
176
|
+
return;
|
|
177
|
+
button?.classList.remove('visible');
|
|
178
|
+
stopScrolling();
|
|
179
|
+
button?.removeEventListener('mouseenter', startScrollingBySide[side]);
|
|
180
|
+
button?.removeEventListener('mouseleave', stopScrolling);
|
|
181
|
+
button?.removeEventListener('click', scrollToMaxBySide[side]);
|
|
182
|
+
}
|
|
183
|
+
if (overflowsRight && fadeRight)
|
|
184
|
+
enableArrowButton('right');
|
|
185
|
+
else
|
|
186
|
+
disableArrowButton('right');
|
|
187
|
+
if (overflowsLeft && fadeLeft)
|
|
188
|
+
enableArrowButton('left');
|
|
189
|
+
else
|
|
190
|
+
disableArrowButton('left');
|
|
191
|
+
if (overflowsTop && fadeTop)
|
|
192
|
+
enableArrowButton('top');
|
|
193
|
+
else
|
|
194
|
+
disableArrowButton('top');
|
|
195
|
+
if (overflowsBottom && fadeBottom)
|
|
196
|
+
enableArrowButton('bottom');
|
|
197
|
+
else
|
|
198
|
+
disableArrowButton('bottom');
|
|
199
|
+
}
|
|
200
|
+
const debouncedCheck = debounce(checkOverflow, MIN_CHECK_INTERVAL_MS);
|
|
201
|
+
const resizeObserver = new ResizeObserver(debouncedCheck);
|
|
202
|
+
resizeObserver.observe(element);
|
|
203
|
+
element.addEventListener('scroll', debouncedCheck);
|
|
204
|
+
return () => {
|
|
205
|
+
stopScrolling();
|
|
206
|
+
resizeObserver.disconnect();
|
|
207
|
+
element.removeEventListener('scroll', debouncedCheck);
|
|
208
|
+
};
|
|
209
|
+
}, [sides, ref.current, scroll]);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (!enableHorizontalScrollWithVerticalWheel || !ref.current)
|
|
212
|
+
return;
|
|
213
|
+
const element = ref.current;
|
|
214
|
+
function scrollWithWheel(event) {
|
|
215
|
+
if (event.deltaY) {
|
|
216
|
+
element.scrollLeft += event.deltaY;
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
event.stopPropagation();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
element.addEventListener('wheel', scrollWithWheel);
|
|
222
|
+
return () => element.removeEventListener('wheel', scrollWithWheel);
|
|
223
|
+
}, [ref.current, enableHorizontalScrollWithVerticalWheel]);
|
|
224
|
+
return scroll === 'arrows' ? (_jsxs(OverflowBox, { ...props, className: listToClass(['scroll-arrows', className]), children: [_jsx("div", { className: "content", ref: ref, children: children }), _jsx("div", { className: "scroll-to-left", "aria-hidden": true, children: _jsx(IconBox, { size: "xs", children: _jsx(ChevronLeft, {}) }) }), _jsx("div", { className: "scroll-to-right", "aria-hidden": true, children: _jsx(IconBox, { size: "xs", children: _jsx(ChevronRight, {}) }) }), _jsx("div", { className: "scroll-to-top", "aria-hidden": true, children: _jsx(IconBox, { size: "xs", children: _jsx(ChevronUp, {}) }) }), _jsx("div", { className: "scroll-to-bottom", "aria-hidden": true, children: _jsx(IconBox, { size: "xs", children: _jsx(ChevronDown, {}) }) })] })) : _jsx(OverflowBox, { ...props, className: className, ref: ref, children: children });
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=FadingOverflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadingOverflow.js","sourceRoot":"","sources":["../../src/components/FadingOverflow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,KAAK,EAAa,MAAM,0BAA0B,CAAA;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EAAC,iBAAiB,iCAAa,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,YAAY,KAAG,GAAU,GAAM,EAChG,cAAK,SAAS,EAAC,eAAe,iCAAa,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,SAAS,KAAG,GAAU,GAAM,EAC3F,cAAK,SAAS,EAAC,kBAAkB,iCAAa,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,WAAW,KAAG,GAAU,GAAM,IACpF,CACf,CAAC,CAAC,CAAC,KAAC,WAAW,OAAK,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,YAAG,QAAQ,GAAe,CAAA;AACtF,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationItem.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAexD,UAAU,KAAK;IACb,YAAY,EAAE,8BAA8B,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IAEnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationItem.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAexD,UAAU,KAAK;IACb,YAAY,EAAE,8BAA8B,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IAEnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;CACtC;AAqKD,UAAU,+BAAgC,SAAQ,KAAK;IACrD;;;;;;;;;;OAUG;IACH,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/F;AAED,UAAU,wBAAyB,SAAQ,KAAK;IAC9C;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,KAAK,qBAAqB,GAAG,+BAA+B,GAAG,wBAAwB,CAAA;AAEvF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,0CAA2C,qBAAqB,4CA4C5F,CAAA"}
|
|
@@ -20,11 +20,6 @@ const statusToColor = {
|
|
|
20
20
|
HIGH: 'danger.500',
|
|
21
21
|
};
|
|
22
22
|
const style = {
|
|
23
|
-
tooltip: {
|
|
24
|
-
'&::after': {
|
|
25
|
-
top: '25%',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
23
|
notificationDescription: {
|
|
29
24
|
display: '-webkit-box',
|
|
30
25
|
WebkitBoxOrient: 'vertical',
|
|
@@ -76,7 +71,7 @@ const NotificationContent = ({ notification, isSummary, onClickViewNotification
|
|
|
76
71
|
}
|
|
77
72
|
}, 100);
|
|
78
73
|
};
|
|
79
|
-
return (_jsxs(_Fragment, { children: [!isSummary && _jsx(Flex, { mt: 4, mb: 3, flexDirection: "column", children: _jsx(LazyMarkdown, { components: components(), children: description }) }), isSummary && (_jsx(Text, { appearance: "body2", mb: 3, sx: style.notificationDescription, children: description })), _jsxs(Flex, { justifyContent: "space-between", children: [_jsxs(Flex, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: t[notification.context] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" }), !isSummary && _jsxs(_Fragment, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: formatDate(notification.trigger_at) }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" })] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: daysAgo > 0 ? daysAgo + ' ' + t.daysAgo : t.today })] }), isSummary && description.length > 120 && (_jsx(Link, { href: "/notifications", onClick: (ev) => {
|
|
74
|
+
return (_jsxs(_Fragment, { children: [!isSummary && _jsx(Flex, { mt: 4, mb: 3, flexDirection: "column", children: _jsx(LazyMarkdown, { components: components(), children: description }) }), isSummary && (_jsx(Text, { appearance: "body2", mb: 3, sx: style.notificationDescription, children: handleTextMark(description) })), _jsxs(Flex, { justifyContent: "space-between", children: [_jsxs(Flex, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: t[notification.context] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" }), !isSummary && _jsxs(_Fragment, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: formatDate(notification.trigger_at) }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" })] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: daysAgo > 0 ? daysAgo + ' ' + t.daysAgo : t.today })] }), isSummary && description.length > 120 && (_jsx(Link, { href: "/notifications", onClick: (ev) => {
|
|
80
75
|
onClickViewNotification?.();
|
|
81
76
|
navigateToNotificationPosition(ev, `notification-item-${notification.id}`);
|
|
82
77
|
}, children: _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: t.readMore }) }))] })] }));
|
|
@@ -114,10 +109,13 @@ export const NotificationItem = ({ notification, isSummary, ...props }) => {
|
|
|
114
109
|
else
|
|
115
110
|
props.onClickMarkReadUnread(true, 'callToAction');
|
|
116
111
|
}
|
|
117
|
-
return (_jsxs(Box, { sx: { position: 'relative' }, id: props.id, children: [_jsxs(Flex, { bg: "light.400", p: "3 3 3 5", r: "xs", flexWrap: "nowrap", flexDirection: "column", w: "100%", sx: styles.item(statusToColor[notification.criticality], notification.committed), children: [_jsx(NotificationHeader, { title: title, isSummary: isSummary }), _jsx(NotificationContent, { notification: notification, isSummary: isSummary, onClickViewNotification: props.onClickViewNotification }), notification.call_to_action && _jsx(NotificationFooter, { actionURL: notification.call_to_action, onClickAction: clickAction, title: title })] }), _jsx(Box, { sx: { position: 'absolute', top: '8px', right: '8px' }, children: _jsx(Tooltip, { text: notification.committed ? t.committed : t.uncommitted, position: "left",
|
|
112
|
+
return (_jsxs(Box, { sx: { position: 'relative' }, id: props.id, children: [_jsxs(Flex, { bg: "light.400", p: "3 3 3 5", r: "xs", flexWrap: "nowrap", flexDirection: "column", w: "100%", sx: styles.item(statusToColor[notification.criticality], notification.committed), children: [_jsx(NotificationHeader, { title: title, isSummary: isSummary }), _jsx(NotificationContent, { notification: notification, isSummary: isSummary, onClickViewNotification: props.onClickViewNotification }), notification.call_to_action && _jsx(NotificationFooter, { actionURL: notification.call_to_action, onClickAction: clickAction, title: title })] }), _jsx(Box, { sx: { position: 'absolute', top: '8px', right: '8px' }, children: _jsx(Tooltip, { text: notification.committed ? t.committed : t.uncommitted, position: "left", children: notification.committed
|
|
118
113
|
? _jsx(IconBox, { role: "img", "aria-label": t.committed, size: "xs", style: { margin: '4px', opacity: 0.5 }, children: _jsx(EnvelopeOpen, {}) })
|
|
119
114
|
: (_jsx(IconButton, { "aria-label": t.uncommitted, onClick: commit, children: _jsx(IconBox, { size: "xs", children: _jsx(Envelope, {}) }) })) }) })] }));
|
|
120
115
|
};
|
|
116
|
+
function handleTextMark(text) {
|
|
117
|
+
return text.replace(/[^\p{L}\p{N}\s\p{Emoji_Presentation}:!'()]/gu, '');
|
|
118
|
+
}
|
|
121
119
|
const dictionary = {
|
|
122
120
|
en: {
|
|
123
121
|
ACCOUNT: 'Account',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/notification/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAiD,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9G,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAA;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,CAAC,KAAa,EAAE,MAAe,EAAE,EAAE,CAAC,CAAC;QACzC,UAAU,EAAE,aAAa,KAAK,EAAE;QAChC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC1B,CAAC;CACgD,CAAA;AAEpD,MAAM,aAAa,GAAkD;IACnE,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,YAAY;CACnB,CAAA;AAUD,MAAM,KAAK,GAAW;IACpB,
|
|
1
|
+
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/notification/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAiD,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9G,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EA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ACZ,gBAAgB,EAAE,sBAAsB;QACxC,QAAQ,EAAE,WAAW;KACtB;IACD,EAAE,EAAE;QACF,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,SAAS;QACjB,EAAE,EAAE,IAAI;QACR,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,+BAA+B;QAC1C,WAAW,EAAE,oEAAoE;QACjF,IAAI,EAAE,YAAY;QAClB,gBAAgB,EAAE,2BAA2B;QAC7C,QAAQ,EAAE,UAAU;KACrB;CACmB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AsyncContent } from './components/AsyncContent.js';
|
|
2
2
|
export { BannerWarning } from './components/BannerWarning.js';
|
|
3
|
-
export { ChatBot } from './components/ChatBot.js';
|
|
4
3
|
export { ButtonLoading } from './components/ButtonLoading.js';
|
|
4
|
+
export { ChatBot } from './components/ChatBot.js';
|
|
5
5
|
export { useDateFormatter } from './hooks/date.js';
|
|
6
6
|
export { useKeyboardControls } from './hooks/keyboard.js';
|
|
7
7
|
export { useManualRender } from './hooks/manual-render.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AsyncContent } from './components/AsyncContent.js';
|
|
2
2
|
export { BannerWarning } from './components/BannerWarning.js';
|
|
3
|
-
export { ChatBot } from './components/ChatBot.js';
|
|
4
3
|
export { ButtonLoading } from './components/ButtonLoading.js';
|
|
4
|
+
export { ChatBot } from './components/ChatBot.js';
|
|
5
5
|
export { useDateFormatter } from './hooks/date.js';
|
|
6
6
|
export { useKeyboardControls } from './hooks/keyboard.js';
|
|
7
7
|
export { useManualRender } from './hooks/manual-render.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/portal-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"./SearchInput": "./dist/components/form/SearchInput.js",
|
|
24
24
|
"./Select": "./dist/components/form/Select/index.js",
|
|
25
25
|
"./Stepper": "./dist/components/Stepper/index.js",
|
|
26
|
-
"./FileTreeView": "./dist/components/FileTreeView/index.js"
|
|
26
|
+
"./FileTreeView": "./dist/components/FileTreeView/index.js",
|
|
27
|
+
"./FadingOverflow": "./dist/components/FadingOverflow.js"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { IconBox } from '@citric/core'
|
|
2
|
+
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from '@citric/icons'
|
|
3
|
+
import { listToClass, theme, WithStyle } from '@stack-spot/portal-theme'
|
|
4
|
+
import { debounce } from 'lodash'
|
|
5
|
+
import { useEffect, useRef } from 'react'
|
|
6
|
+
import { styled } from 'styled-components'
|
|
7
|
+
|
|
8
|
+
type Side = 'top' | 'right' | 'left' | 'bottom'
|
|
9
|
+
type ScrollType = 'none' | 'wheel' | 'bar' | 'arrows'
|
|
10
|
+
|
|
11
|
+
interface Props extends WithStyle {
|
|
12
|
+
/**
|
|
13
|
+
* How to scroll the content.
|
|
14
|
+
* - none: overflow is hidden. No scrolling.
|
|
15
|
+
* - wheel: the content is solely scrollable through the mouse wheel and keyboard arrows, no scroll bars are rendered.
|
|
16
|
+
* - bar: this is the normal browser scroll. The content will be scrollable through the mouse wheel, keyboard and scrollbar.
|
|
17
|
+
* - arrows: arrows will be placed in the far edges of the sides that must be scrolled. The content is scrolled through the mouse wheel,
|
|
18
|
+
* keyboard and these arrows. Hovering an arrow slowly scrolls the content, clicking the arrow fully scrolls the content in its direction.
|
|
19
|
+
* There are no scrollbars in this scenario.
|
|
20
|
+
* @default 'none'
|
|
21
|
+
*/
|
|
22
|
+
scroll?: ScrollType,
|
|
23
|
+
/**
|
|
24
|
+
* If true, a horizontal scroll can be performed by using the vertical mouse wheel.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
enableHorizontalScrollWithVerticalWheel?: boolean,
|
|
28
|
+
/**
|
|
29
|
+
* Which sides to fade when the content overflows.
|
|
30
|
+
*
|
|
31
|
+
* Important: it seems the current solution doesn't support mixing vertical and horizontal scrolls. I'm not sure if this is possible, I
|
|
32
|
+
* believed combining linear gradients would work, but it doesn't.
|
|
33
|
+
*/
|
|
34
|
+
sides?: Side[],
|
|
35
|
+
children?: React.ReactNode,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Scrolling can be very fast, this sets a lower limit for us to run listeners without impacting performance.
|
|
39
|
+
const MIN_CHECK_INTERVAL_MS = 20
|
|
40
|
+
// The interval which to scroll the content when a scroll arrow is hovered.
|
|
41
|
+
const SCROLL_INTERVAL_MS = 20
|
|
42
|
+
// This sets the speed of the scroll when the user hovers a scroll arrow.
|
|
43
|
+
const SCROLL_PX = 4
|
|
44
|
+
// Fade masks
|
|
45
|
+
const masks = {
|
|
46
|
+
right: 'linear-gradient(to left, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
47
|
+
left: 'linear-gradient(to right, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
48
|
+
top: 'linear-gradient(to bottom, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
49
|
+
bottom: 'linear-gradient(to top, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgba(0, 0, 0) 100%)',
|
|
50
|
+
horizontal: 'linear-gradient(to left, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgb(0, 0, 0) max(70%, calc(100% - 100px)), rgba(0, 0, 0, 0) 100%)',
|
|
51
|
+
vertical: 'linear-gradient(to top, rgb(0, 0, 0, 0) 0%, rgb(0, 0, 0) min(30%, 100px), rgb(0, 0, 0) max(70%, calc(100% - 100px)), rgba(0, 0, 0, 0) 100%)',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const OverflowBox = styled.div`
|
|
55
|
+
&.hidden-scroll-bars::-webkit-scrollbar, &.scroll-arrows ::-webkit-scrollbar {
|
|
56
|
+
width: 0;
|
|
57
|
+
height: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.scroll-arrows {
|
|
61
|
+
position: relative;
|
|
62
|
+
|
|
63
|
+
> .content {
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.scroll-to-left, .scroll-to-right, .scroll-to-top, .scroll-to-bottom {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
right: 0;
|
|
74
|
+
width: 30px;
|
|
75
|
+
height: 30px;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
opacity: 0;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
transition: opacity 0.3s;
|
|
82
|
+
|
|
83
|
+
${IconBox} {
|
|
84
|
+
background-color: ${theme.color.light[300]};
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
width: 16px;
|
|
87
|
+
height: 16px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.visible {
|
|
94
|
+
opacity: 0.6;
|
|
95
|
+
pointer-events: auto;
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.scroll-to-left {
|
|
104
|
+
right: unset;
|
|
105
|
+
height: unset;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.scroll-to-right {
|
|
109
|
+
left: unset;
|
|
110
|
+
height: unset;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.scroll-to-top {
|
|
114
|
+
bottom: unset;
|
|
115
|
+
width: unset;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.scroll-to-bottom {
|
|
119
|
+
top: unset;
|
|
120
|
+
width: unset;
|
|
121
|
+
}
|
|
122
|
+
`
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* This component applies a fading graphical effect to its content if it overflows in any of the sides specified by the props.
|
|
126
|
+
*
|
|
127
|
+
* This also controls how this overflow is scrolled, introducing a new scrolling technique, which applies arrows to the overflowing side.
|
|
128
|
+
*/
|
|
129
|
+
export const FadingOverflow = (
|
|
130
|
+
{ children, scroll = 'none', sides, enableHorizontalScrollWithVerticalWheel, className, ...props }: Props,
|
|
131
|
+
) => {
|
|
132
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (!ref.current) return
|
|
136
|
+
const element = ref.current
|
|
137
|
+
const fadeTop = !sides || sides.includes('top')
|
|
138
|
+
const fadeRight = !sides || sides.includes('right')
|
|
139
|
+
const fadeBottom = !sides || sides.includes('bottom')
|
|
140
|
+
const fadeLeft = !sides || sides.includes('left')
|
|
141
|
+
let intervalId: number | undefined
|
|
142
|
+
const overflow = scroll === 'none' ? 'clip' : 'auto'
|
|
143
|
+
element.style.overflowX = (fadeLeft || fadeRight) ? overflow : ''
|
|
144
|
+
element.style.overflowY = (fadeTop || fadeBottom) ? overflow : ''
|
|
145
|
+
if (scroll === 'arrows' || scroll === 'wheel') element.classList.add('hidden-scroll-bars')
|
|
146
|
+
|
|
147
|
+
function stopScrolling() {
|
|
148
|
+
clearInterval(intervalId)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function checkOverflow() {
|
|
152
|
+
// masking (fading)
|
|
153
|
+
const overflowsRight = element.clientWidth < element.scrollWidth && element.scrollLeft < (element.scrollWidth - element.clientWidth)
|
|
154
|
+
const overflowsLeft = element.scrollLeft > 0
|
|
155
|
+
const overflowsBottom = element.clientHeight < element.scrollHeight
|
|
156
|
+
&& element.scrollTop < (element.scrollHeight - element.clientHeight)
|
|
157
|
+
const overflowsTop = element.scrollTop > 0
|
|
158
|
+
const masksToApply: string[] = []
|
|
159
|
+
if (overflowsLeft && fadeLeft && overflowsRight && fadeRight) masksToApply.push(masks.horizontal)
|
|
160
|
+
else {
|
|
161
|
+
if (overflowsRight && fadeRight) masksToApply.push(masks.right)
|
|
162
|
+
if (overflowsLeft && fadeLeft) masksToApply.push(masks.left)
|
|
163
|
+
}
|
|
164
|
+
if (overflowsTop && fadeTop && overflowsBottom && fadeBottom) masksToApply.push(masks.vertical)
|
|
165
|
+
else {
|
|
166
|
+
if (overflowsTop && fadeTop) masksToApply.push(masks.top)
|
|
167
|
+
if (overflowsBottom && fadeBottom) masksToApply.push(masks.bottom)
|
|
168
|
+
}
|
|
169
|
+
element.style.maskImage = masksToApply.join(', ')
|
|
170
|
+
|
|
171
|
+
// arrow buttons
|
|
172
|
+
if (scroll !== 'arrows') return
|
|
173
|
+
|
|
174
|
+
function startScrolling(side: Side) {
|
|
175
|
+
stopScrolling()
|
|
176
|
+
const direction = side === 'bottom' || side === 'top' ? 'scrollTop' : 'scrollLeft'
|
|
177
|
+
const multiplier = side === 'bottom' || side === 'right' ? 1 : -1
|
|
178
|
+
intervalId = window.setInterval(() => {
|
|
179
|
+
element[direction] += SCROLL_PX * multiplier
|
|
180
|
+
}, SCROLL_INTERVAL_MS)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const startScrollingBySide = {
|
|
184
|
+
left: () => startScrolling('left'),
|
|
185
|
+
right: () => startScrolling('right'),
|
|
186
|
+
top: () => startScrolling('top'),
|
|
187
|
+
bottom: () => startScrolling('bottom'),
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const scrollToMaxBySide = {
|
|
191
|
+
left: () => element.scrollLeft = 0,
|
|
192
|
+
right: () => element.scrollLeft = element.scrollWidth - element.clientWidth,
|
|
193
|
+
top: () => element.scrollTop = 0,
|
|
194
|
+
bottom: () => element.scrollTop = element.scrollHeight - element.clientHeight,
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function enableArrowButton(side: Side) {
|
|
198
|
+
const button = element.parentNode?.querySelector(`.scroll-to-${side}`)
|
|
199
|
+
if (button?.classList.contains('visible')) return
|
|
200
|
+
button?.classList.add('visible')
|
|
201
|
+
button?.addEventListener('mouseenter', startScrollingBySide[side])
|
|
202
|
+
button?.addEventListener('mouseleave', stopScrolling)
|
|
203
|
+
button?.addEventListener('click', scrollToMaxBySide[side])
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function disableArrowButton(side: Side) {
|
|
207
|
+
const button = element.parentNode?.querySelector(`.scroll-to-${side}`)
|
|
208
|
+
if (!button?.classList.contains('visible')) return
|
|
209
|
+
button?.classList.remove('visible')
|
|
210
|
+
stopScrolling()
|
|
211
|
+
button?.removeEventListener('mouseenter', startScrollingBySide[side])
|
|
212
|
+
button?.removeEventListener('mouseleave', stopScrolling)
|
|
213
|
+
button?.removeEventListener('click', scrollToMaxBySide[side])
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (overflowsRight && fadeRight) enableArrowButton('right')
|
|
217
|
+
else disableArrowButton('right')
|
|
218
|
+
if (overflowsLeft && fadeLeft) enableArrowButton('left')
|
|
219
|
+
else disableArrowButton('left')
|
|
220
|
+
if (overflowsTop && fadeTop) enableArrowButton('top')
|
|
221
|
+
else disableArrowButton('top')
|
|
222
|
+
if (overflowsBottom && fadeBottom) enableArrowButton('bottom')
|
|
223
|
+
else disableArrowButton('bottom')
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const debouncedCheck = debounce(checkOverflow, MIN_CHECK_INTERVAL_MS)
|
|
227
|
+
const resizeObserver = new ResizeObserver(debouncedCheck)
|
|
228
|
+
resizeObserver.observe(element)
|
|
229
|
+
element.addEventListener('scroll', debouncedCheck)
|
|
230
|
+
|
|
231
|
+
return () => {
|
|
232
|
+
stopScrolling()
|
|
233
|
+
resizeObserver.disconnect()
|
|
234
|
+
element.removeEventListener('scroll', debouncedCheck)
|
|
235
|
+
}
|
|
236
|
+
}, [sides, ref.current, scroll])
|
|
237
|
+
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
if (!enableHorizontalScrollWithVerticalWheel || !ref.current) return
|
|
240
|
+
const element = ref.current
|
|
241
|
+
|
|
242
|
+
function scrollWithWheel(event: WheelEvent) {
|
|
243
|
+
if (event.deltaY) {
|
|
244
|
+
element.scrollLeft += event.deltaY
|
|
245
|
+
event.preventDefault()
|
|
246
|
+
event.stopPropagation()
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
element.addEventListener('wheel', scrollWithWheel)
|
|
251
|
+
return () => element.removeEventListener('wheel', scrollWithWheel)
|
|
252
|
+
}, [ref.current, enableHorizontalScrollWithVerticalWheel])
|
|
253
|
+
|
|
254
|
+
return scroll === 'arrows' ? (
|
|
255
|
+
<OverflowBox {...props} className={listToClass(['scroll-arrows', className])}>
|
|
256
|
+
<div className="content" ref={ref}>{children}</div>
|
|
257
|
+
<div className="scroll-to-left" aria-hidden><IconBox size="xs"><ChevronLeft /></IconBox></div>
|
|
258
|
+
<div className="scroll-to-right" aria-hidden><IconBox size="xs"><ChevronRight /></IconBox></div>
|
|
259
|
+
<div className="scroll-to-top" aria-hidden><IconBox size="xs"><ChevronUp /></IconBox></div>
|
|
260
|
+
<div className="scroll-to-bottom" aria-hidden><IconBox size="xs"><ChevronDown /></IconBox></div>
|
|
261
|
+
</OverflowBox>
|
|
262
|
+
) : <OverflowBox {...props} className={className} ref={ref}>{children}</OverflowBox>
|
|
263
|
+
}
|
|
@@ -31,11 +31,6 @@ interface Props {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const style: Styles = {
|
|
34
|
-
tooltip: {
|
|
35
|
-
'&::after': {
|
|
36
|
-
top: '25%',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
34
|
notificationDescription: {
|
|
40
35
|
display: '-webkit-box',
|
|
41
36
|
WebkitBoxOrient: 'vertical',
|
|
@@ -113,7 +108,9 @@ const NotificationContent = ({ notification, isSummary, onClickViewNotification
|
|
|
113
108
|
<LazyMarkdown components={components()}>{description}</LazyMarkdown>
|
|
114
109
|
</Flex>}
|
|
115
110
|
{isSummary && (
|
|
116
|
-
<Text appearance="body2" mb={3} sx={style.notificationDescription}>
|
|
111
|
+
<Text appearance="body2" mb={3} sx={style.notificationDescription}>
|
|
112
|
+
{handleTextMark(description)}
|
|
113
|
+
</Text>
|
|
117
114
|
)}
|
|
118
115
|
<Flex justifyContent="space-between">
|
|
119
116
|
<Flex>
|
|
@@ -267,7 +264,7 @@ export const NotificationItem = ({ notification, isSummary, ...props }: Notifica
|
|
|
267
264
|
/>}
|
|
268
265
|
</Flex>
|
|
269
266
|
<Box sx={{ position: 'absolute', top: '8px', right: '8px' }}>
|
|
270
|
-
<Tooltip text={notification.committed ? t.committed : t.uncommitted} position="left"
|
|
267
|
+
<Tooltip text={notification.committed ? t.committed : t.uncommitted} position="left">
|
|
271
268
|
{notification.committed
|
|
272
269
|
? <IconBox role="img" aria-label={t.committed} size="xs" style={{ margin: '4px', opacity: 0.5 }}><EnvelopeOpen /></IconBox>
|
|
273
270
|
: (
|
|
@@ -282,6 +279,10 @@ export const NotificationItem = ({ notification, isSummary, ...props }: Notifica
|
|
|
282
279
|
)
|
|
283
280
|
}
|
|
284
281
|
|
|
282
|
+
function handleTextMark(text: string) {
|
|
283
|
+
return text.replace(/[^\p{L}\p{N}\s\p{Emoji_Presentation}:!'()]/gu, '')
|
|
284
|
+
}
|
|
285
|
+
|
|
285
286
|
const dictionary = {
|
|
286
287
|
en: {
|
|
287
288
|
ACCOUNT: 'Account',
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AsyncContent } from './components/AsyncContent'
|
|
2
2
|
export { BannerWarning } from './components/BannerWarning'
|
|
3
|
-
export { ChatBot } from './components/ChatBot'
|
|
4
3
|
export { ButtonLoading } from './components/ButtonLoading'
|
|
4
|
+
export { ChatBot } from './components/ChatBot'
|
|
5
5
|
export { useDateFormatter } from './hooks/date'
|
|
6
6
|
export { useKeyboardControls } from './hooks/keyboard'
|
|
7
7
|
export { useManualRender } from './hooks/manual-render'
|