@pushwoosh/dumb-components 1.1.134 → 1.1.136

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.
Files changed (217) hide show
  1. package/AccessForbidden/AccessForbidden.js +19 -5
  2. package/AccessForbidden/polyglot/index.d.ts +2 -0
  3. package/AccessForbidden/polyglot/index.js +10 -0
  4. package/AccessForbidden/polyglot/messages_en.d.ts +3 -0
  5. package/AccessForbidden/polyglot/messages_en.js +4 -0
  6. package/AccessForbidden/polyglot/messages_ru.d.ts +3 -0
  7. package/AccessForbidden/polyglot/messages_ru.js +4 -0
  8. package/AccessForbidden/polyglot/types.d.ts +5 -0
  9. package/AccessForbidden/polyglot/types.js +1 -0
  10. package/Alert/Alert.d.ts +1 -2
  11. package/Alert/Alert.js +31 -25
  12. package/ApplicationPreloader/ApplicationPreloader.d.ts +1 -2
  13. package/ApplicationPreloader/ApplicationPreloader.js +5 -4
  14. package/Badge/Badge.js +2 -2
  15. package/Banner/Banner.js +40 -24
  16. package/Button/Button.js +20 -9
  17. package/Button/RemoveButton.js +7 -6
  18. package/Calendar/CalendarDropdown/CalendarDropdown.js +121 -108
  19. package/Calendar/CalendarMonth/CalendarMonth.js +68 -66
  20. package/Calendar/CalendarMonthSlider/CalendarMonthSlider.d.ts +2 -2
  21. package/Calendar/CalendarMonthSlider/CalendarMonthSlider.js +68 -55
  22. package/Calendar/CalendarSuperForm/CalendarSuperForm.js +75 -70
  23. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.d.ts +2 -2
  24. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +3 -2
  25. package/Calendar/CalendarSuperForm/components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection.js +106 -88
  26. package/Calendar/CalendarSuperForm/components/CalendarTimeInput.d.ts +1 -2
  27. package/Calendar/CalendarSuperForm/components/CalendarTimeInput.js +2 -2
  28. package/Calendar/CalendarSuperForm/components/CalendarTimezoneSelect.js +3 -2
  29. package/CardMetric/CardChildren.js +9 -6
  30. package/CardMetric/CardCollapse.js +8 -6
  31. package/CardMetric/CardMetric.js +52 -33
  32. package/Checkbox/Checkbox.js +30 -24
  33. package/Chip/Chip.d.ts +6 -7
  34. package/Chip/Chip.js +22 -15
  35. package/CodeEditor/CodeEditor.d.ts +1 -2
  36. package/CodeEditor/CodeEditor.js +2 -2
  37. package/CrashScreen/CrashScreen.js +19 -6
  38. package/CrashScreen/polyglot/index.d.ts +2 -0
  39. package/CrashScreen/polyglot/index.js +10 -0
  40. package/CrashScreen/polyglot/messages_en.d.ts +3 -0
  41. package/CrashScreen/polyglot/messages_en.js +4 -0
  42. package/CrashScreen/polyglot/messages_ru.d.ts +3 -0
  43. package/CrashScreen/polyglot/messages_ru.js +4 -0
  44. package/CrashScreen/polyglot/types.d.ts +5 -0
  45. package/CrashScreen/polyglot/types.js +1 -0
  46. package/DateTimePicker/components/AutosizeInput/AutosizeInput.js +17 -13
  47. package/DateTimePicker/components/DatePicker/DatePicker.js +35 -32
  48. package/DateTimePicker/components/DatePickerField/DatePickerField.js +32 -22
  49. package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +22 -20
  50. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +30 -22
  51. package/DateTimePicker/components/DecadeView/DecadeView.js +19 -17
  52. package/DateTimePicker/components/Input/Input.js +2 -2
  53. package/DateTimePicker/components/Month/Month.js +52 -21
  54. package/DateTimePicker/components/MonthView/MonthView.js +21 -17
  55. package/DateTimePicker/components/NumberPicker/NumberPicker.js +49 -40
  56. package/DateTimePicker/components/PickerPlate/PickerPlate.js +17 -14
  57. package/DateTimePicker/components/YearView/YearView.js +22 -18
  58. package/DateTimePicker/polyglot/index.d.ts +2 -0
  59. package/DateTimePicker/polyglot/index.js +9 -0
  60. package/DateTimePicker/polyglot/messages_en.d.ts +3 -0
  61. package/DateTimePicker/polyglot/messages_en.js +11 -0
  62. package/DateTimePicker/polyglot/messages_ru.d.ts +3 -0
  63. package/DateTimePicker/polyglot/messages_ru.js +11 -0
  64. package/DateTimePicker/polyglot/types.d.ts +12 -0
  65. package/DateTimePicker/polyglot/types.js +1 -0
  66. package/Drawer/components/Drawer/Drawer.js +18 -13
  67. package/Drawer/components/Drawer/styles.d.ts +2 -2
  68. package/Drawer/components/Drawer/styles.js +5 -4
  69. package/Drawer/components/DrawerDocs/DrawerDocs.js +28 -17
  70. package/Drawer/polyglot/index.d.ts +2 -0
  71. package/Drawer/polyglot/index.js +10 -0
  72. package/Drawer/polyglot/messages_en.d.ts +3 -0
  73. package/Drawer/polyglot/messages_en.js +4 -0
  74. package/Drawer/polyglot/messages_ru.d.ts +3 -0
  75. package/Drawer/polyglot/messages_ru.js +4 -0
  76. package/Drawer/polyglot/types.d.ts +5 -0
  77. package/Drawer/polyglot/types.js +1 -0
  78. package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +28 -24
  79. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -6
  80. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +6 -4
  81. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +13 -10
  82. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +40 -31
  83. package/EditableField/EditableField.js +56 -39
  84. package/EditableField/polyglot/index.d.ts +2 -0
  85. package/EditableField/polyglot/index.js +9 -0
  86. package/EditableField/polyglot/messages_en.d.ts +3 -0
  87. package/EditableField/polyglot/messages_en.js +4 -0
  88. package/EditableField/polyglot/messages_ru.d.ts +3 -0
  89. package/EditableField/polyglot/messages_ru.js +4 -0
  90. package/EditableField/polyglot/types.d.ts +5 -0
  91. package/EditableField/polyglot/types.js +1 -0
  92. package/EmailTemplatePreview/EmailTemplatePreview.js +10 -8
  93. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +30 -16
  94. package/EmailTemplatePreview/polyglot/index.d.ts +2 -0
  95. package/EmailTemplatePreview/polyglot/index.js +10 -0
  96. package/EmailTemplatePreview/polyglot/messages_en.d.ts +3 -0
  97. package/EmailTemplatePreview/polyglot/messages_en.js +5 -0
  98. package/EmailTemplatePreview/polyglot/messages_ru.d.ts +3 -0
  99. package/EmailTemplatePreview/polyglot/messages_ru.js +5 -0
  100. package/EmailTemplatePreview/polyglot/types.d.ts +6 -0
  101. package/EmailTemplatePreview/polyglot/types.js +1 -0
  102. package/EnhancedInput/EnhancedInput.d.ts +3 -4
  103. package/EnhancedInput/EnhancedInput.js +14 -10
  104. package/EnhancedInput/SearchInput.js +3 -3
  105. package/ExportResult/ExportResult.js +33 -23
  106. package/ExternalImagePreview/ExternalImagePreview.js +24 -20
  107. package/FieldBox/FieldBox.js +50 -37
  108. package/FrequencyCapping/FrequencyCappingEdit.js +41 -33
  109. package/FrequencyCapping/FrequencyCappingInApps.js +41 -33
  110. package/FrequencyCapping/FrequencyCappingReadonly.d.ts +1 -2
  111. package/FrequencyCapping/FrequencyCappingReadonly.js +24 -20
  112. package/FrequencyCapping/components/Condition/index.d.ts +1 -2
  113. package/FrequencyCapping/components/Condition/index.js +24 -20
  114. package/FrequencyCapping/components/Description/index.d.ts +2 -2
  115. package/FrequencyCapping/components/Description/index.js +7 -5
  116. package/FrequencyCapping/components/Settings/EditCappingSettings.js +28 -20
  117. package/FrequencyCapping/components/Settings/EditInAppCappingSettings.js +86 -71
  118. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +1 -2
  119. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +41 -32
  120. package/GetStartedPage/GetStartedPage.js +44 -25
  121. package/InputFile/InputFile.js +44 -35
  122. package/Link/Link.js +2 -2
  123. package/Modal/components/Modal/Modal.js +17 -12
  124. package/Modal/components/Modal/styles.js +5 -4
  125. package/Modal/components/ModalConfirm/ModalConfirm.js +51 -24
  126. package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +2 -2
  127. package/Modal/components/ModalConfirm/ModalConfirmProvider.js +8 -6
  128. package/Modal/components/ModalConfirm/types.d.ts +1 -1
  129. package/Modal/components/ModalTitle/ModalTitle.js +10 -8
  130. package/Modal/polyglot/index.d.ts +2 -0
  131. package/Modal/polyglot/index.js +9 -0
  132. package/Modal/polyglot/messages_en.d.ts +3 -0
  133. package/Modal/polyglot/messages_en.js +6 -0
  134. package/Modal/polyglot/messages_ru.d.ts +3 -0
  135. package/Modal/polyglot/messages_ru.js +6 -0
  136. package/Modal/polyglot/types.d.ts +7 -0
  137. package/Modal/polyglot/types.js +1 -0
  138. package/NotificationInbox/NotificationBar.js +19 -11
  139. package/NotificationInbox/NotificationBell.js +21 -12
  140. package/NotificationInbox/NotificationInbox.js +160 -105
  141. package/NotificationInbox/polyglot/index.d.ts +2 -0
  142. package/NotificationInbox/polyglot/index.js +10 -0
  143. package/NotificationInbox/polyglot/messages_en.d.ts +3 -0
  144. package/NotificationInbox/polyglot/messages_en.js +8 -0
  145. package/NotificationInbox/polyglot/messages_ru.d.ts +3 -0
  146. package/NotificationInbox/polyglot/messages_ru.js +8 -0
  147. package/NotificationInbox/polyglot/types.d.ts +11 -0
  148. package/NotificationInbox/polyglot/types.js +1 -0
  149. package/NumberPicker/NumberPicker.js +53 -44
  150. package/NumberPicker/components/AutosizeInput/AutosizeInput.js +19 -15
  151. package/PageHeader/components/AutosizeInput/AutosizeInput.js +30 -22
  152. package/PageHeader/components/PageHeader/PageHeader.js +44 -27
  153. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +51 -34
  154. package/PageHeader/components/PageHeaderError/PageHeaderError.js +17 -10
  155. package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.js +20 -16
  156. package/Pagination/Pagination.js +60 -49
  157. package/Popover/Popover.js +6 -5
  158. package/ProgressBar/ProgressBar.js +25 -10
  159. package/PushPreview/PushPreview.js +30 -22
  160. package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +23 -11
  161. package/PushPreview/components/SilentPushPreview/SilentPushPreview.js +20 -13
  162. package/PushPreview/polyglot/index.d.ts +2 -0
  163. package/PushPreview/polyglot/index.js +9 -0
  164. package/PushPreview/polyglot/messages_en.d.ts +3 -0
  165. package/PushPreview/polyglot/messages_en.js +4 -0
  166. package/PushPreview/polyglot/messages_ru.d.ts +3 -0
  167. package/PushPreview/polyglot/messages_ru.js +4 -0
  168. package/PushPreview/polyglot/types.d.ts +5 -0
  169. package/PushPreview/polyglot/types.js +1 -0
  170. package/Radio/Radio.js +32 -26
  171. package/RadioCard/RadioCard.js +17 -9
  172. package/ReCaptcha/ReCaptcha.js +2 -2
  173. package/RichMessageEditor/EditorEmojiPicker.js +9 -7
  174. package/RichMessageEditor/RichMessageEditor.js +77 -67
  175. package/RichMessageEditor/RichMessageViewer.js +19 -13
  176. package/RichMessageEditor/slate/DynamicContentElement.d.ts +1 -2
  177. package/RichMessageEditor/slate/DynamicContentElement.js +13 -9
  178. package/RichMessageEditor/slate/SlateEditor.js +9 -7
  179. package/RichmediaPreview/RichmediaPreview.js +13 -11
  180. package/Select/Select.js +10 -8
  181. package/SendRate/SendRateEdit.d.ts +1 -2
  182. package/SendRate/SendRateEdit.js +42 -34
  183. package/SendRate/SendRateReadonly.d.ts +1 -2
  184. package/SendRate/SendRateReadonly.js +24 -20
  185. package/SendRate/components/Condition/index.d.ts +1 -2
  186. package/SendRate/components/Condition/index.js +15 -13
  187. package/SendRate/components/Description/index.d.ts +2 -2
  188. package/SendRate/components/Description/index.js +30 -22
  189. package/SendRate/components/Settings/index.d.ts +1 -2
  190. package/SendRate/components/Settings/index.js +20 -14
  191. package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +1 -2
  192. package/SendRate/helpers/getReadonlySendRateHelpers.js +39 -30
  193. package/Skeleton/TextSkeleton.js +5 -4
  194. package/SortButton/SortButton.js +11 -7
  195. package/Spinner/Spinner.js +7 -4
  196. package/StatisticCard/StatisticCard.js +44 -29
  197. package/Switch/Switch.js +16 -13
  198. package/Tabs/components/Tab/Tab.d.ts +3 -4
  199. package/Tabs/components/Tab/Tab.js +6 -4
  200. package/Tabs/components/TabBar/TabBar.d.ts +3 -4
  201. package/Tabs/components/TabBar/TabBar.js +12 -4
  202. package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.d.ts +1 -2
  203. package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.js +27 -21
  204. package/Tabs/components/TabBase/TabBase.d.ts +3 -4
  205. package/Tabs/components/TabBase/TabBase.js +11 -6
  206. package/Tabs/components/TabPanel/TabPanel.js +4 -2
  207. package/Tabs/components/Tabs/Tabs.js +8 -4
  208. package/Toast/Toast.js +31 -18
  209. package/Toast/ToastProvider.d.ts +2 -3
  210. package/Toast/ToastProvider.js +10 -8
  211. package/Tooltip/Tooltip.js +2 -2
  212. package/Tooltip/TooltipTrigger.js +13 -11
  213. package/package.json +2 -2
  214. package/polyglot/__tests__/render.test.js +46 -16
  215. package/polyglot/liquid/render.d.ts +2 -2
  216. package/polyglot/liquid/render.js +7 -6
  217. package/polyglot/react.js +7 -5
