grep-components 1.27.0-GREPF-2104.2 → 1.27.0

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/index.js CHANGED
@@ -47,26 +47,19 @@ import Link$1 from '@mui/material/Link';
47
47
  dayjs.extend(isBetweenPlugin);
48
48
  dayjs.extend(LocalizedFormatPlugin);
49
49
  dayjs.locale('nb');
50
- var DateRangeValue = /** @class */ (function () {
51
- function DateRangeValue(from, to) {
50
+ class DateRangeValue {
51
+ constructor(from, to) {
52
52
  this.from = from;
53
53
  this.to = to;
54
54
  }
55
- Object.defineProperty(DateRangeValue.prototype, "valid", {
56
- get: function () {
57
- return this.isValid();
58
- },
59
- enumerable: false,
60
- configurable: true
61
- });
62
- DateRangeValue.prototype.isValid = function (allowNull, allowSame, unit) {
63
- if (allowNull === void 0) { allowNull = true; }
64
- if (allowSame === void 0) { allowSame = true; }
65
- if (unit === void 0) { unit = 'day'; }
55
+ get valid() {
56
+ return this.isValid();
57
+ }
58
+ isValid(allowNull = true, allowSame = true, unit = 'day') {
66
59
  if (!this.from && !this.to)
67
60
  return allowNull;
68
- var dateFrom = dayjs(this.from || undefined);
69
- var dateTo = dayjs(this.to || undefined);
61
+ const dateFrom = dayjs(this.from || undefined);
62
+ const dateTo = dayjs(this.to || undefined);
70
63
  if (!this.from)
71
64
  return allowNull && dateTo.isValid();
72
65
  if (!this.to)
@@ -77,17 +70,13 @@ var DateRangeValue = /** @class */ (function () {
77
70
  : dateTo.isAfter(dateFrom, unit);
78
71
  }
79
72
  return false;
80
- };
81
- DateRangeValue.prototype.compare = function (_a, unit) {
82
- var from = _a.from, to = _a.to;
83
- if (unit === void 0) { unit = 'day'; }
73
+ }
74
+ compare({ from, to }, unit = 'day') {
84
75
  return (dayjs(this.from || '').isSame(dayjs(from || ''), unit) &&
85
76
  dayjs(this.to || '').isSame(dayjs(to || ''), unit));
86
- };
87
- return DateRangeValue;
88
- }());
89
- var parseDate = function (datetime, _a) {
90
- var _b = _a === void 0 ? { utc: true } : _a, format = _b.format, utc = _b.utc;
77
+ }
78
+ }
79
+ const parseDate = (datetime, { format, utc } = { utc: true }) => {
91
80
  datetime =
92
81
  typeof datetime === 'string'
93
82
  ? datetime
@@ -96,34 +85,28 @@ var parseDate = function (datetime, _a) {
96
85
  .replace(/(^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3})(\d*)$/, '$1')
97
86
  : datetime;
98
87
  // dirty hack to not provide utc flag
99
- var parsed = dayjs(datetime, { utc: utc, format: format });
88
+ const parsed = dayjs(datetime, { utc, format });
100
89
  return parsed.isValid() ? dayjs(parsed.toISOString()) : parsed;
101
90
  };
102
- var hasDateChanged = function (a, b) {
91
+ const hasDateChanged = (a, b) => {
103
92
  if (a === null || b === null) {
104
93
  return a !== b;
105
94
  }
106
95
  return dayjs(a).format('L') !== dayjs(b).format('L');
107
96
  };
108
- var isDateValid = function (date, allowNull) {
109
- return !date ? !!allowNull : dayjs(date).isValid();
110
- };
111
- var isSameOrBefore = function (point, match, unit) {
112
- if (unit === void 0) { unit = 'day'; }
113
- var date = dayjs(point);
97
+ const isDateValid = (date, allowNull) => !date ? !!allowNull : dayjs(date).isValid();
98
+ const isSameOrBefore = (point, match, unit = 'day') => {
99
+ const date = dayjs(point);
114
100
  return ((date.isValid() && date.isSame(match, unit)) || date.isBefore(match, unit));
115
101
  };
116
- var isSameOrAfter = function (point, match, unit) {
117
- if (unit === void 0) { unit = 'day'; }
118
- var date = dayjs(point);
102
+ const isSameOrAfter = (point, match, unit = 'day') => {
103
+ const date = dayjs(point);
119
104
  return ((date.isValid() && date.isSame(match, unit)) || date.isAfter(match, unit));
120
105
  };
121
- var getShortDate = function (datetime, options) { return parseDate(datetime, options).format('L'); };
122
- var getTime = function (datetime, options) {
123
- return parseDate(datetime, options).format('[kl.] LT');
124
- };
125
- var getFullDate = function (datetime, options) { return parseDate(datetime, options).format('LLL'); };
126
- var getExcelDateTime = function (datetime, options) { return parseDate(datetime, options).format('L HH:mm'); };
106
+ const getShortDate = (datetime, options) => parseDate(datetime, options).format('L');
107
+ const getTime = (datetime, options) => parseDate(datetime, options).format('[kl.] LT');
108
+ const getFullDate = (datetime, options) => parseDate(datetime, options).format('LLL');
109
+ const getExcelDateTime = (datetime, options) => parseDate(datetime, options).format('L HH:mm');
127
110
 
128
111
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
129
112
 
@@ -249,16 +232,16 @@ var Key_enum = {};
249
232
  })(exports.Key || (exports.Key = {}));
250
233
  } (Key_enum));
251
234
 
252
- var onActivation = function (cb) { return function (ev) {
235
+ const onActivation = (cb) => (ev) => {
253
236
  switch (ev.which) {
254
237
  case Key_enum.Key.Space:
255
238
  case Key_enum.Key.Enter:
256
239
  cb(ev);
257
240
  break;
258
241
  }
259
- }; };
242
+ };
260
243
  var keyboard = {
261
- onActivation: onActivation,
244
+ onActivation,
262
245
  };
263
246
 
264
247
  var index = /*#__PURE__*/Object.freeze({
@@ -277,7 +260,7 @@ var index = /*#__PURE__*/Object.freeze({
277
260
  DateTime: dayjs
278
261
  });
279
262
 
280
- var Colors = {
263
+ const Colors = {
281
264
  red: red[500],
282
265
  pink: pink[500],
283
266
  purple: purple[500],
@@ -304,111 +287,30 @@ var Colors = {
304
287
  white: '#fff',
305
288
  };
306
289
 
307
- /******************************************************************************
308
- Copyright (c) Microsoft Corporation.
309
-
310
- Permission to use, copy, modify, and/or distribute this software for any
311
- purpose with or without fee is hereby granted.
312
-
313
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
314
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
315
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
316
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
317
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
318
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
319
- PERFORMANCE OF THIS SOFTWARE.
320
- ***************************************************************************** */
321
- /* global Reflect, Promise */
322
-
323
- var extendStatics = function(d, b) {
324
- extendStatics = Object.setPrototypeOf ||
325
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
326
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
327
- return extendStatics(d, b);
328
- };
329
-
330
- function __extends(d, b) {
331
- if (typeof b !== "function" && b !== null)
332
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
333
- extendStatics(d, b);
334
- function __() { this.constructor = d; }
335
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
336
- }
337
-
338
- var __assign = function() {
339
- __assign = Object.assign || function __assign(t) {
340
- for (var s, i = 1, n = arguments.length; i < n; i++) {
341
- s = arguments[i];
342
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
343
- }
344
- return t;
345
- };
346
- return __assign.apply(this, arguments);
347
- };
348
-
349
- function __rest$1(s, e) {
350
- var t = {};
351
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
352
- t[p] = s[p];
353
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
354
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
355
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
356
- t[p[i]] = s[p[i]];
357
- }
358
- return t;
359
- }
360
-
361
- function __read(o, n) {
362
- var m = typeof Symbol === "function" && o[Symbol.iterator];
363
- if (!m) return o;
364
- var i = m.call(o), r, ar = [], e;
365
- try {
366
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
367
- }
368
- catch (error) { e = { error: error }; }
369
- finally {
370
- try {
371
- if (r && !r.done && (m = i["return"])) m.call(i);
372
- }
373
- finally { if (e) throw e.error; }
374
- }
375
- return ar;
376
- }
377
-
378
- function __spreadArray(to, from, pack) {
379
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
380
- if (ar || !(i in from)) {
381
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
382
- ar[i] = from[i];
383
- }
384
- }
385
- return to.concat(ar || Array.prototype.slice.call(from));
386
- }
387
-
388
- var hexPattern = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
389
- var hexPatternShorthand = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
390
- var convertHex2rgb = function (hex) {
391
- var match = hex
392
- .replace(hexPatternShorthand, function (_m, r, g, b) { return r + r + g + g + b + b; })
290
+ const hexPattern = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
291
+ const hexPatternShorthand = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
292
+ const convertHex2rgb = (hex) => {
293
+ const match = hex
294
+ .replace(hexPatternShorthand, (_m, r, g, b) => r + r + g + g + b + b)
393
295
  .match(hexPattern);
394
296
  match && match.shift();
395
- return match ? match.map(function (i) { return parseInt(i, 16); }) : [];
297
+ return match ? match.map((i) => parseInt(i, 16)) : [];
396
298
  };
397
- var hex2rgb = function (hex) {
398
- var rgb = convertHex2rgb(hex);
399
- return rgb && "rgb(".concat(rgb.join(','), ")");
299
+ const hex2rgb = (hex) => {
300
+ const rgb = convertHex2rgb(hex);
301
+ return rgb && `rgb(${rgb.join(',')})`;
400
302
  };
401
- var hex2rgba = function (hex, alpha) {
402
- var rgb = convertHex2rgb(hex);
303
+ const hex2rgba = (hex, alpha) => {
304
+ const rgb = convertHex2rgb(hex);
403
305
  rgb && rgb.push(alpha);
404
- return rgb && "rgba(".concat(rgb.join(','), ")");
306
+ return rgb && `rgba(${rgb.join(',')})`;
405
307
  };
406
- var convertToRgba = function (color, alpha) {
308
+ const convertToRgba = (color, alpha) => {
407
309
  if (color.match(/^#/)) {
408
310
  return hex2rgba(color, alpha);
409
311
  }
410
- var _a = __read(color.match(/[(](.*)[)]/) || [], 2), value = _a[1];
411
- return value ? "rgba(".concat(value, ", ").concat(alpha, ")") : color;
312
+ const [, value] = color.match(/[(](.*)[)]/) || [];
313
+ return value ? `rgba(${value}, ${alpha})` : color;
412
314
  };
413
315
 
414
316
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -2959,33 +2861,29 @@ function createMakeAndWithStyles(params) {
2959
2861
  return Object.assign(Object.assign({}, createMakeStyles(params)), createWithStyles(params));
2960
2862
  }
2961
2863
 
2962
- var _a;
2963
- var makeStyles = (_a = createMakeAndWithStyles({
2964
- useTheme: useTheme,
2864
+ const { makeStyles, withStyles } = createMakeAndWithStyles({
2865
+ useTheme,
2965
2866
  /*
2966
2867
  OR, if you have extended the default mui theme adding your own custom properties:
2967
2868
  Let's assume the myTheme object that you provide to the <ThemeProvider /> is of
2968
2869
  type MyTheme then you'll write:
2969
2870
  */
2970
2871
  //"useTheme": useTheme as (()=> MyTheme)
2971
- }), _a.makeStyles), withStyles = _a.withStyles;
2972
-
2973
- var useStyles$i = makeStyles()(function (_a) {
2974
- var palette = _a.palette;
2975
- return ({
2976
- user: {
2977
- color: palette.text.primary,
2978
- margin: '0 10px',
2979
- marginLeft: 20,
2980
- height: 'fit-content',
2981
- textAlign: 'left',
2982
- textTransform: 'none',
2983
- },
2984
- });
2985
2872
  });
2986
2873
 
2987
- var AppBarProfile = function (props) {
2988
- var classes = useStyles$i().classes;
2874
+ const useStyles$i = makeStyles()(({ palette }) => ({
2875
+ user: {
2876
+ color: palette.text.primary,
2877
+ margin: '0 10px',
2878
+ marginLeft: 20,
2879
+ height: 'fit-content',
2880
+ textAlign: 'left',
2881
+ textTransform: 'none',
2882
+ },
2883
+ }));
2884
+
2885
+ const AppBarProfile = (props) => {
2886
+ const { classes } = useStyles$i();
2989
2887
  return (React.createElement(Button, { variant: "text", onClick: props.onButtonClick },
2990
2888
  React.createElement(AccountCircle, { color: "primary", fontSize: "large" }),
2991
2889
  React.createElement(Box, { className: classes.user },
@@ -2994,87 +2892,76 @@ var AppBarProfile = function (props) {
2994
2892
  React.createElement(ArrowDropdown, { color: "primary" })));
2995
2893
  };
2996
2894
 
2997
- var useStyles$h = makeStyles()(function (theme) {
2998
- var _a, _b;
2999
- return ({
3000
- tabs: (_a = {
3001
- margin: 'auto 0'
3002
- },
3003
- _a[theme.breakpoints.down('xl')] = {
3004
- display: 'none',
3005
- },
3006
- _a[theme.breakpoints.up('lg')] = {
3007
- display: 'grid',
3008
- },
3009
- _a),
3010
- tab: (_b = {
3011
- textTransform: 'uppercase',
3012
- color: theme.palette.primary.main,
3013
- fontWeight: theme.typography.fontWeightBold,
3014
- fontSize: theme.typography.subtitle1.fontSize,
3015
- marginRight: theme.spacing(1),
3016
- '&:focus': {
3017
- opacity: 1,
3018
- }
3019
- },
3020
- _b[theme.breakpoints.down('lg')] = {
3021
- minWidth: 120,
3022
- marginRight: 0,
3023
- },
3024
- _b[theme.breakpoints.up('lg')] = {
3025
- minWidth: 160,
3026
- padding: '12px',
3027
- },
3028
- _b[theme.breakpoints.up('lg')] = {
3029
- minWidth: 160,
3030
- padding: '12px',
3031
- },
3032
- _b[theme.breakpoints.up('lg')] = {
3033
- minWidth: 160,
3034
- padding: '12px',
3035
- },
3036
- _b),
3037
- indicator: {
2895
+ const useStyles$h = makeStyles()((theme) => ({
2896
+ tabs: {
2897
+ margin: 'auto 0',
2898
+ [theme.breakpoints.down('xl')]: {
2899
+ display: 'none',
2900
+ },
2901
+ [theme.breakpoints.up('lg')]: {
2902
+ display: 'grid',
2903
+ },
2904
+ },
2905
+ tab: {
2906
+ textTransform: 'uppercase',
2907
+ color: theme.palette.primary.main,
2908
+ fontWeight: theme.typography.fontWeightBold,
2909
+ fontSize: theme.typography.subtitle1.fontSize,
2910
+ marginRight: theme.spacing(1),
2911
+ '&:focus': {
2912
+ opacity: 1,
2913
+ },
2914
+ [theme.breakpoints.down('lg')]: {
2915
+ minWidth: 120,
2916
+ marginRight: 0,
2917
+ },
2918
+ [theme.breakpoints.up('lg')]: {
2919
+ minWidth: 160,
2920
+ padding: '12px',
2921
+ },
2922
+ [theme.breakpoints.up('lg')]: {
2923
+ minWidth: 160,
2924
+ padding: '12px',
2925
+ },
2926
+ [theme.breakpoints.up('lg')]: {
2927
+ minWidth: 160,
2928
+ padding: '12px',
2929
+ },
2930
+ },
2931
+ indicator: {
2932
+ display: 'flex',
2933
+ justifyContent: 'center',
2934
+ backgroundColor: 'transparent',
2935
+ '& > div': {
2936
+ maxWidth: 40,
2937
+ width: '100%',
2938
+ backgroundColor: theme.palette.secondary.main,
2939
+ },
2940
+ },
2941
+ }));
2942
+ const useMobileStyles = makeStyles()(({ palette, breakpoints }) => ({
2943
+ mobileNavList: {
2944
+ backgroundColor: `transparent`,
2945
+ color: palette.primary.main,
2946
+ fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
2947
+ [breakpoints.down('lg')]: {
3038
2948
  display: 'flex',
3039
- justifyContent: 'center',
3040
- backgroundColor: 'transparent',
3041
- '& > div': {
3042
- maxWidth: 40,
3043
- width: '100%',
3044
- backgroundColor: theme.palette.secondary.main,
3045
- },
3046
2949
  },
3047
- });
3048
- });
3049
- var useMobileStyles = makeStyles()(function (_a) {
3050
- var _b;
3051
- var palette = _a.palette, breakpoints = _a.breakpoints;
3052
- return ({
3053
- mobileNavList: (_b = {
3054
- backgroundColor: "transparent",
3055
- color: palette.primary.main,
3056
- fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif'
3057
- },
3058
- _b[breakpoints.down('lg')] = {
3059
- display: 'flex',
3060
- },
3061
- _b[breakpoints.up('lg')] = {
3062
- display: 'none',
3063
- },
3064
- _b),
3065
- });
3066
- });
3067
-
3068
- var MobileAppBarNavList = function (_a) {
3069
- var pages = _a.pages;
3070
- var classes = useMobileStyles().classes;
3071
- var history = useHistory();
3072
- var _b = __read(React.useState(null), 2), anchorElNav = _b[0], setAnchorElNav = _b[1];
3073
- var openNav = Boolean(anchorElNav);
3074
- var handleClickNav = function (event) {
2950
+ [breakpoints.up('lg')]: {
2951
+ display: 'none',
2952
+ },
2953
+ },
2954
+ }));
2955
+
2956
+ const MobileAppBarNavList = ({ pages, }) => {
2957
+ const { classes } = useMobileStyles();
2958
+ const history = useHistory();
2959
+ const [anchorElNav, setAnchorElNav] = React.useState(null);
2960
+ const openNav = Boolean(anchorElNav);
2961
+ const handleClickNav = (event) => {
3075
2962
  setAnchorElNav(event.currentTarget);
3076
2963
  };
3077
- var handleCloseNav = function () {
2964
+ const handleCloseNav = () => {
3078
2965
  setAnchorElNav(null);
3079
2966
  };
3080
2967
  return (React.createElement(Box, { style: { flexGrow: 1 }, className: classes.mobileNavList },
@@ -3082,34 +2969,30 @@ var MobileAppBarNavList = function (_a) {
3082
2969
  React.createElement(MenuIcon, { fontSize: "large" })),
3083
2970
  React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElNav, open: openNav, onClose: handleCloseNav, MenuListProps: {
3084
2971
  'aria-labelledby': 'basic-button',
3085
- } }, pages.map(function (page) { return (React.createElement(MenuItem, { key: page.id, onClick: function () {
2972
+ } }, pages.map((page) => (React.createElement(MenuItem, { key: page.id, onClick: () => {
3086
2973
  handleCloseNav();
3087
- history.push((page === null || page === void 0 ? void 0 : page.toUrl) || '');
3088
- }, onKeyDown: keyboard.onActivation(function () {
3089
- return history.push((page === null || page === void 0 ? void 0 : page.toUrl) || '');
3090
- }) }, page.label)); }))));
2974
+ history.push(page?.toUrl || '');
2975
+ }, onKeyDown: keyboard.onActivation(() => history.push(page?.toUrl || '')) }, page.label))))));
3091
2976
  };
3092
2977
 
3093
- var AppBarNavList = function (_a) {
3094
- var selectedPage = _a.selectedPage, pages = _a.pages, onChange = _a.onChange;
3095
- var _b = __read(React.useState(selectedPage), 2), value = _b[0], setValue = _b[1];
3096
- var classes = useStyles$h().classes;
3097
- var handleChange = function (_event, newValue) {
2978
+ const AppBarNavList = ({ selectedPage, pages, onChange, }) => {
2979
+ const [value, setValue] = React.useState(selectedPage);
2980
+ const { classes } = useStyles$h();
2981
+ const handleChange = (_event, newValue) => {
3098
2982
  setValue(newValue);
3099
2983
  onChange(newValue);
3100
2984
  };
3101
2985
  return (React.createElement(React.Fragment, null,
3102
- React.createElement(Tabs, { classes: { root: classes.tabs, indicator: classes.indicator }, value: value, onChange: handleChange, TabIndicatorProps: { children: React.createElement("div", null) } }, pages.map(function (page) { return (React.createElement(Tab, { disableTouchRipple: true, className: classes.tab, key: page.id, label: page.label })); })),
2986
+ React.createElement(Tabs, { classes: { root: classes.tabs, indicator: classes.indicator }, value: value, onChange: handleChange, TabIndicatorProps: { children: React.createElement("div", null) } }, pages.map((page) => (React.createElement(Tab, { disableTouchRipple: true, className: classes.tab, key: page.id, label: page.label })))),
3103
2987
  React.createElement(MobileAppBarNavList, { pages: pages })));
3104
2988
  };
3105
2989
 
3106
- var BodyLayout = function (props) { return (React.createElement(Box, { width: "100%", paddingTop: "20px", display: "flex", flexDirection: "row", marginBottom: "20px", justifyContent: "space-between" }, props.children)); };
2990
+ const BodyLayout = (props) => (React.createElement(Box, { width: "100%", paddingTop: "20px", display: "flex", flexDirection: "row", marginBottom: "20px", justifyContent: "space-between" }, props.children));
3107
2991
 
3108
- var MainLayout = function (props) { return (React.createElement(Box, { display: "flex", flex: "1", flexDirection: "column" }, props.children)); };
2992
+ const MainLayout = (props) => (React.createElement(Box, { display: "flex", flex: "1", flexDirection: "column" }, props.children));
3109
2993
 
3110
- var CollapsableMenu = function (_a) {
3111
- var children = _a.children, onMenuClose = _a.onMenuClose, collapseProps = __rest$1(_a, ["children", "onMenuClose"]);
3112
- var onKeyDown = function (e) {
2994
+ const CollapsableMenu = ({ children, onMenuClose, ...collapseProps }) => {
2995
+ const onKeyDown = (e) => {
3113
2996
  switch (e.keyCode) {
3114
2997
  case Key_enum.Key.Escape:
3115
2998
  onMenuClose && onMenuClose();
@@ -3119,37 +3002,33 @@ var CollapsableMenu = function (_a) {
3119
3002
  }
3120
3003
  e.stopPropagation();
3121
3004
  };
3122
- return (React__default.createElement(Collapse, __assign({ timeout: "auto", unmountOnExit: true, mountOnEnter: true }, collapseProps),
3005
+ return (React__default.createElement(Collapse, { timeout: "auto", unmountOnExit: true, mountOnEnter: true, ...collapseProps },
3123
3006
  React__default.createElement(MenuList, { disablePadding: true, autoFocusItem: true, onKeyDown: onKeyDown }, children)));
3124
3007
  };
3125
3008
 
3126
- var useStyles$g = makeStyles()(function (_a, _b) {
3127
- var palette = _a.palette, transitions = _a.transitions;
3128
- var open = _b.open;
3129
- return ({
3130
- root: {
3131
- padding: '0 1rem',
3132
- transition: transitions.create(['background-color'], {
3133
- duration: transitions.duration.short,
3134
- easing: transitions.easing.easeIn,
3135
- }),
3136
- '&.Mui-focusVisible': {
3137
- backgroundColor: convertToRgba(palette.primary.light, 0.15),
3138
- },
3139
- },
3140
- subMenu: {
3141
- margin: '0 -1rem',
3142
- },
3143
- expander: {
3144
- marginLeft: '2rem',
3145
- transform: "rotate(".concat(open ? 180 : 0, "deg)"),
3146
- transition: transitions.create(['transform, color, background-color'], {
3147
- duration: transitions.duration.short,
3148
- easing: transitions.easing.easeOut,
3149
- }),
3009
+ const useStyles$g = makeStyles()(({ palette, transitions }, { open }) => ({
3010
+ root: {
3011
+ padding: '0 1rem',
3012
+ transition: transitions.create(['background-color'], {
3013
+ duration: transitions.duration.short,
3014
+ easing: transitions.easing.easeIn,
3015
+ }),
3016
+ '&.Mui-focusVisible': {
3017
+ backgroundColor: convertToRgba(palette.primary.light, 0.15),
3150
3018
  },
3151
- });
3152
- });
3019
+ },
3020
+ subMenu: {
3021
+ margin: '0 -1rem',
3022
+ },
3023
+ expander: {
3024
+ marginLeft: '2rem',
3025
+ transform: `rotate(${open ? 180 : 0}deg)`,
3026
+ transition: transitions.create(['transform, color, background-color'], {
3027
+ duration: transitions.duration.short,
3028
+ easing: transitions.easing.easeOut,
3029
+ }),
3030
+ },
3031
+ }));
3153
3032
 
3154
3033
  /**
3155
3034
  * TypeError: Failed to construct 'CustomEvent': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
@@ -3157,42 +3036,36 @@ var useStyles$g = makeStyles()(function (_a, _b) {
3157
3036
  *
3158
3037
  * export class CollapsableMenuStatusEvent extends CustomEvent<React.Ref<any>> {}
3159
3038
  */
3160
- var CollapsableMenuStatusEvent = /** @class */ (function () {
3161
- function CollapsableMenuStatusEvent(type, currentTarget) {
3039
+ class CollapsableMenuStatusEvent {
3040
+ constructor(type, currentTarget) {
3162
3041
  this.type = type;
3163
3042
  this.currentTarget = currentTarget;
3164
3043
  }
3165
- Object.defineProperty(CollapsableMenuStatusEvent.prototype, "defaultPrevented", {
3166
- get: function () {
3167
- return !!this._defaultPrevented;
3168
- },
3169
- enumerable: false,
3170
- configurable: true
3171
- });
3172
- CollapsableMenuStatusEvent.prototype.preventDefault = function () {
3044
+ get defaultPrevented() {
3045
+ return !!this._defaultPrevented;
3046
+ }
3047
+ preventDefault() {
3173
3048
  this._defaultPrevented = true;
3174
- };
3175
- return CollapsableMenuStatusEvent;
3176
- }());
3177
- var CollapsableMenuItem = function (_a) {
3178
- var items = _a.items, onClick = _a.onClick, children = _a.children; _a.onClose; var tooltipText = _a.tooltipText, disabled = _a.disabled, props = __rest$1(_a, ["items", "onClick", "children", "onClose", "tooltipText", "disabled"]);
3179
- var listItemRef = useRef(null);
3180
- var _b = __read(useState(false), 2), open = _b[0], setOpen = _b[1];
3181
- var onStatusChange = useCallback$1(function (type) { return new CollapsableMenuStatusEvent(type, listItemRef); }, [listItemRef]);
3182
- var expand = useCallback$1(function () {
3183
- var event = onStatusChange('expand');
3049
+ }
3050
+ }
3051
+ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tooltipText, disabled, ...props }) => {
3052
+ const listItemRef = useRef(null);
3053
+ const [open, setOpen] = useState(false);
3054
+ const onStatusChange = useCallback$1((type) => new CollapsableMenuStatusEvent(type, listItemRef), [listItemRef]);
3055
+ const expand = useCallback$1(() => {
3056
+ const event = onStatusChange('expand');
3184
3057
  !event.defaultPrevented && setOpen(true);
3185
3058
  return !event.defaultPrevented;
3186
3059
  }, [onStatusChange, setOpen]);
3187
- var collapse = useCallback$1(function () {
3188
- var event = onStatusChange('collapse');
3060
+ const collapse = useCallback$1(() => {
3061
+ const event = onStatusChange('collapse');
3189
3062
  if (!event.defaultPrevented) {
3190
3063
  setOpen(false);
3191
- requestAnimationFrame(function () { var _a; return (_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
3064
+ requestAnimationFrame(() => listItemRef.current?.focus());
3192
3065
  }
3193
3066
  return !event.defaultPrevented;
3194
3067
  }, [onStatusChange, setOpen, listItemRef]);
3195
- var handleKey = function (e) {
3068
+ const handleKey = (e) => {
3196
3069
  if (items) {
3197
3070
  switch (e.keyCode) {
3198
3071
  case Key_enum.Key.RightArrow:
@@ -3204,204 +3077,181 @@ var CollapsableMenuItem = function (_a) {
3204
3077
  }
3205
3078
  }
3206
3079
  };
3207
- var onToggleClick = useCallback$1(function (e) {
3080
+ const onToggleClick = useCallback$1((e) => {
3208
3081
  e.preventDefault();
3209
3082
  e.stopPropagation();
3210
3083
  open ? collapse() : expand();
3211
3084
  }, [open, collapse, expand]);
3212
- var onScrimClick = useCallback$1(function (e) {
3213
- var _a;
3214
- var scrimClick = !((_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target));
3085
+ const onScrimClick = useCallback$1((e) => {
3086
+ const scrimClick = !listItemRef.current?.contains(e.target);
3215
3087
  scrimClick && collapse();
3216
3088
  }, [listItemRef, collapse]);
3217
- var handleClick = items ? onToggleClick : onClick;
3218
- useEffect(function () {
3089
+ const handleClick = items ? onToggleClick : onClick;
3090
+ useEffect(() => {
3219
3091
  document.addEventListener('click', onScrimClick, { capture: true });
3220
- return function () { return document.removeEventListener('click', onScrimClick); };
3092
+ return () => document.removeEventListener('click', onScrimClick);
3221
3093
  }, [listItemRef, onScrimClick]);
3222
- var classes = useStyles$g({ open: open }).classes;
3223
- var renderInner = function () { return (React__default.createElement(Box, { display: "flex", flexDirection: "column", width: "100%" },
3094
+ const { classes } = useStyles$g({ open });
3095
+ const renderInner = () => (React__default.createElement(Box, { display: "flex", flexDirection: "column", width: "100%" },
3224
3096
  React__default.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", minHeight: 48 },
3225
3097
  children,
3226
3098
  items && React__default.createElement(IconExpand, { className: classes.expander })),
3227
- items && (React__default.createElement(CollapsableMenu, { className: classes.subMenu, in: open, onMenuClose: collapse, onEntered: function () {
3228
- return requestAnimationFrame(function () {
3229
- return window.dispatchEvent(new Event('resize'));
3230
- });
3231
- } }, items)))); };
3099
+ items && (React__default.createElement(CollapsableMenu, { className: classes.subMenu, in: open, onMenuClose: collapse, onEntered: () => requestAnimationFrame(() => window.dispatchEvent(new Event('resize'))) }, items))));
3232
3100
  return tooltipText ? (React__default.createElement(Tooltip, { title: tooltipText },
3233
3101
  React__default.createElement(MenuItem, { role: "menuitem", sx: disabled && !items
3234
3102
  ? { cursor: 'not-allowed', pointerEvents: 'inherit !important' }
3235
- : { pointerEvents: 'inherit !important' }, className: classes.root, onMouseOver: function (e) { return e.currentTarget.focus(); }, selected: open, ref: listItemRef, onClick: handleClick, onKeyDown: handleKey }, renderInner()))) : (React__default.createElement(MenuItem, __assign({ sx: disabled && !items ? { cursor: 'not-allowed' } : {}, className: classes.root, ref: listItemRef, selected: open, onClick: handleClick, onKeyDown: handleKey }, props), renderInner()));
3103
+ : { pointerEvents: 'inherit !important' }, className: classes.root, onMouseOver: (e) => e.currentTarget.focus(), selected: open, ref: listItemRef, onClick: handleClick, onKeyDown: handleKey }, renderInner()))) : (React__default.createElement(MenuItem, { sx: disabled && !items ? { cursor: 'not-allowed' } : {}, className: classes.root, ref: listItemRef, selected: open, onClick: handleClick, onKeyDown: handleKey, ...props }, renderInner()));
3236
3104
  };
3237
3105
 
3238
- var useStyles$f = makeStyles()(function (_a) {
3239
- var palette = _a.palette;
3240
- return ({
3241
- selected: {
3242
- color: "".concat(palette.common.black, " !important"),
3243
- backgroundColor: 'rgba(0,0,0,.05) !important',
3244
- },
3245
- });
3246
- });
3247
-
3248
- var DropdownMenu = function (_a) {
3249
- var context = _a.context, menuItems = _a.menuItems, menuProps = __rest$1(_a, ["context", "menuItems"]);
3250
- var classes = useStyles$f().classes;
3251
- var renderChild = function (level, parentDisabled) {
3252
- if (level === void 0) { level = 0; }
3253
- // eslint-disable-next-line react/display-name
3254
- return function (item, index) {
3255
- var _a;
3256
- var label = item.label, children = item.children, handleClick = item.handleClick, disabled = item.disabled, props = __rest$1(item, ["label", "children", "handleClick", "disabled"]);
3257
- var itemOrParentDisabled = (_a = (parentDisabled || disabled)) !== null && _a !== void 0 ? _a : false;
3258
- var isDisabled = typeof itemOrParentDisabled === 'function'
3259
- ? itemOrParentDisabled(context)
3260
- : itemOrParentDisabled;
3261
- var style = isDisabled
3262
- ? { paddingLeft: "".concat(level * 0.5, "rem"), opacity: 0.4 }
3263
- : {
3264
- paddingLeft: "".concat(level * 0.5, "rem"),
3265
- };
3266
- props.key = "child-item-".concat(index);
3267
- props.classes = { selected: classes.selected };
3268
- // ninja way, since rewriting existing code on lpu and admin is daunting
3269
- props.onClick = function (e) {
3270
- if (isDisabled) {
3271
- e.preventDefault();
3272
- e.stopPropagation();
3273
- return;
3274
- }
3275
- menuProps.onClose && menuProps.onClose(e, 'backdropClick');
3276
- !isDisabled && handleClick && handleClick(context);
3106
+ const useStyles$f = makeStyles()(({ palette }) => ({
3107
+ selected: {
3108
+ color: `${palette.common.black} !important`,
3109
+ backgroundColor: 'rgba(0,0,0,.05) !important',
3110
+ },
3111
+ }));
3112
+
3113
+ const DropdownMenu = ({ context, menuItems, ...menuProps }) => {
3114
+ const { classes } = useStyles$f();
3115
+ const renderChild = (level = 0, parentDisabled) =>
3116
+ // eslint-disable-next-line react/display-name
3117
+ (item, index) => {
3118
+ const { label, children, handleClick, disabled, ...props } = item;
3119
+ const itemOrParentDisabled = (parentDisabled || disabled) ?? false;
3120
+ const isDisabled = typeof itemOrParentDisabled === 'function'
3121
+ ? itemOrParentDisabled(context)
3122
+ : itemOrParentDisabled;
3123
+ const style = isDisabled
3124
+ ? { paddingLeft: `${level * 0.5}rem`, opacity: 0.4 }
3125
+ : {
3126
+ paddingLeft: `${level * 0.5}rem`,
3277
3127
  };
3278
- return (React__default.createElement(CollapsableMenuItem, __assign({ sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children === null || children === void 0 ? void 0 : children.map(renderChild(level + 1, isDisabled)) }, props),
3279
- React__default.createElement("span", { style: style }, label)));
3128
+ props.key = `child-item-${index}`;
3129
+ props.classes = { selected: classes.selected };
3130
+ // ninja way, since rewriting existing code on lpu and admin is daunting
3131
+ props.onClick = (e) => {
3132
+ if (isDisabled) {
3133
+ e.preventDefault();
3134
+ e.stopPropagation();
3135
+ return;
3136
+ }
3137
+ menuProps.onClose && menuProps.onClose(e, 'backdropClick');
3138
+ !isDisabled && handleClick && handleClick(context);
3280
3139
  };
3140
+ return (React__default.createElement(CollapsableMenuItem, { sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children?.map(renderChild(level + 1, isDisabled)), ...props },
3141
+ React__default.createElement("span", { style: style }, label)));
3281
3142
  };
3282
- return (React__default.createElement(Menu, __assign({}, menuProps, { anchorOrigin: (menuProps === null || menuProps === void 0 ? void 0 : menuProps.anchorOrigin) || {
3143
+ return (React__default.createElement(Menu, { ...menuProps, anchorOrigin: menuProps?.anchorOrigin || {
3283
3144
  vertical: 'bottom',
3284
3145
  horizontal: 'center',
3285
3146
  }, transformOrigin: menuProps.transformOrigin || {
3286
3147
  vertical: 'top',
3287
3148
  horizontal: 'center',
3288
- } }), menuItems.map(renderChild())));
3149
+ } }, menuItems.map(renderChild())));
3289
3150
  };
3290
3151
 
3291
- var useFooterStyles = makeStyles()(function (theme) {
3292
- var _a, _b, _c, _d, _e;
3293
- return ({
3294
- footer: (_a = {
3295
- bottom: 0,
3296
- width: '100%',
3297
- marginTop: 'auto',
3298
- display: 'flex',
3299
- alignItems: 'center',
3300
- backgroundColor: theme.palette.primary.main
3301
- },
3302
- _a[theme.breakpoints.down('md')] = {
3303
- minHeight: 'unset',
3304
- },
3305
- _a[theme.breakpoints.up('md')] = {
3306
- minHeight: '100px',
3307
- },
3308
- _a.fontFamily = 'Montserrat',
3309
- _a.fontWeight = 600,
3310
- _a.fontSize = '14px',
3311
- _a),
3312
- content: (_b = {
3313
- display: 'flex',
3314
- width: '100%',
3315
- a: {
3316
- ':focus': {
3317
- outlineColor: 'white',
3318
- outlineOffset: '8px',
3319
- },
3320
- }
3321
- },
3322
- _b[theme.breakpoints.down('md')] = {
3323
- flexDirection: 'column',
3324
- padding: '0',
3325
- a: {
3326
- width: '150px',
3327
- margin: '40px auto 40px auto',
3328
- },
3329
- },
3330
- _b[theme.breakpoints.up('md')] = {
3331
- flexDirection: 'row',
3332
- padding: '0 12px 0 12px',
3333
- a: {
3334
- marginLeft: '28px',
3335
- },
3336
- },
3337
- _b),
3338
- serviceNameText: (_c = {
3339
- color: Colors.white,
3340
- textAlign: 'center',
3341
- display: 'block'
3342
- },
3343
- _c[theme.breakpoints.down('md')] = {
3344
- marginBottom: '30px',
3345
- },
3346
- _c),
3347
- list: (_d = {
3348
- display: 'flex',
3349
- flexDirection: 'row',
3350
- justifyContent: 'center'
3351
- },
3352
- _d[theme.breakpoints.down('md')] = {
3353
- marginBottom: '40px',
3354
- flexWrap: 'wrap',
3355
- height: '64px',
3356
- },
3357
- _d),
3358
- item: (_e = {
3359
- color: Colors.white,
3360
- width: 'fit-content',
3361
- margin: '0',
3362
- height: '10px',
3363
- gap: '10px',
3364
- borderRight: "1px solid #7dbf9d"
3365
- },
3366
- _e[theme.breakpoints.down('md')] = {
3367
- textAlign: 'center',
3368
- width: 'filter-content',
3369
- },
3370
- _e['&:last-child'] = {
3371
- border: '0 !important',
3152
+ const useFooterStyles = makeStyles()((theme) => ({
3153
+ footer: {
3154
+ bottom: 0,
3155
+ width: '100%',
3156
+ marginTop: 'auto',
3157
+ display: 'flex',
3158
+ alignItems: 'center',
3159
+ backgroundColor: theme.palette.primary.main,
3160
+ [theme.breakpoints.down('md')]: {
3161
+ minHeight: 'unset',
3162
+ },
3163
+ [theme.breakpoints.up('md')]: {
3164
+ minHeight: '100px',
3165
+ },
3166
+ fontFamily: 'Montserrat',
3167
+ fontWeight: 600,
3168
+ fontSize: '14px',
3169
+ },
3170
+ content: {
3171
+ display: 'flex',
3172
+ width: '100%',
3173
+ a: {
3174
+ ':focus': {
3175
+ outlineColor: 'white',
3176
+ outlineOffset: '8px',
3372
3177
  },
3373
- _e[':focus'] = {
3374
- background: 'inherit',
3375
- boxShadow: '0px 0px 0px 1px white',
3376
- borderRadius: '2px',
3178
+ },
3179
+ [theme.breakpoints.down('md')]: {
3180
+ flexDirection: 'column',
3181
+ padding: '0',
3182
+ a: {
3183
+ width: '150px',
3184
+ margin: '40px auto 40px auto',
3377
3185
  },
3378
- _e),
3379
- itemText: {
3380
- padding: 0,
3381
- margin: '0 auto',
3382
- fontFamily: 'Montserrat',
3383
- fontWeight: 400,
3384
- fontSize: '14px',
3385
- color: Colors.white,
3386
3186
  },
3387
- itemBtn: {
3388
- textDecoration: 'underline',
3389
- textTransform: 'none',
3390
- '&:hover': {
3391
- backgroundColor: 'unset',
3187
+ [theme.breakpoints.up('md')]: {
3188
+ flexDirection: 'row',
3189
+ padding: '0 12px 0 12px',
3190
+ a: {
3191
+ marginLeft: '28px',
3392
3192
  },
3393
3193
  },
3394
- });
3395
- });
3194
+ },
3195
+ serviceNameText: {
3196
+ color: Colors.white,
3197
+ textAlign: 'center',
3198
+ display: 'block',
3199
+ [theme.breakpoints.down('md')]: {
3200
+ marginBottom: '30px',
3201
+ },
3202
+ },
3203
+ list: {
3204
+ display: 'flex',
3205
+ flexDirection: 'row',
3206
+ justifyContent: 'center',
3207
+ [theme.breakpoints.down('md')]: {
3208
+ marginBottom: '40px',
3209
+ flexWrap: 'wrap',
3210
+ height: '64px',
3211
+ },
3212
+ },
3213
+ item: {
3214
+ color: Colors.white,
3215
+ width: 'fit-content',
3216
+ margin: '0',
3217
+ height: '10px',
3218
+ gap: '10px',
3219
+ borderRight: `1px solid #7dbf9d`,
3220
+ [theme.breakpoints.down('md')]: {
3221
+ textAlign: 'center',
3222
+ width: 'filter-content',
3223
+ },
3224
+ '&:last-child': {
3225
+ border: '0 !important',
3226
+ },
3227
+ ':focus': {
3228
+ background: 'inherit',
3229
+ boxShadow: '0px 0px 0px 1px white',
3230
+ borderRadius: '2px',
3231
+ },
3232
+ },
3233
+ itemText: {
3234
+ padding: 0,
3235
+ margin: '0 auto',
3236
+ fontFamily: 'Montserrat',
3237
+ fontWeight: 400,
3238
+ fontSize: '14px',
3239
+ color: Colors.white,
3240
+ },
3241
+ itemBtn: {
3242
+ textDecoration: 'underline',
3243
+ textTransform: 'none',
3244
+ '&:hover': {
3245
+ backgroundColor: 'unset',
3246
+ },
3247
+ },
3248
+ }));
3396
3249
 
3397
- var Footer = function (_a) {
3398
- var items = _a.items, serviceNameText = _a.serviceNameText, udirLink = _a.udirLink, udirLogo = _a.udirLogo;
3399
- var classes = useFooterStyles().classes;
3400
- var renderItem = function (item) {
3401
- return item.onClickItem ? (React__default.createElement(Button, { className: classes.itemBtn.concat(' ' + classes.itemText), onClick: item.onClickItem }, item.label)) : (React__default.createElement(ListItemText, { className: classes.itemText, primary: item.label, primaryTypographyProps: {
3402
- style: { fontSize: 14, fontFamily: 'Montserrat', fontWeight: 400 },
3403
- } }));
3404
- };
3250
+ const Footer = ({ items, serviceNameText, udirLink, udirLogo, }) => {
3251
+ const { classes } = useFooterStyles();
3252
+ const renderItem = (item) => item.onClickItem ? (React__default.createElement(Button, { className: classes.itemBtn.concat(' ' + classes.itemText), onClick: item.onClickItem }, item.label)) : (React__default.createElement(ListItemText, { className: classes.itemText, primary: item.label, primaryTypographyProps: {
3253
+ style: { fontSize: 14, fontFamily: 'Montserrat', fontWeight: 400 },
3254
+ } }));
3405
3255
  return (React__default.createElement(Box, { className: classes.footer, role: "contentinfo" },
3406
3256
  React__default.createElement(Box, { className: classes.content },
3407
3257
  React__default.createElement("a", { href: udirLink },
@@ -3412,29 +3262,29 @@ var Footer = function (_a) {
3412
3262
  paddingRight: '16px !important',
3413
3263
  } },
3414
3264
  React__default.createElement("span", { className: classes.serviceNameText }, serviceNameText),
3415
- React__default.createElement(List, { className: classes.list }, items.map(function (item, i) { return (React__default.createElement(ListItem, { key: i, classes: {
3265
+ React__default.createElement(List, { className: classes.list }, items.map((item, i) => (React__default.createElement(ListItem, { key: i, classes: {
3416
3266
  root: classes.item,
3417
3267
  //button: onClickItem ? classes.itemBtn : undefined,
3418
3268
  } }, item.render
3419
- ? item.render(function () { return renderItem(item); })
3420
- : renderItem(item))); }))))));
3269
+ ? item.render(() => renderItem(item))
3270
+ : renderItem(item)))))))));
3421
3271
  };
3422
3272
 
3423
- var LinkList = function (props) { return (React.createElement(Box, { width: "100%", flexDirection: "column" },
3273
+ const LinkList = (props) => (React.createElement(Box, { width: "100%", flexDirection: "column" },
3424
3274
  React.createElement(Typography, { style: { fontSize: 24, color: Colors.black, marginBottom: 20 } }, props.title),
3425
- React.createElement(List, null, props.pages.map(function (page) { return (React.createElement(Box, { key: page.id },
3426
- React.createElement(ListItem, { button: true, onClick: function () { return props.onPageClick(page); }, style: { padding: '12px 4px' } },
3275
+ React.createElement(List, null, props.pages.map((page) => (React.createElement(Box, { key: page.id },
3276
+ React.createElement(ListItem, { button: true, onClick: () => props.onPageClick(page), style: { padding: '12px 4px' } },
3427
3277
  React.createElement(ListItemText, { primary: page.label, primaryTypographyProps: {
3428
3278
  color: 'primary',
3429
3279
  style: { fontSize: 18 },
3430
3280
  } }),
3431
3281
  React.createElement(ListItemIcon, { style: { justifyContent: 'flex-end' } },
3432
3282
  React.createElement(ArrowForward, { color: "primary" }))),
3433
- React.createElement(Divider, null))); })))); };
3283
+ React.createElement(Divider, null)))))));
3434
3284
 
3435
- var useStyles$e = makeStyles()({
3285
+ const useStyles$e = makeStyles()({
3436
3286
  container: {
3437
- border: "1px solid ".concat(Colors.lightGrey),
3287
+ border: `1px solid ${Colors.lightGrey}`,
3438
3288
  height: 'fit-content',
3439
3289
  width: 'fit-content',
3440
3290
  },
@@ -3446,32 +3296,30 @@ var useStyles$e = makeStyles()({
3446
3296
  },
3447
3297
  });
3448
3298
 
3449
- var ContainedLinkList = function (props) {
3450
- var classes = useStyles$e().classes;
3299
+ const ContainedLinkList = (props) => {
3300
+ const { classes } = useStyles$e();
3451
3301
  return (React.createElement(Box, { className: classes.container, style: props.style },
3452
3302
  React.createElement(Typography, { className: classes.title }, props.title),
3453
- React.createElement(List, { style: { padding: 0 } }, props.pages.map(function (page) { return (React.createElement(ListItem, { divider: true, key: page.id, disablePadding: true },
3454
- React.createElement(ListItemButton, { onClick: function () { return props.onPageClick(page); } },
3303
+ React.createElement(List, { style: { padding: 0 } }, props.pages.map((page) => (React.createElement(ListItem, { divider: true, key: page.id, disablePadding: true },
3304
+ React.createElement(ListItemButton, { onClick: () => props.onPageClick(page) },
3455
3305
  page.linkIcon && React.createElement(ListItemIcon$1, null, page.linkIcon),
3456
- React.createElement(ListItemText, { primary: page.label })))); }))));
3306
+ React.createElement(ListItemText, { primary: page.label }))))))));
3457
3307
  };
3458
3308
 
3459
- var OverflowTooltip = /** @class */ (function (_super) {
3460
- __extends(OverflowTooltip, _super);
3461
- function OverflowTooltip(props) {
3462
- var _this = _super.call(this, props) || this;
3463
- _this.nodeRef = React.createRef();
3464
- _this.state = { overflow: false };
3465
- return _this;
3309
+ class OverflowTooltip extends React.Component {
3310
+ constructor(props) {
3311
+ super(props);
3312
+ this.nodeRef = React.createRef();
3313
+ this.state = { overflow: false };
3466
3314
  }
3467
- OverflowTooltip.prototype.componentDidMount = function () {
3468
- var element = this.nodeRef.current;
3315
+ componentDidMount() {
3316
+ const element = this.nodeRef.current;
3469
3317
  if (element) {
3470
- var overflow = element.clientWidth < element.scrollWidth;
3471
- this.setState({ overflow: overflow });
3318
+ const overflow = element.clientWidth < element.scrollWidth;
3319
+ this.setState({ overflow });
3472
3320
  }
3473
- };
3474
- OverflowTooltip.prototype.render = function () {
3321
+ }
3322
+ render() {
3475
3323
  if (this.state.overflow || this.props.force) {
3476
3324
  return (React.createElement(Tooltip, { placement: "left", title: this.props.title || '' },
3477
3325
  React.createElement("div", { style: { display: 'unset' }, ref: this.nodeRef }, this.props.children)));
@@ -3479,56 +3327,50 @@ var OverflowTooltip = /** @class */ (function (_super) {
3479
3327
  else {
3480
3328
  return React.createElement("div", { ref: this.nodeRef }, this.props.children);
3481
3329
  }
3482
- };
3483
- return OverflowTooltip;
3484
- }(React.Component));
3330
+ }
3331
+ }
3485
3332
 
3486
- var CellValue = styled('span')({
3333
+ const CellValue = styled('span')({
3487
3334
  overflow: 'hidden',
3488
3335
  textOverflow: 'ellipsis',
3489
3336
  display: '-webkit-box',
3490
3337
  WebkitBoxOrient: 'vertical',
3491
3338
  });
3492
- var GrepTableRow$1 = function (_a) {
3493
- var row = _a.row, column = _a.column, expanded = _a.expanded, props = __rest$1(_a, ["row", "column", "expanded"]);
3494
- var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, lang = column.lang, _b = column.lines, lines = _b === void 0 ? function () { return (expanded ? undefined : 1); } : _b;
3495
- var padding = column.padding;
3496
- var value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) }, lang: typeof lang === 'string' ? lang : lang ? lang(row) : '' }, getCell(row)));
3339
+ const GrepTableRow$1 = ({ row, column, expanded, ...props }) => {
3340
+ const { forceTooltip, getTooltip, getCell, lang, lines = () => (expanded ? undefined : 1), } = column;
3341
+ const { padding } = column;
3342
+ const value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) }, lang: typeof lang === 'string' ? lang : lang ? lang(row) : '' }, getCell(row)));
3497
3343
  if (forceTooltip || getTooltip) {
3498
- return (React__default.createElement(TableCell, __assign({ padding: padding }, props),
3344
+ return (React__default.createElement(TableCell, { padding: padding, ...props },
3499
3345
  React__default.createElement(OverflowTooltip, { force: forceTooltip, title: getTooltip ? getTooltip(row) : value }, value)));
3500
3346
  }
3501
- return (React__default.createElement(TableCell, __assign({ padding: padding }, props), value));
3347
+ return (React__default.createElement(TableCell, { padding: padding, ...props }, value));
3502
3348
  };
3503
3349
 
3504
- var GrepTableRow = function (_a) {
3505
- var row = _a.row, columns = _a.columns, selected = _a.selected, expanded = _a.expanded, variant = _a.variant; _a.clickable; _a.height; var underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["row", "columns", "selected", "expanded", "variant", "clickable", "height", "underlineOnFocus"]);
3506
- var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index, expanded: expanded }, { column: column, row: row, variant: variant, selected: selected }))); };
3507
- return (React__default.createElement(TableRow, __assign({ sx: {
3350
+ const GrepTableRow = ({ row, columns, selected, expanded, variant, clickable: _clickable, height: _height, underlineOnFocus, ...props }) => {
3351
+ const render = (column, index) => (React__default.createElement(GrepTableRow$1, { key: index, expanded: expanded, ...{ column, row, variant, selected } }));
3352
+ return (React__default.createElement(TableRow, { sx: {
3508
3353
  ':focus': { textDecoration: underlineOnFocus ? 'underline' : 'none' },
3509
- }, tabIndex: props.tabIndex }, __assign({ selected: selected }, props)), columns.map(render)));
3354
+ }, tabIndex: props.tabIndex, ...{ selected, ...props } }, columns.map(render)));
3510
3355
  };
3511
3356
 
3512
- var usePaginationActionStyles = makeStyles()(function (_a) {
3513
- var palette = _a.palette;
3514
- return ({
3515
- button: {
3516
- minWidth: '18px',
3517
- minHeight: '20px',
3518
- padding: '0 6px',
3519
- margin: '0 8px',
3520
- borderRadius: '2px',
3521
- fontSize: 12,
3522
- backgroundColor: palette.primary.main,
3523
- },
3524
- textButton: {
3525
- textTransform: 'capitalize',
3526
- fontWeight: 'initial',
3527
- fontSize: 12,
3528
- },
3529
- });
3530
- });
3531
- var usePaginationStyles = makeStyles()({
3357
+ const usePaginationActionStyles = makeStyles()(({ palette }) => ({
3358
+ button: {
3359
+ minWidth: '18px',
3360
+ minHeight: '20px',
3361
+ padding: '0 6px',
3362
+ margin: '0 8px',
3363
+ borderRadius: '2px',
3364
+ fontSize: 12,
3365
+ backgroundColor: palette.primary.main,
3366
+ },
3367
+ textButton: {
3368
+ textTransform: 'capitalize',
3369
+ fontWeight: 'initial',
3370
+ fontSize: 12,
3371
+ },
3372
+ }));
3373
+ const usePaginationStyles = makeStyles()({
3532
3374
  toolbar: {
3533
3375
  padding: 0,
3534
3376
  width: '100%',
@@ -3547,42 +3389,39 @@ var usePaginationStyles = makeStyles()({
3547
3389
  display: 'none',
3548
3390
  },
3549
3391
  });
3550
- var useTableHeaderStyles = makeStyles()(function (_theme, _a) {
3551
- var column = _a.column;
3552
- var width = column.width
3392
+ const useTableHeaderStyles = makeStyles()((_theme, { column }) => {
3393
+ const width = column.width
3553
3394
  ? typeof column.width === 'number'
3554
- ? "".concat(column.width, "%")
3395
+ ? `${column.width}%`
3555
3396
  : column.width
3556
3397
  : undefined;
3557
3398
  return {
3558
3399
  th: {
3559
- width: width,
3400
+ width,
3560
3401
  fontSize: 14,
3561
3402
  },
3562
3403
  };
3563
3404
  });
3564
3405
 
3565
- var TableHeaderCell = function (_a) {
3566
- var column = _a.column, onSortBy = _a.onSortBy, direction = _a.direction, active = _a.active, children = _a.children, _b = _a.empty, empty = _b === void 0 ? false : _b, props = __rest$1(_a, ["column", "onSortBy", "direction", "active", "children", "empty"]);
3567
- var classes = useTableHeaderStyles({ column: column }).classes;
3568
- var sortable = !!(onSortBy && column.sortable);
3406
+ const TableHeaderCell = ({ column, onSortBy, direction, active, children, empty = false, ...props }) => {
3407
+ const { classes } = useTableHeaderStyles({ column });
3408
+ const sortable = !!(onSortBy && column.sortable);
3569
3409
  if (sortable && !empty) {
3570
- return (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props),
3410
+ return (React__default.createElement(TableCell, { variant: empty ? 'body' : 'head', className: classes.th, ...props },
3571
3411
  React__default.createElement(TableSortLabel, { active: active, direction: direction }, children)));
3572
3412
  }
3573
- return empty ? (React__default.createElement("td", { className: classes.th }, children)) : (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props), children));
3413
+ return empty ? (React__default.createElement("td", { className: classes.th }, children)) : (React__default.createElement(TableCell, { variant: empty ? 'body' : 'head', className: classes.th, ...props }, children));
3574
3414
  };
3575
3415
 
3576
- var TableHeader = function (_a) {
3577
- var columns = _a.columns, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, dropdownItems = _a.dropdownItems, props = __rest$1(_a, ["columns", "sortBy", "sortDirection", "onSortBy", "dropdownItems"]);
3578
- var headerColumns = dropdownItems
3579
- ? columns.concat([{ label: '', width: '48px', getCell: function () { return ''; } }])
3416
+ const TableHeader = ({ columns, sortBy, sortDirection, onSortBy, dropdownItems, ...props }) => {
3417
+ const headerColumns = dropdownItems
3418
+ ? columns.concat([{ label: '', width: '48px', getCell: () => '' }])
3580
3419
  : columns;
3581
- return (React__default.createElement(TableHead, __assign({}, props),
3582
- React__default.createElement(TableRow, null, headerColumns.map(function (column, index) {
3583
- var sortable = !!(onSortBy && column.sortable);
3584
- var label = column.label, colDef = column.colDef;
3585
- return (React__default.createElement(TableHeaderCell, { key: index, empty: !label, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: function () { return sortable && onSortBy(column); }, onKeyDown: onActivation(function (e) {
3420
+ return (React__default.createElement(TableHead, { ...props },
3421
+ React__default.createElement(TableRow, null, headerColumns.map((column, index) => {
3422
+ const sortable = !!(onSortBy && column.sortable);
3423
+ const { label, colDef } = column;
3424
+ return (React__default.createElement(TableHeaderCell, { key: index, empty: label === undefined, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: () => sortable && onSortBy(column), onKeyDown: onActivation((e) => {
3586
3425
  if (sortable) {
3587
3426
  e.preventDefault();
3588
3427
  onSortBy(column);
@@ -3591,23 +3430,19 @@ var TableHeader = function (_a) {
3591
3430
  }))));
3592
3431
  };
3593
3432
 
3594
- var PaginationActions = function (_a) {
3595
- var count = _a.count, page = _a.page, rowsPerPage = _a.rowsPerPage, onPageChange = _a.onPageChange;
3596
- var classes = usePaginationActionStyles().classes;
3597
- var getPageNumbers = function (count, currentPage, rowsPerPage) {
3598
- var pageNumbers = [];
3599
- var pageCount = Math.ceil(count / rowsPerPage);
3600
- var _loop_1 = function (i) {
3433
+ const PaginationActions = ({ count, page, rowsPerPage, onPageChange }) => {
3434
+ const { classes } = usePaginationActionStyles();
3435
+ const getPageNumbers = (count, currentPage, rowsPerPage) => {
3436
+ const pageNumbers = [];
3437
+ const pageCount = Math.ceil(count / rowsPerPage);
3438
+ for (let i = 0; i < pageCount; i++) {
3601
3439
  pageNumbers.push(React.createElement(Button, { key: i, className: classes.button, style: currentPage === i
3602
3440
  ? {
3603
3441
  color: 'white',
3604
3442
  }
3605
3443
  : {
3606
3444
  backgroundColor: Colors.white,
3607
- }, onClick: function (e) { return onPageChange(e, i); }, disabled: currentPage === i }, i + 1));
3608
- };
3609
- for (var i = 0; i < pageCount; i++) {
3610
- _loop_1(i);
3445
+ }, onClick: (e) => onPageChange(e, i), disabled: currentPage === i }, i + 1));
3611
3446
  }
3612
3447
  if (currentPage >= 2 && currentPage < pageCount - 2) {
3613
3448
  return pageNumbers.slice(currentPage - 2, currentPage + 3);
@@ -3617,14 +3452,14 @@ var PaginationActions = function (_a) {
3617
3452
  : pageNumbers.slice(pageCount - 5, pageCount);
3618
3453
  };
3619
3454
  return (React.createElement("div", { style: { gridArea: 'right', justifySelf: 'end' } },
3620
- React.createElement(Button, { className: classes.textButton, onClick: function (e) { return onPageChange(e, page - 1); }, disabled: page === 0, "aria-label": "Previous Page" }, "Forrige"),
3455
+ React.createElement(Button, { className: classes.textButton, onClick: (e) => onPageChange(e, page - 1), disabled: page === 0, "aria-label": "Previous Page" }, "Forrige"),
3621
3456
  getPageNumbers(count, page, rowsPerPage),
3622
- React.createElement(Button, { className: classes.textButton, onClick: function (e) { return onPageChange(e, page + 1); }, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "Next Page" }, "Neste")));
3457
+ React.createElement(Button, { className: classes.textButton, onClick: (e) => onPageChange(e, page + 1), disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "Next Page" }, "Neste")));
3623
3458
  };
3624
3459
 
3625
- var GrepTablePagination = function (props) {
3626
- var classes = usePaginationStyles().classes;
3627
- return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions, SelectProps: {
3460
+ const GrepTablePagination = (props) => {
3461
+ const { classes } = usePaginationStyles();
3462
+ return (React__default.createElement(TablePagination, { classes: classes, rowsPerPageOptions: props.rowsPerPageOptions, SelectProps: {
3628
3463
  inputProps: {
3629
3464
  title: 'Velg antall elementer',
3630
3465
  },
@@ -3632,40 +3467,31 @@ var GrepTablePagination = function (props) {
3632
3467
  gridArea: 'left',
3633
3468
  justifySelf: 'start',
3634
3469
  },
3635
- }, ActionsComponent: function (actions) { return (React__default.createElement(PaginationActions, __assign({}, actions))); } }, props)));
3470
+ }, ActionsComponent: (actions) => (React__default.createElement(PaginationActions, { ...actions })), ...props }));
3636
3471
  };
3637
3472
 
3638
- var GrepTablePlaceholder = function (_a) {
3639
- var columns = _a.columns, padding = _a.padding, _b = _a.text, text = _b === void 0 ? 'Tabellen er tom.' : _b;
3473
+ const GrepTablePlaceholder = ({ columns, padding, text = 'Tabellen er tom.', }) => {
3640
3474
  return (React__default.createElement(TableRow, null,
3641
3475
  React__default.createElement(TableCell, { padding: padding, colSpan: columns.length }, text)));
3642
3476
  };
3643
3477
 
3644
- var useStyles$d = makeStyles()(function (theme, _a) {
3645
- var showHeader = _a.showHeader, outlined = _a.outlined;
3646
- return ({
3647
- table: {
3648
- border: outlined ? "1px solid ".concat(theme.palette.divider) : 'none',
3649
- borderCollapse: outlined ? 'separate' : 'collapse',
3650
- tableLayout: 'auto',
3651
- },
3652
- header: {
3653
- visibility: showHeader ? 'visible' : 'collapse',
3654
- },
3655
- body: {
3656
- '&:focus': {
3657
- outline: 'none',
3658
- },
3478
+ const useStyles$d = makeStyles()((theme, { showHeader, outlined }) => ({
3479
+ table: {
3480
+ border: outlined ? `1px solid ${theme.palette.divider}` : 'none',
3481
+ borderCollapse: outlined ? 'separate' : 'collapse',
3482
+ tableLayout: 'auto',
3483
+ },
3484
+ header: {
3485
+ visibility: showHeader ? 'visible' : 'collapse',
3486
+ },
3487
+ body: {
3488
+ '&:focus': {
3489
+ outline: 'none',
3659
3490
  },
3660
- });
3661
- });
3662
- var containsFocus = function (el, tag) {
3663
- if (tag === void 0) { tag = '*'; }
3664
- return Array.from(el.getElementsByTagName(tag)).some(function (el) { return el === document.activeElement; });
3665
- };
3666
- var getElementIndex = function (el) {
3667
- return Number(el.getAttribute('data-index') || -1);
3668
- };
3491
+ },
3492
+ }));
3493
+ const containsFocus = (el, tag = '*') => Array.from(el.getElementsByTagName(tag)).some((el) => el === document.activeElement);
3494
+ const getElementIndex = (el) => Number(el.getAttribute('data-index') || -1);
3669
3495
  /**
3670
3496
  * Since Grep-Table is so tightly intregrated into LPU and Admin some core logic could not be fixed
3671
3497
  * Still works but still messy
@@ -3673,16 +3499,15 @@ var getElementIndex = function (el) {
3673
3499
  * @todo enhance page handling
3674
3500
  *
3675
3501
  */
3676
- var GrepTable = function (_a) {
3677
- var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, menuButtonLabel = _a.menuButtonLabel, underlineOnFocus = _a.underlineOnFocus, rowTabIndex = _a.rowTabIndex, rowStyle = _a.rowStyle, _c = _a.rowsPerPageOptions, rowsPerPageOptions = _c === void 0 ? [5, 10, 25, 50] : _c, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "menuButtonLabel", "underlineOnFocus", "rowTabIndex", "rowStyle", "rowsPerPageOptions"]);
3678
- var _d = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _d[0], setRowsPerPage = _d[1];
3679
- var _e = __read(React__default.useState(null), 2), menuAnchor = _e[0], setMenuAnchor = _e[1];
3680
- var _f = __read(React__default.useState(0), 2), currentPage = _f[0], _setCurrentPage = _f[1];
3681
- var _g = __read(React__default.useState(), 2), selectedRowIndex = _g[0], _setSelectedRowIndex = _g[1];
3682
- var _h = __read(React__default.useState(), 2), expandedRowIndex = _h[0], _setExpandedRowIndex = _h[1];
3683
- var _j = __read(React__default.useState(), 2), dropdownContext = _j[0], setDropdownContext = _j[1];
3684
- var selectedRow = data[selectedRowIndex] || null;
3685
- var setCurrentPage = useCallback$1(function (index, rowIndex, shouldExpand) {
3502
+ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick = false, menuButtonLabel, underlineOnFocus, rowTabIndex, rowStyle, rowsPerPageOptions = [5, 10, 25, 50], ...props }) => {
3503
+ const [rowsPerPage, setRowsPerPage] = React__default.useState(props.rowsPerPage || 10);
3504
+ const [menuAnchor, setMenuAnchor] = React__default.useState(null);
3505
+ const [currentPage, _setCurrentPage] = React__default.useState(0);
3506
+ const [selectedRowIndex, _setSelectedRowIndex] = React__default.useState();
3507
+ const [expandedRowIndex, _setExpandedRowIndex] = React__default.useState();
3508
+ const [dropdownContext, setDropdownContext] = React__default.useState();
3509
+ const selectedRow = data[selectedRowIndex] || null;
3510
+ const setCurrentPage = useCallback$1((index, rowIndex, shouldExpand) => {
3686
3511
  index = pagination && index >= 0 ? index : 0;
3687
3512
  _setCurrentPage(index);
3688
3513
  _setSelectedRowIndex(rowIndex);
@@ -3696,24 +3521,21 @@ var GrepTable = function (_a) {
3696
3521
  rowsPerPage,
3697
3522
  pagination,
3698
3523
  ]);
3699
- var setSelectedRowIndex = function (index, shouldExpand) {
3700
- if (shouldExpand === void 0) { shouldExpand = true; }
3701
- var hasIndexChanged = index === selectedRowIndex;
3702
- var pageIndex = Math.floor(index / rowsPerPage);
3524
+ const setSelectedRowIndex = (index, shouldExpand = true) => {
3525
+ const hasIndexChanged = index === selectedRowIndex;
3526
+ const pageIndex = Math.floor(index / rowsPerPage);
3703
3527
  setCurrentPage(pageIndex, index, shouldExpand);
3704
3528
  if (hasIndexChanged && onSelectedRowChange) {
3705
3529
  onSelectedRowChange(data[index]);
3706
3530
  }
3707
3531
  };
3708
- var setSelectedElement = function (el, shouldExpand) {
3709
- if (shouldExpand === void 0) { shouldExpand = true; }
3532
+ const setSelectedElement = (el, shouldExpand = true) => {
3710
3533
  setSelectedRowIndex(getElementIndex(el), shouldExpand);
3711
3534
  };
3712
- var tableRef = React__default.useRef(null);
3535
+ const tableRef = React__default.useRef(null);
3713
3536
  // focus selected row first tabable item
3714
- React__default.useEffect(function () {
3715
- var _a;
3716
- var rowTab = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-index=\"".concat(selectedRowIndex, "\"]"));
3537
+ React__default.useEffect(() => {
3538
+ const rowTab = tableRef.current?.querySelector(`[data-index="${selectedRowIndex}"]`);
3717
3539
  if (!rowTab)
3718
3540
  return;
3719
3541
  if (!containsFocus(rowTab)) {
@@ -3722,70 +3544,76 @@ var GrepTable = function (_a) {
3722
3544
  }
3723
3545
  }
3724
3546
  }, [tableRef, selectedRowIndex]);
3725
- React__default.useMemo(function () {
3547
+ React__default.useMemo(() => {
3726
3548
  setCurrentPage(0);
3727
3549
  }, [data.length, setCurrentPage]);
3728
- var _openDropdown = function (e, row) {
3729
- var onContextIdChanged = props.onContextIdChanged;
3550
+ const _openDropdown = (e, row) => {
3551
+ const { onContextIdChanged } = props;
3730
3552
  if (onContextIdChanged) {
3731
3553
  onContextIdChanged(row);
3732
3554
  }
3733
3555
  setDropdownContext(row);
3734
3556
  setMenuAnchor(e.currentTarget);
3735
3557
  };
3736
- var _handleRowClick = useCallback$1(function (row) {
3737
- var disabled = isRowDisabled && isRowDisabled(row);
3558
+ const _handleRowClick = useCallback$1((row) => {
3559
+ const disabled = isRowDisabled && isRowDisabled(row);
3738
3560
  !disabled && onRowClick && onRowClick(row);
3739
3561
  }, [onRowClick]);
3740
- var _handlePageChange = function (event, newPage) {
3562
+ const _handlePageChange = (event, newPage) => {
3741
3563
  event && event.preventDefault();
3742
3564
  setCurrentPage(newPage);
3743
3565
  };
3744
- var _handleChangeRowsPerPage = function (event) {
3566
+ const _handleChangeRowsPerPage = (event) => {
3745
3567
  setRowsPerPage(Number(event.target.value));
3746
3568
  };
3747
- var _handleMenuClose = function () {
3569
+ const _handleMenuClose = () => {
3748
3570
  setMenuAnchor(null);
3749
3571
  };
3750
- var _renderCellButton = function (row) {
3751
- var menuDisabled = props.menuDisabled, menuTooltip = props.menuTooltip;
3752
- var disabled = menuDisabled && menuDisabled(row);
3753
- var tooltip = menuTooltip ? menuTooltip(row) : '';
3572
+ const _renderCellButton = (row) => {
3573
+ const { menuDisabled, menuTooltip } = props;
3574
+ const disabled = menuDisabled && menuDisabled(row);
3575
+ const tooltip = menuTooltip ? menuTooltip(row) : '';
3754
3576
  return (React__default.createElement(Tooltip, { title: tooltip, placement: "bottom" },
3755
3577
  React__default.createElement("div", { style: { display: 'flex', justifyContent: 'end' } },
3756
- React__default.createElement(IconButton, { disableTouchRipple: true, disabled: disabled, style: { float: 'right' }, onMouseDown: function (e) {
3578
+ React__default.createElement(IconButton, { disableTouchRipple: true, disabled: disabled, style: { float: 'right' }, onMouseDown: (e) => {
3757
3579
  e.preventDefault();
3758
3580
  e.stopPropagation();
3759
- }, onClick: function (e) {
3581
+ }, onClick: (e) => {
3760
3582
  _openDropdown(e, row);
3761
- }, onKeyDown: function (e) {
3583
+ }, onKeyDown: (e) => {
3762
3584
  switch (e.which) {
3763
3585
  case Key_enum.Key.Enter:
3764
3586
  // dont show dropdown
3765
3587
  e.preventDefault();
3766
3588
  break;
3767
3589
  }
3768
- }, tabIndex: 0, size: "large", "aria-label": menuButtonLabel !== null && menuButtonLabel !== void 0 ? menuButtonLabel : 'Åpne meny' },
3590
+ }, tabIndex: 0, size: "large", "aria-label": menuButtonLabel ?? 'Åpne meny' },
3769
3591
  React__default.createElement(MoreVert, null)))));
3770
3592
  };
3771
- var getRowStyle = function (row, index, clickableRows, disabled) {
3772
- var style = { cursor: clickableRows && !disabled ? 'pointer' : '' };
3593
+ const getRowStyle = (row, index, clickableRows, disabled) => {
3594
+ let style = { cursor: clickableRows && !disabled ? 'pointer' : '' };
3773
3595
  if (typeof rowStyle === "function") {
3774
- style = __assign(__assign({}, style), rowStyle(row, index));
3596
+ style = {
3597
+ ...style,
3598
+ ...rowStyle(row, index)
3599
+ };
3775
3600
  }
3776
3601
  else if (rowStyle) {
3777
- style = __assign(__assign({}, style), rowStyle);
3602
+ style = {
3603
+ ...style,
3604
+ ...rowStyle
3605
+ };
3778
3606
  }
3779
3607
  return style;
3780
3608
  };
3781
- var _renderRow = function (row, index) {
3782
- var rowColumns = dropdownItems
3609
+ const _renderRow = (row, index) => {
3610
+ const rowColumns = dropdownItems
3783
3611
  ? columns.concat([{ getCell: _renderCellButton, padding: 'none' }])
3784
3612
  : columns;
3785
- var clickableRows = !!onRowClick;
3786
- var disabled = isRowDisabled && isRowDisabled(row);
3787
- var rowIndex = index + currentPage * rowsPerPage;
3788
- return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex !== null && rowTabIndex !== void 0 ? rowTabIndex : 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, expanded: rowIndex === expandedRowIndex, clickable: clickableRows, onMouseDown: function (e) {
3613
+ const clickableRows = !!onRowClick;
3614
+ const disabled = isRowDisabled && isRowDisabled(row);
3615
+ const rowIndex = index + currentPage * rowsPerPage;
3616
+ return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex ?? 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, expanded: rowIndex === expandedRowIndex, clickable: clickableRows, onMouseDown: (e) => {
3789
3617
  if (e.target.type === 'checkbox') {
3790
3618
  e.preventDefault();
3791
3619
  e.stopPropagation();
@@ -3797,16 +3625,16 @@ var GrepTable = function (_a) {
3797
3625
  _handleRowClick(row);
3798
3626
  }
3799
3627
  }
3800
- }, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: function (e) {
3628
+ }, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: (e) => {
3801
3629
  if (selectedRowIndex !== rowIndex) {
3802
3630
  setSelectedElement(e.currentTarget);
3803
3631
  }
3804
3632
  }, underlineOnFocus: underlineOnFocus }));
3805
3633
  };
3806
- var onKey = function (e) {
3807
- var maxIndex = data.length - 1;
3808
- var moveSelectedRow = function (steps) {
3809
- var i = (selectedRowIndex || 0) + steps;
3634
+ const onKey = (e) => {
3635
+ const maxIndex = data.length - 1;
3636
+ const moveSelectedRow = (steps) => {
3637
+ const i = (selectedRowIndex || 0) + steps;
3810
3638
  if (i >= 0 && i <= maxIndex) {
3811
3639
  setSelectedRowIndex(i);
3812
3640
  }
@@ -3833,7 +3661,7 @@ var GrepTable = function (_a) {
3833
3661
  setSelectedRowIndex(maxIndex);
3834
3662
  break;
3835
3663
  case Key_enum.Key.Tab:
3836
- requestAnimationFrame(function () {
3664
+ requestAnimationFrame(() => {
3837
3665
  // check is any children still has focus
3838
3666
  !containsFocus(tableRef.current) && setSelectedRowIndex(-1);
3839
3667
  });
@@ -3843,57 +3671,53 @@ var GrepTable = function (_a) {
3843
3671
  break;
3844
3672
  }
3845
3673
  };
3846
- var rows = pagination
3674
+ const rows = pagination
3847
3675
  ? data.slice(currentPage * rowsPerPage, currentPage * rowsPerPage + rowsPerPage)
3848
3676
  : data;
3849
- var classes = useStyles$d({ outlined: outlined, showHeader: header }).classes;
3677
+ const { classes } = useStyles$d({ outlined, showHeader: header });
3850
3678
  return (React__default.createElement(TableContainer, { sx: props.style },
3851
3679
  React__default.createElement(Table, { className: classes.table, size: size, stickyHeader: stickyHeader, padding: padding },
3852
3680
  caption && React__default.createElement("caption", null, caption),
3853
3681
  React__default.createElement(TableHeader, { className: classes.header, columns: columns, sortBy: sortBy, sortDirection: sortDirection, onSortBy: onSortBy, dropdownItems: dropdownItems }),
3854
3682
  React__default.createElement(TableBody, { ref: tableRef, className: classes.body, onKeyDown: onKey }, data.length ? (rows.map(_renderRow)) : (React__default.createElement(GrepTablePlaceholder, { padding: padding, columns: columns, text: placeholderText }))),
3855
3683
  React__default.createElement(TableFooter, null, pagination && (React__default.createElement(TableRow, null,
3856
- React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, rowsPerPageOptions: rowsPerPageOptions, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: function (_a) {
3857
- var from = _a.from, to = _a.to, count = _a.count;
3858
- return "Viser ".concat(from, "-").concat(to, " av ").concat(count);
3859
- } }))))),
3684
+ React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, rowsPerPageOptions: rowsPerPageOptions, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: ({ from, to, count }) => `Viser ${from}-${to} av ${count}` }))))),
3860
3685
  dropdownItems && dropdownContext && (React__default.createElement(DropdownMenu, { open: !!menuAnchor, context: dropdownContext, anchorEl: menuAnchor, menuItems: dropdownItems, onClose: _handleMenuClose }))));
3861
3686
  };
3862
3687
 
3863
- var useStyles$c = makeStyles()({
3688
+ const useStyles$c = makeStyles()({
3864
3689
  container: {
3865
- border: "1px solid ".concat(Colors.lightGrey),
3690
+ border: `1px solid ${Colors.lightGrey}`,
3866
3691
  height: 'fit-content',
3867
3692
  flex: 'auto',
3868
3693
  },
3869
3694
  title: { fontSize: 24, padding: 20, color: Colors.black },
3870
3695
  });
3871
3696
 
3872
- var GrepTableCard = function (props) {
3873
- var classes = useStyles$c().classes;
3697
+ const GrepTableCard = (props) => {
3698
+ const { classes } = useStyles$c();
3874
3699
  return (React.createElement(Box, { className: classes.container, style: props.style },
3875
3700
  React.createElement(Typography, { className: classes.title }, props.title),
3876
- React.createElement(GrepTable, __assign({}, props, { header: true }))));
3701
+ React.createElement(GrepTable, { ...props, header: true })));
3877
3702
  };
3878
3703
 
3879
- var LoadingOverlay = function (_a) {
3880
- var _b = _a.overlay, overlay = _b === void 0 ? 'rgba(255,255,255, .5)' : _b, show = _a.show, children = _a.children, minTime = _a.minTime, zIndex = _a.zIndex, sx = _a.sx, box = __rest$1(_a, ["overlay", "show", "children", "minTime", "zIndex", "sx"]);
3881
- var _c = __read(useState(show), 2), enabled = _c[0], setEnabled = _c[1];
3882
- useEffect(function () {
3883
- var timeout = setTimeout(function () { return setEnabled(show); }, show ? 0 : minTime);
3884
- return function () { return clearTimeout(timeout); };
3704
+ const LoadingOverlay = ({ overlay = 'rgba(255,255,255, .5)', show, children, minTime, zIndex, sx, ...box }) => {
3705
+ const [enabled, setEnabled] = useState(show);
3706
+ useEffect(() => {
3707
+ const timeout = setTimeout(() => setEnabled(show), show ? 0 : minTime);
3708
+ return () => clearTimeout(timeout);
3885
3709
  }, [show, minTime, setEnabled]);
3886
3710
  return (React__default.createElement(Box, { position: "relative", display: "block", overflow: show ? 'hidden' : '' },
3887
3711
  children,
3888
- React__default.createElement(Box, __assign({ position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? (zIndex ? zIndex : 999) : -999, style: {
3712
+ React__default.createElement(Box, { position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? (zIndex ? zIndex : 999) : -999, style: {
3889
3713
  backgroundColor: overlay,
3890
3714
  opacity: show ? 1 : 0,
3891
- transition: "opacity ".concat(show ? 0 : minTime, "ms ease"),
3892
- }, sx: sx }, box),
3715
+ transition: `opacity ${show ? 0 : minTime}ms ease`,
3716
+ }, sx: sx, ...box },
3893
3717
  React__default.createElement(CircularProgress, { "aria-label": "Laster inn" }))));
3894
3718
  };
3895
3719
 
3896
- var useStyles$b = makeStyles()({
3720
+ const useStyles$b = makeStyles()({
3897
3721
  container: {
3898
3722
  display: 'flex',
3899
3723
  marginTop: 30,
@@ -3921,18 +3745,17 @@ var useStyles$b = makeStyles()({
3921
3745
  },
3922
3746
  });
3923
3747
 
3924
- var isOverflowing = function (e) { return e.offsetWidth < e.scrollWidth; };
3925
- var GrepCrumbs = function (_a) {
3926
- var style = _a.style, onClick = _a.onClick, breadcrumbs = _a.breadcrumbs;
3927
- var classes = useStyles$b().classes;
3928
- var dispatch = useDispatch();
3929
- var ref = React__default.useRef(null);
3930
- var _b = __read(React__default.useState(false), 2), showTooltip = _b[0], setShowTooltip = _b[1];
3931
- React__default.useEffect(function () {
3932
- var current = ref.current;
3748
+ const isOverflowing = (e) => e.offsetWidth < e.scrollWidth;
3749
+ const GrepCrumbs = ({ style, onClick, breadcrumbs, }) => {
3750
+ const { classes } = useStyles$b();
3751
+ const dispatch = useDispatch();
3752
+ const ref = React__default.useRef(null);
3753
+ const [showTooltip, setShowTooltip] = React__default.useState(false);
3754
+ React__default.useEffect(() => {
3755
+ const { current } = ref;
3933
3756
  setShowTooltip(!!current && isOverflowing(current));
3934
3757
  }, [ref]);
3935
- var handleClick = function (crumb) {
3758
+ const handleClick = (crumb) => {
3936
3759
  if (onClick) {
3937
3760
  onClick(crumb);
3938
3761
  }
@@ -3940,15 +3763,13 @@ var GrepCrumbs = function (_a) {
3940
3763
  crumb.path && dispatch(push(crumb.path));
3941
3764
  }
3942
3765
  };
3943
- return (React__default.createElement("div", { className: classes.container, style: style }, breadcrumbs.map(function (crumb, index) {
3944
- return crumb.path ? (React__default.createElement(Box, { key: index, display: "flex" },
3945
- React__default.createElement(Link, { className: classes.link, tabIndex: 0, component: "button", onClick: function () { return handleClick(crumb); } }, crumb.label),
3946
- index !== breadcrumbs.length - 1 && (React__default.createElement(Box, { margin: "auto 8px", height: "fit-content" /*lineHeight="20px"*/ }, ">")))) : (React__default.createElement(Tooltip, { key: index, title: showTooltip ? crumb.label : '' },
3947
- React__default.createElement("div", { className: classes.current, ref: ref }, crumb.label)));
3948
- })));
3766
+ return (React__default.createElement("div", { className: classes.container, style: style }, breadcrumbs.map((crumb, index) => crumb.path ? (React__default.createElement(Box, { key: index, display: "flex" },
3767
+ React__default.createElement(Link, { className: classes.link, tabIndex: 0, component: "button", onClick: () => handleClick(crumb) }, crumb.label),
3768
+ index !== breadcrumbs.length - 1 && (React__default.createElement(Box, { margin: "auto 8px", height: "fit-content" /*lineHeight="20px"*/ }, ">")))) : (React__default.createElement(Tooltip, { key: index, title: showTooltip ? crumb.label : '' },
3769
+ React__default.createElement("div", { className: classes.current, ref: ref }, crumb.label))))));
3949
3770
  };
3950
3771
 
3951
- var useStyles$a = makeStyles()({
3772
+ const useStyles$a = makeStyles()({
3952
3773
  outer: {
3953
3774
  alignItems: 'center',
3954
3775
  background: Colors.white,
@@ -3969,27 +3790,27 @@ var useStyles$a = makeStyles()({
3969
3790
  helptext: { margin: '0 10px 0 10px', color: '#6e6e6e', fontSize: 12 },
3970
3791
  });
3971
3792
 
3972
- var SearchBar = function (props) {
3973
- var inputRef = React.useRef(null);
3974
- var _a = __read(React.useState(props.initValue || ''), 2), value = _a[0], setValue = _a[1];
3975
- var classes = useStyles$a().classes;
3976
- React.useEffect(function () {
3793
+ const SearchBar = (props) => {
3794
+ const inputRef = React.useRef(null);
3795
+ const [value, setValue] = React.useState(props.initValue || '');
3796
+ const { classes } = useStyles$a();
3797
+ React.useEffect(() => {
3977
3798
  if (props.autoFocus && inputRef.current) {
3978
3799
  inputRef.current.focus();
3979
3800
  }
3980
3801
  });
3981
- var _handleChange = function (event) {
3982
- var newVal = event.target.value;
3802
+ const _handleChange = (event) => {
3803
+ const newVal = event.target.value;
3983
3804
  setValue(newVal);
3984
3805
  props.onInputChange(newVal);
3985
3806
  };
3986
- var _handleClear = function () {
3807
+ const _handleClear = () => {
3987
3808
  setValue('');
3988
3809
  props.onClear();
3989
3810
  };
3990
3811
  return (React.createElement(React.Fragment, null,
3991
3812
  React.createElement(Box, { className: classes.outer, "data-testid": "searchBarContainer", style: {
3992
- border: props.outlined ? "1px solid ".concat(Colors.lightGrey) : 0,
3813
+ border: props.outlined ? `1px solid ${Colors.lightGrey}` : 0,
3993
3814
  } },
3994
3815
  React.createElement(Box, { className: classes.icon },
3995
3816
  React.createElement(Search, null)),
@@ -4006,53 +3827,42 @@ var SearchBar = function (props) {
4006
3827
  props.searchAllText && props.onSearchAll && (React.createElement(Button, { color: "primary", onClick: props.onSearchAll }, props.searchAllText)))));
4007
3828
  };
4008
3829
 
4009
- var useStyles$9 = makeStyles()(function (theme, _a) {
4010
- var elevation = _a.elevation;
4011
- return ({
4012
- cover: {
4013
- background: theme.palette.grey.A200,
4014
- marginBottom: 12,
4015
- padding: '10px 0',
4016
- boxShadow: elevation
4017
- ? "0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%);"
4018
- : 'none',
4019
- },
4020
- });
4021
- });
3830
+ const useStyles$9 = makeStyles()((theme, { elevation }) => ({
3831
+ cover: {
3832
+ background: theme.palette.grey.A200,
3833
+ marginBottom: 12,
3834
+ padding: '10px 0',
3835
+ boxShadow: elevation
3836
+ ? `0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%);`
3837
+ : 'none',
3838
+ },
3839
+ }));
4022
3840
 
4023
- var GreyCover = function (_a) {
4024
- var elevation = _a.elevation, children = _a.children;
4025
- var classes = useStyles$9({ elevation: elevation }).classes;
3841
+ const GreyCover = ({ elevation, children }) => {
3842
+ const { classes } = useStyles$9({ elevation });
4026
3843
  return React.createElement(Box, { className: classes.cover }, children);
4027
3844
  };
4028
3845
 
4029
- var CircularLoading = function (_a) {
4030
- var height = _a.height, props = __rest$1(_a, ["height"]);
4031
- return (React.createElement(Box, { height: height, width: "100%", display: "flex", alignItems: "center", justifyContent: "center" },
4032
- React.createElement(CircularProgress$1, __assign({}, props))));
4033
- };
3846
+ const CircularLoading = ({ height, ...props }) => (React.createElement(Box, { height: height, width: "100%", display: "flex", alignItems: "center", justifyContent: "center" },
3847
+ React.createElement(CircularProgress$1, { ...props })));
4034
3848
 
4035
- var useStyles$8 = makeStyles()(function (theme) {
4036
- var _a;
4037
- return ({
4038
- container: (_a = {
4039
- width: '48%',
4040
- display: 'flex',
4041
- flexDirection: 'column'
4042
- },
4043
- _a[theme.breakpoints.down('lg')] = {
4044
- width: '100%',
4045
- },
4046
- _a[theme.breakpoints.up('md')] = {
4047
- width: '48%',
4048
- },
4049
- _a),
4050
- });
4051
- });
3849
+ const useStyles$8 = makeStyles()((theme) => ({
3850
+ container: {
3851
+ width: '48%',
3852
+ display: 'flex',
3853
+ flexDirection: 'column',
3854
+ [theme.breakpoints.down('lg')]: {
3855
+ width: '100%',
3856
+ },
3857
+ [theme.breakpoints.up('md')]: {
3858
+ width: '48%',
3859
+ },
3860
+ },
3861
+ }));
4052
3862
 
4053
- var renderField$1 = function (id, label, value) { return (React.createElement(TextField, { id: id, disabled: true, label: label, value: value, variant: "outlined", style: { margin: '10px 0' }, InputProps: { style: { color: 'rgb(84, 84, 84)' } } })); };
4054
- var ProfileInfo = function (props) {
4055
- var classes = useStyles$8().classes;
3863
+ const renderField$1 = (id, label, value) => (React.createElement(TextField, { id: id, disabled: true, label: label, value: value, variant: "outlined", style: { margin: '10px 0' }, InputProps: { style: { color: 'rgb(84, 84, 84)' } } }));
3864
+ const ProfileInfo = (props) => {
3865
+ const { classes } = useStyles$8();
4056
3866
  return (React.createElement(Box, { className: classes.container },
4057
3867
  renderField$1('firstname', 'Fornavn', props.firstName),
4058
3868
  renderField$1('lastname', 'Etternavn', props.lastName),
@@ -4061,48 +3871,43 @@ var ProfileInfo = function (props) {
4061
3871
  renderField$1('role', 'Rolle', props.role)));
4062
3872
  };
4063
3873
 
4064
- var useStyles$7 = makeStyles()(function (theme) {
4065
- var _a;
4066
- return ({
4067
- container: (_a = {
4068
- backgroundColor: 'rgb(241, 243, 244)',
4069
- height: 'fit-content',
4070
- display: 'flex',
4071
- maxWidth: 500
4072
- },
4073
- _a[theme.breakpoints.down('lg')] = {
4074
- maxWidth: 'unset',
4075
- width: '100%',
4076
- },
4077
- _a[theme.breakpoints.up('md')] = {
4078
- maxWidth: 500,
4079
- },
4080
- _a),
4081
- content: {
4082
- backgroundColor: 'unset',
4083
- marginRight: 20,
3874
+ const useStyles$7 = makeStyles()((theme) => ({
3875
+ container: {
3876
+ backgroundColor: 'rgb(241, 243, 244)',
3877
+ height: 'fit-content',
3878
+ display: 'flex',
3879
+ maxWidth: 500,
3880
+ [theme.breakpoints.down('lg')]: {
3881
+ maxWidth: 'unset',
3882
+ width: '100%',
4084
3883
  },
4085
- title: {
4086
- backgroundColor: 'unset',
4087
- fontSize: 16,
4088
- margin: '20px 0',
3884
+ [theme.breakpoints.up('md')]: {
3885
+ maxWidth: 500,
4089
3886
  },
4090
- body: {
4091
- backgroundColor: 'unset',
4092
- h4: {
4093
- marginRight: 20,
4094
- },
4095
- },
4096
- icon: {
4097
- margin: '20px 10px',
4098
- color: 'rgb(255, 158, 157)',
3887
+ },
3888
+ content: {
3889
+ backgroundColor: 'unset',
3890
+ marginRight: 20,
3891
+ },
3892
+ title: {
3893
+ backgroundColor: 'unset',
3894
+ fontSize: 16,
3895
+ margin: '20px 0',
3896
+ },
3897
+ body: {
3898
+ backgroundColor: 'unset',
3899
+ h4: {
3900
+ marginRight: 20,
4099
3901
  },
4100
- });
4101
- });
3902
+ },
3903
+ icon: {
3904
+ margin: '20px 10px',
3905
+ color: 'rgb(255, 158, 157)',
3906
+ },
3907
+ }));
4102
3908
 
4103
- var GDPR = function (_a) {
4104
- var children = _a.children;
4105
- var classes = useStyles$7().classes;
3909
+ const GDPR = ({ children }) => {
3910
+ const { classes } = useStyles$7();
4106
3911
  return (React.createElement(Box, { className: classes.container },
4107
3912
  React.createElement(Info, { className: classes.icon }),
4108
3913
  React.createElement(Box, { className: classes.content },
@@ -4110,67 +3915,66 @@ var GDPR = function (_a) {
4110
3915
  React.createElement(Typography, { className: classes.body }, children))));
4111
3916
  };
4112
3917
 
4113
- var GrepInput = function (_a) {
4114
- var _b = _a.variant, variant = _b === void 0 ? 'standard' : _b, props = __rest$1(_a, ["variant"]);
4115
- var errorMessage = props.errorMessage, helperText = props.helperText, shrink = props.shrink, value = props.value, rest = __rest$1(props, ["errorMessage", "helperText", "shrink", "value"]);
4116
- var error = errorMessage ? errorMessage.length > 0 : false;
4117
- return (React.createElement(TextField, __assign({}, rest, { variant: variant, helperText: errorMessage || helperText, value: value === null ? '' : value, InputLabelProps: { shrink: shrink }, error: error || rest.error })));
3918
+ const GrepInput = ({ variant = 'standard', ...props }) => {
3919
+ const { errorMessage, helperText, shrink, value, ...rest } = props;
3920
+ const error = errorMessage ? errorMessage.length > 0 : false;
3921
+ return (React.createElement(TextField, { ...rest, variant: variant, helperText: errorMessage || helperText, value: value === null ? '' : value, InputLabelProps: { shrink }, error: error || rest.error }));
4118
3922
  };
4119
3923
 
4120
- var GrepSelect = function (props) {
4121
- var inputLabel = React.useRef(null);
4122
- var _a = __read(React.useState(0), 2), labelWidth = _a[0], setLabelWidth = _a[1];
4123
- React.useEffect(function () {
3924
+ const GrepSelect = (props) => {
3925
+ const inputLabel = React.useRef(null);
3926
+ const [labelWidth, setLabelWidth] = React.useState(0);
3927
+ React.useEffect(() => {
4124
3928
  setLabelWidth(inputLabel.current.offsetWidth);
4125
3929
  }, []);
4126
- var _b = props.unselectOption, unselectOption = _b === void 0 ? true : _b, errorMessage = props.errorMessage, selectItems = props.selectItems, helperText = props.helperText, fullWidth = props.fullWidth, outlined = props.outlined, disabled = props.disabled, required = props.required, label = props.label, inputProps = props.inputProps, value = props.value, size = props.size, id = props.id, useCheckedSelect = props.useCheckedSelect, rest = __rest$1(props, ["unselectOption", "errorMessage", "selectItems", "helperText", "fullWidth", "outlined", "disabled", "required", "label", "inputProps", "value", "size", "id", "useCheckedSelect"]);
4127
- var error = errorMessage ? errorMessage.length > 0 : false;
4128
- var selected = value;
3930
+ const { unselectOption = true, errorMessage, selectItems, helperText, fullWidth, outlined, disabled, required, label, inputProps, value, size, id, useCheckedSelect, ...rest } = props;
3931
+ const error = errorMessage ? errorMessage.length > 0 : false;
3932
+ const selected = value;
4129
3933
  return (React.createElement(FormControl, { variant: outlined ? 'outlined' : 'standard', className: props.className, fullWidth: fullWidth, required: required, style: props.style, error: error, size: size, disabled: disabled },
4130
3934
  React.createElement(InputLabel, { htmlFor: id, ref: inputLabel, style: {
4131
3935
  minWidth: 'max-content',
4132
3936
  overflow: 'visible',
4133
3937
  } }, label),
4134
- React.createElement(Select, __assign({}, rest, { inputProps: __assign({ id: id }, inputProps), disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
3938
+ React.createElement(Select, { ...rest, inputProps: { id, ...inputProps }, disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
4135
3939
  // @todo: make input respect label length
4136
- input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: __assign(__assign({}, rest.MenuProps), { anchorOrigin: {
3940
+ input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: {
3941
+ ...rest.MenuProps,
3942
+ anchorOrigin: {
4137
3943
  vertical: 'bottom',
4138
3944
  horizontal: 'center',
4139
- }, transformOrigin: {
3945
+ },
3946
+ transformOrigin: {
4140
3947
  vertical: 'top',
4141
3948
  horizontal: 'center',
4142
- } }) }),
3949
+ },
3950
+ } },
4143
3951
  unselectOption && (React.createElement(MenuItem, { value: "" },
4144
3952
  React.createElement("em", null, "Fjern valgt"))),
4145
- selectItems.map(function (_a, i) {
4146
- var label = _a.label, value = _a.value, disabled = _a.disabled, lang = _a.lang;
4147
- return (React.createElement(MenuItem, { key: i, value: value, disabled: disabled, lang: lang },
4148
- useCheckedSelect && (React.createElement(Checkbox, { checked: (selected === null || selected === void 0 ? void 0 : selected.indexOf(value)) > -1 })),
4149
- React.createElement(ListItemText, { sx: { margin: '0px', span: { lineHeight: '1.4375em' } }, primary: label ? label : value })));
4150
- })),
3953
+ selectItems.map(({ label, value, disabled, lang }, i) => (React.createElement(MenuItem, { key: i, value: value, disabled: disabled, lang: lang },
3954
+ useCheckedSelect && (React.createElement(Checkbox, { checked: selected?.indexOf(value) > -1 })),
3955
+ React.createElement(ListItemText, { sx: { margin: '0px', span: { lineHeight: '1.4375em' } }, primary: label ? label : value }))))),
4151
3956
  React.createElement(FormHelperText, null, errorMessage || helperText)));
4152
3957
  };
4153
3958
 
4154
- var defaultOptions$2 = {
3959
+ const defaultOptions$2 = {
4155
3960
  utc: true,
4156
3961
  preserveTime: false,
4157
3962
  };
4158
- var useDate = function (value, options) {
4159
- if (value === void 0) { value = null; }
4160
- var _a = __assign(__assign({}, options), defaultOptions$2), utc = _a.utc, preserveTime = _a.preserveTime;
4161
- var _b = __read(useState(null), 2), date = _b[0], _setDate = _b[1];
4162
- var getDate = useCallback$1(function (value) {
3963
+ const useDate = (value = null, options) => {
3964
+ const { utc, preserveTime } = { ...options, ...defaultOptions$2 };
3965
+ const [date, _setDate] = useState(null);
3966
+ const getDate = useCallback$1((value) => {
4163
3967
  if (value) {
4164
- var date_1 = dayjs(value);
4165
- return preserveTime ? date_1 : date_1.startOf('day');
3968
+ const date = dayjs(value);
3969
+ return preserveTime ? date : date.startOf('day');
4166
3970
  }
4167
3971
  return null;
4168
3972
  }, [preserveTime]);
4169
- var setDate = function (next) {
4170
- var nextDate = getDate(next);
3973
+ const setDate = (next) => {
3974
+ const nextDate = getDate(next);
4171
3975
  hasDateChanged(date, nextDate) && _setDate(nextDate);
4172
3976
  };
4173
- useMemo$1(function () { return setDate(value ? parseDate(value, { utc: utc }) : null); }, [
3977
+ useMemo$1(() => setDate(value ? parseDate(value, { utc }) : null), [
4174
3978
  value,
4175
3979
  utc,
4176
3980
  ]);
@@ -4569,55 +4373,58 @@ var lodash_debounce = debounce$1;
4569
4373
  * return (<><input {...{ref,onChange}}/><p>{txt}</p></>)
4570
4374
  * }
4571
4375
  */
4572
- var useDebounce = function (func, opt, deps) {
4573
- var debounce = useMemo$1(function () {
4574
- var wait = opt.wait, settings = __rest$1(opt, ["wait"]);
4376
+ const useDebounce = (func, opt, deps) => {
4377
+ const debounce = useMemo$1(() => {
4378
+ const { wait, ...settings } = opt;
4575
4379
  return lodash_debounce(func, wait, settings);
4576
4380
  }, deps || []);
4577
- useEffect(function () { return debounce.cancel; }, [debounce]);
4381
+ useEffect(() => debounce.cancel, [debounce]);
4578
4382
  return debounce;
4579
4383
  };
4580
4384
 
4581
- var filterElements = function (match) { return function (elements) {
4582
- return match ? elements.filter(function (el) { return el.nodeName.match(match); }) : elements;
4583
- }; };
4584
- var defaultOptions$1 = {
4585
- identify: function (el) { return el.id; },
4385
+ const filterElements = (match) => (elements) => {
4386
+ return match ? elements.filter((el) => el.nodeName.match(match)) : elements;
4387
+ };
4388
+ const defaultOptions$1 = {
4389
+ identify: (el) => el.id,
4586
4390
  config: {
4587
4391
  attributes: false,
4588
4392
  childList: true,
4589
4393
  subtree: true,
4590
4394
  },
4591
4395
  };
4592
- var useContentElements = function (container, selector, options) {
4593
- var _a = __assign(__assign({}, defaultOptions$1), options), filter = _a.filter, config = _a.config, identify = _a.identify;
4594
- var _b = __read(useState({}), 2), elements = _b[0], setElements = _b[1];
4595
- var getElements = useCallback$1(function () {
4596
- var all = Array.from(container.querySelectorAll(selector));
4597
- var elements = filter ? all.filter(filter) : all;
4598
- return elements.reduce(function (curr, el) {
4599
- var id = identify(el);
4396
+ const useContentElements = (container, selector, options) => {
4397
+ const { filter, config, identify } = {
4398
+ ...defaultOptions$1,
4399
+ ...options,
4400
+ };
4401
+ const [elements, setElements] = useState({});
4402
+ const getElements = useCallback$1(() => {
4403
+ const all = Array.from(container.querySelectorAll(selector));
4404
+ const elements = filter ? all.filter(filter) : all;
4405
+ return elements.reduce((curr, el) => {
4406
+ const id = identify(el);
4600
4407
  if (curr[id])
4601
4408
  throw Error('duplicate identifiers!');
4602
4409
  curr[id] = el;
4603
4410
  return curr;
4604
4411
  }, {});
4605
4412
  }, [container, selector, identify, filter]);
4606
- useEffect(function () {
4413
+ useEffect(() => {
4607
4414
  // early exit, nothing to observe
4608
4415
  if (!container)
4609
4416
  return;
4610
4417
  // set current elements
4611
4418
  setElements(getElements());
4612
4419
  // Observe changes in DOM
4613
- var observer = new MutationObserver(function () {
4420
+ const observer = new MutationObserver(() => {
4614
4421
  setElements(getElements());
4615
4422
  });
4616
4423
  // start observing
4617
4424
  observer.observe(container, config);
4618
4425
  console.debug('observing container', container);
4619
4426
  // stop observing when unmounted
4620
- return function () {
4427
+ return () => {
4621
4428
  observer.disconnect();
4622
4429
  console.debug('observing disconnected', container);
4623
4430
  };
@@ -4625,100 +4432,98 @@ var useContentElements = function (container, selector, options) {
4625
4432
  return elements;
4626
4433
  };
4627
4434
 
4628
- var DatePicker = function (_a) {
4629
- var id = _a.id, label = _a.label, value = _a.value, variant = _a.variant, onChange = _a.onChange, errorMessage = _a.errorMessage, placeholder = _a.placeholder, fullWidth = _a.fullWidth, required = _a.required, onFocus = _a.onFocus, margin = _a.margin, sx = _a.sx, props = __rest$1(_a, ["id", "label", "value", "variant", "onChange", "errorMessage", "placeholder", "fullWidth", "required", "onFocus", "margin", "sx"]);
4630
- var _b = __read(useDate(value), 2), date = _b[0], setDate = _b[1];
4631
- var _c = __read(useState(), 2), error = _c[0], setError = _c[1];
4632
- var helperText = errorMessage || error || props.helperText;
4633
- useEffect(function () { return onChange(date); }, [String(date)]);
4435
+ const DatePicker = ({ id, label, value, variant, onChange, errorMessage, placeholder, fullWidth, required, onFocus, margin, sx, ...props }) => {
4436
+ const [date, setDate] = useDate(value);
4437
+ const [error, setError] = useState();
4438
+ const helperText = errorMessage || error || props.helperText;
4439
+ useEffect(() => onChange(date), [String(date)]);
4634
4440
  return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: 'nb' },
4635
4441
  React__default.createElement(DesktopDatePicker
4636
4442
  // clearable @todo
4637
- , __assign({
4443
+ , {
4638
4444
  // clearable @todo
4639
- inputFormat: "DD/MM/YYYY", onError: function (reason) {
4445
+ inputFormat: "DD/MM/YYYY", onError: (reason) => {
4640
4446
  switch (reason) {
4641
4447
  case 'invalidDate':
4642
4448
  setError('Ugyldig dato');
4643
4449
  break;
4644
4450
  case 'maxDate':
4645
- setError("Dato m\u00E5 v\u00E6re f\u00F8r ".concat(dayjs(props.maxDate)
4451
+ setError(`Dato være før ${dayjs(props.maxDate)
4646
4452
  .add(1, 'day')
4647
- .format('DD/MM/YYYY')));
4453
+ .format('DD/MM/YYYY')}`);
4648
4454
  break;
4649
4455
  case 'minDate':
4650
- setError("Dato m\u00E5 v\u00E6re etter ".concat(dayjs(props.minDate)
4456
+ setError(`Dato være etter ${dayjs(props.minDate)
4651
4457
  .subtract(1, 'day')
4652
- .format('DD/MM/YYYY')));
4458
+ .format('DD/MM/YYYY')}`);
4653
4459
  break;
4654
4460
  default:
4655
4461
  setError(undefined);
4656
4462
  }
4657
- }, value: date, onChange: setDate, renderInput: function (params) { return (React__default.createElement(TextField, __assign({ id: id }, params, { label: label, variant: variant, onFocus: onFocus, required: required, fullWidth: fullWidth, placeholder: placeholder, sx: sx, margin: margin, error: !!error || !!errorMessage }, (helperText && { helperText: helperText })))); } }, props))));
4463
+ }, value: date, onChange: setDate, renderInput: (params) => (React__default.createElement(TextField, { id: id, ...params, label: label, variant: variant, onFocus: onFocus, required: required, fullWidth: fullWidth, placeholder: placeholder, sx: sx, margin: margin, error: !!error || !!errorMessage, ...(helperText && { helperText }) })), ...props })));
4658
4464
  };
4659
4465
 
4660
- var GrepDateRange = function (_a) {
4661
- var onChange = _a.onChange, _b = _a.spacing, spacing = _b === void 0 ? 3 : _b, style = _a.style, fullWidth = _a.fullWidth, fromProperties = _a.from, toProperties = _a.to, properties = __rest$1(_a, ["onChange", "spacing", "style", "fullWidth", "from", "to"]);
4662
- var _c = __read(useDate(fromProperties.value), 2), from = _c[0], setFrom = _c[1];
4663
- var _d = __read(useDate(toProperties.value), 2), to = _d[0], setTo = _d[1];
4664
- var minDate = properties.minDate, maxDate = properties.maxDate, commonProperties = __rest$1(properties, ["minDate", "maxDate"]);
4665
- useEffect(function () { return onChange(new DateRangeValue(from, to)); }, [String(from), String(to)]);
4466
+ const GrepDateRange = ({ onChange, spacing = 3, style, fullWidth, from: fromProperties, to: toProperties, ...properties }) => {
4467
+ const [from, setFrom] = useDate(fromProperties.value);
4468
+ const [to, setTo] = useDate(toProperties.value);
4469
+ const { minDate, maxDate, ...commonProperties } = properties;
4470
+ useEffect(() => onChange(new DateRangeValue(from, to)), [String(from), String(to)]);
4666
4471
  return (React__default.createElement(Grid, { container: true, spacing: spacing, style: style },
4667
4472
  React__default.createElement(Grid, { item: true, xs: 12, sm: fullWidth ? 12 : 6 },
4668
- React__default.createElement(DatePicker, __assign({ id: String(fromProperties.label), fullWidth: true, minDate: minDate }, commonProperties, fromProperties, { value: from, maxDate: (to === null || to === void 0 ? void 0 : to.subtract(1, 'day')) || undefined, onChange: setFrom }))),
4473
+ React__default.createElement(DatePicker, { id: String(fromProperties.label), fullWidth: true, minDate: minDate, ...commonProperties, ...fromProperties, value: from, maxDate: to?.subtract(1, 'day') || undefined, onChange: setFrom })),
4669
4474
  React__default.createElement(Grid, { item: true, xs: 12, sm: fullWidth ? 12 : 6 },
4670
- React__default.createElement(DatePicker, __assign({ id: String(toProperties.label), fullWidth: true, maxDate: maxDate }, commonProperties, toProperties, { value: to, minDate: (from === null || from === void 0 ? void 0 : from.add(1, 'day')) || undefined, onChange: setTo })))));
4475
+ React__default.createElement(DatePicker, { id: String(toProperties.label), fullWidth: true, maxDate: maxDate, ...commonProperties, ...toProperties, value: to, minDate: from?.add(1, 'day') || undefined, onChange: setTo }))));
4671
4476
  };
4672
4477
 
4673
- var renderField = function (_a) {
4674
- var key = _a.key, value = _a.value;
4675
- return (React.createElement(Box, { key: key, display: "flex", marginRight: "20px" },
4676
- React.createElement(Typography, { variant: "body1", style: { color: Colors.grey, marginRight: '2rem' } },
4677
- key,
4678
- ":"),
4679
- React.createElement(Typography, { variant: "body1" }, value)));
4680
- };
4681
- var renderHorizontal = function (infoFields) { return (React.createElement(Box, { display: "flex", flexWrap: "wrap", justifyContent: "space-between" }, infoFields.map(renderField))); };
4682
- var renderVertical = function (infoFields) {
4683
- return infoFields.map(renderField);
4684
- };
4685
- var InfoContainer = function (props) { return (React.createElement(Box, { style: __assign({ paddingTop: 20 }, props.style) },
4478
+ const renderField = ({ key, value }) => (React.createElement(Box, { key: key, display: "flex", marginRight: "20px" },
4479
+ React.createElement(Typography, { variant: "body1", style: { color: Colors.grey, marginRight: '2rem' } },
4480
+ key,
4481
+ ":"),
4482
+ React.createElement(Typography, { variant: "body1" }, value)));
4483
+ const renderHorizontal = (infoFields) => (React.createElement(Box, { display: "flex", flexWrap: "wrap", justifyContent: "space-between" }, infoFields.map(renderField)));
4484
+ const renderVertical = (infoFields) => infoFields.map(renderField);
4485
+ const InfoContainer = (props) => (React.createElement(Box, { style: { paddingTop: 20, ...props.style } },
4686
4486
  props.header && (React.createElement(Typography, { variant: "h6", style: { paddingBottom: 10 } }, props.header)),
4687
4487
  props.inline
4688
4488
  ? renderHorizontal(props.infoFields)
4689
- : renderVertical(props.infoFields))); };
4489
+ : renderVertical(props.infoFields)));
4690
4490
 
4691
- var textStyles = {
4491
+ const textStyles = {
4692
4492
  userSelect: 'none',
4693
4493
  whiteSpace: 'nowrap',
4694
4494
  outline: 'none',
4695
4495
  fontSize: 16,
4696
4496
  };
4697
- var useStyles$6 = makeStyles()(function (_a, _props, classes) {
4698
- var _b;
4699
- var palette = _a.palette;
4700
- var text = __assign(__assign({}, textStyles), { color: 'inherit', fontWeight: 400 });
4497
+ const useStyles$6 = makeStyles()(({ palette }, _props, classes) => {
4498
+ const text = {
4499
+ ...textStyles,
4500
+ color: 'inherit',
4501
+ fontWeight: 400,
4502
+ };
4701
4503
  return {
4702
4504
  container: {
4703
4505
  padding: 10,
4704
4506
  display: 'flex',
4705
4507
  flexDirection: 'column',
4706
4508
  },
4707
- item: (_b = {
4708
- cursor: 'pointer',
4709
- color: palette.text.disabled,
4710
- outline: 'none',
4711
- '&:hover': {
4712
- color: palette.primary.main,
4713
- }
4509
+ item: {
4510
+ cursor: 'pointer',
4511
+ color: palette.text.disabled,
4512
+ outline: 'none',
4513
+ '&:hover': {
4514
+ color: palette.primary.main,
4714
4515
  },
4715
- _b["&:focus .".concat(classes.text)] = {
4516
+ [`&:focus .${classes.text}`]: {
4716
4517
  color: palette.primary.main,
4717
4518
  outline: 'auto',
4718
4519
  },
4719
- _b),
4720
- text: text,
4721
- selected: __assign(__assign({}, textStyles), { color: palette.primary.main, fontWeight: 500 }),
4520
+ },
4521
+ text,
4522
+ selected: {
4523
+ ...textStyles,
4524
+ color: palette.primary.main,
4525
+ fontWeight: 500,
4526
+ },
4722
4527
  icon: {
4723
4528
  minWidth: 'fit-content',
4724
4529
  marginRight: 2,
@@ -4726,26 +4531,24 @@ var useStyles$6 = makeStyles()(function (_a, _props, classes) {
4726
4531
  };
4727
4532
  });
4728
4533
 
4729
- var Sidebar = function (_a) {
4730
- var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId, expandOnIcon = _a.expandOnIcon;
4731
- var _b = __read(React.useState([]), 2), expanded = _b[0], setExpanded = _b[1];
4732
- var classes = useStyles$6().classes;
4733
- React.useEffect(function () {
4734
- var _a;
4534
+ const Sidebar = ({ pages, onPageClick, currentPageId, expandOnIcon }) => {
4535
+ const [expanded, setExpanded] = React.useState([]);
4536
+ const { classes } = useStyles$6();
4537
+ React.useEffect(() => {
4735
4538
  if (currentPageId) {
4736
- var pageId = (_a = pages.find(function (p) { var _a; return (_a = p.children) === null || _a === void 0 ? void 0 : _a.some(function (c) { return c.id === currentPageId; }); })) === null || _a === void 0 ? void 0 : _a.id;
4737
- !!pageId && setExpanded(__spreadArray(__spreadArray([], __read(expanded), false), [pageId], false));
4539
+ const pageId = pages.find((p) => p.children?.some((c) => c.id === currentPageId))?.id;
4540
+ !!pageId && setExpanded([...expanded, pageId]);
4738
4541
  }
4739
4542
  }, [pages]);
4740
- var toggleExpand = function (id) {
4543
+ const toggleExpand = (id) => {
4741
4544
  if (expanded.includes(id)) {
4742
- setExpanded(__spreadArray([], __read(expanded.filter(function (_id) { return _id !== id; })), false));
4545
+ setExpanded([...expanded.filter((_id) => _id !== id)]);
4743
4546
  }
4744
4547
  else {
4745
- setExpanded(__spreadArray(__spreadArray([], __read(expanded), false), [id], false));
4548
+ setExpanded([...expanded, id]);
4746
4549
  }
4747
4550
  };
4748
- var handleClick = function (page) {
4551
+ const handleClick = (page) => {
4749
4552
  if (expandOnIcon) {
4750
4553
  onPageClick(page);
4751
4554
  }
@@ -4753,14 +4556,14 @@ var Sidebar = function (_a) {
4753
4556
  page.children ? toggleExpand(page.id) : onPageClick(page);
4754
4557
  }
4755
4558
  };
4756
- var renderItem = function (page) { return (React.createElement(React.Fragment, null,
4559
+ const renderItem = (page) => (React.createElement(React.Fragment, null,
4757
4560
  page.linkIcon && (React.createElement(ListItemIcon, { className: classes.icon }, page.linkIcon)),
4758
- React.createElement(ListItemText$1, { sx: { outline: 'none !important' }, tabIndex: -1, disableTypography: true, primary: page.label, className: page.id === currentPageId ? classes.selected : classes.text }))); };
4759
- var renderExpandIcon = function (page) {
4561
+ React.createElement(ListItemText$1, { sx: { outline: 'none !important' }, tabIndex: -1, disableTypography: true, primary: page.label, className: page.id === currentPageId ? classes.selected : classes.text })));
4562
+ const renderExpandIcon = (page) => {
4760
4563
  if (page.children) {
4761
4564
  if (expanded.includes(page.id)) {
4762
4565
  if (expandOnIcon) {
4763
- return React.createElement(ExpandLess, { onClick: function (e) { e.stopPropagation(), toggleExpand(page.id); } });
4566
+ return React.createElement(ExpandLess, { onClick: (e) => { e.stopPropagation(), toggleExpand(page.id); } });
4764
4567
  }
4765
4568
  else {
4766
4569
  return React.createElement(ExpandLess, null);
@@ -4768,7 +4571,7 @@ var Sidebar = function (_a) {
4768
4571
  }
4769
4572
  else {
4770
4573
  if (expandOnIcon) {
4771
- return React.createElement(ExpandMore, { onClick: function (e) { e.stopPropagation(), toggleExpand(page.id); } });
4574
+ return React.createElement(ExpandMore, { onClick: (e) => { e.stopPropagation(), toggleExpand(page.id); } });
4772
4575
  }
4773
4576
  else {
4774
4577
  return React.createElement(ExpandMore, null);
@@ -4778,18 +4581,15 @@ var Sidebar = function (_a) {
4778
4581
  return null;
4779
4582
  };
4780
4583
  return (React.createElement(Box$1, { className: classes.container },
4781
- React.createElement(List$1, null, pages.map(function (page) {
4782
- var _a;
4783
- return (React.createElement("div", { key: page.id },
4784
- React.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(page); }, onKeyPress: keyboard.onActivation(function () { return handleClick(page); }) },
4785
- renderItem(page),
4786
- renderExpandIcon(page)),
4787
- React.createElement(Collapse, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
4788
- React.createElement(List$1, { disablePadding: true }, (_a = page.children) === null || _a === void 0 ? void 0 : _a.map(function (child) { return (React.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(child); }, onKeyPress: keyboard.onActivation(function () { return handleClick(child); }) }, renderItem(child))); })))));
4789
- }))));
4584
+ React.createElement(List$1, null, pages.map((page) => (React.createElement("div", { key: page.id },
4585
+ React.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: () => handleClick(page), onKeyPress: keyboard.onActivation(() => handleClick(page)) },
4586
+ renderItem(page),
4587
+ renderExpandIcon(page)),
4588
+ React.createElement(Collapse, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
4589
+ React.createElement(List$1, { disablePadding: true }, page.children?.map((child) => (React.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: () => handleClick(child), onKeyPress: keyboard.onActivation(() => handleClick(child)) }, renderItem(child))))))))))));
4790
4590
  };
4791
4591
 
4792
- var useStyles$5 = makeStyles()(function () { return ({
4592
+ var useStyles$5 = makeStyles()(() => ({
4793
4593
  message: {
4794
4594
  overflowWrap: 'break-word',
4795
4595
  backgroundColor: '#f8e9d6',
@@ -4826,17 +4626,16 @@ var useStyles$5 = makeStyles()(function () { return ({
4826
4626
  alignSelf: 'center',
4827
4627
  marginLeft: 5,
4828
4628
  },
4829
- }); });
4629
+ }));
4830
4630
 
4831
- var ServiceMessage = function (_a) {
4832
- var id = _a.id, message = _a.message, isPublic = _a.isPublic, onDismiss = _a.onDismiss;
4833
- var classes = useStyles$5().classes;
4631
+ const ServiceMessage = ({ id, message, isPublic, onDismiss }) => {
4632
+ const { classes } = useStyles$5();
4834
4633
  return (React.createElement(Box, { className: classes.message },
4835
4634
  React.createElement(Typography, { className: classes.messageType },
4836
4635
  React.createElement(Warning, { className: classes.warning }),
4837
4636
  "Driftsmelding"),
4838
4637
  React.createElement(Typography, { className: classes.messageText }, message),
4839
- !isPublic && onDismiss && (React.createElement(IconButton, { className: classes.button, onClick: function () { return onDismiss(id); }, size: "large" },
4638
+ !isPublic && onDismiss && (React.createElement(IconButton, { className: classes.button, onClick: () => onDismiss(id), size: "large" },
4840
4639
  React.createElement(Close, { className: classes.close })))));
4841
4640
  };
4842
4641
 
@@ -13633,128 +13432,110 @@ var ConnectedDroppable = connect(makeMapStateToProps$1, mapDispatchToProps$1, nu
13633
13432
  })(Droppable);
13634
13433
  ConnectedDroppable.defaultProps = defaultProps;
13635
13434
 
13636
- var setDimensions = function (el) {
13637
- var _a = el.getBoundingClientRect(), width = _a.width, height = _a.height;
13638
- el.style.width = "".concat(width, "px");
13639
- el.style.height = "".concat(height, "px");
13435
+ const setDimensions = (el) => {
13436
+ const { width, height } = el.getBoundingClientRect();
13437
+ el.style.width = `${width}px`;
13438
+ el.style.height = `${height}px`;
13640
13439
  };
13641
- var clearDimensions = function (el) {
13440
+ const clearDimensions = (el) => {
13642
13441
  el.style.removeProperty('height');
13643
13442
  el.style.removeProperty('width');
13644
13443
  };
13645
- function SortableTableCell(_a) {
13646
- var locked = _a.locked, children = _a.children, props = __rest$1(_a, ["locked", "children"]);
13647
- var ref = useRef();
13648
- useMemo$1(function () {
13444
+ function SortableTableCell({ locked, children, ...props }) {
13445
+ const ref = useRef();
13446
+ useMemo$1(() => {
13649
13447
  if (ref.current) {
13650
13448
  locked ? setDimensions(ref.current) : clearDimensions(ref.current);
13651
13449
  }
13652
13450
  }, [locked]);
13653
- return (React__default.createElement(TableCell$1, __assign({ ref: ref }, props), children));
13451
+ return (React__default.createElement(TableCell$1, { ref: ref, ...props }, children));
13654
13452
  }
13655
13453
 
13656
- var useStyles$4 = makeStyles()(function (_a, _b) {
13657
- var palette = _a.palette, transitions = _a.transitions;
13658
- var isDragging = _b.isDragging;
13659
- return ({
13660
- row: {
13661
- transition: transitions.create(['background-color'], {
13662
- duration: transitions.duration.shorter,
13663
- easing: transitions.easing.easeOut,
13664
- }),
13665
- backgroundColor: isDragging
13666
- ? "var(--tablecell__background--drag, ".concat(hex2rgba(palette.primary.main, 0.25), ")")
13667
- : 'var(--tablecell__background)',
13668
- },
13669
- });
13670
- });
13671
-
13672
- function SortableTableRow(_a) {
13673
- var item = _a.item, id = _a.id, index = _a.index, render = _a.render, disabled = _a.disabled;
13674
- var cells = useMemo$1(function () { return render(item); }, [item, render]);
13675
- var renderRow = useCallback$1(function (isDragging) {
13676
- return cells.map(function (_a, index) {
13677
- var value = _a.value, properties = _a.properties;
13678
- return (React__default.createElement(SortableTableCell, __assign({ key: "dragable-".concat(id, "-").concat(index), locked: isDragging }, properties), value));
13679
- });
13680
- }, [cells, id]);
13681
- return (React__default.createElement(PublicDraggable, { draggableId: "dragable-".concat(id), index: index, isDragDisabled: disabled }, function (provided, _a) {
13682
- var isDragging = _a.isDragging;
13683
- var classes = useStyles$4({ isDragging: isDragging }).classes;
13684
- return (React__default.createElement(TableRow$1, __assign({ className: classes.row, ref: provided.innerRef }, provided.draggableProps),
13685
- React__default.createElement(TableCell$1, __assign({ style: { width: '45px', padding: '5px 10px' } }, provided.dragHandleProps),
13454
+ const useStyles$4 = makeStyles()(({ palette, transitions }, { isDragging }) => ({
13455
+ row: {
13456
+ transition: transitions.create(['background-color'], {
13457
+ duration: transitions.duration.shorter,
13458
+ easing: transitions.easing.easeOut,
13459
+ }),
13460
+ backgroundColor: isDragging
13461
+ ? `var(--tablecell__background--drag, ${hex2rgba(palette.primary.main, 0.25)})`
13462
+ : 'var(--tablecell__background)',
13463
+ },
13464
+ }));
13465
+
13466
+ function SortableTableRow({ item, id, index, render, disabled, }) {
13467
+ const cells = useMemo$1(() => render(item), [item, render]);
13468
+ const renderRow = useCallback$1((isDragging) => cells.map(({ value, properties }, index) => (React__default.createElement(SortableTableCell, { key: `dragable-${id}-${index}`, locked: isDragging, ...properties }, value))), [cells, id]);
13469
+ return (React__default.createElement(PublicDraggable, { draggableId: `dragable-${id}`, index: index, isDragDisabled: disabled }, (provided, { isDragging }) => {
13470
+ const { classes } = useStyles$4({ isDragging: isDragging });
13471
+ return (React__default.createElement(TableRow$1, { className: classes.row, ref: provided.innerRef, ...provided.draggableProps },
13472
+ React__default.createElement(TableCell$1, { style: { width: '45px', padding: '5px 10px' }, ...provided.dragHandleProps },
13686
13473
  React__default.createElement(DragIndicator, null)),
13687
13474
  renderRow(isDragging)));
13688
13475
  }));
13689
13476
  }
13690
13477
 
13691
13478
  function reorder(list, startIndex, endIndex) {
13692
- var _a = __read(list.splice(startIndex, 1), 1), removed = _a[0];
13479
+ const [removed] = list.splice(startIndex, 1);
13693
13480
  list.splice(endIndex, 0, removed);
13694
13481
  return list;
13695
13482
  }
13696
13483
  function castCellNode(value) {
13697
13484
  return typeof value === 'object' && value.value !== undefined
13698
13485
  ? value
13699
- : { value: value };
13486
+ : { value };
13700
13487
  }
13701
- var SortableTable = function (_a) {
13702
- var columns = _a.columns, items = _a.items, identify = _a.identify, headerValue = _a.headerValue, cellValue = _a.cellValue, disabled = _a.disabled, onChange = _a.onChange;
13703
- var _b = __read(useState(items), 2), records = _b[0], setRecords = _b[1];
13704
- var _c = __read(useState(false), 2), isDragging = _c[0], setIsDragging = _c[1];
13705
- useMemo$1(function () {
13488
+ const SortableTable = ({ columns, items, identify, headerValue, cellValue, disabled, onChange, }) => {
13489
+ const [records, setRecords] = useState(items);
13490
+ const [isDragging, setIsDragging] = useState(false);
13491
+ useMemo$1(() => {
13706
13492
  return setRecords(items);
13707
13493
  }, [items]);
13708
- var onDragStart = function () {
13494
+ const onDragStart = () => {
13709
13495
  setIsDragging(true);
13710
13496
  };
13711
- var onDragEnd = function (result) {
13497
+ const onDragEnd = (result) => {
13712
13498
  setIsDragging(false);
13713
13499
  if (result.destination) {
13714
- var newOrder = reorder(records, result.source.index, result.destination.index);
13500
+ const newOrder = reorder(records, result.source.index, result.destination.index);
13715
13501
  setRecords(newOrder);
13716
13502
  onChange &&
13717
- onChange(newOrder.map(function (record, index) { return ({
13503
+ onChange(newOrder.map((record, index) => ({
13718
13504
  id: identify(record),
13719
- index: index,
13720
- }); }));
13505
+ index,
13506
+ })));
13721
13507
  }
13722
13508
  };
13723
- var headers = useMemo$1(function () {
13724
- return columns.map(function (column) {
13725
- return castCellNode(headerValue ? headerValue(column) : column);
13726
- });
13509
+ const headers = useMemo$1(() => {
13510
+ return columns.map((column) => castCellNode(headerValue ? headerValue(column) : column));
13727
13511
  }, [columns, headerValue]);
13728
- var getCellValue = useCallback$1(function (column, item) {
13512
+ const getCellValue = useCallback$1((column, item) => {
13729
13513
  return castCellNode(cellValue ? cellValue(column, item) : item[column]);
13730
13514
  }, [cellValue]);
13731
- var render = useCallback$1(function (item) {
13732
- return columns.map(function (column) { return getCellValue(column, item); });
13733
- }, [columns, getCellValue]);
13515
+ const render = useCallback$1((item) => columns.map((column) => getCellValue(column, item)), [columns, getCellValue]);
13734
13516
  return (React__default.createElement(Table$1, null,
13735
13517
  React__default.createElement(TableHead, null,
13736
13518
  React__default.createElement(TableRow, null,
13737
13519
  React__default.createElement(SortableTableCell, { locked: isDragging }),
13738
- headers.map(function (_a, index) {
13739
- var value = _a.value, properties = _a.properties;
13740
- return (React__default.createElement(SortableTableCell, __assign({ key: "header-".concat(index), locked: isDragging }, properties), value));
13520
+ headers.map(({ value, properties }, index) => {
13521
+ return (React__default.createElement(SortableTableCell, { key: `header-${index}`, locked: isDragging, ...properties }, value));
13741
13522
  }))),
13742
13523
  React__default.createElement(DragDropContext, { onDragEnd: onDragEnd, onBeforeDragStart: onDragStart },
13743
- React__default.createElement(ConnectedDroppable, { droppableId: "droppable", direction: "vertical" }, function (provided) { return (React__default.createElement(TableBody$1, __assign({ ref: provided.innerRef }, provided.droppableProps),
13744
- records.map(function (item, index) {
13745
- var props = {
13524
+ React__default.createElement(ConnectedDroppable, { droppableId: "droppable", direction: "vertical" }, (provided) => (React__default.createElement(TableBody$1, { ref: provided.innerRef, ...provided.droppableProps },
13525
+ records.map((item, index) => {
13526
+ const props = {
13746
13527
  id: identify(item),
13747
- item: item,
13748
- index: index,
13749
- render: render,
13750
- disabled: disabled,
13528
+ item,
13529
+ index,
13530
+ render,
13531
+ disabled,
13751
13532
  };
13752
- return (React__default.createElement(SortableTableRow, __assign({ key: "item-".concat(props.id) }, props)));
13533
+ return (React__default.createElement(SortableTableRow, { key: `item-${props.id}`, ...props }));
13753
13534
  }),
13754
- provided.placeholder)); }))));
13535
+ provided.placeholder))))));
13755
13536
  };
13756
13537
 
13757
- var EditorContext = createContext({});
13538
+ const EditorContext = createContext({});
13758
13539
 
13759
13540
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
13760
13541
 
@@ -20419,58 +20200,52 @@ function stateFromHTML(html, options) {
20419
20200
  return stateFromElement(element, otherOptions);
20420
20201
  }
20421
20202
 
20422
- var createState = function (content, decorators) {
20423
- var decorator = decorators ? new CompositeDecorator(decorators) : undefined;
20203
+ const createState = (content, decorators) => {
20204
+ const decorator = decorators ? new CompositeDecorator(decorators) : undefined;
20424
20205
  if (content) {
20425
- var state = stateFromHTML(content);
20206
+ const state = stateFromHTML(content);
20426
20207
  return EditorState.createWithContent(state, decorator);
20427
20208
  }
20428
20209
  return EditorState.createEmpty(decorator);
20429
20210
  };
20430
- var convert2html = function (content, options) {
20431
- if (options === void 0) { options = {
20432
- inlineStyles: {
20433
- BOLD: { element: 'strong' },
20434
- ITALIC: { element: 'i' },
20435
- UNSTYLED: { element: 'p' },
20436
- },
20437
- }; }
20438
- var html = content.getPlainText().trim().length
20211
+ const convert2html = (content, options = {
20212
+ inlineStyles: {
20213
+ BOLD: { element: 'strong' },
20214
+ ITALIC: { element: 'i' },
20215
+ UNSTYLED: { element: 'p' },
20216
+ },
20217
+ }) => {
20218
+ const html = content.getPlainText().trim().length
20439
20219
  ? stateToHTML(content, options)
20440
20220
  : '';
20441
20221
  return html; //.replace(/&nbsp;/, ' ');
20442
20222
  };
20443
- var convert2txt = function (content) {
20444
- return content.getPlainText();
20445
- };
20446
- var parseContentState = function (state) { return ({
20223
+ const convert2txt = (content) => content.getPlainText();
20224
+ const parseContentState = (state) => ({
20447
20225
  txt: convert2txt(state).trim(),
20448
20226
  html: convert2html(state),
20449
- }); };
20450
- var parseContent = function (content, decorators) {
20451
- return parseContentState(createState(content, decorators).getCurrentContent());
20452
- };
20453
- var UpdateStyle = function (state, style) { return RichUtils.toggleInlineStyle(state, style); };
20227
+ });
20228
+ const parseContent = (content, decorators) => parseContentState(createState(content, decorators).getCurrentContent());
20229
+ const UpdateStyle = (state, style) => RichUtils.toggleInlineStyle(state, style);
20454
20230
 
20455
- var Provider = function (_a) {
20456
- var html = _a.html, decorators = _a.decorators, children = _a.children;
20457
- var _b = __read(useState(createState('', decorators)), 2), state = _b[0], setState = _b[1];
20458
- var _c = __read(useState(), 2), selection = _c[0], setSelection = _c[1];
20459
- useMemo$1(function () {
20231
+ const Provider = ({ html, decorators, children, }) => {
20232
+ const [state, setState] = useState(createState('', decorators));
20233
+ const [selection, setSelection] = useState();
20234
+ useMemo$1(() => {
20460
20235
  console.debug('creating new state for editor', html);
20461
20236
  setState(createState(html, decorators));
20462
20237
  }, [html, decorators]);
20463
20238
  return (React__default.createElement(EditorContext.Provider, { value: {
20464
- state: state,
20465
- setState: setState,
20466
- selection: selection,
20467
- setSelection: setSelection,
20239
+ state,
20240
+ setState,
20241
+ selection,
20242
+ setSelection,
20468
20243
  } }, children));
20469
20244
  };
20470
20245
 
20471
20246
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
20472
20247
 
20473
- var useButtonStyles = makeStyles()({
20248
+ const useButtonStyles = makeStyles()({
20474
20249
  btn: {
20475
20250
  backgroundColor: 'white',
20476
20251
  '&:hover': {
@@ -20485,121 +20260,114 @@ var useButtonStyles = makeStyles()({
20485
20260
  },
20486
20261
  });
20487
20262
 
20488
- var useEditorStyles = makeStyles()(function (theme, _a) {
20489
- var hasFocus = _a.hasFocus, hasContent = _a.hasContent, readOnly = _a.readOnly;
20490
- return ({
20491
- root: {
20492
- position: 'relative',
20493
- display: 'inline-flex',
20494
- flexFlow: 'column',
20495
- minWidth: '100%', // TODO
20496
- },
20497
- legend: {
20498
- position: 'absolute',
20499
- top: -5,
20500
- left: 0,
20501
- right: 0,
20502
- bottom: 0,
20503
- lineHeight: '11px',
20504
- zIndex: hasFocus ? 0 : 1,
20505
- paddingLeft: 10,
20506
- borderStyle: 'solid',
20507
- borderRadius: theme.shape.borderRadius,
20508
- borderWidth: hasFocus ? 2 : 1,
20263
+ const useEditorStyles = makeStyles()((theme, { hasFocus, hasContent, readOnly }) => ({
20264
+ root: {
20265
+ position: 'relative',
20266
+ display: 'inline-flex',
20267
+ flexFlow: 'column',
20268
+ minWidth: '100%', // TODO
20269
+ },
20270
+ legend: {
20271
+ position: 'absolute',
20272
+ top: -5,
20273
+ left: 0,
20274
+ right: 0,
20275
+ bottom: 0,
20276
+ lineHeight: '11px',
20277
+ zIndex: hasFocus ? 0 : 1,
20278
+ paddingLeft: 10,
20279
+ borderStyle: 'solid',
20280
+ borderRadius: theme.shape.borderRadius,
20281
+ borderWidth: hasFocus ? 2 : 1,
20282
+ borderColor: hasFocus
20283
+ ? theme.palette.primary.main
20284
+ : hex2rgba('#000', 0.23),
20285
+ '&:hover': {
20509
20286
  borderColor: hasFocus
20510
20287
  ? theme.palette.primary.main
20511
- : hex2rgba('#000', 0.23),
20512
- '&:hover': {
20513
- borderColor: hasFocus
20514
- ? theme.palette.primary.main
20515
- : theme.palette.text.primary,
20516
- },
20517
- transition: theme.transitions.create(['border-color'], {
20518
- duration: theme.transitions.duration.shorter,
20519
- easing: theme.transitions.easing.easeOut,
20520
- }),
20288
+ : theme.palette.text.primary,
20521
20289
  },
20522
- editor: {
20523
- padding: '.8rem 1rem',
20524
- position: 'relative',
20525
- zIndex: hasFocus || readOnly ? 1 : 0,
20526
- '& .unstyled': {
20527
- margin: '.5rem 0',
20528
- },
20529
- },
20530
- label: {
20531
- position: 'absolute',
20532
- top: 0,
20533
- left: 0,
20534
- zIndex: 1,
20535
- transform: hasFocus || hasContent
20536
- ? 'translate(6px, -14px) scale(0.75)'
20537
- : 'translate(6px, 12px) scale(1)',
20538
- transformOrigin: 'top left',
20539
- transition: theme.transitions.create(['color', 'transform'], {
20540
- duration: theme.transitions.duration.shorter,
20541
- easing: theme.transitions.easing.easeOut,
20542
- }),
20543
- color: hasFocus
20544
- ? theme.palette.primary[theme.palette.mode === 'light' ? 'dark' : 'light']
20545
- : theme.palette.text.secondary,
20546
- fontSize: '1.1428571428571428rem',
20547
- // hack @todo when time
20548
- backgroundColor: 'white',
20549
- padding: '2px 10px',
20550
- },
20551
- helpertext: {
20552
- margin: 0,
20553
- opacity: hasFocus ? 1 : 0,
20554
- transition: theme.transitions.create(['opacity'], {
20555
- duration: theme.transitions.duration.shorter,
20556
- easing: theme.transitions.easing.easeOut,
20557
- }),
20558
- fontSize: 'small',
20559
- // hack @todo when time
20560
- backgroundColor: 'white',
20561
- padding: '2px 10px',
20562
- },
20563
- charcount: {
20564
- margin: 0,
20565
- transition: theme.transitions.create(['opacity'], {
20566
- duration: theme.transitions.duration.shorter,
20567
- easing: theme.transitions.easing.easeOut,
20568
- }),
20569
- fontSize: 'small',
20570
- // hack @todo when time
20571
- backgroundColor: 'white',
20572
- padding: '2px 10px',
20290
+ transition: theme.transitions.create(['border-color'], {
20291
+ duration: theme.transitions.duration.shorter,
20292
+ easing: theme.transitions.easing.easeOut,
20293
+ }),
20294
+ },
20295
+ editor: {
20296
+ padding: '.8rem 1rem',
20297
+ position: 'relative',
20298
+ zIndex: hasFocus || readOnly ? 1 : 0,
20299
+ '& .unstyled': {
20300
+ margin: '.5rem 0',
20573
20301
  },
20574
- });
20575
- });
20302
+ },
20303
+ label: {
20304
+ position: 'absolute',
20305
+ top: 0,
20306
+ left: 0,
20307
+ zIndex: 1,
20308
+ transform: hasFocus || hasContent
20309
+ ? 'translate(6px, -14px) scale(0.75)'
20310
+ : 'translate(6px, 12px) scale(1)',
20311
+ transformOrigin: 'top left',
20312
+ transition: theme.transitions.create(['color', 'transform'], {
20313
+ duration: theme.transitions.duration.shorter,
20314
+ easing: theme.transitions.easing.easeOut,
20315
+ }),
20316
+ color: hasFocus
20317
+ ? theme.palette.primary[theme.palette.mode === 'light' ? 'dark' : 'light']
20318
+ : theme.palette.text.secondary,
20319
+ fontSize: '1.1428571428571428rem',
20320
+ // hack @todo when time
20321
+ backgroundColor: 'white',
20322
+ padding: '2px 10px',
20323
+ },
20324
+ helpertext: {
20325
+ margin: 0,
20326
+ opacity: hasFocus ? 1 : 0,
20327
+ transition: theme.transitions.create(['opacity'], {
20328
+ duration: theme.transitions.duration.shorter,
20329
+ easing: theme.transitions.easing.easeOut,
20330
+ }),
20331
+ fontSize: 'small',
20332
+ // hack @todo when time
20333
+ backgroundColor: 'white',
20334
+ padding: '2px 10px',
20335
+ },
20336
+ charcount: {
20337
+ margin: 0,
20338
+ transition: theme.transitions.create(['opacity'], {
20339
+ duration: theme.transitions.duration.shorter,
20340
+ easing: theme.transitions.easing.easeOut,
20341
+ }),
20342
+ fontSize: 'small',
20343
+ // hack @todo when time
20344
+ backgroundColor: 'white',
20345
+ padding: '2px 10px',
20346
+ },
20347
+ }));
20576
20348
 
20577
- var useFloatingToolbarStyles = makeStyles()(function (_theme, _a) {
20578
- var isVisible = _a.isVisible;
20579
- return ({
20580
- root: {
20581
- position: 'absolute',
20582
- zIndex: 9,
20583
- transition: 'transform 0.15s cubic-bezier(.3,1.2,.2,1)',
20584
- visibility: isVisible ? 'visible' : 'hidden',
20585
- transform: isVisible
20586
- ? 'translate(-50%) scale(1)'
20587
- : 'translate(-50%) scale(0)',
20588
- },
20589
- });
20590
- });
20349
+ const useFloatingToolbarStyles = makeStyles()((_theme, { isVisible }) => ({
20350
+ root: {
20351
+ position: 'absolute',
20352
+ zIndex: 9,
20353
+ transition: 'transform 0.15s cubic-bezier(.3,1.2,.2,1)',
20354
+ visibility: isVisible ? 'visible' : 'hidden',
20355
+ transform: isVisible
20356
+ ? 'translate(-50%) scale(1)'
20357
+ : 'translate(-50%) scale(0)',
20358
+ },
20359
+ }));
20591
20360
 
20592
- var InlineButton = function (_a) {
20593
- var type = _a.type; _a.editor; var children = _a.children, props = __rest$1(_a, ["type", "editor", "children"]);
20594
- var classes = useButtonStyles().classes;
20595
- var _b = useContext(EditorContext), state = _b.state, setState = _b.setState;
20596
- var onClick = function (event) {
20361
+ const InlineButton = ({ type, editor: _editor, children, ...props }) => {
20362
+ const { classes } = useButtonStyles();
20363
+ const { state, setState } = useContext(EditorContext);
20364
+ const onClick = (event) => {
20597
20365
  event.preventDefault();
20598
- var e = event;
20366
+ const e = event;
20599
20367
  setState(UpdateStyle(state, e.currentTarget.value));
20600
20368
  };
20601
- var selected = state.getCurrentInlineStyle().has(type);
20602
- return (React__default.createElement(ToggleButton, __assign({}, props, { classes: { root: classes.btn, selected: classes.btnSelected }, selected: selected, onClick: onClick, value: type, size: "small" }), children));
20369
+ const selected = state.getCurrentInlineStyle().has(type);
20370
+ return (React__default.createElement(ToggleButton, { ...props, classes: { root: classes.btn, selected: classes.btnSelected }, selected: selected, onClick: onClick, value: type, size: "small" }, children));
20603
20371
  };
20604
20372
 
20605
20373
  var ButtonType;
@@ -20607,7 +20375,7 @@ var ButtonType;
20607
20375
  ButtonType["bold"] = "BOLD";
20608
20376
  ButtonType["italic"] = "ITALIC";
20609
20377
  })(ButtonType || (ButtonType = {}));
20610
- var createButton = function (style) {
20378
+ const createButton = (style) => {
20611
20379
  switch (style) {
20612
20380
  case 'bold':
20613
20381
  return {
@@ -20622,117 +20390,109 @@ var createButton = function (style) {
20622
20390
  }
20623
20391
  };
20624
20392
 
20625
- var FloatingToolbar = function (_a) {
20626
- var editor = _a.editor, buttons = _a.buttons;
20627
- var selection = useContext(EditorContext).selection;
20628
- var _b = __read(useState(false), 2), isVisible = _b[0], setVisibility = _b[1];
20629
- var toolbar = useRef();
20630
- var classes = useFloatingToolbarStyles({ isVisible: isVisible }).classes;
20393
+ const FloatingToolbar = ({ editor, buttons }) => {
20394
+ const { selection } = useContext(EditorContext);
20395
+ const [isVisible, setVisibility] = useState(false);
20396
+ const toolbar = useRef();
20397
+ const { classes } = useFloatingToolbarStyles({ isVisible });
20631
20398
  // @eslint-disable-next-line react-hooks/exhaustive-deps
20632
- useEffect(function () {
20633
- var _a;
20634
- var selectionRect = getVisibleSelectionRect(window);
20399
+ useEffect(() => {
20400
+ const selectionRect = getVisibleSelectionRect(window);
20635
20401
  if (!selectionRect || !toolbar.current || !editor.current)
20636
20402
  return;
20637
- var editorRoot = editor.current.editorContainer;
20638
- var editorRootRect = editorRoot.getBoundingClientRect();
20639
- var position = {
20403
+ const editorRoot = editor.current.editorContainer;
20404
+ const editorRootRect = editorRoot.getBoundingClientRect();
20405
+ const position = {
20640
20406
  top: editorRoot.offsetTop -
20641
- ((_a = toolbar === null || toolbar === void 0 ? void 0 : toolbar.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) +
20407
+ toolbar?.current?.offsetHeight +
20642
20408
  (selectionRect.top - editorRootRect.top) -
20643
20409
  5,
20644
20410
  left: editorRoot.offsetLeft +
20645
20411
  (selectionRect.left - editorRootRect.left) +
20646
20412
  selectionRect.width / 2,
20647
20413
  };
20648
- toolbar.current.style.top = "".concat(position.top, "px");
20649
- toolbar.current.style.left = "".concat(position.left, "px");
20414
+ toolbar.current.style.top = `${position.top}px`;
20415
+ toolbar.current.style.left = `${position.left}px`;
20650
20416
  setVisibility(!!selection && !selection.isCollapsed() && selection.getHasFocus());
20651
20417
  });
20652
20418
  return (React__default.createElement("div", { ref: toolbar, className: classes.root },
20653
- React__default.createElement(ToggleButtonGroup, null, buttons.map(function (_a, key) {
20654
- var type = _a.type, children = _a.children;
20655
- return (React__default.createElement(InlineButton, { key: key, type: type, editor: editor }, children));
20656
- }))));
20419
+ React__default.createElement(ToggleButtonGroup, null, buttons.map(({ type, children }, key) => (React__default.createElement(InlineButton, { key: key, type: type, editor: editor }, children))))));
20657
20420
  };
20658
20421
 
20659
- var customKeyHandler = function (setEditorState) { return function (command, editorState) {
20422
+ const customKeyHandler = (setEditorState) => (command, editorState) => {
20660
20423
  if (command === 'shift-split-block') {
20661
- var newState = RichUtils.insertSoftNewline(editorState);
20424
+ const newState = RichUtils.insertSoftNewline(editorState);
20662
20425
  setEditorState(newState);
20663
20426
  return 'handled';
20664
20427
  }
20665
20428
  return 'not-handled';
20666
- }; };
20667
- var keyHandler = function (setEditorState, allowedStyles) { return function (command, editorState) {
20668
- if (!allowedStyles || allowedStyles.some(function (s) { return s === command; })) {
20669
- var newState = RichUtils.handleKeyCommand(editorState, command);
20429
+ };
20430
+ const keyHandler = (setEditorState, allowedStyles) => (command, editorState) => {
20431
+ if (!allowedStyles || allowedStyles.some((s) => s === command)) {
20432
+ const newState = RichUtils.handleKeyCommand(editorState, command);
20670
20433
  if (newState) {
20671
20434
  setEditorState(newState);
20672
20435
  return 'handled';
20673
20436
  }
20674
20437
  }
20675
20438
  return customKeyHandler(setEditorState)(command, editorState);
20676
- }; };
20439
+ };
20677
20440
 
20678
- var blockStyleFn = function (block) { return block.getType(); };
20679
- var createDefaultButtons = function () { return [
20441
+ const blockStyleFn = (block) => block.getType();
20442
+ const createDefaultButtons = () => [
20680
20443
  createButton('bold'),
20681
20444
  createButton('italic'),
20682
- ]; };
20683
- var getCharCount = function (editorState) {
20684
- return editorState.getCurrentContent().getPlainText('').length;
20685
- };
20686
- var EditorComponent = function (_a) {
20687
- var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, blockPasting = _a.blockPasting, lang = _a.lang, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar", "blockPasting", "lang"]);
20688
- var _c = useContext(EditorContext), state = _c.state, setState = _c.setState, setSelection = _c.setSelection;
20689
- var ref = useRef();
20690
- var canStyle = allowedStyles === undefined || allowedStyles.length > 0;
20691
- var buttons = !allowedStyles
20445
+ ];
20446
+ const getCharCount = (editorState) => editorState.getCurrentContent().getPlainText('').length;
20447
+ const EditorComponent = ({ label, classes, autoFocus, helperText, showCharCount, allowedStyles, disableNewlines, onContentChange, Toolbar = FloatingToolbar, blockPasting, lang, ...props }) => {
20448
+ const { state, setState, setSelection } = useContext(EditorContext);
20449
+ const ref = useRef();
20450
+ const canStyle = allowedStyles === undefined || allowedStyles.length > 0;
20451
+ const buttons = !allowedStyles
20692
20452
  ? createDefaultButtons()
20693
20453
  : allowedStyles.map(createButton);
20694
20454
  // TODO: make prop
20695
- var handleKeyCommand = canStyle
20455
+ const handleKeyCommand = canStyle
20696
20456
  ? keyHandler(setState, allowedStyles)
20697
20457
  : customKeyHandler(setState);
20698
- var _d = __read(useState(false), 2), hasFocus = _d[0], setFocused = _d[1];
20699
- var _e = __read(useState(0), 2), charCount = _e[0], setCharCount = _e[1];
20458
+ const [hasFocus, setFocused] = useState(false);
20459
+ const [charCount, setCharCount] = useState(0);
20700
20460
  // defer focus until next tick
20701
- var requestFocus = function () {
20702
- window.requestAnimationFrame(function () { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus(); });
20461
+ const requestFocus = () => {
20462
+ window.requestAnimationFrame(() => ref.current?.focus());
20703
20463
  };
20704
20464
  // multiple components might request focus and deligate back focus
20705
- var onBlur = useDebounce(function () { return ref.current && setFocused(false); }, {
20465
+ const onBlur = useDebounce(() => ref.current && setFocused(false), {
20706
20466
  wait: 150,
20707
20467
  });
20708
- var onFocus = function () {
20468
+ const onFocus = () => {
20709
20469
  // when editor focused cancel pending defocus
20710
20470
  onBlur.cancel();
20711
20471
  setFocused(true);
20712
20472
  };
20713
- var onChange = function (nextState) {
20473
+ const onChange = (nextState) => {
20714
20474
  setState(nextState);
20715
20475
  setSelection(nextState.getSelection());
20716
20476
  setCharCount(getCharCount(nextState));
20717
20477
  };
20718
- useEffect(function () {
20478
+ useEffect(() => {
20719
20479
  autoFocus && ref.current && ref.current.focus();
20720
20480
  }, [autoFocus]);
20721
20481
  // hacky workaround?
20722
- var oldContent = useRef(state.getCurrentContent());
20723
- var currentContent = state.getCurrentContent();
20724
- useEffect(function () {
20482
+ const oldContent = useRef(state.getCurrentContent());
20483
+ const currentContent = state.getCurrentContent();
20484
+ useEffect(() => {
20725
20485
  if (oldContent.current !== currentContent) {
20726
20486
  onContentChange && onContentChange(currentContent);
20727
20487
  }
20728
20488
  }, [convert2html(currentContent)]);
20729
- var hasContent = state.getCurrentContent().hasText();
20730
- var styles = useEditorStyles({
20731
- hasFocus: hasFocus,
20732
- hasContent: hasContent,
20489
+ const hasContent = state.getCurrentContent().hasText();
20490
+ const { classes: styles } = useEditorStyles({
20491
+ hasFocus,
20492
+ hasContent,
20733
20493
  readOnly: props.readOnly,
20734
- }).classes;
20735
- var keyBindingFn = function (e) {
20494
+ });
20495
+ const keyBindingFn = (e) => {
20736
20496
  if (disableNewlines && e.key === 'Enter')
20737
20497
  return null;
20738
20498
  if (e.key === 'Enter' && e.shiftKey) {
@@ -20742,31 +20502,40 @@ var EditorComponent = function (_a) {
20742
20502
  return getDefaultKeyBinding(e);
20743
20503
  }
20744
20504
  };
20745
- var handlePastedText = function (text, _html, editorState) {
20505
+ const handlePastedText = (text, _html, editorState) => {
20746
20506
  if (!blockPasting) {
20747
20507
  onChange(EditorState.push(editorState, Modifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), text.replace(/\n/g, ' ')), 'remove-range'));
20748
20508
  }
20749
20509
  return 'handled';
20750
20510
  };
20751
- return (React__default.createElement(Box, { className: clsx(styles.root, classes === null || classes === void 0 ? void 0 : classes.root), onClick: requestFocus },
20752
- React__default.createElement("legend", { className: clsx(styles.legend, classes === null || classes === void 0 ? void 0 : classes.legend) },
20511
+ return (React__default.createElement(Box, { className: clsx(styles.root, classes?.root), onClick: requestFocus },
20512
+ React__default.createElement("legend", { className: clsx(styles.legend, classes?.legend) },
20753
20513
  React__default.createElement("span", { dangerouslySetInnerHTML: { __html: '&#8203;' } })),
20754
- label && (React__default.createElement("label", { className: clsx(styles.label, classes === null || classes === void 0 ? void 0 : classes.label) }, label)),
20514
+ label && (React__default.createElement("label", { className: clsx(styles.label, classes?.label) }, label)),
20755
20515
  canStyle && (React__default.createElement(Toolbar, { editor: ref, buttons: buttons })),
20756
- React__default.createElement(Box, { className: clsx(styles.editor, classes === null || classes === void 0 ? void 0 : classes.editor), lang: lang },
20757
- React__default.createElement(Editor, __assign({ ref: ref }, __assign({ editorState: state, onChange: onChange, onFocus: onFocus, onBlur: onBlur, blockStyleFn: blockStyleFn, handleKeyCommand: handleKeyCommand, keyBindingFn: keyBindingFn, handlePastedText: handlePastedText }, props)))),
20516
+ React__default.createElement(Box, { className: clsx(styles.editor, classes?.editor), lang: lang },
20517
+ React__default.createElement(Editor, { ref: ref, ...{
20518
+ editorState: state,
20519
+ onChange,
20520
+ onFocus,
20521
+ onBlur,
20522
+ blockStyleFn,
20523
+ handleKeyCommand,
20524
+ keyBindingFn,
20525
+ handlePastedText,
20526
+ ...props,
20527
+ } })),
20758
20528
  (showCharCount || helperText) && (React__default.createElement(Box, { margin: ".5rem" },
20759
- showCharCount && (React__default.createElement(FormHelperText, { className: styles.charcount }, "Antall tegn: ".concat(charCount))),
20529
+ showCharCount && (React__default.createElement(FormHelperText, { className: styles.charcount }, `Antall tegn: ${charCount}`)),
20760
20530
  helperText && (React__default.createElement(FormHelperText, { className: styles.helpertext }, helperText))))));
20761
20531
  };
20762
20532
 
20763
- var GrepEditor = function (_a) {
20764
- var html = _a.html, props = __rest$1(_a, ["html"]);
20765
- return (React__default.createElement(Provider, __assign({}, { html: html }),
20766
- React__default.createElement(EditorComponent, __assign({}, props))));
20533
+ const GrepEditor = ({ html, ...props }) => {
20534
+ return (React__default.createElement(Provider, { ...{ html } },
20535
+ React__default.createElement(EditorComponent, { ...props })));
20767
20536
  };
20768
20537
 
20769
- var dimensions = {
20538
+ const dimensions = {
20770
20539
  breadcrumbsFontSize: 16,
20771
20540
  contentWidth: 1028,
20772
20541
  footerHeight: 50,
@@ -20777,7 +20546,7 @@ var dimensions = {
20777
20546
  toolbarMenuWidth: 1028,
20778
20547
  toolbarMenuHeight: 50,
20779
20548
  };
20780
- var ToolbarTitle = styled(NavLink)(function () { return ({
20549
+ const ToolbarTitle = styled(NavLink)(() => ({
20781
20550
  display: 'flex',
20782
20551
  fontSize: '24px',
20783
20552
  color: '#303030',
@@ -20791,102 +20560,84 @@ var ToolbarTitle = styled(NavLink)(function () { return ({
20791
20560
  outline: 'none',
20792
20561
  textDecoration: 'underline',
20793
20562
  },
20794
- }); });
20795
- var EnvironmentTitle = styled('div')(function () { return ({
20563
+ }));
20564
+ const EnvironmentTitle = styled('div')(() => ({
20796
20565
  color: 'rgba(0, 0, 0, 0.33)',
20797
20566
  marginLeft: '17px',
20798
- }); });
20799
- var Toolbar = styled('div')(function (_a) {
20800
- var _b;
20801
- var theme = _a.theme;
20802
- return (_b = {
20803
- display: 'flex',
20804
- flexDirection: 'column'
20805
- },
20806
- _b[theme.breakpoints.down('sm')] = {
20807
- height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20808
- minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20809
- maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20810
- },
20811
- _b[theme.breakpoints.up('sm')] = {
20812
- height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20813
- minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20814
- maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20815
- },
20816
- _b);
20817
- });
20818
- var ToolbarFixer = styled('div')(function (_a) {
20819
- var _b;
20820
- var theme = _a.theme;
20821
- return (_b = {
20822
- display: 'flex',
20823
- flexDirection: 'column',
20824
- position: 'fixed',
20825
- top: 0,
20826
- left: 0,
20827
- right: 0,
20828
- zIndex: 101
20829
- },
20830
- _b[theme.breakpoints.down('sm')] = {
20831
- height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20832
- minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20833
- maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
20834
- },
20835
- _b[theme.breakpoints.up('sm')] = {
20836
- height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20837
- minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20838
- maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
20839
- },
20840
- _b);
20841
- });
20842
- var ToolbarInner = styled('div')(function (_a) {
20843
- var _b;
20844
- var colors = _a.colors, theme = _a.theme;
20567
+ }));
20568
+ const Toolbar = styled('div')(({ theme }) => ({
20569
+ display: 'flex',
20570
+ flexDirection: 'column',
20571
+ [theme.breakpoints.down('sm')]: {
20572
+ height: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20573
+ minHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20574
+ maxHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20575
+ },
20576
+ [theme.breakpoints.up('sm')]: {
20577
+ height: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20578
+ minHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20579
+ maxHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20580
+ },
20581
+ }));
20582
+ const ToolbarFixer = styled('div')(({ theme }) => ({
20583
+ display: 'flex',
20584
+ flexDirection: 'column',
20585
+ position: 'fixed',
20586
+ top: 0,
20587
+ left: 0,
20588
+ right: 0,
20589
+ zIndex: 101,
20590
+ [theme.breakpoints.down('sm')]: {
20591
+ height: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20592
+ minHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20593
+ maxHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile}px`,
20594
+ },
20595
+ [theme.breakpoints.up('sm')]: {
20596
+ height: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20597
+ minHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20598
+ maxHeight: `${dimensions.toolbarMenuHeight + dimensions.toolbarHeight}px`,
20599
+ },
20600
+ }));
20601
+ const ToolbarInner = styled('div')(({ colors, theme }) => {
20845
20602
  if (!theme) {
20846
20603
  return {};
20847
20604
  }
20848
- return _b = {
20849
- alignItems: 'center',
20850
- display: 'flex',
20851
- margin: '0 auto',
20852
- width: '100%',
20853
- padding: 0,
20854
- backgroundColor: colors.headerBackgroundColor
20855
- },
20856
- _b[theme.breakpoints.down('sm')] = {
20857
- height: "".concat(dimensions.toolbarHeightMobile, "px"),
20858
- minHeight: "".concat(dimensions.toolbarHeightMobile, "px"),
20605
+ return {
20606
+ alignItems: 'center',
20607
+ display: 'flex',
20608
+ margin: '0 auto',
20609
+ width: '100%',
20610
+ padding: 0,
20611
+ backgroundColor: colors.headerBackgroundColor,
20612
+ [theme.breakpoints.down('sm')]: {
20613
+ height: `${dimensions.toolbarHeightMobile}px`,
20614
+ minHeight: `${dimensions.toolbarHeightMobile}px`,
20859
20615
  },
20860
- _b[theme.breakpoints.up('sm')] = {
20616
+ [theme.breakpoints.up('sm')]: {
20861
20617
  padding: 0,
20862
- height: "".concat(dimensions.toolbarHeight, "px"),
20863
- minHeight: "".concat(dimensions.toolbarHeight, "px"),
20618
+ height: `${dimensions.toolbarHeight}px`,
20619
+ minHeight: `${dimensions.toolbarHeight}px`,
20864
20620
  },
20865
- _b;
20621
+ };
20866
20622
  });
20867
- var ToolbarLeft = styled('div')(function () { return ({
20623
+ const ToolbarLeft = styled('div')(() => ({
20868
20624
  alignItems: 'center',
20869
20625
  display: 'flex',
20870
20626
  marginLeft: '40px',
20871
- }); });
20872
- var ToolbarRight = styled('div')(function (_a) {
20873
- var _b;
20874
- var theme = _a.theme;
20875
- return (_b = {
20876
- alignItems: 'center',
20877
- display: 'flex',
20878
- marginLeft: 'auto',
20879
- marginRight: '40px'
20880
- },
20881
- _b[theme.breakpoints.down('sm')] = {
20882
- display: 'none',
20883
- },
20884
- _b[theme.breakpoints.up('sm')] = {
20885
- display: 'flex',
20886
- },
20887
- _b);
20888
- });
20889
- var UserContainer = styled('div')(function () { return ({
20627
+ }));
20628
+ const ToolbarRight = styled('div')(({ theme }) => ({
20629
+ alignItems: 'center',
20630
+ display: 'flex',
20631
+ marginLeft: 'auto',
20632
+ marginRight: '40px',
20633
+ [theme.breakpoints.down('sm')]: {
20634
+ display: 'none',
20635
+ },
20636
+ [theme.breakpoints.up('sm')]: {
20637
+ display: 'flex',
20638
+ },
20639
+ }));
20640
+ const UserContainer = styled('div')(() => ({
20890
20641
  display: 'flex',
20891
20642
  flexDirection: 'column',
20892
20643
  margin: '0 17px',
@@ -20894,133 +20645,117 @@ var UserContainer = styled('div')(function () { return ({
20894
20645
  textTransform: 'none',
20895
20646
  fontWeight: '400',
20896
20647
  color: 'rgba(0, 0, 0, 0.87)',
20897
- }); });
20898
- var AccountName = styled('span')(function () { return ({
20648
+ }));
20649
+ const AccountName = styled('span')(() => ({
20899
20650
  fontSize: '18px',
20900
20651
  lineHeight: '25px',
20901
- }); });
20902
- var ToolbarMenu = styled('div')(function (_a) {
20903
- var _b;
20904
- var theme = _a.theme;
20905
- return _b = {
20906
- backgroundColor: theme.palette.primary.main,
20907
- height: "".concat(dimensions.toolbarMenuHeight, "px"),
20908
- maxHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
20909
- minHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
20910
- width: '100%',
20911
- display: 'flex',
20912
- alignItems: 'center',
20913
- fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
20914
- boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)'
20915
- },
20916
- _b[theme.breakpoints.down('sm')] = {
20917
- display: 'none',
20918
- },
20919
- _b[theme.breakpoints.up('sm')] = {
20920
- display: 'flex',
20921
- },
20922
- _b;
20923
- });
20924
- var MobileToolbarMenu = styled('div')(function (_a) {
20925
- var _b;
20926
- var theme = _a.theme;
20927
- return (_b = {
20928
- backgroundColor: theme.palette.primary.main,
20929
- height: "".concat(dimensions.toolbarMenuHeight, "px"),
20930
- maxHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
20931
- minHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
20932
- width: '100%',
20933
- flexGrow: 1,
20934
- alignItems: 'center',
20935
- fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
20936
- boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)'
20937
- },
20938
- _b[theme.breakpoints.down('sm')] = {
20939
- display: 'flex',
20940
- },
20941
- _b[theme.breakpoints.up('sm')] = {
20652
+ }));
20653
+ const ToolbarMenu = styled('div')(({ theme }) => {
20654
+ return {
20655
+ backgroundColor: theme.palette.primary.main,
20656
+ height: `${dimensions.toolbarMenuHeight}px`,
20657
+ maxHeight: `${dimensions.toolbarMenuHeight}px`,
20658
+ minHeight: `${dimensions.toolbarMenuHeight}px`,
20659
+ width: '100%',
20660
+ display: 'flex',
20661
+ alignItems: 'center',
20662
+ fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
20663
+ boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)',
20664
+ [theme.breakpoints.down('sm')]: {
20942
20665
  display: 'none',
20943
20666
  },
20944
- _b);
20945
- });
20946
- var ToolbarMenuInner = styled('div')(function (_a) {
20947
- var _b;
20948
- var theme = _a.theme;
20949
- return (_b = {
20667
+ [theme.breakpoints.up('sm')]: {
20950
20668
  display: 'flex',
20951
- height: 'fit-content',
20952
- maxWidth: "".concat(dimensions.toolbarMenuWidth, "px"),
20953
- margin: '0 auto'
20954
- },
20955
- _b[theme.breakpoints.down('lg')] = {
20956
- padding: '0 24px',
20957
- },
20958
- _b[theme.breakpoints.up('lg')] = {
20959
- padding: 0,
20960
20669
  },
20961
- _b);
20670
+ };
20962
20671
  });
20963
- var menuItemHoverGreen = '#B9E1CC';
20964
- var ToolbarMenuItem = styled(NavLink)(function (_a) {
20965
- var theme = _a.theme;
20966
- return ({
20967
- alignItems: 'center',
20968
- borderRight: '1px solid #696868',
20969
- color: theme.palette.background.default,
20970
- cursor: 'pointer',
20672
+ const MobileToolbarMenu = styled('div')(({ theme }) => ({
20673
+ backgroundColor: theme.palette.primary.main,
20674
+ height: `${dimensions.toolbarMenuHeight}px`,
20675
+ maxHeight: `${dimensions.toolbarMenuHeight}px`,
20676
+ minHeight: `${dimensions.toolbarMenuHeight}px`,
20677
+ width: '100%',
20678
+ flexGrow: 1,
20679
+ alignItems: 'center',
20680
+ fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
20681
+ boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)',
20682
+ [theme.breakpoints.down('sm')]: {
20971
20683
  display: 'flex',
20972
- fontSize: '16px',
20973
- padding: '0 17px',
20974
- height: '100%',
20975
- textTransform: 'capitalize',
20976
- userSelect: 'none',
20977
- position: 'relative',
20978
- textDecoration: 'none',
20979
- fontWeight: 500,
20980
- ':first-child': {
20981
- paddingLeft: 0,
20982
- ':after': {
20983
- marginLeft: '-24px',
20984
- },
20985
- },
20986
- ':last-child': {
20987
- borderRight: 'none',
20988
- },
20684
+ },
20685
+ [theme.breakpoints.up('sm')]: {
20686
+ display: 'none',
20687
+ },
20688
+ }));
20689
+ const ToolbarMenuInner = styled('div')(({ theme }) => ({
20690
+ display: 'flex',
20691
+ height: 'fit-content',
20692
+ maxWidth: `${dimensions.toolbarMenuWidth}px`,
20693
+ margin: '0 auto',
20694
+ [theme.breakpoints.down('lg')]: {
20695
+ padding: '0 24px',
20696
+ },
20697
+ [theme.breakpoints.up('lg')]: {
20698
+ padding: 0,
20699
+ },
20700
+ }));
20701
+ const menuItemHoverGreen = '#B9E1CC';
20702
+ const ToolbarMenuItem = styled(NavLink)(({ theme }) => ({
20703
+ alignItems: 'center',
20704
+ borderRight: '1px solid #696868',
20705
+ color: theme.palette.background.default,
20706
+ cursor: 'pointer',
20707
+ display: 'flex',
20708
+ fontSize: '16px',
20709
+ padding: '0 17px',
20710
+ height: '100%',
20711
+ textTransform: 'capitalize',
20712
+ userSelect: 'none',
20713
+ position: 'relative',
20714
+ textDecoration: 'none',
20715
+ fontWeight: 500,
20716
+ ':first-child': {
20717
+ paddingLeft: 0,
20989
20718
  ':after': {
20990
- position: 'absolute',
20991
- bottom: 0,
20992
- left: '50%',
20993
- width: '32px',
20994
- marginLeft: '-16px',
20995
- borderBottom: "2px solid ".concat(theme.palette.secondary.light),
20996
- opacity: 0,
20997
- content: '""',
20998
- transition: 'all 0.3s ease',
20999
- pointerEvents: 'none',
21000
- },
21001
- ':focus': {
21002
- outline: 'none',
21003
- color: menuItemHoverGreen,
21004
- ':after': {
21005
- bottom: '-4px',
21006
- opacity: '1',
21007
- },
20719
+ marginLeft: '-24px',
21008
20720
  },
21009
- ':hover': {
21010
- textDecoration: 'none',
21011
- color: menuItemHoverGreen,
21012
- ':after': {
21013
- bottom: '-4px',
21014
- opacity: '1',
21015
- },
20721
+ },
20722
+ ':last-child': {
20723
+ borderRight: 'none',
20724
+ },
20725
+ ':after': {
20726
+ position: 'absolute',
20727
+ bottom: 0,
20728
+ left: '50%',
20729
+ width: '32px',
20730
+ marginLeft: '-16px',
20731
+ borderBottom: `2px solid ${theme.palette.secondary.light}`,
20732
+ opacity: 0,
20733
+ content: '""',
20734
+ transition: 'all 0.3s ease',
20735
+ pointerEvents: 'none',
20736
+ },
20737
+ ':focus': {
20738
+ outline: 'none',
20739
+ color: menuItemHoverGreen,
20740
+ ':after': {
20741
+ bottom: '-4px',
20742
+ opacity: '1',
21016
20743
  },
21017
- '.active:after': {
20744
+ },
20745
+ ':hover': {
20746
+ textDecoration: 'none',
20747
+ color: menuItemHoverGreen,
20748
+ ':after': {
21018
20749
  bottom: '-4px',
21019
20750
  opacity: '1',
21020
20751
  },
21021
- });
21022
- });
21023
- var MobileToolbarMenuItem = styled(NavLink)(function () { return ({
20752
+ },
20753
+ '.active:after': {
20754
+ bottom: '-4px',
20755
+ opacity: '1',
20756
+ },
20757
+ }));
20758
+ const MobileToolbarMenuItem = styled(NavLink)(() => ({
21024
20759
  alignItems: 'center',
21025
20760
  color: 'black',
21026
20761
  cursor: 'pointer',
@@ -21030,24 +20765,23 @@ var MobileToolbarMenuItem = styled(NavLink)(function () { return ({
21030
20765
  userSelect: 'none',
21031
20766
  position: 'relative',
21032
20767
  textDecoration: 'none',
21033
- }); });
20768
+ }));
21034
20769
 
21035
- var MobileAppBar = function (_a) {
21036
- var userMenuItems = _a.userMenuItems, menuItems = _a.menuItems;
21037
- var _b = __read(React.useState(null), 2), anchorElNav = _b[0], setAnchorElNav = _b[1];
21038
- var openNav = Boolean(anchorElNav);
21039
- var handleClickNav = function (event) {
20770
+ const MobileAppBar = ({ userMenuItems, menuItems, }) => {
20771
+ const [anchorElNav, setAnchorElNav] = React.useState(null);
20772
+ const openNav = Boolean(anchorElNav);
20773
+ const handleClickNav = (event) => {
21040
20774
  setAnchorElNav(event.currentTarget);
21041
20775
  };
21042
- var handleCloseNav = function () {
20776
+ const handleCloseNav = () => {
21043
20777
  setAnchorElNav(null);
21044
20778
  };
21045
- var _c = __read(React.useState(null), 2), anchorElMenu = _c[0], setAnchorElMenu = _c[1];
21046
- var openMenu = Boolean(anchorElMenu);
21047
- var handleClickMenu = function (event) {
20779
+ const [anchorElMenu, setAnchorElMenu] = React.useState(null);
20780
+ const openMenu = Boolean(anchorElMenu);
20781
+ const handleClickMenu = (event) => {
21048
20782
  setAnchorElMenu(event.currentTarget);
21049
20783
  };
21050
- var handleCloseMenu = function () {
20784
+ const handleCloseMenu = () => {
21051
20785
  setAnchorElMenu(null);
21052
20786
  };
21053
20787
  return (React.createElement(MobileToolbarMenu, { style: { flexGrow: 1 } },
@@ -21057,40 +20791,39 @@ var MobileAppBar = function (_a) {
21057
20791
  React.createElement(Menu$1, { sx: { color: 'white' } })),
21058
20792
  React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElNav, open: openNav, onClose: handleCloseNav, MenuListProps: {
21059
20793
  'aria-labelledby': 'basic-button',
21060
- } }, menuItems.map(function (page) { return (React.createElement(MobileToolbarMenuItem, { key: page.name, to: page.redirectUrl || '' },
20794
+ } }, menuItems.map((page) => (React.createElement(MobileToolbarMenuItem, { key: page.name, to: page.redirectUrl || '' },
21061
20795
  React.createElement(MenuItem, { sx: {
21062
20796
  width: '100%',
21063
- }, key: page.name }, page.translatedTextRef))); })),
20797
+ }, key: page.name }, page.translatedTextRef))))),
21064
20798
  React.createElement(IconButton, { size: "medium", edge: "end", color: "inherit", "aria-label": "menu", style: { marginLeft: 'auto' }, onClick: handleClickMenu },
21065
20799
  React.createElement(MoreVert, { sx: { color: 'white' } })),
21066
20800
  React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElMenu, open: openMenu, onClose: handleCloseMenu, MenuListProps: {
21067
20801
  'aria-labelledby': 'basic-button',
21068
- } }, userMenuItems.map(function (i, index) { return (React.createElement(Box, { key: i.id },
21069
- React.createElement(MenuItem, { key: i.id, onClick: function () {
20802
+ } }, userMenuItems.map((i, index) => (React.createElement(Box, { key: i.id },
20803
+ React.createElement(MenuItem, { key: i.id, onClick: () => {
21070
20804
  handleCloseMenu();
21071
20805
  i.action && i.action();
21072
20806
  } }, i.isAnchor ? (React.createElement("a", { style: {
21073
20807
  textDecoration: 'inherit',
21074
20808
  color: 'inherit',
21075
20809
  }, rel: "noreferrer", href: i.href }, i.label)) : (i.label)),
21076
- userMenuItems.length > index + 1 && React.createElement(Divider, null))); }))))));
20810
+ userMenuItems.length > index + 1 && React.createElement(Divider, null)))))))));
21077
20811
  };
21078
20812
 
21079
- var AppBar = function (_a) {
21080
- var username = _a.username, currentPath = _a.currentPath, isProd = _a.isProd, appTitle = _a.appTitle, userMenuItems = _a.userMenuItems, menuItems = _a.menuItems, userRole = _a.userRole, colors = _a.colors;
21081
- var _b = __read(React.useState(null), 2), userMenuAnchor = _b[0], setUserMenuAnchor = _b[1];
21082
- var _handleIconButtonClick = function (event) {
20813
+ const AppBar = ({ username, currentPath, isProd, appTitle, userMenuItems, menuItems, userRole, colors, }) => {
20814
+ const [userMenuAnchor, setUserMenuAnchor] = React.useState(null);
20815
+ const _handleIconButtonClick = (event) => {
21083
20816
  event.preventDefault();
21084
20817
  setUserMenuAnchor(event.currentTarget);
21085
20818
  };
21086
- var _handleCloseUserMenu = function () {
20819
+ const _handleCloseUserMenu = () => {
21087
20820
  setUserMenuAnchor(null);
21088
20821
  };
21089
- var _renderToolbarMenuItem = function (page) {
21090
- var isActive = (page === null || page === void 0 ? void 0 : page.exact)
20822
+ const _renderToolbarMenuItem = (page) => {
20823
+ const isActive = page?.exact
21091
20824
  ? currentPath === page.redirectUrl
21092
20825
  : currentPath.includes(page.redirectUrl || '');
21093
- return (React.createElement(ToolbarMenuItem, { className: isActive ? 'active' : '', to: page.redirectUrl || '', key: page.name, tabIndex: 0 }, page === null || page === void 0 ? void 0 : page.translatedTextRef));
20826
+ return (React.createElement(ToolbarMenuItem, { className: isActive ? 'active' : '', to: page.redirectUrl || '', key: page.name, tabIndex: 0 }, page?.translatedTextRef));
21094
20827
  };
21095
20828
  return (React.createElement(Toolbar, null,
21096
20829
  React.createElement(ToolbarFixer, null,
@@ -21112,8 +20845,8 @@ var AppBar = function (_a) {
21112
20845
  }, transformOrigin: {
21113
20846
  vertical: 'top',
21114
20847
  horizontal: 'center',
21115
- } }, userMenuItems.map(function (i, index) {
21116
- return (React.createElement(MenuItem$1, { key: i.id, onClick: function () {
20848
+ } }, userMenuItems.map((i, index) => {
20849
+ return (React.createElement(MenuItem$1, { key: i.id, onClick: () => {
21117
20850
  setUserMenuAnchor(null);
21118
20851
  i.action && i.action();
21119
20852
  }, divider: userMenuItems.length > index + 1, sx: {
@@ -21126,36 +20859,35 @@ var AppBar = function (_a) {
21126
20859
  }, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)));
21127
20860
  })))),
21128
20861
  React.createElement(ToolbarMenu, { role: "navigation" },
21129
- React.createElement(ToolbarMenuInner, null, menuItems.map(function (page) { return _renderToolbarMenuItem(page); }))),
20862
+ React.createElement(ToolbarMenuInner, null, menuItems.map((page) => _renderToolbarMenuItem(page)))),
21130
20863
  React.createElement(MobileAppBar, { menuItems: menuItems, userMenuItems: userMenuItems, colors: colors }))));
21131
20864
  };
21132
20865
 
21133
- var NavGuard = function (_a) {
21134
- var when = _a.when, title = _a.title, txt = _a.txt, txtSave = _a.txtSave, txtCancel = _a.txtCancel, txtDiscard = _a.txtDiscard, onSave = _a.onSave, onCancel = _a.onCancel, onDiscard = _a.onDiscard;
21135
- var _b = __read(React.useState(false), 2), open = _b[0], setOpen = _b[1];
21136
- var _c = __read(React.useState(false), 2), leave = _c[0], setLeave = _c[1];
21137
- var _d = __read(React.useState(), 2), lastLocation = _d[0], setLastLocation = _d[1];
21138
- var dispatch = useDispatch();
21139
- var handleCancel = function () {
20866
+ const NavGuard = ({ when, title, txt, txtSave, txtCancel, txtDiscard, onSave, onCancel, onDiscard, }) => {
20867
+ const [open, setOpen] = React.useState(false);
20868
+ const [leave, setLeave] = React.useState(false);
20869
+ const [lastLocation, setLastLocation] = React.useState();
20870
+ const dispatch = useDispatch();
20871
+ const handleCancel = () => {
21140
20872
  setLeave(false);
21141
20873
  setOpen(false);
21142
20874
  onCancel && onCancel();
21143
20875
  };
21144
- var handleDiscard = function () {
20876
+ const handleDiscard = () => {
21145
20877
  setLeave(true);
21146
20878
  setOpen(false);
21147
20879
  onDiscard && onDiscard();
21148
20880
  lastLocation &&
21149
- window.requestAnimationFrame(function () { return dispatch(push(lastLocation)); });
20881
+ window.requestAnimationFrame(() => dispatch(push(lastLocation)));
21150
20882
  };
21151
- var handleSave = function () {
20883
+ const handleSave = () => {
21152
20884
  onSave && onSave();
21153
20885
  setLeave(true);
21154
20886
  setOpen(false);
21155
20887
  lastLocation &&
21156
- window.requestAnimationFrame(function () { return dispatch(push(lastLocation)); });
20888
+ window.requestAnimationFrame(() => dispatch(push(lastLocation)));
21157
20889
  };
21158
- var handleLeave = function (location) {
20890
+ const handleLeave = (location) => {
21159
20891
  setLastLocation(location);
21160
20892
  setOpen(!leave);
21161
20893
  return !!leave;
@@ -21172,21 +20904,17 @@ var NavGuard = function (_a) {
21172
20904
  onSave && (React.createElement(Button, { onClick: handleSave, color: "primary" }, txtSave))))));
21173
20905
  };
21174
20906
 
21175
- var useStyles$3 = makeStyles()(function (_a) {
21176
- var palette = _a.palette;
21177
- return ({
21178
- discard: {
21179
- color: palette.error.main,
21180
- '&:hover': {
21181
- backgroundColor: hex2rgba(palette.error.main, 0.1),
21182
- },
20907
+ const useStyles$3 = makeStyles()(({ palette }) => ({
20908
+ discard: {
20909
+ color: palette.error.main,
20910
+ '&:hover': {
20911
+ backgroundColor: hex2rgba(palette.error.main, 0.1),
21183
20912
  },
21184
- });
21185
- });
20913
+ },
20914
+ }));
21186
20915
 
21187
- var ConfirmationDialog = function (_a) {
21188
- var open = _a.open, title = _a.title, description = _a.description, warning = _a.warning, onSubmit = _a.onSubmit, onCancel = _a.onCancel, _b = _a.confirmText, confirmText = _b === void 0 ? 'OK' : _b, _c = _a.cancelText, cancelText = _c === void 0 ? 'Avbryt' : _c;
21189
- var classes = useStyles$3().classes;
20916
+ const ConfirmationDialog = ({ open, title, description, warning, onSubmit, onCancel, confirmText = 'OK', cancelText = 'Avbryt', }) => {
20917
+ const { classes } = useStyles$3();
21190
20918
  return (React__default.createElement(Dialog, { open: open },
21191
20919
  React__default.createElement(DialogTitle, null, title),
21192
20920
  React__default.createElement(DialogContent, null,
@@ -21196,62 +20924,56 @@ var ConfirmationDialog = function (_a) {
21196
20924
  React__default.createElement(Button, { className: warning ? classes.discard : '', onClick: onSubmit }, confirmText))));
21197
20925
  };
21198
20926
 
21199
- var ConfirmationServiceContext = React__default.createContext(Promise.reject);
21200
- var ConfirmationServiceProvider = function (_a) {
21201
- var children = _a.children;
21202
- var _b = __read(React__default.useState(null), 2), confirmationState = _b[0], setConfirmationState = _b[1];
21203
- var _c = __read(React__default.useState(false), 2), dialogOpen = _c[0], setDialogOpen = _c[1];
21204
- var awaitingPromiseRef = React__default.useRef();
21205
- var openDialog = function (options) {
20927
+ const ConfirmationServiceContext = React__default.createContext(Promise.reject);
20928
+ const ConfirmationServiceProvider = ({ children, }) => {
20929
+ const [confirmationState, setConfirmationState] = React__default.useState(null);
20930
+ const [dialogOpen, setDialogOpen] = React__default.useState(false);
20931
+ const awaitingPromiseRef = React__default.useRef();
20932
+ const openDialog = (options) => {
21206
20933
  setConfirmationState(options);
21207
20934
  setDialogOpen(true);
21208
- return new Promise(function (resolve, reject) {
21209
- awaitingPromiseRef.current = { resolve: resolve, reject: reject };
20935
+ return new Promise((resolve, reject) => {
20936
+ awaitingPromiseRef.current = { resolve, reject };
21210
20937
  });
21211
20938
  };
21212
- var handleCancel = function () {
20939
+ const handleCancel = () => {
21213
20940
  setDialogOpen(false);
21214
20941
  };
21215
- var handleSubmit = function () {
21216
- var _a;
21217
- (_a = awaitingPromiseRef.current) === null || _a === void 0 ? void 0 : _a.resolve();
20942
+ const handleSubmit = () => {
20943
+ awaitingPromiseRef.current?.resolve();
21218
20944
  setDialogOpen(false);
21219
20945
  };
21220
20946
  return (React__default.createElement(ConfirmationServiceContext.Provider, { value: openDialog },
21221
- React__default.createElement(ConfirmationDialog, __assign({ open: dialogOpen, onSubmit: handleSubmit, onCancel: handleCancel }, confirmationState)),
20947
+ React__default.createElement(ConfirmationDialog, { open: dialogOpen, onSubmit: handleSubmit, onCancel: handleCancel, ...confirmationState }),
21222
20948
  children));
21223
20949
  };
21224
- var useConfirmation = function () {
21225
- return React__default.useContext(ConfirmationServiceContext);
21226
- };
20950
+ const useConfirmation = () => React__default.useContext(ConfirmationServiceContext);
21227
20951
 
21228
- var GrepDialog = function (_a) {
21229
- var open = _a.open, title = _a.title, content = _a.content, onClose = _a.onClose, _b = _a.closeBtnText, closeBtnText = _b === void 0 ? 'Lukk' : _b, props = __rest$1(_a, ["open", "title", "content", "onClose", "closeBtnText"]);
21230
- var actions = [
20952
+ const GrepDialog = ({ open, title, content, onClose, closeBtnText = 'Lukk', ...props }) => {
20953
+ const actions = [
21231
20954
  React__default.createElement(Button, { key: "OK", color: "primary", onClick: onClose }, closeBtnText),
21232
20955
  ];
21233
20956
  if (props.actions)
21234
- actions.push.apply(actions, __spreadArray([], __read(props.actions), false));
20957
+ actions.push(...props.actions);
21235
20958
  return (React__default.createElement(Dialog, { open: open, onClose: onClose },
21236
20959
  React__default.createElement(DialogTitle, null, title),
21237
20960
  React__default.createElement(DialogContent, null, content),
21238
- React__default.createElement(DialogActions, null, actions.map(function (action) { return action; }))));
20961
+ React__default.createElement(DialogActions, null, actions.map((action) => action))));
21239
20962
  };
21240
20963
 
21241
- var GrepDialogServiceContext = React__default.createContext(function () { return null; });
21242
- var GrepDialogServiceProvider = function (_a) {
21243
- var children = _a.children;
21244
- var _b = __read(React__default.useState(false), 2), dialogOpen = _b[0], setDialogOpen = _b[1];
21245
- var _c = __read(React__default.useState({}), 2), dialogState = _c[0], setDialogState = _c[1];
21246
- var openDialog = function (options) {
20964
+ const GrepDialogServiceContext = React__default.createContext(() => null);
20965
+ const GrepDialogServiceProvider = ({ children, }) => {
20966
+ const [dialogOpen, setDialogOpen] = React__default.useState(false);
20967
+ const [dialogState, setDialogState] = React__default.useState({});
20968
+ const openDialog = (options) => {
21247
20969
  setDialogState(options);
21248
20970
  setDialogOpen(true);
21249
20971
  };
21250
20972
  return (React__default.createElement(GrepDialogServiceContext.Provider, { value: openDialog },
21251
- React__default.createElement(GrepDialog, __assign({ open: dialogOpen, onClose: function () { return setDialogOpen(false); } }, dialogState)),
20973
+ React__default.createElement(GrepDialog, { open: dialogOpen, onClose: () => setDialogOpen(false), ...dialogState }),
21252
20974
  children));
21253
20975
  };
21254
- var useGrepDialog = function () { return React__default.useContext(GrepDialogServiceContext); };
20976
+ const useGrepDialog = () => React__default.useContext(GrepDialogServiceContext);
21255
20977
 
21256
20978
  /**
21257
20979
  * lodash (Custom Build) <https://lodash.com/>
@@ -21693,89 +21415,89 @@ function toNumber(value) {
21693
21415
 
21694
21416
  var lodash_throttle = throttle;
21695
21417
 
21696
- var generateElementId = function (element) {
21697
- var tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
21698
- var id = tmpId, index = 1;
21418
+ const generateElementId = (element) => {
21419
+ const tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
21420
+ let id = tmpId, index = 1;
21699
21421
  while (document.getElementById(id)) {
21700
- id = "".concat(tmpId, "-").concat(++index);
21422
+ id = `${tmpId}-${++index}`;
21701
21423
  }
21702
21424
  return id;
21703
21425
  };
21704
- var identifyElement = function (identify) {
21426
+ const identifyElement = (identify) => {
21705
21427
  identify = identify || generateElementId;
21706
- return function (element) {
21428
+ return (element) => {
21707
21429
  !element.id && (element.id = identify(element));
21708
21430
  return element.id;
21709
21431
  };
21710
21432
  };
21711
21433
 
21712
- var initial = {
21434
+ const initial = {
21713
21435
  elements: {},
21714
- setSelected: function () {
21436
+ setSelected: () => {
21715
21437
  throw Error('not implemented');
21716
21438
  },
21717
21439
  };
21718
- var context = React__default.createContext(initial);
21440
+ const context = React__default.createContext(initial);
21719
21441
  context.displayName = 'Grep.ToC.Context';
21720
21442
 
21721
- var defaultSelector = __spreadArray([], __read(new Array(9)), false).map(function (_, i) { return "h".concat(i + 1, ":not([role=\"presentation\"])"); })
21443
+ const defaultSelector = [...new Array(9)]
21444
+ .map((_, i) => `h${i + 1}:not([role="presentation"])`)
21722
21445
  .join(',');
21723
- var GrepTableOfContentProvider = function (_a) {
21724
- var props = __rest$1(_a, []);
21725
- var container = props.container, identifier = props.identifier, onSelected = props.onSelected, classes = props.classes, scrollTarget = props.scrollTarget, children = props.children, _b = props.offsetTop, offsetTop = _b === void 0 ? -10 : _b, _c = props.identifyElementFn, identifyElementFn = _c === void 0 ? identifyElement : _c;
21726
- var _d = __read(useState(), 2), selected = _d[0], _setSelected = _d[1];
21727
- var _e = __read(useState(), 2), initialized = _e[0], setInitialized = _e[1];
21728
- var hash = useSelector(function (s) { return decodeURI(getHash(s)); }).substring(1);
21729
- var scrollToElement = useCallback$1(function (element) {
21730
- var target = scrollTarget || window;
21731
- var elementBounds = element.getBoundingClientRect();
21732
- var elementTop = elementBounds.top - element.clientHeight;
21733
- var top = elementTop - offsetTop;
21734
- target.scrollBy({ top: top });
21446
+ const GrepTableOfContentProvider = ({ ...props }) => {
21447
+ const { container, identifier, onSelected, classes, scrollTarget, children, offsetTop = -10, identifyElementFn = identifyElement, } = props;
21448
+ const [selected, _setSelected] = useState();
21449
+ const [initialized, setInitialized] = useState();
21450
+ const hash = useSelector((s) => decodeURI(getHash(s))).substring(1);
21451
+ const scrollToElement = useCallback$1((element) => {
21452
+ const target = scrollTarget || window;
21453
+ const elementBounds = element.getBoundingClientRect();
21454
+ const elementTop = elementBounds.top - element.clientHeight;
21455
+ const top = elementTop - offsetTop;
21456
+ target.scrollBy({ top });
21735
21457
  }, [scrollTarget, offsetTop]);
21736
- var identify = useMemo$1(function () {
21458
+ const identify = useMemo$1(() => {
21737
21459
  return identifyElementFn(identifier || generateElementId);
21738
21460
  }, [identifier, identifyElementFn]);
21739
- var elements = useContentElements(container, props.selector || defaultSelector, { identify: identify });
21740
- var setSelected = useCallback$1(lodash_throttle(function (element, scroll) {
21461
+ const elements = useContentElements(container, props.selector || defaultSelector, { identify });
21462
+ const setSelected = useCallback$1(lodash_throttle((element, scroll) => {
21741
21463
  element && scroll && scrollToElement(element);
21742
21464
  _setSelected(element);
21743
21465
  }, 50, { trailing: false }), [_setSelected, scrollToElement]);
21744
- var getViewportElement = useCallback$1(function () {
21745
- var records = Object.values(elements);
21466
+ const getViewportElement = useCallback$1(() => {
21467
+ const records = Object.values(elements);
21746
21468
  if (!records.length)
21747
21469
  return;
21748
- var index = records.findIndex(function (e) { return e.getBoundingClientRect().bottom > offsetTop; });
21470
+ const index = records.findIndex((e) => e.getBoundingClientRect().bottom > offsetTop);
21749
21471
  if (index > 0) {
21750
- var rect = records[index].getBoundingClientRect();
21751
- var offset = Math.floor(rect.top - offsetTop);
21752
- var within = offset < rect.height + 20;
21472
+ const rect = records[index].getBoundingClientRect();
21473
+ const offset = Math.floor(rect.top - offsetTop);
21474
+ const within = offset < rect.height + 20;
21753
21475
  return records[within ? index : index - 1];
21754
21476
  }
21755
21477
  return records[index];
21756
21478
  }, [elements, offsetTop]);
21757
21479
  // attach observer to elements
21758
- useEffect(function () {
21759
- var target = scrollTarget || window;
21480
+ useEffect(() => {
21481
+ const target = scrollTarget || window;
21760
21482
  if (!target)
21761
21483
  return;
21762
- var onScroll = lodash_throttle(function () {
21763
- var element = getViewportElement();
21484
+ const onScroll = lodash_throttle(() => {
21485
+ const element = getViewportElement();
21764
21486
  setSelected(element);
21765
21487
  }, 50);
21766
21488
  target.addEventListener('scroll', onScroll, false);
21767
21489
  console.debug('scroll observer attached');
21768
- return function () {
21490
+ return () => {
21769
21491
  console.debug('scroll observer detached');
21770
21492
  return target.removeEventListener('scroll', onScroll);
21771
21493
  };
21772
21494
  }, [scrollTarget, setSelected, offsetTop, getViewportElement]);
21773
21495
  // notify observer when selected change
21774
- useEffect(function () {
21496
+ useEffect(() => {
21775
21497
  selected && onSelected && onSelected(selected);
21776
21498
  }, [selected, onSelected]);
21777
21499
  // observe changes in hash
21778
- useEffect(function () {
21500
+ useEffect(() => {
21779
21501
  if (hash && elements[hash]) {
21780
21502
  console.debug('anchor change, setting selected element');
21781
21503
  setSelected(elements[hash], true);
@@ -21787,17 +21509,15 @@ var GrepTableOfContentProvider = function (_a) {
21787
21509
  setSelected(elements[hash], true);
21788
21510
  setInitialized(true);
21789
21511
  }
21790
- return (React__default.createElement(context.Provider, { value: { elements: elements, selected: selected, classes: classes, setSelected: setSelected } }, children));
21512
+ return (React__default.createElement(context.Provider, { value: { elements, selected, classes, setSelected } }, children));
21791
21513
  };
21792
21514
  GrepTableOfContentProvider.displayName = 'Grep.ToC.Provider';
21793
21515
 
21794
- var useStyles$2 = makeStyles()(function (_a, _b) {
21795
- var palette = _a.palette;
21796
- var lvl = _b.lvl;
21797
- var defaultColor = convertToRgba(palette.primary.main, 0.75);
21798
- var linkcolor = "var(--grep-toc-link-color, ".concat(defaultColor, ")");
21799
- var selectedColor = "var(--grep-toc-selected-color, ".concat(palette.primary.main, ")");
21800
- var focusBackground = "var(--grep-toc-focused-background, ".concat(convertToRgba(palette.primary.main, 0.1), ")");
21516
+ const useStyles$2 = makeStyles()(({ palette }, { lvl }) => {
21517
+ const defaultColor = convertToRgba(palette.primary.main, 0.75);
21518
+ const linkcolor = `var(--grep-toc-link-color, ${defaultColor})`;
21519
+ const selectedColor = `var(--grep-toc-selected-color, ${palette.primary.main})`;
21520
+ const focusBackground = `var(--grep-toc-focused-background, ${convertToRgba(palette.primary.main, 0.1)})`;
21801
21521
  return {
21802
21522
  root: {
21803
21523
  color: linkcolor,
@@ -21813,7 +21533,7 @@ var useStyles$2 = makeStyles()(function (_a, _b) {
21813
21533
  textOverflow: 'ellipsis',
21814
21534
  '&--selected': {
21815
21535
  color: selectedColor,
21816
- borderLeft: "5px solid ".concat(selectedColor),
21536
+ borderLeft: `5px solid ${selectedColor}`,
21817
21537
  },
21818
21538
  '&:focus': {
21819
21539
  outline: 'none',
@@ -21823,48 +21543,47 @@ var useStyles$2 = makeStyles()(function (_a, _b) {
21823
21543
  };
21824
21544
  });
21825
21545
 
21826
- var GrepTableOfContentNavTreeNode = function (props) {
21827
- var linkRef = useRef(null);
21828
- var node = props.node, style = props.style, renderChilds = props.renderChilds, setSelectedValue = props.setSelectedValue, percentageRendered = props.percentageRendered;
21829
- var lvl = node.lvl, el = node.el, index = node.index, children = node.children;
21830
- var _a = useContext(context), selected = _a.selected, setSelected = _a.setSelected, classes = _a.classes, elements = _a.elements;
21831
- var isSelected = el === selected;
21832
- var styles = useStyles$2({ lvl: lvl }).classes;
21833
- var className = clsx('grep-toc__nav-tree-node', isSelected && 'grep-toc__nav-tree-node--selected', styles.root, classes === null || classes === void 0 ? void 0 : classes.node, props.className);
21834
- var _b = __read(useState(false), 2), awaitingRender = _b[0], setAwaitingRender = _b[1];
21835
- var txt = el.innerText;
21836
- var location = useSelector(function (s) { return getLocation(s); });
21837
- var url = "".concat(location.pathname).concat(location.search, "#").concat(node.id);
21838
- useEffect(function () {
21839
- var link = linkRef.current;
21546
+ const GrepTableOfContentNavTreeNode = (props) => {
21547
+ const linkRef = useRef(null);
21548
+ const { node, style, renderChilds, setSelectedValue, percentageRendered } = props;
21549
+ const { lvl, el, index, children } = node;
21550
+ const { selected, setSelected, classes, elements } = useContext(context);
21551
+ const isSelected = el === selected;
21552
+ const { classes: styles } = useStyles$2({ lvl });
21553
+ const className = clsx('grep-toc__nav-tree-node', isSelected && 'grep-toc__nav-tree-node--selected', styles.root, classes?.node, props.className);
21554
+ const [awaitingRender, setAwaitingRender] = useState(false);
21555
+ const txt = el.innerText;
21556
+ const location = useSelector((s) => getLocation(s));
21557
+ const url = `${location.pathname}${location.search}#${node.id}`;
21558
+ useEffect(() => {
21559
+ const link = linkRef.current;
21840
21560
  if (isSelected) {
21841
- link === null || link === void 0 ? void 0 : link.scrollIntoViewIfNeeded();
21561
+ link?.scrollIntoViewIfNeeded();
21842
21562
  //setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
21843
21563
  }
21844
21564
  else if (link === document.activeElement) {
21845
- link === null || link === void 0 ? void 0 : link.blur();
21565
+ link?.blur();
21846
21566
  }
21847
21567
  }, [isSelected, linkRef, setSelectedValue]);
21848
- var tabIndex = isSelected ? 0 : -1;
21849
- useEffect(function () {
21568
+ const tabIndex = isSelected ? 0 : -1;
21569
+ useEffect(() => {
21850
21570
  if (awaitingRender) {
21851
21571
  doSelect();
21852
21572
  setAwaitingRender(false);
21853
21573
  }
21854
21574
  }, [percentageRendered]);
21855
- var doSelect = function (checkAwaitRender) {
21856
- if (checkAwaitRender === void 0) { checkAwaitRender = false; }
21575
+ const doSelect = (checkAwaitRender = false) => {
21857
21576
  window.history.replaceState({}, txt, url);
21858
21577
  setSelected(el, true);
21859
- var values = Object.values(elements);
21860
- var newPercentage = values.findIndex(function (e) { return e === el; }) / values.length + 0.1;
21578
+ const values = Object.values(elements);
21579
+ const newPercentage = values.findIndex((e) => e === el) / values.length + 0.1;
21861
21580
  setSelectedValue(newPercentage);
21862
21581
  if (checkAwaitRender && newPercentage > percentageRendered) {
21863
21582
  setAwaitingRender(true);
21864
21583
  }
21865
21584
  };
21866
21585
  return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
21867
- React__default.createElement(Link$1, { ref: linkRef, className: clsx(styles.link, isSelected && "".concat(styles.link, "--selected")), href: url, tabIndex: tabIndex, onClick: function (event) {
21586
+ React__default.createElement(Link$1, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
21868
21587
  console.debug('node click', node);
21869
21588
  event.preventDefault();
21870
21589
  event.stopPropagation();
@@ -21874,7 +21593,7 @@ var GrepTableOfContentNavTreeNode = function (props) {
21874
21593
  };
21875
21594
  GrepTableOfContentNavTreeNode.displayName = 'Grep.ToC.NavTree.Node';
21876
21595
 
21877
- var useStyles$1 = makeStyles()(function () { return ({
21596
+ const useStyles$1 = makeStyles()(() => ({
21878
21597
  root: {
21879
21598
  listStyle: 'none',
21880
21599
  padding: 0,
@@ -21882,18 +21601,18 @@ var useStyles$1 = makeStyles()(function () { return ({
21882
21601
  fontSize: '.9em',
21883
21602
  },
21884
21603
  },
21885
- }); });
21886
-
21887
- var NavTree = function (props) {
21888
- var elements = props.elements, style = props.style, setSelectedValue = props.setSelectedValue, percentageRendered = props.percentageRendered;
21889
- var classes = useContext(context).classes;
21890
- var styles = useStyles$1().classes;
21891
- var className = clsx('grep-toc__nav-tree', styles.root, classes === null || classes === void 0 ? void 0 : classes.tree, props.className);
21892
- return (React__default.createElement("ul", { className: className, style: style }, Object.values(elements).map(function (node) { return (React__default.createElement(GrepTableOfContentNavTreeNode, { node: node, key: node.index, renderChilds: function (children) { return (React__default.createElement(NavTree, { elements: children, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })); }, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })); })));
21604
+ }));
21605
+
21606
+ const NavTree = (props) => {
21607
+ const { elements, style, setSelectedValue, percentageRendered } = props;
21608
+ const { classes } = useContext(context);
21609
+ const { classes: styles } = useStyles$1();
21610
+ const className = clsx('grep-toc__nav-tree', styles.root, classes?.tree, props.className);
21611
+ return (React__default.createElement("ul", { className: className, style: style }, Object.values(elements).map((node) => (React__default.createElement(GrepTableOfContentNavTreeNode, { node: node, key: node.index, renderChilds: (children) => (React__default.createElement(NavTree, { elements: children, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })), setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })))));
21893
21612
  };
21894
21613
  NavTree.displayName = 'Grep.ToC.NavTree';
21895
21614
 
21896
- var useStyles = makeStyles()(function () { return ({
21615
+ const useStyles = makeStyles()(() => ({
21897
21616
  root: {
21898
21617
  fontSize: 18,
21899
21618
  overflowY: 'scroll',
@@ -21916,54 +21635,47 @@ var useStyles = makeStyles()(function () { return ({
21916
21635
  padding: '2px 5px',
21917
21636
  },
21918
21637
  },
21919
- }); });
21638
+ }));
21920
21639
 
21921
- var getElementLevel = function (el) {
21922
- var res = el.nodeName.match(/H([1-9])/);
21640
+ const getElementLevel = (el) => {
21641
+ const res = el.nodeName.match(/H([1-9])/);
21923
21642
  if (res) {
21924
- var _a = __read(res, 2); _a[0]; var lvl = _a[1];
21643
+ const [_, lvl] = res;
21925
21644
  return Number(lvl);
21926
21645
  }
21927
21646
  return 0;
21928
21647
  };
21929
21648
 
21930
- var normalize = function (elements) {
21931
- return elements.reduce(function (curr, el, index) {
21932
- var _a;
21933
- var id = el.id;
21934
- var lvl = getElementLevel(el, elements[index - 1]);
21935
- var parent = (_a = __spreadArray([], __read(curr), false).reverse().find(function (obj) { return obj.lvl < lvl; })) === null || _a === void 0 ? void 0 : _a.index;
21936
- curr.push({ id: id, el: el, lvl: lvl, parent: parent, index: index });
21649
+ const normalize = (elements) => {
21650
+ return elements.reduce((curr, el, index) => {
21651
+ const { id } = el;
21652
+ const lvl = getElementLevel(el, elements[index - 1]);
21653
+ const parent = [...curr].reverse().find((obj) => obj.lvl < lvl)?.index;
21654
+ curr.push({ id, el, lvl, parent, index });
21937
21655
  return curr;
21938
21656
  }, []);
21939
21657
  };
21940
21658
 
21941
- var nest = function (items, id) {
21942
- return items
21943
- .filter(function (item) { return item.parent === id; })
21944
- .reduce(function (curr, item) {
21945
- var _a;
21946
- return Object.assign(curr, (_a = {},
21947
- _a[item.index] = __assign(__assign({}, item), { children: nest(items, item.index) }),
21948
- _a));
21949
- }, {});
21950
- };
21951
- var buildTree = function (elements, normalizer) {
21952
- if (normalizer === void 0) { normalizer = normalize; }
21953
- var items = normalizer(elements);
21659
+ const nest = (items, id) => items
21660
+ .filter((item) => item.parent === id)
21661
+ .reduce((curr, item) => Object.assign(curr, {
21662
+ [item.index]: { ...item, children: nest(items, item.index) },
21663
+ }), {});
21664
+ const buildTree = (elements, normalizer = normalize) => {
21665
+ const items = normalizer(elements);
21954
21666
  return nest(items);
21955
21667
  };
21956
21668
 
21957
- var GrepTableOfContentNav = function (props) {
21958
- var _a = __read(useState(false), 2), showKeyboardHint = _a[0], setShowKeyboardHint = _a[1];
21959
- var ref = useRef(null);
21960
- var _b = useContext(context), elements = _b.elements, classes = _b.classes, selected = _b.selected, setSelected = _b.setSelected;
21961
- var tree = useMemo$1(function () { return buildTree(Object.values(elements)); }, [elements]);
21962
- var focusSelected = useCallback$1(function () {
21963
- requestAnimationFrame(function () {
21669
+ const GrepTableOfContentNav = (props) => {
21670
+ const [showKeyboardHint, setShowKeyboardHint] = useState(false);
21671
+ const ref = useRef(null);
21672
+ const { elements, classes, selected, setSelected } = useContext(context);
21673
+ const tree = useMemo$1(() => buildTree(Object.values(elements)), [elements]);
21674
+ const focusSelected = useCallback$1(() => {
21675
+ requestAnimationFrame(() => {
21964
21676
  if (!(ref.current instanceof HTMLElement))
21965
21677
  return;
21966
- var active = ref.current.querySelector('[tabindex="0"]');
21678
+ const active = ref.current.querySelector('[tabindex="0"]');
21967
21679
  if (active instanceof HTMLElement) {
21968
21680
  active.focus();
21969
21681
  }
@@ -21972,55 +21684,54 @@ var GrepTableOfContentNav = function (props) {
21972
21684
  }
21973
21685
  });
21974
21686
  }, [ref]);
21975
- var onKeyDown = function (e) {
21687
+ const onKeyDown = (e) => {
21976
21688
  if (selected && e.which === Key_enum.Key.Tab && e.shiftKey === false) {
21977
- var tabindex_1 = selected.getAttribute('tabindex');
21689
+ const tabindex = selected.getAttribute('tabindex');
21978
21690
  selected.setAttribute('tabindex', '0');
21979
21691
  selected.focus();
21980
- requestAnimationFrame(function () {
21981
- tabindex_1 === null
21692
+ requestAnimationFrame(() => {
21693
+ tabindex === null
21982
21694
  ? selected.removeAttribute('tabindex')
21983
- : selected.setAttribute('tabindex', tabindex_1);
21695
+ : selected.setAttribute('tabindex', tabindex);
21984
21696
  });
21985
21697
  }
21986
21698
  if ([Key_enum.Key.UpArrow, Key_enum.Key.DownArrow].includes(e.which)) {
21987
21699
  e.preventDefault();
21988
21700
  e.stopPropagation();
21989
- var nodes = Object.values(elements);
21990
- var currentIndex = nodes.indexOf(selected);
21991
- var moveIndex = e.which === Key_enum.Key.UpArrow ? -1 : 1;
21992
- var next = nodes[currentIndex + moveIndex];
21701
+ const nodes = Object.values(elements);
21702
+ const currentIndex = nodes.indexOf(selected);
21703
+ const moveIndex = e.which === Key_enum.Key.UpArrow ? -1 : 1;
21704
+ const next = nodes[currentIndex + moveIndex];
21993
21705
  next && setSelected(next, true);
21994
21706
  focusSelected();
21995
21707
  }
21996
21708
  };
21997
- useEffect(function () {
21998
- var onKeyDown = function (e) {
21709
+ useEffect(() => {
21710
+ const onKeyDown = (e) => {
21999
21711
  e.keyCode === Key_enum.Key.Alt && setShowKeyboardHint(true);
22000
21712
  if (e.altKey) {
22001
21713
  e.keyCode === Key_enum.Key.I && focusSelected();
22002
21714
  }
22003
21715
  };
22004
- var onKeyUp = function (e) {
21716
+ const onKeyUp = (e) => {
22005
21717
  e.keyCode === Key_enum.Key.Alt && setShowKeyboardHint(false);
22006
21718
  };
22007
21719
  window.addEventListener('keydown', onKeyDown);
22008
21720
  window.addEventListener('keyup', onKeyUp);
22009
- return function () {
21721
+ return () => {
22010
21722
  window.removeEventListener('keydown', onKeyDown);
22011
21723
  window.removeEventListener('keyup', onKeyUp);
22012
21724
  };
22013
21725
  }, [focusSelected]);
22014
- var style = useStyles().classes;
22015
- var className = clsx('grep-toc__nav', style.root, classes === null || classes === void 0 ? void 0 : classes.nav, props.className, showKeyboardHint && style.keyboardHint);
21726
+ const { classes: style } = useStyles();
21727
+ const className = clsx('grep-toc__nav', style.root, classes?.nav, props.className, showKeyboardHint && style.keyboardHint);
22016
21728
  return (React__default.createElement("nav", { className: className, style: props.style, tabIndex: selected ? -1 : 0, onKeyDown: onKeyDown, ref: ref },
22017
21729
  React__default.createElement(NavTree, { elements: tree, setSelectedValue: props.setSelectedValue, percentageRendered: props.percentageRendered })));
22018
21730
  };
22019
21731
  GrepTableOfContentNav.displayName = 'Grep.ToC.Nav';
22020
21732
 
22021
- var GrepTableOfContent = function (_a) {
22022
- var style = _a.style, className = _a.className, setSelectedValue = _a.setSelectedValue, percentageRendered = _a.percentageRendered, props = __rest$1(_a, ["style", "className", "setSelectedValue", "percentageRendered"]);
22023
- return (React__default.createElement(GrepTableOfContentProvider, __assign({}, props),
21733
+ const GrepTableOfContent = ({ style, className, setSelectedValue, percentageRendered, ...props }) => {
21734
+ return (React__default.createElement(GrepTableOfContentProvider, { ...props },
22024
21735
  React__default.createElement(GrepTableOfContentNav, { className: className, style: style, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })));
22025
21736
  };
22026
21737
  GrepTableOfContent.displayName = 'Grep.ToC';