@norges-domstoler/dds-components 13.7.0 → 13.8.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.
Files changed (34) hide show
  1. package/dist/cjs/components/AppShell/AppShell.d.ts +29 -4
  2. package/dist/cjs/components/AppShell/AppShell.stories.d.ts +9 -4
  3. package/dist/cjs/components/AppShell/AppShell.tokens.d.ts +16 -0
  4. package/dist/cjs/components/AppShell/AppShellContext.d.ts +10 -0
  5. package/dist/cjs/components/AppShell/Navigation/EmbeteIcon.d.ts +7 -0
  6. package/dist/cjs/components/AppShell/Navigation/Navigation.d.ts +6 -1
  7. package/dist/cjs/components/AppShell/Navigation/NavigationItem.d.ts +5 -2
  8. package/dist/cjs/components/AppShell/Navigation/NavigationLogo.d.ts +3 -0
  9. package/dist/cjs/components/AppShell/Navigation/TopBar.d.ts +23 -0
  10. package/dist/cjs/components/Button/Button.d.ts +1 -1
  11. package/dist/cjs/components/Button/Button.stories.d.ts +1 -1
  12. package/dist/cjs/components/Button/Button.types.d.ts +2 -2
  13. package/dist/cjs/index.js +1824 -1605
  14. package/dist/components/AppShell/AppShell.d.ts +29 -4
  15. package/dist/components/AppShell/AppShell.js +42 -20
  16. package/dist/components/AppShell/AppShell.stories.d.ts +9 -4
  17. package/dist/components/AppShell/AppShell.tokens.d.ts +16 -0
  18. package/dist/components/AppShell/AppShell.tokens.js +16 -3
  19. package/dist/components/AppShell/AppShellContext.d.ts +10 -0
  20. package/dist/components/AppShell/AppShellContext.js +27 -0
  21. package/dist/components/AppShell/Navigation/EmbeteIcon.d.ts +7 -0
  22. package/dist/components/AppShell/Navigation/EmbeteIcon.js +21 -0
  23. package/dist/components/AppShell/Navigation/Navigation.d.ts +6 -1
  24. package/dist/components/AppShell/Navigation/Navigation.js +83 -37
  25. package/dist/components/AppShell/Navigation/NavigationItem.d.ts +5 -2
  26. package/dist/components/AppShell/Navigation/NavigationItem.js +13 -3
  27. package/dist/components/AppShell/Navigation/NavigationLogo.d.ts +3 -0
  28. package/dist/components/AppShell/Navigation/NavigationLogo.js +34 -0
  29. package/dist/components/AppShell/Navigation/TopBar.d.ts +23 -0
  30. package/dist/components/AppShell/Navigation/TopBar.js +78 -0
  31. package/dist/components/Button/Button.d.ts +1 -1
  32. package/dist/components/Button/Button.stories.d.ts +1 -1
  33. package/dist/components/Button/Button.types.d.ts +2 -2
  34. package/package.json +2 -1
