@snack-uikit/notification 0.13.25 → 0.13.26

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 (101) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +70 -0
  3. package/dist/cjs/components/NotificationCard/NotificationCard.d.ts +2 -7
  4. package/dist/cjs/components/NotificationCard/NotificationCard.js +11 -4
  5. package/dist/cjs/components/NotificationCard/components/index.d.ts +0 -1
  6. package/dist/cjs/components/NotificationCard/components/index.js +0 -1
  7. package/dist/cjs/components/NotificationCard/helpers.d.ts +2 -0
  8. package/dist/cjs/components/NotificationCard/helpers.js +4 -0
  9. package/dist/cjs/components/NotificationCard/styles.module.css +10 -9
  10. package/dist/cjs/components/NotificationPanel/NotificationPanel.d.ts +3 -1
  11. package/dist/cjs/components/NotificationPanel/NotificationPanel.js +14 -11
  12. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +27 -0
  13. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +101 -0
  14. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/hooks.d.ts +12 -0
  15. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/hooks.js +36 -0
  16. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/index.d.ts +1 -0
  17. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/index.js +25 -0
  18. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/styles.module.css +74 -0
  19. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/utils.d.ts +2 -0
  20. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/utils.js +14 -0
  21. package/dist/cjs/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.js +10 -3
  22. package/dist/cjs/components/NotificationPanel/components/NotificationPanelDivider/styles.module.css +12 -3
  23. package/dist/cjs/components/NotificationPanel/components/index.d.ts +1 -0
  24. package/dist/cjs/components/NotificationPanel/components/index.js +2 -1
  25. package/dist/cjs/components/NotificationPanel/constants.d.ts +6 -0
  26. package/dist/cjs/components/NotificationPanel/constants.js +7 -1
  27. package/dist/cjs/components/NotificationPanel/helperComponents/StackTail/StackTail.d.ts +6 -0
  28. package/dist/cjs/components/NotificationPanel/helperComponents/StackTail/StackTail.js +33 -0
  29. package/dist/cjs/components/NotificationPanel/helperComponents/StackTail/index.d.ts +1 -0
  30. package/dist/cjs/components/NotificationPanel/helperComponents/StackTail/index.js +25 -0
  31. package/dist/cjs/components/NotificationPanel/helperComponents/StackTail/styles.module.css +53 -0
  32. package/dist/cjs/components/NotificationPanel/helperComponents/WithTooltip/WithTooltip.d.ts +1 -1
  33. package/dist/cjs/components/NotificationPanel/styles.module.css +7 -4
  34. package/dist/cjs/helperComponents/ActionsButton/ActionsButton.d.ts +16 -0
  35. package/dist/cjs/helperComponents/ActionsButton/ActionsButton.js +72 -0
  36. package/dist/cjs/helperComponents/ActionsButton/index.d.ts +1 -0
  37. package/dist/cjs/helperComponents/ActionsButton/index.js +25 -0
  38. package/dist/cjs/helperComponents/ActionsButton/styles.module.css +3 -0
  39. package/dist/esm/components/NotificationCard/NotificationCard.d.ts +2 -7
  40. package/dist/esm/components/NotificationCard/NotificationCard.js +6 -3
  41. package/dist/esm/components/NotificationCard/components/index.d.ts +0 -1
  42. package/dist/esm/components/NotificationCard/components/index.js +0 -1
  43. package/dist/esm/components/NotificationCard/helpers.d.ts +2 -0
  44. package/dist/esm/components/NotificationCard/helpers.js +3 -0
  45. package/dist/esm/components/NotificationCard/styles.module.css +10 -9
  46. package/dist/esm/components/NotificationPanel/NotificationPanel.d.ts +3 -1
  47. package/dist/esm/components/NotificationPanel/NotificationPanel.js +3 -2
  48. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +27 -0
  49. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +28 -0
  50. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/hooks.d.ts +12 -0
  51. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/hooks.js +26 -0
  52. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/index.d.ts +1 -0
  53. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/index.js +1 -0
  54. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/styles.module.css +74 -0
  55. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/utils.d.ts +2 -0
  56. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/utils.js +7 -0
  57. package/dist/esm/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.js +2 -2
  58. package/dist/esm/components/NotificationPanel/components/NotificationPanelDivider/styles.module.css +12 -3
  59. package/dist/esm/components/NotificationPanel/components/index.d.ts +1 -0
  60. package/dist/esm/components/NotificationPanel/components/index.js +1 -0
  61. package/dist/esm/components/NotificationPanel/constants.d.ts +6 -0
  62. package/dist/esm/components/NotificationPanel/constants.js +6 -0
  63. package/dist/esm/components/NotificationPanel/helperComponents/StackTail/StackTail.d.ts +6 -0
  64. package/dist/esm/components/NotificationPanel/helperComponents/StackTail/StackTail.js +5 -0
  65. package/dist/esm/components/NotificationPanel/helperComponents/StackTail/index.d.ts +1 -0
  66. package/dist/esm/components/NotificationPanel/helperComponents/StackTail/index.js +1 -0
  67. package/dist/esm/components/NotificationPanel/helperComponents/StackTail/styles.module.css +53 -0
  68. package/dist/esm/components/NotificationPanel/helperComponents/WithTooltip/WithTooltip.d.ts +1 -1
  69. package/dist/esm/components/NotificationPanel/styles.module.css +7 -4
  70. package/dist/esm/helperComponents/ActionsButton/ActionsButton.d.ts +16 -0
  71. package/dist/esm/helperComponents/ActionsButton/ActionsButton.js +23 -0
  72. package/dist/esm/helperComponents/ActionsButton/index.d.ts +1 -0
  73. package/dist/esm/helperComponents/ActionsButton/index.js +1 -0
  74. package/dist/esm/helperComponents/ActionsButton/styles.module.css +3 -0
  75. package/package.json +4 -3
  76. package/src/components/NotificationCard/NotificationCard.tsx +14 -11
  77. package/src/components/NotificationCard/components/index.ts +0 -1
  78. package/src/components/NotificationCard/helpers.tsx +6 -0
  79. package/src/components/NotificationCard/styles.module.scss +3 -3
  80. package/src/components/NotificationPanel/NotificationPanel.tsx +16 -10
  81. package/src/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.tsx +107 -0
  82. package/src/components/NotificationPanel/components/NotificationCardStack/hooks.ts +45 -0
  83. package/src/components/NotificationPanel/components/NotificationCardStack/index.ts +1 -0
  84. package/src/components/NotificationPanel/components/NotificationCardStack/styles.module.scss +89 -0
  85. package/src/components/NotificationPanel/components/NotificationCardStack/utils.ts +12 -0
  86. package/src/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.tsx +5 -3
  87. package/src/components/NotificationPanel/components/NotificationPanelDivider/styles.module.scss +15 -7
  88. package/src/components/NotificationPanel/components/index.ts +1 -0
  89. package/src/components/NotificationPanel/constants.ts +6 -0
  90. package/src/components/NotificationPanel/helperComponents/StackTail/StackTail.tsx +17 -0
  91. package/src/components/NotificationPanel/helperComponents/StackTail/index.ts +1 -0
  92. package/src/components/NotificationPanel/helperComponents/StackTail/styles.module.scss +77 -0
  93. package/src/components/NotificationPanel/styles.module.scss +6 -6
  94. package/src/helperComponents/ActionsButton/ActionsButton.tsx +65 -0
  95. package/src/helperComponents/ActionsButton/index.ts +1 -0
  96. package/src/helperComponents/ActionsButton/styles.module.scss +3 -0
  97. package/dist/cjs/components/NotificationCard/components/NotificationCardFunction.d.ts +0 -7
  98. package/dist/cjs/components/NotificationCard/components/NotificationCardFunction.js +0 -64
  99. package/dist/esm/components/NotificationCard/components/NotificationCardFunction.d.ts +0 -7
  100. package/dist/esm/components/NotificationCard/components/NotificationCardFunction.js +0 -20
  101. package/src/components/NotificationCard/components/NotificationCardFunction.tsx +0 -43
