@alfalab/core-components-notification 7.5.10 → 8.0.0-snapshot-1393ffa

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 (129) hide show
  1. package/Component.js +11 -12
  2. package/Component.js.map +1 -0
  3. package/cssm/Component.js +9 -8
  4. package/cssm/Component.js.map +1 -0
  5. package/cssm/index.js +1 -0
  6. package/cssm/index.js.map +1 -0
  7. package/cssm/index.module.css +7 -27
  8. package/cssm/shared/index.js +3 -2
  9. package/cssm/shared/index.js.map +1 -0
  10. package/{Component.d.ts → cssm/src/Component.d.ts} +5 -8
  11. package/cssm/src/index.d.ts +1 -0
  12. package/cssm/src/shared/index.d.ts +1 -0
  13. package/cssm/src/utils/getNotificationTestIds.d.ts +4 -0
  14. package/cssm/src/utils/index.d.ts +2 -0
  15. package/cssm/utils/getNotificationTestIds.js +4 -19
  16. package/cssm/utils/getNotificationTestIds.js.map +1 -0
  17. package/cssm/utils/index.js +1 -0
  18. package/cssm/utils/index.js.map +1 -0
  19. package/esm/Component.js +3 -4
  20. package/esm/Component.js.map +1 -0
  21. package/esm/index.css +15 -36
  22. package/esm/index.js +1 -0
  23. package/esm/index.js.map +1 -0
  24. package/esm/index.module.css.js +6 -0
  25. package/esm/index.module.css.js.map +1 -0
  26. package/esm/shared/index.js +1 -0
  27. package/esm/shared/index.js.map +1 -0
  28. package/esm/{Component.d.ts → src/Component.d.ts} +5 -8
  29. package/esm/src/index.d.ts +1 -0
  30. package/esm/src/shared/index.d.ts +1 -0
  31. package/esm/src/utils/getNotificationTestIds.d.ts +4 -0
  32. package/esm/src/utils/index.d.ts +2 -0
  33. package/esm/utils/getNotificationTestIds.js +2 -17
  34. package/esm/utils/getNotificationTestIds.js.map +1 -0
  35. package/esm/utils/index.js +1 -0
  36. package/esm/utils/index.js.map +1 -0
  37. package/index.css +15 -36
  38. package/index.js +1 -0
  39. package/index.js.map +1 -0
  40. package/index.module.css.js +8 -0
  41. package/index.module.css.js.map +1 -0
  42. package/modern/Component.js +3 -4
  43. package/modern/Component.js.map +1 -0
  44. package/modern/index.css +15 -36
  45. package/modern/index.js +1 -0
  46. package/modern/index.js.map +1 -0
  47. package/modern/index.module.css.js +6 -0
  48. package/modern/index.module.css.js.map +1 -0
  49. package/modern/shared/index.js +1 -0
  50. package/modern/shared/index.js.map +1 -0
  51. package/{cssm → modern/src}/Component.d.ts +5 -8
  52. package/modern/src/index.d.ts +1 -0
  53. package/modern/src/shared/index.d.ts +1 -0
  54. package/modern/src/utils/getNotificationTestIds.d.ts +4 -0
  55. package/modern/src/utils/index.d.ts +2 -0
  56. package/modern/utils/getNotificationTestIds.js +2 -17
  57. package/modern/utils/getNotificationTestIds.js.map +1 -0
  58. package/modern/utils/index.js +1 -0
  59. package/modern/utils/index.js.map +1 -0
  60. package/moderncssm/Component.js +2 -1
  61. package/moderncssm/Component.js.map +1 -0
  62. package/moderncssm/index.js +1 -0
  63. package/moderncssm/index.js.map +1 -0
  64. package/moderncssm/index.module.css +1 -2
  65. package/moderncssm/shared/index.js +1 -0
  66. package/moderncssm/shared/index.js.map +1 -0
  67. package/{modern → moderncssm/src}/Component.d.ts +5 -8
  68. package/moderncssm/src/index.d.ts +1 -0
  69. package/moderncssm/src/shared/index.d.ts +1 -0
  70. package/moderncssm/src/utils/getNotificationTestIds.d.ts +4 -0
  71. package/moderncssm/src/utils/index.d.ts +2 -0
  72. package/moderncssm/utils/getNotificationTestIds.js +2 -17
  73. package/moderncssm/utils/getNotificationTestIds.js.map +1 -0
  74. package/moderncssm/utils/index.js +1 -0
  75. package/moderncssm/utils/index.js.map +1 -0
  76. package/package.json +8 -6
  77. package/shared/index.js +3 -2
  78. package/shared/index.js.map +1 -0
  79. package/src/Component.d.ts +86 -0
  80. package/src/Component.tsx +1 -1
  81. package/src/index.d.ts +1 -0
  82. package/src/shared/index.d.ts +1 -0
  83. package/src/utils/getNotificationTestIds.d.ts +4 -0
  84. package/src/utils/index.d.ts +2 -0
  85. package/utils/getNotificationTestIds.js +4 -19
  86. package/utils/getNotificationTestIds.js.map +1 -0
  87. package/utils/index.js +1 -0
  88. package/utils/index.js.map +1 -0
  89. package/browser-e5f2ef37.d.ts +0 -8
  90. package/cssm/browser-e5f2ef37.d.ts +0 -8
  91. package/cssm/fnUtils-edf8408d.d.ts +0 -16
  92. package/cssm/index.d.ts +0 -1
  93. package/cssm/shared/index.d.ts +0 -1
  94. package/cssm/useCustomWebkitScrollbar-e5f2ef37.d.ts +0 -2
  95. package/cssm/useIsMounted-edf8408d.d.ts +0 -3
  96. package/cssm/utils/getNotificationTestIds.d.ts +0 -5
  97. package/cssm/utils/index.d.ts +0 -4
  98. package/esm/browser-e5f2ef37.d.ts +0 -8
  99. package/esm/fnUtils-edf8408d.d.ts +0 -16
  100. package/esm/index.d.ts +0 -1
  101. package/esm/shared/index.d.ts +0 -1
  102. package/esm/useCustomWebkitScrollbar-e5f2ef37.d.ts +0 -2
  103. package/esm/useIsMounted-edf8408d.d.ts +0 -3
  104. package/esm/utils/getNotificationTestIds.d.ts +0 -5
  105. package/esm/utils/index.d.ts +0 -4
  106. package/fnUtils-edf8408d.d.ts +0 -16
  107. package/index.d.ts +0 -1
  108. package/modern/browser-e5f2ef37.d.ts +0 -8
  109. package/modern/fnUtils-edf8408d.d.ts +0 -16
  110. package/modern/index.d.ts +0 -1
  111. package/modern/shared/index.d.ts +0 -1
  112. package/modern/useCustomWebkitScrollbar-e5f2ef37.d.ts +0 -2
  113. package/modern/useIsMounted-edf8408d.d.ts +0 -3
  114. package/modern/utils/getNotificationTestIds.d.ts +0 -5
  115. package/modern/utils/index.d.ts +0 -4
  116. package/moderncssm/Component.d.ts +0 -89
  117. package/moderncssm/browser-e5f2ef37.d.ts +0 -8
  118. package/moderncssm/fnUtils-edf8408d.d.ts +0 -16
  119. package/moderncssm/index.d.ts +0 -1
  120. package/moderncssm/shared/index.d.ts +0 -1
  121. package/moderncssm/useCustomWebkitScrollbar-e5f2ef37.d.ts +0 -2
  122. package/moderncssm/useIsMounted-edf8408d.d.ts +0 -3
  123. package/moderncssm/utils/getNotificationTestIds.d.ts +0 -5
  124. package/moderncssm/utils/index.d.ts +0 -4
  125. package/shared/index.d.ts +0 -1
  126. package/useCustomWebkitScrollbar-e5f2ef37.d.ts +0 -2
  127. package/useIsMounted-edf8408d.d.ts +0 -3
  128. package/utils/getNotificationTestIds.d.ts +0 -5
  129. package/utils/index.d.ts +0 -4
