grep-components 2.10.0 → 2.11.0-gREPF-2708.2
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 +2 -0
- package/dist/components/GrepDialog/stories/dialog.stories.d.ts +8 -1
- package/dist/components/ToC/components/nav-tree-node.d.ts +0 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.js +57 -177
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +1 -0
- package/package.json +10 -33
- 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,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IAuthorizedPage } from '../types';
|
|
2
3
|
export declare const v0colors: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -14,6 +15,7 @@ export declare const v0colors: {
|
|
|
14
15
|
white: string;
|
|
15
16
|
lightGrey: string;
|
|
16
17
|
};
|
|
18
|
+
export declare const navbarPages: IAuthorizedPage[];
|
|
17
19
|
declare const _default: {
|
|
18
20
|
title: string;
|
|
19
21
|
excludeStories: string[];
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
1
|
+
import React, { JSX } from 'react';
|
|
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
|
+
}>;
|
|
2
8
|
declare const _default: {
|
|
3
9
|
title: string;
|
|
4
10
|
decorators: ((storyFn: any) => JSX.Element)[];
|
|
11
|
+
excludeStories: string[];
|
|
5
12
|
};
|
|
6
13
|
export default _default;
|
|
7
14
|
export declare const Standard: {
|
|
@@ -1,14 +1,5 @@
|
|
|
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
|
-
}
|
|
12
3
|
export interface GrepTableOfContentNavTreeNodeProps {
|
|
13
4
|
node: ContextTreeElement;
|
|
14
5
|
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();
|
|
@@ -1788,14 +1673,13 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
|
|
|
1788
1673
|
const event = onStatusChange('collapse');
|
|
1789
1674
|
if (!event.defaultPrevented) {
|
|
1790
1675
|
setOpen(false);
|
|
1791
|
-
requestAnimationFrame(() => listItemRef.current?.focus());
|
|
1792
1676
|
}
|
|
1793
1677
|
return !event.defaultPrevented;
|
|
1794
1678
|
}, [onStatusChange, setOpen, listItemRef]);
|
|
1795
1679
|
const handleKey = (e) => {
|
|
1796
1680
|
if (items) {
|
|
1797
|
-
switch (e.
|
|
1798
|
-
case
|
|
1681
|
+
switch (e.key) {
|
|
1682
|
+
case Key.ArrowRight:
|
|
1799
1683
|
if (expand()) {
|
|
1800
1684
|
e.preventDefault();
|
|
1801
1685
|
e.stopPropagation();
|
|
@@ -2315,8 +2199,8 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
2315
2199
|
}, onClick: (e) => {
|
|
2316
2200
|
_openDropdown(e, row);
|
|
2317
2201
|
}, onKeyDown: (e) => {
|
|
2318
|
-
switch (e.
|
|
2319
|
-
case
|
|
2202
|
+
switch (e.key) {
|
|
2203
|
+
case Key.Enter:
|
|
2320
2204
|
// dont show dropdown
|
|
2321
2205
|
e.preventDefault();
|
|
2322
2206
|
break;
|
|
@@ -2373,34 +2257,34 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
2373
2257
|
setSelectedRowIndex(i);
|
|
2374
2258
|
}
|
|
2375
2259
|
};
|
|
2376
|
-
switch (e.
|
|
2377
|
-
case
|
|
2260
|
+
switch (e.key) {
|
|
2261
|
+
case Key.ArrowDown:
|
|
2378
2262
|
moveSelectedRow(1);
|
|
2379
2263
|
break;
|
|
2380
|
-
case
|
|
2264
|
+
case Key.ArrowUp:
|
|
2381
2265
|
moveSelectedRow(-1);
|
|
2382
2266
|
break;
|
|
2383
|
-
case
|
|
2384
|
-
case
|
|
2267
|
+
case Key.ArrowLeft:
|
|
2268
|
+
case Key.PageUp:
|
|
2385
2269
|
moveSelectedRow(-rowsPerPage);
|
|
2386
2270
|
break;
|
|
2387
|
-
case
|
|
2388
|
-
case
|
|
2271
|
+
case Key.ArrowRight:
|
|
2272
|
+
case Key.PageDown:
|
|
2389
2273
|
moveSelectedRow(rowsPerPage);
|
|
2390
2274
|
break;
|
|
2391
|
-
case
|
|
2275
|
+
case Key.Home:
|
|
2392
2276
|
setSelectedRowIndex(0);
|
|
2393
2277
|
break;
|
|
2394
|
-
case
|
|
2278
|
+
case Key.End:
|
|
2395
2279
|
setSelectedRowIndex(maxIndex);
|
|
2396
2280
|
break;
|
|
2397
|
-
case
|
|
2281
|
+
case Key.Tab:
|
|
2398
2282
|
requestAnimationFrame(() => {
|
|
2399
2283
|
// check is any children still has focus
|
|
2400
2284
|
!containsFocus(tableRef.current) && setSelectedRowIndex(-1);
|
|
2401
2285
|
});
|
|
2402
2286
|
break;
|
|
2403
|
-
case
|
|
2287
|
+
case Key.Enter:
|
|
2404
2288
|
selectedRow && _handleRowClick(selectedRow);
|
|
2405
2289
|
break;
|
|
2406
2290
|
}
|
|
@@ -2718,6 +2602,12 @@ const useDate = (value = null, options) => {
|
|
|
2718
2602
|
return [date, setDate];
|
|
2719
2603
|
};
|
|
2720
2604
|
|
|
2605
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2606
|
+
|
|
2607
|
+
function getDefaultExportFromCjs (x) {
|
|
2608
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2721
2611
|
/**
|
|
2722
2612
|
* lodash (Custom Build) <https://lodash.com/>
|
|
2723
2613
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
@@ -3170,11 +3060,9 @@ const useContentElements = (container, selector, options) => {
|
|
|
3170
3060
|
});
|
|
3171
3061
|
// start observing
|
|
3172
3062
|
observer.observe(container, config);
|
|
3173
|
-
console.debug('observing container', container);
|
|
3174
3063
|
// stop observing when unmounted
|
|
3175
3064
|
return () => {
|
|
3176
3065
|
observer.disconnect();
|
|
3177
|
-
console.debug('observing disconnected', container);
|
|
3178
3066
|
};
|
|
3179
3067
|
}, [container, config, getElements]);
|
|
3180
3068
|
return elements;
|
|
@@ -12889,7 +12777,7 @@ var lodash_throttleExports = requireLodash_throttle();
|
|
|
12889
12777
|
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
|
12890
12778
|
|
|
12891
12779
|
const generateElementId = (element) => {
|
|
12892
|
-
const tmpId = element.innerText
|
|
12780
|
+
const tmpId = element.innerText?.replace(/\s/g, '-').toLowerCase();
|
|
12893
12781
|
let id = tmpId, index = 1;
|
|
12894
12782
|
while (document.getElementById(id)) {
|
|
12895
12783
|
id = `${tmpId}-${++index}`;
|
|
@@ -12959,9 +12847,7 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12959
12847
|
setSelected(element);
|
|
12960
12848
|
}, 50);
|
|
12961
12849
|
target.addEventListener('scroll', onScroll, false);
|
|
12962
|
-
console.debug('scroll observer attached');
|
|
12963
12850
|
return () => {
|
|
12964
|
-
console.debug('scroll observer detached');
|
|
12965
12851
|
return target.removeEventListener('scroll', onScroll);
|
|
12966
12852
|
};
|
|
12967
12853
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
@@ -12972,13 +12858,11 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12972
12858
|
// observe changes in hash
|
|
12973
12859
|
useEffect(() => {
|
|
12974
12860
|
if (hash && elements[hash]) {
|
|
12975
|
-
console.debug('anchor change, setting selected element');
|
|
12976
12861
|
setSelected(elements[hash], true);
|
|
12977
12862
|
}
|
|
12978
12863
|
}, [hash, setSelected]);
|
|
12979
12864
|
// set selected element on initial load
|
|
12980
12865
|
if (!initialized && elements && elements[hash]) {
|
|
12981
|
-
console.debug('setting initial selected element');
|
|
12982
12866
|
setSelected(elements[hash], true);
|
|
12983
12867
|
setInitialized(true);
|
|
12984
12868
|
}
|
|
@@ -13031,8 +12915,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13031
12915
|
useEffect(() => {
|
|
13032
12916
|
const link = linkRef.current;
|
|
13033
12917
|
if (isSelected) {
|
|
13034
|
-
link?.
|
|
13035
|
-
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
12918
|
+
link?.scrollIntoView({ block: 'nearest' });
|
|
13036
12919
|
}
|
|
13037
12920
|
else if (link === document.activeElement) {
|
|
13038
12921
|
link?.blur();
|
|
@@ -13057,7 +12940,6 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13057
12940
|
};
|
|
13058
12941
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
13059
12942
|
React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
|
|
13060
|
-
console.debug('node click', node);
|
|
13061
12943
|
event.preventDefault();
|
|
13062
12944
|
event.stopPropagation();
|
|
13063
12945
|
doSelect(true);
|
|
@@ -13158,7 +13040,7 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13158
13040
|
});
|
|
13159
13041
|
}, [ref]);
|
|
13160
13042
|
const onKeyDown = (e) => {
|
|
13161
|
-
if (selected && e.
|
|
13043
|
+
if (selected && e.key === Key.Tab && e.shiftKey === false) {
|
|
13162
13044
|
const tabindex = selected.getAttribute('tabindex');
|
|
13163
13045
|
selected.setAttribute('tabindex', '0');
|
|
13164
13046
|
selected.focus();
|
|
@@ -13168,12 +13050,12 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13168
13050
|
: selected.setAttribute('tabindex', tabindex);
|
|
13169
13051
|
});
|
|
13170
13052
|
}
|
|
13171
|
-
if (
|
|
13053
|
+
if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {
|
|
13172
13054
|
e.preventDefault();
|
|
13173
13055
|
e.stopPropagation();
|
|
13174
13056
|
const nodes = Object.values(elements);
|
|
13175
13057
|
const currentIndex = nodes.indexOf(selected);
|
|
13176
|
-
const moveIndex = e.
|
|
13058
|
+
const moveIndex = e.key === Key.ArrowUp ? -1 : 1;
|
|
13177
13059
|
const next = nodes[currentIndex + moveIndex];
|
|
13178
13060
|
next && setSelected(next, true);
|
|
13179
13061
|
focusSelected();
|
|
@@ -13181,13 +13063,13 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13181
13063
|
};
|
|
13182
13064
|
useEffect(() => {
|
|
13183
13065
|
const onKeyDown = (e) => {
|
|
13184
|
-
e.
|
|
13066
|
+
e.key === Key.Alt && setShowKeyboardHint(true);
|
|
13185
13067
|
if (e.altKey) {
|
|
13186
|
-
e.
|
|
13068
|
+
e.key === Key.I && focusSelected();
|
|
13187
13069
|
}
|
|
13188
13070
|
};
|
|
13189
13071
|
const onKeyUp = (e) => {
|
|
13190
|
-
e.
|
|
13072
|
+
e.key === Key.Alt && setShowKeyboardHint(false);
|
|
13191
13073
|
};
|
|
13192
13074
|
window.addEventListener('keydown', onKeyDown);
|
|
13193
13075
|
window.addEventListener('keyup', onKeyUp);
|
|
@@ -13209,7 +13091,5 @@ const GrepTableOfContent = ({ style, className, setSelectedValue, percentageRend
|
|
|
13209
13091
|
};
|
|
13210
13092
|
GrepTableOfContent.displayName = 'Grep.ToC';
|
|
13211
13093
|
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
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 };
|
|
13094
|
+
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 };
|
|
13215
13095
|
//# sourceMappingURL=index.js.map
|