@@ -0,0 +1,78 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import styled from 'styled-components';
3
+ import { CloseIcon, MenuIcon } from '@norges-domstoler/dds-icons';
4
+ import { ENVIRONMENT_BANNER_HEIGHT } from '@norges-domstoler/development-utils';
5
+ import { EmbeteIcon } from './EmbeteIcon.js';
6
+ import { appShellTokens } from '../AppShell.tokens.js';
7
+ import { NavigationLogo } from './NavigationLogo.js';
8
+ import { Button } from '../../Button/Button.js';
9
+ import { OverflowMenu } from '../../OverflowMenu/OverflowMenu.js';
10
+ import { OverflowMenuGroup } from '../../OverflowMenu/OverflowMenuGroup.js';
11
+
12
+ var navTokens = appShellTokens.navigation,
13
+ floatingActionButtons = appShellTokens.floatingActionButtons;
14
+ var LogoBurgerGroup = styled.div.withConfig({
15
+ displayName: "TopBar__LogoBurgerGroup",
16
+ componentId: "sc-1mmx14i-0"
17
+ })(["display:flex;align-items:center;gap:", ";"], navTokens.topBar.gap);
18
+ var ActionButtonGroup = styled.div.withConfig({
19
+ displayName: "TopBar__ActionButtonGroup",
20
+ componentId: "sc-1mmx14i-1"
21
+ })(["display:flex;align-items:center;gap:", ";"], navTokens.topBar.gap);
22
+ var IconButton = styled(Button).attrs({
23
+ appearance: 'borderless',
24
+ purpose: 'secondary'
25
+ }).withConfig({
26
+ displayName: "TopBar__IconButton",
27
+ componentId: "sc-1mmx14i-2"
28
+ })(["color:", ";> :first-child{font-size:1.65rem;}@media (max-width:", "){border:0;box-shadow:none;padding:12px;&:hover,&:active{color:", ";text-decoration-color:", ";box-shadow:none;}gap:0;}"], navTokens.topBar.buttonTextColor, navTokens.mobile.breakpoint, navTokens.topBar.buttonTextColor, navTokens.topBar.buttonTextColor);
29
+ var IconButtonText = styled.span.withConfig({
30
+ displayName: "TopBar__IconButtonText",
31
+ componentId: "sc-1mmx14i-3"
32
+ })(["display:none;width:0;"]);
33
+ var Bar = styled.div.withConfig({
34
+ displayName: "TopBar__Bar",
35
+ componentId: "sc-1mmx14i-4"
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;
46
+ var Icon = function Icon(props) {
47
+ return jsx(EmbeteIcon, Object.assign({}, props, {
48
+ type: user.embete.type
49
+ }));
50
+ };
51
+ return jsxs(Bar, {
52
+ environmentBannerActive: environmentBannerActive,
53
+ children: [jsxs(LogoBurgerGroup, {
54
+ children: [jsx(IconButton, {
55
+ icon: isNavigationOpen ? CloseIcon : MenuIcon,
56
+ onClick: function onClick() {
57
+ return onNavigationOpenChange(!isNavigationOpen);
58
+ }
59
+ }), jsx(NavigationLogo, {
60
+ small: true,
61
+ children: "Lovisa"
62
+ })]
63
+ }), jsx(ActionButtonGroup, {
64
+ children: jsxs(OverflowMenuGroup, {
65
+ children: [jsx(IconButton, {
66
+ icon: Icon,
67
+ label: jsx(IconButtonText, {
68
+ children: user.name
69
+ })
70
+ }), jsx(OverflowMenu, {
71
+ items: userMenuItems
72
+ })]
73
+ })
74
+ })]
75
+ });
76
+ };
77
+
78
+ export { TopBar };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Button: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "onFocus" | "onBlur" | "type">, "id" | "className"> & {
3
3
  size?: import("./Button.types").ButtonSize | undefined;
4
- label?: string | undefined;
4
+ label?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
5
5
  purpose?: import("./Button.types").ButtonPurpose | undefined;
6
6
  iconPosition?: import("./Button.types").IconPosition | undefined;
7
7
  appearance?: import("./Button.types").ButtonAppearance | undefined;
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  title: string;
5
5
  component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onFocus" | "onBlur" | "onClick">, "className" | "id"> & {
6
6
  size?: import("./Button.types").ButtonSize | undefined;
7
- label?: string | undefined;
7
+ label?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
8
8
  purpose?: import("./Button.types").ButtonPurpose | undefined;
9
9
  iconPosition?: import("./Button.types").IconPosition | undefined;
10
10
  appearance?: import("./Button.types").ButtonAppearance | undefined;
@@ -1,4 +1,4 @@
1
- import { ButtonHTMLAttributes } from 'react';
1
+ import { ButtonHTMLAttributes, ReactElement } from 'react';
2
2
  import { BaseComponentProps } from '@norges-domstoler/dds-core';
3
3
  import { SvgIcon } from '@norges-domstoler/dds-icons';
4
4
  export type ButtonPurpose = 'primary' | 'secondary' | 'danger';
@@ -10,7 +10,7 @@ export type ButtonProps = BaseComponentProps<HTMLButtonElement, {
10
10
  /**Størrelsen på knappen. */
11
11
  size?: ButtonSize;
12
12
  /**Tekst i knappen. */
13
- label?: string;
13
+ label?: string | ReactElement;
14
14
  /**Bestemmer farger basert på formål. */
15
15
  purpose?: ButtonPurpose;
16
16
  /** Posisjonen til ikonet i forhold til teksten.*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "13.7.0",
3
+ "version": "13.8.1",
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",