@salutejs/plasma-new-hope 0.116.1-canary.1345.10273776051.0 → 0.116.1-canary.1345.10274146329.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/cjs/components/Modal/Modal.js +3 -1
  2. package/cjs/components/Modal/Modal.js.map +1 -1
  3. package/cjs/hooks/useFocusTrap.js +97 -0
  4. package/cjs/hooks/useFocusTrap.js.map +1 -0
  5. package/cjs/index.js +2 -0
  6. package/cjs/index.js.map +1 -1
  7. package/cjs/utils/focusManager.js +56 -0
  8. package/cjs/utils/focusManager.js.map +1 -0
  9. package/cjs/utils/scopeTab.js +37 -0
  10. package/cjs/utils/scopeTab.js.map +1 -0
  11. package/cjs/utils/tabbable.js +51 -0
  12. package/cjs/utils/tabbable.js.map +1 -0
  13. package/emotion/cjs/components/Modal/Modal.js +4 -3
  14. package/emotion/cjs/hooks/index.js +7 -0
  15. package/emotion/cjs/hooks/useFocusTrap.js +95 -0
  16. package/emotion/cjs/utils/focusManager.js +60 -0
  17. package/emotion/cjs/utils/scopeTab.js +35 -0
  18. package/emotion/cjs/utils/tabbable.js +46 -0
  19. package/emotion/cjs/utils/useFocusTrap.js +95 -0
  20. package/emotion/es/components/Modal/Modal.js +2 -1
  21. package/emotion/es/hooks/index.js +1 -0
  22. package/emotion/es/hooks/useFocusTrap.js +90 -0
  23. package/emotion/es/utils/focusManager.js +55 -0
  24. package/emotion/es/utils/scopeTab.js +30 -0
  25. package/emotion/es/utils/tabbable.js +40 -0
  26. package/emotion/es/utils/useFocusTrap.js +90 -0
  27. package/es/components/Modal/Modal.js +3 -1
  28. package/es/components/Modal/Modal.js.map +1 -1
  29. package/es/hooks/useFocusTrap.js +93 -0
  30. package/es/hooks/useFocusTrap.js.map +1 -0
  31. package/es/index.js +1 -0
  32. package/es/index.js.map +1 -1
  33. package/es/utils/focusManager.js +52 -0
  34. package/es/utils/focusManager.js.map +1 -0
  35. package/es/utils/scopeTab.js +33 -0
  36. package/es/utils/scopeTab.js.map +1 -0
  37. package/es/utils/tabbable.js +43 -0
  38. package/es/utils/tabbable.js.map +1 -0
  39. package/package.json +4 -4
  40. package/styled-components/cjs/components/Modal/Modal.js +4 -3
  41. package/styled-components/cjs/hooks/index.js +7 -0
  42. package/styled-components/cjs/hooks/useFocusTrap.js +95 -0
  43. package/styled-components/cjs/utils/focusManager.js +60 -0
  44. package/styled-components/cjs/utils/scopeTab.js +35 -0
  45. package/styled-components/cjs/utils/tabbable.js +46 -0
  46. package/styled-components/cjs/utils/useFocusTrap.js +95 -0
  47. package/styled-components/es/components/Modal/Modal.js +2 -1
  48. package/styled-components/es/hooks/index.js +1 -0
  49. package/styled-components/es/hooks/useFocusTrap.js +90 -0
  50. package/styled-components/es/utils/focusManager.js +55 -0
  51. package/styled-components/es/utils/scopeTab.js +30 -0
  52. package/styled-components/es/utils/tabbable.js +40 -0
  53. package/styled-components/es/utils/useFocusTrap.js +90 -0
  54. package/types/components/Modal/Modal.d.ts.map +1 -1
  55. package/types/hooks/index.d.ts +1 -0
  56. package/types/hooks/index.d.ts.map +1 -1
  57. package/types/hooks/useFocusTrap.d.ts +6 -0
  58. package/types/hooks/useFocusTrap.d.ts.map +1 -0
  59. package/types/utils/focusManager.d.ts +15 -0
  60. package/types/utils/focusManager.d.ts.map +1 -0
  61. package/types/utils/scopeTab.d.ts +7 -0
  62. package/types/utils/scopeTab.d.ts.map +1 -0
  63. package/types/utils/tabbable.d.ts +6 -0
  64. package/types/utils/tabbable.d.ts.map +1 -0
  65. package/types/utils/useFocusTrap.d.ts +6 -0
  66. package/types/utils/useFocusTrap.d.ts.map +1 -0
