@via-profit/ui-kit 0.1.0-rc.59 → 0.1.0-rc.60
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.
- package/Highlighted/index.d.ts +7 -1
- package/Highlighted/index.js +2 -2
- package/Modal/BaseModal/ModalWrapper.js +32 -65
- package/Typography/Base.js +1 -1
- package/Typography/Blockquote.js +1 -1
- package/Typography/H1.js +1 -1
- package/Typography/H2.js +1 -1
- package/Typography/H3.js +1 -1
- package/Typography/H4.js +1 -1
- package/Typography/H5.js +1 -1
- package/Typography/Paragraph.js +1 -1
- package/package.json +1 -1
- package/utils/TabManager.d.ts +57 -0
- package/utils/TabManager.js +136 -0
package/Highlighted/index.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface HighlightedProps extends React.HTMLAttributes<HTMLSpanElement>
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
readonly highlight: string | readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* Case sensitive\
|
|
27
|
+
* **Default:** `false`
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
readonly caseSensitive?: boolean;
|
|
25
31
|
/**
|
|
26
32
|
* Overridable components map
|
|
27
33
|
*/
|
|
@@ -37,7 +43,7 @@ export interface HighlightedOverrides {
|
|
|
37
43
|
*/
|
|
38
44
|
readonly Mark?: React.ForwardRefExoticComponent<HighlightedMarkProps & React.RefAttributes<HTMLElement>>;
|
|
39
45
|
/**
|
|
40
|
-
* Text element (HTML <span>)
|
|
46
|
+
* Text element (HTML <span>)regex
|
|
41
47
|
*/
|
|
42
48
|
readonly Text?: React.ForwardRefExoticComponent<HighlightedTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
43
49
|
}
|
package/Highlighted/index.js
CHANGED
|
@@ -26,11 +26,11 @@ exports.escapeRegex = escapeRegex;
|
|
|
26
26
|
* The component allows you to highlight text matches in a string
|
|
27
27
|
*/
|
|
28
28
|
const Highlighted = (props, ref) => {
|
|
29
|
-
const { text, highlight, overrides } = props, nativeProps = __rest(props, ["text", "highlight", "overrides"]);
|
|
29
|
+
const { text, highlight, overrides, caseSensitive = false } = props, nativeProps = __rest(props, ["text", "highlight", "overrides", "caseSensitive"]);
|
|
30
30
|
const patterns = react_1.default.useMemo(() => (typeof highlight === 'string' ? [highlight] : highlight)
|
|
31
31
|
.filter(h => h.trim() !== '')
|
|
32
32
|
.map(exports.escapeRegex), [highlight]);
|
|
33
|
-
const regex = react_1.default.useMemo(() => new RegExp(`(${patterns.join('|')})`, 'gi'), [patterns]);
|
|
33
|
+
const regex = react_1.default.useMemo(() => new RegExp(`(${patterns.join('|')})`, caseSensitive ? 'g' : 'gi'), [patterns, caseSensitive]);
|
|
34
34
|
const overridesMap = react_1.default.useMemo(() => (Object.assign({ Container: HighlightedContainer_1.default,
|
|
35
35
|
Mark: HighlightedMark_1.default,
|
|
36
36
|
Text: HighlightedText_1.default }, overrides)), [overrides]);
|
|
@@ -6,13 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const react_2 = require("@emotion/react");
|
|
8
8
|
const context_1 = require("./context");
|
|
9
|
+
const TabManager_1 = __importDefault(require("../../utils/TabManager"));
|
|
9
10
|
const ModalWrapper = props => {
|
|
10
11
|
const { children, isOpen: isOpenProp } = props;
|
|
11
12
|
const { state, dispatch } = (0, context_1.useContext)();
|
|
12
13
|
const [alreadyMounted, setMountState] = react_1.default.useState(true);
|
|
13
14
|
const { closeOnEsape, isMounted, isOpen, destroyTimeout, onRequestClose } = state;
|
|
14
15
|
const containerRef = react_1.default.useRef(null);
|
|
15
|
-
const id =
|
|
16
|
+
const id = context_1.PORTAL_ID + react_1.default.useId();
|
|
17
|
+
react_1.default.useEffect(() => {
|
|
18
|
+
const c = containerRef.current;
|
|
19
|
+
if (isOpen && c) {
|
|
20
|
+
TabManager_1.default.registerContainer(c);
|
|
21
|
+
}
|
|
22
|
+
return () => {
|
|
23
|
+
if (c) {
|
|
24
|
+
TabManager_1.default.unregisterContainer(c);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, [isOpen]);
|
|
16
28
|
const getScrollWidth = react_1.default.useCallback(() => {
|
|
17
29
|
var _a;
|
|
18
30
|
const outer = window.document.createElement('div');
|
|
@@ -37,69 +49,6 @@ const ModalWrapper = props => {
|
|
|
37
49
|
(_a = outer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(outer);
|
|
38
50
|
return widthNoScroll - widthWithScroll;
|
|
39
51
|
}, []);
|
|
40
|
-
/**
|
|
41
|
-
* Set focus to the next or prev element
|
|
42
|
-
*/
|
|
43
|
-
const lastIndex = react_1.default.useRef(-1);
|
|
44
|
-
const nextFocus = react_1.default.useCallback((reverse) => {
|
|
45
|
-
if (!containerRef.current) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const universe = containerRef.current.querySelectorAll('input, button, select, textarea, a[href]');
|
|
49
|
-
const list = Array.prototype.filter.call(universe, function (item) {
|
|
50
|
-
return item.tabIndex >= '0';
|
|
51
|
-
});
|
|
52
|
-
if (!reverse) {
|
|
53
|
-
const nextIndex = lastIndex.current + 1;
|
|
54
|
-
if (list[nextIndex]) {
|
|
55
|
-
list[nextIndex].focus();
|
|
56
|
-
lastIndex.current = nextIndex;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
// othrwise
|
|
60
|
-
const nextEl = list[0];
|
|
61
|
-
if (nextEl) {
|
|
62
|
-
lastIndex.current = 0;
|
|
63
|
-
nextEl.focus();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (reverse) {
|
|
68
|
-
const nextIndex = lastIndex.current - 1;
|
|
69
|
-
if (list[nextIndex]) {
|
|
70
|
-
list[nextIndex].focus();
|
|
71
|
-
lastIndex.current = nextIndex;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// othrwise
|
|
75
|
-
const nextEl = list[list.length - 1];
|
|
76
|
-
if (nextEl) {
|
|
77
|
-
lastIndex.current = list.length - 1;
|
|
78
|
-
nextEl.focus();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, []);
|
|
83
|
-
react_1.default.useEffect(() => {
|
|
84
|
-
if (isOpenProp && containerRef.current) {
|
|
85
|
-
containerRef.current.focus();
|
|
86
|
-
}
|
|
87
|
-
const keydown = (event) => {
|
|
88
|
-
if (event.key.toLowerCase() !== 'tab' || !isOpenProp) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
event.preventDefault();
|
|
92
|
-
nextFocus(event.shiftKey);
|
|
93
|
-
};
|
|
94
|
-
const lastFocused = document.activeElement;
|
|
95
|
-
window.document.addEventListener('keydown', keydown);
|
|
96
|
-
return () => {
|
|
97
|
-
if (lastFocused) {
|
|
98
|
-
lastFocused.focus();
|
|
99
|
-
}
|
|
100
|
-
window.document.removeEventListener('keydown', keydown);
|
|
101
|
-
};
|
|
102
|
-
}, [nextFocus, isOpenProp]);
|
|
103
52
|
/**
|
|
104
53
|
* Component will unmount
|
|
105
54
|
* Mark component as unmounted
|
|
@@ -108,6 +57,9 @@ const ModalWrapper = props => {
|
|
|
108
57
|
setMountState(false);
|
|
109
58
|
}, []);
|
|
110
59
|
react_1.default.useEffect(() => {
|
|
60
|
+
if (isOpenProp && containerRef.current) {
|
|
61
|
+
containerRef.current.focus();
|
|
62
|
+
}
|
|
111
63
|
/**
|
|
112
64
|
* The last dialog will be found and closed
|
|
113
65
|
*/
|
|
@@ -120,12 +72,27 @@ const ModalWrapper = props => {
|
|
|
120
72
|
onRequestClose();
|
|
121
73
|
}
|
|
122
74
|
}
|
|
75
|
+
if (event.key.toLowerCase() === 'tab' &&
|
|
76
|
+
isOpenProp &&
|
|
77
|
+
TabManager_1.default.isCurrentContainer(containerRef.current)) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
if (event.shiftKey) {
|
|
80
|
+
TabManager_1.default.focusPrev();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
TabManager_1.default.focusNext();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
123
86
|
};
|
|
87
|
+
const lastFocused = document.activeElement;
|
|
124
88
|
window.document.addEventListener('keydown', keyDown);
|
|
125
89
|
return () => {
|
|
90
|
+
if (lastFocused) {
|
|
91
|
+
lastFocused.focus();
|
|
92
|
+
}
|
|
126
93
|
window.document.removeEventListener('keydown', keyDown);
|
|
127
94
|
};
|
|
128
|
-
}, [onRequestClose, closeOnEsape, id]);
|
|
95
|
+
}, [onRequestClose, closeOnEsape, id, isOpenProp]);
|
|
129
96
|
/**
|
|
130
97
|
* Controller for visibility state.
|
|
131
98
|
* Waiting n milliseconds after closing the modal, then sets the visibility property to true
|
package/Typography/Base.js
CHANGED
package/Typography/Blockquote.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
7
7
|
const Blockquote = styled_1.default.blockquote `
|
|
8
|
-
font-size:
|
|
8
|
+
font-size: 1em;
|
|
9
9
|
font-weight: 400;
|
|
10
10
|
font-style: italic;
|
|
11
11
|
position: relative;
|
package/Typography/H1.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const Styled = styled_1.default.h1 `
|
|
20
|
-
font-size:
|
|
20
|
+
font-size: 2em;
|
|
21
21
|
font-weight: 700;
|
|
22
22
|
color: currentColor;
|
|
23
23
|
`;
|
package/Typography/H2.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const Styled = styled_1.default.h2 `
|
|
20
|
-
font-size: 1.
|
|
20
|
+
font-size: 1.5em;
|
|
21
21
|
font-weight: 500;
|
|
22
22
|
color: currentColor;
|
|
23
23
|
`;
|
package/Typography/H3.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const Styled = styled_1.default.h3 `
|
|
20
|
-
font-size: 1.
|
|
20
|
+
font-size: 1.25em;
|
|
21
21
|
font-weight: 500;
|
|
22
22
|
color: currentColor;
|
|
23
23
|
`;
|
package/Typography/H4.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const Styled = styled_1.default.h4 `
|
|
20
|
-
font-size: 1.
|
|
20
|
+
font-size: 1.2em;
|
|
21
21
|
font-weight: 500;
|
|
22
22
|
color: currentColor;
|
|
23
23
|
`;
|
package/Typography/H5.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
19
|
const Styled = styled_1.default.h5 `
|
|
20
|
-
font-size: 1.
|
|
20
|
+
font-size: 1.2em;
|
|
21
21
|
font-weight: 300;
|
|
22
22
|
color: currentColor;
|
|
23
23
|
`;
|
package/Typography/Paragraph.js
CHANGED
|
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
const React = __importStar(require("react"));
|
|
41
41
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
42
42
|
const StyledParagraph = styled_1.default.p `
|
|
43
|
-
font-size:
|
|
43
|
+
font-size: 1em;
|
|
44
44
|
font-weight: 300;
|
|
45
45
|
margin: ${({ $noMargin }) => ($noMargin ? 0 : '0 0 0.8em 0')};
|
|
46
46
|
color: currentColor;
|
package/package.json
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How to use:
|
|
3
|
+
* ```tsx
|
|
4
|
+
* const MyComponent: React.FC = () => {
|
|
5
|
+
* const container = React.useRef<HTMLElement | null>(null);
|
|
6
|
+
*
|
|
7
|
+
* React.useEffect(() => {
|
|
8
|
+
* const keydown = (event: KeyboardEvent) => {
|
|
9
|
+
* if (
|
|
10
|
+
* event.key.toLowerCase() !== 'tab' ||
|
|
11
|
+
* !TabManager.isCurrentContainer(containerRef.current)
|
|
12
|
+
* ) {
|
|
13
|
+
* return;
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* event.preventDefault();
|
|
17
|
+
*
|
|
18
|
+
* if (event.shiftKey) {
|
|
19
|
+
* TabManager.focusPrev();
|
|
20
|
+
* } else {
|
|
21
|
+
* TabManager.focusNext();
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* window.document.addEventListener('keydown', keydown);
|
|
26
|
+
*
|
|
27
|
+
* return () => {
|
|
28
|
+
* window.document.addEventListener('keydown', keydown);
|
|
29
|
+
* }
|
|
30
|
+
* }, []);
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <div ref={container} onKeyDown>
|
|
34
|
+
* ...
|
|
35
|
+
* </div>
|
|
36
|
+
* )
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare class TabManager {
|
|
41
|
+
#private;
|
|
42
|
+
isCurrentContainer(elem: HTMLElement | null): boolean | null;
|
|
43
|
+
getTopOfTheStack(): {
|
|
44
|
+
stackElement: {
|
|
45
|
+
container: HTMLElement;
|
|
46
|
+
lastIndex: number;
|
|
47
|
+
};
|
|
48
|
+
stackIndex: number;
|
|
49
|
+
};
|
|
50
|
+
registerContainer(container: HTMLElement): void;
|
|
51
|
+
unregisterContainer(container: HTMLElement): void;
|
|
52
|
+
getElementsList(): HTMLElement[];
|
|
53
|
+
focusNext(): void;
|
|
54
|
+
focusPrev(): void;
|
|
55
|
+
}
|
|
56
|
+
declare const tabManager: TabManager;
|
|
57
|
+
export default tabManager;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
+
};
|
|
13
|
+
var _TabManager_stack;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
/**
|
|
16
|
+
* How to use:
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const MyComponent: React.FC = () => {
|
|
19
|
+
* const container = React.useRef<HTMLElement | null>(null);
|
|
20
|
+
*
|
|
21
|
+
* React.useEffect(() => {
|
|
22
|
+
* const keydown = (event: KeyboardEvent) => {
|
|
23
|
+
* if (
|
|
24
|
+
* event.key.toLowerCase() !== 'tab' ||
|
|
25
|
+
* !TabManager.isCurrentContainer(containerRef.current)
|
|
26
|
+
* ) {
|
|
27
|
+
* return;
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* event.preventDefault();
|
|
31
|
+
*
|
|
32
|
+
* if (event.shiftKey) {
|
|
33
|
+
* TabManager.focusPrev();
|
|
34
|
+
* } else {
|
|
35
|
+
* TabManager.focusNext();
|
|
36
|
+
* }
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* window.document.addEventListener('keydown', keydown);
|
|
40
|
+
*
|
|
41
|
+
* return () => {
|
|
42
|
+
* window.document.addEventListener('keydown', keydown);
|
|
43
|
+
* }
|
|
44
|
+
* }, []);
|
|
45
|
+
*
|
|
46
|
+
* return (
|
|
47
|
+
* <div ref={container} onKeyDown>
|
|
48
|
+
* ...
|
|
49
|
+
* </div>
|
|
50
|
+
* )
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
class TabManager {
|
|
55
|
+
constructor() {
|
|
56
|
+
_TabManager_stack.set(this, []);
|
|
57
|
+
}
|
|
58
|
+
isCurrentContainer(elem) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const lastof = (_b = (_a = this.getTopOfTheStack()) === null || _a === void 0 ? void 0 : _a.stackElement) === null || _b === void 0 ? void 0 : _b.container;
|
|
61
|
+
return lastof && elem && lastof === elem;
|
|
62
|
+
}
|
|
63
|
+
getTopOfTheStack() {
|
|
64
|
+
const stackIndex = __classPrivateFieldGet(this, _TabManager_stack, "f").length - 1;
|
|
65
|
+
return {
|
|
66
|
+
stackElement: __classPrivateFieldGet(this, _TabManager_stack, "f")[stackIndex],
|
|
67
|
+
stackIndex,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
registerContainer(container) {
|
|
71
|
+
__classPrivateFieldGet(this, _TabManager_stack, "f").push({ container, lastIndex: -1 });
|
|
72
|
+
}
|
|
73
|
+
unregisterContainer(container) {
|
|
74
|
+
__classPrivateFieldSet(this, _TabManager_stack, __classPrivateFieldGet(this, _TabManager_stack, "f").filter(stackElem => stackElem.container !== container), "f");
|
|
75
|
+
}
|
|
76
|
+
getElementsList() {
|
|
77
|
+
const { stackElement } = this.getTopOfTheStack();
|
|
78
|
+
const universe = stackElement.container.querySelectorAll('input, button, select, textarea, a[href]');
|
|
79
|
+
const list = Array.prototype.filter.call(universe, function (item) {
|
|
80
|
+
return item.tabIndex >= 0;
|
|
81
|
+
});
|
|
82
|
+
list.sort((a, b) => {
|
|
83
|
+
if (a.tabIndex === 0) {
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
if (b.tabIndex === 0) {
|
|
87
|
+
return -1;
|
|
88
|
+
}
|
|
89
|
+
if (a.tabIndex < b.tabIndex) {
|
|
90
|
+
return -1;
|
|
91
|
+
}
|
|
92
|
+
if (a.tabIndex > b.tabIndex) {
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
return 0;
|
|
96
|
+
});
|
|
97
|
+
return list;
|
|
98
|
+
}
|
|
99
|
+
focusNext() {
|
|
100
|
+
const { stackElement, stackIndex } = this.getTopOfTheStack();
|
|
101
|
+
const list = this.getElementsList();
|
|
102
|
+
const nextIndex = stackElement.lastIndex + 1;
|
|
103
|
+
if (list[nextIndex]) {
|
|
104
|
+
list[nextIndex].focus();
|
|
105
|
+
__classPrivateFieldGet(this, _TabManager_stack, "f")[stackIndex].lastIndex = nextIndex;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Othrwise
|
|
109
|
+
const nextEl = list[0];
|
|
110
|
+
if (nextEl) {
|
|
111
|
+
__classPrivateFieldGet(this, _TabManager_stack, "f")[stackIndex].lastIndex = 0;
|
|
112
|
+
nextEl.focus();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
focusPrev() {
|
|
117
|
+
const { stackElement, stackIndex } = this.getTopOfTheStack();
|
|
118
|
+
const list = this.getElementsList();
|
|
119
|
+
const nextIndex = stackElement.lastIndex - 1;
|
|
120
|
+
if (list[nextIndex]) {
|
|
121
|
+
list[nextIndex].focus();
|
|
122
|
+
__classPrivateFieldGet(this, _TabManager_stack, "f")[stackIndex].lastIndex = nextIndex;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// Othrwise
|
|
126
|
+
const nextEl = list[list.length - 1];
|
|
127
|
+
if (nextEl) {
|
|
128
|
+
__classPrivateFieldGet(this, _TabManager_stack, "f")[stackIndex].lastIndex = list.length - 1;
|
|
129
|
+
nextEl.focus();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
_TabManager_stack = new WeakMap();
|
|
135
|
+
const tabManager = new TabManager();
|
|
136
|
+
exports.default = tabManager;
|