@snack-uikit/notification 0.7.59 → 0.7.60-preview-ba12ca94.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.
Files changed (103) hide show
  1. package/dist/cjs/components/NotificationCard/NotificationCard.js +156 -0
  2. package/dist/cjs/components/NotificationCard/components/NotificationCardFunction.js +64 -0
  3. package/dist/cjs/components/NotificationCard/components/NotificationCardSkeleton.js +60 -0
  4. package/dist/cjs/components/NotificationCard/components/index.js +26 -0
  5. package/dist/cjs/components/NotificationCard/constants.js +28 -0
  6. package/dist/cjs/components/NotificationCard/helpers.js +32 -0
  7. package/dist/cjs/components/NotificationCard/index.js +25 -0
  8. package/dist/cjs/components/NotificationCard/types.js +5 -0
  9. package/dist/cjs/components/NotificationPanel/NotificationPanel.js +112 -0
  10. package/dist/cjs/components/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.js +42 -0
  11. package/dist/cjs/components/NotificationPanel/components/NotificationPanelBlank/index.js +25 -0
  12. package/dist/cjs/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.js +37 -0
  13. package/dist/cjs/components/NotificationPanel/components/NotificationPanelDivider/index.js +25 -0
  14. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.js +29 -0
  15. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +50 -0
  16. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/index.js +25 -0
  17. package/dist/cjs/components/NotificationPanel/components/index.js +26 -0
  18. package/dist/cjs/components/NotificationPanel/constants.js +18 -0
  19. package/dist/cjs/components/NotificationPanel/index.js +25 -0
  20. package/dist/cjs/components/NotificationPanelPopover/NotificationPanelPopover.js +53 -0
  21. package/dist/cjs/components/NotificationPanelPopover/index.js +25 -0
  22. package/dist/cjs/components/index.js +27 -0
  23. package/dist/cjs/index.js +25 -0
  24. package/dist/esm/components/NotificationCard/NotificationCard.d.ts +43 -0
  25. package/dist/esm/components/NotificationCard/components/NotificationCardFunction.d.ts +7 -0
  26. package/dist/esm/components/NotificationCard/components/NotificationCardSkeleton.d.ts +1 -0
  27. package/dist/esm/components/NotificationCard/components/index.js +2 -0
  28. package/dist/esm/components/NotificationCard/constants.d.ts +22 -0
  29. package/dist/esm/components/NotificationCard/helpers.d.ts +2 -0
  30. package/dist/esm/components/NotificationCard/index.js +1 -0
  31. package/dist/esm/components/NotificationCard/styles.module.css +135 -0
  32. package/dist/esm/components/NotificationCard/types.d.ts +3 -0
  33. package/dist/esm/components/NotificationPanel/NotificationPanel.d.ts +43 -0
  34. package/dist/esm/components/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +4 -0
  35. package/dist/esm/components/NotificationPanel/components/NotificationPanelBlank/index.js +1 -0
  36. package/dist/esm/components/NotificationPanel/components/NotificationPanelBlank/styles.module.css +3 -0
  37. package/dist/esm/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.d.ts +8 -0
  38. package/dist/esm/components/NotificationPanel/components/NotificationPanelDivider/index.js +1 -0
  39. package/dist/esm/components/NotificationPanel/components/NotificationPanelDivider/styles.module.css +10 -0
  40. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +9 -0
  41. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +13 -0
  42. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/index.js +1 -0
  43. package/dist/esm/components/NotificationPanel/components/index.js +2 -0
  44. package/dist/esm/components/NotificationPanel/constants.d.ts +12 -0
  45. package/dist/esm/components/NotificationPanel/index.js +1 -0
  46. package/dist/esm/components/NotificationPanel/styles.module.css +111 -0
  47. package/dist/esm/components/NotificationPanelPopover/NotificationPanelPopover.d.ts +11 -0
  48. package/dist/esm/components/NotificationPanelPopover/index.js +1 -0
  49. package/dist/esm/components/NotificationPanelPopover/styles.module.css +20 -0
  50. package/dist/esm/components/index.js +3 -0
  51. package/dist/esm/index.js +1 -0
  52. package/package.json +22 -18
  53. /package/dist/{components → cjs/components}/NotificationCard/NotificationCard.d.ts +0 -0
  54. /package/dist/{components → cjs/components}/NotificationCard/components/NotificationCardFunction.d.ts +0 -0
  55. /package/dist/{components → cjs/components}/NotificationCard/components/NotificationCardSkeleton.d.ts +0 -0
  56. /package/dist/{components → cjs/components}/NotificationCard/components/index.d.ts +0 -0
  57. /package/dist/{components → cjs/components}/NotificationCard/constants.d.ts +0 -0
  58. /package/dist/{components → cjs/components}/NotificationCard/helpers.d.ts +0 -0
  59. /package/dist/{components → cjs/components}/NotificationCard/index.d.ts +0 -0
  60. /package/dist/{components → cjs/components}/NotificationCard/styles.module.css +0 -0
  61. /package/dist/{components → cjs/components}/NotificationCard/types.d.ts +0 -0
  62. /package/dist/{components → cjs/components}/NotificationPanel/NotificationPanel.d.ts +0 -0
  63. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +0 -0
  64. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelBlank/index.d.ts +0 -0
  65. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelBlank/styles.module.css +0 -0
  66. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.d.ts +0 -0
  67. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelDivider/index.d.ts +0 -0
  68. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelDivider/styles.module.css +0 -0
  69. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +0 -0
  70. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +0 -0
  71. /package/dist/{components → cjs/components}/NotificationPanel/components/NotificationPanelSettings/index.d.ts +0 -0
  72. /package/dist/{components → cjs/components}/NotificationPanel/components/index.d.ts +0 -0
  73. /package/dist/{components → cjs/components}/NotificationPanel/constants.d.ts +0 -0
  74. /package/dist/{components → cjs/components}/NotificationPanel/index.d.ts +0 -0
  75. /package/dist/{components → cjs/components}/NotificationPanel/styles.module.css +0 -0
  76. /package/dist/{components → cjs/components}/NotificationPanelPopover/NotificationPanelPopover.d.ts +0 -0
  77. /package/dist/{components → cjs/components}/NotificationPanelPopover/index.d.ts +0 -0
  78. /package/dist/{components → cjs/components}/NotificationPanelPopover/styles.module.css +0 -0
  79. /package/dist/{components → cjs/components}/index.d.ts +0 -0
  80. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  81. /package/dist/{components → esm/components}/NotificationCard/NotificationCard.js +0 -0
  82. /package/dist/{components → esm/components}/NotificationCard/components/NotificationCardFunction.js +0 -0
  83. /package/dist/{components → esm/components}/NotificationCard/components/NotificationCardSkeleton.js +0 -0
  84. /package/dist/{components/NotificationCard/components/index.js → esm/components/NotificationCard/components/index.d.ts} +0 -0
  85. /package/dist/{components → esm/components}/NotificationCard/constants.js +0 -0
  86. /package/dist/{components → esm/components}/NotificationCard/helpers.js +0 -0
  87. /package/dist/{components/NotificationCard/index.js → esm/components/NotificationCard/index.d.ts} +0 -0
  88. /package/dist/{components → esm/components}/NotificationCard/types.js +0 -0
  89. /package/dist/{components → esm/components}/NotificationPanel/NotificationPanel.js +0 -0
  90. /package/dist/{components → esm/components}/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.js +0 -0
  91. /package/dist/{components/NotificationPanel/components/NotificationPanelBlank/index.js → esm/components/NotificationPanel/components/NotificationPanelBlank/index.d.ts} +0 -0
  92. /package/dist/{components → esm/components}/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.js +0 -0
  93. /package/dist/{components/NotificationPanel/components/NotificationPanelDivider/index.js → esm/components/NotificationPanel/components/NotificationPanelDivider/index.d.ts} +0 -0
  94. /package/dist/{components → esm/components}/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.js +0 -0
  95. /package/dist/{components → esm/components}/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +0 -0
  96. /package/dist/{components/NotificationPanel/components/NotificationPanelSettings/index.js → esm/components/NotificationPanel/components/NotificationPanelSettings/index.d.ts} +0 -0
  97. /package/dist/{components/NotificationPanel/components/index.js → esm/components/NotificationPanel/components/index.d.ts} +0 -0
  98. /package/dist/{components → esm/components}/NotificationPanel/constants.js +0 -0
  99. /package/dist/{components/NotificationPanel/index.js → esm/components/NotificationPanel/index.d.ts} +0 -0
  100. /package/dist/{components → esm/components}/NotificationPanelPopover/NotificationPanelPopover.js +0 -0
  101. /package/dist/{components/NotificationPanelPopover/index.js → esm/components/NotificationPanelPopover/index.d.ts} +0 -0
  102. /package/dist/{components/index.js → esm/components/index.d.ts} +0 -0
  103. /package/dist/{index.js → esm/index.d.ts} +0 -0
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.NotificationCard = NotificationCard;
20
+ const jsx_runtime_1 = require("react/jsx-runtime");
21
+ const classnames_1 = __importDefault(require("classnames"));
22
+ const react_1 = require("react");
23
+ const button_1 = require("@snack-uikit/button");
24
+ const link_1 = require("@snack-uikit/link");
25
+ const truncate_string_1 = require("@snack-uikit/truncate-string");
26
+ const typography_1 = require("@snack-uikit/typography");
27
+ const utils_1 = require("@snack-uikit/utils");
28
+ const components_1 = require("./components");
29
+ const constants_1 = require("./constants");
30
+ const helpers_1 = require("./helpers");
31
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
32
+ /** Компонент карточки уведомления */
33
+ function NotificationCard(_a) {
34
+ var {
35
+ id,
36
+ appearance = constants_1.APPEARANCE.Neutral,
37
+ label,
38
+ unread,
39
+ title,
40
+ content,
41
+ link,
42
+ date,
43
+ onClick,
44
+ primaryButton,
45
+ secondaryButton,
46
+ actions,
47
+ onVisible,
48
+ className
49
+ } = _a,
50
+ rest = __rest(_a, ["id", "appearance", "label", "unread", "title", "content", "link", "date", "onClick", "primaryButton", "secondaryButton", "actions", "onVisible", "className"]);
51
+ const {
52
+ icon,
53
+ linkOnColor,
54
+ buttonAppearance
55
+ } = (0, react_1.useMemo)(() => ({
56
+ icon: (0, helpers_1.getIcon)(appearance),
57
+ linkOnColor: appearance === constants_1.APPEARANCE.ErrorCritical ? 'red' : undefined,
58
+ buttonAppearance: appearance === constants_1.APPEARANCE.ErrorCritical ? 'destructive' : 'primary'
59
+ }), [appearance]);
60
+ const [isDroplistOpen, setDroplistOpen] = (0, react_1.useState)(false);
61
+ const cardRef = (0, react_1.useRef)(null);
62
+ (0, react_1.useEffect)(() => {
63
+ if (!unread || !onVisible) {
64
+ return;
65
+ }
66
+ const handleIntersection = entries => {
67
+ const [entry] = entries;
68
+ if (entry.isIntersecting) {
69
+ onVisible(id);
70
+ }
71
+ };
72
+ const observer = new IntersectionObserver(handleIntersection, {
73
+ root: null,
74
+ threshold: 0.8,
75
+ rootMargin: '0px'
76
+ });
77
+ observer.observe(cardRef.current);
78
+ return () => {
79
+ observer.disconnect();
80
+ };
81
+ }, [id, onVisible, unread]);
82
+ const showFooter = Boolean(link || date);
83
+ const handleLinkClick = e => {
84
+ var _a;
85
+ e.stopPropagation();
86
+ (_a = link === null || link === void 0 ? void 0 : link.onClick) === null || _a === void 0 ? void 0 : _a.call(link, e);
87
+ };
88
+ return (0, jsx_runtime_1.jsxs)("div", Object.assign({
89
+ ref: cardRef,
90
+ role: 'button',
91
+ onClick: onClick,
92
+ tabIndex: 0
93
+ }, (0, utils_1.extractSupportProps)(rest), {
94
+ "data-appearance": appearance,
95
+ "data-unread": unread || undefined,
96
+ "data-clickable": Boolean(onClick) || undefined,
97
+ "data-droplist-open": isDroplistOpen || undefined,
98
+ className: (0, classnames_1.default)(styles_module_scss_1.default.notificationCard, className),
99
+ children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (0, jsx_runtime_1.jsx)(components_1.NotificationCardFunction, {
100
+ actions: actions,
101
+ open: isDroplistOpen,
102
+ setDroplistOpen: setDroplistOpen
103
+ }), label && (0, jsx_runtime_1.jsx)(typography_1.Typography.LightLabelS, {
104
+ tag: 'div',
105
+ className: styles_module_scss_1.default.notificationCardLabel,
106
+ children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, {
107
+ maxLines: 1,
108
+ text: label,
109
+ "data-test-id": constants_1.TEST_IDS.label
110
+ })
111
+ }), (0, jsx_runtime_1.jsxs)("div", {
112
+ className: styles_module_scss_1.default.notificationCardTitle,
113
+ children: [(0, jsx_runtime_1.jsx)("div", {
114
+ className: styles_module_scss_1.default.notificationCardTitleIcon,
115
+ children: icon
116
+ }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleS, {
117
+ tag: 'div',
118
+ className: styles_module_scss_1.default.notificationCardTitleText,
119
+ children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, {
120
+ maxLines: 2,
121
+ text: title,
122
+ "data-test-id": constants_1.TEST_IDS.title
123
+ })
124
+ })]
125
+ }), content && (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, {
126
+ tag: 'div',
127
+ className: styles_module_scss_1.default.notificationCardContent,
128
+ "data-test-id": constants_1.TEST_IDS.content,
129
+ children: content
130
+ }), (primaryButton || secondaryButton) && (0, jsx_runtime_1.jsxs)("div", {
131
+ className: styles_module_scss_1.default.notificationCardButtons,
132
+ children: [secondaryButton && (0, jsx_runtime_1.jsx)(button_1.ButtonSimple, Object.assign({}, secondaryButton, {
133
+ appearance: buttonAppearance,
134
+ size: 's',
135
+ "data-test-id": constants_1.TEST_IDS.primaryButton
136
+ })), primaryButton && (0, jsx_runtime_1.jsx)(button_1.ButtonTonal, Object.assign({}, primaryButton, {
137
+ appearance: buttonAppearance,
138
+ size: 's',
139
+ "data-test-id": constants_1.TEST_IDS.secondaryButton
140
+ }))]
141
+ }), showFooter && (0, jsx_runtime_1.jsxs)("div", {
142
+ className: styles_module_scss_1.default.notificationCardFooter,
143
+ children: [link && (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({}, link, {
144
+ onClick: handleLinkClick,
145
+ appearance: linkOnColor,
146
+ textMode: 'default',
147
+ size: 's',
148
+ "data-test-id": constants_1.TEST_IDS.link
149
+ })), date && (0, jsx_runtime_1.jsx)(typography_1.Typography.LightLabelS, {
150
+ className: styles_module_scss_1.default.notificationCardDate,
151
+ "data-test-id": constants_1.TEST_IDS.date,
152
+ children: date
153
+ })]
154
+ })]
155
+ }));
156
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
4
+ return mod && mod.__esModule ? mod : {
5
+ "default": mod
6
+ };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ exports.NotificationCardFunction = NotificationCardFunction;
12
+ const jsx_runtime_1 = require("react/jsx-runtime");
13
+ const button_1 = require("@snack-uikit/button");
14
+ const icons_1 = require("@snack-uikit/icons");
15
+ const list_1 = require("@snack-uikit/list");
16
+ const tag_1 = require("@snack-uikit/tag");
17
+ const constants_1 = require("../constants");
18
+ const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
19
+ function NotificationCardFunction(_ref) {
20
+ let {
21
+ actions,
22
+ open,
23
+ setDroplistOpen
24
+ } = _ref;
25
+ return (0, jsx_runtime_1.jsx)("div", {
26
+ className: styles_module_scss_1.default.notificationCardFunction,
27
+ "data-test-id": constants_1.TEST_IDS.actions.wrapper,
28
+ children: (0, jsx_runtime_1.jsx)(list_1.Droplist, {
29
+ trigger: 'clickAndFocusVisible',
30
+ open: open,
31
+ onOpenChange: setDroplistOpen,
32
+ placement: 'bottom-end',
33
+ scroll: true,
34
+ "data-test-id": constants_1.TEST_IDS.actions.droplist,
35
+ items: actions.map(_ref2 => {
36
+ let {
37
+ onClick,
38
+ disabled,
39
+ content,
40
+ tagLabel,
41
+ icon
42
+ } = _ref2;
43
+ return {
44
+ onClick: e => {
45
+ setDroplistOpen(false);
46
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
47
+ },
48
+ disabled,
49
+ content,
50
+ beforeContent: icon,
51
+ afterContent: tagLabel ? (0, jsx_runtime_1.jsx)(tag_1.Tag, {
52
+ label: tagLabel
53
+ }) : undefined,
54
+ 'data-test-id': constants_1.TEST_IDS.actions.droplistAction
55
+ };
56
+ }),
57
+ children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
58
+ size: 's',
59
+ icon: (0, jsx_runtime_1.jsx)(icons_1.KebabSVG, {}),
60
+ "data-test-id": constants_1.TEST_IDS.actions.droplistTrigger
61
+ })
62
+ })
63
+ });
64
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
4
+ return mod && mod.__esModule ? mod : {
5
+ "default": mod
6
+ };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ exports.NotificationCardSkeleton = NotificationCardSkeleton;
12
+ const jsx_runtime_1 = require("react/jsx-runtime");
13
+ const skeleton_1 = require("@snack-uikit/skeleton");
14
+ const constants_1 = require("../../NotificationPanel/constants");
15
+ const styles_module_scss_1 = __importDefault(require('../styles.module.css'));
16
+ const BORDER_RADIUS = 24;
17
+ function NotificationCardSkeleton() {
18
+ return (0, jsx_runtime_1.jsxs)("div", {
19
+ className: styles_module_scss_1.default.notificationCard,
20
+ "data-test-id": constants_1.TEST_IDS.skeleton,
21
+ "data-skeleton": true,
22
+ children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, {
23
+ width: 140,
24
+ height: 11,
25
+ borderRadius: BORDER_RADIUS
26
+ }), (0, jsx_runtime_1.jsxs)("div", {
27
+ className: styles_module_scss_1.default.notificationCardTitle,
28
+ "data-center": true,
29
+ children: [(0, jsx_runtime_1.jsx)("div", {
30
+ className: styles_module_scss_1.default.notificationCardTitleIcon,
31
+ children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, {
32
+ width: 16,
33
+ height: 16,
34
+ borderRadius: BORDER_RADIUS
35
+ })
36
+ }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, {
37
+ width: 140,
38
+ height: 14,
39
+ borderRadius: BORDER_RADIUS
40
+ })]
41
+ }), (0, jsx_runtime_1.jsx)("div", {
42
+ className: styles_module_scss_1.default.notificationCardContent,
43
+ children: (0, jsx_runtime_1.jsx)(skeleton_1.SkeletonText, {
44
+ lines: 3,
45
+ borderRadius: BORDER_RADIUS
46
+ })
47
+ }), (0, jsx_runtime_1.jsxs)("div", {
48
+ className: styles_module_scss_1.default.notificationCardFooter,
49
+ children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, {
50
+ width: 140,
51
+ borderRadius: BORDER_RADIUS,
52
+ height: 12
53
+ }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, {
54
+ width: 140,
55
+ borderRadius: BORDER_RADIUS,
56
+ height: 11
57
+ })]
58
+ })]
59
+ });
60
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./NotificationCardFunction"), exports);
26
+ __exportStar(require("./NotificationCardSkeleton"), exports);
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TEST_IDS = exports.APPEARANCE = void 0;
7
+ exports.APPEARANCE = {
8
+ Neutral: 'neutral',
9
+ Error: 'error',
10
+ ErrorCritical: 'errorCritical',
11
+ Warning: 'warning',
12
+ Success: 'success'
13
+ };
14
+ exports.TEST_IDS = {
15
+ label: 'notification-card__label',
16
+ title: 'notification-card__title',
17
+ content: 'notification-card__content',
18
+ link: 'notification-card__link',
19
+ date: 'notification-card__date',
20
+ actions: {
21
+ wrapper: 'notification-card__actions',
22
+ droplist: 'notification-card__droplist',
23
+ droplistTrigger: 'notification-card__droplist-trigger',
24
+ droplistAction: 'notification-card__droplist-action'
25
+ },
26
+ primaryButton: 'notification-card__primary-button',
27
+ secondaryButton: 'notification-card__secondary-button'
28
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getIcon = getIcon;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const icons_1 = require("@snack-uikit/icons");
9
+ const constants_1 = require("./constants");
10
+ function getIcon(appearance) {
11
+ switch (appearance) {
12
+ case constants_1.APPEARANCE.Success:
13
+ return (0, jsx_runtime_1.jsx)(icons_1.CheckFilledSVG, {
14
+ size: 16
15
+ });
16
+ case constants_1.APPEARANCE.Error:
17
+ case constants_1.APPEARANCE.ErrorCritical:
18
+ return (0, jsx_runtime_1.jsx)(icons_1.CrossFilledSVG, {
19
+ size: 16
20
+ });
21
+ case constants_1.APPEARANCE.Warning:
22
+ return (0, jsx_runtime_1.jsx)(icons_1.AlarmFilledSVG, {
23
+ size: 16
24
+ });
25
+ case constants_1.APPEARANCE.Neutral:
26
+ return (0, jsx_runtime_1.jsx)(icons_1.InfoFilledSVG, {
27
+ size: 16
28
+ });
29
+ default:
30
+ return null;
31
+ }
32
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./NotificationCard"), exports);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.NotificationPanel = NotificationPanel;
20
+ const react_1 = require("react");
21
+ const jsx_runtime_1 = require("react/jsx-runtime");
22
+ const classnames_1 = __importDefault(require("classnames"));
23
+ const react_2 = require("react");
24
+ const button_1 = require("@snack-uikit/button");
25
+ const chips_1 = require("@snack-uikit/chips");
26
+ const scroll_1 = require("@snack-uikit/scroll");
27
+ const skeleton_1 = require("@snack-uikit/skeleton");
28
+ const truncate_string_1 = require("@snack-uikit/truncate-string");
29
+ const typography_1 = require("@snack-uikit/typography");
30
+ const utils_1 = require("@snack-uikit/utils");
31
+ const components_1 = require("../NotificationCard/components");
32
+ const components_2 = require("./components");
33
+ const NotificationPanelDivider_1 = require("./components/NotificationPanelDivider");
34
+ const constants_1 = require("./constants");
35
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
36
+ /** Компонент панели для уведомлений */
37
+ function NotificationPanel(_a) {
38
+ var {
39
+ title,
40
+ settings,
41
+ chips,
42
+ readAllButton,
43
+ footerButton,
44
+ content,
45
+ loading,
46
+ skeletonsAmount = 2,
47
+ scrollEndRef,
48
+ scrollContainerRef,
49
+ className
50
+ } = _a,
51
+ rest = __rest(_a, ["title", "settings", "chips", "readAllButton", "footerButton", "content", "loading", "skeletonsAmount", "scrollEndRef", "scrollContainerRef", "className"]);
52
+ const skeletons = (0, react_2.useMemo)(() => Array.from({
53
+ length: skeletonsAmount
54
+ }, (_, i) => i), [skeletonsAmount]);
55
+ return (0, jsx_runtime_1.jsxs)("div", Object.assign({
56
+ className: (0, classnames_1.default)(styles_module_scss_1.default.wrapper, className)
57
+ }, (0, utils_1.extractSupportProps)(rest), {
58
+ children: [(0, jsx_runtime_1.jsxs)("div", {
59
+ className: styles_module_scss_1.default.notificationPanelHeader,
60
+ children: [(0, jsx_runtime_1.jsxs)("div", {
61
+ className: styles_module_scss_1.default.notificationPanelHeadline,
62
+ children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansHeadlineS, {
63
+ className: styles_module_scss_1.default.notificationPanelTitle,
64
+ children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, {
65
+ text: title,
66
+ "data-test-id": constants_1.TEST_IDS.title
67
+ })
68
+ }), settings && (0, jsx_runtime_1.jsx)(components_2.NotificationPanelSettings, Object.assign({}, settings))]
69
+ }), (0, jsx_runtime_1.jsxs)("div", {
70
+ className: styles_module_scss_1.default.notificationPanelHeaderFunctions,
71
+ children: [(0, jsx_runtime_1.jsx)("div", {
72
+ className: styles_module_scss_1.default.notificationPanelChips,
73
+ children: chips === null || chips === void 0 ? void 0 : chips.map(chip => (0, react_1.createElement)(chips_1.ChipToggle, Object.assign({}, chip, {
74
+ key: chip.label,
75
+ "data-test-id": `${constants_1.TEST_IDS.chip}-${chip.label}`,
76
+ size: 'xs',
77
+ disabled: chip.disabled || loading
78
+ })))
79
+ }), readAllButton && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, Object.assign({}, readAllButton, {
80
+ size: 'xs',
81
+ disabled: readAllButton.disabled || loading,
82
+ "data-test-id": constants_1.TEST_IDS.readAll
83
+ }))]
84
+ })]
85
+ }), (0, jsx_runtime_1.jsxs)(scroll_1.Scroll, {
86
+ size: 'm',
87
+ className: styles_module_scss_1.default.notificationPanelBody,
88
+ ref: scrollContainerRef,
89
+ children: [content, loading && (0, jsx_runtime_1.jsx)(skeleton_1.SkeletonContextProvider, {
90
+ loading: loading || false,
91
+ children: skeletons.map(skeleton => (0, jsx_runtime_1.jsx)(skeleton_1.WithSkeleton, {
92
+ skeleton: (0, jsx_runtime_1.jsx)(components_1.NotificationCardSkeleton, {})
93
+ }, skeleton))
94
+ }), (0, jsx_runtime_1.jsx)("div", {
95
+ className: styles_module_scss_1.default.scrollStub,
96
+ ref: scrollEndRef
97
+ })]
98
+ }), footerButton && (0, jsx_runtime_1.jsx)("button", {
99
+ type: 'button',
100
+ onClick: footerButton.onClick,
101
+ className: styles_module_scss_1.default.notificationPanelFooterButton,
102
+ "data-test-id": constants_1.TEST_IDS.footerButton,
103
+ children: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansLabelS, {
104
+ children: footerButton.label
105
+ })
106
+ })]
107
+ }));
108
+ }
109
+ (function (NotificationPanel) {
110
+ NotificationPanel.Blank = components_2.NotificationPanelBlank;
111
+ NotificationPanel.Divider = NotificationPanelDivider_1.NotificationPanelDivider;
112
+ })(NotificationPanel || (exports.NotificationPanel = NotificationPanel = {}));
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.NotificationPanelBlank = NotificationPanelBlank;
20
+ const jsx_runtime_1 = require("react/jsx-runtime");
21
+ const classnames_1 = __importDefault(require("classnames"));
22
+ const info_block_1 = require("@snack-uikit/info-block");
23
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
24
+ /** Компонента для "заглушки" вместо карточек в панели */
25
+ function NotificationPanelBlank(_a) {
26
+ var _b;
27
+ var {
28
+ icon,
29
+ className
30
+ } = _a,
31
+ props = __rest(_a, ["icon", "className"]);
32
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {
33
+ children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, Object.assign({}, props, {
34
+ icon: icon ? Object.assign(Object.assign({}, icon), {
35
+ appearance: (_b = icon.appearance) !== null && _b !== void 0 ? _b : 'neutral'
36
+ }) : undefined,
37
+ size: 'l',
38
+ align: 'vertical',
39
+ className: (0, classnames_1.default)(styles_module_scss_1.default.notificationPanelBlank, className)
40
+ }))
41
+ });
42
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./NotificationPanelBlank"), exports);
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.NotificationPanelDivider = NotificationPanelDivider;
20
+ const jsx_runtime_1 = require("react/jsx-runtime");
21
+ const classnames_1 = __importDefault(require("classnames"));
22
+ const typography_1 = require("@snack-uikit/typography");
23
+ const utils_1 = require("@snack-uikit/utils");
24
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
25
+ /** Разделитель для группировки или разделения карточек в списке */
26
+ function NotificationPanelDivider(_a) {
27
+ var {
28
+ text,
29
+ className
30
+ } = _a,
31
+ rest = __rest(_a, ["text", "className"]);
32
+ return (0, jsx_runtime_1.jsx)(typography_1.Typography.LightLabelS, Object.assign({
33
+ className: (0, classnames_1.default)(styles_module_scss_1.default.notificationPanelDivider, className)
34
+ }, (0, utils_1.extractSupportProps)(rest), {
35
+ children: text
36
+ }));
37
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./NotificationPanelDivider"), exports);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NotificationPanelSettings = NotificationPanelSettings;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const button_1 = require("@snack-uikit/button");
9
+ const icons_1 = require("@snack-uikit/icons");
10
+ const constants_1 = require("../../constants");
11
+ const NotificationPanelSettingsDroplist_1 = require("./NotificationPanelSettingsDroplist");
12
+ function NotificationPanelSettings(_ref) {
13
+ let {
14
+ actions,
15
+ button
16
+ } = _ref;
17
+ const buttonProps = Object.assign(Object.assign({}, button), {
18
+ size: 's',
19
+ icon: button.icon || (0, jsx_runtime_1.jsx)(icons_1.KebabSVG, {}),
20
+ 'data-test-id': constants_1.TEST_IDS.settings.droplistTrigger
21
+ });
22
+ if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
23
+ return (0, jsx_runtime_1.jsx)(button_1.ButtonSimple, Object.assign({}, buttonProps));
24
+ }
25
+ return (0, jsx_runtime_1.jsx)(NotificationPanelSettingsDroplist_1.NotificationPanelSettingsDroplist, {
26
+ actions: actions,
27
+ button: buttonProps
28
+ });
29
+ }