@@ -0,0 +1,90 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { FocusManager } from '../utils/focusManager';
3
+ import { focusSelector, isFocusable, isTabble } from '../utils/tabbable';
4
+ import { scopeTab } from '../utils/scopeTab';
5
+
6
+ // Находим элемент для фокуса
7
+ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
8
+ var focusElement = null;
9
+ if (firstFocusSelector) {
10
+ if (typeof firstFocusSelector === 'string') {
11
+ focusElement = node.querySelector(firstFocusSelector);
12
+ } else if (firstFocusSelector.current) {
13
+ focusElement = firstFocusSelector.current;
14
+ }
15
+ }
16
+ if (!focusElement) {
17
+ var children = Array.from(node.querySelectorAll(focusSelector));
18
+ focusElement = children.find(function (el) {
19
+ return isTabble(el);
20
+ }) || null;
21
+ }
22
+
23
+ // Если ничего не нашлось, то может ли сама нода быть под фокусом
24
+ if (!focusElement && isFocusable(node)) {
25
+ focusElement = node;
26
+ }
27
+ return focusElement;
28
+ };
29
+ var processNode = function processNode(node, firstFocusSelector, ref) {
30
+ if (ref !== null && ref !== void 0 && ref.current) {
31
+ ref.current.removeEventListener('animationend', function () {
32
+ processNode(node, firstFocusSelector, ref);
33
+ });
34
+ }
35
+ var focusElement = getFocusElement(node, firstFocusSelector);
36
+ if (focusElement) {
37
+ focusElement.focus();
38
+ }
39
+ };
40
+ var focusManager = /*#__PURE__*/new FocusManager();
41
+
42
+ /**
43
+ * Захватывает фокус внутри DOM node.
44
+ * */
45
+ export var useFocusTrap = function useFocusTrap() {
46
+ var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
47
+ var firstFocusSelector = arguments.length > 1 ? arguments[1] : undefined;
48
+ var focusAfterNode = arguments.length > 2 ? arguments[2] : undefined;
49
+ var activeAfterAnimation = arguments.length > 3 ? arguments[3] : undefined;
50
+ var ref = useRef();
51
+ var setRef = useCallback(function (node) {
52
+ if (ref.current) {
53
+ focusManager.teardownScopedFocus();
54
+ focusManager.returnFocus();
55
+ }
56
+ if (active && node) {
57
+ focusManager.setupScopedFocus(node);
58
+ focusManager.markForFocusAfter(focusAfterNode);
59
+
60
+ // Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
61
+ setTimeout(function () {
62
+ if (ref !== null && ref !== void 0 && ref.current && node.ownerDocument && activeAfterAnimation) {
63
+ ref.current.addEventListener('animationend', function () {
64
+ processNode(node, firstFocusSelector, ref);
65
+ });
66
+ } else if (node.ownerDocument) {
67
+ processNode(node, firstFocusSelector);
68
+ }
69
+ });
70
+ ref.current = node;
71
+ return;
72
+ }
73
+ ref.current = null;
74
+ }, [active, firstFocusSelector]);
75
+ useEffect(function () {
76
+ if (!active) {
77
+ return;
78
+ }
79
+ var handleKeyDown = function handleKeyDown(event) {
80
+ if (event.key === 'Tab' && ref.current) {
81
+ scopeTab(ref.current, event);
82
+ }
83
+ };
84
+ document.addEventListener('keydown', handleKeyDown);
85
+ return function () {
86
+ document.removeEventListener('keydown', handleKeyDown);
87
+ };
88
+ }, [active]);
89
+ return setRef;
90
+ };
@@ -0,0 +1,55 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import { findTabbableDescendants } from './tabbable';
9
+
10
+ /**
11
+ * Менеджер фокуса при открытии и закрытии нод при использовании focus-trap.
12
+ * Также необходим, чтобы фокус всегда должен находиться внутри необходимой ноды.
13
+ * */
14
+ export var FocusManager = /*#__PURE__*/_createClass(function FocusManager() {
15
+ var _this = this;
16
+ _classCallCheck(this, FocusManager);
17
+ // массив с элементами, которые нужно зафокусить после анмаунта
18
+ _defineProperty(this, "focusAfterElements", []);
19
+ // массив с trap нодами
20
+ _defineProperty(this, "focusNodes", []);
21
+ _defineProperty(this, "handleFocus", function () {
22
+ // Фокус всегда должен находиться внутри необходимой ноды
23
+ var focusNode = _this.focusNodes[_this.focusNodes.length - 1];
24
+ if (!focusNode || focusNode.contains(document.activeElement)) {
25
+ return;
26
+ }
27
+
28
+ // Выделяем первый tabbable элемент
29
+ var el = findTabbableDescendants(focusNode)[0] || focusNode;
30
+ el.focus();
31
+ });
32
+ // добавление на фокус после анмаунта
33
+ _defineProperty(this, "markForFocusAfter", function (focusAfterNode) {
34
+ var node = focusAfterNode && focusAfterNode.current ? focusAfterNode.current : document.activeElement;
35
+ _this.focusAfterElements.push(node);
36
+ });
37
+ // фокус на необходимый элемент
38
+ _defineProperty(this, "returnFocus", function () {
39
+ var _this$focusAfterEleme;
40
+ var toFocus = (_this$focusAfterEleme = _this.focusAfterElements.pop()) !== null && _this$focusAfterEleme !== void 0 ? _this$focusAfterEleme : null;
41
+ if (toFocus) {
42
+ toFocus.focus();
43
+ }
44
+ });
45
+ // при маунте ноды
46
+ _defineProperty(this, "setupScopedFocus", function (element) {
47
+ _this.focusNodes.push(element);
48
+ document.addEventListener('focusin', _this.handleFocus, true);
49
+ });
50
+ // при анмаунте
51
+ _defineProperty(this, "teardownScopedFocus", function () {
52
+ _this.focusNodes.pop();
53
+ document.removeEventListener('focusin', _this.handleFocus);
54
+ });
55
+ });
@@ -0,0 +1,30 @@
1
+ import { findTabbableDescendants } from './tabbable';
2
+
3
+ /**
4
+ * Управлление фокусом лишь внутри ноды через tab
5
+ * @param node
6
+ * @param event
7
+ */
8
+ export var scopeTab = function scopeTab(node, event) {
9
+ var tabbable = findTabbableDescendants(node);
10
+ if (!tabbable.length) {
11
+ event.preventDefault();
12
+ return;
13
+ }
14
+
15
+ // смотрим, является ли элемент крайним - первый или последним
16
+ var finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
17
+ var leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
18
+
19
+ // если не является, то передаем обработку таба самому браузеру
20
+ if (!leavingFinalTabbable) {
21
+ return;
22
+ }
23
+
24
+ // иначе зацкливаемся
25
+ event.preventDefault();
26
+ var target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
27
+ if (target) {
28
+ target.focus();
29
+ }
30
+ };
@@ -0,0 +1,40 @@
1
+ var tabbableNode = /input|select|textarea|button|object/;
2
+ export var focusSelector = /*#__PURE__*/['input', 'select', 'textarea', 'a', 'button', 'object', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
3
+ var isHidden = function isHidden(el) {
4
+ return el.offsetWidth <= 0 && el.offsetHeight <= 0 || el.style.display === 'none' || el.style.visibility === 'hidden' || el.style.opacity === '0';
5
+ };
6
+ export var isVisible = function isVisible(element, parentContainer) {
7
+ var parentElement = element;
8
+ while (parentElement) {
9
+ if (parentElement === parentContainer || parentElement === document.body) {
10
+ break;
11
+ }
12
+ if (isHidden(parentElement)) {
13
+ return false;
14
+ }
15
+ parentElement = parentElement.parentNode;
16
+ }
17
+ return true;
18
+ };
19
+ var getElementTabIndex = function getElementTabIndex(element) {
20
+ var tabIndex = element.getAttribute('tabindex');
21
+ return tabIndex === null ? NaN : parseInt(tabIndex, 10);
22
+ };
23
+ export var isFocusable = function isFocusable(element, parentContainer) {
24
+ var nodeName = element.nodeName.toLowerCase();
25
+ var isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element));
26
+ var res = tabbableNode.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN);
27
+ return Boolean(res) && isVisible(element, parentContainer);
28
+ };
29
+ export var isTabble = function isTabble(element, parentContainer) {
30
+ var tabIndex = getElementTabIndex(element);
31
+ var isTabIndexNaN = Number.isNaN(tabIndex);
32
+ return (isTabIndexNaN || tabIndex >= 0) && isFocusable(element, parentContainer);
33
+ };
34
+
35
+ // Все элементы внутри данной ноды, до которых можно добраться табом
36
+ export var findTabbableDescendants = function findTabbableDescendants(element) {
37
+ return Array.from(element.querySelectorAll(focusSelector)).filter(function (el) {
38
+ return isTabble(el, element);
39
+ });
40
+ };
@@ -0,0 +1,90 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { FocusManager } from '../utils/focusManager';
3
+ import { focusSelector, isFocusable, isTabble } from '../utils/tabbable';
4
+ import { scopeTab } from '../utils/scopeTab';
5
+
6
+ // Находим элемент для фокуса
7
+ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
8
+ var focusElement = null;
9
+ if (firstFocusSelector) {
10
+ if (typeof firstFocusSelector === 'string') {
11
+ focusElement = node.querySelector(firstFocusSelector);
12
+ } else if (firstFocusSelector.current) {
13
+ focusElement = firstFocusSelector.current;
14
+ }
15
+ }
16
+ if (!focusElement) {
17
+ var children = Array.from(node.querySelectorAll(focusSelector));
18
+ focusElement = children.find(function (el) {
19
+ return isTabble(el);
20
+ }) || null;
21
+ }
22
+
23
+ // Если ничего не нашлось, то может ли сама нода быть под фокусом
24
+ if (!focusElement && isFocusable(node)) {
25
+ focusElement = node;
26
+ }
27
+ return focusElement;
28
+ };
29
+ var processNode = function processNode(node, firstFocusSelector, ref) {
30
+ if (ref !== null && ref !== void 0 && ref.current) {
31
+ ref.current.removeEventListener('animationend', function () {
32
+ processNode(node, firstFocusSelector, ref);
33
+ });
34
+ }
35
+ var focusElement = getFocusElement(node, firstFocusSelector);
36
+ if (focusElement) {
37
+ focusElement.focus();
38
+ }
39
+ };
40
+ var focusManager = /*#__PURE__*/new FocusManager();
41
+
42
+ /**
43
+ * Захватывает фокус внутри DOM node.
44
+ * */
45
+ export var useFocusTrap = function useFocusTrap() {
46
+ var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
47
+ var firstFocusSelector = arguments.length > 1 ? arguments[1] : undefined;
48
+ var focusAfterNode = arguments.length > 2 ? arguments[2] : undefined;
49
+ var activeAfterAnimation = arguments.length > 3 ? arguments[3] : undefined;
50
+ var ref = useRef();
51
+ var setRef = useCallback(function (node) {
52
+ if (ref.current) {
53
+ focusManager.teardownScopedFocus();
54
+ focusManager.returnFocus();
55
+ }
56
+ if (active && node) {
57
+ focusManager.setupScopedFocus(node);
58
+ focusManager.markForFocusAfter(focusAfterNode);
59
+
60
+ // Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
61
+ setTimeout(function () {
62
+ if (ref !== null && ref !== void 0 && ref.current && node.ownerDocument && activeAfterAnimation) {
63
+ ref.current.addEventListener('animationend', function () {
64
+ processNode(node, firstFocusSelector, ref);
65
+ });
66
+ } else if (node.ownerDocument) {
67
+ processNode(node, firstFocusSelector);
68
+ }
69
+ });
70
+ ref.current = node;
71
+ return;
72
+ }
73
+ ref.current = null;
74
+ }, [active, firstFocusSelector]);
75
+ useEffect(function () {
76
+ if (!active) {
77
+ return;
78
+ }
79
+ var handleKeyDown = function handleKeyDown(event) {
80
+ if (event.key === 'Tab' && ref.current) {
81
+ scopeTab(ref.current, event);
82
+ }
83
+ };
84
+ document.addEventListener('keydown', handleKeyDown);
85
+ return function () {
86
+ document.removeEventListener('keydown', handleKeyDown);
87
+ };
88
+ }, [active]);
89
+ return setRef;
90
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAa,MAAM,eAAe,CAAC;AAMrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C;;;GAGG;AACH,eAAO,MAAM,SAAS,SAAU,UAAU,cAAc,EAAE,UAAU,CAAC,sFAiFhE,CAAC;AAEN,eAAO,MAAM,WAAW;;;mBAnFQ,UAAU,cAAc,EAAE,UAAU,CAAC;;;;;;;;;;CAgGpE,CAAC"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAa,MAAM,eAAe,CAAC;AAOrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C;;;GAGG;AACH,eAAO,MAAM,SAAS,SAAU,UAAU,cAAc,EAAE,UAAU,CAAC,sFAiFhE,CAAC;AAEN,eAAO,MAAM,WAAW;;;mBAnFQ,UAAU,cAAc,EAAE,UAAU,CAAC;;;;;;;;;;CAgGpE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { useUniqId } from './useUniqId';
2
+ export { useFocusTrap } from './useFocusTrap';
2
3
  export { usePreviousValue } from './usePreviousValue';
3
4
  export { useForceUpdate } from './useForceUpdate';
4
5
  export { useDidMountEffect } from './useDidMountEffect';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Захватывает фокус внутри DOM node.
4
+ * */
5
+ export declare const useFocusTrap: (active?: boolean, firstFocusSelector?: string | import("react").RefObject<HTMLElement> | undefined, focusAfterNode?: import("react").RefObject<HTMLElement> | undefined, activeAfterAnimation?: boolean | undefined) => (instance: HTMLElement | null) => void;
6
+ //# sourceMappingURL=useFocusTrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":";AAoDA;;KAEK;AACL,eAAO,MAAM,YAAY,sOAKV,WAAW,GAAG,IAAI,KAAK,IAoDrC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Менеджер фокуса при открытии и закрытии нод при использовании focus-trap.
4
+ * Также необходим, чтобы фокус всегда должен находиться внутри необходимой ноды.
5
+ * */
6
+ export declare class FocusManager {
7
+ private focusAfterElements;
8
+ private focusNodes;
9
+ private handleFocus;
10
+ markForFocusAfter: (focusAfterNode?: import("react").RefObject<HTMLElement> | undefined) => void;
11
+ returnFocus: () => void;
12
+ setupScopedFocus: (element: HTMLElement) => void;
13
+ teardownScopedFocus: () => void;
14
+ }
15
+ //# sourceMappingURL=focusManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusManager.d.ts","sourceRoot":"","sources":["../../src/utils/focusManager.ts"],"names":[],"mappings":";AAEA;;;KAGK;AACL,qBAAa,YAAY;IAErB,OAAO,CAAC,kBAAkB,CAA0B;IAGpD,OAAO,CAAC,UAAU,CAA0B;IAE5C,OAAO,CAAC,WAAW,CAWjB;IAGK,iBAAiB,gFAItB;IAGK,WAAW,aAKhB;IAGK,gBAAgB,YAAa,WAAW,UAG7C;IAGK,mBAAmB,aAGxB;CACL"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Управлление фокусом лишь внутри ноды через tab
3
+ * @param node
4
+ * @param event
5
+ */
6
+ export declare const scopeTab: (node: HTMLElement, event: KeyboardEvent) => void;
7
+ //# sourceMappingURL=scopeTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeTab.d.ts","sourceRoot":"","sources":["../../src/utils/scopeTab.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAU,WAAW,SAAS,aAAa,SAsB/D,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const focusSelector: string;
2
+ export declare const isVisible: (element: HTMLElement, parentContainer?: HTMLElement | undefined) => boolean;
3
+ export declare const isFocusable: (element: HTMLElement, parentContainer?: HTMLElement | undefined) => boolean;
4
+ export declare const isTabble: (element: HTMLElement, parentContainer?: HTMLElement | undefined) => boolean;
5
+ export declare const findTabbableDescendants: (element: HTMLElement) => Array<HTMLElement>;
6
+ //# sourceMappingURL=tabbable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../../src/utils/tabbable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,QAWf,CAAC;AAWZ,eAAO,MAAM,SAAS,YAAa,WAAW,gDAAkC,OAgB/E,CAAC;AAQF,eAAO,MAAM,WAAW,YAAa,WAAW,gDAAkC,OAQjF,CAAC;AAEF,eAAO,MAAM,QAAQ,YAAa,WAAW,gDAAkC,OAI9E,CAAC;AAGF,eAAO,MAAM,uBAAuB,YAAa,WAAW,KAAG,MAAM,WAAW,CAE/E,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Захватывает фокус внутри DOM node.
4
+ * */
5
+ export declare const useFocusTrap: (active?: boolean, firstFocusSelector?: string | import("react").RefObject<HTMLElement> | undefined, focusAfterNode?: import("react").RefObject<HTMLElement> | undefined, activeAfterAnimation?: boolean | undefined) => (instance: HTMLElement | null) => void;
6
+ //# sourceMappingURL=useFocusTrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/utils/useFocusTrap.ts"],"names":[],"mappings":";AAoDA;;KAEK;AACL,eAAO,MAAM,YAAY,sOAKV,WAAW,GAAG,IAAI,KAAK,IAoDrC,CAAC"}