@@ -0,0 +1,89 @@
1
+ @use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-notification-notificationCard' as tokens;
2
+
3
+ $duration: var(--snack-notification-stack-animation-duration);
4
+
5
+ .container {
6
+ @include tokens.composite-var(tokens.$notification-card-stack-container);
7
+
8
+ display: flex;
9
+ flex-direction: column;
10
+ }
11
+
12
+ .header {
13
+ @include tokens.composite-var(tokens.$notification-card-stack-header-container);
14
+
15
+ display: flex;
16
+ flex-direction: row;
17
+ align-items: center;
18
+ color: var(tokens.$sys-neutral-text-main);
19
+ }
20
+
21
+ .title {
22
+ @include tokens.composite-var(tokens.$sans-title-s);
23
+
24
+ overflow: hidden;
25
+ flex-grow: 1;
26
+ flex-shrink: 1;
27
+
28
+ text-overflow: ellipsis;
29
+ white-space: nowrap;
30
+ }
31
+
32
+ .right {
33
+ @include tokens.composite-var(tokens.$notification-card-stack-header-right);
34
+
35
+ display: flex;
36
+ flex-direction: row;
37
+ flex-grow: 0;
38
+ flex-shrink: 0;
39
+ }
40
+
41
+ .first {
42
+ display: flex;
43
+ flex-direction: column-reverse;
44
+ }
45
+
46
+ .stack {
47
+ position: relative;
48
+ overflow: visible;
49
+ height: auto;
50
+ transition: overflow $duration allow-discrete step-end;
51
+
52
+ &:not([data-open]) {
53
+ overflow: hidden;
54
+ transition:
55
+ height $duration allow-discrete step-end;
56
+
57
+ &[data-tail-size] {
58
+ height: 8px;
59
+ }
60
+
61
+ &[data-tail-size="1"] {
62
+ height: 4px;
63
+ }
64
+ }
65
+ }
66
+
67
+ .animationContainer {
68
+ translate: 0 -100%;
69
+ scale: 0.98;
70
+
71
+ display: flex;
72
+ flex-direction: column;
73
+ gap: tokens.$space-notification-panel-container-body-stack-cards;
74
+
75
+ margin-top: tokens.$space-notification-panel-container-body-stack-cards;
76
+
77
+ opacity: 0;
78
+
79
+ transition:
80
+ scale $duration,
81
+ translate $duration,
82
+ opacity $duration;
83
+
84
+ [data-open] & {
85
+ translate: 0 0;
86
+ scale: 1;
87
+ opacity: 1;
88
+ }
89
+ }
@@ -0,0 +1,12 @@
1
+ import { cloneElement, isValidElement, ReactNode } from 'react';
2
+
3
+ export const cloneCard = (element: ReactNode, props: Record<string, unknown>) => {
4
+ if (!isValidElement(element)) {
5
+ return element;
6
+ }
7
+
8
+ return cloneElement(element, {
9
+ ...element.props,
10
+ ...props,
11
+ });
12
+ };
@@ -14,8 +14,10 @@ export type NotificationPanelDividerProps = WithSupportProps<{
14
14
  /** Разделитель для группировки или разделения карточек в списке */
15
15
  export function NotificationPanelDivider({ text, className, ...rest }: NotificationPanelDividerProps) {
16
16
  return (
17
- <Typography.LightLabelS className={cn(styles.notificationPanelDivider, className)} {...extractSupportProps(rest)}>
18
- {text}
19
- </Typography.LightLabelS>
17
+ <div className={cn(styles.container, className)} {...extractSupportProps(rest)}>
18
+ <div className={styles.line}></div>
19
+ <Typography.LightLabelS className={styles.text}>{text}</Typography.LightLabelS>
20
+ <div className={styles.line}></div>
21
+ </div>
20
22
  );
21
23
  }
@@ -1,15 +1,23 @@
1
- @use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-notification-notificationPanel';
2
-
3
- .notificationPanelDivider {
4
- @include styles-tokens-notification-notificationPanel.composite-var(styles-tokens-notification-notificationPanel.$notification-panel-readed-divider);
1
+ @use '@snack-uikit/figma-tokens/build/scss/styles-theme-variables' as stv;
5
2
 
3
+ .container {
6
4
  display: flex;
5
+ gap: stv.$space-notification-panel-divider-gap;
7
6
  align-items: center;
8
7
  justify-content: center;
8
+ }
9
+
10
+ .text {
11
+ flex-grow: 0;
12
+ flex-shrink: 0;
13
+ color: stv.$sys-neutral-text-light;
14
+ }
9
15
 
10
- color: styles-tokens-notification-notificationPanel.$sys-neutral-text-light;
16
+ .line {
17
+ flex-grow: 1;
18
+ flex-shrink: 1;
11
19
 
12
- background-color: styles-tokens-notification-notificationPanel.$sys-neutral-background2-level;
13
- border-bottom-color: styles-tokens-notification-notificationPanel.$sys-neutral-decor-default;
20
+ background-color: stv.$sys-neutral-background2-level;
21
+ border-bottom-color: stv.$sys-neutral-decor-default;
14
22
  border-bottom-style: solid;
15
23
  }
@@ -1,2 +1,3 @@
1
1
  export * from './NotificationPanelSettings';
2
2
  export * from './NotificationPanelBlank';
3
+ export * from './NotificationCardStack';
@@ -9,4 +9,10 @@ export const TEST_IDS = {
9
9
  readAll: 'notification-panel__readAll',
10
10
  footerButton: 'notification-panel__footerButton',
11
11
  skeleton: 'notification-panel__skeleton',
12
+ cardStack: {
13
+ headline: 'notification-panel__card-stack__headline',
14
+ wrapper: 'notification-panel__card-stack__wrapper',
15
+ title: 'notification-panel__card-stack__title',
16
+ openButton: 'notification-panel__card-stack__open-button',
17
+ },
12
18
  };
@@ -0,0 +1,17 @@
1
+ import styles from './styles.module.scss';
2
+
3
+ type StackTailProps = {
4
+ open: boolean;
5
+ count: number;
6
+ };
7
+
8
+ export function StackTail({ open, count }: StackTailProps) {
9
+ return (
10
+ <div className={styles.container} data-open={open || undefined}>
11
+ <div className={styles.animationContainer}>
12
+ {count > 1 && <div className={styles.card} data-level='3' />}
13
+ <div className={styles.card} data-level='2' />
14
+ </div>
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1 @@
1
+ export * from './StackTail';
@@ -0,0 +1,77 @@
1
+ @use '@snack-uikit/figma-tokens/build/scss/styles-theme-variables' as stv;
2
+
3
+ $halfDuration: calc(var(--snack-notification-stack-animation-duration) / 2);
4
+
5
+ .container {
6
+ position: relative;
7
+ height: 0;
8
+ }
9
+
10
+ .animationContainer {
11
+ position: absolute;
12
+ top: 0;
13
+ bottom: calc(-1 * stv.$space-notification-panel-card-stack-stack3-level-horizontal-padding);
14
+
15
+ overflow: hidden;
16
+
17
+ width: 100%;
18
+
19
+ transition: bottom $halfDuration calc($halfDuration / 1.7) ease-out;
20
+
21
+ [data-open] & {
22
+ bottom: -416px;
23
+ transition: bottom $halfDuration ease-out;
24
+ }
25
+ }
26
+
27
+ .card {
28
+ position: absolute;
29
+
30
+ overflow: hidden;
31
+
32
+ height: 200px;
33
+
34
+ background-color: stv.$sys-neutral-background2-level;
35
+ border: stv.$border-width-notification-panel-card solid stv.$sys-neutral-decor-default;
36
+ border-radius: stv.$radius-notification-panel-card;
37
+
38
+ transition:
39
+ left $halfDuration $halfDuration ease,
40
+ right $halfDuration $halfDuration ease,
41
+ opacity $halfDuration $halfDuration ease;
42
+
43
+ &::after {
44
+ content: '';
45
+
46
+ position: absolute;
47
+ top: 0;
48
+ right: 0;
49
+ bottom: 0;
50
+ left: 0;
51
+
52
+ opacity: stv.$opacity-a008;
53
+ background-color: stv.$sys-neutral-accent-default;
54
+ }
55
+
56
+ [data-open] & {
57
+ right: 0;
58
+ left: 0;
59
+ opacity: 0;
60
+ transition:
61
+ left $halfDuration ease,
62
+ right $halfDuration ease,
63
+ opacity $halfDuration ease;
64
+ }
65
+
66
+ &[data-level="2"] {
67
+ right: stv.$space-notification-panel-card-stack-stack2-level-horizontal-padding;
68
+ bottom: 50%;
69
+ left: stv.$space-notification-panel-card-stack-stack2-level-horizontal-padding;
70
+ }
71
+
72
+ &[data-level="3"] {
73
+ right: stv.$space-notification-panel-card-stack-stack3-level-horizontal-padding;
74
+ bottom: 0;
75
+ left: stv.$space-notification-panel-card-stack-stack3-level-horizontal-padding;
76
+ }
77
+ }
@@ -34,14 +34,14 @@
34
34
  }
35
35
 
36
36
  .notificationPanelBody {
37
+ @include styles-tokens-notification-notificationPanel.composite-var(styles-tokens-notification-notificationPanel.$notification-panel-body-container);
38
+
39
+ display: flex;
37
40
  flex: 1 1 auto;
38
- min-height: 0;
39
- }
41
+ flex-direction: column;
42
+ gap: styles-tokens-element.$space-notification-panel-container-body-gap;
40
43
 
41
- .notificationPanelCard {
42
- &:last-of-type {
43
- border-bottom: none;
44
- }
44
+ min-height: 0;
45
45
  }
46
46
 
47
47
  .notificationPanelFooterButton {
@@ -0,0 +1,65 @@
1
+ import cn from 'classnames';
2
+ import { Dispatch, ReactElement, SetStateAction } from 'react';
3
+
4
+ import { ButtonFunction } from '@snack-uikit/button';
5
+ import { BaseItemProps, Droplist } from '@snack-uikit/list';
6
+ import { Tag } from '@snack-uikit/tag';
7
+
8
+ import { TEST_IDS } from '../../components/NotificationCard/constants';
9
+ import { stopPropagationClick } from '../../components/NotificationCard/helpers';
10
+ import { NotificationCardProps } from '../../components/NotificationCard/NotificationCard';
11
+ import styles from './styles.module.scss';
12
+
13
+ export type Action = {
14
+ icon?: ReactElement;
15
+ tagLabel?: string;
16
+ } & Pick<BaseItemProps, 'content' | 'onClick' | 'disabled'>;
17
+
18
+ export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps, 'actions'>> & {
19
+ actions: Action[];
20
+ open: boolean;
21
+ setDroplistOpen: Dispatch<SetStateAction<boolean>>;
22
+ size: 's' | 'xs';
23
+ icon: ReactElement;
24
+ className?: string;
25
+ };
26
+
27
+ export function ActionsButton({
28
+ actions,
29
+ open,
30
+ setDroplistOpen,
31
+ size,
32
+ icon,
33
+ className,
34
+ }: NotificationCardFunctionProps) {
35
+ return (
36
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
37
+ <div
38
+ className={cn(styles.container, className)}
39
+ data-test-id={TEST_IDS.actions.wrapper}
40
+ onClick={stopPropagationClick}
41
+ >
42
+ <Droplist
43
+ trigger='clickAndFocusVisible'
44
+ open={open}
45
+ onOpenChange={setDroplistOpen}
46
+ placement='bottom-end'
47
+ scroll
48
+ data-test-id={TEST_IDS.actions.droplist}
49
+ items={actions.map(({ onClick, disabled, content, tagLabel, icon }) => ({
50
+ onClick: e => {
51
+ setDroplistOpen(false);
52
+ onClick?.(e);
53
+ },
54
+ disabled,
55
+ content,
56
+ beforeContent: icon,
57
+ afterContent: tagLabel ? <Tag label={tagLabel} /> : undefined,
58
+ 'data-test-id': TEST_IDS.actions.droplistAction,
59
+ }))}
60
+ >
61
+ <ButtonFunction size={size} icon={icon} data-test-id={TEST_IDS.actions.droplistTrigger} />
62
+ </Droplist>
63
+ </div>
64
+ );
65
+ }
@@ -0,0 +1 @@
1
+ export * from './ActionsButton';
@@ -0,0 +1,3 @@
1
+ .container {
2
+ display: flex;
3
+ }
@@ -1,7 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- import { NotificationCardProps } from '../NotificationCard';
3
- export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps, 'actions'>> & {
4
- open: boolean;
5
- setDroplistOpen: Dispatch<SetStateAction<boolean>>;
6
- };
7
- export declare function NotificationCardFunction({ actions, open, setDroplistOpen }: NotificationCardFunctionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,64 +0,0 @@
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
- }
@@ -1,7 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- import { NotificationCardProps } from '../NotificationCard';
3
- export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps, 'actions'>> & {
4
- open: boolean;
5
- setDroplistOpen: Dispatch<SetStateAction<boolean>>;
6
- };
7
- export declare function NotificationCardFunction({ actions, open, setDroplistOpen }: NotificationCardFunctionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ButtonFunction } from '@snack-uikit/button';
3
- import { KebabSVG } from '@snack-uikit/icons';
4
- import { Droplist } from '@snack-uikit/list';
5
- import { Tag } from '@snack-uikit/tag';
6
- import { TEST_IDS } from '../constants';
7
- import styles from '../styles.module.css';
8
- export function NotificationCardFunction({ actions, open, setDroplistOpen }) {
9
- return (_jsx("div", { className: styles.notificationCardFunction, "data-test-id": TEST_IDS.actions.wrapper, children: _jsx(Droplist, { trigger: 'clickAndFocusVisible', open: open, onOpenChange: setDroplistOpen, placement: 'bottom-end', scroll: true, "data-test-id": TEST_IDS.actions.droplist, items: actions.map(({ onClick, disabled, content, tagLabel, icon }) => ({
10
- onClick: e => {
11
- setDroplistOpen(false);
12
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
13
- },
14
- disabled,
15
- content,
16
- beforeContent: icon,
17
- afterContent: tagLabel ? _jsx(Tag, { label: tagLabel }) : undefined,
18
- 'data-test-id': TEST_IDS.actions.droplistAction,
19
- })), children: _jsx(ButtonFunction, { size: 's', icon: _jsx(KebabSVG, {}), "data-test-id": TEST_IDS.actions.droplistTrigger }) }) }));
20
- }
@@ -1,43 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
-
3
- import { ButtonFunction } from '@snack-uikit/button';
4
- import { KebabSVG } from '@snack-uikit/icons';
5
- import { Droplist } from '@snack-uikit/list';
6
- import { Tag } from '@snack-uikit/tag';
7
-
8
- import { TEST_IDS } from '../constants';
9
- import { NotificationCardProps } from '../NotificationCard';
10
- import styles from '../styles.module.scss';
11
-
12
- export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps, 'actions'>> & {
13
- open: boolean;
14
- setDroplistOpen: Dispatch<SetStateAction<boolean>>;
15
- };
16
-
17
- export function NotificationCardFunction({ actions, open, setDroplistOpen }: NotificationCardFunctionProps) {
18
- return (
19
- <div className={styles.notificationCardFunction} data-test-id={TEST_IDS.actions.wrapper}>
20
- <Droplist
21
- trigger='clickAndFocusVisible'
22
- open={open}
23
- onOpenChange={setDroplistOpen}
24
- placement='bottom-end'
25
- scroll
26
- data-test-id={TEST_IDS.actions.droplist}
27
- items={actions.map(({ onClick, disabled, content, tagLabel, icon }) => ({
28
- onClick: e => {
29
- setDroplistOpen(false);
30
- onClick?.(e);
31
- },
32
- disabled,
33
- content,
34
- beforeContent: icon,
35
- afterContent: tagLabel ? <Tag label={tagLabel} /> : undefined,
36
- 'data-test-id': TEST_IDS.actions.droplistAction,
37
- }))}
38
- >
39
- <ButtonFunction size='s' icon={<KebabSVG />} data-test-id={TEST_IDS.actions.droplistTrigger} />
40
- </Droplist>
41
- </div>
42
- );
43
- }