@stack-spot/portal-components 2.0.2 → 2.1.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 +15 -0
- package/dist/components/AnimatedHeight.d.ts +59 -0
- package/dist/components/AnimatedHeight.d.ts.map +1 -0
- package/dist/components/AnimatedHeight.js +105 -0
- package/dist/components/AnimatedHeight.js.map +1 -0
- package/dist/components/Placeholder.d.ts +6 -4
- package/dist/components/Placeholder.d.ts.map +1 -1
- package/dist/components/Placeholder.js +5 -4
- package/dist/components/Placeholder.js.map +1 -1
- package/dist/components/TimelineSection.d.ts +25 -0
- package/dist/components/TimelineSection.d.ts.map +1 -0
- package/dist/components/TimelineSection.js +27 -0
- package/dist/components/TimelineSection.js.map +1 -0
- package/dist/components/error/ErrorFeedback.d.ts +9 -1
- package/dist/components/error/ErrorFeedback.d.ts.map +1 -1
- package/dist/components/error/ErrorFeedback.js +41 -4
- package/dist/components/error/ErrorFeedback.js.map +1 -1
- package/dist/components/form/SearchInput.d.ts +9 -0
- package/dist/components/form/SearchInput.d.ts.map +1 -0
- package/dist/components/form/SearchInput.js +28 -0
- package/dist/components/form/SearchInput.js.map +1 -0
- package/dist/components/form/Select.d.ts +69 -0
- package/dist/components/form/Select.d.ts.map +1 -0
- package/dist/components/form/Select.js +161 -0
- package/dist/components/form/Select.js.map +1 -0
- package/dist/components/{Notifications → notification}/NotificationComponent.d.ts +2 -1
- package/dist/components/notification/NotificationComponent.d.ts.map +1 -0
- package/dist/components/{Notifications → notification}/NotificationComponent.js +12 -4
- package/dist/components/notification/NotificationComponent.js.map +1 -0
- package/dist/components/notification/NotificationItem.d.ts +42 -0
- package/dist/components/notification/NotificationItem.d.ts.map +1 -0
- package/dist/components/{Notifications → notification}/NotificationItem.js +27 -12
- package/dist/components/notification/NotificationItem.js.map +1 -0
- package/dist/components/notification/NotificationList.d.ts +39 -0
- package/dist/components/notification/NotificationList.d.ts.map +1 -0
- package/dist/components/notification/NotificationList.js +82 -0
- package/dist/components/notification/NotificationList.js.map +1 -0
- package/dist/components/notification/NotificationPlaceholder.d.ts +12 -0
- package/dist/components/notification/NotificationPlaceholder.d.ts.map +1 -0
- package/dist/components/notification/NotificationPlaceholder.js +22 -0
- package/dist/components/notification/NotificationPlaceholder.js.map +1 -0
- package/dist/components/{Notifications → notification}/types.d.ts +16 -0
- package/dist/components/notification/types.d.ts.map +1 -0
- package/dist/components/{Notifications → notification}/types.js +3 -0
- package/dist/components/notification/types.js.map +1 -0
- package/dist/containers/NotificationsPage.d.ts +2 -0
- package/dist/containers/NotificationsPage.d.ts.map +1 -0
- package/dist/containers/NotificationsPage.js +58 -0
- package/dist/containers/NotificationsPage.js.map +1 -0
- package/dist/context/notification/LazyNotificationList.d.ts +28 -0
- package/dist/context/notification/LazyNotificationList.d.ts.map +1 -0
- package/dist/context/notification/LazyNotificationList.js +128 -0
- package/dist/context/notification/LazyNotificationList.js.map +1 -0
- package/dist/context/notification/NotificationController.d.ts +24 -0
- package/dist/context/notification/NotificationController.d.ts.map +1 -0
- package/dist/context/notification/NotificationController.js +136 -0
- package/dist/context/notification/NotificationController.js.map +1 -0
- package/dist/context/notification/context.d.ts +9 -0
- package/dist/context/notification/context.d.ts.map +1 -0
- package/dist/context/notification/context.js +12 -0
- package/dist/context/notification/context.js.map +1 -0
- package/dist/context/notification/hooks.d.ts +13 -0
- package/dist/context/notification/hooks.d.ts.map +1 -0
- package/dist/context/notification/hooks.js +77 -0
- package/dist/context/notification/hooks.js.map +1 -0
- package/dist/context/notification/types.d.ts +57 -0
- package/dist/context/notification/types.d.ts.map +1 -0
- package/dist/context/notification/types.js +2 -0
- package/dist/context/notification/types.js.map +1 -0
- package/dist/hooks/manual-render.d.ts +8 -0
- package/dist/hooks/manual-render.d.ts.map +1 -0
- package/dist/hooks/manual-render.js +10 -0
- package/dist/hooks/manual-render.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/notifications.d.ts +11 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +10 -0
- package/dist/notifications.js.map +1 -0
- package/dist/svg/GenericPlaceholder.d.ts +5 -0
- package/dist/svg/GenericPlaceholder.d.ts.map +1 -0
- package/dist/svg/GenericPlaceholder.js +4 -0
- package/dist/svg/GenericPlaceholder.js.map +1 -0
- package/dist/svg/index.d.ts +1 -0
- package/dist/svg/index.d.ts.map +1 -1
- package/dist/svg/index.js +1 -0
- package/dist/svg/index.js.map +1 -1
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.d.ts.map +1 -0
- package/dist/utils/promise.js +6 -0
- package/dist/utils/promise.js.map +1 -0
- package/package.json +8 -4
- package/src/components/AnimatedHeight.tsx +174 -0
- package/src/components/Placeholder.tsx +13 -8
- package/src/components/TimelineSection.tsx +54 -0
- package/src/components/error/ErrorFeedback.tsx +93 -55
- package/src/components/form/SearchInput.tsx +69 -0
- package/src/components/form/Select.tsx +264 -0
- package/src/components/{Notifications → notification}/NotificationComponent.tsx +13 -5
- package/src/components/{Notifications → notification}/NotificationItem.tsx +76 -34
- package/src/components/notification/NotificationList.tsx +167 -0
- package/src/components/notification/NotificationPlaceholder.tsx +40 -0
- package/src/components/{Notifications → notification}/types.ts +21 -0
- package/src/containers/NotificationsPage.tsx +98 -0
- package/src/context/notification/LazyNotificationList.ts +95 -0
- package/src/context/notification/NotificationController.ts +104 -0
- package/src/context/notification/context.tsx +23 -0
- package/src/context/notification/hooks.ts +82 -0
- package/src/context/notification/types.ts +64 -0
- package/src/hooks/manual-render.tsx +10 -0
- package/src/index.ts +2 -1
- package/src/notifications.ts +11 -0
- package/src/svg/GenericPlaceholder.tsx +19 -0
- package/src/svg/index.ts +1 -0
- package/src/utils/promise.ts +5 -0
- package/dist/components/Notifications/NotificationComponent.d.ts.map +0 -1
- package/dist/components/Notifications/NotificationComponent.js.map +0 -1
- package/dist/components/Notifications/NotificationItem.d.ts +0 -17
- package/dist/components/Notifications/NotificationItem.d.ts.map +0 -1
- package/dist/components/Notifications/NotificationItem.js.map +0 -1
- package/dist/components/Notifications/index.d.ts +0 -4
- package/dist/components/Notifications/index.d.ts.map +0 -1
- package/dist/components/Notifications/index.js +0 -4
- package/dist/components/Notifications/index.js.map +0 -1
- package/dist/components/Notifications/types.d.ts.map +0 -1
- package/dist/components/Notifications/types.js.map +0 -1
- package/src/components/Notifications/index.tsx +0 -3
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconBox, Text } from '@citric/core';
|
|
3
|
+
import { ChevronDown } from '@citric/icons';
|
|
4
|
+
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { styled } from 'styled-components';
|
|
7
|
+
const OPTION_HEIGHT = 32;
|
|
8
|
+
const LIST_BOTTOM_PADDING = 7;
|
|
9
|
+
const SelectBox = styled.div `
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
select {
|
|
13
|
+
border: none;
|
|
14
|
+
height: 40px;
|
|
15
|
+
opacity: 0;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fake-select {
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
border-radius: 0.25rem;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
border: 1px solid ${theme.color.light[600]};
|
|
28
|
+
transition: border-color 0.3s, box-shadow 0.3s;
|
|
29
|
+
z-index: 1;
|
|
30
|
+
background-color: ${theme.color.light[300]};
|
|
31
|
+
|
|
32
|
+
.arrow {
|
|
33
|
+
transition: transform ease-in-out 0.3s;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.focused, &.open {
|
|
37
|
+
border: 1px solid ${theme.color.primary[500]};
|
|
38
|
+
box-shadow: 0 0 0 1px ${theme.color.primary[500]};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.open {
|
|
42
|
+
.arrow {
|
|
43
|
+
transform: rotate(180deg);
|
|
44
|
+
}
|
|
45
|
+
.options {
|
|
46
|
+
/* lets the overflow be hidden until the animation on the height ends. */
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
animation: 0.3s overflow-animation;
|
|
49
|
+
@keyframes overflow-animation {
|
|
50
|
+
0% {
|
|
51
|
+
overflow-y: hidden;
|
|
52
|
+
}
|
|
53
|
+
99% {
|
|
54
|
+
overflow-y: hidden;
|
|
55
|
+
}
|
|
56
|
+
100% {
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.current-value {
|
|
64
|
+
height: 40px;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
padding: 0 8px;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
align-items: center;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.clipped-text {
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
width: 100%;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.options {
|
|
81
|
+
list-style: none;
|
|
82
|
+
padding: 0;
|
|
83
|
+
margin: 0;
|
|
84
|
+
overflow-y: hidden;
|
|
85
|
+
transition: height ease-in-out 0.3s;
|
|
86
|
+
max-height: ${({ $maxItems }) => $maxItems * OPTION_HEIGHT + LIST_BOTTOM_PADDING}px;
|
|
87
|
+
|
|
88
|
+
li {
|
|
89
|
+
height: ${OPTION_HEIGHT}px;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: row;
|
|
92
|
+
align-items: center;
|
|
93
|
+
padding: 0 8px;
|
|
94
|
+
border-top: 1px solid ${theme.color.light[600]};
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
transition: background-color 0.2s;
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: ${theme.color.light[500]};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
function renderProperty(option, renderer) {
|
|
105
|
+
if (!renderer)
|
|
106
|
+
return `${option ?? ''}`;
|
|
107
|
+
return typeof renderer === 'function' ? renderer(option) : (option[renderer] ?? `${option ?? ''}`);
|
|
108
|
+
}
|
|
109
|
+
const FakeOption = ({ value, label, onChange }) => (_jsx("li", { className: "option", onClick: () => onChange({ target: { value } }), children: _jsx(Text, { className: "clipped-text", children: label }) }));
|
|
110
|
+
/**
|
|
111
|
+
* Renders a Select component using the Citric Design System.
|
|
112
|
+
*
|
|
113
|
+
* The styled version of the select component is rendered on top of the default select from the browser. Visual users will use the Citric
|
|
114
|
+
* version of a Select, but blind users, who interacts with the keyboard, will use the default browser select instead, which is already
|
|
115
|
+
* highly optimized for accessibility.
|
|
116
|
+
* @param props the component props: {@link SelectProps}.
|
|
117
|
+
*/
|
|
118
|
+
export function Select({ onChange, options, value, emptyOption, renderLabel, renderValue, maxItems = 6, onFocus, onBlur, style, className, ...props }) {
|
|
119
|
+
const [open, setOpen] = useState(false);
|
|
120
|
+
const [focused, setFocused] = useState(false);
|
|
121
|
+
const valueLabelRef = useRef(null);
|
|
122
|
+
const onChangeOption = useCallback((event) => {
|
|
123
|
+
const value = options.find(o => renderProperty(o, renderValue) === event.target.value);
|
|
124
|
+
onChange(value);
|
|
125
|
+
}, []);
|
|
126
|
+
const onClickOutside = useCallback((event) => {
|
|
127
|
+
if (valueLabelRef.current && !valueLabelRef.current.contains(event.target))
|
|
128
|
+
setOpen(false);
|
|
129
|
+
}, []);
|
|
130
|
+
const [htmlOptions, fakeOptions] = useMemo(() => options.reduce(([opts, fake], o) => {
|
|
131
|
+
const id = renderProperty(o, renderValue);
|
|
132
|
+
const label = renderProperty(o, renderLabel);
|
|
133
|
+
return [
|
|
134
|
+
[...opts, _jsx("option", { value: id, selected: value === id, children: label }, id)],
|
|
135
|
+
[...fake, _jsx(FakeOption, { value: id, label: label, onChange: onChangeOption }, id)],
|
|
136
|
+
];
|
|
137
|
+
}, [[], []]), [options, value]);
|
|
138
|
+
const height = open ? (LIST_BOTTOM_PADDING + (options.length + (emptyOption === undefined ? 0 : 1)) * OPTION_HEIGHT) : 0;
|
|
139
|
+
function getCurrentValue() {
|
|
140
|
+
return value === undefined ? '' : renderProperty(value, renderValue);
|
|
141
|
+
}
|
|
142
|
+
function getCurrentLabel() {
|
|
143
|
+
return value === undefined ? (emptyOption ?? '') : renderProperty(value, renderLabel);
|
|
144
|
+
}
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
const detach = () => document.removeEventListener('mousedown', onClickOutside);
|
|
147
|
+
if (open)
|
|
148
|
+
document.addEventListener('mousedown', onClickOutside);
|
|
149
|
+
else
|
|
150
|
+
detach();
|
|
151
|
+
return detach;
|
|
152
|
+
}, [open]);
|
|
153
|
+
return (_jsxs(SelectBox, { style: style, className: className, "$maxItems": maxItems, children: [_jsxs("select", { ...props, value: getCurrentValue(), onChange: onChangeOption, onFocus: (ev) => {
|
|
154
|
+
setFocused(true);
|
|
155
|
+
onFocus?.(ev);
|
|
156
|
+
}, onBlur: (ev) => {
|
|
157
|
+
setFocused(false);
|
|
158
|
+
onBlur?.(ev);
|
|
159
|
+
}, children: [emptyOption === undefined ? null : _jsx("option", { value: "", selected: !value, children: emptyOption }), htmlOptions] }), _jsxs("div", { className: listToClass(['fake-select', open && 'open', focused && 'focused']), "aria-hidden": true, children: [_jsxs("div", { ref: valueLabelRef, className: "current-value", onClick: () => setOpen(!open), children: [_jsx(Text, { className: "clipped-text", children: getCurrentLabel() }), _jsx(IconBox, { className: "arrow", children: _jsx(ChevronDown, {}) })] }), _jsxs("ul", { className: "options", style: { height: `${height}px` }, children: [emptyOption === undefined ? null : _jsx(FakeOption, { value: "", label: emptyOption, onChange: onChangeOption }), fakeOptions] })] })] }));
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/form/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAuB,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AA+D1C,MAAM,aAAa,GAAG,EAAE,CAAA;AACxB,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAE7B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;;;;;;;;;;;;;;;wBAkB3B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;wBAGtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;0BAOpB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;8BACpB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAgDlC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,GAAG,aAAa,GAAG,mBAAmB;;;kBAGpE,aAAa;;;;;gCAKC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;8BAIxB,KAAK,CAAC,KAAK,CAAC,KAAK,CA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YAAG,WAAW,GAAU,EAC5F,WAAW,IACL,EACT,eAAK,SAAS,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,IAAI,IAAI,MAAM,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC,kCAChF,eAAK,GAAG,EAAE,aAAa,EAAE,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,aAC9E,KAAC,IAAI,IAAC,SAAS,EAAC,cAAc,YAAE,eAAe,EAAE,GAAQ,EACzD,KAAC,OAAO,IAAC,SAAS,EAAC,OAAO,YAAC,KAAC,WAAW,KAAG,GAAU,IAChD,EACN,cAAI,SAAS,EAAC,SAAS,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,aACrD,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,GAAI,EACxG,WAAW,IACT,IACD,IACI,CACb,CAAA;AACH,CAAC"}
|
|
@@ -21,9 +21,10 @@ interface Props {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* NotificationComponent component that renders the notifications panel.
|
|
24
|
-
* It
|
|
24
|
+
* It renders the notification icon and when clicked the notification modal is opened.
|
|
25
25
|
*
|
|
26
26
|
* @param props the component's props {@link Props}.
|
|
27
|
+
* @deprecated this functionality has been moved to the Layout library. This is now a property of the Header.
|
|
27
28
|
*/
|
|
28
29
|
export declare const NotificationComponent: ({ hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error, type, onUpdateType, onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage, placeholderComponent, isSummary, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAqC,MAAM,OAAO,CAAA;AAEvE,OAAO,EAAgB,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK1D,OAAO,EAAoB,uBAAuB,EAAE,qBAAqB,EAAc,MAAM,SAAS,CAAA;AAEtG,UAAU,KAAK;IACb,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAyID,UAAU,KAAK;IACb,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,CAAC;IACnG,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,UAAU,CAAC;IACzB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,uBAAuB,CAAC;IAC/B,YAAY,EAAE,CAAC,WAAW,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC9D,oBAAoB,EAAE,YAAY,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;CACpB;AAGD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,6NAK/B,KAAK,4CAqHP,CAAA"}
|
|
@@ -12,18 +12,24 @@ import { ScrollView } from '../ScrollView.js';
|
|
|
12
12
|
import { StatusCircle } from '../StatusCircle.js';
|
|
13
13
|
import { NotificationItem } from './NotificationItem.js';
|
|
14
14
|
import { NotificationType, UnreadType } from './types.js';
|
|
15
|
-
const
|
|
15
|
+
const ANIMATION_DURATION_MS = 300;
|
|
16
|
+
const MAX_HEIGHT_TRANSITION = `max-height ease-in ${ANIMATION_DURATION_MS / 1000}s`;
|
|
17
|
+
const NotificationsComponent = styled.div `
|
|
16
18
|
max-height: 0;
|
|
17
19
|
z-index: 2;
|
|
18
20
|
visibility: hidden;
|
|
19
21
|
position: absolute;
|
|
20
22
|
top: calc(var(--header-height) + 4px);
|
|
21
23
|
right: -270%;
|
|
24
|
+
opacity: 0;
|
|
22
25
|
width: 400px;
|
|
26
|
+
transition: ${MAX_HEIGHT_TRANSITION}, opacity ${ANIMATION_DURATION_MS}ms ease-in-out, visibility 0s ${ANIMATION_DURATION_MS}ms;
|
|
23
27
|
|
|
24
28
|
&.visible {
|
|
25
29
|
visibility: visible;
|
|
26
30
|
min-height: 400px;
|
|
31
|
+
opacity: 1;
|
|
32
|
+
transition: ${MAX_HEIGHT_TRANSITION}, opacity ${ANIMATION_DURATION_MS}ms ease-in-out;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
.content {
|
|
@@ -31,7 +37,7 @@ const NotificationsComponent = styled(Flex) `
|
|
|
31
37
|
border: 1px solid ${theme.color.light[400]};
|
|
32
38
|
box-shadow: 4px 4px 48px ${theme.color.danger.contrastText};
|
|
33
39
|
background-color: ${theme.color.light[300]};
|
|
34
|
-
overflow-y: ${({ $scroll }) => $scroll ? 'auto' : 'hidden'};
|
|
40
|
+
overflow-y: ${({ $scroll }) => ($scroll ? 'auto' : 'hidden')};
|
|
35
41
|
overflow-x: hidden;
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -82,11 +88,13 @@ const NotificationsFilter = ({ type, onChangeFilterType }) => {
|
|
|
82
88
|
const t = useTranslate(dictionary);
|
|
83
89
|
return (_jsxs(Flex, { alignItems: "center", sx: { gap: '4px' }, my: "5", children: [_jsx(Button, { "aria-pressed": !type, appearance: "text", role: "button", "aria-label": t.filterAll, onClick: () => onChangeFilterType(), sx: { borderColor: !type ? 'primary' : 'transparent' }, children: _jsx(Text, { colorScheme: "inverse", appearance: "microtext1", children: t.all }) }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterUnread, label: t.unread, enumType: UnreadType.Unread }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterHigh, label: t.high, enumType: NotificationType.High }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterMedium, label: t.medium, enumType: NotificationType.Medium }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterLow, label: t.low, enumType: NotificationType.Low })] }));
|
|
84
90
|
};
|
|
91
|
+
// fixme: remove this component in the next major
|
|
85
92
|
/**
|
|
86
93
|
* NotificationComponent component that renders the notifications panel.
|
|
87
|
-
* It
|
|
94
|
+
* It renders the notification icon and when clicked the notification modal is opened.
|
|
88
95
|
*
|
|
89
96
|
* @param props the component's props {@link Props}.
|
|
97
|
+
* @deprecated this functionality has been moved to the Layout library. This is now a property of the Header.
|
|
90
98
|
*/
|
|
91
99
|
export const NotificationComponent = ({ hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error, type, onUpdateType, onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage, placeholderComponent, isSummary = false, }) => {
|
|
92
100
|
const t = useTranslate(dictionary);
|
|
@@ -122,7 +130,7 @@ export const NotificationComponent = ({ hasUnreadNotification, onMarkAsReadUnrea
|
|
|
122
130
|
return (_jsxs(Flex, { sx: { position: 'relative' }, children: [_jsx(IconButton, { "aria-label": t.openNotifications, onClick: () => {
|
|
123
131
|
onClickViewNotifications();
|
|
124
132
|
setVisible(!visible);
|
|
125
|
-
}, sx: { border: 'none', bg: 'transparent' }, "aria-expanded": visible, children: _jsx(IconBox, { size: "md", className: "notificationsTour", children: _jsx(Bell, {}) }) }), hasUnreadNotification && _jsx(Box, { sx: { position: 'absolute', right: '2px' }, "aria-label": t.hasUnread, children: _jsx(StatusCircle, { status: 'danger' }) }), visible && _jsx(Overlay, { onClick: () => setVisible(false) }), _jsx(NotificationsComponent, { className: listToClass(['notification-
|
|
133
|
+
}, sx: { border: 'none', bg: 'transparent' }, "aria-expanded": visible, children: _jsx(IconBox, { size: "md", className: "notificationsTour", children: _jsx(Bell, {}) }) }), hasUnreadNotification && _jsx(Box, { sx: { position: 'absolute', right: '2px' }, "aria-label": t.hasUnread, children: _jsx(StatusCircle, { status: 'danger' }) }), visible && _jsx(Overlay, { onClick: () => setVisible(false) }), _jsx(NotificationsComponent, { className: listToClass(['notification-list', visible ? 'visible' : undefined]), "$scroll": true, "aria-hidden": !visible, children: _jsxs(Flex, { className: "content", p: 5, flexDirection: "column", justifyContent: "space-between", children: [_jsxs(Flex, { w: "100%", children: [_jsxs(Flex, { justifyContent: "space-between", w: "100%", children: [_jsx(Text, { appearance: "h4", children: t.notifications }), _jsx(IconButton, { onClick: () => setVisible(false), "aria-label": t.close, children: _jsx(IconBox, { size: "xs", children: _jsx(TimesMini, {}) }) })] }), _jsx(NotificationsFilter, { type: type, onChangeFilterType: updateType }), _jsx(AsyncContent, { error: error, errorDetails: errorDetails, loading: isLoading, children: notifications?.length ? _jsx(StyledBox, { children: _jsx(ScrollView, { id: "scrollableNotifications", direction: "vertical", style: { maxHeight: 'calc(100vh - 300px)' }, children: _jsx(InfiniteScroll, { dataLength: notifications?.length || 0, next: fetchNextPage, hasMore: hasNextPage, scrollableTarget: "scrollableNotifications", children: _jsx(Flex, { sx: { gap: '4px' }, mr: "3", flexDirection: "column", children: notifications?.map((item, index) => (_jsx(NotificationItem, { notification: item, id: `notificationItem-${index}`, isSummary: isSummary, onClickMarkReadUnread: (read, type) => onMarkAsReadUnread(item.id, read, type) }, item.id))) }) }) }) })
|
|
126
134
|
:
|
|
127
135
|
_jsx(_Fragment, { children: placeholderComponent }) })] }), _jsx(Flex, { w: "100%", pt: 3, children: _jsx(Button, { ref: seeAllButtonRef, size: "sm", sx: { width: '100%' }, colorScheme: "inverse", appearance: "text", onClick: () => {
|
|
128
136
|
setVisible(false);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationComponent.js","sourceRoot":"","sources":["../../../src/components/notification/NotificationComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAgB,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,YAAY,EAAc,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAkD,UAAU,EAAE,MAAM,SAAS,CAAA;AAMtG,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACjC,MAAM,qBAAqB,GAAG,sBAAsB,qBAAqB,GAAG,IAAI,GAAG,CAAA;AAEnF,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;;;;;;gBAShD,qBAAqB,aAAa,qBAAqB,iCAAiC,qBAAqB;;;;;;kBAM3G,qBAAqB,aAAa,qBAAqB;;;;;wBAKjD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;+BACf,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;wBACtC,KAAK,CAAC,KAAK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,WAAW;QACnB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO;QACf,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,2BAA2B;QACnC,iBAAiB,EAAE,yBAAyB;QAC5C,SAAS,EAAE,gCAAgC;QAC3C,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StackspotNotification } from './types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
notification: StackspotNotification;
|
|
4
|
+
isSummary: boolean;
|
|
5
|
+
id?: string;
|
|
6
|
+
}
|
|
7
|
+
interface DeprecatedNotificationItemProps extends Props {
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use `onCommit` and `onClickAction` instead.
|
|
10
|
+
*
|
|
11
|
+
* Function to call when the user marks a notification as read or unread. This can happen either through the mail icon or when the user
|
|
12
|
+
* clicks the action button of a notification. Type will be "icon" on the first case or "callToAction" on the former.
|
|
13
|
+
*
|
|
14
|
+
* Tip: clicking the action button (callToAction) should only change the read status if the message is unread. This is not treated by this
|
|
15
|
+
* component, be sure to handle it on your side.
|
|
16
|
+
*
|
|
17
|
+
* Deprecation warning: since the deprecation, the parameter `read` is always true.
|
|
18
|
+
*/
|
|
19
|
+
onClickMarkReadUnread: (read: boolean, type: 'callToAction' | 'icon') => void | Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
interface NewNotificationItemProps extends Props {
|
|
22
|
+
/**
|
|
23
|
+
* Function to call when the user marks a notification as read (committed).
|
|
24
|
+
*/
|
|
25
|
+
onCommit: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Whenever the user clicks the action button of a notification, the notification is marked as read (committed) and the browser is
|
|
28
|
+
* redirected to the page that corresponds to the action.
|
|
29
|
+
*
|
|
30
|
+
* If you need additional behavior, use this parameter, which is a function to call whenever the button is clicked.
|
|
31
|
+
*/
|
|
32
|
+
onClickAction?: () => void;
|
|
33
|
+
}
|
|
34
|
+
type NotificationItemProps = DeprecatedNotificationItemProps | NewNotificationItemProps;
|
|
35
|
+
/**
|
|
36
|
+
* NotificationItem component that renders a notification item.
|
|
37
|
+
*
|
|
38
|
+
* @param props the component's props {@link NotificationItemProps}.
|
|
39
|
+
*/
|
|
40
|
+
export declare const NotificationItem: ({ notification, isSummary, ...props }: NotificationItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=NotificationItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAe/C,UAAU,KAAK;IACb,YAAY,EAAE,qBAAqB,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IAEnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAgHD,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;CAC5B;AAED,KAAK,qBAAqB,GAAG,+BAA+B,GAAG,wBAAwB,CAAA;AAEvF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,0CAA2C,qBAAqB,4CAsC5F,CAAA"}
|
|
@@ -28,9 +28,9 @@ const style = {
|
|
|
28
28
|
/**
|
|
29
29
|
* NotificationHeader component that renders the header of a notification.
|
|
30
30
|
*
|
|
31
|
-
* @param props the component's props
|
|
31
|
+
* @param props the component's props.
|
|
32
32
|
*/
|
|
33
|
-
const NotificationHeader = ({
|
|
33
|
+
const NotificationHeader = ({ title, isSummary }) => (_jsx(Flex, { justifyContent: "space-between", mb: 2, sx: { maxWidth: isSummary ? '330px' : '100%' }, flexWrap: "nowrap", children: _jsx(Text, { appearance: isSummary ? 'body2' : 'body1', nowrapEllipsis: true, children: title }) }));
|
|
34
34
|
/**
|
|
35
35
|
* Get the number of days ago from the given date string.
|
|
36
36
|
*
|
|
@@ -58,21 +58,36 @@ const NotificationContent = ({ notification, isSummary }) => {
|
|
|
58
58
|
*
|
|
59
59
|
* @param props the component's props {@link NotificationFooterProps}.
|
|
60
60
|
*/
|
|
61
|
-
const NotificationFooter = ({
|
|
61
|
+
const NotificationFooter = ({ actionURL, onClickAction }) => {
|
|
62
62
|
const t = useTranslate(dictionary);
|
|
63
63
|
const Link = useAnchorTag();
|
|
64
|
-
return (_jsx(Flex, { mt: "5", children: _jsx(Button, { size: "sm", colorScheme: "inverse", onClick:
|
|
64
|
+
return (_jsx(Flex, { mt: "5", children: _jsx(Button, { size: "sm", colorScheme: "inverse", onClick: onClickAction, as: Link, href: actionURL, "aria-label": t.takeMeThere, children: _jsx(Text, { colorScheme: "inverse.contrastText", children: t.takeMeThere }) }) }));
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
67
67
|
* NotificationItem component that renders a notification item.
|
|
68
68
|
*
|
|
69
69
|
* @param props the component's props {@link NotificationItemProps}.
|
|
70
70
|
*/
|
|
71
|
-
export const NotificationItem = ({ notification, isSummary,
|
|
71
|
+
export const NotificationItem = ({ notification, isSummary, ...props }) => {
|
|
72
72
|
const t = useTranslate(dictionary);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
function commit() {
|
|
74
|
+
if ('onCommit' in props)
|
|
75
|
+
props.onCommit();
|
|
76
|
+
else
|
|
77
|
+
props.onClickMarkReadUnread(true, 'icon');
|
|
78
|
+
}
|
|
79
|
+
function clickAction() {
|
|
80
|
+
if ('onCommit' in props) {
|
|
81
|
+
if (!notification.committed)
|
|
82
|
+
props.onCommit();
|
|
83
|
+
props.onClickAction?.();
|
|
84
|
+
}
|
|
85
|
+
else
|
|
86
|
+
props.onClickMarkReadUnread(true, 'callToAction');
|
|
87
|
+
}
|
|
88
|
+
return (_jsxs(Box, { sx: { position: 'relative' }, children: [_jsxs(Flex, { bg: "light.400", p: "3 3 3 5", r: "xs", flexDirection: "column", w: "100%", sx: styles.item(statusToColor[notification.criticality], notification.committed), children: [_jsx(NotificationHeader, { title: notification.title, isSummary: isSummary }), _jsx(NotificationContent, { notification: notification, isSummary: isSummary }), notification.call_to_action && _jsx(NotificationFooter, { actionURL: notification.call_to_action, onClickAction: clickAction })] }), _jsx(Box, { sx: { position: 'absolute', top: '8px', right: '8px' }, children: _jsx(Tooltip, { text: notification.committed ? t.committed : t.uncommitted, position: "left", sx: style.tooltip, children: notification.committed
|
|
89
|
+
? _jsx(IconBox, { role: "img", "aria-label": t.committed, size: "xs", style: { margin: '4px', opacity: 0.5 }, children: _jsx(EnvelopeOpen, {}) })
|
|
90
|
+
: (_jsx(IconButton, { "aria-label": t.uncommitted, onClick: commit, children: _jsx(IconBox, { size: "xs", children: _jsx(Envelope, {}) }) })) }) })] }));
|
|
76
91
|
};
|
|
77
92
|
const dictionary = {
|
|
78
93
|
en: {
|
|
@@ -82,8 +97,8 @@ const dictionary = {
|
|
|
82
97
|
STUDIO: 'Studio',
|
|
83
98
|
daysAgo: 'days ago',
|
|
84
99
|
today: 'today',
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
committed: 'This notification has been read.',
|
|
101
|
+
uncommitted: 'This notification has not been read yet. Click to mark as read.',
|
|
87
102
|
},
|
|
88
103
|
pt: {
|
|
89
104
|
takeMeThere: 'Leve-me para lá',
|
|
@@ -92,8 +107,8 @@ const dictionary = {
|
|
|
92
107
|
STUDIO: 'Estúdio',
|
|
93
108
|
daysAgo: 'dias atrás',
|
|
94
109
|
today: 'hoje',
|
|
95
|
-
|
|
96
|
-
|
|
110
|
+
committed: 'Esta notificação já foi lida.',
|
|
111
|
+
uncommitted: 'Esta notificação ainda não foi lida. Clique para marcar como lida.',
|
|
97
112
|
},
|
|
98
113
|
};
|
|
99
114
|
//# sourceMappingURL=NotificationItem.js.map
|
|
@@ -0,0 +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,MAAM,eAAe,CAAA;AACtD,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,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;AASD,MAAM,KAAK,GAAW;IACpB,OAAO,EAAE;QACP,UAAU,EAAC;YACT,GAAG,EAAE,KAAK;SACX;KACF;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,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AM,EAAC,EAAE,EAAE,KAAK,CAAC,OAAO,YACnG,YAAY,CAAC,SAAS;wBACrB,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,KAAK,gBAAa,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAE,KAAC,YAAY,KAAG,GAAU;wBAC3H,CAAC,CAAC,CACA,KAAC,UAAU,kBAAa,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,YACpD,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,QAAQ,KAAG,GAAU,GAC9B,CACd,GAEK,GACN,IACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,kCAAkC;QAC7C,WAAW,EAAE,iEAAiE;KAC/E;IACD,EAAE,EAAE;QACF,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,+BAA+B;QAC1C,WAAW,EAAE,oEAAoE;KAClF;CACmB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InfiniteScrollConfig, StackspotNotification } from './types.js';
|
|
3
|
+
export interface NotificationListProps {
|
|
4
|
+
/**
|
|
5
|
+
* Function to call when the message is marked as read (committed).
|
|
6
|
+
* @param id the id of the notification where the read status changed.
|
|
7
|
+
*/
|
|
8
|
+
onCommit: (id: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Optional. Function called when the button to perform the notification action is clicked. This function will be run in addition to
|
|
11
|
+
* the notification action.
|
|
12
|
+
* @param id the id of the notification where the button was clicked
|
|
13
|
+
*/
|
|
14
|
+
onClickAction?: (id: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* If you need this notification list to be have an infinite scroll behavior, set this option.
|
|
17
|
+
*/
|
|
18
|
+
infiniteScroll?: InfiniteScrollConfig;
|
|
19
|
+
/**
|
|
20
|
+
* The notifications themselves.
|
|
21
|
+
*/
|
|
22
|
+
items: StackspotNotification[];
|
|
23
|
+
/**
|
|
24
|
+
* A compact notification list don't show date headers (as a timeline) or descriptions of notifications.
|
|
25
|
+
*/
|
|
26
|
+
compact?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether or not the content is loading. If this is true, the content becomes transparent and the cursor turns into the progress cursor.
|
|
29
|
+
*/
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If true, when the list is empty, the placeholder will say "nothing found" instead of "no notifications".
|
|
33
|
+
*/
|
|
34
|
+
showEmptySearch?: boolean;
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const NotificationList: ({ items, compact, onCommit, onClickAction, infiniteScroll, loading, showEmptySearch, style, className }: NotificationListProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=NotificationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationList.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationList.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAErE,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC;;OAEG;IACH,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuED,eAAO,MAAM,gBAAgB,4GACsF,qBAAqB,oDAgDvI,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex } from '@citric/core';
|
|
3
|
+
import { listToClass } from '@stack-spot/portal-theme';
|
|
4
|
+
import { last } from 'lodash';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { styled } from 'styled-components';
|
|
7
|
+
import { InfiniteScroll } from '../InfiniteScroll.js';
|
|
8
|
+
import { TimelineSection } from '../TimelineSection.js';
|
|
9
|
+
import { NotificationItem } from './NotificationItem.js';
|
|
10
|
+
import { NotificationPlaceholder } from './NotificationPlaceholder.js';
|
|
11
|
+
const StyledBox = styled(Box) `
|
|
12
|
+
width: 100%;
|
|
13
|
+
position: relative;
|
|
14
|
+
transition: opacity 0.3s;
|
|
15
|
+
|
|
16
|
+
> div:first-child{
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.loading {
|
|
21
|
+
opacity: 0.6;
|
|
22
|
+
.loading-mask {
|
|
23
|
+
pointer-events: auto;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.loading-mask {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
position: absolute;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
top: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
cursor: progress;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.placeholder.compact {
|
|
39
|
+
& > div {
|
|
40
|
+
padding-block: 0;
|
|
41
|
+
gap: 15px;
|
|
42
|
+
& > div {
|
|
43
|
+
text-align: center;
|
|
44
|
+
h4 {
|
|
45
|
+
margin-bottom: 10px;
|
|
46
|
+
}
|
|
47
|
+
p {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
// this assumes the data from the backend is ordered by date (trigger_at)
|
|
55
|
+
function groupNotificationsByDate(notifications) {
|
|
56
|
+
const groups = [];
|
|
57
|
+
for (const n of notifications) {
|
|
58
|
+
let currentGroup = last(groups);
|
|
59
|
+
const date = new Date(n.trigger_at);
|
|
60
|
+
const year = date.getFullYear();
|
|
61
|
+
const month = date.getMonth();
|
|
62
|
+
const day = date.getDate();
|
|
63
|
+
if (!currentGroup || currentGroup.day !== day || currentGroup.month !== month || currentGroup.year !== year) {
|
|
64
|
+
currentGroup = { year, month, day, items: [] };
|
|
65
|
+
groups.push(currentGroup);
|
|
66
|
+
}
|
|
67
|
+
currentGroup.items.push(n);
|
|
68
|
+
}
|
|
69
|
+
return groups;
|
|
70
|
+
}
|
|
71
|
+
export const NotificationList = ({ items, compact = false, onCommit, onClickAction, infiniteScroll, loading, showEmptySearch, style, className }) => {
|
|
72
|
+
const groups = useMemo(() => compact ? [{ day: 0, month: 0, year: 0, items }] : groupNotificationsByDate(items), [compact, items]);
|
|
73
|
+
const renderNotifications = (notifications, key) => (_jsx(Flex, { sx: { gap: '4px' }, flexDirection: "column", children: notifications?.map((item) => (_jsx(NotificationItem, { notification: item, isSummary: compact, onCommit: () => onCommit(item.id), onClickAction: () => onClickAction?.(item.id) }, item.id))) }, key));
|
|
74
|
+
return infiniteScroll?.scrollableTarget !== null && (_jsxs(StyledBox, { style: style, className: listToClass([className, loading && 'loading']), children: [items.length ? (_jsx(InfiniteScroll, { dataLength: items.length || 0, next: infiniteScroll?.loadMore ?? (() => { }), hasMore: infiniteScroll?.hasMore ?? false,
|
|
75
|
+
// @ts-ignore: the library is wrongly typed and abandoned, meaning, it will never be fixed. The source code clearly accepts
|
|
76
|
+
// HTMLElements as scrollable targets:
|
|
77
|
+
// https://github.com/ankeetmaini/react-infinite-scroll-component/blob/master/src/index.tsx#L168
|
|
78
|
+
scrollableTarget: infiniteScroll?.scrollableTarget, children: _jsx(Flex, { sx: { gap: '24px' }, flexDirection: "column", children: groups.map((group) => compact
|
|
79
|
+
? renderNotifications(group.items, 'compact')
|
|
80
|
+
: (_jsx(TimelineSection, { month: group.month, day: group.day, children: renderNotifications(group.items) }, `${group.day}-${group.month}-${group.year}`))) }) })) : _jsx(NotificationPlaceholder, { isSearch: showEmptySearch, className: listToClass(['placeholder', compact && 'compact']) }), _jsx("div", { className: "loading-mask" })] }));
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=NotificationList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationList.js","sourceRoot":"","sources":["../../../src/components/notification/NotificationList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB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cAAc,EAAE,gBAAgB,YAElD,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,aAAa,EAAC,QAAQ,YAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO;wBAC5B,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC;wBAC7C,CAAC,CAAC,CACA,KAAC,eAAe,IAAmD,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,YAClG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,IADb,GAAG,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAE/C,CACnB,CACF,GACI,GACQ,CAClB,CAAC,CAAC,CAAC,KAAC,uBAAuB,IAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC,GAAI,EACzH,cAAK,SAAS,EAAC,cAAc,GAAO,IAC1B,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
isSearch?: boolean;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
className?: string;
|
|
7
|
+
sx?: SxProperties;
|
|
8
|
+
sxCard?: SxProperties;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotificationPlaceholder: ({ isSearch, sx, sxCard, className, style }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=NotificationPlaceholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationPlaceholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,+CAAgD,KAAK,4CAYxF,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
+
import { PlaceholderCallToAction } from '../Placeholder.js';
|
|
4
|
+
export const NotificationPlaceholder = ({ isSearch, sx, sxCard, className, style }) => {
|
|
5
|
+
const t = useTranslate(dictionary);
|
|
6
|
+
return _jsx(PlaceholderCallToAction, { title: isSearch ? t.placeholderSearchTitle : t.placeholderTitle, description: isSearch ? t.placeholderSearchDescription : t.placeholderDescription, fullWidth: true, sx: sx, sxCard: sxCard, className: className, style: style });
|
|
7
|
+
};
|
|
8
|
+
const dictionary = {
|
|
9
|
+
en: {
|
|
10
|
+
placeholderTitle: 'No notifications',
|
|
11
|
+
placeholderDescription: 'Your notifications will appear here.',
|
|
12
|
+
placeholderSearchTitle: 'No notifications found',
|
|
13
|
+
placeholderSearchDescription: 'You can change the current filters in the fields above',
|
|
14
|
+
},
|
|
15
|
+
pt: {
|
|
16
|
+
placeholderTitle: 'Nenhuma notificação',
|
|
17
|
+
placeholderDescription: 'Suas notificações aparecerão aqui.',
|
|
18
|
+
placeholderSearchTitle: 'Nenhuma notificação encontrada',
|
|
19
|
+
placeholderSearchDescription: 'Você pode mudar os filtros aplicados nos campos acima',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=NotificationPlaceholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationPlaceholder.js","sourceRoot":"","sources":["../../../src/components/notification/NotificationPlaceholder.tsx"],"names":[],"mappings":";AACA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAUxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAS,EAAE,EAAE;IAC3F,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAElC,OAAO,KAAC,uBAAuB,IAC7B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAC/D,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,EACjF,SAAS,QACT,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,GACZ,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,gBAAgB,EAAE,kBAAkB;QACpC,sBAAsB,EAAE,sCAAsC;QAC9D,sBAAsB,EAAE,wBAAwB;QAChD,4BAA4B,EAAE,wDAAwD;KACvF;IACD,EAAE,EAAE;QACF,gBAAgB,EAAE,qBAAqB;QACvC,sBAAsB,EAAE,oCAAoC;QAC5D,sBAAsB,EAAE,gCAAgC;QACxD,4BAA4B,EAAE,uDAAuD;KACtF;CACmB,CAAA"}
|
|
@@ -35,4 +35,20 @@ export interface NotificationCommitted {
|
|
|
35
35
|
export declare enum UnreadType {
|
|
36
36
|
Unread = "unread"
|
|
37
37
|
}
|
|
38
|
+
export interface InfiniteScrollConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Function to load more items into the list. Called when the scroll is almost reaching its end.
|
|
41
|
+
*/
|
|
42
|
+
loadMore: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Set this to false to prevent the scroll from loading more items when it reaches the end.
|
|
45
|
+
*/
|
|
46
|
+
hasMore: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Defines which scroll will be used as the target of the infinite scroll.
|
|
49
|
+
*
|
|
50
|
+
* If null, nothing renders, it waits until it has a value.
|
|
51
|
+
*/
|
|
52
|
+
scrollableTarget?: string | HTMLElement | null;
|
|
53
|
+
}
|
|
38
54
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/notification/types.ts"],"names":[],"mappings":"AAEA,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAKD,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GAAG,UAAU,CAAA;AAEnE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;CACpB;AAID,oBAAY,UAAU;IACpB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CAChD"}
|