@norges-domstoler/dds-components 13.6.2 → 13.6.4

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.
@@ -0,0 +1,13 @@
1
+ import { PropsWithChildren, ReactElement } from 'react';
2
+ export type AppShellProps = PropsWithChildren<{
3
+ /**Versjon på appen på formatet 0.0.0 */
4
+ version?: string;
5
+ navigation: AppShellNavigationProps;
6
+ }>;
7
+ export type AppShellNavigationProps = {
8
+ /**Interne lenker i navigasjonen. */
9
+ internal?: ReactElement[];
10
+ /**Eksterne lenker i navigasjonen. */
11
+ external?: ReactElement[];
12
+ };
13
+ export declare const AppShell: ({ children, version, navigation: { internal, external }, }: AppShellProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import styled from 'styled-components';
3
+ import { appShellTokens } from './AppShell.tokens.js';
4
+ import { Navigation } from './Navigation/Navigation.js';
5
+
6
+ var AppShellContainer = styled.div.withConfig({
7
+ displayName: "AppShell__AppShellContainer",
8
+ componentId: "sc-1c8yu5p-0"
9
+ })(["display:flex;flex-direction:row;"]);
10
+ var MainContent = styled.main.withConfig({
11
+ displayName: "AppShell__MainContent",
12
+ componentId: "sc-1c8yu5p-1"
13
+ })(["min-width:calc(100vw - ", ");max-width:calc(100vw - ", ");"], appShellTokens.navigation.width, appShellTokens.navigation.width);
14
+ var AppShell = function AppShell(_ref) {
15
+ var children = _ref.children,
16
+ _ref$version = _ref.version,
17
+ version = _ref$version === void 0 ? '' : _ref$version,
18
+ _ref$navigation = _ref.navigation,
19
+ _ref$navigation$inter = _ref$navigation.internal,
20
+ internal = _ref$navigation$inter === void 0 ? [] : _ref$navigation$inter,
21
+ _ref$navigation$exter = _ref$navigation.external,
22
+ external = _ref$navigation$exter === void 0 ? [] : _ref$navigation$exter;
23
+ return jsxs(AppShellContainer, {
24
+ children: [jsx(Navigation, {
25
+ version: version,
26
+ internal: internal,
27
+ external: external
28
+ }), jsx(MainContent, {
29
+ children: children
30
+ })]
31
+ });
32
+ };
33
+
34
+ export { AppShell };
@@ -0,0 +1,23 @@
1
+ import { ComponentProps } from 'react';
2
+ import { AppShell } from '.';
3
+ declare const _default: {
4
+ title: string;
5
+ component: (({ children, version, navigation: { internal, external }, }: import("./AppShell").AppShellProps) => import("react/jsx-runtime").JSX.Element) & {
6
+ NavItem: {
7
+ <T extends import("@norges-domstoler/dds-core").As = "a">({ as: _as, active, icon, external, children, ...rest }: import("react").PropsWithoutRef<ComponentProps<T>> & {
8
+ as?: T | undefined;
9
+ } & ({
10
+ icon: import("@norges-domstoler/dds-icons").SvgIcon;
11
+ active?: boolean | undefined;
12
+ external?: false | undefined;
13
+ } | {
14
+ external: true;
15
+ active?: false | undefined;
16
+ icon?: undefined;
17
+ })): import("react/jsx-runtime").JSX.Element;
18
+ displayName: string;
19
+ };
20
+ };
21
+ };
22
+ export default _default;
23
+ export declare const Default: (args: ComponentProps<typeof AppShell>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ export declare const appShellTokens: {
2
+ navigation: {
3
+ navigationItems: {
4
+ gap: string;
5
+ item: {
6
+ color: string;
7
+ borderRadius: string;
8
+ padding: string;
9
+ gap: string;
10
+ external: {
11
+ lineHeight: any;
12
+ fontSize: string;
13
+ letterSpacing: any;
14
+ fontFamily: any;
15
+ fontWeight: any;
16
+ fontStyle: any;
17
+ };
18
+ hover: {
19
+ backgroundColor: string;
20
+ };
21
+ active: {
22
+ color: string;
23
+ backgroundColor: string;
24
+ };
25
+ lineHeight: any;
26
+ fontSize: string;
27
+ letterSpacing: any;
28
+ fontFamily: any;
29
+ fontWeight: any;
30
+ fontStyle: any;
31
+ };
32
+ };
33
+ logoAndVersion: {
34
+ padding: string;
35
+ color: string;
36
+ logo: {
37
+ fontWeight: number;
38
+ lineHeight: any;
39
+ fontSize: string;
40
+ letterSpacing: any;
41
+ fontFamily: any;
42
+ fontStyle: any;
43
+ };
44
+ version: {
45
+ lineHeight: any;
46
+ fontSize: string;
47
+ letterSpacing: any;
48
+ fontFamily: any;
49
+ fontWeight: any;
50
+ fontStyle: any;
51
+ };
52
+ };
53
+ color: string;
54
+ backgroundColor: string;
55
+ gap: string;
56
+ dividerColor: string;
57
+ padding: string;
58
+ width: string;
59
+ mobile: {
60
+ iconColors: string;
61
+ };
62
+ };
63
+ floatingActionButtons: {
64
+ gap: string;
65
+ textColor: string;
66
+ backgroundColor: string;
67
+ };
68
+ };
@@ -0,0 +1,55 @@
1
+ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
2
+
3
+ var colors = ddsBaseTokens.colors,
4
+ spacing = ddsBaseTokens.spacing,
5
+ fontPackages = ddsBaseTokens.fontPackages,
6
+ borderRadius = ddsBaseTokens.borderRadius;
7
+ var navigationItems = {
8
+ gap: spacing.SizesDdsSpacingLocalX05,
9
+ item: Object.assign(Object.assign({}, fontPackages.body_sans_02.base), {
10
+ color: colors.DdsColorNeutralsGray1,
11
+ borderRadius: borderRadius.RadiiDdsBorderRadius3Radius,
12
+ padding: spacing.SizesDdsSpacingLocalX075,
13
+ gap: spacing.SizesDdsSpacingLocalX05,
14
+ external: Object.assign({}, fontPackages.body_sans_01.base),
15
+ hover: {
16
+ backgroundColor: colors.DdsColorPrimaryDark
17
+ },
18
+ active: {
19
+ color: colors.DdsColorNeutralsWhite,
20
+ backgroundColor: colors.DdsColorPrimaryDarker
21
+ }
22
+ })
23
+ };
24
+ var logoAndVersion = {
25
+ padding: '36px 24px',
26
+ color: colors.DdsColorNeutralsWhite,
27
+ logo: Object.assign(Object.assign({}, fontPackages.heading_sans_05.base), {
28
+ fontWeight: 700
29
+ }),
30
+ version: Object.assign({}, fontPackages.supportingStyle_tiny_01.base)
31
+ };
32
+ var navigation = {
33
+ navigationItems: navigationItems,
34
+ logoAndVersion: logoAndVersion,
35
+ color: colors.DdsColorNeutralsGray1,
36
+ backgroundColor: colors.DdsColorPrimaryBase,
37
+ gap: spacing.SizesDdsSpacingLocalX05,
38
+ dividerColor: colors.DdsColorPrimaryLight,
39
+ padding: spacing.SizesDdsSpacingLocalX1,
40
+ width: '264px',
41
+ mobile: {
42
+ iconColors: colors.DdsColorNeutralsGray3
43
+ }
44
+ };
45
+ var floatingActionButtons = {
46
+ gap: spacing.SizesDdsSpacingLocalX1,
47
+ textColor: colors.DdsColorNeutralsGray7,
48
+ backgroundColor: colors.DdsColorPrimaryDarker
49
+ };
50
+ var appShellTokens = {
51
+ navigation: navigation,
52
+ floatingActionButtons: floatingActionButtons
53
+ };
54
+
55
+ export { appShellTokens };
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from 'react';
2
+ export declare const NavigationItems: import("styled-components").StyledComponent<"nav", any, {}, never>;
3
+ export type NavigationProps = {
4
+ version: string;
5
+ internal: ReactElement[];
6
+ external: ReactElement[];
7
+ };
8
+ export declare const Navigation: ({ version, internal, external, }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Children } from 'react';
3
+ import styled from 'styled-components';
4
+ import { appShellTokens } from '../AppShell.tokens.js';
5
+ import { Divider } from '../../Divider/Divider.js';
6
+ import { NavigationItem } from './NavigationItem.js';
7
+
8
+ var navTokens = appShellTokens.navigation;
9
+ var Sidebar = styled.div.withConfig({
10
+ displayName: "Navigation__Sidebar",
11
+ componentId: "sc-twhp5c-0"
12
+ })(["display:flex;flex-direction:column;height:100vh;width:", ";padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:sticky;top:0;left:0;"], navTokens.width, navTokens.padding, navTokens.color, navTokens.backgroundColor);
13
+ var LogoAndVersionContainer = styled.div.withConfig({
14
+ displayName: "Navigation__LogoAndVersionContainer",
15
+ componentId: "sc-twhp5c-1"
16
+ })(["display:flex;flex-direction:column;color:", ";padding:", ";"], navTokens.logoAndVersion.color, navTokens.logoAndVersion.padding);
17
+ var Logo = styled.a.withConfig({
18
+ displayName: "Navigation__Logo",
19
+ componentId: "sc-twhp5c-2"
20
+ })(["font-size:", ";font-style:", ";font-family:", ";font-weight:", ";line-height:", ";letter-spacing:", ";text-align:middle;"], navTokens.logoAndVersion.logo.fontSize, navTokens.logoAndVersion.logo.fontStyle, navTokens.logoAndVersion.logo.fontFamily, navTokens.logoAndVersion.logo.fontWeight, navTokens.logoAndVersion.logo.lineHeight, navTokens.logoAndVersion.logo.letterSpacing);
21
+ var Version = styled.span.withConfig({
22
+ displayName: "Navigation__Version",
23
+ componentId: "sc-twhp5c-3"
24
+ })(["font-size:", ";font-style:", ";font-family:", ";font-weight:", ";line-height:", ";letter-spacing:", ";"], navTokens.logoAndVersion.version.fontSize, navTokens.logoAndVersion.version.fontStyle, navTokens.logoAndVersion.version.fontFamily, navTokens.logoAndVersion.version.fontWeight, navTokens.logoAndVersion.version.lineHeight, navTokens.logoAndVersion.version.letterSpacing);
25
+ var NavigationItems = styled.nav.withConfig({
26
+ displayName: "Navigation__NavigationItems",
27
+ componentId: "sc-twhp5c-4"
28
+ })(["display:flex;flex-direction:column;gap:", ";"], navTokens.navigationItems.gap);
29
+ var DividerWrapper = styled.div.withConfig({
30
+ displayName: "Navigation__DividerWrapper",
31
+ componentId: "sc-twhp5c-5"
32
+ })(["padding-left:", ";padding-right:", ";"], navTokens.navigationItems.item.padding, navTokens.navigationItems.item.padding);
33
+ var StyledDivider = styled(Divider).withConfig({
34
+ displayName: "Navigation__StyledDivider",
35
+ componentId: "sc-twhp5c-6"
36
+ })(["border-color:", ";"], navTokens.dividerColor);
37
+ var Navigation = function Navigation(_ref) {
38
+ var version = _ref.version,
39
+ internal = _ref.internal,
40
+ external = _ref.external;
41
+ return jsxs(Sidebar, {
42
+ children: [jsxs(LogoAndVersionContainer, {
43
+ children: [jsx(Logo, {
44
+ children: "Lovisa"
45
+ }), version !== '' && jsxs(Version, {
46
+ children: ["v ", version]
47
+ })]
48
+ }), jsxs(NavigationItems, {
49
+ children: [Children.map(internal, function (item) {
50
+ if (item.type !== NavigationItem) {
51
+ console.warn("Du bruker en React-komponent som ikke er tillat i AppShell-internal. Du kan kun bruke AppShell.NavItem i AppShell-internal.");
52
+ return null;
53
+ }
54
+ return item;
55
+ }), external.length > 0 && jsx(DividerWrapper, {
56
+ children: jsx(StyledDivider, {})
57
+ }), Children.map(external, function (item) {
58
+ if (item.type !== NavigationItem) {
59
+ console.warn('Du bruker en React-komponent som ikke er tillat i AppShell-external. Du kan kun bruke AppShell.NavItem i AppShell-external.');
60
+ return null;
61
+ }
62
+ return item;
63
+ })]
64
+ })]
65
+ });
66
+ };
67
+
68
+ export { Navigation, NavigationItems };
@@ -0,0 +1,17 @@
1
+ import { type PropsOf, type As } from '@norges-domstoler/dds-core';
2
+ import { SvgIcon } from '@norges-domstoler/dds-icons';
3
+ type BaseNavigationItemProps = {
4
+ icon: SvgIcon;
5
+ active?: boolean;
6
+ external?: undefined | false;
7
+ } | {
8
+ external: true;
9
+ active?: undefined | false;
10
+ icon?: undefined;
11
+ };
12
+ type NavigationItemProps<T extends As = 'a'> = PropsOf<T> & BaseNavigationItemProps;
13
+ export declare const NavigationItem: {
14
+ <T extends As = "a">({ as: _as, active, icon, external, children, ...rest }: NavigationItemProps<T>): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ export {};
@@ -0,0 +1,70 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import styled from 'styled-components';
4
+ import { Icon, OpenExternalIcon, ChevronRightIcon } from '@norges-domstoler/dds-icons';
5
+ import { appShellTokens } from '../AppShell.tokens.js';
6
+
7
+ var navTokens = appShellTokens.navigation;
8
+ var navItemTokens = navTokens.navigationItems.item;
9
+ var IconContainer = styled.div.withConfig({
10
+ displayName: "NavigationItem__IconContainer",
11
+ componentId: "sc-8k2l5g-0"
12
+ })(["grid-area:icon;display:flex;align-items:center;"]);
13
+ var TextContainer = styled.span.withConfig({
14
+ displayName: "NavigationItem__TextContainer",
15
+ componentId: "sc-8k2l5g-1"
16
+ })(["grid-area:text;"]);
17
+ var ChevronContainer = styled.div.withConfig({
18
+ displayName: "NavigationItem__ChevronContainer",
19
+ componentId: "sc-8k2l5g-2"
20
+ })(["display:flex;align-items:center;opacity:0;grid-area:chevron;"]);
21
+ var BaseLink = styled.a.withConfig({
22
+ displayName: "NavigationItem__BaseLink",
23
+ componentId: "sc-8k2l5g-3"
24
+ })(["padding:", ";gap:", ";border-radius:", ";text-decoration:none;color:", ";font-size:", ";font-style:", ";font-family:", ";font-weight:", ";line-height:", ";letter-spacing:", ";:hover:not(.active){background-color:", ";}&.active{color:", ";background-color:", ";}"], navItemTokens.padding, navItemTokens.gap, navItemTokens.borderRadius, navItemTokens.color, navItemTokens.fontSize, navItemTokens.fontStyle, navItemTokens.fontFamily, navItemTokens.fontWeight, navItemTokens.lineHeight, navItemTokens.letterSpacing, navItemTokens.hover.backgroundColor, navItemTokens.active.color, navItemTokens.active.backgroundColor);
25
+ var InternalNavItem = styled(BaseLink).withConfig({
26
+ displayName: "NavigationItem__InternalNavItem",
27
+ componentId: "sc-8k2l5g-4"
28
+ })(["display:grid;align-items:center;grid-template-areas:'icon text chevron';grid-template-columns:min-content 1fr min-content;:hover{", "{opacity:1;}}"], ChevronContainer);
29
+ var ExternalNavItem = styled(BaseLink).withConfig({
30
+ displayName: "NavigationItem__ExternalNavItem",
31
+ componentId: "sc-8k2l5g-5"
32
+ })(["display:flex;flex-direction:row;align-items:center;font-size:", ";font-style:", ";font-family:", ";font-weight:", ";line-height:", ";letter-spacing:", ";"], navItemTokens.external.fontSize, navItemTokens.external.fontStyle, navItemTokens.external.fontFamily, navItemTokens.external.fontWeight, navItemTokens.external.lineHeight, navItemTokens.external.letterSpacing);
33
+ var NavigationItem = function NavigationItem(_a) {
34
+ var _as = _a.as,
35
+ active = _a.active,
36
+ icon = _a.icon,
37
+ external = _a.external,
38
+ children = _a.children,
39
+ rest = __rest(_a, ["as", "active", "icon", "external", "children"]);
40
+ var Comp = _as !== null && _as !== void 0 ? _as : 'a';
41
+ if (external) {
42
+ return jsxs(ExternalNavItem, Object.assign({
43
+ as: Comp
44
+ }, rest, {
45
+ children: [children, jsx(Icon, {
46
+ icon: OpenExternalIcon,
47
+ iconSize: "inherit"
48
+ })]
49
+ }));
50
+ }
51
+ return jsxs(InternalNavItem, Object.assign({
52
+ as: Comp
53
+ }, rest, {
54
+ className: active ? 'active' : '',
55
+ children: [jsx(IconContainer, {
56
+ children: icon && jsx(Icon, {
57
+ icon: icon
58
+ })
59
+ }), jsx(TextContainer, {
60
+ children: children
61
+ }), jsx(ChevronContainer, {
62
+ children: jsx(Icon, {
63
+ icon: ChevronRightIcon
64
+ })
65
+ })]
66
+ }));
67
+ };
68
+ NavigationItem.displayName = 'AppShell.NavItem';
69
+
70
+ export { NavigationItem };
@@ -0,0 +1,7 @@
1
+ import { AppShell as BaseAppShell, AppShellProps } from './AppShell';
2
+ import { NavigationItem } from './Navigation/NavigationItem';
3
+ type CompoundAppShell = typeof BaseAppShell & {
4
+ NavItem: typeof NavigationItem;
5
+ };
6
+ declare const AppShell: CompoundAppShell;
7
+ export { AppShell, type AppShellProps };
@@ -0,0 +1,7 @@
1
+ import { AppShell as AppShell$1 } from './AppShell.js';
2
+ import { NavigationItem } from './Navigation/NavigationItem.js';
3
+
4
+ var AppShell = AppShell$1;
5
+ AppShell.NavItem = NavigationItem;
6
+
7
+ export { AppShell };
@@ -2,14 +2,14 @@
2
2
  import { ListProps } from '.';
3
3
  declare const _default: {
4
4
  title: string;
5
- component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLUListElement | HTMLOListElement>, "className" | "id"> & {
5
+ component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLOListElement | HTMLUListElement>, "className" | "id"> & {
6
6
  listType?: import("./List").ListType | undefined;
7
7
  typographyType?: import("./List").ListTypographyType | undefined;
8
8
  } & {
9
9
  children?: import("react").ReactNode;
10
10
  } & {
11
- htmlProps?: import("react").HTMLAttributes<HTMLUListElement | HTMLOListElement> | undefined;
12
- } & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
11
+ htmlProps?: import("react").HTMLAttributes<HTMLOListElement | HTMLUListElement> | undefined;
12
+ } & import("react").RefAttributes<HTMLOListElement | HTMLUListElement>>;
13
13
  };
14
14
  export default _default;
15
15
  export declare const Overview: (args: ListProps) => import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './dds-core';
5
5
  export * from './dds-form';
6
6
  export * from './dds-icons';
7
7
  export * from './dds-typography';
8
+ export * from './components/AppShell';
8
9
  export * from './components/SelectionControl/RadioButton';
9
10
  export * from './components/SelectionControl/Checkbox';
10
11
  export * from './components/Button';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export { ScreenSize, getBaseHTMLProps, getLiteralScreenSize, isKeyboardEvent, us
3
3
  export * from '@norges-domstoler/dds-form';
4
4
  export * from '@norges-domstoler/dds-icons';
5
5
  export * from '@norges-domstoler/dds-typography';
6
+ export { AppShell } from './components/AppShell/index.js';
6
7
  export { RadioButton } from './components/SelectionControl/RadioButton/RadioButton.js';
7
8
  export { RadioButtonGroup } from './components/SelectionControl/RadioButton/RadioButtonGroup.js';
8
9
  export { Checkbox } from './components/SelectionControl/Checkbox/Checkbox.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "13.6.2",
3
+ "version": "13.6.4",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",