grep-components 2.10.0 → 2.11.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/index.d.ts +0 -1
- package/dist/index.js +55 -166
- package/dist/index.js.map +1 -1
- package/package.json +9 -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
|
+
}
|
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 ./`
|
|
@@ -13158,7 +13049,7 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13158
13049
|
});
|
|
13159
13050
|
}, [ref]);
|
|
13160
13051
|
const onKeyDown = (e) => {
|
|
13161
|
-
if (selected && e.
|
|
13052
|
+
if (selected && e.key === Key.Tab && e.shiftKey === false) {
|
|
13162
13053
|
const tabindex = selected.getAttribute('tabindex');
|
|
13163
13054
|
selected.setAttribute('tabindex', '0');
|
|
13164
13055
|
selected.focus();
|
|
@@ -13168,12 +13059,12 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13168
13059
|
: selected.setAttribute('tabindex', tabindex);
|
|
13169
13060
|
});
|
|
13170
13061
|
}
|
|
13171
|
-
if (
|
|
13062
|
+
if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {
|
|
13172
13063
|
e.preventDefault();
|
|
13173
13064
|
e.stopPropagation();
|
|
13174
13065
|
const nodes = Object.values(elements);
|
|
13175
13066
|
const currentIndex = nodes.indexOf(selected);
|
|
13176
|
-
const moveIndex = e.
|
|
13067
|
+
const moveIndex = e.key === Key.ArrowUp ? -1 : 1;
|
|
13177
13068
|
const next = nodes[currentIndex + moveIndex];
|
|
13178
13069
|
next && setSelected(next, true);
|
|
13179
13070
|
focusSelected();
|
|
@@ -13181,13 +13072,13 @@ const GrepTableOfContentNav = (props) => {
|
|
|
13181
13072
|
};
|
|
13182
13073
|
useEffect(() => {
|
|
13183
13074
|
const onKeyDown = (e) => {
|
|
13184
|
-
e.
|
|
13075
|
+
e.key === Key.Alt && setShowKeyboardHint(true);
|
|
13185
13076
|
if (e.altKey) {
|
|
13186
|
-
e.
|
|
13077
|
+
e.key === Key.I && focusSelected();
|
|
13187
13078
|
}
|
|
13188
13079
|
};
|
|
13189
13080
|
const onKeyUp = (e) => {
|
|
13190
|
-
e.
|
|
13081
|
+
e.key === Key.Alt && setShowKeyboardHint(false);
|
|
13191
13082
|
};
|
|
13192
13083
|
window.addEventListener('keydown', onKeyDown);
|
|
13193
13084
|
window.addEventListener('keyup', onKeyUp);
|
|
@@ -13209,7 +13100,5 @@ const GrepTableOfContent = ({ style, className, setSelectedValue, percentageRend
|
|
|
13209
13100
|
};
|
|
13210
13101
|
GrepTableOfContent.displayName = 'Grep.ToC';
|
|
13211
13102
|
|
|
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 };
|
|
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 };
|
|
13215
13104
|
//# sourceMappingURL=index.js.map
|