@@ -1,5 +1,3 @@
1
- /* */
2
-
3
1
  :root {
4
2
  --notification-desktop-content-width: 278px;
5
3
  }
@@ -11,6 +9,7 @@
11
9
  width: calc(100% - var(--gap-24));
12
10
  max-width: calc(100vw - var(--gap-24));
13
11
  -webkit-user-select: none;
12
+ -moz-user-select: none;
14
13
  user-select: none;
15
14
  transition: transform 0.4s ease-out
16
15
  }
@@ -1 +1,2 @@
1
1
  export { getNotificationTestIds } from '../utils/getNotificationTestIds.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { MouseEvent } from "react";
4
- import { ToastPlateDesktopProps } from "@alfalab/core-components-toast-plate/desktop";
5
- type NotificationProps = ToastPlateDesktopProps & {
1
+ import React, { MouseEvent } from 'react';
2
+ import { ToastPlateDesktopProps } from '@alfalab/core-components-toast-plate/desktop';
3
+ export declare type NotificationProps = ToastPlateDesktopProps & {
6
4
  /**
7
5
  * Управление видимостью компонента
8
6
  */
@@ -44,7 +42,7 @@ type NotificationProps = ToastPlateDesktopProps & {
44
42
  */
45
43
  onClickOutside?: (event?: MouseEvent<any>) => void;
46
44
  };
47
- declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopProps & {
45
+ export declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopProps & {
48
46
  /**
49
47
  * Управление видимостью компонента
50
48
  */
@@ -68,7 +66,7 @@ declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopPro
68
66
  /**
69
67
  * Позиционирование компонента от верхнего или нижнего края экрана
70
68
  */
71
- position?: "bottom" | "top" | undefined;
69
+ position?: "top" | "bottom" | undefined;
72
70
  /**
73
71
  * Обработчик события истечения времени до закрытия компонента
74
72
  */
@@ -86,4 +84,3 @@ declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopPro
86
84
  */
87
85
  onClickOutside?: ((event?: MouseEvent<any>) => void) | undefined;
88
86
  } & React.RefAttributes<HTMLDivElement>>;
89
- export { NotificationProps, Notification };
@@ -0,0 +1 @@
1
+ export * from './Component';
@@ -0,0 +1 @@
1
+ export { getNotificationTestIds } from '../utils/getNotificationTestIds';
@@ -0,0 +1,4 @@
1
+ export declare function getNotificationTestIds(dataTestId: string): {
2
+ badge: string;
3
+ component: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function useClickOutside(ref: React.RefObject<HTMLElement>, cb: (e: React.MouseEvent | React.TouchEvent) => void): void;
@@ -1,20 +1,4 @@
1
- import { detect } from 'detect-browser';
2
- import { createContext } from 'react';
3
- import '@alfalab/hooks';
4
-
5
- function getDataTestId(dataTestId, element) {
6
- const elementPart = element ? `-${element.toLowerCase()}` : '';
7
- return dataTestId ? `${dataTestId}${elementPart}` : undefined;
8
- }
9
-
10
- detect();
11
-
12
- detect();
13
-
14
- createContext(() => null);
15
-
16
- /* eslint-disable no-console */
17
- if (process.env.NODE_ENV === 'development') ;
1
+ import { getDataTestId } from '@alfalab/core-components-shared/moderncssm';
18
2
 
19
3
  function getNotificationTestIds(dataTestId) {
20
4
  return {
@@ -24,3 +8,4 @@ function getNotificationTestIds(dataTestId) {
24
8
  }
25
9
 
26
10
  export { getNotificationTestIds };
11
+ //# sourceMappingURL=getNotificationTestIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTestIds.js","sources":["../../../src/utils/getNotificationTestIds.ts"],"sourcesContent":["import { getDataTestId } from '@alfalab/core-components-shared';\n\nexport function getNotificationTestIds(dataTestId: string) {\n return {\n badge: getDataTestId(dataTestId, 'badge'),\n component: getDataTestId(dataTestId, 'component'),\n };\n}\n"],"names":[],"mappings":";;AAEM,SAAU,sBAAsB,CAAC,UAAkB,EAAA;IACrD,OAAO;AACH,QAAA,KAAK,EAAE,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC;AACzC,QAAA,SAAS,EAAE,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC;KACpD;AACL;;;;"}
@@ -25,3 +25,4 @@ function useClickOutside(ref, cb) {
25
25
  }
26
26
 
27
27
  export { useClickOutside };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["import React from 'react';\n\n/*\n * Дублирую хук из @alfalab/hooks, так как не подходят названия событий\n * https://github.com/core-ds/utils/blob/develop/packages/hooks/src/useClickOutside/hook.ts\n * issue завел, когда изменения будут реализованы, отсюда можно будет удалить\n * https://github.com/core-ds/utils/issues/35\n */\nexport function useClickOutside(\n ref: React.RefObject<HTMLElement>,\n cb: (e: React.MouseEvent | React.TouchEvent) => void,\n): void {\n React.useEffect(() => {\n // eslint-disable-next-line\n const handler = (event: any) => {\n if (!ref.current || ref.current.contains(event.target)) {\n return;\n }\n\n cb(event);\n };\n\n document.addEventListener('click', handler);\n document.addEventListener('touchend', handler);\n\n return () => {\n document.removeEventListener('click', handler);\n document.removeEventListener('touchend', handler);\n };\n }, [ref, cb]);\n}\n"],"names":[],"mappings":";;AAEA;;;;;AAKG;AACa,SAAA,eAAe,CAC3B,GAAiC,EACjC,EAAoD,EAAA;AAEpD,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;;AAEjB,QAAA,MAAM,OAAO,GAAG,CAAC,KAAU,KAAI;AAC3B,YAAA,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;gBACpD;AACH;YAED,EAAE,CAAC,KAAK,CAAC;AACb,SAAC;AAED,QAAA,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;AAC3C,QAAA,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC;AAE9C,QAAA,OAAO,MAAK;AACR,YAAA,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;AAC9C,YAAA,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC;AACrD,SAAC;AACL,KAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACjB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-notification",
3
- "version": "7.5.10",
3
+ "version": "8.0.0-snapshot-1393ffa",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -12,18 +12,20 @@
12
12
  },
13
13
  "sideEffects": false,
14
14
  "peerDependencies": {
15
+ "@alfalab/core-components-stack-context": "1.0.0-snapshot-1393ffa",
15
16
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@alfalab/core-components-portal": "^3.3.7",
19
- "@alfalab/core-components-stack": "^5.0.1",
20
- "@alfalab/core-components-toast-plate": "^7.3.11",
19
+ "@alfalab/core-components-portal": "3.3.8-snapshot-1393ffa",
20
+ "@alfalab/core-components-stack": "6.0.0-snapshot-1393ffa",
21
+ "@alfalab/core-components-toast-plate": "7.3.12-snapshot-1393ffa",
22
+ "@alfalab/core-components-shared": "0.16.1-snapshot-1393ffa",
21
23
  "classnames": "^2.5.1",
22
24
  "element-closest": "^3.0.2",
23
25
  "react-merge-refs": "^1.1.0",
24
26
  "react-swipeable": "^7.0.0",
25
27
  "tslib": "^2.4.0"
26
28
  },
27
- "themesVersion": "13.7.2",
28
- "varsVersion": "9.19.0"
29
+ "themesVersion": "14.0.0-snapshot-1393ffa",
30
+ "varsVersion": "9.20.1-snapshot-1393ffa"
29
31
  }
package/shared/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utils_getNotificationTestIds = require('../utils/getNotificationTestIds.js');
5
+ var getNotificationTestIds = require('../utils/getNotificationTestIds.js');
6
6
 
7
7
 
8
8
 
9
- exports.getNotificationTestIds = utils_getNotificationTestIds.getNotificationTestIds;
9
+ exports.getNotificationTestIds = getNotificationTestIds.getNotificationTestIds;
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,86 @@
1
+ import React, { MouseEvent } from 'react';
2
+ import { ToastPlateDesktopProps } from '@alfalab/core-components-toast-plate/desktop';
3
+ export declare type NotificationProps = ToastPlateDesktopProps & {
4
+ /**
5
+ * Управление видимостью компонента
6
+ */
7
+ visible?: boolean;
8
+ /**
9
+ * Отступ от верхнего края
10
+ */
11
+ offset?: number;
12
+ /**
13
+ * Время до закрытия компонента
14
+ */
15
+ autoCloseDelay?: number | null;
16
+ /**
17
+ * Использовать портал
18
+ */
19
+ usePortal?: boolean;
20
+ /**
21
+ * z-index компонента
22
+ */
23
+ zIndex?: number;
24
+ /**
25
+ * Позиционирование компонента от верхнего или нижнего края экрана
26
+ */
27
+ position?: 'top' | 'bottom';
28
+ /**
29
+ * Обработчик события истечения времени до закрытия компонента
30
+ */
31
+ onCloseTimeout?: () => void;
32
+ /**
33
+ * Обработчик события наведения курсора на компонент
34
+ */
35
+ onMouseEnter?: (event?: MouseEvent<HTMLDivElement>) => void;
36
+ /**
37
+ * Обработчик события снятия курсора с компонента
38
+ */
39
+ onMouseLeave?: (event?: MouseEvent<HTMLDivElement>) => void;
40
+ /**
41
+ * Обработчик клика вне компонента
42
+ */
43
+ onClickOutside?: (event?: MouseEvent<any>) => void;
44
+ };
45
+ export declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopProps & {
46
+ /**
47
+ * Управление видимостью компонента
48
+ */
49
+ visible?: boolean | undefined;
50
+ /**
51
+ * Отступ от верхнего края
52
+ */
53
+ offset?: number | undefined;
54
+ /**
55
+ * Время до закрытия компонента
56
+ */
57
+ autoCloseDelay?: number | null | undefined;
58
+ /**
59
+ * Использовать портал
60
+ */
61
+ usePortal?: boolean | undefined;
62
+ /**
63
+ * z-index компонента
64
+ */
65
+ zIndex?: number | undefined;
66
+ /**
67
+ * Позиционирование компонента от верхнего или нижнего края экрана
68
+ */
69
+ position?: "top" | "bottom" | undefined;
70
+ /**
71
+ * Обработчик события истечения времени до закрытия компонента
72
+ */
73
+ onCloseTimeout?: (() => void) | undefined;
74
+ /**
75
+ * Обработчик события наведения курсора на компонент
76
+ */
77
+ onMouseEnter?: ((event?: MouseEvent<HTMLDivElement>) => void) | undefined;
78
+ /**
79
+ * Обработчик события снятия курсора с компонента
80
+ */
81
+ onMouseLeave?: ((event?: MouseEvent<HTMLDivElement>) => void) | undefined;
82
+ /**
83
+ * Обработчик клика вне компонента
84
+ */
85
+ onClickOutside?: ((event?: MouseEvent<any>) => void) | undefined;
86
+ } & React.RefAttributes<HTMLDivElement>>;
package/src/Component.tsx CHANGED
@@ -14,11 +14,11 @@ import elementClosest from 'element-closest';
14
14
 
15
15
  import { Portal } from '@alfalab/core-components-portal';
16
16
  import { Stack } from '@alfalab/core-components-stack';
17
+ import { stackingOrder } from '@alfalab/core-components-stack-context';
17
18
  import {
18
19
  ToastPlateDesktop,
19
20
  ToastPlateDesktopProps,
20
21
  } from '@alfalab/core-components-toast-plate/desktop';
21
- import { stackingOrder } from '@alfalab/stack-context';
22
22
 
23
23
  import { useClickOutside } from './utils';
24
24
 
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './Component';
@@ -0,0 +1 @@
1
+ export { getNotificationTestIds } from '../utils/getNotificationTestIds';
@@ -0,0 +1,4 @@
1
+ export declare function getNotificationTestIds(dataTestId: string): {
2
+ badge: string;
3
+ component: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function useClickOutside(ref: React.RefObject<HTMLElement>, cb: (e: React.MouseEvent | React.TouchEvent) => void): void;
@@ -2,29 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var detectBrowser = require('detect-browser');
6
- var React = require('react');
7
- require('@alfalab/hooks');
8
-
9
- function getDataTestId(dataTestId, element) {
10
- var elementPart = element ? "-".concat(element.toLowerCase()) : '';
11
- return dataTestId ? "".concat(dataTestId).concat(elementPart) : undefined;
12
- }
13
-
14
- detectBrowser.detect();
15
-
16
- detectBrowser.detect();
17
-
18
- React.createContext(function () { return null; });
19
-
20
- /* eslint-disable no-console */
21
- if (process.env.NODE_ENV === 'development') ;
5
+ var coreComponentsShared = require('@alfalab/core-components-shared');
22
6
 
23
7
  function getNotificationTestIds(dataTestId) {
24
8
  return {
25
- badge: getDataTestId(dataTestId, 'badge'),
26
- component: getDataTestId(dataTestId, 'component'),
9
+ badge: coreComponentsShared.getDataTestId(dataTestId, 'badge'),
10
+ component: coreComponentsShared.getDataTestId(dataTestId, 'component'),
27
11
  };
28
12
  }
29
13
 
30
14
  exports.getNotificationTestIds = getNotificationTestIds;
15
+ //# sourceMappingURL=getNotificationTestIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTestIds.js","sources":["../../src/utils/getNotificationTestIds.ts"],"sourcesContent":["import { getDataTestId } from '@alfalab/core-components-shared';\n\nexport function getNotificationTestIds(dataTestId: string) {\n return {\n badge: getDataTestId(dataTestId, 'badge'),\n component: getDataTestId(dataTestId, 'component'),\n };\n}\n"],"names":["getDataTestId"],"mappings":";;;;;;AAEM,SAAU,sBAAsB,CAAC,UAAkB,EAAA;IACrD,OAAO;AACH,QAAA,KAAK,EAAEA,kCAAa,CAAC,UAAU,EAAE,OAAO,CAAC;AACzC,QAAA,SAAS,EAAEA,kCAAa,CAAC,UAAU,EAAE,WAAW,CAAC;KACpD;AACL;;;;"}
package/utils/index.js CHANGED
@@ -33,3 +33,4 @@ function useClickOutside(ref, cb) {
33
33
  }
34
34
 
35
35
  exports.useClickOutside = useClickOutside;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import React from 'react';\n\n/*\n * Дублирую хук из @alfalab/hooks, так как не подходят названия событий\n * https://github.com/core-ds/utils/blob/develop/packages/hooks/src/useClickOutside/hook.ts\n * issue завел, когда изменения будут реализованы, отсюда можно будет удалить\n * https://github.com/core-ds/utils/issues/35\n */\nexport function useClickOutside(\n ref: React.RefObject<HTMLElement>,\n cb: (e: React.MouseEvent | React.TouchEvent) => void,\n): void {\n React.useEffect(() => {\n // eslint-disable-next-line\n const handler = (event: any) => {\n if (!ref.current || ref.current.contains(event.target)) {\n return;\n }\n\n cb(event);\n };\n\n document.addEventListener('click', handler);\n document.addEventListener('touchend', handler);\n\n return () => {\n document.removeEventListener('click', handler);\n document.removeEventListener('touchend', handler);\n };\n }, [ref, cb]);\n}\n"],"names":["React"],"mappings":";;;;;;;;;;AAEA;;;;;AAKG;AACa,SAAA,eAAe,CAC3B,GAAiC,EACjC,EAAoD,EAAA;IAEpDA,sBAAK,CAAC,SAAS,CAAC,YAAA;;QAEZ,IAAM,OAAO,GAAG,UAAC,KAAU,EAAA;AACvB,YAAA,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;gBACpD;AACH;YAED,EAAE,CAAC,KAAK,CAAC;AACb,SAAC;AAED,QAAA,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;AAC3C,QAAA,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC;QAE9C,OAAO,YAAA;AACH,YAAA,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;AAC9C,YAAA,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC;AACrD,SAAC;AACL,KAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACjB;;;;"}
@@ -1,8 +0,0 @@
1
- declare function isWebkitBased(): boolean;
2
- declare function isSafari(): boolean;
3
- declare const browser: {
4
- getScrollbarSize: () => number;
5
- isWebkitBased: typeof isWebkitBased;
6
- isSafari: typeof isSafari;
7
- };
8
- export { browser };
@@ -1,8 +0,0 @@
1
- declare function isWebkitBased(): boolean;
2
- declare function isSafari(): boolean;
3
- declare const browser: {
4
- getScrollbarSize: () => number;
5
- isWebkitBased: typeof isWebkitBased;
6
- isSafari: typeof isSafari;
7
- };
8
- export { browser };
@@ -1,16 +0,0 @@
1
- /**
2
- * Возвращает true, если значение равно null или undefined
3
- */
4
- declare function isNullable<T>(value: T): value is T & (null | undefined);
5
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
6
- /**
7
- * Выбор значения между min max границами
8
- */
9
- declare function clamp<T extends Date | number>(value: T, min: T, max: T): T;
10
- declare function noop(): void;
11
- declare const fnUtils: {
12
- clamp: typeof clamp;
13
- noop: typeof noop;
14
- isNil: typeof isNullable;
15
- };
16
- export { isNullable, isNonNullable, noop, fnUtils };
package/cssm/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./Component";
@@ -1 +0,0 @@
1
- export { getNotificationTestIds } from "../utils/getNotificationTestIds";
@@ -1,2 +0,0 @@
1
- declare function useCustomWebkitScrollbar(): boolean;
2
- export { useCustomWebkitScrollbar };
@@ -1,3 +0,0 @@
1
- import { RefObject } from 'react';
2
- declare const useIsMounted: () => [isMountedRef: RefObject<boolean>, runIfMounted: (callback: () => void) => void];
3
- export { useIsMounted };
@@ -1,5 +0,0 @@
1
- declare function getNotificationTestIds(dataTestId: string): {
2
- badge: string;
3
- component: string;
4
- };
5
- export { getNotificationTestIds };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- declare function useClickOutside(ref: React.RefObject<HTMLElement>, cb: (e: React.MouseEvent | React.TouchEvent) => void): void;
4
- export { useClickOutside };
@@ -1,8 +0,0 @@
1
- declare function isWebkitBased(): boolean;
2
- declare function isSafari(): boolean;
3
- declare const browser: {
4
- getScrollbarSize: () => number;
5
- isWebkitBased: typeof isWebkitBased;
6
- isSafari: typeof isSafari;
7
- };
8
- export { browser };
@@ -1,16 +0,0 @@
1
- /**
2
- * Возвращает true, если значение равно null или undefined
3
- */
4
- declare function isNullable<T>(value: T): value is T & (null | undefined);
5
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
6
- /**
7
- * Выбор значения между min max границами
8
- */
9
- declare function clamp<T extends Date | number>(value: T, min: T, max: T): T;
10
- declare function noop(): void;
11
- declare const fnUtils: {
12
- clamp: typeof clamp;
13
- noop: typeof noop;
14
- isNil: typeof isNullable;
15
- };
16
- export { isNullable, isNonNullable, noop, fnUtils };
package/esm/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./Component";
@@ -1 +0,0 @@
1
- export { getNotificationTestIds } from "../utils/getNotificationTestIds";
@@ -1,2 +0,0 @@
1
- declare function useCustomWebkitScrollbar(): boolean;
2
- export { useCustomWebkitScrollbar };
@@ -1,3 +0,0 @@
1
- import { RefObject } from 'react';
2
- declare const useIsMounted: () => [isMountedRef: RefObject<boolean>, runIfMounted: (callback: () => void) => void];
3
- export { useIsMounted };
@@ -1,5 +0,0 @@
1
- declare function getNotificationTestIds(dataTestId: string): {
2
- badge: string;
3
- component: string;
4
- };
5
- export { getNotificationTestIds };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- declare function useClickOutside(ref: React.RefObject<HTMLElement>, cb: (e: React.MouseEvent | React.TouchEvent) => void): void;
4
- export { useClickOutside };
@@ -1,16 +0,0 @@
1
- /**
2
- * Возвращает true, если значение равно null или undefined
3
- */
4
- declare function isNullable<T>(value: T): value is T & (null | undefined);
5
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
6
- /**
7
- * Выбор значения между min max границами
8
- */
9
- declare function clamp<T extends Date | number>(value: T, min: T, max: T): T;
10
- declare function noop(): void;
11
- declare const fnUtils: {
12
- clamp: typeof clamp;
13
- noop: typeof noop;
14
- isNil: typeof isNullable;
15
- };
16
- export { isNullable, isNonNullable, noop, fnUtils };
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./Component";
@@ -1,8 +0,0 @@
1
- declare function isWebkitBased(): boolean;
2
- declare function isSafari(): boolean;
3
- declare const browser: {
4
- getScrollbarSize: () => number;
5
- isWebkitBased: typeof isWebkitBased;
6
- isSafari: typeof isSafari;
7
- };
8
- export { browser };
@@ -1,16 +0,0 @@
1
- /**
2
- * Возвращает true, если значение равно null или undefined
3
- */
4
- declare function isNullable<T>(value: T): value is T & (null | undefined);
5
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
6
- /**
7
- * Выбор значения между min max границами
8
- */
9
- declare function clamp<T extends Date | number>(value: T, min: T, max: T): T;
10
- declare function noop(): void;
11
- declare const fnUtils: {
12
- clamp: typeof clamp;
13
- noop: typeof noop;
14
- isNil: typeof isNullable;
15
- };
16
- export { isNullable, isNonNullable, noop, fnUtils };
package/modern/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./Component";
@@ -1 +0,0 @@
1
- export { getNotificationTestIds } from "../utils/getNotificationTestIds";
@@ -1,2 +0,0 @@
1
- declare function useCustomWebkitScrollbar(): boolean;
2
- export { useCustomWebkitScrollbar };
@@ -1,3 +0,0 @@
1
- import { RefObject } from 'react';
2
- declare const useIsMounted: () => [isMountedRef: RefObject<boolean>, runIfMounted: (callback: () => void) => void];
3
- export { useIsMounted };
@@ -1,5 +0,0 @@
1
- declare function getNotificationTestIds(dataTestId: string): {
2
- badge: string;
3
- component: string;
4
- };
5
- export { getNotificationTestIds };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- declare function useClickOutside(ref: React.RefObject<HTMLElement>, cb: (e: React.MouseEvent | React.TouchEvent) => void): void;
4
- export { useClickOutside };
@@ -1,89 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { MouseEvent } from "react";
4
- import { ToastPlateDesktopProps } from "@alfalab/core-components-toast-plate/desktop";
5
- type NotificationProps = ToastPlateDesktopProps & {
6
- /**
7
- * Управление видимостью компонента
8
- */
9
- visible?: boolean;
10
- /**
11
- * Отступ от верхнего края
12
- */
13
- offset?: number;
14
- /**
15
- * Время до закрытия компонента
16
- */
17
- autoCloseDelay?: number | null;
18
- /**
19
- * Использовать портал
20
- */
21
- usePortal?: boolean;
22
- /**
23
- * z-index компонента
24
- */
25
- zIndex?: number;
26
- /**
27
- * Позиционирование компонента от верхнего или нижнего края экрана
28
- */
29
- position?: 'top' | 'bottom';
30
- /**
31
- * Обработчик события истечения времени до закрытия компонента
32
- */
33
- onCloseTimeout?: () => void;
34
- /**
35
- * Обработчик события наведения курсора на компонент
36
- */
37
- onMouseEnter?: (event?: MouseEvent<HTMLDivElement>) => void;
38
- /**
39
- * Обработчик события снятия курсора с компонента
40
- */
41
- onMouseLeave?: (event?: MouseEvent<HTMLDivElement>) => void;
42
- /**
43
- * Обработчик клика вне компонента
44
- */
45
- onClickOutside?: (event?: MouseEvent<any>) => void;
46
- };
47
- declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopProps & {
48
- /**
49
- * Управление видимостью компонента
50
- */
51
- visible?: boolean | undefined;
52
- /**
53
- * Отступ от верхнего края
54
- */
55
- offset?: number | undefined;
56
- /**
57
- * Время до закрытия компонента
58
- */
59
- autoCloseDelay?: number | null | undefined;
60
- /**
61
- * Использовать портал
62
- */
63
- usePortal?: boolean | undefined;
64
- /**
65
- * z-index компонента
66
- */
67
- zIndex?: number | undefined;
68
- /**
69
- * Позиционирование компонента от верхнего или нижнего края экрана
70
- */
71
- position?: "bottom" | "top" | undefined;
72
- /**
73
- * Обработчик события истечения времени до закрытия компонента
74
- */
75
- onCloseTimeout?: (() => void) | undefined;
76
- /**
77
- * Обработчик события наведения курсора на компонент
78
- */
79
- onMouseEnter?: ((event?: MouseEvent<HTMLDivElement>) => void) | undefined;
80
- /**
81
- * Обработчик события снятия курсора с компонента
82
- */
83
- onMouseLeave?: ((event?: MouseEvent<HTMLDivElement>) => void) | undefined;
84
- /**
85
- * Обработчик клика вне компонента
86
- */
87
- onClickOutside?: ((event?: MouseEvent<any>) => void) | undefined;
88
- } & React.RefAttributes<HTMLDivElement>>;
89
- export { NotificationProps, Notification };
@@ -1,8 +0,0 @@
1
- declare function isWebkitBased(): boolean;
2
- declare function isSafari(): boolean;
3
- declare const browser: {
4
- getScrollbarSize: () => number;
5
- isWebkitBased: typeof isWebkitBased;
6
- isSafari: typeof isSafari;
7
- };
8
- export { browser };