@@ -1,6 +1,7 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
3
  import { NotificationIcon } from '@pushwoosh/kit-icons';
4
+ import { useLang } from './polyglot';
4
5
  import { NotificationBellButton, NotificationBellBadge, NotificationBellBadgeDot } from './styles';
5
6
  export function NotificationBell({
6
7
  count = 0,
@@ -8,6 +9,7 @@ export function NotificationBell({
8
9
  isOpened = false,
9
10
  onClick
10
11
  }) {
12
+ const lang = useLang();
11
13
  const hasNotifications = count > 0;
12
14
  const showBadge = hasNotifications || severity;
13
15
  const getBadgeColor = () => {
@@ -16,18 +18,25 @@ export function NotificationBell({
16
18
  if (severity === 'warning') return Color.WARNING;
17
19
  return Color.PRIMARY;
18
20
  };
19
- return React.createElement(NotificationBellButton, {
21
+ return _jsxs(NotificationBellButton, {
20
22
  "$isOpened": isOpened,
21
23
  onClick: onClick,
22
24
  type: "button",
23
- "aria-label": hasNotifications ? 'You have unread notifications' : 'Notifications'
24
- }, React.createElement(NotificationIcon, {
25
- size: "medium",
26
- type: "enabled",
27
- view: isOpened ? 'filled' : 'lined',
28
- color: "currentColor"
29
- }), showBadge && React.createElement(NotificationBellBadge, null, React.createElement(NotificationBellBadgeDot, {
30
- "$color": getBadgeColor(),
31
- "$isDot": true
32
- })));
25
+ "aria-label": hasNotifications ? lang({
26
+ message: 'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD'
27
+ }) : lang({
28
+ message: 'DUMB.NOTIFICATION_INBOX.TITLE'
29
+ }),
30
+ children: [_jsx(NotificationIcon, {
31
+ size: "medium",
32
+ type: "enabled",
33
+ view: isOpened ? 'filled' : 'lined',
34
+ color: "currentColor"
35
+ }), showBadge && _jsx(NotificationBellBadge, {
36
+ children: _jsx(NotificationBellBadgeDot, {
37
+ "$color": getBadgeColor(),
38
+ "$isDot": true
39
+ })
40
+ })]
41
+ });
33
42
  }
@@ -1,4 +1,5 @@
1
- import React, { useRef, useState, useLayoutEffect, useCallback } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useRef, useState, useLayoutEffect, useCallback } from 'react';
2
3
  import { Color } from '@pushwoosh/kit-constants';
3
4
  import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
4
5
  import { Text } from '@pushwoosh/kit-typography';
@@ -8,6 +9,7 @@ import { useInfiniteScroll } from './useInfiniteScroll';
8
9
  import { Badge } from '../Badge';
9
10
  import { Spinner } from '../Spinner';
10
11
  import emptyNotificationsIcon from './assets/EmptyNotifications.svg?url';
12
+ import { Lang } from './polyglot';
11
13
  import { NotificationInboxContainer, NotificationInboxHeader, NotificationInboxTitle, NotificationInboxList, NotificationItem, NotificationIndicator, NotificationHeader, NotificationDescription, NotificationActionLink, NotificationInboxEmptyIcon, NotificationInboxEmptyText } from './styles';
12
14
  export function NotificationInbox({
13
15
  notifications,
@@ -48,109 +50,162 @@ export function NotificationInbox({
48
50
  setShowExpandMap(newMap);
49
51
  }, [notifications]);
50
52
  if (notifications.length === 0 && !isLoading) {
51
- return React.createElement(NotificationInboxContainer, null, React.createElement(NotificationInboxHeader, null, React.createElement(NotificationInboxTitle, {
52
- "$variant": "h4",
53
- "$color": Color.MAIN
54
- }, "Notifications")), React.createElement(Vertical, {
55
- "$alignItems": "center",
56
- "$gap": 24,
57
- "$padding": "24px"
58
- }, React.createElement(NotificationInboxEmptyIcon, {
59
- alt: emptyStateTitle,
60
- src: emptyNotificationsIcon
61
- }), React.createElement(Vertical, {
62
- "$alignItems": "center",
63
- "$gap": 6,
64
- "$padding": "24px",
65
- "$justifyContent": "center",
66
- "$justifyItems": "center",
67
- "$alignContent": "center"
68
- }, React.createElement(NotificationInboxEmptyText, {
69
- "$variant": "h4",
70
- "$color": Color.LOCKED
71
- }, emptyStateTitle), React.createElement(NotificationInboxEmptyText, {
72
- "$variant": "footnote",
73
- "$color": Color.LOCKED
74
- }, emptyStateDescription))));
53
+ return _jsxs(NotificationInboxContainer, {
54
+ children: [_jsx(NotificationInboxHeader, {
55
+ children: _jsx(NotificationInboxTitle, {
56
+ "$variant": "h4",
57
+ "$color": Color.MAIN,
58
+ children: _jsx(Lang, {
59
+ message: "DUMB.NOTIFICATION_INBOX.TITLE"
60
+ })
61
+ })
62
+ }), _jsxs(Vertical, {
63
+ "$alignItems": "center",
64
+ "$gap": 24,
65
+ "$padding": "24px",
66
+ children: [_jsx(NotificationInboxEmptyIcon, {
67
+ alt: emptyStateTitle,
68
+ src: emptyNotificationsIcon
69
+ }), _jsxs(Vertical, {
70
+ "$alignItems": "center",
71
+ "$gap": 6,
72
+ "$padding": "24px",
73
+ "$justifyContent": "center",
74
+ "$justifyItems": "center",
75
+ "$alignContent": "center",
76
+ children: [_jsx(NotificationInboxEmptyText, {
77
+ "$variant": "h4",
78
+ "$color": Color.LOCKED,
79
+ children: emptyStateTitle
80
+ }), _jsx(NotificationInboxEmptyText, {
81
+ "$variant": "footnote",
82
+ "$color": Color.LOCKED,
83
+ children: emptyStateDescription
84
+ })]
85
+ })]
86
+ })]
87
+ });
75
88
  }
76
- return React.createElement(NotificationInboxContainer, null, React.createElement(NotificationInboxHeader, null, React.createElement(NotificationInboxTitle, {
77
- "$variant": "h4",
78
- "$color": Color.MAIN
79
- }, React.createElement("span", null, "Notifications"), unreadCount > 0 && React.createElement(React.Fragment, null, ' ', React.createElement(Text, {
80
- "$variant": "h4",
81
- "$color": Color.LOCKED
82
- }, unreadCount, ' ', "unread")))), React.createElement(NotificationInboxList, {
83
- "data-notification-list": true
84
- }, notifications.map(notification => {
85
- const isRead = notification.isRead ?? false;
86
- const badgeColor = badgeColorMap[notification.severity] || 'gray';
87
- const showExpandButton = showExpandMap[notification.id] ?? false;
88
- return React.createElement(NotificationItem, {
89
- key: notification.id,
90
- onClick: () => handleNotificationClick(notification)
91
- }, React.createElement(NotificationIndicator, {
92
- "$isRead": isRead
93
- }), React.createElement(Vertical, {
94
- "$gap": 8
95
- }, React.createElement(Vertical, null, React.createElement(NotificationHeader, null, React.createElement(Horizontal, {
96
- "$gap": 4,
97
- "$alignItems": "center"
98
- }, React.createElement(Text, {
99
- "$variant": "footnote",
100
- "$color": Color.LOCKED
101
- }, formatTimestamp(notification.timestamp)), notification.projectName && React.createElement(React.Fragment, null, React.createElement(Text, {
102
- "$color": Color.LOCKED
103
- }, "\u2022"), React.createElement(Text, {
104
- "$variant": "footnote",
105
- "$color": Color.LOCKED
106
- }, notification.projectName))), (notification.severity === 'critical' || notification.severity === 'warning') && React.createElement(Badge, {
107
- color: badgeColor,
108
- isSaturated: false
109
- }, notification.severity.toUpperCase())), React.createElement(Text, {
110
- "$variant": "h4",
111
- "$color": Color.MAIN
112
- }, notification.title), notification.description && React.createElement(NotificationDescription, {
113
- as: "div",
114
- ref: element => descriptionRefs.current[notification.id] = element || null,
115
- "$variant": "standard",
116
- "$color": Color.MAIN,
117
- "$visibleLines": VISIBLE_LINES,
118
- "$expanded": expandedId === notification.id
119
- }, notification.description)), (notification.actionButton || showExpandButton) && React.createElement(Horizontal, {
120
- "$alignItems": "center",
121
- "$justifyContent": "start",
122
- "$gap": 12
123
- }, notification.actionButton && React.createElement(NotificationActionLink, {
124
- "$isPrimary": true,
125
- onClick: e => {
126
- var _notification$actionB;
127
- e.stopPropagation();
128
- (_notification$actionB = notification.actionButton) === null || _notification$actionB === void 0 || _notification$actionB.onClick();
129
- }
130
- }, notification.actionButton.label), showExpandButton && React.createElement(NotificationActionLink, {
131
- onClick: e => {
132
- e.stopPropagation();
133
- setExpandedId(prev => prev === notification.id ? null : notification.id);
134
- }
135
- }, expandedId === notification.id ? 'Collapse' : 'Expand'))));
136
- }), hasMore && isLoading && React.createElement(Horizontal, {
137
- ref: loadMoreRef,
138
- "$alignItems": "center",
139
- "$justifyContent": "center",
140
- "$padding": 16,
141
- "$gap": 8
142
- }, React.createElement(Spinner, {
143
- size: "small",
144
- color: Color.LOCKED
145
- }), React.createElement(Text, {
146
- "$variant": "footnote",
147
- "$color": Color.LOCKED
148
- }, "Loading more\u2026")), isLoading && notifications.length === 0 && !hasMore && React.createElement(Horizontal, {
149
- "$justifyContent": "center",
150
- "$alignItems": "center",
151
- "$padding": "16px 0"
152
- }, React.createElement(Spinner, {
153
- size: "medium",
154
- color: Color.LOCKED
155
- }))));
89
+ return _jsxs(NotificationInboxContainer, {
90
+ children: [_jsx(NotificationInboxHeader, {
91
+ children: _jsxs(NotificationInboxTitle, {
92
+ "$variant": "h4",
93
+ "$color": Color.MAIN,
94
+ children: [_jsx("span", {
95
+ children: _jsx(Lang, {
96
+ message: "DUMB.NOTIFICATION_INBOX.TITLE"
97
+ })
98
+ }), unreadCount > 0 && _jsxs(_Fragment, {
99
+ children: [' ', _jsx(Text, {
100
+ "$variant": "h4",
101
+ "$color": Color.LOCKED,
102
+ children: _jsx(Lang, {
103
+ message: "DUMB.NOTIFICATION_INBOX.UNREAD",
104
+ count: unreadCount
105
+ })
106
+ })]
107
+ })]
108
+ })
109
+ }), _jsxs(NotificationInboxList, {
110
+ "data-notification-list": true,
111
+ children: [notifications.map(notification => {
112
+ const isRead = notification.isRead ?? false;
113
+ const badgeColor = badgeColorMap[notification.severity] || 'gray';
114
+ const showExpandButton = showExpandMap[notification.id] ?? false;
115
+ return _jsxs(NotificationItem, {
116
+ onClick: () => handleNotificationClick(notification),
117
+ children: [_jsx(NotificationIndicator, {
118
+ "$isRead": isRead
119
+ }), _jsxs(Vertical, {
120
+ "$gap": 8,
121
+ children: [_jsxs(Vertical, {
122
+ children: [_jsxs(NotificationHeader, {
123
+ children: [_jsxs(Horizontal, {
124
+ "$gap": 4,
125
+ "$alignItems": "center",
126
+ children: [_jsx(Text, {
127
+ "$variant": "footnote",
128
+ "$color": Color.LOCKED,
129
+ children: formatTimestamp(notification.timestamp)
130
+ }), notification.projectName && _jsxs(_Fragment, {
131
+ children: [_jsx(Text, {
132
+ "$color": Color.LOCKED,
133
+ children: "\u2022"
134
+ }), _jsx(Text, {
135
+ "$variant": "footnote",
136
+ "$color": Color.LOCKED,
137
+ children: notification.projectName
138
+ })]
139
+ })]
140
+ }), (notification.severity === 'critical' || notification.severity === 'warning') && _jsx(Badge, {
141
+ color: badgeColor,
142
+ isSaturated: false,
143
+ children: notification.severity.toUpperCase()
144
+ })]
145
+ }), _jsx(Text, {
146
+ "$variant": "h4",
147
+ "$color": Color.MAIN,
148
+ children: notification.title
149
+ }), notification.description && _jsx(NotificationDescription, {
150
+ as: "div",
151
+ ref: element => descriptionRefs.current[notification.id] = element || null,
152
+ "$variant": "standard",
153
+ "$color": Color.MAIN,
154
+ "$visibleLines": VISIBLE_LINES,
155
+ "$expanded": expandedId === notification.id,
156
+ children: notification.description
157
+ })]
158
+ }), (notification.actionButton || showExpandButton) && _jsxs(Horizontal, {
159
+ "$alignItems": "center",
160
+ "$justifyContent": "start",
161
+ "$gap": 12,
162
+ children: [notification.actionButton && _jsx(NotificationActionLink, {
163
+ "$isPrimary": true,
164
+ onClick: e => {
165
+ var _notification$actionB;
166
+ e.stopPropagation();
167
+ (_notification$actionB = notification.actionButton) === null || _notification$actionB === void 0 || _notification$actionB.onClick();
168
+ },
169
+ children: notification.actionButton.label
170
+ }), showExpandButton && _jsx(NotificationActionLink, {
171
+ onClick: e => {
172
+ e.stopPropagation();
173
+ setExpandedId(prev => prev === notification.id ? null : notification.id);
174
+ },
175
+ children: expandedId === notification.id ? _jsx(Lang, {
176
+ message: "DUMB.NOTIFICATION_INBOX.COLLAPSE"
177
+ }) : _jsx(Lang, {
178
+ message: "DUMB.NOTIFICATION_INBOX.EXPAND"
179
+ })
180
+ })]
181
+ })]
182
+ })]
183
+ }, notification.id);
184
+ }), hasMore && isLoading && _jsxs(Horizontal, {
185
+ ref: loadMoreRef,
186
+ "$alignItems": "center",
187
+ "$justifyContent": "center",
188
+ "$padding": 16,
189
+ "$gap": 8,
190
+ children: [_jsx(Spinner, {
191
+ size: "small",
192
+ color: Color.LOCKED
193
+ }), _jsx(Text, {
194
+ "$variant": "footnote",
195
+ "$color": Color.LOCKED,
196
+ children: _jsx(Lang, {
197
+ message: "DUMB.NOTIFICATION_INBOX.LOADING_MORE"
198
+ })
199
+ })]
200
+ }), isLoading && notifications.length === 0 && !hasMore && _jsx(Horizontal, {
201
+ "$justifyContent": "center",
202
+ "$alignItems": "center",
203
+ "$padding": "16px 0",
204
+ children: _jsx(Spinner, {
205
+ size: "medium",
206
+ color: Color.LOCKED
207
+ })
208
+ })]
209
+ })]
210
+ });
156
211
  }
@@ -0,0 +1,2 @@
1
+ import { type NotificationInboxMessages } from './types';
2
+ export declare const Lang: import("react").FC<import("../../polyglot").LangProps<NotificationInboxMessages>>, useLang: () => (props: import("../../polyglot").LangProps<NotificationInboxMessages>) => string;
@@ -0,0 +1,10 @@
1
+ import { messages as en } from './messages_en';
2
+ import { messages as ru } from './messages_ru';
3
+ import { createLang } from '../../polyglot';
4
+ export const {
5
+ Lang,
6
+ useLang
7
+ } = createLang({
8
+ en,
9
+ ru
10
+ });
@@ -0,0 +1,3 @@
1
+ import { type NotificationInboxMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<NotificationInboxMessages>;
@@ -0,0 +1,8 @@
1
+ export const messages = {
2
+ 'DUMB.NOTIFICATION_INBOX.TITLE': 'Notifications',
3
+ 'DUMB.NOTIFICATION_INBOX.UNREAD': '{{count}} unread',
4
+ 'DUMB.NOTIFICATION_INBOX.COLLAPSE': 'Collapse',
5
+ 'DUMB.NOTIFICATION_INBOX.EXPAND': 'Expand',
6
+ 'DUMB.NOTIFICATION_INBOX.LOADING_MORE': 'Loading more…',
7
+ 'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': 'You have unread notifications'
8
+ };
@@ -0,0 +1,3 @@
1
+ import { type NotificationInboxMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<NotificationInboxMessages>;
@@ -0,0 +1,8 @@
1
+ export const messages = {
2
+ 'DUMB.NOTIFICATION_INBOX.TITLE': 'Уведомления',
3
+ 'DUMB.NOTIFICATION_INBOX.UNREAD': '{{count}} {{count | pluralize: "непрочитанное", "непрочитанных", "непрочитанных"}}',
4
+ 'DUMB.NOTIFICATION_INBOX.COLLAPSE': 'Свернуть',
5
+ 'DUMB.NOTIFICATION_INBOX.EXPAND': 'Развернуть',
6
+ 'DUMB.NOTIFICATION_INBOX.LOADING_MORE': 'Загрузка…',
7
+ 'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': 'Есть непрочитанные уведомления'
8
+ };
@@ -0,0 +1,11 @@
1
+ import type { NoParams } from '../../polyglot';
2
+ export type NotificationInboxMessages = {
3
+ 'DUMB.NOTIFICATION_INBOX.TITLE': NoParams;
4
+ 'DUMB.NOTIFICATION_INBOX.UNREAD': {
5
+ count: number;
6
+ };
7
+ 'DUMB.NOTIFICATION_INBOX.COLLAPSE': NoParams;
8
+ 'DUMB.NOTIFICATION_INBOX.EXPAND': NoParams;
9
+ 'DUMB.NOTIFICATION_INBOX.LOADING_MORE': NoParams;
10
+ 'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': NoParams;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
- import React, { useRef, useState, useEffect } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect } from 'react';
2
3
  import { Vertical, useMount, usePersistentFunction } from '@pushwoosh/kit-helpers';
3
4
  import { ChevronIcon } from '@pushwoosh/kit-icons';
4
5
  import { AutosizeInput } from './components/AutosizeInput';
@@ -77,50 +78,58 @@ export function NumberPicker({
77
78
  };
78
79
  const resetAutoDiff = () => setAutoDiff(0);
79
80
  const InputComponent = autoSize ? AutosizeInput : InputStyled;
80
- return React.createElement(SingleInputFrame, {
81
+ return _jsxs(SingleInputFrame, {
81
82
  ref: ref,
82
83
  "$hasHint": !!hint,
83
- "$isDisabled": isDisabled
84
- }, React.createElement(InputComponent, {
85
- value: localValue,
86
- placeholder: placeholder,
87
- isDisabled: isDisabled,
88
- disabled: isDisabled,
89
- onChange: handleChange,
90
- onKeyDown: handleKeyDown,
91
- onKeyUp: resetAutoDiff,
92
- onBlur: event => {
93
- if (!event.target.value && value === undefined) {
94
- return;
84
+ "$isDisabled": isDisabled,
85
+ children: [_jsx(InputComponent, {
86
+ value: localValue,
87
+ placeholder: placeholder,
88
+ isDisabled: isDisabled,
89
+ disabled: isDisabled,
90
+ onChange: handleChange,
91
+ onKeyDown: handleKeyDown,
92
+ onKeyUp: resetAutoDiff,
93
+ onBlur: event => {
94
+ if (!event.target.value && value === undefined) {
95
+ return;
96
+ }
97
+ let blurValue = intVal(event.target.value);
98
+ const minValueValid = minValue === undefined || blurValue >= minValue;
99
+ const maxValueValid = maxValue === undefined || blurValue <= maxValue;
100
+ if (!maxValueValid) {
101
+ blurValue = maxValue;
102
+ } else if (!minValueValid) {
103
+ blurValue = minValue;
104
+ }
105
+ onChange(blurValue);
106
+ setLocalValue(`${blurValue}`);
95
107
  }
96
- let blurValue = intVal(event.target.value);
97
- const minValueValid = minValue === undefined || blurValue >= minValue;
98
- const maxValueValid = maxValue === undefined || blurValue <= maxValue;
99
- if (!maxValueValid) {
100
- blurValue = maxValue;
101
- } else if (!minValueValid) {
102
- blurValue = minValue;
103
- }
104
- onChange(blurValue);
105
- setLocalValue(`${blurValue}`);
106
- }
107
- }), hint && React.createElement(Hint, null, hint), React.createElement(Vertical, {
108
- "$gap": 1
109
- }, React.createElement("div", null, React.createElement(ChevronIcon, {
110
- direction: "up",
111
- size: "small",
112
- "aria-disabled": "true",
113
- onClick: () => onChangeDiff(step),
114
- onMouseDown: () => setAutoDiff(step),
115
- onMouseUp: resetAutoDiff,
116
- onMouseLeave: resetAutoDiff
117
- })), React.createElement("div", null, React.createElement(ChevronIcon, {
118
- size: "small",
119
- direction: "down",
120
- "aria-disabled": isDisabled,
121
- onClick: () => onChangeDiff(-1 * step),
122
- onMouseDown: () => setAutoDiff(-1 * step),
123
- onMouseUp: resetAutoDiff,
124
- onMouseLeave: resetAutoDiff
125
- }))));
108
+ }), hint && _jsx(Hint, {
109
+ children: hint
110
+ }), _jsxs(Vertical, {
111
+ "$gap": 1,
112
+ children: [_jsx("div", {
113
+ children: _jsx(ChevronIcon, {
114
+ direction: "up",
115
+ size: "small",
116
+ "aria-disabled": "true",
117
+ onClick: () => onChangeDiff(step),
118
+ onMouseDown: () => setAutoDiff(step),
119
+ onMouseUp: resetAutoDiff,
120
+ onMouseLeave: resetAutoDiff
121
+ })
122
+ }), _jsx("div", {
123
+ children: _jsx(ChevronIcon, {
124
+ size: "small",
125
+ direction: "down",
126
+ "aria-disabled": isDisabled,
127
+ onClick: () => onChangeDiff(-1 * step),
128
+ onMouseDown: () => setAutoDiff(-1 * step),
129
+ onMouseUp: resetAutoDiff,
130
+ onMouseLeave: resetAutoDiff
131
+ })
132
+ })]
133
+ })]
134
+ });
126
135
  }
@@ -1,4 +1,5 @@
1
- import React, { useRef, useState, useEffect } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect } from 'react';
2
3
  import { minimalWidth } from './constants';
3
4
  import { Hidden } from './styles';
4
5
  import { InputStyled } from '../../styles';
@@ -20,18 +21,21 @@ export function AutosizeInput(props) {
20
21
  } = hiddenRef.current;
21
22
  setWidth(hiddenWidth + minimalWidth);
22
23
  }, [value]);
23
- return React.createElement(React.Fragment, null, React.createElement(InputStyled, {
24
- style: {
25
- width
26
- },
27
- value: value,
28
- placeholder: placeholder,
29
- disabled: isDisabled,
30
- onChange: onChange,
31
- onKeyUp: onKeyUp,
32
- onKeyDown: onKeyDown,
33
- onBlur: onBlur
34
- }), React.createElement(Hidden, {
35
- ref: hiddenRef
36
- }, value || placeholder));
24
+ return _jsxs(_Fragment, {
25
+ children: [_jsx(InputStyled, {
26
+ style: {
27
+ width
28
+ },
29
+ value: value,
30
+ placeholder: placeholder,
31
+ disabled: isDisabled,
32
+ onChange: onChange,
33
+ onKeyUp: onKeyUp,
34
+ onKeyDown: onKeyDown,
35
+ onBlur: onBlur
36
+ }), _jsx(Hidden, {
37
+ ref: hiddenRef,
38
+ children: value || placeholder
39
+ })]
40
+ });
37
41
  }
@@ -1,4 +1,5 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
2
3
  import { EditIcon } from '@pushwoosh/kit-icons';
3
4
  import { DEFAULT_EMPTY_VALUE, WIDTH_EMPTY_VALUE } from './constants';
4
5
  import { RootBox, InputBox, InputStyled, PromptBox } from './styles';
@@ -56,25 +57,32 @@ export function AutosizeInput(props) {
56
57
  return onComplete === null || onComplete === void 0 ? void 0 : onComplete(inputRef === null || inputRef === void 0 || (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value);
57
58
  }, 100);
58
59
  };
59
- return React.createElement(RootBox, null, React.createElement(InputBox, null, React.createElement(InputStyled, {
60
- ref: inputRef,
61
- width: width,
62
- value: value,
63
- placeholder: placeholder,
64
- onKeyDown: onKeyDown,
65
- onChange: onChangeHandler,
66
- onBlur: onBlur
67
- }), React.createElement("span", {
68
- ref: hiddenValueRef
69
- }, value), React.createElement("span", {
70
- ref: hiddenPlaceholderRef
71
- }, placeholder)), React.createElement(PromptBox, {
72
- onClick: () => {
73
- var _inputRef$current4;
74
- return (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
75
- }
76
- }, React.createElement(EditIcon, {
77
- size: "small",
78
- view: "filled"
79
- })));
60
+ return _jsxs(RootBox, {
61
+ children: [_jsxs(InputBox, {
62
+ children: [_jsx(InputStyled, {
63
+ ref: inputRef,
64
+ width: width,
65
+ value: value,
66
+ placeholder: placeholder,
67
+ onKeyDown: onKeyDown,
68
+ onChange: onChangeHandler,
69
+ onBlur: onBlur
70
+ }), _jsx("span", {
71
+ ref: hiddenValueRef,
72
+ children: value
73
+ }), _jsx("span", {
74
+ ref: hiddenPlaceholderRef,
75
+ children: placeholder
76
+ })]
77
+ }), _jsx(PromptBox, {
78
+ onClick: () => {
79
+ var _inputRef$current4;
80
+ return (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
81
+ },
82
+ children: _jsx(EditIcon, {
83
+ size: "small",
84
+ view: "filled"
85
+ })
86
+ })]
87
+ });
80
88
  }