@norges-domstoler/dds-components 13.8.0 → 13.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AppShell/AppShell.d.ts +10 -1
- package/dist/cjs/components/AppShell/AppShell.stories.d.ts +8 -3
- package/dist/cjs/components/AppShell/AppShellContext.d.ts +10 -0
- package/dist/cjs/components/AppShell/Navigation/Navigation.d.ts +2 -1
- package/dist/cjs/components/AppShell/Navigation/NavigationItem.d.ts +5 -2
- package/dist/cjs/components/AppShell/Navigation/TopBar.d.ts +2 -1
- package/dist/cjs/components/Select/Select.styles.d.ts +1 -1
- package/dist/cjs/components/Select/Select.tokens.d.ts +3 -1
- package/dist/cjs/index.js +155 -86
- package/dist/components/AppShell/AppShell.d.ts +10 -1
- package/dist/components/AppShell/AppShell.js +41 -23
- package/dist/components/AppShell/AppShell.stories.d.ts +8 -3
- package/dist/components/AppShell/AppShellContext.d.ts +10 -0
- package/dist/components/AppShell/AppShellContext.js +27 -0
- package/dist/components/AppShell/Navigation/Navigation.d.ts +2 -1
- package/dist/components/AppShell/Navigation/Navigation.js +29 -17
- package/dist/components/AppShell/Navigation/NavigationItem.d.ts +5 -2
- package/dist/components/AppShell/Navigation/NavigationItem.js +12 -2
- package/dist/components/AppShell/Navigation/TopBar.d.ts +2 -1
- package/dist/components/AppShell/Navigation/TopBar.js +12 -6
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/Select.styles.d.ts +1 -1
- package/dist/components/Select/Select.styles.js +2 -2
- package/dist/components/Select/Select.tokens.d.ts +3 -1
- package/dist/components/Select/Select.tokens.js +6 -1
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { User } from './Navigation/TopBar';
|
|
3
3
|
import { OverflowMenuProps } from '../OverflowMenu';
|
|
4
|
+
import { Environment } from '@norges-domstoler/development-utils';
|
|
4
5
|
export type AppShellProps = PropsWithChildren<{
|
|
5
6
|
/**
|
|
6
7
|
* Versjon på appen på formatet 0.0.0
|
|
@@ -15,6 +16,11 @@ export type AppShellProps = PropsWithChildren<{
|
|
|
15
16
|
* Menyvalg som skal vises i OverflowMenu knyttet til "bruker"-knappen.
|
|
16
17
|
*/
|
|
17
18
|
userMenuItems?: OverflowMenuProps['items'];
|
|
19
|
+
/**
|
|
20
|
+
* `environment` brukes for å vise en banner øverst i appen som viser hvilket miljø du er i.
|
|
21
|
+
* Når environment er undefined eller `"PROD"` så vises ikke banneret.
|
|
22
|
+
*/
|
|
23
|
+
environment?: Environment;
|
|
18
24
|
}>;
|
|
19
25
|
export type AppShellNavigationProps = {
|
|
20
26
|
/**
|
|
@@ -26,4 +32,7 @@ export type AppShellNavigationProps = {
|
|
|
26
32
|
*/
|
|
27
33
|
external?: ReactElement[];
|
|
28
34
|
};
|
|
29
|
-
export declare const AppShell:
|
|
35
|
+
export declare const AppShell: {
|
|
36
|
+
({ children, version, navigation: { internal, external }, user, userMenuItems, environment, }: AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
@@ -2,11 +2,14 @@ import { ComponentProps } from 'react';
|
|
|
2
2
|
import { AppShell } from '.';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: {
|
|
6
|
+
({ children, version, navigation: { internal, external }, user, userMenuItems, environment, }: import("./AppShell").AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
} & {
|
|
6
9
|
NavItem: {
|
|
7
|
-
<T extends import("@norges-domstoler/dds-core").As = "a">({ as: _as, active, icon, external, children, ...rest }: import("react").PropsWithoutRef<ComponentProps<T>> & {
|
|
10
|
+
<T extends import("@norges-domstoler/dds-core").As = "a">({ as: _as, active, icon, external, children, onClick: propOnClick, ...rest }: import("react").PropsWithoutRef<ComponentProps<T>> & {
|
|
8
11
|
as?: T | undefined;
|
|
9
|
-
} & ({
|
|
12
|
+
} & (({
|
|
10
13
|
icon: import("@norges-domstoler/dds-icons").SvgIcon;
|
|
11
14
|
active?: boolean | undefined;
|
|
12
15
|
external?: false | undefined;
|
|
@@ -14,6 +17,8 @@ declare const _default: {
|
|
|
14
17
|
external: true;
|
|
15
18
|
active?: false | undefined;
|
|
16
19
|
icon?: undefined;
|
|
20
|
+
}) & {
|
|
21
|
+
onClick?: import("react").MouseEventHandler | undefined;
|
|
17
22
|
})): import("react/jsx-runtime").JSX.Element;
|
|
18
23
|
displayName: string;
|
|
19
24
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode, type SetStateAction, type Dispatch } from 'react';
|
|
2
|
+
type AppShellContextValues = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const AppShellContextProvider: ({ children, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useAppShellContext: () => AppShellContextValues;
|
|
10
|
+
export {};
|
|
@@ -8,5 +8,6 @@ export type NavigationProps = {
|
|
|
8
8
|
external: ReactElement[];
|
|
9
9
|
user: User;
|
|
10
10
|
userMenuItems?: OverflowMenuProps['items'];
|
|
11
|
+
environmentBannerActive: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const Navigation: ({ version, user, userMenuItems, internal, external, }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Navigation: ({ version, user, userMenuItems, internal, external, environmentBannerActive, }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PropsOf, type As } from '@norges-domstoler/dds-core';
|
|
2
2
|
import { SvgIcon } from '@norges-domstoler/dds-icons';
|
|
3
|
-
type
|
|
3
|
+
import { type MouseEventHandler } from 'react';
|
|
4
|
+
type BaseNavigationItemProps = ({
|
|
4
5
|
icon: SvgIcon;
|
|
5
6
|
active?: boolean;
|
|
6
7
|
external?: undefined | false;
|
|
@@ -8,10 +9,12 @@ type BaseNavigationItemProps = {
|
|
|
8
9
|
external: true;
|
|
9
10
|
active?: undefined | false;
|
|
10
11
|
icon?: undefined;
|
|
12
|
+
}) & {
|
|
13
|
+
onClick?: MouseEventHandler;
|
|
11
14
|
};
|
|
12
15
|
type NavigationItemProps<T extends As = 'a'> = PropsOf<T> & BaseNavigationItemProps;
|
|
13
16
|
export declare const NavigationItem: {
|
|
14
|
-
<T extends As = "a">({ as: _as, active, icon, external, children, ...rest }: NavigationItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
<T extends As = "a">({ as: _as, active, icon, external, children, onClick: propOnClick, ...rest }: NavigationItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
displayName: string;
|
|
16
19
|
};
|
|
17
20
|
export {};
|
|
@@ -5,6 +5,7 @@ type TopBarProps = {
|
|
|
5
5
|
userMenuItems?: OverflowMenuProps['items'];
|
|
6
6
|
isNavigationOpen: boolean;
|
|
7
7
|
onNavigationOpenChange: (isOpen: boolean) => void;
|
|
8
|
+
environmentBannerActive: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type User = {
|
|
10
11
|
/**Brukerens fulle navn (for- og etternavn). */
|
|
@@ -18,5 +19,5 @@ export type Embete = {
|
|
|
18
19
|
/**Hvilken instans embetet er. */
|
|
19
20
|
type: EmbeteType;
|
|
20
21
|
};
|
|
21
|
-
export declare const TopBar: ({ user, userMenuItems, isNavigationOpen, onNavigationOpenChange, }: TopBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TopBar: ({ user, userMenuItems, isNavigationOpen, onNavigationOpenChange, environmentBannerActive, }: TopBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -14,5 +14,5 @@ type StyledContainerProps = {
|
|
|
14
14
|
export declare const Container: import("styled-components").StyledComponent<"div", any, StyledContainerProps, never>;
|
|
15
15
|
export declare const InnerSingleValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
16
|
export declare const StyledIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
17
|
-
export declare const getCustomStyles: <TOption>() => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
|
|
17
|
+
export declare const getCustomStyles: <TOption>(size: InputSize) => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
|
|
18
18
|
export {};
|
|
@@ -10,7 +10,9 @@ export declare const typographyTypes: {
|
|
|
10
10
|
[k in InputSize]: StaticTypographyType;
|
|
11
11
|
};
|
|
12
12
|
groupHeading: StaticTypographyType;
|
|
13
|
-
multiValueLabel:
|
|
13
|
+
multiValueLabel: {
|
|
14
|
+
[k in InputSize]: StaticTypographyType;
|
|
15
|
+
};
|
|
14
16
|
};
|
|
15
17
|
export declare const selectTokens: {
|
|
16
18
|
control: {
|
package/dist/cjs/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var styled = require('styled-components');
|
|
|
10
10
|
var ddsDesignTokens = require('@norges-domstoler/dds-design-tokens');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var tslib = require('tslib');
|
|
13
|
+
var developmentUtils = require('@norges-domstoler/development-utils');
|
|
13
14
|
var ReactSelect = require('react-select');
|
|
14
15
|
var reactDom = require('react-dom');
|
|
15
16
|
var fileSelector = require('file-selector');
|
|
@@ -87,6 +88,46 @@ var appShellTokens = {
|
|
|
87
88
|
floatingActionButtons: floatingActionButtons$1
|
|
88
89
|
};
|
|
89
90
|
|
|
91
|
+
var border$b = ddsDesignTokens.ddsBaseTokens.border,
|
|
92
|
+
spacing$A = ddsDesignTokens.ddsBaseTokens.spacing;
|
|
93
|
+
var divider$2 = {
|
|
94
|
+
borderTop: "".concat(border$b.BordersDdsBorderStyleLightStrokeWeight, " solid"),
|
|
95
|
+
marginTop: spacing$A.SizesDdsSpacingLocalX1,
|
|
96
|
+
marginBottom: spacing$A.SizesDdsSpacingLocalX1,
|
|
97
|
+
color: {
|
|
98
|
+
primary: {
|
|
99
|
+
borderColor: border$b.BordersDdsBorderStyleDarkStroke
|
|
100
|
+
},
|
|
101
|
+
primaryLighter: {
|
|
102
|
+
borderColor: border$b.BordersDdsBorderStyleLightStroke
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var dividerTokens = Object.assign({}, divider$2);
|
|
107
|
+
|
|
108
|
+
var StyledDivider$2 = styled__default.default.hr.withConfig({
|
|
109
|
+
displayName: "Divider__StyledDivider",
|
|
110
|
+
componentId: "sc-ggdopz-0"
|
|
111
|
+
})(["border:0;background-color:transparent;border-top:", ";margin-top:", ";margin-bottom:", ";", ""], dividerTokens.borderTop, dividerTokens.marginTop, dividerTokens.marginBottom, function (_ref) {
|
|
112
|
+
var color = _ref.color;
|
|
113
|
+
return color && styled.css(["border-color:", ";"], dividerTokens.color[color].borderColor);
|
|
114
|
+
});
|
|
115
|
+
var Divider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
116
|
+
var _props$color = props.color,
|
|
117
|
+
color = _props$color === void 0 ? 'primary' : _props$color,
|
|
118
|
+
id = props.id,
|
|
119
|
+
className = props.className,
|
|
120
|
+
htmlProps = props.htmlProps,
|
|
121
|
+
rest = tslib.__rest(props, ["color", "id", "className", "htmlProps"]);
|
|
122
|
+
var lineProps = Object.assign(Object.assign({}, ddsCore.getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
123
|
+
color: color
|
|
124
|
+
});
|
|
125
|
+
return jsxRuntime.jsx(StyledDivider$2, Object.assign({
|
|
126
|
+
ref: ref
|
|
127
|
+
}, lineProps));
|
|
128
|
+
});
|
|
129
|
+
Divider.displayName = 'Divider';
|
|
130
|
+
|
|
90
131
|
function _iterableToArrayLimit(arr, i) {
|
|
91
132
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
92
133
|
if (null != _i) {
|
|
@@ -478,45 +519,27 @@ function _toPropertyKey(arg) {
|
|
|
478
519
|
return typeof key === "symbol" ? key : String(key);
|
|
479
520
|
}
|
|
480
521
|
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
borderTop: "".concat(border$b.BordersDdsBorderStyleLightStrokeWeight, " solid"),
|
|
485
|
-
marginTop: spacing$A.SizesDdsSpacingLocalX1,
|
|
486
|
-
marginBottom: spacing$A.SizesDdsSpacingLocalX1,
|
|
487
|
-
color: {
|
|
488
|
-
primary: {
|
|
489
|
-
borderColor: border$b.BordersDdsBorderStyleDarkStroke
|
|
490
|
-
},
|
|
491
|
-
primaryLighter: {
|
|
492
|
-
borderColor: border$b.BordersDdsBorderStyleLightStroke
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
var dividerTokens = Object.assign({}, divider$2);
|
|
497
|
-
|
|
498
|
-
var StyledDivider$2 = styled__default.default.hr.withConfig({
|
|
499
|
-
displayName: "Divider__StyledDivider",
|
|
500
|
-
componentId: "sc-ggdopz-0"
|
|
501
|
-
})(["border:0;background-color:transparent;border-top:", ";margin-top:", ";margin-bottom:", ";", ""], dividerTokens.borderTop, dividerTokens.marginTop, dividerTokens.marginBottom, function (_ref) {
|
|
502
|
-
var color = _ref.color;
|
|
503
|
-
return color && styled.css(["border-color:", ";"], dividerTokens.color[color].borderColor);
|
|
522
|
+
var AppShellContext = /*#__PURE__*/React.createContext({
|
|
523
|
+
isOpen: false,
|
|
524
|
+
setOpen: function setOpen() {}
|
|
504
525
|
});
|
|
505
|
-
var
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
526
|
+
var AppShellContextProvider = function AppShellContextProvider(_ref) {
|
|
527
|
+
var children = _ref.children;
|
|
528
|
+
var _useState = React.useState(false),
|
|
529
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
530
|
+
isOpen = _useState2[0],
|
|
531
|
+
setOpen = _useState2[1];
|
|
532
|
+
return jsxRuntime.jsx(AppShellContext.Provider, {
|
|
533
|
+
value: {
|
|
534
|
+
isOpen: isOpen,
|
|
535
|
+
setOpen: setOpen
|
|
536
|
+
},
|
|
537
|
+
children: children
|
|
514
538
|
});
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
Divider.displayName = 'Divider';
|
|
539
|
+
};
|
|
540
|
+
var useAppShellContext = function useAppShellContext() {
|
|
541
|
+
return React.useContext(AppShellContext);
|
|
542
|
+
};
|
|
520
543
|
|
|
521
544
|
var navTokens$3 = appShellTokens.navigation;
|
|
522
545
|
var navItemTokens = navTokens$3.navigationItems.item;
|
|
@@ -550,12 +573,20 @@ var NavigationItem$1 = function NavigationItem(_a) {
|
|
|
550
573
|
icon = _a.icon,
|
|
551
574
|
external = _a.external,
|
|
552
575
|
children = _a.children,
|
|
553
|
-
|
|
576
|
+
propOnClick = _a.onClick,
|
|
577
|
+
rest = tslib.__rest(_a, ["as", "active", "icon", "external", "children", "onClick"]);
|
|
578
|
+
var _useAppShellContext = useAppShellContext(),
|
|
579
|
+
setOpen = _useAppShellContext.setOpen;
|
|
554
580
|
var Comp = _as !== null && _as !== void 0 ? _as : 'a';
|
|
581
|
+
var onClick = function onClick(e) {
|
|
582
|
+
propOnClick === null || propOnClick === void 0 ? void 0 : propOnClick(e);
|
|
583
|
+
setOpen(false);
|
|
584
|
+
};
|
|
555
585
|
if (external) {
|
|
556
586
|
return jsxRuntime.jsxs(ExternalNavItem, Object.assign({
|
|
557
587
|
as: Comp
|
|
558
588
|
}, rest, {
|
|
589
|
+
onClick: onClick,
|
|
559
590
|
children: [children, jsxRuntime.jsx(ddsIcons.Icon, {
|
|
560
591
|
icon: ddsIcons.OpenExternalIcon,
|
|
561
592
|
iconSize: "inherit"
|
|
@@ -565,7 +596,8 @@ var NavigationItem$1 = function NavigationItem(_a) {
|
|
|
565
596
|
return jsxRuntime.jsxs(InternalNavItem, Object.assign({
|
|
566
597
|
as: Comp
|
|
567
598
|
}, rest, {
|
|
568
|
-
|
|
599
|
+
onClick: onClick,
|
|
600
|
+
className: [active ? 'active' : '', rest.className].join(' '),
|
|
569
601
|
children: [jsxRuntime.jsx(IconContainer, {
|
|
570
602
|
children: icon && jsxRuntime.jsx(ddsIcons.Icon, {
|
|
571
603
|
icon: icon
|
|
@@ -1820,18 +1852,23 @@ var IconButtonText = styled__default.default.span.withConfig({
|
|
|
1820
1852
|
var Bar$1 = styled__default.default.div.withConfig({
|
|
1821
1853
|
displayName: "TopBar__Bar",
|
|
1822
1854
|
componentId: "sc-1mmx14i-4"
|
|
1823
|
-
})(["display:flex;align-items:center;justify-content:space-between;gap:", ";width:100vw;height:", ";color:", ";background-color:", ";box-sizing:border-box;z-index:101;position:fixed;top:
|
|
1824
|
-
var
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1855
|
+
})(["display:flex;align-items:center;justify-content:space-between;gap:", ";width:100vw;height:", ";color:", ";background-color:", ";box-sizing:border-box;z-index:101;position:fixed;top:", ";left:0;right:0;@media (min-width:", "){justify-content:flex-end;background-color:transparent;margin-left:", ";width:calc(100vw - ", ");pointer-events:none;& > *{pointer-events:initial;}", "{display:none;}", "{padding-right:calc(2 * ", ");gap:", ";}", "{background-color:", ";color:", ";box-shadow:8px 16px 32px 0px rgba(0,0,0,0.1);border-radius:", ";", "{display:unset;}}}"], navTokens$1.topBar.gap, navTokens$1.topBar.height, navTokens$1.color, navTokens$1.backgroundColor, function (_ref) {
|
|
1856
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
1857
|
+
return environmentBannerActive ? developmentUtils.ENVIRONMENT_BANNER_HEIGHT : '0';
|
|
1858
|
+
}, navTokens$1.mobile.breakpoint, navTokens$1.width, navTokens$1.width, LogoBurgerGroup, ActionButtonGroup, navTokens$1.topBar.gap, floatingActionButtons.gap, IconButton, floatingActionButtons.backgroundColor, floatingActionButtons.textColor, floatingActionButtons.borderRadius, IconButtonText);
|
|
1859
|
+
var TopBar = function TopBar(_ref2) {
|
|
1860
|
+
var user = _ref2.user,
|
|
1861
|
+
userMenuItems = _ref2.userMenuItems,
|
|
1862
|
+
isNavigationOpen = _ref2.isNavigationOpen,
|
|
1863
|
+
onNavigationOpenChange = _ref2.onNavigationOpenChange,
|
|
1864
|
+
environmentBannerActive = _ref2.environmentBannerActive;
|
|
1829
1865
|
var Icon = function Icon(props) {
|
|
1830
1866
|
return jsxRuntime.jsx(EmbeteIcon, Object.assign({}, props, {
|
|
1831
1867
|
type: user.embete.type
|
|
1832
1868
|
}));
|
|
1833
1869
|
};
|
|
1834
1870
|
return jsxRuntime.jsxs(Bar$1, {
|
|
1871
|
+
environmentBannerActive: environmentBannerActive,
|
|
1835
1872
|
children: [jsxRuntime.jsxs(LogoBurgerGroup, {
|
|
1836
1873
|
children: [jsxRuntime.jsx(IconButton, {
|
|
1837
1874
|
icon: isNavigationOpen ? ddsIcons.CloseIcon : ddsIcons.MenuIcon,
|
|
@@ -1861,13 +1898,22 @@ var navTokens = appShellTokens.navigation;
|
|
|
1861
1898
|
var Sidebar = styled__default.default.div.withConfig({
|
|
1862
1899
|
displayName: "Navigation__Sidebar",
|
|
1863
1900
|
componentId: "sc-twhp5c-0"
|
|
1864
|
-
})(["display:flex;flex-direction:column;height:calc(100vh - ", ");width:100vw;padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:fixed;top:", ";left:0;right:0;bottom:0;z-index:100;transition:transform 0.2s ease-in-out,opacity 0.2s ease-in-out;transform:translateX(", ");opacity:", ";@media (min-width:", "){height:
|
|
1865
|
-
var
|
|
1866
|
-
return
|
|
1901
|
+
})(["display:flex;flex-direction:column;height:calc(100vh - ", ");width:100vw;padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:fixed;top:", ";left:0;right:0;bottom:0;z-index:100;transition:transform 0.2s ease-in-out,opacity 0.2s ease-in-out;transform:translateX(", ");opacity:", ";@media (min-width:", "){height:", ";top:", ";width:", ";position:fixed;transform:translateX(0);opacity:1;}"], navTokens.topBar.height, navTokens.padding, navTokens.color, navTokens.backgroundColor, function (_ref) {
|
|
1902
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
1903
|
+
return environmentBannerActive ? "calc(".concat(developmentUtils.ENVIRONMENT_BANNER_HEIGHT, " + ").concat(navTokens.topBar.height, ")") : navTokens.topBar.height;
|
|
1867
1904
|
}, function (_ref2) {
|
|
1868
1905
|
var isOpen = _ref2.isOpen;
|
|
1906
|
+
return isOpen ? '0' : '-100%';
|
|
1907
|
+
}, function (_ref3) {
|
|
1908
|
+
var isOpen = _ref3.isOpen;
|
|
1869
1909
|
return isOpen ? '1' : '0';
|
|
1870
|
-
}, navTokens.mobile.breakpoint,
|
|
1910
|
+
}, navTokens.mobile.breakpoint, function (_ref4) {
|
|
1911
|
+
var environmentBannerActive = _ref4.environmentBannerActive;
|
|
1912
|
+
return environmentBannerActive ? "calc(100vh - ".concat(developmentUtils.ENVIRONMENT_BANNER_HEIGHT, ")") : '100vh';
|
|
1913
|
+
}, function (_ref5) {
|
|
1914
|
+
var environmentBannerActive = _ref5.environmentBannerActive;
|
|
1915
|
+
return environmentBannerActive ? developmentUtils.ENVIRONMENT_BANNER_HEIGHT : 0;
|
|
1916
|
+
}, navTokens.width);
|
|
1871
1917
|
var LogoAndVersionContainer = styled__default.default.div.withConfig({
|
|
1872
1918
|
displayName: "Navigation__LogoAndVersionContainer",
|
|
1873
1919
|
componentId: "sc-twhp5c-1"
|
|
@@ -1888,16 +1934,16 @@ var StyledDivider = styled__default.default(Divider).withConfig({
|
|
|
1888
1934
|
displayName: "Navigation__StyledDivider",
|
|
1889
1935
|
componentId: "sc-twhp5c-5"
|
|
1890
1936
|
})(["border-color:", ";"], navTokens.dividerColor);
|
|
1891
|
-
var Navigation$1 = function Navigation(
|
|
1892
|
-
var version =
|
|
1893
|
-
user =
|
|
1894
|
-
userMenuItems =
|
|
1895
|
-
internal =
|
|
1896
|
-
external =
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
isOpen =
|
|
1900
|
-
setOpen =
|
|
1937
|
+
var Navigation$1 = function Navigation(_ref6) {
|
|
1938
|
+
var version = _ref6.version,
|
|
1939
|
+
user = _ref6.user,
|
|
1940
|
+
userMenuItems = _ref6.userMenuItems,
|
|
1941
|
+
internal = _ref6.internal,
|
|
1942
|
+
external = _ref6.external,
|
|
1943
|
+
environmentBannerActive = _ref6.environmentBannerActive;
|
|
1944
|
+
var _useAppShellContext = useAppShellContext(),
|
|
1945
|
+
isOpen = _useAppShellContext.isOpen,
|
|
1946
|
+
setOpen = _useAppShellContext.setOpen;
|
|
1901
1947
|
React.useEffect(function () {
|
|
1902
1948
|
var listener = function listener(event) {
|
|
1903
1949
|
if (event.key === 'o') {
|
|
@@ -1918,9 +1964,11 @@ var Navigation$1 = function Navigation(_ref3) {
|
|
|
1918
1964
|
isNavigationOpen: isOpen,
|
|
1919
1965
|
onNavigationOpenChange: function onNavigationOpenChange(newOpen) {
|
|
1920
1966
|
return setOpen(newOpen);
|
|
1921
|
-
}
|
|
1967
|
+
},
|
|
1968
|
+
environmentBannerActive: environmentBannerActive
|
|
1922
1969
|
}), jsxRuntime.jsxs(Sidebar, {
|
|
1923
1970
|
isOpen: isOpen,
|
|
1971
|
+
environmentBannerActive: environmentBannerActive,
|
|
1924
1972
|
children: [jsxRuntime.jsxs(LogoAndVersionContainer, {
|
|
1925
1973
|
children: [jsxRuntime.jsx(NavigationLogo, {
|
|
1926
1974
|
children: "Lovisa"
|
|
@@ -1955,30 +2003,46 @@ var AppShellContainer = styled__default.default.div.withConfig({
|
|
|
1955
2003
|
var MainContent = styled__default.default.main.withConfig({
|
|
1956
2004
|
displayName: "AppShell__MainContent",
|
|
1957
2005
|
componentId: "sc-1c8yu5p-1"
|
|
1958
|
-
})(["min-height:calc(100vh - ", ");margin-top:", ";@media (min-width:", "){min-height:unset;margin-top:
|
|
1959
|
-
var
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2006
|
+
})(["min-height:calc(100vh - ", ");margin-top:", ";@media (min-width:", "){min-height:unset;margin-top:", ";margin-left:", ";min-width:calc(100vw - ", ");max-width:calc(100vw - ", ");}"], appShellTokens.navigation.topBar.height, function (_ref) {
|
|
2007
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
2008
|
+
return environmentBannerActive ? "calc(".concat(developmentUtils.ENVIRONMENT_BANNER_HEIGHT, " + ").concat(appShellTokens.navigation.topBar.height, ")") : appShellTokens.navigation.topBar.height;
|
|
2009
|
+
}, appShellTokens.navigation.mobile.breakpoint, function (_ref2) {
|
|
2010
|
+
var environmentBannerActive = _ref2.environmentBannerActive;
|
|
2011
|
+
return environmentBannerActive ? developmentUtils.ENVIRONMENT_BANNER_HEIGHT : 0;
|
|
2012
|
+
}, appShellTokens.navigation.width, appShellTokens.navigation.width, appShellTokens.navigation.width);
|
|
2013
|
+
var AppShell$1 = function AppShell(_ref3) {
|
|
2014
|
+
var children = _ref3.children,
|
|
2015
|
+
_ref3$version = _ref3.version,
|
|
2016
|
+
version = _ref3$version === void 0 ? '' : _ref3$version,
|
|
2017
|
+
_ref3$navigation = _ref3.navigation,
|
|
2018
|
+
_ref3$navigation$inte = _ref3$navigation.internal,
|
|
2019
|
+
internal = _ref3$navigation$inte === void 0 ? [] : _ref3$navigation$inte,
|
|
2020
|
+
_ref3$navigation$exte = _ref3$navigation.external,
|
|
2021
|
+
external = _ref3$navigation$exte === void 0 ? [] : _ref3$navigation$exte,
|
|
2022
|
+
user = _ref3.user,
|
|
2023
|
+
userMenuItems = _ref3.userMenuItems,
|
|
2024
|
+
_ref3$environment = _ref3.environment,
|
|
2025
|
+
environment = _ref3$environment === void 0 ? 'PROD' : _ref3$environment;
|
|
2026
|
+
var environmentBannerActive = environment !== 'PROD';
|
|
2027
|
+
return jsxRuntime.jsx(AppShellContextProvider, {
|
|
2028
|
+
children: jsxRuntime.jsxs(AppShellContainer, {
|
|
2029
|
+
children: [jsxRuntime.jsx(developmentUtils.EnvironmentBanner, {
|
|
2030
|
+
environment: environment
|
|
2031
|
+
}), jsxRuntime.jsx(Navigation$1, {
|
|
2032
|
+
user: user,
|
|
2033
|
+
userMenuItems: userMenuItems,
|
|
2034
|
+
version: version,
|
|
2035
|
+
internal: internal,
|
|
2036
|
+
external: external,
|
|
2037
|
+
environmentBannerActive: environmentBannerActive
|
|
2038
|
+
}), jsxRuntime.jsx(MainContent, {
|
|
2039
|
+
environmentBannerActive: environmentBannerActive,
|
|
2040
|
+
children: children
|
|
2041
|
+
})]
|
|
2042
|
+
})
|
|
1980
2043
|
});
|
|
1981
2044
|
};
|
|
2045
|
+
AppShell$1.displayName = 'AppShell';
|
|
1982
2046
|
|
|
1983
2047
|
var AppShell = AppShell$1;
|
|
1984
2048
|
AppShell.NavItem = NavigationItem$1;
|
|
@@ -2743,13 +2807,18 @@ var placeholderTypographyTypes = {
|
|
|
2743
2807
|
small: 'supportingStylePlaceholderText02',
|
|
2744
2808
|
tiny: 'supportingStylePlaceholderText03'
|
|
2745
2809
|
};
|
|
2810
|
+
var multiValueLabelTypographyTypes = {
|
|
2811
|
+
medium: 'bodySans01',
|
|
2812
|
+
small: 'bodySans01',
|
|
2813
|
+
tiny: 'supportingStyleTiny01'
|
|
2814
|
+
};
|
|
2746
2815
|
var typographyTypes$5 = {
|
|
2747
2816
|
control: ddsForm.inputTypographyTypes,
|
|
2748
2817
|
option: ddsForm.inputTypographyTypes,
|
|
2749
2818
|
placeholder: placeholderTypographyTypes,
|
|
2750
2819
|
noOptionsMessage: placeholderTypographyTypes,
|
|
2751
2820
|
groupHeading: 'supportingStyleHelperText01',
|
|
2752
|
-
multiValueLabel:
|
|
2821
|
+
multiValueLabel: multiValueLabelTypographyTypes
|
|
2753
2822
|
};
|
|
2754
2823
|
var control = {
|
|
2755
2824
|
borderRadius: borderRadius$5.RadiiDdsBorderRadius1Radius,
|
|
@@ -2939,7 +3008,7 @@ var StyledIcon$2 = styled__default.default(ddsIcons.Icon).withConfig({
|
|
|
2939
3008
|
displayName: "Selectstyles__StyledIcon",
|
|
2940
3009
|
componentId: "sc-19jkd5s-2"
|
|
2941
3010
|
})(["margin-right:", ";"], icon$6.marginRight);
|
|
2942
|
-
var getCustomStyles = function getCustomStyles() {
|
|
3011
|
+
var getCustomStyles = function getCustomStyles(size) {
|
|
2943
3012
|
return {
|
|
2944
3013
|
control: function control() {
|
|
2945
3014
|
return {
|
|
@@ -3008,7 +3077,7 @@ var getCustomStyles = function getCustomStyles() {
|
|
|
3008
3077
|
multiValueLabel: function multiValueLabel(provided) {
|
|
3009
3078
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
|
|
3010
3079
|
padding: _multiValueLabel.padding
|
|
3011
|
-
}), ddsTypography.getFontStyling(typographyTypes$5.multiValueLabel)), {
|
|
3080
|
+
}), ddsTypography.getFontStyling(typographyTypes$5.multiValueLabel[size])), {
|
|
3012
3081
|
color: _multiValueLabel.color
|
|
3013
3082
|
});
|
|
3014
3083
|
},
|
|
@@ -3258,7 +3327,7 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
3258
3327
|
inputId: uniqueId,
|
|
3259
3328
|
name: uniqueId,
|
|
3260
3329
|
classNamePrefix: prefix,
|
|
3261
|
-
styles: getCustomStyles(),
|
|
3330
|
+
styles: getCustomStyles(componentSize),
|
|
3262
3331
|
filterOption: function filterOption(option, inputValue) {
|
|
3263
3332
|
var label = option.label;
|
|
3264
3333
|
return ddsCore.searchFilter(label, inputValue) || inputValue === '';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { User } from './Navigation/TopBar';
|
|
3
3
|
import { OverflowMenuProps } from '../OverflowMenu';
|
|
4
|
+
import { Environment } from '@norges-domstoler/development-utils';
|
|
4
5
|
export type AppShellProps = PropsWithChildren<{
|
|
5
6
|
/**
|
|
6
7
|
* Versjon på appen på formatet 0.0.0
|
|
@@ -15,6 +16,11 @@ export type AppShellProps = PropsWithChildren<{
|
|
|
15
16
|
* Menyvalg som skal vises i OverflowMenu knyttet til "bruker"-knappen.
|
|
16
17
|
*/
|
|
17
18
|
userMenuItems?: OverflowMenuProps['items'];
|
|
19
|
+
/**
|
|
20
|
+
* `environment` brukes for å vise en banner øverst i appen som viser hvilket miljø du er i.
|
|
21
|
+
* Når environment er undefined eller `"PROD"` så vises ikke banneret.
|
|
22
|
+
*/
|
|
23
|
+
environment?: Environment;
|
|
18
24
|
}>;
|
|
19
25
|
export type AppShellNavigationProps = {
|
|
20
26
|
/**
|
|
@@ -26,4 +32,7 @@ export type AppShellNavigationProps = {
|
|
|
26
32
|
*/
|
|
27
33
|
external?: ReactElement[];
|
|
28
34
|
};
|
|
29
|
-
export declare const AppShell:
|
|
35
|
+
export declare const AppShell: {
|
|
36
|
+
({ children, version, navigation: { internal, external }, user, userMenuItems, environment, }: AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { appShellTokens } from './AppShell.tokens.js';
|
|
4
4
|
import { Navigation } from './Navigation/Navigation.js';
|
|
5
|
+
import { ENVIRONMENT_BANNER_HEIGHT, EnvironmentBanner } from '@norges-domstoler/development-utils';
|
|
6
|
+
import { AppShellContextProvider } from './AppShellContext.js';
|
|
5
7
|
|
|
6
8
|
var AppShellContainer = styled.div.withConfig({
|
|
7
9
|
displayName: "AppShell__AppShellContainer",
|
|
@@ -10,29 +12,45 @@ var AppShellContainer = styled.div.withConfig({
|
|
|
10
12
|
var MainContent = styled.main.withConfig({
|
|
11
13
|
displayName: "AppShell__MainContent",
|
|
12
14
|
componentId: "sc-1c8yu5p-1"
|
|
13
|
-
})(["min-height:calc(100vh - ", ");margin-top:", ";@media (min-width:", "){min-height:unset;margin-top:
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
})(["min-height:calc(100vh - ", ");margin-top:", ";@media (min-width:", "){min-height:unset;margin-top:", ";margin-left:", ";min-width:calc(100vw - ", ");max-width:calc(100vw - ", ");}"], appShellTokens.navigation.topBar.height, function (_ref) {
|
|
16
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
17
|
+
return environmentBannerActive ? "calc(".concat(ENVIRONMENT_BANNER_HEIGHT, " + ").concat(appShellTokens.navigation.topBar.height, ")") : appShellTokens.navigation.topBar.height;
|
|
18
|
+
}, appShellTokens.navigation.mobile.breakpoint, function (_ref2) {
|
|
19
|
+
var environmentBannerActive = _ref2.environmentBannerActive;
|
|
20
|
+
return environmentBannerActive ? ENVIRONMENT_BANNER_HEIGHT : 0;
|
|
21
|
+
}, appShellTokens.navigation.width, appShellTokens.navigation.width, appShellTokens.navigation.width);
|
|
22
|
+
var AppShell = function AppShell(_ref3) {
|
|
23
|
+
var children = _ref3.children,
|
|
24
|
+
_ref3$version = _ref3.version,
|
|
25
|
+
version = _ref3$version === void 0 ? '' : _ref3$version,
|
|
26
|
+
_ref3$navigation = _ref3.navigation,
|
|
27
|
+
_ref3$navigation$inte = _ref3$navigation.internal,
|
|
28
|
+
internal = _ref3$navigation$inte === void 0 ? [] : _ref3$navigation$inte,
|
|
29
|
+
_ref3$navigation$exte = _ref3$navigation.external,
|
|
30
|
+
external = _ref3$navigation$exte === void 0 ? [] : _ref3$navigation$exte,
|
|
31
|
+
user = _ref3.user,
|
|
32
|
+
userMenuItems = _ref3.userMenuItems,
|
|
33
|
+
_ref3$environment = _ref3.environment,
|
|
34
|
+
environment = _ref3$environment === void 0 ? 'PROD' : _ref3$environment;
|
|
35
|
+
var environmentBannerActive = environment !== 'PROD';
|
|
36
|
+
return jsx(AppShellContextProvider, {
|
|
37
|
+
children: jsxs(AppShellContainer, {
|
|
38
|
+
children: [jsx(EnvironmentBanner, {
|
|
39
|
+
environment: environment
|
|
40
|
+
}), jsx(Navigation, {
|
|
41
|
+
user: user,
|
|
42
|
+
userMenuItems: userMenuItems,
|
|
43
|
+
version: version,
|
|
44
|
+
internal: internal,
|
|
45
|
+
external: external,
|
|
46
|
+
environmentBannerActive: environmentBannerActive
|
|
47
|
+
}), jsx(MainContent, {
|
|
48
|
+
environmentBannerActive: environmentBannerActive,
|
|
49
|
+
children: children
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
35
52
|
});
|
|
36
53
|
};
|
|
54
|
+
AppShell.displayName = 'AppShell';
|
|
37
55
|
|
|
38
56
|
export { AppShell };
|
|
@@ -2,11 +2,14 @@ import { ComponentProps } from 'react';
|
|
|
2
2
|
import { AppShell } from '.';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: {
|
|
6
|
+
({ children, version, navigation: { internal, external }, user, userMenuItems, environment, }: import("./AppShell").AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
} & {
|
|
6
9
|
NavItem: {
|
|
7
|
-
<T extends import("@norges-domstoler/dds-core").As = "a">({ as: _as, active, icon, external, children, ...rest }: import("react").PropsWithoutRef<ComponentProps<T>> & {
|
|
10
|
+
<T extends import("@norges-domstoler/dds-core").As = "a">({ as: _as, active, icon, external, children, onClick: propOnClick, ...rest }: import("react").PropsWithoutRef<ComponentProps<T>> & {
|
|
8
11
|
as?: T | undefined;
|
|
9
|
-
} & ({
|
|
12
|
+
} & (({
|
|
10
13
|
icon: import("@norges-domstoler/dds-icons").SvgIcon;
|
|
11
14
|
active?: boolean | undefined;
|
|
12
15
|
external?: false | undefined;
|
|
@@ -14,6 +17,8 @@ declare const _default: {
|
|
|
14
17
|
external: true;
|
|
15
18
|
active?: false | undefined;
|
|
16
19
|
icon?: undefined;
|
|
20
|
+
}) & {
|
|
21
|
+
onClick?: import("react").MouseEventHandler | undefined;
|
|
17
22
|
})): import("react/jsx-runtime").JSX.Element;
|
|
18
23
|
displayName: string;
|
|
19
24
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode, type SetStateAction, type Dispatch } from 'react';
|
|
2
|
+
type AppShellContextValues = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const AppShellContextProvider: ({ children, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useAppShellContext: () => AppShellContextValues;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useContext, createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
var AppShellContext = /*#__PURE__*/createContext({
|
|
6
|
+
isOpen: false,
|
|
7
|
+
setOpen: function setOpen() {}
|
|
8
|
+
});
|
|
9
|
+
var AppShellContextProvider = function AppShellContextProvider(_ref) {
|
|
10
|
+
var children = _ref.children;
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
isOpen = _useState2[0],
|
|
14
|
+
setOpen = _useState2[1];
|
|
15
|
+
return jsx(AppShellContext.Provider, {
|
|
16
|
+
value: {
|
|
17
|
+
isOpen: isOpen,
|
|
18
|
+
setOpen: setOpen
|
|
19
|
+
},
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var useAppShellContext = function useAppShellContext() {
|
|
24
|
+
return useContext(AppShellContext);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { AppShellContextProvider, useAppShellContext };
|
|
@@ -8,5 +8,6 @@ export type NavigationProps = {
|
|
|
8
8
|
external: ReactElement[];
|
|
9
9
|
user: User;
|
|
10
10
|
userMenuItems?: OverflowMenuProps['items'];
|
|
11
|
+
environmentBannerActive: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const Navigation: ({ version, user, userMenuItems, internal, external, }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Navigation: ({ version, user, userMenuItems, internal, external, environmentBannerActive, }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect, Children } from 'react';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
4
|
import { appShellTokens } from '../AppShell.tokens.js';
|
|
6
5
|
import { Divider } from '../../Divider/Divider.js';
|
|
7
6
|
import { NavigationItem } from './NavigationItem.js';
|
|
8
7
|
import { TopBar } from './TopBar.js';
|
|
9
8
|
import { NavigationLogo } from './NavigationLogo.js';
|
|
9
|
+
import { ENVIRONMENT_BANNER_HEIGHT } from '@norges-domstoler/development-utils';
|
|
10
|
+
import { useAppShellContext } from '../AppShellContext.js';
|
|
10
11
|
|
|
11
12
|
var navTokens = appShellTokens.navigation;
|
|
12
13
|
var Sidebar = styled.div.withConfig({
|
|
13
14
|
displayName: "Navigation__Sidebar",
|
|
14
15
|
componentId: "sc-twhp5c-0"
|
|
15
|
-
})(["display:flex;flex-direction:column;height:calc(100vh - ", ");width:100vw;padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:fixed;top:", ";left:0;right:0;bottom:0;z-index:100;transition:transform 0.2s ease-in-out,opacity 0.2s ease-in-out;transform:translateX(", ");opacity:", ";@media (min-width:", "){height:
|
|
16
|
-
var
|
|
17
|
-
return
|
|
16
|
+
})(["display:flex;flex-direction:column;height:calc(100vh - ", ");width:100vw;padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:fixed;top:", ";left:0;right:0;bottom:0;z-index:100;transition:transform 0.2s ease-in-out,opacity 0.2s ease-in-out;transform:translateX(", ");opacity:", ";@media (min-width:", "){height:", ";top:", ";width:", ";position:fixed;transform:translateX(0);opacity:1;}"], navTokens.topBar.height, navTokens.padding, navTokens.color, navTokens.backgroundColor, function (_ref) {
|
|
17
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
18
|
+
return environmentBannerActive ? "calc(".concat(ENVIRONMENT_BANNER_HEIGHT, " + ").concat(navTokens.topBar.height, ")") : navTokens.topBar.height;
|
|
18
19
|
}, function (_ref2) {
|
|
19
20
|
var isOpen = _ref2.isOpen;
|
|
21
|
+
return isOpen ? '0' : '-100%';
|
|
22
|
+
}, function (_ref3) {
|
|
23
|
+
var isOpen = _ref3.isOpen;
|
|
20
24
|
return isOpen ? '1' : '0';
|
|
21
|
-
}, navTokens.mobile.breakpoint,
|
|
25
|
+
}, navTokens.mobile.breakpoint, function (_ref4) {
|
|
26
|
+
var environmentBannerActive = _ref4.environmentBannerActive;
|
|
27
|
+
return environmentBannerActive ? "calc(100vh - ".concat(ENVIRONMENT_BANNER_HEIGHT, ")") : '100vh';
|
|
28
|
+
}, function (_ref5) {
|
|
29
|
+
var environmentBannerActive = _ref5.environmentBannerActive;
|
|
30
|
+
return environmentBannerActive ? ENVIRONMENT_BANNER_HEIGHT : 0;
|
|
31
|
+
}, navTokens.width);
|
|
22
32
|
var LogoAndVersionContainer = styled.div.withConfig({
|
|
23
33
|
displayName: "Navigation__LogoAndVersionContainer",
|
|
24
34
|
componentId: "sc-twhp5c-1"
|
|
@@ -39,16 +49,16 @@ var StyledDivider = styled(Divider).withConfig({
|
|
|
39
49
|
displayName: "Navigation__StyledDivider",
|
|
40
50
|
componentId: "sc-twhp5c-5"
|
|
41
51
|
})(["border-color:", ";"], navTokens.dividerColor);
|
|
42
|
-
var Navigation = function Navigation(
|
|
43
|
-
var version =
|
|
44
|
-
user =
|
|
45
|
-
userMenuItems =
|
|
46
|
-
internal =
|
|
47
|
-
external =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
isOpen =
|
|
51
|
-
setOpen =
|
|
52
|
+
var Navigation = function Navigation(_ref6) {
|
|
53
|
+
var version = _ref6.version,
|
|
54
|
+
user = _ref6.user,
|
|
55
|
+
userMenuItems = _ref6.userMenuItems,
|
|
56
|
+
internal = _ref6.internal,
|
|
57
|
+
external = _ref6.external,
|
|
58
|
+
environmentBannerActive = _ref6.environmentBannerActive;
|
|
59
|
+
var _useAppShellContext = useAppShellContext(),
|
|
60
|
+
isOpen = _useAppShellContext.isOpen,
|
|
61
|
+
setOpen = _useAppShellContext.setOpen;
|
|
52
62
|
useEffect(function () {
|
|
53
63
|
var listener = function listener(event) {
|
|
54
64
|
if (event.key === 'o') {
|
|
@@ -69,9 +79,11 @@ var Navigation = function Navigation(_ref3) {
|
|
|
69
79
|
isNavigationOpen: isOpen,
|
|
70
80
|
onNavigationOpenChange: function onNavigationOpenChange(newOpen) {
|
|
71
81
|
return setOpen(newOpen);
|
|
72
|
-
}
|
|
82
|
+
},
|
|
83
|
+
environmentBannerActive: environmentBannerActive
|
|
73
84
|
}), jsxs(Sidebar, {
|
|
74
85
|
isOpen: isOpen,
|
|
86
|
+
environmentBannerActive: environmentBannerActive,
|
|
75
87
|
children: [jsxs(LogoAndVersionContainer, {
|
|
76
88
|
children: [jsx(NavigationLogo, {
|
|
77
89
|
children: "Lovisa"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PropsOf, type As } from '@norges-domstoler/dds-core';
|
|
2
2
|
import { SvgIcon } from '@norges-domstoler/dds-icons';
|
|
3
|
-
type
|
|
3
|
+
import { type MouseEventHandler } from 'react';
|
|
4
|
+
type BaseNavigationItemProps = ({
|
|
4
5
|
icon: SvgIcon;
|
|
5
6
|
active?: boolean;
|
|
6
7
|
external?: undefined | false;
|
|
@@ -8,10 +9,12 @@ type BaseNavigationItemProps = {
|
|
|
8
9
|
external: true;
|
|
9
10
|
active?: undefined | false;
|
|
10
11
|
icon?: undefined;
|
|
12
|
+
}) & {
|
|
13
|
+
onClick?: MouseEventHandler;
|
|
11
14
|
};
|
|
12
15
|
type NavigationItemProps<T extends As = 'a'> = PropsOf<T> & BaseNavigationItemProps;
|
|
13
16
|
export declare const NavigationItem: {
|
|
14
|
-
<T extends As = "a">({ as: _as, active, icon, external, children, ...rest }: NavigationItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
<T extends As = "a">({ as: _as, active, icon, external, children, onClick: propOnClick, ...rest }: NavigationItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
displayName: string;
|
|
16
19
|
};
|
|
17
20
|
export {};
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Icon, OpenExternalIcon, ChevronRightIcon } from '@norges-domstoler/dds-icons';
|
|
5
5
|
import { appShellTokens } from '../AppShell.tokens.js';
|
|
6
|
+
import { useAppShellContext } from '../AppShellContext.js';
|
|
6
7
|
|
|
7
8
|
var navTokens = appShellTokens.navigation;
|
|
8
9
|
var navItemTokens = navTokens.navigationItems.item;
|
|
@@ -36,12 +37,20 @@ var NavigationItem = function NavigationItem(_a) {
|
|
|
36
37
|
icon = _a.icon,
|
|
37
38
|
external = _a.external,
|
|
38
39
|
children = _a.children,
|
|
39
|
-
|
|
40
|
+
propOnClick = _a.onClick,
|
|
41
|
+
rest = __rest(_a, ["as", "active", "icon", "external", "children", "onClick"]);
|
|
42
|
+
var _useAppShellContext = useAppShellContext(),
|
|
43
|
+
setOpen = _useAppShellContext.setOpen;
|
|
40
44
|
var Comp = _as !== null && _as !== void 0 ? _as : 'a';
|
|
45
|
+
var onClick = function onClick(e) {
|
|
46
|
+
propOnClick === null || propOnClick === void 0 ? void 0 : propOnClick(e);
|
|
47
|
+
setOpen(false);
|
|
48
|
+
};
|
|
41
49
|
if (external) {
|
|
42
50
|
return jsxs(ExternalNavItem, Object.assign({
|
|
43
51
|
as: Comp
|
|
44
52
|
}, rest, {
|
|
53
|
+
onClick: onClick,
|
|
45
54
|
children: [children, jsx(Icon, {
|
|
46
55
|
icon: OpenExternalIcon,
|
|
47
56
|
iconSize: "inherit"
|
|
@@ -51,7 +60,8 @@ var NavigationItem = function NavigationItem(_a) {
|
|
|
51
60
|
return jsxs(InternalNavItem, Object.assign({
|
|
52
61
|
as: Comp
|
|
53
62
|
}, rest, {
|
|
54
|
-
|
|
63
|
+
onClick: onClick,
|
|
64
|
+
className: [active ? 'active' : '', rest.className].join(' '),
|
|
55
65
|
children: [jsx(IconContainer, {
|
|
56
66
|
children: icon && jsx(Icon, {
|
|
57
67
|
icon: icon
|
|
@@ -5,6 +5,7 @@ type TopBarProps = {
|
|
|
5
5
|
userMenuItems?: OverflowMenuProps['items'];
|
|
6
6
|
isNavigationOpen: boolean;
|
|
7
7
|
onNavigationOpenChange: (isOpen: boolean) => void;
|
|
8
|
+
environmentBannerActive: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type User = {
|
|
10
11
|
/**Brukerens fulle navn (for- og etternavn). */
|
|
@@ -18,5 +19,5 @@ export type Embete = {
|
|
|
18
19
|
/**Hvilken instans embetet er. */
|
|
19
20
|
type: EmbeteType;
|
|
20
21
|
};
|
|
21
|
-
export declare const TopBar: ({ user, userMenuItems, isNavigationOpen, onNavigationOpenChange, }: TopBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TopBar: ({ user, userMenuItems, isNavigationOpen, onNavigationOpenChange, environmentBannerActive, }: TopBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CloseIcon, MenuIcon } from '@norges-domstoler/dds-icons';
|
|
4
|
+
import { ENVIRONMENT_BANNER_HEIGHT } from '@norges-domstoler/development-utils';
|
|
4
5
|
import { EmbeteIcon } from './EmbeteIcon.js';
|
|
5
6
|
import { appShellTokens } from '../AppShell.tokens.js';
|
|
6
7
|
import { NavigationLogo } from './NavigationLogo.js';
|
|
@@ -32,18 +33,23 @@ var IconButtonText = styled.span.withConfig({
|
|
|
32
33
|
var Bar = styled.div.withConfig({
|
|
33
34
|
displayName: "TopBar__Bar",
|
|
34
35
|
componentId: "sc-1mmx14i-4"
|
|
35
|
-
})(["display:flex;align-items:center;justify-content:space-between;gap:", ";width:100vw;height:", ";color:", ";background-color:", ";box-sizing:border-box;z-index:101;position:fixed;top:
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
})(["display:flex;align-items:center;justify-content:space-between;gap:", ";width:100vw;height:", ";color:", ";background-color:", ";box-sizing:border-box;z-index:101;position:fixed;top:", ";left:0;right:0;@media (min-width:", "){justify-content:flex-end;background-color:transparent;margin-left:", ";width:calc(100vw - ", ");pointer-events:none;& > *{pointer-events:initial;}", "{display:none;}", "{padding-right:calc(2 * ", ");gap:", ";}", "{background-color:", ";color:", ";box-shadow:8px 16px 32px 0px rgba(0,0,0,0.1);border-radius:", ";", "{display:unset;}}}"], navTokens.topBar.gap, navTokens.topBar.height, navTokens.color, navTokens.backgroundColor, function (_ref) {
|
|
37
|
+
var environmentBannerActive = _ref.environmentBannerActive;
|
|
38
|
+
return environmentBannerActive ? ENVIRONMENT_BANNER_HEIGHT : '0';
|
|
39
|
+
}, navTokens.mobile.breakpoint, navTokens.width, navTokens.width, LogoBurgerGroup, ActionButtonGroup, navTokens.topBar.gap, floatingActionButtons.gap, IconButton, floatingActionButtons.backgroundColor, floatingActionButtons.textColor, floatingActionButtons.borderRadius, IconButtonText);
|
|
40
|
+
var TopBar = function TopBar(_ref2) {
|
|
41
|
+
var user = _ref2.user,
|
|
42
|
+
userMenuItems = _ref2.userMenuItems,
|
|
43
|
+
isNavigationOpen = _ref2.isNavigationOpen,
|
|
44
|
+
onNavigationOpenChange = _ref2.onNavigationOpenChange,
|
|
45
|
+
environmentBannerActive = _ref2.environmentBannerActive;
|
|
41
46
|
var Icon = function Icon(props) {
|
|
42
47
|
return jsx(EmbeteIcon, Object.assign({}, props, {
|
|
43
48
|
type: user.embete.type
|
|
44
49
|
}));
|
|
45
50
|
};
|
|
46
51
|
return jsxs(Bar, {
|
|
52
|
+
environmentBannerActive: environmentBannerActive,
|
|
47
53
|
children: [jsxs(LogoBurgerGroup, {
|
|
48
54
|
children: [jsx(IconButton, {
|
|
49
55
|
icon: isNavigationOpen ? CloseIcon : MenuIcon,
|
|
@@ -153,7 +153,7 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
153
153
|
inputId: uniqueId,
|
|
154
154
|
name: uniqueId,
|
|
155
155
|
classNamePrefix: prefix,
|
|
156
|
-
styles: getCustomStyles(),
|
|
156
|
+
styles: getCustomStyles(componentSize),
|
|
157
157
|
filterOption: function filterOption(option, inputValue) {
|
|
158
158
|
var label = option.label;
|
|
159
159
|
return searchFilter(label, inputValue) || inputValue === '';
|
|
@@ -14,5 +14,5 @@ type StyledContainerProps = {
|
|
|
14
14
|
export declare const Container: import("styled-components").StyledComponent<"div", any, StyledContainerProps, never>;
|
|
15
15
|
export declare const InnerSingleValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
16
|
export declare const StyledIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
17
|
-
export declare const getCustomStyles: <TOption>() => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
|
|
17
|
+
export declare const getCustomStyles: <TOption>(size: InputSize) => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
|
|
18
18
|
export {};
|
|
@@ -52,7 +52,7 @@ var StyledIcon = styled(Icon).withConfig({
|
|
|
52
52
|
displayName: "Selectstyles__StyledIcon",
|
|
53
53
|
componentId: "sc-19jkd5s-2"
|
|
54
54
|
})(["margin-right:", ";"], icon.marginRight);
|
|
55
|
-
var getCustomStyles = function getCustomStyles() {
|
|
55
|
+
var getCustomStyles = function getCustomStyles(size) {
|
|
56
56
|
return {
|
|
57
57
|
control: function control() {
|
|
58
58
|
return {
|
|
@@ -121,7 +121,7 @@ var getCustomStyles = function getCustomStyles() {
|
|
|
121
121
|
multiValueLabel: function multiValueLabel(provided) {
|
|
122
122
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, provided), {
|
|
123
123
|
padding: _multiValueLabel.padding
|
|
124
|
-
}), getFontStyling(typographyTypes.multiValueLabel)), {
|
|
124
|
+
}), getFontStyling(typographyTypes.multiValueLabel[size])), {
|
|
125
125
|
color: _multiValueLabel.color
|
|
126
126
|
});
|
|
127
127
|
},
|
|
@@ -10,7 +10,9 @@ export declare const typographyTypes: {
|
|
|
10
10
|
[k in InputSize]: StaticTypographyType;
|
|
11
11
|
};
|
|
12
12
|
groupHeading: StaticTypographyType;
|
|
13
|
-
multiValueLabel:
|
|
13
|
+
multiValueLabel: {
|
|
14
|
+
[k in InputSize]: StaticTypographyType;
|
|
15
|
+
};
|
|
14
16
|
};
|
|
15
17
|
export declare const selectTokens: {
|
|
16
18
|
control: {
|
|
@@ -11,13 +11,18 @@ var placeholderTypographyTypes = {
|
|
|
11
11
|
small: 'supportingStylePlaceholderText02',
|
|
12
12
|
tiny: 'supportingStylePlaceholderText03'
|
|
13
13
|
};
|
|
14
|
+
var multiValueLabelTypographyTypes = {
|
|
15
|
+
medium: 'bodySans01',
|
|
16
|
+
small: 'bodySans01',
|
|
17
|
+
tiny: 'supportingStyleTiny01'
|
|
18
|
+
};
|
|
14
19
|
var typographyTypes = {
|
|
15
20
|
control: inputTypographyTypes,
|
|
16
21
|
option: inputTypographyTypes,
|
|
17
22
|
placeholder: placeholderTypographyTypes,
|
|
18
23
|
noOptionsMessage: placeholderTypographyTypes,
|
|
19
24
|
groupHeading: 'supportingStyleHelperText01',
|
|
20
|
-
multiValueLabel:
|
|
25
|
+
multiValueLabel: multiValueLabelTypographyTypes
|
|
21
26
|
};
|
|
22
27
|
var control = {
|
|
23
28
|
borderRadius: borderRadius.RadiiDdsBorderRadius1Radius,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "13.8.
|
|
3
|
+
"version": "13.8.2",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"@norges-domstoler/dds-form": "*",
|
|
94
94
|
"@norges-domstoler/dds-icons": "*",
|
|
95
95
|
"@norges-domstoler/dds-typography": "*",
|
|
96
|
+
"@norges-domstoler/development-utils": "*",
|
|
96
97
|
"attr-accept": "^2.2.2",
|
|
97
98
|
"file-selector": "^0.6.0",
|
|
98
99
|
"focus-visible": "^5.2.0",
|