@pushwoosh/dumb-components 1.1.95 → 1.1.97

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.
@@ -1,5 +1 @@
1
- ;
2
- ;
3
- ;
4
- ;
5
1
  export {};
@@ -2,8 +2,9 @@ import React from 'react';
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
3
  import { NotificationIcon } from '@pushwoosh/kit-icons';
4
4
  import { NotificationBarButton, NotificationBarIcon, NotificationBarBadge, NotificationBarText, NotificationBarBadgeText } from './styles';
5
- function getIconView(isOpened, filled) {
6
- if (isOpened) return 'lined';
5
+ function getIconView(isOpened, filled, hasNotifications) {
6
+ if (isOpened && !hasNotifications) return 'lined';
7
+ if (isOpened) return 'filled';
7
8
  if (filled) return 'filled';
8
9
  return 'lined';
9
10
  }
@@ -15,7 +16,7 @@ export function NotificationBar({
15
16
  onClick,
16
17
  className
17
18
  }) {
18
- const showBadge = count > 0 && type !== 'no-notifications';
19
+ const hasNotifications = count > 0 && type !== 'no-notifications';
19
20
  const shouldUseFilledIcon = !isOpened && (!read && type !== 'no-notifications' || read);
20
21
  const getIconColor = () => {
21
22
  if (isOpened) return Color.CLEAR;
@@ -38,9 +39,9 @@ export function NotificationBar({
38
39
  }, React.createElement(NotificationBarIcon, null, React.createElement(NotificationIcon, {
39
40
  type: "enabled",
40
41
  size: "small",
41
- view: getIconView(isOpened, shouldUseFilledIcon),
42
+ view: getIconView(isOpened, shouldUseFilledIcon, hasNotifications),
42
43
  color: getIconColor()
43
- })), React.createElement(NotificationBarText, null, "Notification center"), showBadge && React.createElement(NotificationBarBadge, null, React.createElement(NotificationBarBadgeText, {
44
+ })), React.createElement(NotificationBarText, null, "Notification center"), hasNotifications && React.createElement(NotificationBarBadge, null, React.createElement(NotificationBarBadgeText, {
44
45
  "$variant": "h5"
45
46
  }, count)));
46
47
  }
@@ -6,7 +6,7 @@ import { useInfiniteScroll } from './useInfiniteScroll';
6
6
  import { Badge } from '../Badge';
7
7
  import { Spinner } from '../Spinner';
8
8
  import emptyNotificationsIcon from './assets/EmptyNotifications.svg?url';
9
- import { NotificationInboxContainer, NotificationInboxHeader, NotificationInboxTitle, NotificationInboxList, NotificationItem, NotificationIndicator, NotificationHeader, NotificationActionLink, NotificationInboxEmptyIcon, NotificationInboxLoadMore, NotificationInboxEmptyText } from './styles';
9
+ import { NotificationInboxContainer, NotificationInboxHeader, NotificationInboxTitle, NotificationInboxList, NotificationItem, NotificationIndicator, NotificationHeader, NotificationActionLink, NotificationInboxEmptyIcon, NotificationInboxEmptyText } from './styles';
10
10
  const severityToBadgeColorMap = {
11
11
  critical: 'red',
12
12
  warning: 'orange',
@@ -98,13 +98,15 @@ export function NotificationInbox({
98
98
  "$isRead": isRead
99
99
  }), React.createElement(Vertical, {
100
100
  "$gap": 8
101
- }, React.createElement(NotificationHeader, null, React.createElement(Horizontal, {
101
+ }, React.createElement(Vertical, null, React.createElement(NotificationHeader, null, React.createElement(Horizontal, {
102
102
  "$gap": 4,
103
103
  "$alignItems": "center"
104
104
  }, React.createElement(Text, {
105
105
  "$variant": "footnote",
106
106
  "$color": Color.LOCKED
107
- }, formatTimestamp(notification.timestamp)), notification.projectName && React.createElement(React.Fragment, null, React.createElement("span", null, "\u2022"), React.createElement(Text, {
107
+ }, formatTimestamp(notification.timestamp)), notification.projectName && React.createElement(React.Fragment, null, React.createElement(Text, {
108
+ "$color": Color.LOCKED
109
+ }, "\u2022"), React.createElement(Text, {
108
110
  "$variant": "footnote",
109
111
  "$color": Color.LOCKED
110
112
  }, notification.projectName))), (notification.severity === 'critical' || notification.severity === 'warning') && React.createElement(Badge, {
@@ -116,9 +118,10 @@ export function NotificationInbox({
116
118
  }, notification.title), notification.description && React.createElement(Text, {
117
119
  "$variant": "standard",
118
120
  "$color": Color.MAIN
119
- }, notification.description), (notification.actionButton || notification.expandButton) && React.createElement(Horizontal, {
120
- "$gap": 12,
121
- "$justifyContent": "start"
121
+ }, notification.description)), (notification.actionButton || notification.expandButton) && React.createElement(Horizontal, {
122
+ "$alignItems": "center",
123
+ "$justifyContent": "start",
124
+ "$gap": 12
122
125
  }, notification.actionButton && React.createElement(NotificationActionLink, {
123
126
  "$isPrimary": true,
124
127
  onClick: e => {
@@ -133,17 +136,24 @@ export function NotificationInbox({
133
136
  (_notification$expandB = notification.expandButton) === null || _notification$expandB === void 0 || _notification$expandB.onClick();
134
137
  }
135
138
  }, notification.expandButton.label))));
136
- }), hasMore && React.createElement(NotificationInboxLoadMore, {
139
+ }), hasMore && isLoading && React.createElement(Horizontal, {
137
140
  ref: loadMoreRef,
141
+ "$alignItems": "center",
142
+ "$justifyContent": "center",
143
+ "$padding": 16,
144
+ "$gap": 8
145
+ }, React.createElement(Spinner, {
146
+ size: "small",
147
+ color: Color.LOCKED
148
+ }), React.createElement(Text, {
138
149
  "$variant": "footnote",
139
- "$color": Color.PHANTOM
140
- }, isLoading ? React.createElement(Spinner, {
141
- size: "small"
142
- }) : 'Loading more...'), isLoading && notifications.length === 0 && !hasMore && React.createElement(Horizontal, {
150
+ "$color": Color.LOCKED
151
+ }, "Loading more\u2026")), isLoading && notifications.length === 0 && !hasMore && React.createElement(Horizontal, {
143
152
  "$justifyContent": "center",
144
153
  "$alignItems": "center",
145
154
  "$padding": "16px 0"
146
155
  }, React.createElement(Spinner, {
147
- size: "medium"
156
+ size: "medium",
157
+ color: Color.LOCKED
148
158
  }))));
149
159
  }
@@ -342,62 +342,6 @@ export declare const NotificationHeader: import("styled-components").StyledCompo
342
342
  } & {
343
343
  $gridAutoFlow: string;
344
344
  }, "$gridAutoFlow">;
345
- export declare const NotificationActions: import("styled-components").StyledComponent<"div", any, {
346
- $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
347
- $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
348
- $bgColor?: string | undefined;
349
- $border?: string | ({
350
- top?: string | undefined;
351
- right?: string | undefined;
352
- bottom?: string | undefined;
353
- left?: string | undefined;
354
- } | {
355
- horizontal: string;
356
- top?: string | undefined;
357
- bottom?: string | undefined;
358
- } | {
359
- vertical: string;
360
- right?: string | undefined;
361
- left?: string | undefined;
362
- }) | undefined;
363
- $borderRadius?: (string | number) | undefined;
364
- $boxShadow?: string | undefined;
365
- $gap?: (string | number) | undefined;
366
- $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
367
- $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
368
- $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
369
- $margin?: (string | number) | ({
370
- top?: (string | number) | undefined;
371
- right?: (string | number) | undefined;
372
- bottom?: (string | number) | undefined;
373
- left?: (string | number) | undefined;
374
- } | {
375
- horizontal: string | number;
376
- top?: (string | number) | undefined;
377
- bottom?: (string | number) | undefined;
378
- } | {
379
- vertical: string | number;
380
- right?: (string | number) | undefined;
381
- left?: (string | number) | undefined;
382
- }) | undefined;
383
- $padding?: (string | number) | ({
384
- top?: (string | number) | undefined;
385
- right?: (string | number) | undefined;
386
- bottom?: (string | number) | undefined;
387
- left?: (string | number) | undefined;
388
- } | {
389
- horizontal: string | number;
390
- top?: (string | number) | undefined;
391
- bottom?: (string | number) | undefined;
392
- } | {
393
- vertical: string | number;
394
- right?: (string | number) | undefined;
395
- left?: (string | number) | undefined;
396
- }) | undefined;
397
- $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
398
- } & {
399
- $gridAutoFlow: string;
400
- }, "$gridAutoFlow">;
401
345
  export declare const NotificationActionLink: import("styled-components").StyledComponent<"button", any, {
402
346
  $isPrimary?: boolean;
403
347
  }, never>;
@@ -408,12 +352,6 @@ export declare const NotificationInboxEmptyText: import("styled-components").Sty
408
352
  $ellipsis?: boolean | undefined;
409
353
  $variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
410
354
  }, never>;
411
- export declare const NotificationInboxLoadMore: import("styled-components").StyledComponent<"span", any, {
412
- $color?: string | undefined;
413
- $uppercase?: boolean | undefined;
414
- $ellipsis?: boolean | undefined;
415
- $variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
416
- }, never>;
417
355
  export declare const NotificationBarButton: import("styled-components").StyledComponent<"button", any, {
418
356
  $type: "important" | "warning" | "notifications" | "no-notifications";
419
357
  $isOpened: boolean;
@@ -32,31 +32,23 @@ export const NotificationHeader = styled(Horizontal).withConfig({
32
32
  displayName: "NotificationHeader",
33
33
  componentId: "sc-1nrene1-6"
34
34
  })(["justify-content:space-between;align-items:center;width:100%;gap:4px;height:20px;"]);
35
- export const NotificationActions = styled(Horizontal).withConfig({
36
- displayName: "NotificationActions",
37
- componentId: "sc-1nrene1-7"
38
- })(["gap:12px;margin-top:0;flex-wrap:wrap;justify-content:flex-start;width:100%;"]);
39
35
  export const NotificationActionLink = styled.button.withConfig({
40
36
  displayName: "NotificationActionLink",
41
- componentId: "sc-1nrene1-8"
37
+ componentId: "sc-1nrene1-7"
42
38
  })(["background:none;border:none;padding:0;margin:0;font-size:12px;font-family:", ";font-weight:", ";line-height:1.3;color:", ";text-decoration:none;text-transform:uppercase;cursor:pointer;transition:opacity 0.2s;white-space:nowrap;&:hover{opacity:0.8;}&:active{opacity:0.6;}"], FontFamily.MAIN, FontWeight.BOLD, ({
43
39
  $isPrimary
44
40
  }) => $isPrimary ? Color.PRIMARY : Color.SOFT);
45
41
  export const NotificationInboxEmptyIcon = styled.div.withConfig({
46
42
  displayName: "NotificationInboxEmptyIcon",
47
- componentId: "sc-1nrene1-9"
43
+ componentId: "sc-1nrene1-8"
48
44
  })(["width:120px;height:120px;display:flex;align-items:center;justify-content:center;color:", ";margin:0 auto;img{width:100%;height:100%;object-fit:contain;}"], Color.PHANTOM);
49
45
  export const NotificationInboxEmptyText = styled(Text).withConfig({
50
46
  displayName: "NotificationInboxEmptyText",
51
- componentId: "sc-1nrene1-10"
47
+ componentId: "sc-1nrene1-9"
52
48
  })(["text-align:center;"]);
53
- export const NotificationInboxLoadMore = styled(NotificationInboxEmptyText).withConfig({
54
- displayName: "NotificationInboxLoadMore",
55
- componentId: "sc-1nrene1-11"
56
- })(["padding:16px;"]);
57
49
  export const NotificationBarButton = styled.button.withConfig({
58
50
  displayName: "NotificationBarButton",
59
- componentId: "sc-1nrene1-12"
51
+ componentId: "sc-1nrene1-10"
60
52
  })(["display:flex;gap:8px;align-items:center;padding:8px 16px 8px 12px;width:260px;border:none;border-top:1px solid ", ";border-bottom:0;border-left:0;border-right:0;cursor:pointer;transition:background-color 0.2s,opacity 0.2s;background-color:", ";--icon-color:", ";--text-color:", ";--badge-bg:", ";--badge-text-color:", ";&:hover:not(:disabled){background-color:", ";--icon-color:", ";--text-color:", ";--badge-bg:", ";--badge-text-color:", ";}&:active:not(:disabled){opacity:0.5;--icon-color:", ";--text-color:", ";--badge-bg:", ";}"], Color.FORM, ({
61
53
  $type,
62
54
  $isOpened,
@@ -220,24 +212,24 @@ export const NotificationBarButton = styled.button.withConfig({
220
212
  });
221
213
  export const NotificationBarIcon = styled.div.withConfig({
222
214
  displayName: "NotificationBarIcon",
223
- componentId: "sc-1nrene1-13"
215
+ componentId: "sc-1nrene1-11"
224
216
  })(["width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center;transition:color 0.2s;color:var(--icon-color);"]);
225
217
  export const NotificationBarText = styled.div.withConfig({
226
218
  displayName: "NotificationBarText",
227
- componentId: "sc-1nrene1-14"
228
- })(["flex:1 0 0;font-size:", ";font-family:", ";font-weight:", ";line-height:1.4;transition:color 0.2s;color:var(--text-color);white-space:pre-wrap;"], FontSize.REGULAR, FontFamily.MAIN, FontWeight.MEDIUM);
219
+ componentId: "sc-1nrene1-12"
220
+ })(["display:flex;align-items:center;justify-content:start;flex:1 0 0;font-size:", ";font-family:", ";font-weight:", ";line-height:1.4;transition:color 0.2s;color:var(--text-color);white-space:pre-wrap;"], FontSize.REGULAR, FontFamily.MAIN, FontWeight.MEDIUM);
229
221
  export const NotificationBarBadge = styled.div.withConfig({
230
222
  displayName: "NotificationBarBadge",
231
- componentId: "sc-1nrene1-15"
223
+ componentId: "sc-1nrene1-13"
232
224
  })(["flex-shrink:0;transition:background-color 0.2s;background-color:var(--badge-bg);border-radius:", ";padding:2px 6px;display:flex;align-items:center;justify-content:center;"], ShapeRadius.CONTROL);
233
225
  export const NotificationBarBadgeText = styled(Text).withConfig({
234
226
  displayName: "NotificationBarBadgeText",
235
- componentId: "sc-1nrene1-16"
227
+ componentId: "sc-1nrene1-14"
236
228
  })(["text-transform:uppercase;transition:color 0.2s;color:var(--badge-text-color);"]);
237
229
  export const NotificationBellButton = styled.button.withConfig({
238
230
  displayName: "NotificationBellButton",
239
- componentId: "sc-1nrene1-17"
240
- })(["position:relative;width:36px;height:36px;padding:6px;border:none;background:", ";border-radius:", ";cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color 0.2s;color:", ";transition:background-color 0.2s,color 0.2s;&:hover:not(:disabled){background-color:", ";color:", ";}"], ({
231
+ componentId: "sc-1nrene1-15"
232
+ })(["position:relative;width:36px;height:36px;padding:6px;border:none;background:", ";border-radius:", ";cursor:pointer;display:flex;align-items:center;justify-content:center;color:", ";transition:background-color 0.2s,color 0.2s;&:hover:not(:disabled){background-color:", ";color:", ";}"], ({
241
233
  $isOpened
242
234
  }) => $isOpened ? Color.MAIN : 'transparent', ShapeRadius.CONTROL, ({
243
235
  $isOpened
@@ -248,11 +240,11 @@ export const NotificationBellButton = styled.button.withConfig({
248
240
  }) => $isOpened ? Color.CLEAR : Color.PRIMARY_HOVER);
249
241
  export const NotificationBellBadge = styled.div.withConfig({
250
242
  displayName: "NotificationBellBadge",
251
- componentId: "sc-1nrene1-18"
243
+ componentId: "sc-1nrene1-16"
252
244
  })(["position:absolute;right:4px;top:4px;z-index:1;"]);
253
245
  export const NotificationBellBadgeDot = styled.div.withConfig({
254
246
  displayName: "NotificationBellBadgeDot",
255
- componentId: "sc-1nrene1-19"
247
+ componentId: "sc-1nrene1-17"
256
248
  })(["background-color:", ";border-radius:100px;", " display:flex;align-items:center;justify-content:center;font-size:10px;font-family:", ";font-weight:", ";line-height:1;color:", ";white-space:nowrap;"], ({
257
249
  $color
258
250
  }) => $color, ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.95",
3
+ "version": "1.1.97",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",