@altinn/altinn-components 0.6.11 → 0.6.12

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/README.md CHANGED
@@ -42,23 +42,12 @@ To use the components in your application, you need to import the components you
42
42
  // example: import the Avatar component and type
43
43
  import { Avatar, type AvatarVariant } from '@altinn/components';
44
44
  ```
45
- and import the css file in your application once:
45
+ and import the css file in your application once, e.g. in your css:
46
46
  ```ts
47
47
  import '@altinn/altinn-components/lib/css/global.css';
48
48
  ```
49
49
  for correct `font-family` and minimal collection of resets.
50
50
 
51
- Using `nextjs`?
52
-
53
- You probably need to transpile the package. Add the following to your `next.config.js`:
54
-
55
- ```js
56
- /** @type {import('next').NextConfig} */
57
- const nextConfig = {
58
- transpilePackages: ['@altinn/components'],
59
- }
60
- module.exports = nextConfig
61
- ```
62
51
 
63
52
  ## Documentation
64
53
  The documentation for the components can be found in the [Storybook](https://altinn.github.io/altinn-components)
@@ -1,9 +1,10 @@
1
- import { GlobalMenuProps } from '../GlobalMenu';
2
- import { Account } from '../GlobalMenu/AccountButton.tsx';
1
+ import { GlobalMenuProps, Account } from '../GlobalMenu';
3
2
  import { SearchbarProps } from '../Searchbar';
3
+ import { HeaderLogoProps } from './HeaderLogo';
4
4
  export interface HeaderProps {
5
5
  menu: GlobalMenuProps;
6
6
  search?: SearchbarProps;
7
7
  currentAccount?: Account;
8
+ logo?: HeaderLogoProps;
8
9
  }
9
- export declare const Header: ({ search, menu, currentAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Header: ({ search, menu, currentAccount, logo }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,53 +1,53 @@
1
1
  "use client";
2
2
  import { jsxs as p, jsx as o } from "react/jsx-runtime";
3
3
  import "react";
4
- import { useEscapeKey as h } from "../../hooks/useEscapeKey.js";
5
- import { DropdownBase as w } from "../Dropdown/DropdownBase.js";
4
+ import { useEscapeKey as w } from "../../hooks/useEscapeKey.js";
5
+ import { DropdownBase as g } from "../Dropdown/DropdownBase.js";
6
6
  import "../../index-L8X2o7IH.js";
7
- import { DrawerBase as g } from "../Dropdown/DrawerBase.js";
7
+ import { DrawerBase as x } from "../Dropdown/DrawerBase.js";
8
8
  import "../Icon/SvgIcon.js";
9
- import { useRootContext as x } from "../RootProvider/RootProvider.js";
9
+ import { useRootContext as H } from "../RootProvider/RootProvider.js";
10
10
  import { GlobalMenu as t } from "../GlobalMenu/GlobalMenu.js";
11
- import { HeaderBase as H } from "./HeaderBase.js";
12
- import { HeaderLogo as _ } from "./HeaderLogo.js";
13
- import { HeaderButton as C } from "./HeaderButton.js";
14
- import { Searchbar as b } from "../Searchbar/Searchbar.js";
15
- import { HeaderMenu as y } from "./HeaderMenu.js";
16
- import { HeaderSearch as B } from "./HeaderSearch.js";
17
- import '../../assets/Header.css';const N = "_drawer_1wgf5_1", S = "_dropdown_1wgf5_5", d = {
18
- drawer: N,
19
- dropdown: S
20
- }, z = ({ search: s, menu: r, currentAccount: a }) => {
21
- const { currentId: e, toggleId: n, openId: l, closeAll: m } = x();
22
- h(m);
23
- const i = () => {
24
- l("search");
25
- }, c = () => {
26
- n("search");
11
+ import { HeaderBase as _ } from "./HeaderBase.js";
12
+ import { HeaderLogo as C } from "./HeaderLogo.js";
13
+ import { HeaderButton as b } from "./HeaderButton.js";
14
+ import { Searchbar as y } from "../Searchbar/Searchbar.js";
15
+ import { HeaderMenu as B } from "./HeaderMenu.js";
16
+ import { HeaderSearch as N } from "./HeaderSearch.js";
17
+ import '../../assets/Header.css';const S = "_drawer_1wgf5_1", I = "_dropdown_1wgf5_5", d = {
18
+ drawer: S,
19
+ dropdown: I
20
+ }, J = ({ search: s, menu: r, currentAccount: a, logo: l = {} }) => {
21
+ const { currentId: e, toggleId: n, openId: i, closeAll: m } = H();
22
+ w(m);
23
+ const c = () => {
24
+ i("search");
27
25
  }, f = () => {
26
+ n("search");
27
+ }, h = () => {
28
28
  n("menu");
29
29
  };
30
- return /* @__PURE__ */ p(H, { currentId: e, open: e === "search" || e === "menu", onClose: m, children: [
31
- /* @__PURE__ */ o(_, { className: d.logo }),
32
- /* @__PURE__ */ p(y, { className: d.menu, children: [
30
+ return /* @__PURE__ */ p(_, { currentId: e, open: e === "search" || e === "menu", onClose: m, children: [
31
+ /* @__PURE__ */ o(C, { ...l, className: d.logo }),
32
+ /* @__PURE__ */ p(B, { className: d.menu, children: [
33
33
  /* @__PURE__ */ o(
34
- C,
34
+ b,
35
35
  {
36
36
  avatar: a && {
37
37
  type: a.type,
38
38
  name: a.name
39
39
  },
40
- onClick: f,
40
+ onClick: h,
41
41
  expanded: e === "menu",
42
42
  label: r == null ? void 0 : r.menuLabel
43
43
  }
44
44
  ),
45
- r && /* @__PURE__ */ o(w, { padding: !1, placement: "right", expanded: e === "menu", className: d.dropdown, children: /* @__PURE__ */ o(t, { ...r, currentAccount: a }) })
45
+ r && /* @__PURE__ */ o(g, { padding: !1, placement: "right", expanded: e === "menu", className: d.dropdown, children: /* @__PURE__ */ o(t, { ...r, currentAccount: a }) })
46
46
  ] }),
47
- s && /* @__PURE__ */ o(B, { expanded: e === "search", children: /* @__PURE__ */ o(b, { ...s, expanded: e === "search", onClose: c, onFocus: i }) }),
48
- r && /* @__PURE__ */ o(g, { expanded: e === "menu", className: d.drawer, children: /* @__PURE__ */ o(t, { ...r, currentAccount: a }) })
47
+ s && /* @__PURE__ */ o(N, { expanded: e === "search", children: /* @__PURE__ */ o(y, { ...s, expanded: e === "search", onClose: f, onFocus: c }) }),
48
+ r && /* @__PURE__ */ o(x, { expanded: e === "menu", className: d.drawer, children: /* @__PURE__ */ o(t, { ...r, currentAccount: a }) })
49
49
  ] });
50
50
  };
51
51
  export {
52
- z as Header
52
+ J as Header
53
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.6.11",
3
+ "version": "0.6.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [