@altinn/altinn-components 0.7.3 → 0.7.5
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/Autocomplete-hEFuiN2u.js +287 -0
- package/dist/assets/Autocomplete.css +1 -0
- package/dist/assets/GlobalMenuBase.css +1 -1
- package/dist/assets/Header.css +1 -1
- package/dist/assets/LayoutBase.css +1 -1
- package/dist/components/Bookmarks/BookmarksList.js +1 -1
- package/dist/components/Bookmarks/BookmarksListItem.js +4 -5
- package/dist/components/Bookmarks/BookmarksListItem.stories.js +7 -7
- package/dist/components/Bookmarks/index.js +4 -4
- package/dist/components/Button/Buttons.stories.js +5 -4
- package/dist/components/ContextMenu/ContextMenu.js +4 -27
- package/dist/components/ContextMenu/ContextMenu.stories.js +3 -3
- package/dist/components/ContextMenu/ContextMenuBase.js +6 -32
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/components/Dialog/DialogActions.js +3 -2
- package/dist/components/Dialog/DialogGroup.js +3 -2
- package/dist/components/Dialog/DialogList.js +1 -1
- package/dist/components/Dialog/DialogListItem.js +13 -87
- package/dist/components/Dialog/DialogListItem.stories.js +1 -1
- package/dist/components/Dialog/DialogNav.js +11 -11
- package/dist/components/Dialog/Examples.stories.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dropdown/DrawerButton.js +5 -4
- package/dist/components/Dropdown/DrawerOrDropdown.js +7 -6
- package/dist/components/GlobalMenu/AccountButton.js +3 -2
- package/dist/components/GlobalMenu/AccountMenu.d.ts +5 -2
- package/dist/components/GlobalMenu/AccountMenu.js +35 -26
- package/dist/components/GlobalMenu/AccountMenu.stories.js +19 -2
- package/dist/components/GlobalMenu/BackButton.js +3 -2
- package/dist/components/GlobalMenu/GlobalMenu.js +3 -2
- package/dist/components/GlobalMenu/GlobalMenu.stories.js +6 -12
- package/dist/components/GlobalMenu/GlobalMenuBase.js +9 -9
- package/dist/components/Header/Header.js +13 -13
- package/dist/components/Header/HeaderBase.js +5 -4
- package/dist/components/Layout/Layout.js +9 -8
- package/dist/components/Layout/Layout.stories.js +140 -49
- package/dist/components/Layout/LayoutBase.js +3 -3
- package/dist/components/LayoutAction/ActionMenu.js +5 -4
- package/dist/components/List/List.js +3 -3
- package/dist/components/List/List.stories.js +5 -4
- package/dist/components/List/ListItem.js +6 -39
- package/dist/components/List/ListItem.stories.js +1 -1
- package/dist/components/List/ListItemControls.js +5 -15
- package/dist/components/List/index.js +12 -13
- package/dist/components/Menu/Menu.js +9 -9
- package/dist/components/Menu/MenuItem.stories.js +21 -20
- package/dist/components/Menu/MenuItems.js +8 -59
- package/dist/components/Menu/MenuItems.stories.js +1 -1
- package/dist/components/Menu/MenuSearch.js +6 -5
- package/dist/components/Menu/index.js +7 -7
- package/dist/components/Page/PageHeader.js +8 -7
- package/dist/components/Searchbar/Autocomplete.d.ts +1 -2
- package/dist/components/Searchbar/Autocomplete.js +7 -23
- package/dist/components/Searchbar/Autocomplete.stories.js +1 -1
- package/dist/components/Searchbar/AutocompleteBase.d.ts +2 -1
- package/dist/components/Searchbar/AutocompleteBase.js +9 -6
- package/dist/components/Searchbar/AutocompleteItem.js +3 -20
- package/dist/components/Searchbar/ScopeListItem.d.ts +2 -2
- package/dist/components/Searchbar/ScopeListItem.js +3 -6
- package/dist/components/Searchbar/SearchField.js +39 -39
- package/dist/components/Searchbar/Searchbar.d.ts +1 -1
- package/dist/components/Searchbar/Searchbar.js +25 -17
- package/dist/components/Searchbar/Searchbar.stories.js +63 -47
- package/dist/components/Toolbar/ToolbarAdd.js +3 -2
- package/dist/components/Toolbar/ToolbarDaterange.js +3 -2
- package/dist/components/Toolbar/ToolbarFilter.js +3 -2
- package/dist/components/Toolbar/ToolbarMenu.js +3 -2
- package/dist/components/Toolbar/ToolbarOptions.js +13 -12
- package/dist/components/Toolbar/ToolbarSearch.js +16 -15
- package/dist/components/index.js +213 -218
- package/dist/hooks/useEnterKey.d.ts +1 -0
- package/dist/hooks/useEnterKey.js +15 -0
- package/dist/index.js +226 -231
- package/package.json +1 -1
- package/dist/assets/ContextMenuBase.css +0 -1
- package/dist/assets/DialogListItem.css +0 -1
- package/dist/assets/ListItemControls.css +0 -1
- package/dist/assets/ScopeListItem.css +0 -1
|
@@ -1,64 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { Fragment as L } from "react";
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
4
3
|
import "../../index-L8X2o7IH.js";
|
|
5
4
|
import "../Icon/SvgIcon.js";
|
|
6
5
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
level: c = 0,
|
|
13
|
-
expanded: I,
|
|
14
|
-
items: b,
|
|
15
|
-
groups: r = {},
|
|
16
|
-
defaultItemColor: l,
|
|
17
|
-
defaultItemSize: o
|
|
18
|
-
}) => {
|
|
19
|
-
const { menu: f } = G({
|
|
20
|
-
items: b,
|
|
21
|
-
groups: r,
|
|
22
|
-
groupByKey: "groupId",
|
|
23
|
-
keyboardEvents: !1
|
|
24
|
-
});
|
|
25
|
-
return /* @__PURE__ */ a(E, { expanded: I, children: f.map((t, s) => {
|
|
26
|
-
const n = (t == null ? void 0 : t.props) || {}, { title: x, divider: v = !0 } = n, y = f[s + 1];
|
|
27
|
-
return /* @__PURE__ */ i(L, { children: [
|
|
28
|
-
(c > 0 || s) && v ? /* @__PURE__ */ a(m, { role: "separator" }) : "",
|
|
29
|
-
x && /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(B, { title: x }) }),
|
|
30
|
-
t == null ? void 0 : t.items.map((M, h) => {
|
|
31
|
-
const { active: F } = M, { groupId: K, ...e } = M.props || {}, { expanded: d } = e, j = t == null ? void 0 : t.items[h + 1];
|
|
32
|
-
return /* @__PURE__ */ i(m, { role: "presentation", expanded: d, children: [
|
|
33
|
-
/* @__PURE__ */ a(
|
|
34
|
-
k,
|
|
35
|
-
{
|
|
36
|
-
...e,
|
|
37
|
-
color: (e == null ? void 0 : e.color) || (n == null ? void 0 : n.defaultItemColor) || l,
|
|
38
|
-
size: (e == null ? void 0 : e.size) || (n == null ? void 0 : n.defaultItemSize) || o,
|
|
39
|
-
active: F,
|
|
40
|
-
tabIndex: e != null && e.disabled ? -1 : 0
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
d && (e == null ? void 0 : e.items) && /* @__PURE__ */ i(z, { children: [
|
|
44
|
-
/* @__PURE__ */ a(
|
|
45
|
-
H,
|
|
46
|
-
{
|
|
47
|
-
expanded: d,
|
|
48
|
-
level: c + 1,
|
|
49
|
-
items: e == null ? void 0 : e.items,
|
|
50
|
-
groups: r,
|
|
51
|
-
defaultItemColor: l,
|
|
52
|
-
defaultItemSize: o
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
(y || j) && /* @__PURE__ */ a(m, { role: "separator" })
|
|
56
|
-
] })
|
|
57
|
-
] }, h);
|
|
58
|
-
})
|
|
59
|
-
] }, s);
|
|
60
|
-
}) });
|
|
61
|
-
};
|
|
6
|
+
import "./MenuItem.js";
|
|
7
|
+
import "./MenuHeader.js";
|
|
8
|
+
import { M as n } from "../../Autocomplete-hEFuiN2u.js";
|
|
9
|
+
import "./MenuBase.js";
|
|
10
|
+
import "../../hooks/useMenu.js";
|
|
62
11
|
export {
|
|
63
|
-
|
|
12
|
+
n as MenuItems
|
|
64
13
|
};
|
|
@@ -5,17 +5,18 @@ import "../../index-L8X2o7IH.js";
|
|
|
5
5
|
import "react";
|
|
6
6
|
import { IconButton as a } from "../Button/IconButton.js";
|
|
7
7
|
import "../RootProvider/RootProvider.js";
|
|
8
|
+
import "../../Autocomplete-hEFuiN2u.js";
|
|
8
9
|
import '../../assets/MenuSearch.css';const l = "_field_mo7y9_1", p = "_icon_mo7y9_5", _ = "_input_mo7y9_14", f = "_clear_mo7y9_31", o = {
|
|
9
10
|
field: l,
|
|
10
11
|
icon: p,
|
|
11
12
|
input: _,
|
|
12
13
|
clear: f
|
|
13
|
-
},
|
|
14
|
+
}, j = ({ value: c, name: n, placeholder: s = "Søk", onChange: e, onClear: t }) => /* @__PURE__ */ m("div", { className: o.field, children: [
|
|
14
15
|
/* @__PURE__ */ i(
|
|
15
16
|
"input",
|
|
16
17
|
{
|
|
17
18
|
type: "search",
|
|
18
|
-
value:
|
|
19
|
+
value: c,
|
|
19
20
|
name: n,
|
|
20
21
|
placeholder: s,
|
|
21
22
|
className: o.input,
|
|
@@ -24,7 +25,7 @@ import '../../assets/MenuSearch.css';const l = "_field_mo7y9_1", p = "_icon_mo7y
|
|
|
24
25
|
}
|
|
25
26
|
),
|
|
26
27
|
/* @__PURE__ */ i(r, { name: "magnifying-glass", className: o.icon }),
|
|
27
|
-
|
|
28
|
+
t && /* @__PURE__ */ i(
|
|
28
29
|
a,
|
|
29
30
|
{
|
|
30
31
|
icon: "x-mark",
|
|
@@ -32,10 +33,10 @@ import '../../assets/MenuSearch.css';const l = "_field_mo7y9_1", p = "_icon_mo7y
|
|
|
32
33
|
variant: "solid",
|
|
33
34
|
size: "custom",
|
|
34
35
|
className: o.clear,
|
|
35
|
-
onClick:
|
|
36
|
+
onClick: t
|
|
36
37
|
}
|
|
37
38
|
)
|
|
38
39
|
] });
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
j as MenuSearch
|
|
41
42
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MenuItemBase as o } from "./MenuItemBase.js";
|
|
2
2
|
import { MenuItemLabel as m } from "./MenuItemLabel.js";
|
|
3
|
-
import { MenuItemMedia as
|
|
3
|
+
import { MenuItemMedia as M } from "./MenuItemMedia.js";
|
|
4
4
|
import { MenuItem as p } from "./MenuItem.js";
|
|
5
5
|
import { MenuInputField as x } from "./MenuInputField.js";
|
|
6
|
-
import { MenuOption as
|
|
7
|
-
import { MenuSearch as
|
|
6
|
+
import { MenuOption as I } from "./MenuOption.js";
|
|
7
|
+
import { MenuSearch as i } from "./MenuSearch.js";
|
|
8
8
|
import { MenuHeader as L } from "./MenuHeader.js";
|
|
9
|
-
import {
|
|
9
|
+
import { M as B } from "../../Autocomplete-hEFuiN2u.js";
|
|
10
10
|
import { MenuBase as c, MenuList as h, MenuListItem as F } from "./MenuBase.js";
|
|
11
11
|
import { Menu as O } from "./Menu.js";
|
|
12
12
|
export {
|
|
@@ -17,10 +17,10 @@ export {
|
|
|
17
17
|
p as MenuItem,
|
|
18
18
|
o as MenuItemBase,
|
|
19
19
|
m as MenuItemLabel,
|
|
20
|
-
|
|
20
|
+
M as MenuItemMedia,
|
|
21
21
|
B as MenuItems,
|
|
22
22
|
h as MenuList,
|
|
23
23
|
F as MenuListItem,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
I as MenuOption,
|
|
25
|
+
i as MenuSearch
|
|
26
26
|
};
|
|
@@ -4,19 +4,20 @@ import "../Icon/SvgIcon.js";
|
|
|
4
4
|
import "react";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
6
|
import { Heading as c } from "../Typography/Heading.js";
|
|
7
|
+
import "../../Autocomplete-hEFuiN2u.js";
|
|
7
8
|
import { SectionBase as n } from "./SectionBase.js";
|
|
8
|
-
import { P as
|
|
9
|
-
import { PageNav as
|
|
10
|
-
const
|
|
11
|
-
/* @__PURE__ */ e(
|
|
9
|
+
import { P as p, s as i } from "../../PageHeaderMedia-DpZ09tLD.js";
|
|
10
|
+
import { PageNav as l } from "./PageNav.js";
|
|
11
|
+
const z = ({ title: a, description: o, icon: s, avatar: m, avatarGroup: t, children: h, ...d }) => /* @__PURE__ */ r(n, { as: "header", ...d, children: [
|
|
12
|
+
/* @__PURE__ */ e(l, {}),
|
|
12
13
|
/* @__PURE__ */ r("section", { className: i.header, children: [
|
|
13
|
-
/* @__PURE__ */ e(
|
|
14
|
+
/* @__PURE__ */ e(p, { icon: s, avatar: m, avatarGroup: t }),
|
|
14
15
|
/* @__PURE__ */ r("div", { className: i.title, children: [
|
|
15
16
|
/* @__PURE__ */ e(c, { size: "md", children: a }),
|
|
16
|
-
/* @__PURE__ */ e("div", { className: "description", children:
|
|
17
|
+
/* @__PURE__ */ e("div", { className: "description", children: o })
|
|
17
18
|
] })
|
|
18
19
|
] })
|
|
19
20
|
] });
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
z as PageHeader
|
|
22
23
|
};
|
|
@@ -5,6 +5,5 @@ export interface AutocompleteProps {
|
|
|
5
5
|
groups?: Record<string, AutocompleteGroupProps>;
|
|
6
6
|
expanded?: boolean;
|
|
7
7
|
className?: string;
|
|
8
|
-
onSelect?: () => void;
|
|
9
8
|
}
|
|
10
|
-
export declare const Autocomplete: (
|
|
9
|
+
export declare const Autocomplete: import('react').ForwardRefExoticComponent<AutocompleteProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
const M = ({ className: t, items: r, groups: m = {}, expanded: p }) => {
|
|
8
|
-
const { menu: n, setActiveIndex: u } = I({
|
|
9
|
-
items: r,
|
|
10
|
-
groups: m,
|
|
11
|
-
groupByKey: "groupId",
|
|
12
|
-
keyboardEvents: !0
|
|
13
|
-
});
|
|
14
|
-
return /* @__PURE__ */ e(x, { className: t, expanded: p, children: n.map((o, i) => /* @__PURE__ */ f(A, { ...o.props, key: i }, /* @__PURE__ */ e("ul", { children: o.items.map((c, s) => {
|
|
15
|
-
const {
|
|
16
|
-
active: l,
|
|
17
|
-
menuIndex: d,
|
|
18
|
-
props: { groupId: h, ...a }
|
|
19
|
-
} = c;
|
|
20
|
-
return /* @__PURE__ */ e("li", { tabIndex: -1, onMouseEnter: () => u(d), children: /* @__PURE__ */ e(y, { ...a, active: l }) }, s);
|
|
21
|
-
}) }))) });
|
|
22
|
-
};
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../../hooks/useMenu.js";
|
|
4
|
+
import "./AutocompleteBase.js";
|
|
5
|
+
import "./AutocompleteGroup.js";
|
|
6
|
+
import { A } from "../../Autocomplete-hEFuiN2u.js";
|
|
23
7
|
export {
|
|
24
|
-
|
|
8
|
+
A as Autocomplete
|
|
25
9
|
};
|
|
@@ -3,5 +3,6 @@ export interface AutocompleteBaseProps {
|
|
|
3
3
|
className?: string;
|
|
4
4
|
expanded?: boolean;
|
|
5
5
|
children?: ReactNode;
|
|
6
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
6
7
|
}
|
|
7
|
-
export declare const AutocompleteBase: (
|
|
8
|
+
export declare const AutocompleteBase: import('react').ForwardRefExoticComponent<Omit<AutocompleteBaseProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c } from "../../index-L8X2o7IH.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { c as r } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import { forwardRef as c } from "react";
|
|
4
|
+
import '../../assets/AutocompleteBase.css';const p = "_autocomplete_1yzw8_1", s = {
|
|
5
|
+
autocomplete: p
|
|
6
|
+
}, f = c(
|
|
7
|
+
({ expanded: o, children: t, className: e }, a) => /* @__PURE__ */ m("nav", { className: r(s.autocomplete, e), "aria-expanded": o, ref: a, children: t })
|
|
8
|
+
);
|
|
6
9
|
export {
|
|
7
|
-
|
|
10
|
+
f as AutocompleteBase
|
|
8
11
|
};
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../index-L8X2o7IH.js";
|
|
4
4
|
import "../Icon/SvgIcon.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import {
|
|
7
|
-
import { ListItem as o } from "../List/ListItem.js";
|
|
8
|
-
import { BookmarksListItem as n } from "../Bookmarks/BookmarksListItem.js";
|
|
9
|
-
import { ScopeListItem as i } from "./ScopeListItem.js";
|
|
10
|
-
const h = ({ type: m, ...t }) => {
|
|
11
|
-
switch (m) {
|
|
12
|
-
case "scope":
|
|
13
|
-
return /* @__PURE__ */ e(i, { ...t, shadow: "none", tabIndex: -1 });
|
|
14
|
-
case "bookmark":
|
|
15
|
-
return /* @__PURE__ */ e(n, { ...t, shadow: "none", size: "sm", tabIndex: -1 });
|
|
16
|
-
case "dialog":
|
|
17
|
-
return /* @__PURE__ */ e(r, { ...t, shadow: "none", size: "sm", tabIndex: -1 });
|
|
18
|
-
case "information":
|
|
19
|
-
return /* @__PURE__ */ e(o, { ...t, shadow: "none", tabIndex: -1, disabled: !0 });
|
|
20
|
-
default:
|
|
21
|
-
return /* @__PURE__ */ e(o, { ...t, shadow: "none", size: "sm", tabIndex: -1 });
|
|
22
|
-
}
|
|
23
|
-
};
|
|
6
|
+
import { c } from "../../Autocomplete-hEFuiN2u.js";
|
|
24
7
|
export {
|
|
25
|
-
|
|
8
|
+
c as AutocompleteItem
|
|
26
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementType,
|
|
1
|
+
import { ElementType, ReactElement } from 'react';
|
|
2
2
|
import { BadgeProps } from '../Badge';
|
|
3
3
|
import { ListItemProps } from '../List/';
|
|
4
4
|
export interface ScopeListItemProps extends ListItemProps {
|
|
@@ -7,6 +7,6 @@ export interface ScopeListItemProps extends ListItemProps {
|
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
badge: BadgeProps;
|
|
9
9
|
loading?: boolean;
|
|
10
|
-
label?: string | (() =>
|
|
10
|
+
label?: string | (() => ReactElement);
|
|
11
11
|
}
|
|
12
12
|
export declare const ScopeListItem: ({ as, label, ...rest }: ScopeListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "../Icon/SvgIcon.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import {
|
|
7
|
-
import '../../assets/ScopeListItem.css';const r = "_item_1a3bc_1", e = {
|
|
8
|
-
item: r
|
|
9
|
-
}, I = ({ as: s = "a", label: t, ...o }) => /* @__PURE__ */ i(m, { className: e.item, linkIcon: "chevron-right", ...o, children: typeof t == "function" ? t() : t });
|
|
6
|
+
import { S as s } from "../../Autocomplete-hEFuiN2u.js";
|
|
10
7
|
export {
|
|
11
|
-
|
|
8
|
+
s as ScopeListItem
|
|
12
9
|
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { Icon as
|
|
2
|
+
import { jsxs as q, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { c as h } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import { useRef as w } from "react";
|
|
5
|
+
import { Icon as N } from "../Icon/Icon.js";
|
|
6
6
|
import "../Icon/SvgIcon.js";
|
|
7
|
-
import { IconButton as
|
|
8
|
-
import '../../assets/SearchField.css';const
|
|
9
|
-
field:
|
|
7
|
+
import { IconButton as l } from "../Button/IconButton.js";
|
|
8
|
+
import '../../assets/SearchField.css';const b = "_field_1wjpq_1", g = "_icon_1wjpq_10", C = "_input_1wjpq_17", I = "_dismiss_1wjpq_41", K = "_clear_1wjpq_47", s = {
|
|
9
|
+
field: b,
|
|
10
10
|
icon: g,
|
|
11
11
|
input: C,
|
|
12
12
|
dismiss: I,
|
|
13
|
-
clear:
|
|
14
|
-
},
|
|
15
|
-
className:
|
|
16
|
-
expanded:
|
|
17
|
-
name:
|
|
18
|
-
value:
|
|
19
|
-
placeholder:
|
|
13
|
+
clear: K
|
|
14
|
+
}, O = ({
|
|
15
|
+
className: m,
|
|
16
|
+
expanded: c,
|
|
17
|
+
name: p = "q",
|
|
18
|
+
value: e,
|
|
19
|
+
placeholder: u = "Søk",
|
|
20
20
|
onFocus: f,
|
|
21
|
-
onBlur:
|
|
22
|
-
onChange:
|
|
23
|
-
onClear:
|
|
24
|
-
onClose:
|
|
25
|
-
onEnter:
|
|
26
|
-
tabIndex:
|
|
21
|
+
onBlur: d,
|
|
22
|
+
onChange: _,
|
|
23
|
+
onClear: x,
|
|
24
|
+
onClose: y,
|
|
25
|
+
onEnter: a,
|
|
26
|
+
tabIndex: j
|
|
27
27
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
var r;
|
|
30
|
-
t.key === "Escape" && ((r =
|
|
28
|
+
const o = w(null), k = (t) => {
|
|
29
|
+
var r, n;
|
|
30
|
+
t.key === "Escape" && ((r = o.current) == null || r.blur()), t.key === "Enter" && ((n = o.current) == null || n.blur(), a == null || a());
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ q("div", { className: h(s.field, m), "aria-expanded": c, children: [
|
|
33
33
|
/* @__PURE__ */ i(
|
|
34
34
|
"input",
|
|
35
35
|
{
|
|
36
|
-
ref:
|
|
36
|
+
ref: o,
|
|
37
37
|
onFocus: f,
|
|
38
|
-
onBlur:
|
|
39
|
-
name:
|
|
40
|
-
value:
|
|
41
|
-
onChange:
|
|
42
|
-
placeholder:
|
|
38
|
+
onBlur: d,
|
|
39
|
+
name: p,
|
|
40
|
+
value: e,
|
|
41
|
+
onChange: _,
|
|
42
|
+
placeholder: u,
|
|
43
43
|
className: s.input,
|
|
44
|
-
onKeyUp:
|
|
44
|
+
onKeyUp: k,
|
|
45
45
|
type: "search",
|
|
46
46
|
"aria-haspopup": !0,
|
|
47
47
|
autoComplete: "off",
|
|
48
48
|
"aria-autocomplete": "list",
|
|
49
|
-
"aria-expanded":
|
|
50
|
-
tabIndex:
|
|
49
|
+
"aria-expanded": c,
|
|
50
|
+
tabIndex: j ?? 0
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */ i(
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
/* @__PURE__ */ i(N, { name: "magnifying-glass", className: s.icon }),
|
|
54
|
+
e && /* @__PURE__ */ i(
|
|
55
|
+
l,
|
|
56
56
|
{
|
|
57
57
|
icon: "x-mark",
|
|
58
58
|
color: "secondary",
|
|
59
59
|
variant: "solid",
|
|
60
60
|
size: "custom",
|
|
61
61
|
className: s.clear,
|
|
62
|
-
onClick:
|
|
62
|
+
onClick: x
|
|
63
63
|
}
|
|
64
|
-
) ||
|
|
64
|
+
) || c && /* @__PURE__ */ i(l, { icon: "x-mark", variant: "text", className: s.dismiss, onClick: y })
|
|
65
65
|
] });
|
|
66
66
|
};
|
|
67
67
|
export {
|
|
68
|
-
|
|
68
|
+
O as SearchField
|
|
69
69
|
};
|
|
@@ -6,4 +6,4 @@ export interface SearchbarProps extends SearchFieldProps {
|
|
|
6
6
|
expanded: boolean;
|
|
7
7
|
tabIndex?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare const Searchbar: ({ className, autocomplete, expanded, onClose,
|
|
9
|
+
export declare const Searchbar: ({ className, autocomplete, expanded, onClose, tabIndex, ...search }: SearchbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as p, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as h } from "react";
|
|
3
|
+
import { useEnterKey as l } from "../../hooks/useEnterKey.js";
|
|
4
|
+
import { A as b } from "../../Autocomplete-hEFuiN2u.js";
|
|
5
|
+
import { SearchField as n } from "./SearchField.js";
|
|
6
|
+
import { SearchbarBase as E } from "./SearchbarBase.js";
|
|
7
|
+
const d = ({
|
|
8
|
+
className: o,
|
|
9
|
+
autocomplete: t,
|
|
10
|
+
expanded: e = !1,
|
|
11
|
+
onClose: r,
|
|
12
|
+
tabIndex: s,
|
|
13
|
+
...a
|
|
14
|
+
}) => {
|
|
15
|
+
const c = h(null);
|
|
16
|
+
return l(() => {
|
|
17
|
+
var i, f;
|
|
18
|
+
const m = (i = c.current) == null ? void 0 : i.querySelector('[data-active="true"]');
|
|
19
|
+
(f = m == null ? void 0 : m.firstElementChild) == null || f.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), r == null || r();
|
|
20
|
+
}), /* @__PURE__ */ p(E, { className: o, expanded: e, autocomplete: !!t, children: [
|
|
21
|
+
/* @__PURE__ */ u(n, { ...a, expanded: e, onClose: r, tabIndex: s }),
|
|
22
|
+
t && /* @__PURE__ */ u(b, { ...t, expanded: e, ref: c })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
17
25
|
export {
|
|
18
|
-
|
|
26
|
+
d as Searchbar
|
|
19
27
|
};
|