@altinn/altinn-components 0.37.0 → 0.38.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.
- package/dist/assets/Byline.css +1 -1
- package/dist/assets/DrawerOrDropdown.css +1 -1
- package/dist/assets/FloatingActionButton.css +1 -0
- package/dist/assets/Header.css +1 -1
- package/dist/assets/ListItemLabel.css +1 -1
- package/dist/assets/MenuItemBase.css +1 -1
- package/dist/assets/MenuItemLabel.css +1 -1
- package/dist/assets/ModalBase.css +1 -1
- package/dist/components/Account/AccountMenu.js +39 -35
- package/dist/components/Button/FloatingActionButton.js +36 -0
- package/dist/components/Button/IconButton.js +9 -7
- package/dist/components/Button/index.js +6 -4
- package/dist/components/Byline/Byline.js +18 -18
- package/dist/components/ContextMenu/ContextMenu.js +58 -43
- package/dist/components/Dialog/DialogListItem.js +113 -126
- package/dist/components/Dropdown/DrawerOrDropdown.js +4 -4
- package/dist/components/Header/Header.js +42 -57
- package/dist/components/Header/LocaleButton.js +3 -2
- package/dist/components/Header/LocaleSwitcher.js +38 -23
- package/dist/components/Layout/Layout.js +27 -16
- package/dist/components/Layout/LayoutContent.js +4 -4
- package/dist/components/List/ListItemHeader.js +55 -53
- package/dist/components/List/ListItemLabel.js +32 -31
- package/dist/components/Menu/MenuBase.js +9 -9
- package/dist/components/Menu/MenuItem.js +22 -21
- package/dist/components/Menu/MenuItemBase.js +31 -27
- package/dist/components/Menu/MenuItemLabel.js +41 -25
- package/dist/components/Menu/MenuItems.js +43 -37
- package/dist/components/Modal/ModalBase.js +5 -5
- package/dist/components/Searchbar/Autocomplete.js +23 -30
- package/dist/components/Searchbar/Searchbar.js +4 -4
- package/dist/components/SkipLink/SkipLink.js +18 -0
- package/dist/components/SkipLink/index.js +4 -0
- package/dist/components/Typography/Heading.js +26 -24
- package/dist/components/Typography/useHighlightedText.js +28 -21
- package/dist/components/index.js +402 -400
- package/dist/hooks/useEnterKey.js +8 -8
- package/dist/hooks/useMenu.js +43 -28
- package/dist/index.js +408 -406
- package/dist/types/lib/components/Account/AccountListItem.stories.d.ts +1 -0
- package/dist/types/lib/components/Button/FloatingActionButton.d.ts +14 -0
- package/dist/types/lib/components/Button/IconButton.d.ts +2 -1
- package/dist/types/lib/components/Button/index.d.ts +1 -0
- package/dist/types/lib/components/Dropdown/DrawerOrDropdown.d.ts +1 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +1 -0
- package/dist/types/lib/components/Header/LocaleButton.d.ts +2 -1
- package/dist/types/lib/components/Header/LocaleSwitcher.d.ts +2 -5
- package/dist/types/lib/components/Layout/Layout.d.ts +3 -1
- package/dist/types/lib/components/Layout/Layout.stories.d.ts +7 -1
- package/dist/types/lib/components/Layout/LayoutContent.d.ts +9 -2
- package/dist/types/lib/components/List/ListItemHeader.d.ts +3 -1
- package/dist/types/lib/components/List/ListItemLabel.d.ts +2 -1
- package/dist/types/lib/components/Menu/MenuBase.d.ts +4 -2
- package/dist/types/lib/components/Menu/MenuItem.d.ts +4 -2
- package/dist/types/lib/components/Menu/MenuItemBase.d.ts +3 -2
- package/dist/types/lib/components/Menu/MenuItemLabel.d.ts +2 -1
- package/dist/types/lib/components/Menu/MenuItems.d.ts +3 -1
- package/dist/types/lib/components/Settings/SettingsItem.stories.d.ts +1 -0
- package/dist/types/lib/components/SkipLink/SkipLink.d.ts +9 -0
- package/dist/types/lib/components/SkipLink/SkipLink.stories.d.ts +15 -0
- package/dist/types/lib/components/SkipLink/index.d.ts +1 -0
- package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +2 -1
- package/dist/types/lib/hooks/useEnterKey.d.ts +1 -1
- package/dist/types/lib/hooks/useMenu.d.ts +6 -2
- package/dist/types/lib/stories/InboxBeta.stories.d.ts +15 -0
- package/dist/types/lib/stories/Profile.stories.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/lib/components/Header/LocaleSwitcher.stories.d.ts +0 -19
package/dist/assets/Byline.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._byline_1o0os_1{display:inline-flex;align-items:center;column-gap:.5em}._avatar_1o0os_7,._avatarGroup_1o0os_12{font-size:1.25rem;flex-shrink:0}._avatar_1o0os_7[data-size=lg]{font-size:2.25rem}._label_1o0os_21{display:inline-flex;flex-wrap:wrap;column-gap:.25em;color:var(--ds-color-text-subtle)}._label_1o0os_21[data-size=xs],._label_1o0os_21[data-size=sm]{font-size:14px;line-height:1.125rem;padding:.1875rem 0}._label_1o0os_21[data-size=md],._label_1o0os_21[data-size=lg]{font-size:16px;line-height:1.25rem}._label_1o0os_21>strong{font-weight:500;color:var(--ds-color-text-default)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerOrDropdown_2swxb_1{background-color:var(--ds-color-background-default);display:none}._drawerOrDropdown_2swxb_1[data-expanded=true]{position:fixed;top:5.5rem;right:0;bottom:0;left:0;display:block;z-index:2}@media (min-width: 1024px){._header_2swxb_17,._footer_2swxb_18{display:none}._drawerOrDropdown_2swxb_1[data-expanded=true]{position:absolute;top:auto;right:auto;bottom:auto;left:0;min-width:16rem;max-width:24rem;margin-top:.5rem;border-radius:.375rem;overflow:hidden}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._button_v6n2g_1{--dsc-button-size: var(--ds-size-14);width:var(--ds-button-size);height:var(--ds-button-size);border-radius:50%;flex-shrink:0;position:fixed;bottom:0;right:0;margin:1rem}
|
package/dist/assets/Header.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawer_1tael_1[data-expanded=true]{display:block;width:100%}._dropdown_1tael_6[data-expanded=true]{display:none}@media (min-width: 1024px){._dropdown_1tael_6[data-expanded=true]{width:320px;display:block}._drawer_1tael_1[data-expanded=true]{display:none}}._relative_1tael_20{position:relative}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._label_1cju7_1{pointer-events:none;position:relative;display:flex;flex-direction:column;align-items:start;justify-content:center;margin-top:var(--dsc-item-my);margin-bottom:var(--dsc-item-my)}._label_1cju7_1 mark{background-color:var(--ds-color-surface-tinted)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._item_1qmxq_1{font:inherit;color:inherit;padding:0;border:0;text-align:inherit;text-decoration:none;line-height:normal;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;user-select:none;cursor:pointer;position:relative;width:100%;display:flex;align-items:center;column-gap:.25rem;margin:.5rem 0;border-radius:2px}._item_1qmxq_1[aria-disabled=true]{opacity:.5;pointer-events:none}._item_1qmxq_1[data-size=md]{min-height:56px}._item_1qmxq_1[data-size=md]{min-height:44px}._item_1qmxq_1[data-size=sm]{min-height:40px}._content_1qmxq_45{display:flex;width:100%;align-items:center;column-gap:6px;padding:6px}._item_1qmxq_1,._item_1qmxq_1[data-theme]{background-color:transparent}._item_1qmxq_1{pointer-events:none}._item_1qmxq_1[data-interactive=true]{pointer-events:all}[data-theme=subtle] ._item_1qmxq_1:hover{background-color:var(--ds-color-surface-hover)}[data-theme=subtle] ._item_1qmxq_1:active{background-color:var(--ds-color-surface-active)}[data-theme=subtle] ._item_1qmxq_1[data-selected=true]{background-color:var(--ds-color-background-default)}[data-theme=default] ._item_1qmxq_1:hover,[data-theme=default] [data-active=true]{background-color:var(--ds-color-surface-hover)}[data-theme=default] ._item_1qmxq_1:active{background-color:var(--ds-color-surface-active)}[data-theme=default] ._item_1qmxq_1[data-selected=true]{background-color:var(--ds-color-background-tinted)}._content_1qmxq_45{display:flex;width:100%;align-items:center;column-gap:.5em}._item_1qmxq_1:focus-visible{box-shadow:var(--_ds--focus, var(--dsc-focus-boxShadow));outline:var(--_ds--focus, var(--dsc-focus-outline))}._item_1qmxq_1:focus-visible *{--_ds--focus: }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._label_k9qsn_1{flex-grow:1;display:flex;flex-direction:column;padding:0 .125rem}._label_k9qsn_1[data-size=lg]{font-size:1.125rem}._label_k9qsn_1[data-size=md],._label_k9qsn_1[data-size=sm]{font-size:1rem}._title_k9qsn_20{display:inline-flex;align-items:center;column-gap:.5em}._label_k9qsn_1 mark{background-color:var(--ds-color-surface-tinted)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._modal_4vfmr_1{padding:0;width:100%;max-width:450px;border:none;background-color:#fff;border-radius:.5rem;box-shadow:var(--ds-shadow-xs)}._modal_4vfmr_1[data-backdrop-color=inherit]::backdrop{background-color:#111d4640}._modal_4vfmr_1[data-backdrop-color=transparent]::backdrop{background-color:transparent}._modal_4vfmr_1[data-variant=default]{max-width:640px;margin:auto}._modal_4vfmr_1[data-variant=content]{max-width:988px;margin:auto}._modal_4vfmr_1[data-variant=full]{width:100%;max-width:none;height:100%;min-height:unset}._content_4vfmr_35{position:relative}
|
|
@@ -1,55 +1,59 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
3
|
+
import { useState as I } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
6
|
import { Menu as M } from "../Menu/Menu.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
const
|
|
8
|
+
const b = (n) => `${n} hits`, k = ({
|
|
9
9
|
items: n = [],
|
|
10
|
-
groups:
|
|
11
|
-
search:
|
|
10
|
+
groups: h = {},
|
|
11
|
+
search: t,
|
|
12
12
|
onSelectAccount: r,
|
|
13
|
-
currentAccount:
|
|
14
|
-
menuItemsVirtual:
|
|
13
|
+
currentAccount: s,
|
|
14
|
+
menuItemsVirtual: C
|
|
15
15
|
}) => {
|
|
16
|
-
var
|
|
17
|
-
const
|
|
18
|
-
...
|
|
19
|
-
title: (
|
|
20
|
-
groupId:
|
|
21
|
-
selected:
|
|
22
|
-
onClick: () => r == null ? void 0 : r(
|
|
23
|
-
})), [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
var p;
|
|
17
|
+
const d = n.map((o) => ({
|
|
18
|
+
...o,
|
|
19
|
+
title: (o == null ? void 0 : o.title) || o.name,
|
|
20
|
+
groupId: o.groupId || "search",
|
|
21
|
+
selected: o.selected ?? (s == null ? void 0 : s.id) === o.id,
|
|
22
|
+
onClick: () => r == null ? void 0 : r(o.id)
|
|
23
|
+
})), [l, a] = I(""), e = l ? d.filter(
|
|
24
|
+
(o) => {
|
|
25
|
+
var g, i, f;
|
|
26
|
+
return ((g = o == null ? void 0 : o.name) == null ? void 0 : g.toLowerCase().includes(l.toLowerCase())) || ((f = (i = o == null ? void 0 : o.description) == null ? void 0 : i.toString()) == null ? void 0 : f.toLowerCase().includes(l.toLowerCase()));
|
|
27
|
+
}
|
|
28
|
+
).map((o) => ({
|
|
29
|
+
...o,
|
|
30
|
+
groupId: "search",
|
|
31
|
+
title: (o == null ? void 0 : o.title) || o.name,
|
|
32
|
+
highlightWords: [l]
|
|
33
|
+
})) : d, L = l ? {
|
|
30
34
|
search: {
|
|
31
|
-
title: ((
|
|
35
|
+
title: ((p = t == null ? void 0 : t.getResultsLabel) == null ? void 0 : p.call(t, e.length)) ?? b(e.length)
|
|
32
36
|
}
|
|
33
|
-
} :
|
|
37
|
+
} : h, c = {
|
|
34
38
|
name: "account-search",
|
|
35
|
-
value:
|
|
36
|
-
placeholder: (
|
|
37
|
-
onChange: (
|
|
38
|
-
onClear: () =>
|
|
39
|
-
},
|
|
40
|
-
...
|
|
39
|
+
value: l,
|
|
40
|
+
placeholder: (t == null ? void 0 : t.placeholder) ?? "Find account",
|
|
41
|
+
onChange: (o) => a(o.target.value),
|
|
42
|
+
onClear: () => a("")
|
|
43
|
+
}, u = [
|
|
44
|
+
...e.length > 0 ? e : [{ id: "search", groupId: "search", hidden: !0 }]
|
|
41
45
|
];
|
|
42
|
-
return /* @__PURE__ */
|
|
46
|
+
return console.log("items", u), /* @__PURE__ */ w(
|
|
43
47
|
M,
|
|
44
48
|
{
|
|
45
49
|
theme: "default",
|
|
46
|
-
search:
|
|
47
|
-
groups:
|
|
48
|
-
items:
|
|
49
|
-
menuItemsVirtual:
|
|
50
|
+
search: t && c,
|
|
51
|
+
groups: L,
|
|
52
|
+
items: u,
|
|
53
|
+
menuItemsVirtual: C
|
|
50
54
|
}
|
|
51
55
|
);
|
|
52
56
|
};
|
|
53
57
|
export {
|
|
54
|
-
|
|
58
|
+
k as AccountMenu
|
|
55
59
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import "../../index-L8X2o7IH.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { ButtonBase as u } from "./ButtonBase.js";
|
|
5
|
+
import { ButtonIcon as l } from "./ButtonIcon.js";
|
|
6
|
+
import "../RootProvider/RootProvider.js";
|
|
7
|
+
import "../Snackbar/useSnackbar.js";
|
|
8
|
+
import '../../assets/FloatingActionButton.css';const c = "_button_v6n2g_1", b = {
|
|
9
|
+
button: c
|
|
10
|
+
}, j = ({
|
|
11
|
+
variant: n = "solid",
|
|
12
|
+
size: r,
|
|
13
|
+
icon: t,
|
|
14
|
+
iconSize: i,
|
|
15
|
+
iconAltText: s,
|
|
16
|
+
color: m,
|
|
17
|
+
onClick: a,
|
|
18
|
+
dataTestId: e,
|
|
19
|
+
onBlurCapture: p
|
|
20
|
+
}) => /* @__PURE__ */ o(
|
|
21
|
+
u,
|
|
22
|
+
{
|
|
23
|
+
className: b.button,
|
|
24
|
+
variant: n,
|
|
25
|
+
color: m,
|
|
26
|
+
size: r,
|
|
27
|
+
onClick: a,
|
|
28
|
+
"data-testid": e,
|
|
29
|
+
"aria-label": s,
|
|
30
|
+
onBlurCapture: p,
|
|
31
|
+
children: t && /* @__PURE__ */ o(l, { icon: t, size: i })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
export {
|
|
35
|
+
j as FloatingActionButton
|
|
36
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { ButtonBase as
|
|
5
|
-
import { ButtonIcon as
|
|
4
|
+
import { ButtonBase as u } from "./ButtonBase.js";
|
|
5
|
+
import { ButtonIcon as B } from "./ButtonIcon.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
const
|
|
8
|
+
const g = ({
|
|
9
9
|
variant: r = "solid",
|
|
10
10
|
rounded: i = !1,
|
|
11
11
|
size: m,
|
|
@@ -16,9 +16,10 @@ const z = ({
|
|
|
16
16
|
className: n,
|
|
17
17
|
selected: s,
|
|
18
18
|
onClick: l,
|
|
19
|
-
dataTestId: d
|
|
19
|
+
dataTestId: d,
|
|
20
|
+
onBlurCapture: f
|
|
20
21
|
}) => /* @__PURE__ */ o(
|
|
21
|
-
|
|
22
|
+
u,
|
|
22
23
|
{
|
|
23
24
|
variant: r,
|
|
24
25
|
rounded: i,
|
|
@@ -29,9 +30,10 @@ const z = ({
|
|
|
29
30
|
selected: s,
|
|
30
31
|
"data-testid": d,
|
|
31
32
|
"aria-label": p,
|
|
32
|
-
|
|
33
|
+
onBlurCapture: f,
|
|
34
|
+
children: t && /* @__PURE__ */ o(B, { icon: t, size: e })
|
|
33
35
|
}
|
|
34
36
|
);
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
g as IconButton
|
|
37
39
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ButtonBase as r } from "./ButtonBase.js";
|
|
2
|
-
import { ButtonLabel as
|
|
2
|
+
import { ButtonLabel as e } from "./ButtonLabel.js";
|
|
3
3
|
import { ButtonIcon as p } from "./ButtonIcon.js";
|
|
4
4
|
import { Button as B } from "./Button.js";
|
|
5
5
|
import { ComboButton as x } from "./ComboButton.js";
|
|
6
|
-
import { IconButton as
|
|
6
|
+
import { IconButton as c } from "./IconButton.js";
|
|
7
|
+
import { FloatingActionButton as i } from "./FloatingActionButton.js";
|
|
7
8
|
import { ButtonGroup as I } from "./ButtonGroup.js";
|
|
8
9
|
export {
|
|
9
10
|
B as Button,
|
|
10
11
|
r as ButtonBase,
|
|
11
12
|
I as ButtonGroup,
|
|
12
13
|
p as ButtonIcon,
|
|
13
|
-
|
|
14
|
+
e as ButtonLabel,
|
|
14
15
|
x as ComboButton,
|
|
15
|
-
|
|
16
|
+
i as FloatingActionButton,
|
|
17
|
+
c as IconButton
|
|
16
18
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as _, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Avatar as
|
|
5
|
-
import { AvatarGroup as
|
|
4
|
+
import { Avatar as v } from "../Avatar/Avatar.js";
|
|
5
|
+
import { AvatarGroup as b } from "../Avatar/AvatarGroup.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { Skeleton as
|
|
7
|
+
import { Skeleton as l } from "../Skeleton/Skeleton.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
|
-
import '../../assets/Byline.css';const d = "
|
|
9
|
+
import '../../assets/Byline.css';const d = "_byline_1o0os_1", y = "_avatar_1o0os_7", u = "_avatarGroup_1o0os_12", N = "_label_1o0os_21", o = {
|
|
10
10
|
byline: d,
|
|
11
11
|
avatar: y,
|
|
12
|
-
avatarGroup:
|
|
13
|
-
label:
|
|
14
|
-
},
|
|
15
|
-
loading:
|
|
12
|
+
avatarGroup: u,
|
|
13
|
+
label: N
|
|
14
|
+
}, S = ({
|
|
15
|
+
loading: s,
|
|
16
16
|
color: n = "neutral",
|
|
17
|
-
size:
|
|
18
|
-
avatar:
|
|
17
|
+
size: t = "xs",
|
|
18
|
+
avatar: r,
|
|
19
19
|
avatarGroup: e,
|
|
20
|
-
datetime:
|
|
21
|
-
children:
|
|
22
|
-
as:
|
|
20
|
+
datetime: m,
|
|
21
|
+
children: i,
|
|
22
|
+
as: c,
|
|
23
23
|
...p
|
|
24
|
-
}) => /* @__PURE__ */
|
|
25
|
-
(e ||
|
|
26
|
-
/* @__PURE__ */ a("time", { "data-size":
|
|
24
|
+
}) => /* @__PURE__ */ _(c || "div", { ...p, className: o.byline, "data-color": n, "data-size": t, children: [
|
|
25
|
+
(e || r) && /* @__PURE__ */ a(l, { variant: "circle", className: o.avatar, loading: s, children: e ? /* @__PURE__ */ a(b, { ...e, size: t, className: o.avatarGroup }) : r && /* @__PURE__ */ a(v, { ...r, size: t, className: o.avatar }) }),
|
|
26
|
+
/* @__PURE__ */ a("time", { "data-size": t, dateTime: m, className: o.label, children: /* @__PURE__ */ a(l, { loading: s, children: i }) })
|
|
27
27
|
] });
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
S as Byline
|
|
30
30
|
};
|
|
@@ -1,68 +1,83 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import * as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
import { useClickOutside as
|
|
2
|
+
import { jsxs as y, jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { c as I } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import * as m from "react";
|
|
5
|
+
import { forwardRef as w, useRef as O, useMemo as k } from "react";
|
|
6
|
+
import { IconButton as E } from "../Button/IconButton.js";
|
|
7
|
+
import { useClickOutside as C } from "../../hooks/useClickOutside.js";
|
|
8
|
+
import { useEnterKey as M } from "../../hooks/useEnterKey.js";
|
|
8
9
|
import { DropdownBase as j } from "../Dropdown/DropdownBase.js";
|
|
9
|
-
import { MenuItems as
|
|
10
|
-
import { useRootContext as
|
|
10
|
+
import { MenuItems as _ } from "../Menu/MenuItems.js";
|
|
11
|
+
import { useRootContext as R } from "../RootProvider/RootProvider.js";
|
|
11
12
|
import "../Snackbar/useSnackbar.js";
|
|
12
|
-
import { u as
|
|
13
|
-
import '../../assets/ContextMenu.css';var
|
|
14
|
-
var
|
|
15
|
-
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) &&
|
|
13
|
+
import { u as P } from "../../useId-BVFxCjkq.js";
|
|
14
|
+
import '../../assets/ContextMenu.css';var T = function(e, s) {
|
|
15
|
+
var n = {};
|
|
16
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && s.indexOf(t) < 0 && (n[t] = e[t]);
|
|
16
17
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
17
18
|
for (var o = 0, t = Object.getOwnPropertySymbols(e); o < t.length; o++)
|
|
18
|
-
|
|
19
|
-
return
|
|
19
|
+
s.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (n[t[o]] = e[t[o]]);
|
|
20
|
+
return n;
|
|
20
21
|
};
|
|
21
|
-
const
|
|
22
|
-
var { title:
|
|
23
|
-
let
|
|
24
|
-
return
|
|
22
|
+
const A = w((e, s) => {
|
|
23
|
+
var { title: n, titleId: t } = e, o = T(e, ["title", "titleId"]);
|
|
24
|
+
let i = P();
|
|
25
|
+
return i = n ? t || "title-" + i : void 0, m.createElement(
|
|
25
26
|
"svg",
|
|
26
|
-
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref:
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: s, "aria-labelledby": i }, o),
|
|
28
|
+
n ? m.createElement("title", { id: i }, n) : null,
|
|
29
|
+
m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
|
|
29
30
|
);
|
|
30
|
-
}),
|
|
31
|
-
toggle:
|
|
32
|
-
},
|
|
31
|
+
}), B = "_toggle_nol5i_1", S = {
|
|
32
|
+
toggle: B
|
|
33
|
+
}, Q = ({
|
|
33
34
|
id: e = "context-menu",
|
|
34
|
-
ariaLabel:
|
|
35
|
-
placement:
|
|
35
|
+
ariaLabel: s,
|
|
36
|
+
placement: n = "right",
|
|
36
37
|
groups: t = {},
|
|
37
38
|
className: o,
|
|
38
|
-
items:
|
|
39
|
+
items: i
|
|
39
40
|
}) => {
|
|
40
|
-
const { currentId:
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const { currentId: v, toggleId: p, closeAll: a } = R(), d = O(null), g = "context-menu-" + e, x = () => p(e), u = v === e;
|
|
42
|
+
C(d, () => {
|
|
43
|
+
u && p(e);
|
|
43
44
|
});
|
|
44
|
-
const
|
|
45
|
-
...
|
|
45
|
+
const b = k(() => i.map((r) => ({
|
|
46
|
+
...r,
|
|
47
|
+
tabIndex: -1,
|
|
46
48
|
onClick: () => {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
49
|
+
var c;
|
|
50
|
+
(c = r.onClick) == null || c.call(r), a();
|
|
49
51
|
}
|
|
50
|
-
})), [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
})), [i, a]);
|
|
53
|
+
M((r) => {
|
|
54
|
+
var c;
|
|
55
|
+
if (u) {
|
|
56
|
+
r.preventDefault();
|
|
57
|
+
const l = (c = d.current) == null ? void 0 : c.querySelector('[data-active="true"]');
|
|
58
|
+
l && (l.tagName === "A" && l.hasAttribute("href") ? l.click() : l.dispatchEvent(new MouseEvent("click", { bubbles: !0 }))), a();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const h = (r) => {
|
|
62
|
+
var l;
|
|
63
|
+
((l = r == null ? void 0 : r.relatedTarget) == null ? void 0 : l.closest(`[data-testid="${g}"]`)) || a();
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ y("div", { className: I(S.toggle, o), "data-color": "neutral", ref: d, "data-testid": g, children: [
|
|
66
|
+
/* @__PURE__ */ f(
|
|
67
|
+
E,
|
|
54
68
|
{
|
|
55
69
|
size: "xs",
|
|
56
70
|
rounded: !0,
|
|
57
|
-
icon:
|
|
71
|
+
icon: A,
|
|
58
72
|
variant: "text",
|
|
59
|
-
onClick:
|
|
60
|
-
iconAltText:
|
|
73
|
+
onClick: x,
|
|
74
|
+
iconAltText: s || `Open ${e}`,
|
|
75
|
+
onBlurCapture: h
|
|
61
76
|
}
|
|
62
77
|
),
|
|
63
|
-
|
|
78
|
+
u && /* @__PURE__ */ f(j, { placement: n, open: u, children: /* @__PURE__ */ f(_, { groups: t, items: b, keyboardEvents: !0 }) })
|
|
64
79
|
] });
|
|
65
80
|
};
|
|
66
81
|
export {
|
|
67
|
-
|
|
82
|
+
Q as ContextMenu
|
|
68
83
|
};
|