grep-components 2.10.0-GREPF-2677.1 → 2.10.0-gREPF-2708.1
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/dist/assets/keycodeEnum.d.ts +20 -0
- package/dist/components/AppBar/stories/AppBarStory.stories.d.ts +0 -2
- package/dist/components/DropdownMenu/stories/DropDownMenu.stories.d.ts +3 -5
- package/dist/components/GrepDialog/stories/dialog.stories.d.ts +1 -8
- package/dist/components/ToC/components/nav-tree-node.d.ts +9 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +65 -168
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +0 -1
- package/package.json +12 -42
- package/dist/41017f048e09b7d9.png +0 -0
- package/dist/assets/index.d.ts +0 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** An incomplete list deriving values from:
|
|
2
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
|
3
|
+
* and
|
|
4
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values */
|
|
5
|
+
export declare enum Key {
|
|
6
|
+
Enter = "Enter",
|
|
7
|
+
Space = " ",
|
|
8
|
+
Tab = "Tab",
|
|
9
|
+
Escape = "Escape",
|
|
10
|
+
ArrowUp = "ArrowUp",
|
|
11
|
+
ArrowDown = "ArrowDown",
|
|
12
|
+
ArrowLeft = "ArrowLeft",
|
|
13
|
+
ArrowRight = "ArrowRight",
|
|
14
|
+
End = "End",
|
|
15
|
+
Home = "Home",
|
|
16
|
+
PageUp = "PageUp",
|
|
17
|
+
PageDown = "PageDown",
|
|
18
|
+
Alt = "Alt",
|
|
19
|
+
I = "KeyI"
|
|
20
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IAuthorizedPage } from '../types';
|
|
3
2
|
export declare const v0colors: {
|
|
4
3
|
primary: string;
|
|
5
4
|
secondary: string;
|
|
@@ -15,7 +14,6 @@ export declare const v0colors: {
|
|
|
15
14
|
white: string;
|
|
16
15
|
lightGrey: string;
|
|
17
16
|
};
|
|
18
|
-
export declare const navbarPages: IAuthorizedPage[];
|
|
19
17
|
declare const _default: {
|
|
20
18
|
title: string;
|
|
21
19
|
excludeStories: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DropdownMenuItem } from '../..';
|
|
3
3
|
interface TestMenuItem {
|
|
4
4
|
label: string;
|
|
@@ -12,8 +12,6 @@ declare const _default: {
|
|
|
12
12
|
};
|
|
13
13
|
export default _default;
|
|
14
14
|
export declare const Standard: {
|
|
15
|
-
()
|
|
16
|
-
|
|
17
|
-
name: string;
|
|
18
|
-
};
|
|
15
|
+
render: () => React.JSX.Element;
|
|
16
|
+
name: string;
|
|
19
17
|
};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const content = "Some content";
|
|
3
|
-
export declare const openText = "Open dialog";
|
|
4
|
-
export declare const title = "Title text";
|
|
5
|
-
export declare const Component: React.FC<{
|
|
6
|
-
actions?: JSX.Element[];
|
|
7
|
-
}>;
|
|
1
|
+
import { JSX } from 'react';
|
|
8
2
|
declare const _default: {
|
|
9
3
|
title: string;
|
|
10
4
|
decorators: ((storyFn: any) => JSX.Element)[];
|
|
11
|
-
excludeStories: string[];
|
|
12
5
|
};
|
|
13
6
|
export default _default;
|
|
14
7
|
export declare const Standard: {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { ContextTreeElement, ContextTree } from '../utils/tree-builder';
|
|
3
|
+
/**
|
|
4
|
+
* @TODO fix later
|
|
5
|
+
* cheat, https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElement {
|
|
9
|
+
scrollIntoViewIfNeeded: VoidFunction;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
export interface GrepTableOfContentNavTreeNodeProps {
|
|
4
13
|
node: ContextTreeElement;
|
|
5
14
|
className?: string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -133,147 +133,32 @@ const getTime = (datetime, options) => parseDate(datetime, options).format('[kl.
|
|
|
133
133
|
const getFullDate = (datetime, options) => parseDate(datetime, options).format('LLL');
|
|
134
134
|
const getExcelDateTime = (datetime, options) => parseDate(datetime, options).format('L HH:mm');
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Key[Key["Alt"] = 18] = "Alt";
|
|
158
|
-
Key[Key["PauseBreak"] = 19] = "PauseBreak";
|
|
159
|
-
Key[Key["CapsLock"] = 20] = "CapsLock";
|
|
160
|
-
Key[Key["Escape"] = 27] = "Escape";
|
|
161
|
-
Key[Key["Space"] = 32] = "Space";
|
|
162
|
-
Key[Key["PageUp"] = 33] = "PageUp";
|
|
163
|
-
Key[Key["PageDown"] = 34] = "PageDown";
|
|
164
|
-
Key[Key["End"] = 35] = "End";
|
|
165
|
-
Key[Key["Home"] = 36] = "Home";
|
|
166
|
-
Key[Key["LeftArrow"] = 37] = "LeftArrow";
|
|
167
|
-
Key[Key["UpArrow"] = 38] = "UpArrow";
|
|
168
|
-
Key[Key["RightArrow"] = 39] = "RightArrow";
|
|
169
|
-
Key[Key["DownArrow"] = 40] = "DownArrow";
|
|
170
|
-
Key[Key["Insert"] = 45] = "Insert";
|
|
171
|
-
Key[Key["Delete"] = 46] = "Delete";
|
|
172
|
-
Key[Key["Zero"] = 48] = "Zero";
|
|
173
|
-
Key[Key["ClosedParen"] = 48] = "ClosedParen";
|
|
174
|
-
Key[Key["One"] = 49] = "One";
|
|
175
|
-
Key[Key["ExclamationMark"] = 49] = "ExclamationMark";
|
|
176
|
-
Key[Key["Two"] = 50] = "Two";
|
|
177
|
-
Key[Key["AtSign"] = 50] = "AtSign";
|
|
178
|
-
Key[Key["Three"] = 51] = "Three";
|
|
179
|
-
Key[Key["PoundSign"] = 51] = "PoundSign";
|
|
180
|
-
Key[Key["Hash"] = 51] = "Hash";
|
|
181
|
-
Key[Key["Four"] = 52] = "Four";
|
|
182
|
-
Key[Key["DollarSign"] = 52] = "DollarSign";
|
|
183
|
-
Key[Key["Five"] = 53] = "Five";
|
|
184
|
-
Key[Key["PercentSign"] = 53] = "PercentSign";
|
|
185
|
-
Key[Key["Six"] = 54] = "Six";
|
|
186
|
-
Key[Key["Caret"] = 54] = "Caret";
|
|
187
|
-
Key[Key["Hat"] = 54] = "Hat";
|
|
188
|
-
Key[Key["Seven"] = 55] = "Seven";
|
|
189
|
-
Key[Key["Ampersand"] = 55] = "Ampersand";
|
|
190
|
-
Key[Key["Eight"] = 56] = "Eight";
|
|
191
|
-
Key[Key["Star"] = 56] = "Star";
|
|
192
|
-
Key[Key["Asterik"] = 56] = "Asterik";
|
|
193
|
-
Key[Key["Nine"] = 57] = "Nine";
|
|
194
|
-
Key[Key["OpenParen"] = 57] = "OpenParen";
|
|
195
|
-
Key[Key["A"] = 65] = "A";
|
|
196
|
-
Key[Key["B"] = 66] = "B";
|
|
197
|
-
Key[Key["C"] = 67] = "C";
|
|
198
|
-
Key[Key["D"] = 68] = "D";
|
|
199
|
-
Key[Key["E"] = 69] = "E";
|
|
200
|
-
Key[Key["F"] = 70] = "F";
|
|
201
|
-
Key[Key["G"] = 71] = "G";
|
|
202
|
-
Key[Key["H"] = 72] = "H";
|
|
203
|
-
Key[Key["I"] = 73] = "I";
|
|
204
|
-
Key[Key["J"] = 74] = "J";
|
|
205
|
-
Key[Key["K"] = 75] = "K";
|
|
206
|
-
Key[Key["L"] = 76] = "L";
|
|
207
|
-
Key[Key["M"] = 77] = "M";
|
|
208
|
-
Key[Key["N"] = 78] = "N";
|
|
209
|
-
Key[Key["O"] = 79] = "O";
|
|
210
|
-
Key[Key["P"] = 80] = "P";
|
|
211
|
-
Key[Key["Q"] = 81] = "Q";
|
|
212
|
-
Key[Key["R"] = 82] = "R";
|
|
213
|
-
Key[Key["S"] = 83] = "S";
|
|
214
|
-
Key[Key["T"] = 84] = "T";
|
|
215
|
-
Key[Key["U"] = 85] = "U";
|
|
216
|
-
Key[Key["V"] = 86] = "V";
|
|
217
|
-
Key[Key["W"] = 87] = "W";
|
|
218
|
-
Key[Key["X"] = 88] = "X";
|
|
219
|
-
Key[Key["Y"] = 89] = "Y";
|
|
220
|
-
Key[Key["Z"] = 90] = "Z";
|
|
221
|
-
Key[Key["LeftWindowKey"] = 91] = "LeftWindowKey";
|
|
222
|
-
Key[Key["RightWindowKey"] = 92] = "RightWindowKey";
|
|
223
|
-
Key[Key["SelectKey"] = 93] = "SelectKey";
|
|
224
|
-
Key[Key["Numpad0"] = 96] = "Numpad0";
|
|
225
|
-
Key[Key["Numpad1"] = 97] = "Numpad1";
|
|
226
|
-
Key[Key["Numpad2"] = 98] = "Numpad2";
|
|
227
|
-
Key[Key["Numpad3"] = 99] = "Numpad3";
|
|
228
|
-
Key[Key["Numpad4"] = 100] = "Numpad4";
|
|
229
|
-
Key[Key["Numpad5"] = 101] = "Numpad5";
|
|
230
|
-
Key[Key["Numpad6"] = 102] = "Numpad6";
|
|
231
|
-
Key[Key["Numpad7"] = 103] = "Numpad7";
|
|
232
|
-
Key[Key["Numpad8"] = 104] = "Numpad8";
|
|
233
|
-
Key[Key["Numpad9"] = 105] = "Numpad9";
|
|
234
|
-
Key[Key["Multiply"] = 106] = "Multiply";
|
|
235
|
-
Key[Key["Add"] = 107] = "Add";
|
|
236
|
-
Key[Key["Subtract"] = 109] = "Subtract";
|
|
237
|
-
Key[Key["DecimalPoint"] = 110] = "DecimalPoint";
|
|
238
|
-
Key[Key["Divide"] = 111] = "Divide";
|
|
239
|
-
Key[Key["F1"] = 112] = "F1";
|
|
240
|
-
Key[Key["F2"] = 113] = "F2";
|
|
241
|
-
Key[Key["F3"] = 114] = "F3";
|
|
242
|
-
Key[Key["F4"] = 115] = "F4";
|
|
243
|
-
Key[Key["F5"] = 116] = "F5";
|
|
244
|
-
Key[Key["F6"] = 117] = "F6";
|
|
245
|
-
Key[Key["F7"] = 118] = "F7";
|
|
246
|
-
Key[Key["F8"] = 119] = "F8";
|
|
247
|
-
Key[Key["F9"] = 120] = "F9";
|
|
248
|
-
Key[Key["F10"] = 121] = "F10";
|
|
249
|
-
Key[Key["F11"] = 122] = "F11";
|
|
250
|
-
Key[Key["F12"] = 123] = "F12";
|
|
251
|
-
Key[Key["NumLock"] = 144] = "NumLock";
|
|
252
|
-
Key[Key["ScrollLock"] = 145] = "ScrollLock";
|
|
253
|
-
Key[Key["SemiColon"] = 186] = "SemiColon";
|
|
254
|
-
Key[Key["Equals"] = 187] = "Equals";
|
|
255
|
-
Key[Key["Comma"] = 188] = "Comma";
|
|
256
|
-
Key[Key["Dash"] = 189] = "Dash";
|
|
257
|
-
Key[Key["Period"] = 190] = "Period";
|
|
258
|
-
Key[Key["UnderScore"] = 189] = "UnderScore";
|
|
259
|
-
Key[Key["PlusSign"] = 187] = "PlusSign";
|
|
260
|
-
Key[Key["ForwardSlash"] = 191] = "ForwardSlash";
|
|
261
|
-
Key[Key["Tilde"] = 192] = "Tilde";
|
|
262
|
-
Key[Key["GraveAccent"] = 192] = "GraveAccent";
|
|
263
|
-
Key[Key["OpenBracket"] = 219] = "OpenBracket";
|
|
264
|
-
Key[Key["ClosedBracket"] = 221] = "ClosedBracket";
|
|
265
|
-
Key[Key["Quote"] = 222] = "Quote";
|
|
266
|
-
})(exports.Key || (exports.Key = {}));
|
|
267
|
-
} (Key_enum));
|
|
268
|
-
return Key_enum;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
var Key_enumExports = requireKey_enum();
|
|
136
|
+
/** An incomplete list deriving values from:
|
|
137
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
|
138
|
+
* and
|
|
139
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values */
|
|
140
|
+
var Key;
|
|
141
|
+
(function (Key) {
|
|
142
|
+
Key["Enter"] = "Enter";
|
|
143
|
+
Key["Space"] = " ";
|
|
144
|
+
Key["Tab"] = "Tab";
|
|
145
|
+
Key["Escape"] = "Escape";
|
|
146
|
+
Key["ArrowUp"] = "ArrowUp";
|
|
147
|
+
Key["ArrowDown"] = "ArrowDown";
|
|
148
|
+
Key["ArrowLeft"] = "ArrowLeft";
|
|
149
|
+
Key["ArrowRight"] = "ArrowRight";
|
|
150
|
+
Key["End"] = "End";
|
|
151
|
+
Key["Home"] = "Home";
|
|
152
|
+
Key["PageUp"] = "PageUp";
|
|
153
|
+
Key["PageDown"] = "PageDown";
|
|
154
|
+
Key["Alt"] = "Alt";
|
|
155
|
+
Key["I"] = "KeyI";
|
|
156
|
+
})(Key || (Key = {}));
|
|
272
157
|
|
|
273
158
|
const onActivation = (cb) => (ev) => {
|
|
274
|
-
switch (ev.
|
|
275
|
-
case
|
|
276
|
-
case
|
|
159
|
+
switch (ev.key) {
|
|
160
|
+
case Key.Space:
|
|
161
|
+
case Key.Enter:
|
|
277
162
|
cb(ev);
|
|
278
163
|
break;
|
|
279
164
|
}
|
|
@@ -1710,11 +1595,11 @@ const MainLayout = (props) => (React.createElement(Box, { display: "flex", flex:
|
|
|
1710
1595
|
|
|
1711
1596
|
const CollapsableMenu = ({ children, onMenuClose, ...collapseProps }) => {
|
|
1712
1597
|
const onKeyDown = (e) => {
|
|
1713
|
-
switch (e.
|
|
1714
|
-
case
|
|
1598
|
+
switch (e.key) {
|
|
1599
|
+
case Key.Escape:
|
|
1715
1600
|
onMenuClose && onMenuClose();
|
|
1716
1601
|
return;
|
|
1717
|
-
case
|
|
1602
|
+
case Key.ArrowLeft:
|
|
1718
1603
|
onMenuClose && onMenuClose();
|
|
1719
1604
|
}
|
|
1720
1605
|
e.stopPropagation();
|
|
@@ -1794,8 +1679,8 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
|
|
|
1794
1679
|
}, [onStatusChange, setOpen, listItemRef]);
|
|
1795
1680
|
const handleKey = (e) => {
|
|
1796
1681
|
if (items) {
|
|
1797
|
-
switch (e.
|
|
1798
|
-
case
|
|
1682
|
+
switch (e.key) {
|
|
1683
|
+
case Key.ArrowRight:
|
|
1799
1684
|
if (expand()) {
|
|
1800
1685
|
e.preventDefault();
|
|
1801
1686
|
e.stopPropagation();
|
|
@@ -2315,8 +2200,8 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
2315
2200
|
}, onClick: (e) => {
|
|
2316
2201
|
_openDropdown(e, row);
|
|
2317
2202
|
}, onKeyDown: (e) => {
|
|
2318
|
-
switch (e.
|
|
2319
|
-
case
|
|
2203
|
+
switch (e.key) {
|
|
2204
|
+
case Key.Enter:
|
|
2320
2205
|
// dont show dropdown
|
|
2321
2206
|
e.preventDefault();
|
|
2322
2207
|
break;
|
|
@@ -2373,34 +2258,34 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
2373
2258
|
setSelectedRowIndex(i);
|
|
2374
2259
|
}
|
|
2375
2260
|
};
|
|
2376
|
-
switch (e.
|
|
2377
|
-
case
|
|
2261
|
+
switch (e.key) {
|
|
2262
|
+
case Key.ArrowDown:
|
|
2378
2263
|
moveSelectedRow(1);
|
|
2379
2264
|
break;
|
|
2380
|
-
case
|
|
2265
|
+
case Key.ArrowUp:
|
|
2381
2266
|
moveSelectedRow(-1);
|
|
2382
2267
|
break;
|
|
2383
|
-
case
|
|
2384
|
-
case
|
|
2268
|
+
case Key.ArrowLeft:
|
|
2269
|
+
case Key.PageUp:
|
|
2385
2270
|
moveSelectedRow(-rowsPerPage);
|
|
2386
2271
|
break;
|
|
2387
|
-
case
|
|
2388
|
-
case
|
|
2272
|
+
case Key.ArrowRight:
|
|
2273
|
+
case Key.PageDown:
|
|
2389
2274
|
moveSelectedRow(rowsPerPage);
|
|
2390
2275
|
break;
|
|
2391
|
-
case
|
|
2276
|
+
case Key.Home:
|
|
2392
2277
|
setSelectedRowIndex(0);
|
|
2393
2278
|
break;
|
|
2394
|
-
case
|
|
2279
|
+
case Key.End:
|
|
2395
2280
|
setSelectedRowIndex(maxIndex);
|
|
2396
2281
|
break;
|
|
2397
|
-
case
|
|
2282
|
+
case Key.Tab:
|
|
2398
2283
|
requestAnimationFrame(() => {
|
|
2399
2284
|
// check is any children still has focus
|
|
2400
2285
|
!containsFocus(tableRef.current) && setSelectedRowIndex(-1);
|
|
2401
2286
|
});
|
|
2402
2287
|
break;
|
|
2403
|
-
case
|
|
2288
|
+
case Key.Enter:
|
|
2404
2289
|
selectedRow && _handleRowClick(selectedRow);
|
|
2405
2290
|
break;
|
|
2406
2291
|
}
|
|
@@ -2718,6 +2603,12 @@ const useDate = (value = null, options) => {
|
|
|
2718
2603
|
return [date, setDate];
|
|
2719
2604
|
};
|
|
2720
2605
|
|
|
2606
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2607
|
+
|
|
2608
|
+
function getDefaultExportFromCjs (x) {
|
|
2609
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2721
2612
|
/**
|
|
2722
2613
|
* lodash (Custom Build) <https://lodash.com/>
|
|
2723
2614
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
@@ -3170,9 +3061,11 @@ const useContentElements = (container, selector, options) => {
|
|
|
3170
3061
|
});
|
|
3171
3062
|
// start observing
|
|
3172
3063
|
observer.observe(container, config);
|
|
3064
|
+
console.debug('observing container', container);
|
|
3173
3065
|
// stop observing when unmounted
|
|
3174
3066
|
return () => {
|
|
3175
3067
|
observer.disconnect();
|
|
3068
|
+
console.debug('observing disconnected', container);
|
|
3176
3069
|
};
|
|
3177
3070
|
}, [container, config, getElements]);
|
|
3178
3071
|
return elements;
|
|
@@ -12887,7 +12780,7 @@ var lodash_throttleExports = requireLodash_throttle();
|
|
|
12887
12780
|
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
|
12888
12781
|
|
|
12889
12782
|
const generateElementId = (element) => {
|
|
12890
|
-
const tmpId = element.innerText
|
|
12783
|
+
const tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
|
|
12891
12784
|
let id = tmpId, index = 1;
|
|
12892
12785
|
while (document.getElementById(id)) {
|
|
12893
12786
|
id = `${tmpId}-${++index}`;
|
|
@@ -12957,7 +12850,9 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12957
12850
|
setSelected(element);
|
|
12958
12851
|
}, 50);
|
|
12959
12852
|
target.addEventListener('scroll', onScroll, false);
|
|
12853
|
+
console.debug('scroll observer attached');
|
|
12960
12854
|
return () => {
|
|
12855
|
+
console.debug('scroll observer detached');
|
|
12961
12856
|
return target.removeEventListener('scroll', onScroll);
|
|
12962
12857
|
};
|
|
12963
12858
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
@@ -12968,11 +12863,13 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12968
12863
|
// observe changes in hash
|
|
12969
12864
|
useEffect(() => {
|
|
12970
12865
|
if (hash && elements[hash]) {
|
|
12866
|
+
console.debug('anchor change, setting selected element');
|
|
12971
12867
|
setSelected(elements[hash], true);
|
|
12972
12868
|
}
|
|
12973
12869
|
}, [hash, setSelected]);
|
|
12974
12870
|
// set selected element on initial load
|
|
12975
12871
|
if (!initialized && elements && elements[hash]) {
|
|
12872
|
+
console.debug('setting initial selected element');
|
|
12976
12873
|
setSelected(elements[hash], true);
|
|
12977
12874
|
setInitialized(true);
|
|
12978
12875
|
}
|
|
@@ -13025,7 +12922,8 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13025
12922
|
useEffect(() => {
|
|
13026
12923
|
const link = linkRef.current;
|
|
13027
12924
|
if (isSelected) {
|
|
13028
|
-
link?.
|
|
12925
|
+
link?.scrollIntoViewIfNeeded();
|
|
12926
|
+
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
13029
12927
|
}
|
|
13030
12928
|
else if (link === document.activeElement) {
|
|
13031
12929
|
link?.blur();
|
|
@@ -13050,6 +12948,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13050
12948
|
};
|
|
13051
12949
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
13052
12950
|
React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
|
|
12951
|
+
console.debug('node click', node);
|
|
13053
12952
|
event.preventDefault();
|
|
13054
12953
|
event.stopPropagation();
|
|
13055
12954
|
doSelect(true);
|
|
@@ -13150,7 +13049,7 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13150
13049
|
});
|
|
13151
13050
|
}, [ref]);
|
|
13152
13051
|
const onKeyDown = (e) => {
|
|
13153
|
-
if (selected && e.
|
|
13052
|
+
if (selected && e.key === Key.Tab && e.shiftKey === false) {
|
|
13154
13053
|
const tabindex = selected.getAttribute('tabindex');
|
|
13155
13054
|
selected.setAttribute('tabindex', '0');
|
|
13156
13055
|
selected.focus();
|
|
@@ -13160,12 +13059,12 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13160
13059
|
: selected.setAttribute('tabindex', tabindex);
|
|
13161
13060
|
});
|
|
13162
13061
|
}
|
|
13163
|
-
if (
|
|
13062
|
+
if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {
|
|
13164
13063
|
e.preventDefault();
|
|
13165
13064
|
e.stopPropagation();
|
|
13166
13065
|
const nodes = Object.values(elements);
|
|
13167
13066
|
const currentIndex = nodes.indexOf(selected);
|
|
13168
|
-
const moveIndex = e.
|
|
13067
|
+
const moveIndex = e.key === Key.ArrowUp ? -1 : 1;
|
|
13169
13068
|
const next = nodes[currentIndex + moveIndex];
|
|
13170
13069
|
next && setSelected(next, true);
|
|
13171
13070
|
focusSelected();
|
|
@@ -13173,13 +13072,13 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13173
13072
|
};
|
|
13174
13073
|
useEffect(() => {
|
|
13175
13074
|
const onKeyDown = (e) => {
|
|
13176
|
-
e.
|
|
13075
|
+
e.key === Key.Alt && setShowKeyboardHint(true);
|
|
13177
13076
|
if (e.altKey) {
|
|
13178
|
-
e.
|
|
13077
|
+
e.key === Key.I && focusSelected();
|
|
13179
13078
|
}
|
|
13180
13079
|
};
|
|
13181
13080
|
const onKeyUp = (e) => {
|
|
13182
|
-
e.
|
|
13081
|
+
e.key === Key.Alt && setShowKeyboardHint(false);
|
|
13183
13082
|
};
|
|
13184
13083
|
window.addEventListener('keydown', onKeyDown);
|
|
13185
13084
|
window.addEventListener('keyup', onKeyUp);
|
|
@@ -13201,7 +13100,5 @@ const GrepTableOfContent = ({ style, className, setSelectedValue, percentageRend
|
|
|
13201
13100
|
};
|
|
13202
13101
|
GrepTableOfContent.displayName = 'Grep.ToC';
|
|
13203
13102
|
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
export { AppBar, AppBarNavList, AppBarProfile, BodyLayout, CircularLoading, Colors, ConfirmationServiceProvider, ContainedLinkList, DatePicker, DropdownMenu, Footer, GDPR, GrepCrumbs, DatePicker as GrepDatePicker, GrepDateRange, GrepDialogServiceProvider, GrepEditor, GrepInput, GrepSelect, GrepTable, GrepTableCard, GrepTableOfContent, GrepTableRow, GreyCover, InfoContainer, LinkList, LoadingOverlay, MainLayout, NavGuard, OverflowTooltip, ProfileInfo, SearchBar, ServiceMessage, Sidebar, SortableTable, utdanningsdirektoratetLogoRgbNeg as UdirLogo, index as Utils, convertToRgba, filterElements as filterContentElements, hex2rgb, hex2rgba, makeStyles, useConfirmation, useContentElements, useDate, useDebounce, useGrepDialog, useStyles$d as useStyles, withStyles };
|
|
13103
|
+
export { AppBar, AppBarNavList, AppBarProfile, BodyLayout, CircularLoading, Colors, ConfirmationServiceProvider, ContainedLinkList, DatePicker, DropdownMenu, Footer, GDPR, GrepCrumbs, DatePicker as GrepDatePicker, GrepDateRange, GrepDialogServiceProvider, GrepEditor, GrepInput, GrepSelect, GrepTable, GrepTableCard, GrepTableOfContent, GrepTableRow, GreyCover, InfoContainer, LinkList, LoadingOverlay, MainLayout, NavGuard, OverflowTooltip, ProfileInfo, SearchBar, ServiceMessage, Sidebar, SortableTable, index as Utils, convertToRgba, filterElements as filterContentElements, hex2rgb, hex2rgba, makeStyles, useConfirmation, useContentElements, useDate, useDebounce, useGrepDialog, useStyles$d as useStyles, withStyles };
|
|
13207
13104
|
//# sourceMappingURL=index.js.map
|