@entur-partner/common 5.3.1 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionBar.d.ts +4 -4
- package/dist/Box.d.ts +22 -22
- package/dist/ConfirmModal.d.ts +1 -1
- package/dist/ErrorBoundary.d.ts +4 -4
- package/dist/ExpandableMultiLanguageInput.d.ts +3 -3
- package/dist/FeatureToggle.d.ts +2 -2
- package/dist/LanguageSelect.d.ts +1 -1
- package/dist/LinkButton.d.ts +2 -2
- package/dist/MultiLanguageInput.d.ts +1 -1
- package/dist/PageTitle.d.ts +3 -2
- package/dist/Stack.d.ts +2 -2
- package/dist/Text.d.ts +6 -6
- package/dist/UserMenu.d.ts +5 -1
- package/dist/common.cjs.development.js +210 -329
- package/dist/common.cjs.development.js.map +1 -1
- package/dist/common.cjs.production.min.js +1 -1
- package/dist/common.cjs.production.min.js.map +1 -1
- package/dist/common.esm.js +213 -331
- package/dist/common.esm.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/styles.css +1371 -1371
- package/package.json +5 -5
- package/dist/PermissionCheckedRoute.d.ts +0 -11
package/dist/common.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { Children, useState, useRef, useEffect, Component } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import { Link as Link$1, Heading6, Paragraph } from '@entur/typography';
|
|
4
|
-
import { NorwayIcon, UKIcon,
|
|
4
|
+
import { NorwayIcon, UKIcon, UserIcon, LogOutIcon, DownArrowIcon, ChannelsIcon } from '@entur/icons';
|
|
5
5
|
import { SecondaryButton, Button, PrimaryButton, ButtonGroup } from '@entur/button';
|
|
6
|
-
import {
|
|
6
|
+
import { Link as Link$2, useNavigate, useInRouterContext, useBlocker } from 'react-router-dom';
|
|
7
7
|
import { SearchableDropdown } from '@entur/dropdown';
|
|
8
8
|
import { SegmentedControl, SegmentedChoice } from '@entur/form';
|
|
9
9
|
import { assertIsDefined, localeDate, localeDateTime, isDate, isDateString, isString, hasAllPermissions, hasOneOfPermissions, splitUrlPath } from '@entur-partner/util';
|
|
@@ -17,26 +17,21 @@ function _extends() {
|
|
|
17
17
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
18
18
|
for (var i = 1; i < arguments.length; i++) {
|
|
19
19
|
var source = arguments[i];
|
|
20
|
-
|
|
21
20
|
for (var key in source) {
|
|
22
21
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
23
22
|
target[key] = source[key];
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
return target;
|
|
29
27
|
};
|
|
30
28
|
return _extends.apply(this, arguments);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
function _inheritsLoose(subClass, superClass) {
|
|
34
31
|
subClass.prototype = Object.create(superClass.prototype);
|
|
35
32
|
subClass.prototype.constructor = subClass;
|
|
36
|
-
|
|
37
33
|
_setPrototypeOf(subClass, superClass);
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
function _setPrototypeOf(o, p) {
|
|
41
36
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
42
37
|
o.__proto__ = p;
|
|
@@ -44,23 +39,20 @@ function _setPrototypeOf(o, p) {
|
|
|
44
39
|
};
|
|
45
40
|
return _setPrototypeOf(o, p);
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
49
43
|
if (source == null) return {};
|
|
50
44
|
var target = {};
|
|
51
45
|
var sourceKeys = Object.keys(source);
|
|
52
46
|
var key, i;
|
|
53
|
-
|
|
54
47
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
55
48
|
key = sourceKeys[i];
|
|
56
49
|
if (excluded.indexOf(key) >= 0) continue;
|
|
57
50
|
target[key] = source[key];
|
|
58
51
|
}
|
|
59
|
-
|
|
60
52
|
return target;
|
|
61
53
|
}
|
|
62
54
|
|
|
63
|
-
var _excluded$
|
|
55
|
+
var _excluded$e = ["as", "children", "contrast", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "padding", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "margin", "display", "justifyContent", "alignItems", "maxWidth", "width", "background", "color", "flexDirection", "flexWrap", "className"];
|
|
64
56
|
function responsiveProp(prefix, prop) {
|
|
65
57
|
if (Array.isArray(prop)) {
|
|
66
58
|
var classes = [];
|
|
@@ -69,40 +61,38 @@ function responsiveProp(prefix, prop) {
|
|
|
69
61
|
prop[2] && classes.push("" + prefix + prop[2] + "-xl");
|
|
70
62
|
return classes;
|
|
71
63
|
}
|
|
72
|
-
|
|
73
64
|
return [prefix + prop];
|
|
74
65
|
}
|
|
75
66
|
var Box = function Box(_ref) {
|
|
76
67
|
var _ref$as = _ref.as,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
68
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
69
|
+
children = _ref.children,
|
|
70
|
+
contrast = _ref.contrast,
|
|
71
|
+
paddingTop = _ref.paddingTop,
|
|
72
|
+
paddingRight = _ref.paddingRight,
|
|
73
|
+
paddingBottom = _ref.paddingBottom,
|
|
74
|
+
paddingLeft = _ref.paddingLeft,
|
|
75
|
+
paddingX = _ref.paddingX,
|
|
76
|
+
paddingY = _ref.paddingY,
|
|
77
|
+
padding = _ref.padding,
|
|
78
|
+
marginTop = _ref.marginTop,
|
|
79
|
+
marginRight = _ref.marginRight,
|
|
80
|
+
marginBottom = _ref.marginBottom,
|
|
81
|
+
marginLeft = _ref.marginLeft,
|
|
82
|
+
marginX = _ref.marginX,
|
|
83
|
+
marginY = _ref.marginY,
|
|
84
|
+
margin = _ref.margin,
|
|
85
|
+
display = _ref.display,
|
|
86
|
+
justifyContent = _ref.justifyContent,
|
|
87
|
+
alignItems = _ref.alignItems,
|
|
88
|
+
maxWidth = _ref.maxWidth,
|
|
89
|
+
width = _ref.width,
|
|
90
|
+
background = _ref.background,
|
|
91
|
+
color = _ref.color,
|
|
92
|
+
flexDirection = _ref.flexDirection,
|
|
93
|
+
flexWrap = _ref.flexWrap,
|
|
94
|
+
className = _ref.className,
|
|
95
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
106
96
|
var classes = [];
|
|
107
97
|
var resolvedPaddingTop = paddingTop || paddingY || padding;
|
|
108
98
|
var resolvedPaddingBottom = paddingBottom || paddingY || padding;
|
|
@@ -123,11 +113,9 @@ var Box = function Box(_ref) {
|
|
|
123
113
|
resolvedMarginRight && classes.push.apply(classes, responsiveProp('eps-mr-', resolvedMarginRight));
|
|
124
114
|
display && classes.push.apply(classes, responsiveProp('eps-', display));
|
|
125
115
|
justifyContent && classes.push.apply(classes, responsiveProp('eps-justify-', justifyContent));
|
|
126
|
-
|
|
127
116
|
if (alignItems) {
|
|
128
117
|
classes.push.apply(classes, responsiveProp('eps-items-', alignItems));
|
|
129
118
|
}
|
|
130
|
-
|
|
131
119
|
maxWidth && classes.push.apply(classes, responsiveProp('eps-max-w-', maxWidth));
|
|
132
120
|
width && classes.push.apply(classes, responsiveProp('eps-w-', width));
|
|
133
121
|
color && classes.push("eps-color-" + color);
|
|
@@ -142,14 +130,12 @@ var Box = function Box(_ref) {
|
|
|
142
130
|
|
|
143
131
|
var Stack = function Stack(_ref) {
|
|
144
132
|
var children = _ref.children,
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
space = _ref.space,
|
|
134
|
+
className = _ref.className;
|
|
147
135
|
var stackItems = Children.toArray(children);
|
|
148
|
-
|
|
149
136
|
if (stackItems.length <= 1) {
|
|
150
137
|
return React.createElement(React.Fragment, null, stackItems);
|
|
151
138
|
}
|
|
152
|
-
|
|
153
139
|
return React.createElement("div", {
|
|
154
140
|
className: className
|
|
155
141
|
}, stackItems.map(function (child, index) {
|
|
@@ -168,14 +154,12 @@ var ActionBarLeft = function ActionBarLeft(_ref) {
|
|
|
168
154
|
className: "eps-action-bar-left"
|
|
169
155
|
}, children);
|
|
170
156
|
};
|
|
171
|
-
|
|
172
157
|
var ActionBarRight = function ActionBarRight(_ref2) {
|
|
173
158
|
var children = _ref2.children;
|
|
174
159
|
return React.createElement("div", {
|
|
175
160
|
className: "eps-action-bar-right"
|
|
176
161
|
}, children);
|
|
177
162
|
};
|
|
178
|
-
|
|
179
163
|
var ActionBar = function ActionBar(_ref3) {
|
|
180
164
|
var children = _ref3.children;
|
|
181
165
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
@@ -185,12 +169,11 @@ var ActionBar = function ActionBar(_ref3) {
|
|
|
185
169
|
}, children));
|
|
186
170
|
};
|
|
187
171
|
|
|
188
|
-
var _excluded$
|
|
172
|
+
var _excluded$d = ["children", "className"];
|
|
189
173
|
var LinkButton = function LinkButton(_ref) {
|
|
190
174
|
var children = _ref.children,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
175
|
+
className = _ref.className,
|
|
176
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
194
177
|
return React.createElement(Link$1, _extends({}, rest, {
|
|
195
178
|
as: "button",
|
|
196
179
|
className: cx('eps-link-button', className)
|
|
@@ -204,10 +187,8 @@ var LinkButton = function LinkButton(_ref) {
|
|
|
204
187
|
* @param flag case sensitive flag. If it is an environment variable
|
|
205
188
|
* you can drop the REACT_APP_ prefix.
|
|
206
189
|
*/
|
|
207
|
-
|
|
208
190
|
function featureFlag(flag) {
|
|
209
191
|
var _window$localStorage, _window$localStorage2;
|
|
210
|
-
|
|
211
192
|
return process.env["REACT_APP_" + flag] === 'true' || ((_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.getItem(flag)) === 'true' || ((_window$localStorage2 = window.localStorage) == null ? void 0 : _window$localStorage2.getItem("REACT_APP_" + flag)) === 'true';
|
|
212
193
|
}
|
|
213
194
|
/**
|
|
@@ -217,40 +198,33 @@ function featureFlag(flag) {
|
|
|
217
198
|
* @param flag case sensitive flag. If it is an environment variable
|
|
218
199
|
* you can drop the REACT_APP_ prefix.
|
|
219
200
|
*/
|
|
220
|
-
|
|
221
201
|
function useFeatureToggle(flag) {
|
|
222
202
|
return featureFlag(flag);
|
|
223
203
|
}
|
|
224
204
|
var FeatureToggle = function FeatureToggle(_ref) {
|
|
225
205
|
var children = _ref.children,
|
|
226
|
-
|
|
206
|
+
flag = _ref.flag;
|
|
227
207
|
var feature = useFeatureToggle(flag);
|
|
228
|
-
|
|
229
208
|
if (feature) {
|
|
230
209
|
return React.createElement(React.Fragment, null, children);
|
|
231
210
|
}
|
|
232
|
-
|
|
233
211
|
return null;
|
|
234
212
|
};
|
|
235
213
|
|
|
236
214
|
var _environmentColors, _humanReadableEnviron;
|
|
237
|
-
|
|
238
215
|
var Environment;
|
|
239
|
-
|
|
240
216
|
(function (Environment) {
|
|
241
217
|
Environment["Local"] = "local";
|
|
242
218
|
Environment["Development"] = "dev";
|
|
243
219
|
Environment["Staging"] = "staging";
|
|
244
220
|
Environment["Production"] = "prod";
|
|
245
221
|
})(Environment || (Environment = {}));
|
|
246
|
-
|
|
247
222
|
var environmentColors = (_environmentColors = {}, _environmentColors[Environment.Local] = '#B482FB', _environmentColors[Environment.Development] = '#5AC39A', _environmentColors[Environment.Staging] = '#FFCA28', _environmentColors);
|
|
248
223
|
/**
|
|
249
224
|
* Gets the color for the given environment. This is the color used for the environment
|
|
250
225
|
* indicator. There is no color for production as it should not have any special environment
|
|
251
226
|
* indication.
|
|
252
227
|
*/
|
|
253
|
-
|
|
254
228
|
var getColorForEnvironment = function getColorForEnvironment(environment) {
|
|
255
229
|
return environmentColors[environment];
|
|
256
230
|
};
|
|
@@ -259,13 +233,12 @@ var getHumanReadableEnvironment = function getHumanReadableEnvironment(environme
|
|
|
259
233
|
return humanReadableEnvironment[environment];
|
|
260
234
|
};
|
|
261
235
|
|
|
262
|
-
var _excluded$
|
|
236
|
+
var _excluded$c = ["title", "accentColor"];
|
|
263
237
|
var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
|
|
264
238
|
var title = _ref.title,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
239
|
+
_ref$accentColor = _ref.accentColor,
|
|
240
|
+
accentColor = _ref$accentColor === void 0 ? '#FF5959' : _ref$accentColor,
|
|
241
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
269
242
|
return React.createElement("svg", _extends({
|
|
270
243
|
width: 257,
|
|
271
244
|
height: 37,
|
|
@@ -290,10 +263,10 @@ var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
|
|
|
290
263
|
};
|
|
291
264
|
var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
292
265
|
var _ref2$as = _ref2.as,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
266
|
+
Component = _ref2$as === void 0 ? 'nav' : _ref2$as,
|
|
267
|
+
className = _ref2.className,
|
|
268
|
+
altText = _ref2.altText,
|
|
269
|
+
environment = _ref2.environment;
|
|
297
270
|
var classList = cx(['eps-logo-wrapper', className]);
|
|
298
271
|
return React.createElement(Component, {
|
|
299
272
|
className: classList
|
|
@@ -306,9 +279,9 @@ var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
|
306
279
|
|
|
307
280
|
var Menu = function Menu(_ref) {
|
|
308
281
|
var _ref$as = _ref.as,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
282
|
+
Component = _ref$as === void 0 ? 'nav' : _ref$as,
|
|
283
|
+
className = _ref.className,
|
|
284
|
+
children = _ref.children;
|
|
312
285
|
var classList = cx(['eds-contrast', 'eps-menu', className]);
|
|
313
286
|
return React.createElement(Component, {
|
|
314
287
|
className: classList
|
|
@@ -317,34 +290,31 @@ var Menu = function Menu(_ref) {
|
|
|
317
290
|
|
|
318
291
|
var Content = function Content(_ref) {
|
|
319
292
|
var _ref$as = _ref.as,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
293
|
+
Component = _ref$as === void 0 ? 'main' : _ref$as,
|
|
294
|
+
className = _ref.className,
|
|
295
|
+
children = _ref.children;
|
|
323
296
|
var classList = cx(['eps-content', className]);
|
|
324
297
|
return React.createElement(Component, {
|
|
325
298
|
className: classList
|
|
326
299
|
}, children);
|
|
327
300
|
};
|
|
328
301
|
|
|
329
|
-
var _excluded$
|
|
302
|
+
var _excluded$b = ["className", "children", "userName", "open", "onOpenChange", "environment"];
|
|
330
303
|
var UserMenu = function UserMenu(_ref) {
|
|
331
304
|
var className = _ref.className,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
var history = useHistory();
|
|
305
|
+
messages = _ref.messages,
|
|
306
|
+
onLogout = _ref.onLogout,
|
|
307
|
+
onLanguageChange = _ref.onLanguageChange,
|
|
308
|
+
userName = _ref.userName,
|
|
309
|
+
language = _ref.language,
|
|
310
|
+
environment = _ref.environment,
|
|
311
|
+
showVersionItem = _ref.showVersionItem,
|
|
312
|
+
showMyProfileItem = _ref.showMyProfileItem,
|
|
313
|
+
onNavigateToMyProfile = _ref.onNavigateToMyProfile;
|
|
342
314
|
var triggerClassList = cx(['eps-user-menu__trigger-button', className]);
|
|
343
|
-
|
|
344
315
|
var _useState = useState(false),
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
316
|
+
open = _useState[0],
|
|
317
|
+
setOpen = _useState[1];
|
|
348
318
|
return React.createElement("div", {
|
|
349
319
|
id: "eps-user-menu"
|
|
350
320
|
}, React.createElement(CustomOverflowMenu, {
|
|
@@ -379,19 +349,10 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
379
349
|
}, React.createElement(UKIcon, {
|
|
380
350
|
size: "1rem",
|
|
381
351
|
inline: true
|
|
382
|
-
})), messages.switchLanguage), showVersionItem && messages.appVersion && React.createElement(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
},
|
|
387
|
-
className: "eps-overflow-menu__item"
|
|
388
|
-
}, React.createElement("span", {
|
|
389
|
-
"aria-hidden": true
|
|
390
|
-
}, React.createElement(ChannelsIcon, {
|
|
391
|
-
className: "eps-version-icon",
|
|
392
|
-
size: "1rem",
|
|
393
|
-
inline: true
|
|
394
|
-
})), messages.appVersion), showMyProfileItem && messages.myProfile && React.createElement(Link$2, {
|
|
352
|
+
})), messages.switchLanguage), showVersionItem && messages.appVersion && React.createElement(VersionCustomOverflowMenuItems, {
|
|
353
|
+
title: messages.appVersion,
|
|
354
|
+
setOpen: setOpen
|
|
355
|
+
}), showMyProfileItem && messages.myProfile && React.createElement(Link$2, {
|
|
395
356
|
to: "/permission-admin/my-profile",
|
|
396
357
|
style: {
|
|
397
358
|
textDecoration: 'none'
|
|
@@ -421,16 +382,14 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
421
382
|
inline: true
|
|
422
383
|
})), messages.logout))));
|
|
423
384
|
};
|
|
424
|
-
|
|
425
385
|
var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
|
|
426
386
|
var className = _ref2.className,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
387
|
+
children = _ref2.children,
|
|
388
|
+
userName = _ref2.userName,
|
|
389
|
+
open = _ref2.open,
|
|
390
|
+
onOpenChange = _ref2.onOpenChange,
|
|
391
|
+
environment = _ref2.environment,
|
|
392
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded$b);
|
|
434
393
|
var overflowItemsClasses = cx('eps-overflow-menu__group', {
|
|
435
394
|
'eps-overflow-menu__group--open': open
|
|
436
395
|
});
|
|
@@ -471,48 +430,57 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
|
|
|
471
430
|
ref: overflowContentRef
|
|
472
431
|
}, children));
|
|
473
432
|
};
|
|
474
|
-
|
|
475
433
|
var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
476
434
|
return React.createElement("button", _extends({
|
|
477
435
|
className: cx(props.className, 'eps-overflow-menu__item'),
|
|
478
436
|
role: "menuitem"
|
|
479
437
|
}, props));
|
|
480
438
|
};
|
|
481
|
-
|
|
439
|
+
var VersionCustomOverflowMenuItems = function VersionCustomOverflowMenuItems(_ref3) {
|
|
440
|
+
var title = _ref3.title,
|
|
441
|
+
setOpen = _ref3.setOpen;
|
|
442
|
+
var navigate = useNavigate(); // Hide useNavigate from standalone micro-frontends because it is not under RouterProvider
|
|
443
|
+
return React.createElement(CustomOverflowMenuItem, {
|
|
444
|
+
onClick: function onClick() {
|
|
445
|
+
navigate('/app-version');
|
|
446
|
+
setOpen(false);
|
|
447
|
+
},
|
|
448
|
+
className: "eps-overflow-menu__item"
|
|
449
|
+
}, React.createElement("span", {
|
|
450
|
+
"aria-hidden": true
|
|
451
|
+
}, React.createElement(ChannelsIcon, {
|
|
452
|
+
className: "eps-version-icon",
|
|
453
|
+
size: "1rem",
|
|
454
|
+
inline: true
|
|
455
|
+
})), title);
|
|
456
|
+
};
|
|
482
457
|
function elementContainsEventTarget(element, event) {
|
|
483
458
|
if (!element) {
|
|
484
459
|
return false;
|
|
485
460
|
}
|
|
486
|
-
|
|
487
461
|
if (element.contains(event.target)) {
|
|
488
462
|
return true;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
463
|
+
}
|
|
464
|
+
// For elements inside a Shadow DOM we need to check the composedPath
|
|
492
465
|
if (event.composed && event.composedPath) {
|
|
493
466
|
var contains = event.composedPath().find(function (target) {
|
|
494
467
|
if (target === window) {
|
|
495
468
|
return false;
|
|
496
469
|
}
|
|
497
|
-
|
|
498
470
|
return element.contains(target);
|
|
499
471
|
});
|
|
500
472
|
return contains ? true : false;
|
|
501
473
|
}
|
|
502
|
-
|
|
503
474
|
return false;
|
|
504
475
|
}
|
|
505
|
-
|
|
506
476
|
function useOutsideClick(ref, buttonRef, handler) {
|
|
507
477
|
React.useEffect(function () {
|
|
508
478
|
var listener = function listener(event) {
|
|
509
479
|
if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
|
|
510
480
|
return;
|
|
511
481
|
}
|
|
512
|
-
|
|
513
482
|
handler();
|
|
514
483
|
};
|
|
515
|
-
|
|
516
484
|
document.addEventListener('mousedown', listener);
|
|
517
485
|
document.addEventListener('touchstart', listener);
|
|
518
486
|
return function () {
|
|
@@ -522,14 +490,13 @@ function useOutsideClick(ref, buttonRef, handler) {
|
|
|
522
490
|
}, [ref, buttonRef, handler]);
|
|
523
491
|
}
|
|
524
492
|
|
|
525
|
-
var _excluded$
|
|
493
|
+
var _excluded$a = ["label", "organisations", "onChange", "selectedOrganisationId"];
|
|
526
494
|
var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
527
495
|
var label = _ref.label,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
496
|
+
organisations = _ref.organisations,
|
|
497
|
+
handleChange = _ref.onChange,
|
|
498
|
+
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
499
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
533
500
|
var selectedOrganisation = organisations.find(function (org) {
|
|
534
501
|
return org.id === selectedOrganisationId;
|
|
535
502
|
});
|
|
@@ -561,7 +528,6 @@ function useEventListener(eventName, handler, element) {
|
|
|
561
528
|
if (element === void 0) {
|
|
562
529
|
element = window;
|
|
563
530
|
}
|
|
564
|
-
|
|
565
531
|
var savedHandler = useRef();
|
|
566
532
|
useEffect(function () {
|
|
567
533
|
savedHandler.current = handler;
|
|
@@ -569,11 +535,9 @@ function useEventListener(eventName, handler, element) {
|
|
|
569
535
|
useEffect(function () {
|
|
570
536
|
var isSupported = element && element.addEventListener;
|
|
571
537
|
if (!isSupported) return;
|
|
572
|
-
|
|
573
538
|
var eventListener = function eventListener(event) {
|
|
574
539
|
return savedHandler.current == null ? void 0 : savedHandler.current(event);
|
|
575
540
|
};
|
|
576
|
-
|
|
577
541
|
element.addEventListener(eventName, eventListener);
|
|
578
542
|
return function () {
|
|
579
543
|
element.removeEventListener(eventName, eventListener);
|
|
@@ -581,21 +545,19 @@ function useEventListener(eventName, handler, element) {
|
|
|
581
545
|
}, [eventName, element]);
|
|
582
546
|
}
|
|
583
547
|
|
|
584
|
-
var _excluded$
|
|
548
|
+
var _excluded$9 = ["language", "options", "className", "onChange"];
|
|
585
549
|
var LanguageSelect = function LanguageSelect(_ref) {
|
|
586
550
|
var language = _ref.language,
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
551
|
+
options = _ref.options,
|
|
552
|
+
className = _ref.className,
|
|
553
|
+
_onChange = _ref.onChange,
|
|
554
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
592
555
|
var classNames = cx('eps-language-select', className);
|
|
593
556
|
return React.createElement("div", _extends({}, rest, {
|
|
594
557
|
className: classNames
|
|
595
558
|
}), React.createElement(SegmentedControl, {
|
|
596
559
|
onChange: function onChange(language) {
|
|
597
560
|
assertIsDefined(language);
|
|
598
|
-
|
|
599
561
|
_onChange(language);
|
|
600
562
|
},
|
|
601
563
|
selectedValue: language
|
|
@@ -609,30 +571,26 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
609
571
|
})));
|
|
610
572
|
};
|
|
611
573
|
|
|
612
|
-
var _excluded$
|
|
574
|
+
var _excluded$8 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
|
|
613
575
|
var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
614
576
|
var title = _ref.title,
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
577
|
+
InputComponent = _ref.inputComponent,
|
|
578
|
+
languages = _ref.languages,
|
|
579
|
+
values = _ref.values,
|
|
580
|
+
onChange = _ref.onChange,
|
|
581
|
+
name = _ref.name,
|
|
582
|
+
variant = _ref.variant,
|
|
583
|
+
feedback = _ref.feedback,
|
|
584
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
624
585
|
var handleOnChange = function handleOnChange(language, value) {
|
|
625
586
|
var changes = _extends({}, values);
|
|
626
|
-
|
|
627
587
|
if (value === '' || !value) {
|
|
628
588
|
delete changes[language];
|
|
629
589
|
} else {
|
|
630
590
|
changes[language] = value;
|
|
631
591
|
}
|
|
632
|
-
|
|
633
592
|
onChange(changes);
|
|
634
593
|
};
|
|
635
|
-
|
|
636
594
|
return React.createElement(ExpandablePanel, {
|
|
637
595
|
title: title,
|
|
638
596
|
defaultOpen: true,
|
|
@@ -645,8 +603,8 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
|
645
603
|
space: "medium"
|
|
646
604
|
}, languages.map(function (_ref2) {
|
|
647
605
|
var langKey = _ref2.value,
|
|
648
|
-
|
|
649
|
-
|
|
606
|
+
label = _ref2.label,
|
|
607
|
+
required = _ref2.required;
|
|
650
608
|
return React.createElement(InputComponent, _extends({
|
|
651
609
|
"data-testid": "multi-lang-input-" + name + "-" + langKey,
|
|
652
610
|
key: title + langKey,
|
|
@@ -662,35 +620,31 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
|
662
620
|
})));
|
|
663
621
|
};
|
|
664
622
|
|
|
665
|
-
var _excluded$
|
|
623
|
+
var _excluded$7 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
|
|
666
624
|
/**
|
|
667
625
|
* @deprecated use ExpandableMultiLanguageInput
|
|
668
626
|
*/
|
|
669
|
-
|
|
670
627
|
var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
671
628
|
var className = _ref.className,
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
629
|
+
InputComponent = _ref.inputComponent,
|
|
630
|
+
alertLabel = _ref.alertLabel,
|
|
631
|
+
alertLevel = _ref.alertLevel,
|
|
632
|
+
name = _ref.name,
|
|
633
|
+
languages = _ref.languages,
|
|
634
|
+
values = _ref.values,
|
|
635
|
+
onChange = _ref.onChange,
|
|
636
|
+
_ref$defaultLanguage = _ref.defaultLanguage,
|
|
637
|
+
defaultLanguage = _ref$defaultLanguage === void 0 ? 'nob' : _ref$defaultLanguage,
|
|
638
|
+
_ref$label = _ref.label,
|
|
639
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
640
|
+
_ref$onBlur = _ref.onBlur,
|
|
641
|
+
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
642
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
687
643
|
var _useState = useState(defaultLanguage),
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
644
|
+
language = _useState[0],
|
|
645
|
+
setLanguage = _useState[1];
|
|
691
646
|
var classNames = cx('multi-language-input', className);
|
|
692
647
|
var currentValue = values[language];
|
|
693
|
-
|
|
694
648
|
var handleOnBlur = function handleOnBlur(e) {
|
|
695
649
|
e.persist();
|
|
696
650
|
var currentTarget = e.currentTarget;
|
|
@@ -700,23 +654,18 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
700
654
|
}
|
|
701
655
|
}, 0);
|
|
702
656
|
};
|
|
703
|
-
|
|
704
657
|
var handleLanguageChange = function handleLanguageChange(language) {
|
|
705
658
|
setLanguage(language);
|
|
706
659
|
};
|
|
707
|
-
|
|
708
660
|
var handleOnChange = function handleOnChange(value) {
|
|
709
661
|
var changes = Object.assign({}, values);
|
|
710
|
-
|
|
711
662
|
if (value === '' || !value) {
|
|
712
663
|
delete changes[language];
|
|
713
664
|
} else {
|
|
714
665
|
changes[language] = value;
|
|
715
666
|
}
|
|
716
|
-
|
|
717
667
|
onChange(changes);
|
|
718
668
|
};
|
|
719
|
-
|
|
720
669
|
return React.createElement("div", {
|
|
721
670
|
className: classNames,
|
|
722
671
|
tabIndex: 0,
|
|
@@ -743,12 +692,11 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
743
692
|
}, rest))));
|
|
744
693
|
};
|
|
745
694
|
|
|
746
|
-
var _excluded$
|
|
695
|
+
var _excluded$6 = ["children", "className"];
|
|
747
696
|
var Unbutton = function Unbutton(_ref) {
|
|
748
697
|
var children = _ref.children,
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
698
|
+
className = _ref.className,
|
|
699
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
752
700
|
return React.createElement(Button, _extends({
|
|
753
701
|
variant: "primary"
|
|
754
702
|
}, rest, {
|
|
@@ -763,40 +711,31 @@ function isFunction(functionToCheck) {
|
|
|
763
711
|
var newAppVersionErrorMessage = "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.";
|
|
764
712
|
var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
765
713
|
_inheritsLoose(ErrorBoundary, _Component);
|
|
766
|
-
|
|
767
714
|
function ErrorBoundary(props) {
|
|
768
715
|
var _this;
|
|
769
|
-
|
|
770
716
|
_this = _Component.call(this, props) || this;
|
|
771
717
|
_this.state = {
|
|
772
718
|
error: null
|
|
773
719
|
};
|
|
774
720
|
return _this;
|
|
775
721
|
}
|
|
776
|
-
|
|
777
722
|
ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
|
|
778
723
|
return {
|
|
779
724
|
error: error
|
|
780
725
|
};
|
|
781
726
|
};
|
|
782
|
-
|
|
783
727
|
var _proto = ErrorBoundary.prototype;
|
|
784
|
-
|
|
785
728
|
_proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
|
|
786
729
|
var _this$props$handleErr, _this$props;
|
|
787
|
-
|
|
788
730
|
// React always logs in development
|
|
789
731
|
(_this$props$handleErr = (_this$props = this.props).handleError) == null ? void 0 : _this$props$handleErr.call(_this$props, error, errorInfo);
|
|
790
732
|
};
|
|
791
|
-
|
|
792
733
|
_proto.render = function render() {
|
|
793
734
|
var _this2 = this;
|
|
794
|
-
|
|
795
735
|
var error = this.state.error;
|
|
796
736
|
var _this$props2 = this.props,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
737
|
+
fallback = _this$props2.fallback,
|
|
738
|
+
children = _this$props2.children;
|
|
800
739
|
if (error) {
|
|
801
740
|
if (isFunction(fallback)) {
|
|
802
741
|
return fallback({
|
|
@@ -810,17 +749,13 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
810
749
|
} else if (error.name === 'NotFoundError' && error.message === newAppVersionErrorMessage) {
|
|
811
750
|
return React.createElement(RefreshBannerInfo, null);
|
|
812
751
|
}
|
|
813
|
-
|
|
814
752
|
return fallback;
|
|
815
753
|
}
|
|
816
|
-
|
|
817
754
|
return children;
|
|
818
755
|
};
|
|
819
|
-
|
|
820
756
|
return ErrorBoundary;
|
|
821
757
|
}(Component);
|
|
822
758
|
var LANGUAGE_STORAGE_KEY = 'EP::locale';
|
|
823
|
-
|
|
824
759
|
function RefreshBannerInfo() {
|
|
825
760
|
// Taken from ./app-shell/src/storage.ts
|
|
826
761
|
var language = localStorage.getItem(LANGUAGE_STORAGE_KEY);
|
|
@@ -841,25 +776,23 @@ function RefreshBannerInfo() {
|
|
|
841
776
|
}, isNorwegian ? 'Oppdater' : 'Refresh')));
|
|
842
777
|
}
|
|
843
778
|
|
|
844
|
-
var _excluded$
|
|
779
|
+
var _excluded$5 = ["date", "locale", "as", "hideTime"];
|
|
845
780
|
var FormatDateTime = function FormatDateTime(_ref) {
|
|
846
781
|
var date = _ref.date,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
782
|
+
locale = _ref.locale,
|
|
783
|
+
_ref$as = _ref.as,
|
|
784
|
+
Component = _ref$as === void 0 ? 'main' : _ref$as,
|
|
785
|
+
hideTime = _ref.hideTime,
|
|
786
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
853
787
|
return React.createElement(Component, _extends({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
|
|
854
788
|
};
|
|
855
789
|
|
|
856
|
-
var _excluded$
|
|
790
|
+
var _excluded$4 = ["amount", "as"];
|
|
857
791
|
var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
858
792
|
var amount = _ref.amount,
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
793
|
+
_ref$as = _ref.as,
|
|
794
|
+
Component = _ref$as === void 0 ? 'span' : _ref$as,
|
|
795
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
863
796
|
var parsedAmount = Number(amount) || 0;
|
|
864
797
|
var formattedAmount = new Intl.NumberFormat('nb-NO', {
|
|
865
798
|
maximumFractionDigits: 2,
|
|
@@ -868,19 +801,18 @@ var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
|
868
801
|
return React.createElement(Component, _extends({}, rest), formattedAmount);
|
|
869
802
|
};
|
|
870
803
|
|
|
871
|
-
var _excluded$
|
|
804
|
+
var _excluded$3 = ["items", "locale", "className"];
|
|
872
805
|
var AuditInfo = function AuditInfo(_ref) {
|
|
873
806
|
var items = _ref.items,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
807
|
+
locale = _ref.locale,
|
|
808
|
+
className = _ref.className,
|
|
809
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
878
810
|
var classNames = cx('ep-audit-info', className);
|
|
879
811
|
return React.createElement("div", _extends({
|
|
880
812
|
className: classNames
|
|
881
813
|
}, rest), items.map(function (_ref2, i) {
|
|
882
814
|
var label = _ref2.label,
|
|
883
|
-
|
|
815
|
+
value = _ref2.value;
|
|
884
816
|
return React.createElement(Stack, {
|
|
885
817
|
space: "small",
|
|
886
818
|
key: i
|
|
@@ -893,21 +825,20 @@ var AuditInfo = function AuditInfo(_ref) {
|
|
|
893
825
|
}));
|
|
894
826
|
};
|
|
895
827
|
|
|
896
|
-
var _excluded$
|
|
828
|
+
var _excluded$2 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
|
|
897
829
|
var ConfirmModal = function ConfirmModal(_ref) {
|
|
898
830
|
var _ref$isOpen = _ref.isOpen,
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
831
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
832
|
+
children = _ref.children,
|
|
833
|
+
message = _ref.message,
|
|
834
|
+
_ref$size = _ref.size,
|
|
835
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
836
|
+
buttons = _ref.buttons,
|
|
837
|
+
onConfirm = _ref.onConfirm,
|
|
838
|
+
messages = _ref.messages,
|
|
839
|
+
onClose = _ref.onClose,
|
|
840
|
+
onDismiss = _ref.onDismiss,
|
|
841
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
911
842
|
var childrenToRender = children ? children : message;
|
|
912
843
|
var handleDismiss = onClose ? onClose : onDismiss;
|
|
913
844
|
return React.createElement(Modal, _extends({
|
|
@@ -925,54 +856,37 @@ var ConfirmModal = function ConfirmModal(_ref) {
|
|
|
925
856
|
}, messages.confirm)) : buttons));
|
|
926
857
|
};
|
|
927
858
|
|
|
928
|
-
var _excluded$
|
|
859
|
+
var _excluded$1 = ["children", "shouldBlockNavigation"];
|
|
929
860
|
var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
930
861
|
var children = _ref.children,
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
var
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
setStatus('BLOCKED');
|
|
951
|
-
setLastLocation(nextLocation);
|
|
952
|
-
return false;
|
|
862
|
+
shouldBlockNavigation = _ref.shouldBlockNavigation,
|
|
863
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
864
|
+
assertIsDefined(useInRouterContext() ? true : undefined, "RouteLeavingGuard must be used within a data router.");
|
|
865
|
+
var blocker = useBlocker(function (_ref2) {
|
|
866
|
+
var currentLocation = _ref2.currentLocation,
|
|
867
|
+
nextLocation = _ref2.nextLocation;
|
|
868
|
+
return currentLocation.pathname !== nextLocation.pathname && shouldBlockNavigation(nextLocation);
|
|
869
|
+
});
|
|
870
|
+
return React.createElement(ConfirmModal, _extends({
|
|
871
|
+
onDismiss: function onDismiss() {
|
|
872
|
+
if (blocker.state === 'blocked') {
|
|
873
|
+
blocker.reset();
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
open: blocker.state === 'blocked',
|
|
877
|
+
onConfirm: function onConfirm() {
|
|
878
|
+
if (blocker.state === 'blocked') {
|
|
879
|
+
blocker.proceed();
|
|
880
|
+
}
|
|
953
881
|
}
|
|
954
|
-
|
|
955
|
-
return true;
|
|
956
|
-
};
|
|
957
|
-
|
|
958
|
-
var handleConfirm = function handleConfirm() {
|
|
959
|
-
history.push(lastLocation.pathname);
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
return React.createElement(React.Fragment, null, React.createElement(Prompt, {
|
|
963
|
-
message: allowNavigation
|
|
964
|
-
}), React.createElement(ConfirmModal, _extends({
|
|
965
|
-
onDismiss: closeModal,
|
|
966
|
-
open: status === 'BLOCKED',
|
|
967
|
-
onConfirm: handleConfirm
|
|
968
|
-
}, rest), children));
|
|
882
|
+
}, rest), children);
|
|
969
883
|
};
|
|
970
884
|
|
|
971
885
|
var Pager = function Pager(_ref) {
|
|
972
886
|
var collectionSize = _ref.collectionSize,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
887
|
+
pageSize = _ref.pageSize,
|
|
888
|
+
_onPageChange = _ref.onPageChange,
|
|
889
|
+
currentPage = _ref.currentPage;
|
|
976
890
|
var pageCount = Math.ceil(collectionSize / pageSize);
|
|
977
891
|
return React.createElement(Pagination, {
|
|
978
892
|
pageCount: pageCount,
|
|
@@ -985,12 +899,12 @@ var Pager = function Pager(_ref) {
|
|
|
985
899
|
|
|
986
900
|
var StatusLabel = function StatusLabel(_ref) {
|
|
987
901
|
var _ref$active = _ref.active,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
902
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
903
|
+
_ref$label = _ref.label,
|
|
904
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
905
|
+
aggressiveInactive = _ref.aggressiveInactive,
|
|
906
|
+
showBullet = _ref.showBullet,
|
|
907
|
+
center = _ref.center;
|
|
994
908
|
var bulletClassNames = cx('eps-status-label__bullet', {
|
|
995
909
|
active: active,
|
|
996
910
|
aggressive: aggressiveInactive
|
|
@@ -1010,51 +924,25 @@ var StatusLabel = function StatusLabel(_ref) {
|
|
|
1010
924
|
* check BusinessCapabilities but because it represents a minimal subset of
|
|
1011
925
|
* what we need to check.
|
|
1012
926
|
*/
|
|
1013
|
-
|
|
1014
927
|
var PermissionCheck = function PermissionCheck(_ref) {
|
|
1015
928
|
var children = _ref.children,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
929
|
+
_ref$fallback = _ref.fallback,
|
|
930
|
+
fallback = _ref$fallback === void 0 ? null : _ref$fallback,
|
|
931
|
+
permissions = _ref.permissions,
|
|
932
|
+
_ref$oneOf = _ref.oneOf,
|
|
933
|
+
oneOf = _ref$oneOf === void 0 ? [] : _ref$oneOf,
|
|
934
|
+
_ref$all = _ref.all,
|
|
935
|
+
all = _ref$all === void 0 ? [] : _ref$all;
|
|
1023
936
|
var allIsAllowed = hasAllPermissions(all, permissions);
|
|
1024
937
|
var oneOfIsAllowed = hasOneOfPermissions(oneOf, permissions);
|
|
1025
938
|
var allowed = allIsAllowed && oneOfIsAllowed;
|
|
1026
939
|
return React.createElement(React.Fragment, null, allowed ? children : fallback);
|
|
1027
940
|
};
|
|
1028
941
|
|
|
1029
|
-
var _excluded$1 = ["children", "actualPermissions", "all", "oneOf", "onReject"];
|
|
1030
|
-
var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
|
|
1031
|
-
var children = _ref.children,
|
|
1032
|
-
actualPermissions = _ref.actualPermissions,
|
|
1033
|
-
all = _ref.all,
|
|
1034
|
-
oneOf = _ref.oneOf,
|
|
1035
|
-
onReject = _ref.onReject,
|
|
1036
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1037
|
-
|
|
1038
|
-
var redirect = React.createElement(Redirect, {
|
|
1039
|
-
to: {
|
|
1040
|
-
pathname: '/unauthorized',
|
|
1041
|
-
state: {
|
|
1042
|
-
from: props.location
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
return React.createElement(PermissionCheck, {
|
|
1047
|
-
permissions: actualPermissions,
|
|
1048
|
-
all: all,
|
|
1049
|
-
oneOf: oneOf,
|
|
1050
|
-
fallback: onReject ? onReject : redirect
|
|
1051
|
-
}, React.createElement(Route, _extends({}, props), children));
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
942
|
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
1055
943
|
var prependBreadcrumbItem = _ref.prependBreadcrumbItem,
|
|
1056
|
-
|
|
1057
|
-
|
|
944
|
+
pathname = _ref.pathname,
|
|
945
|
+
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
1058
946
|
var paths = splitUrlPath(pathname);
|
|
1059
947
|
var breadcrumbs = paths.map(function (path) {
|
|
1060
948
|
return {
|
|
@@ -1067,27 +955,23 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
|
1067
955
|
});
|
|
1068
956
|
var breadcrumbElements = breadcrumbs.map(function (_ref3, i) {
|
|
1069
957
|
var title = _ref3.title,
|
|
1070
|
-
|
|
958
|
+
path = _ref3.path;
|
|
1071
959
|
var isLast = i === breadcrumbs.length - 1;
|
|
1072
|
-
|
|
1073
960
|
if (isLast) {
|
|
1074
961
|
return React.createElement(BreadcrumbItem, {
|
|
1075
962
|
key: path,
|
|
1076
963
|
as: 'span'
|
|
1077
964
|
}, title);
|
|
1078
965
|
}
|
|
1079
|
-
|
|
1080
966
|
return React.createElement(BreadcrumbItem, {
|
|
1081
967
|
key: path,
|
|
1082
968
|
as: Link$2,
|
|
1083
969
|
to: path
|
|
1084
970
|
}, title);
|
|
1085
971
|
});
|
|
1086
|
-
|
|
1087
972
|
if (prependBreadcrumbItem) {
|
|
1088
973
|
return React.createElement(BreadcrumbNavigation, null, [prependBreadcrumbItem].concat(breadcrumbElements));
|
|
1089
974
|
}
|
|
1090
|
-
|
|
1091
975
|
return React.createElement(BreadcrumbNavigation, null, breadcrumbElements);
|
|
1092
976
|
};
|
|
1093
977
|
|
|
@@ -1100,15 +984,14 @@ var Link = function Link(props) {
|
|
|
1100
984
|
var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
1101
985
|
var Text = function Text(_ref) {
|
|
1102
986
|
var _ref$as = _ref.as,
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
987
|
+
component = _ref$as === void 0 ? 'span' : _ref$as,
|
|
988
|
+
children = _ref.children,
|
|
989
|
+
fontSize = _ref.fontSize,
|
|
990
|
+
color = _ref.color,
|
|
991
|
+
lineHeight = _ref.lineHeight,
|
|
992
|
+
fontWeight = _ref.fontWeight,
|
|
993
|
+
className = _ref.className,
|
|
994
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1112
995
|
var classes = [];
|
|
1113
996
|
fontSize && classes.push.apply(classes, responsiveProp('eps-font-size-', fontSize));
|
|
1114
997
|
lineHeight && classes.push.apply(classes, responsiveProp('eps-line-height-', lineHeight));
|
|
@@ -1129,10 +1012,9 @@ var Text = function Text(_ref) {
|
|
|
1129
1012
|
* @param Props.onBreadcrumbLookup - A function that takes a path and returns a i18n translated string or undefined
|
|
1130
1013
|
* @returns A Helmet component with updated title
|
|
1131
1014
|
*/
|
|
1132
|
-
|
|
1133
1015
|
function PageTitle(_ref) {
|
|
1134
1016
|
var pathname = _ref.pathname,
|
|
1135
|
-
|
|
1017
|
+
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
1136
1018
|
var paths = splitUrlPath(pathname);
|
|
1137
1019
|
var pageTitles = paths.map(function (path) {
|
|
1138
1020
|
return {
|
|
@@ -1149,5 +1031,5 @@ function PageTitle(_ref) {
|
|
|
1149
1031
|
return React.createElement(Helmet, null, React.createElement("title", null, pageTitles, " | Entur Partner"));
|
|
1150
1032
|
}
|
|
1151
1033
|
|
|
1152
|
-
export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck,
|
|
1034
|
+
export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck, RouteLeavingGuard, Stack, StatusLabel, Text, Unbutton, UserMenu, featureFlag, getColorForEnvironment, getHumanReadableEnvironment, responsiveProp, useEventListener, useFeatureToggle };
|
|
1153
1035
|
//# sourceMappingURL=common.esm.js.map
|