@altinn/altinn-components 0.41.5 → 0.41.6
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/MenuItemBase.css +1 -1
- package/dist/components/Account/AccountList.js +20 -32
- package/dist/components/Account/AccountMenu.js +18 -16
- package/dist/components/Avatar/AvatarGroup.js +12 -12
- package/dist/components/List/ListItemBase.js +35 -33
- package/dist/components/Menu/MenuBase.js +17 -15
- package/dist/components/Menu/MenuItemBase.js +38 -38
- package/dist/components/Settings/SettingsItem.js +13 -15
- package/dist/components/Settings/SettingsItemBase.js +29 -28
- package/dist/components/Settings/SettingsModal.js +33 -9
- package/dist/hooks/useMenu.js +31 -31
- package/dist/types/lib/components/Account/AccountList.d.ts +1 -1
- package/dist/types/lib/components/Account/AccountList.stories.d.ts +1 -1
- package/dist/types/lib/components/Account/AccountListItem.stories.d.ts +1 -0
- package/dist/types/lib/components/List/ListItemBase.d.ts +2 -1
- package/dist/types/lib/components/Menu/MenuBase.d.ts +2 -1
- package/dist/types/lib/components/Settings/SettingsItem.d.ts +5 -3
- package/dist/types/lib/components/Settings/SettingsItem.stories.d.ts +2 -0
- package/dist/types/lib/components/Settings/SettingsItemBase.d.ts +1 -1
- package/dist/types/lib/components/Settings/SettingsModal.d.ts +6 -2
- package/dist/types/lib/components/Settings/SettingsModal.stories.d.ts +1 -1
- package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._item_cs9p2_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_cs9p2_1[data-size=md]{min-height:56px}._item_cs9p2_1[data-size=md]{min-height:44px}._item_cs9p2_1[data-size=sm]{min-height:40px}._content_cs9p2_40{display:flex;width:100%;align-items:center;column-gap:6px;padding:6px}._item_cs9p2_1{background-color:transparent}._item_cs9p2_1{pointer-events:none}._item_cs9p2_1[data-interactive=true]{pointer-events:all}._item_cs9p2_1:hover,._item_cs9p2_1[data-active=true]{background-color:var(--ds-color-background-tinted)}._item_cs9p2_1[data-active=true]{outline:2px solid black}._item_cs9p2_1[data-selected=true],._item_cs9p2_1:active,[data-variant=subtle] ._item_cs9p2_1:hover{background-color:var(--ds-color-surface-hover)}[data-variant=subtle] ._item_cs9p2_1:active{background-color:var(--ds-color-surface-active)}[data-variant=subtle] ._item_cs9p2_1[data-selected=true]{background-color:var(--ds-color-background-default)}._content_cs9p2_40{display:flex;width:100%;align-items:center;column-gap:.5em}._item_cs9p2_1[aria-disabled=true]{opacity:.5;pointer-events:none;outline:none;box-shadow:none;background-color:transparent}._item_cs9p2_1:not([aria-disabled=true]):focus-visible{box-shadow:var(--_ds--focus, var(--dsc-focus-boxShadow));outline:var(--_ds--focus, var(--dsc-focus-outline))}._item_cs9p2_1:not([aria-disabled=true]):focus-visible *{--_ds--focus: }
|
|
@@ -1,44 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as f, createElement as d } from "react";
|
|
3
3
|
import "../../index-L8X2o7IH.js";
|
|
4
|
-
import { AccountListItem as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useMenu as I } from "../../hooks/useMenu.js";
|
|
4
|
+
import { AccountListItem as h } from "./AccountListItem.js";
|
|
5
|
+
import { Heading as y } from "../Typography/Heading.js";
|
|
6
|
+
import { useMenu as x } from "../../hooks/useMenu.js";
|
|
8
7
|
import "../RootProvider/RootProvider.js";
|
|
9
8
|
import { List as L } from "../List/List.js";
|
|
10
9
|
import "../Snackbar/useSnackbar.js";
|
|
11
|
-
import { Section as
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
emptyTitle: f = "Ingen treff",
|
|
17
|
-
emptyDescription: l = "Søket ga ingen treff"
|
|
18
|
-
}) => {
|
|
19
|
-
if (!i || i.length === 0)
|
|
20
|
-
return /* @__PURE__ */ o(c, { children: [
|
|
21
|
-
/* @__PURE__ */ r(m, { size: "lg", children: f }),
|
|
22
|
-
/* @__PURE__ */ r(x, { children: l })
|
|
23
|
-
] });
|
|
24
|
-
const { menu: n } = I({
|
|
25
|
-
items: i,
|
|
26
|
-
groups: p,
|
|
10
|
+
import { Section as j } from "../Page/Section.js";
|
|
11
|
+
const H = ({ items: o, groups: m = {}, sortGroupBy: n }) => {
|
|
12
|
+
const { menu: e } = x({
|
|
13
|
+
items: o,
|
|
14
|
+
groups: m,
|
|
27
15
|
groupByKey: "groupId",
|
|
28
16
|
keyboardEvents: !1,
|
|
29
|
-
sortGroupBy:
|
|
17
|
+
sortGroupBy: n
|
|
30
18
|
});
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
const
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
(
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
const
|
|
37
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ i(j, { spacing: 6, children: e == null ? void 0 : e.map((t, s) => {
|
|
20
|
+
const r = t.props || {};
|
|
21
|
+
return /* @__PURE__ */ a(f, { children: [
|
|
22
|
+
(r == null ? void 0 : r.title) && /* @__PURE__ */ i(y, { size: "lg", children: r.title }),
|
|
23
|
+
/* @__PURE__ */ i(L, { children: t == null ? void 0 : t.items.map((c, p) => {
|
|
24
|
+
const l = c.props || {};
|
|
25
|
+
return /* @__PURE__ */ d(h, { ...l, key: p });
|
|
38
26
|
}) })
|
|
39
|
-
] },
|
|
27
|
+
] }, s);
|
|
40
28
|
}) });
|
|
41
29
|
};
|
|
42
30
|
export {
|
|
43
|
-
|
|
31
|
+
H as AccountList
|
|
44
32
|
};
|
|
@@ -3,52 +3,54 @@ import { jsx as c } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState as M } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { Menu as
|
|
6
|
+
import { Menu as b } from "../Menu/Menu.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
const
|
|
8
|
+
const v = (r) => `${r} hits`, G = ({
|
|
9
9
|
items: r = [],
|
|
10
10
|
groups: f = {},
|
|
11
|
-
search:
|
|
11
|
+
search: l,
|
|
12
12
|
onSelectAccount: e,
|
|
13
13
|
currentAccount: a,
|
|
14
14
|
isVirtualized: C,
|
|
15
15
|
keyboardEvents: h
|
|
16
16
|
}) => {
|
|
17
17
|
var u;
|
|
18
|
-
const
|
|
18
|
+
const d = r.map((o) => ({
|
|
19
19
|
...o,
|
|
20
20
|
title: (o == null ? void 0 : o.title) || o.name,
|
|
21
21
|
groupId: o.groupId || "search",
|
|
22
22
|
selected: o.selected ?? (a == null ? void 0 : a.id) === o.id,
|
|
23
|
-
onClick: () =>
|
|
24
|
-
|
|
23
|
+
onClick: () => {
|
|
24
|
+
!o.disabled && (e == null || e(o.id));
|
|
25
|
+
}
|
|
26
|
+
})), [t, s] = M(""), n = t ? d.filter(
|
|
25
27
|
(o) => {
|
|
26
28
|
var p, g, i;
|
|
27
|
-
return ((p = o == null ? void 0 : o.name) == null ? void 0 : p.toLowerCase().includes(
|
|
29
|
+
return ((p = o == null ? void 0 : o.name) == null ? void 0 : p.toLowerCase().includes(t.toLowerCase())) || ((i = (g = o == null ? void 0 : o.description) == null ? void 0 : g.toString()) == null ? void 0 : i.toLowerCase().includes(t.toLowerCase()));
|
|
28
30
|
}
|
|
29
31
|
).map((o) => ({
|
|
30
32
|
...o,
|
|
31
33
|
groupId: "search",
|
|
32
34
|
title: (o == null ? void 0 : o.title) || o.name,
|
|
33
|
-
highlightWords: [
|
|
34
|
-
})) :
|
|
35
|
+
highlightWords: [t]
|
|
36
|
+
})) : d, L = t ? {
|
|
35
37
|
search: {
|
|
36
|
-
title: ((u =
|
|
38
|
+
title: ((u = l == null ? void 0 : l.getResultsLabel) == null ? void 0 : u.call(l, n.length)) ?? v(n.length)
|
|
37
39
|
}
|
|
38
40
|
} : f, w = {
|
|
39
41
|
name: "account-search",
|
|
40
|
-
value:
|
|
41
|
-
placeholder: (
|
|
42
|
-
onChange: (o) =>
|
|
43
|
-
onClear: () =>
|
|
42
|
+
value: t,
|
|
43
|
+
placeholder: (l == null ? void 0 : l.placeholder) ?? "Find account",
|
|
44
|
+
onChange: (o) => s(o.target.value),
|
|
45
|
+
onClear: () => s("")
|
|
44
46
|
}, I = [
|
|
45
47
|
...n.length > 0 ? n : [{ id: "search", groupId: "search", hidden: !0 }]
|
|
46
48
|
];
|
|
47
49
|
return /* @__PURE__ */ c(
|
|
48
|
-
|
|
50
|
+
b,
|
|
49
51
|
{
|
|
50
52
|
variant: "default",
|
|
51
|
-
search:
|
|
53
|
+
search: l && w,
|
|
52
54
|
groups: L,
|
|
53
55
|
items: I,
|
|
54
56
|
isVirtualized: C,
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as i } from "../../index-L8X2o7IH.js";
|
|
4
4
|
import { useMemo as f } from "react";
|
|
5
5
|
import { Avatar as h } from "./Avatar.js";
|
|
6
6
|
import '../../assets/AvatarGroup.css';const A = "_group_1ts6c_1", _ = "_item_1ts6c_10", s = {
|
|
7
7
|
group: A,
|
|
8
8
|
item: _
|
|
9
|
-
}, L = (
|
|
10
|
-
items:
|
|
9
|
+
}, L = (t) => typeof t == "object" && t !== null && "items" in t, N = ({
|
|
10
|
+
items: t = [],
|
|
11
11
|
maxItemsCount: l = 4,
|
|
12
|
-
defaultType:
|
|
13
|
-
size:
|
|
12
|
+
defaultType: n,
|
|
13
|
+
size: u,
|
|
14
14
|
className: m,
|
|
15
|
-
style:
|
|
15
|
+
style: p
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
const g =
|
|
20
|
-
return /* @__PURE__ */ r("li", { className:
|
|
17
|
+
const o = f(() => t.slice(0, l).reverse(), [t, l]);
|
|
18
|
+
return t.length === 0 ? /* @__PURE__ */ r("div", { className: s.avatarGroup }) : /* @__PURE__ */ r("ul", { className: i(s.group, m), "data-size": u, "data-count": o == null ? void 0 : o.length, style: p, children: o.map((e, c) => {
|
|
19
|
+
const g = c === l - 1, d = e.customLabel || g ? t.length.toString() : void 0;
|
|
20
|
+
return /* @__PURE__ */ r("li", { className: i(s.item), children: /* @__PURE__ */ r(
|
|
21
21
|
h,
|
|
22
22
|
{
|
|
23
23
|
name: e.name,
|
|
24
24
|
customLabel: d,
|
|
25
25
|
imageUrl: e.imageUrl,
|
|
26
26
|
imageUrlAlt: e.imageUrlAlt,
|
|
27
|
-
type: (e == null ? void 0 : e.type) ||
|
|
27
|
+
type: (e == null ? void 0 : e.type) || n,
|
|
28
28
|
variant: e == null ? void 0 : e.variant,
|
|
29
29
|
outline: !0
|
|
30
30
|
}
|
|
31
|
-
) },
|
|
31
|
+
) }, c);
|
|
32
32
|
}) });
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import '../../assets/ListItemBase.css';const
|
|
4
|
-
base:
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { c as x } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import '../../assets/ListItemBase.css';const u = "_base_1xkee_1", _ = {
|
|
4
|
+
base: u
|
|
5
|
+
}, j = ({
|
|
6
|
+
ref: a,
|
|
7
|
+
as: e,
|
|
8
|
+
interactive: t = !0,
|
|
9
|
+
size: s,
|
|
10
|
+
color: o,
|
|
11
|
+
variant: n = "default",
|
|
12
|
+
shadow: r = "none",
|
|
13
|
+
border: d = "none",
|
|
14
|
+
hidden: c = !1,
|
|
15
|
+
selected: i,
|
|
16
|
+
className: m,
|
|
17
|
+
onMouseEnter: l,
|
|
18
|
+
id: b,
|
|
19
|
+
children: p
|
|
20
|
+
}) => /* @__PURE__ */ f(
|
|
21
|
+
e || "li",
|
|
21
22
|
{
|
|
22
|
-
className:
|
|
23
|
-
"data-interactive":
|
|
24
|
-
"data-selected":
|
|
25
|
-
"data-variant":
|
|
26
|
-
"data-color":
|
|
27
|
-
"data-border":
|
|
28
|
-
"data-shadow":
|
|
29
|
-
"data-size":
|
|
30
|
-
"aria-hidden":
|
|
31
|
-
onMouseEnter:
|
|
32
|
-
id:
|
|
33
|
-
|
|
23
|
+
className: x(_.base, m),
|
|
24
|
+
"data-interactive": t,
|
|
25
|
+
"data-selected": i,
|
|
26
|
+
"data-variant": n,
|
|
27
|
+
"data-color": o,
|
|
28
|
+
"data-border": d,
|
|
29
|
+
"data-shadow": r,
|
|
30
|
+
"data-size": s,
|
|
31
|
+
"aria-hidden": c,
|
|
32
|
+
onMouseEnter: l,
|
|
33
|
+
id: b,
|
|
34
|
+
ref: a,
|
|
35
|
+
children: p
|
|
34
36
|
}
|
|
35
37
|
);
|
|
36
38
|
export {
|
|
37
|
-
|
|
39
|
+
j as ListItemBase
|
|
38
40
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { c as r } from "../../index-L8X2o7IH.js";
|
|
3
|
-
import '../../assets/MenuBase.css';const
|
|
4
|
-
menu:
|
|
5
|
-
list:
|
|
6
|
-
item:
|
|
7
|
-
},
|
|
3
|
+
import '../../assets/MenuBase.css';const _ = "_menu_twp4i_1", d = "_list_twp4i_12", C = "_item_twp4i_18", p = {
|
|
4
|
+
menu: _,
|
|
5
|
+
list: d,
|
|
6
|
+
item: C
|
|
7
|
+
}, N = ({ as: t = "nav", color: n, variant: e, className: o, children: s, ref: a }) => /* @__PURE__ */ c(t, { className: r(p.menu, o), "data-color": n, "data-variant": e, ref: a, children: s }), f = ({
|
|
8
8
|
as: t = "ul",
|
|
9
9
|
role: n = "group",
|
|
10
10
|
className: e,
|
|
11
11
|
children: o,
|
|
12
12
|
ref: s,
|
|
13
13
|
onMouseEnter: a,
|
|
14
|
-
onMouseLeave:
|
|
15
|
-
onBlurCapture:
|
|
14
|
+
onMouseLeave: i,
|
|
15
|
+
onBlurCapture: m
|
|
16
16
|
}) => /* @__PURE__ */ c(
|
|
17
17
|
t,
|
|
18
18
|
{
|
|
@@ -20,19 +20,20 @@ import '../../assets/MenuBase.css';const l = "_menu_twp4i_1", _ = "_list_twp4i_1
|
|
|
20
20
|
role: n,
|
|
21
21
|
ref: s,
|
|
22
22
|
onMouseEnter: a,
|
|
23
|
-
onMouseLeave:
|
|
24
|
-
onBlurCapture:
|
|
23
|
+
onMouseLeave: i,
|
|
24
|
+
onBlurCapture: m,
|
|
25
25
|
children: o
|
|
26
26
|
}
|
|
27
|
-
),
|
|
27
|
+
), h = ({
|
|
28
28
|
as: t = "li",
|
|
29
29
|
role: n = "presentation",
|
|
30
30
|
className: e,
|
|
31
31
|
children: o,
|
|
32
32
|
style: s,
|
|
33
33
|
dataIndex: a,
|
|
34
|
+
disabled: i,
|
|
34
35
|
onMouseEnter: m,
|
|
35
|
-
onMouseLeave:
|
|
36
|
+
onMouseLeave: l,
|
|
36
37
|
"aria-checked": u
|
|
37
38
|
}) => /* @__PURE__ */ c(
|
|
38
39
|
t,
|
|
@@ -42,13 +43,14 @@ import '../../assets/MenuBase.css';const l = "_menu_twp4i_1", _ = "_list_twp4i_1
|
|
|
42
43
|
style: s,
|
|
43
44
|
"data-index": a,
|
|
44
45
|
onMouseEnter: m,
|
|
45
|
-
onMouseLeave:
|
|
46
|
+
onMouseLeave: l,
|
|
47
|
+
"aria-disabled": i,
|
|
46
48
|
"aria-checked": u,
|
|
47
49
|
children: o
|
|
48
50
|
}
|
|
49
51
|
);
|
|
50
52
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
N as MenuBase,
|
|
54
|
+
f as MenuList,
|
|
55
|
+
h as MenuListItem
|
|
54
56
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import '../../assets/MenuItemBase.css';const
|
|
5
|
-
item:
|
|
6
|
-
content:
|
|
2
|
+
import { c as E } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import { useRef as M } from "react";
|
|
4
|
+
import '../../assets/MenuItemBase.css';const R = "_item_cs9p2_1", b = "_content_cs9p2_40", c = {
|
|
5
|
+
item: R,
|
|
6
|
+
content: b
|
|
7
7
|
}, A = ({
|
|
8
|
-
interactive:
|
|
8
|
+
interactive: s = !0,
|
|
9
9
|
ariaLabel: m,
|
|
10
|
-
role:
|
|
10
|
+
role: o,
|
|
11
11
|
as: i,
|
|
12
|
-
color:
|
|
13
|
-
variant:
|
|
14
|
-
size:
|
|
15
|
-
className:
|
|
12
|
+
color: d,
|
|
13
|
+
variant: p,
|
|
14
|
+
size: f,
|
|
15
|
+
className: u,
|
|
16
16
|
href: _,
|
|
17
17
|
onClick: t,
|
|
18
|
-
onKeyPress:
|
|
19
|
-
tabIndex:
|
|
20
|
-
hidden:
|
|
21
|
-
selected:
|
|
22
|
-
disabled:
|
|
23
|
-
children:
|
|
24
|
-
active:
|
|
25
|
-
onMouseEnter:
|
|
26
|
-
dataTestId:
|
|
18
|
+
onKeyPress: e,
|
|
19
|
+
tabIndex: l = 0,
|
|
20
|
+
hidden: x,
|
|
21
|
+
selected: v,
|
|
22
|
+
disabled: a = !1,
|
|
23
|
+
children: h,
|
|
24
|
+
active: I,
|
|
25
|
+
onMouseEnter: N,
|
|
26
|
+
dataTestId: j
|
|
27
27
|
}) => {
|
|
28
|
-
const
|
|
28
|
+
const z = i || "a", B = M(null);
|
|
29
29
|
return /* @__PURE__ */ r(
|
|
30
|
-
|
|
30
|
+
z,
|
|
31
31
|
{
|
|
32
|
-
tabIndex:
|
|
33
|
-
className:
|
|
34
|
-
role:
|
|
32
|
+
tabIndex: a ? "-1" : l ?? 0,
|
|
33
|
+
className: E(c.item, u),
|
|
34
|
+
role: o,
|
|
35
35
|
"aria-label": m,
|
|
36
|
-
"data-interactive":
|
|
37
|
-
"data-active":
|
|
38
|
-
"data-size":
|
|
39
|
-
"data-color":
|
|
40
|
-
"data-variant":
|
|
41
|
-
"aria-hidden":
|
|
42
|
-
"aria-disabled":
|
|
43
|
-
"data-selected":
|
|
36
|
+
"data-interactive": !a && s,
|
|
37
|
+
"data-active": I,
|
|
38
|
+
"data-size": f,
|
|
39
|
+
"data-color": d,
|
|
40
|
+
"data-variant": p,
|
|
41
|
+
"aria-hidden": x,
|
|
42
|
+
"aria-disabled": a,
|
|
43
|
+
"data-selected": v,
|
|
44
44
|
href: _,
|
|
45
45
|
onKeyPress: (n) => {
|
|
46
|
-
n.key === "Enter" && (t == null || t()),
|
|
46
|
+
a || (n.key === "Enter" && (t == null || t()), e == null || e(n));
|
|
47
47
|
},
|
|
48
48
|
onClick: t,
|
|
49
|
-
onMouseEnter:
|
|
50
|
-
"data-testid":
|
|
51
|
-
ref:
|
|
52
|
-
children: /* @__PURE__ */ r("span", { className:
|
|
49
|
+
onMouseEnter: N,
|
|
50
|
+
"data-testid": j,
|
|
51
|
+
ref: B,
|
|
52
|
+
children: /* @__PURE__ */ r("span", { className: c.content, children: h })
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
55
|
};
|
|
@@ -6,8 +6,8 @@ import "../Snackbar/useSnackbar.js";
|
|
|
6
6
|
import { Input as x } from "../Forms/Input.js";
|
|
7
7
|
import { SettingsItemBase as n } from "./SettingsItemBase.js";
|
|
8
8
|
import { SettingsModal as I } from "./SettingsModal.js";
|
|
9
|
-
const
|
|
10
|
-
loading:
|
|
9
|
+
const O = ({
|
|
10
|
+
loading: a,
|
|
11
11
|
variant: f = "default",
|
|
12
12
|
id: c = "settings",
|
|
13
13
|
name: m,
|
|
@@ -17,8 +17,8 @@ const M = ({
|
|
|
17
17
|
children: v,
|
|
18
18
|
...t
|
|
19
19
|
}) => {
|
|
20
|
-
const [l,
|
|
21
|
-
if (
|
|
20
|
+
const [l, u] = b(!1);
|
|
21
|
+
if (a)
|
|
22
22
|
return /* @__PURE__ */ i(n, { icon: t == null ? void 0 : t.icon, title: t == null ? void 0 : t.title, loading: !0 });
|
|
23
23
|
switch (f) {
|
|
24
24
|
case "switch":
|
|
@@ -49,23 +49,21 @@ const M = ({
|
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
case "modal":
|
|
52
|
-
return /* @__PURE__ */ i(
|
|
53
|
-
|
|
52
|
+
return /* @__PURE__ */ i(n, { ...t, as: "button", linkIcon: !0, onClick: () => u(!0), expanded: l, children: l && /* @__PURE__ */ i(
|
|
53
|
+
I,
|
|
54
54
|
{
|
|
55
|
-
...
|
|
55
|
+
...e,
|
|
56
|
+
icon: (e == null ? void 0 : e.icon) || (t == null ? void 0 : t.icon),
|
|
56
57
|
title: (e == null ? void 0 : e.title) || (t == null ? void 0 : t.title),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
onClick: () => a(!0),
|
|
61
|
-
expanded: l,
|
|
62
|
-
children: l && /* @__PURE__ */ i(I, { icon: t == null ? void 0 : t.icon, title: t == null ? void 0 : t.title, open: l, onClose: () => a(!1), children: v })
|
|
58
|
+
open: l,
|
|
59
|
+
onClose: () => u(!1),
|
|
60
|
+
children: v
|
|
63
61
|
}
|
|
64
|
-
);
|
|
62
|
+
) });
|
|
65
63
|
default:
|
|
66
64
|
return /* @__PURE__ */ i(n, { ...t });
|
|
67
65
|
}
|
|
68
66
|
};
|
|
69
67
|
export {
|
|
70
|
-
|
|
68
|
+
O as SettingsItem
|
|
71
69
|
};
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
|
-
import { getAriaLabelFromTitle as
|
|
6
|
-
import { ListItemBase as
|
|
7
|
-
import { ListItemHeader as
|
|
8
|
-
import { ListItemLabel as
|
|
5
|
+
import { getAriaLabelFromTitle as f } from "../Menu/MenuItemLabel.js";
|
|
6
|
+
import { ListItemBase as g } from "../List/ListItemBase.js";
|
|
7
|
+
import { ListItemHeader as I } from "../List/ListItemHeader.js";
|
|
8
|
+
import { ListItemLabel as k } from "../List/ListItemLabel.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import '../../assets/SettingsItemBase.css';const
|
|
11
|
-
item:
|
|
12
|
-
label:
|
|
13
|
-
header:
|
|
14
|
-
},
|
|
10
|
+
import '../../assets/SettingsItemBase.css';const N = "_item_lk1g7_1", j = "_label_lk1g7_20", x = "_header_lk1g7_24", e = {
|
|
11
|
+
item: N,
|
|
12
|
+
label: j,
|
|
13
|
+
header: x
|
|
14
|
+
}, v = ({
|
|
15
|
+
ref: s,
|
|
15
16
|
loading: t,
|
|
16
|
-
color:
|
|
17
|
-
size:
|
|
17
|
+
color: l,
|
|
18
|
+
size: o,
|
|
18
19
|
expanded: r,
|
|
19
|
-
icon:
|
|
20
|
-
label:
|
|
20
|
+
icon: c,
|
|
21
|
+
label: n,
|
|
21
22
|
title: m,
|
|
22
|
-
value:
|
|
23
|
-
description:
|
|
24
|
-
children:
|
|
25
|
-
highlightWords:
|
|
23
|
+
value: _,
|
|
24
|
+
description: b,
|
|
25
|
+
children: h,
|
|
26
|
+
highlightWords: p,
|
|
26
27
|
...a
|
|
27
28
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */ i(
|
|
31
|
-
|
|
29
|
+
const L = a.ariaLabel || f(m);
|
|
30
|
+
return /* @__PURE__ */ d(g, { ref: s, className: e.item, color: l, size: o, expanded: r, children: [
|
|
31
|
+
/* @__PURE__ */ i(I, { ...a, loading: t, ariaLabel: L, className: e.header, icon: c, children: /* @__PURE__ */ i(
|
|
32
|
+
k,
|
|
32
33
|
{
|
|
33
34
|
loading: t,
|
|
34
|
-
highlightWords:
|
|
35
|
+
highlightWords: p,
|
|
35
36
|
className: e.label,
|
|
36
37
|
title: m,
|
|
37
|
-
value:
|
|
38
|
-
description:
|
|
39
|
-
children:
|
|
38
|
+
value: _,
|
|
39
|
+
description: b,
|
|
40
|
+
children: n
|
|
40
41
|
}
|
|
41
42
|
) }),
|
|
42
|
-
r &&
|
|
43
|
+
r && h
|
|
43
44
|
] });
|
|
44
45
|
};
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
v as SettingsItemBase
|
|
47
48
|
};
|
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
import { jsxs as e, jsx as
|
|
1
|
+
import { jsxs as e, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as x } from "react";
|
|
2
3
|
import "../../index-L8X2o7IH.js";
|
|
3
|
-
import "
|
|
4
|
+
import { Button as g } from "../Button/Button.js";
|
|
5
|
+
import { ButtonGroup as j } from "../Button/ButtonGroup.js";
|
|
4
6
|
import "../RootProvider/RootProvider.js";
|
|
5
7
|
import "../Snackbar/useSnackbar.js";
|
|
6
|
-
import { ModalBase as
|
|
7
|
-
import { ModalHeader as
|
|
8
|
-
import { ModalBody as
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { ModalBase as y } from "../Modal/ModalBase.js";
|
|
9
|
+
import { ModalHeader as E } from "../Modal/ModalHeader.js";
|
|
10
|
+
import { ModalBody as G } from "../Modal/ModalBody.js";
|
|
11
|
+
const J = ({
|
|
12
|
+
icon: a,
|
|
13
|
+
title: c,
|
|
14
|
+
description: f,
|
|
15
|
+
open: l,
|
|
16
|
+
onClose: i,
|
|
17
|
+
buttons: m,
|
|
18
|
+
children: h,
|
|
19
|
+
...B
|
|
20
|
+
}) => /* @__PURE__ */ e(y, { ...B, open: l, onClose: i, children: [
|
|
21
|
+
/* @__PURE__ */ d(E, { icon: a, title: c, description: f, onClose: i }),
|
|
22
|
+
/* @__PURE__ */ e(G, { children: [
|
|
23
|
+
h,
|
|
24
|
+
(m == null ? void 0 : m.length) && /* @__PURE__ */ d(j, { children: m == null ? void 0 : m.map((r, M) => /* @__PURE__ */ x(
|
|
25
|
+
g,
|
|
26
|
+
{
|
|
27
|
+
...r,
|
|
28
|
+
key: M,
|
|
29
|
+
onClick: (k) => {
|
|
30
|
+
var p;
|
|
31
|
+
(p = r == null ? void 0 : r.onClick) == null || p.call(r, k), r != null && r.close && (i == null || i());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
)) })
|
|
35
|
+
] })
|
|
12
36
|
] });
|
|
13
37
|
export {
|
|
14
|
-
|
|
38
|
+
J as SettingsModal
|
|
15
39
|
};
|
package/dist/hooks/useMenu.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState as w, useMemo as x, useCallback as k, useEffect as
|
|
3
|
-
import { useEnterKey as
|
|
4
|
-
const
|
|
5
|
-
items:
|
|
2
|
+
import { useState as w, useMemo as x, useCallback as k, useEffect as A } from "react";
|
|
3
|
+
import { useEnterKey as D } from "./useEnterKey.js";
|
|
4
|
+
const M = ({
|
|
5
|
+
items: s,
|
|
6
6
|
groups: p,
|
|
7
|
-
groupByKey:
|
|
8
|
-
keyboardEvents:
|
|
7
|
+
groupByKey: i,
|
|
8
|
+
keyboardEvents: a = !1,
|
|
9
9
|
sortGroupBy: v,
|
|
10
|
-
onSelect:
|
|
11
|
-
ref:
|
|
10
|
+
onSelect: l,
|
|
11
|
+
ref: c
|
|
12
12
|
}) => {
|
|
13
|
-
const [
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
|
|
13
|
+
const [d, u] = w(-1);
|
|
14
|
+
D((t) => {
|
|
15
|
+
if (a) {
|
|
16
|
+
const n = c && "current" in c ? c.current : null, e = n == null ? void 0 : n.querySelector('[data-active="true"]');
|
|
17
|
+
t.stopPropagation(), t.preventDefault(), e && (e.tagName === "A" && e.hasAttribute("href") ? e.click() : e.dispatchEvent(new MouseEvent("click", { bubbles: !0 }))), l == null || l();
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
const h = x(() => {
|
|
21
|
-
const
|
|
21
|
+
const t = s.reduce(
|
|
22
22
|
(e, o) => {
|
|
23
|
-
const r =
|
|
23
|
+
const r = i && o[i] ? o[i] : "ungrouped";
|
|
24
24
|
return e[r] = e[r] || [], e[r].push(o), e;
|
|
25
25
|
},
|
|
26
26
|
{}
|
|
27
|
-
),
|
|
28
|
-
return Object.entries(
|
|
27
|
+
), n = Object.values(t).flat().filter((e) => !(e != null && e.disabled));
|
|
28
|
+
return Object.entries(t).sort(v || (() => 0)).map(([e, o]) => ({
|
|
29
29
|
items: o.map((r) => ({
|
|
30
|
-
menuIndex:
|
|
31
|
-
active:
|
|
32
|
-
onMouseEnter:
|
|
33
|
-
|
|
30
|
+
menuIndex: n.indexOf(r),
|
|
31
|
+
active: d === n.indexOf(r),
|
|
32
|
+
onMouseEnter: a ? () => {
|
|
33
|
+
u(n.indexOf(r));
|
|
34
34
|
} : void 0,
|
|
35
|
-
onMouseLeave:
|
|
36
|
-
|
|
35
|
+
onMouseLeave: a ? () => {
|
|
36
|
+
u(-1);
|
|
37
37
|
} : void 0,
|
|
38
38
|
props: r
|
|
39
39
|
})),
|
|
@@ -41,16 +41,16 @@ const L = ({
|
|
|
41
41
|
...p[e] || {}
|
|
42
42
|
}
|
|
43
43
|
}));
|
|
44
|
-
}, [
|
|
45
|
-
(
|
|
46
|
-
|
|
44
|
+
}, [s, i, d, p]), f = k(
|
|
45
|
+
(t) => {
|
|
46
|
+
t.key === "ArrowDown" ? (t.preventDefault(), u((n) => (n + 1) % s.length)) : t.key === "ArrowUp" && (t.preventDefault(), u((n) => (n - 1 + s.length) % s.length));
|
|
47
47
|
},
|
|
48
|
-
[
|
|
48
|
+
[s.length]
|
|
49
49
|
);
|
|
50
|
-
return
|
|
51
|
-
document.removeEventListener("keydown",
|
|
52
|
-
}), [
|
|
50
|
+
return A(() => (a && (u(0), document.addEventListener("keydown", f)), () => {
|
|
51
|
+
document.removeEventListener("keydown", f);
|
|
52
|
+
}), [f, a]), { menu: h, activeIndex: d, setActiveIndex: u };
|
|
53
53
|
};
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
M as useMenu
|
|
56
56
|
};
|
|
@@ -10,4 +10,4 @@ export interface AccountListProps {
|
|
|
10
10
|
emptyTitle?: string;
|
|
11
11
|
emptyDescription?: string;
|
|
12
12
|
}
|
|
13
|
-
export declare const AccountList: ({ items, groups, sortGroupBy
|
|
13
|
+
export declare const AccountList: ({ items, groups, sortGroupBy }: AccountListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { AccountListItemProps, AccountListProps } from '..';
|
|
|
3
3
|
import { UseAccountsProps } from '../../../examples';
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: ({ items, groups, sortGroupBy
|
|
6
|
+
component: ({ items, groups, sortGroupBy }: AccountListProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {};
|
|
9
9
|
args: AccountListProps;
|
|
@@ -35,6 +35,7 @@ declare const meta: {
|
|
|
35
35
|
icon?: import('..').SvgElement | import('..').IconProps | React.ReactNode | import('..').AvatarProps | import('..').AvatarGroupProps;
|
|
36
36
|
badge?: React.ReactNode | import('..').BadgeProps;
|
|
37
37
|
linkIcon?: boolean | undefined;
|
|
38
|
+
ref?: React.Ref<HTMLElement> | undefined;
|
|
38
39
|
interactive?: boolean | undefined;
|
|
39
40
|
as?: React.ElementType | undefined;
|
|
40
41
|
tabIndex?: number | undefined;
|
|
@@ -4,6 +4,7 @@ export type ListItemSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
4
4
|
export type ListItemBorder = 'none' | 'solid' | 'dotted';
|
|
5
5
|
export type ListItemColor = Color;
|
|
6
6
|
export interface ListItemBaseProps {
|
|
7
|
+
ref?: React.Ref<HTMLElement>;
|
|
7
8
|
/** If true, the list item is interactive and has a hover state. */
|
|
8
9
|
interactive?: boolean;
|
|
9
10
|
/** The element type to render as. */
|
|
@@ -41,4 +42,4 @@ export interface ListItemBaseProps {
|
|
|
41
42
|
/** Id of list item. */
|
|
42
43
|
id?: string;
|
|
43
44
|
}
|
|
44
|
-
export declare const ListItemBase: ({ as, interactive, size, color, variant, shadow, border, hidden, selected, className, onMouseEnter, id, children, }: ListItemBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const ListItemBase: ({ ref, as, interactive, size, color, variant, shadow, border, hidden, selected, className, onMouseEnter, id, children, }: ListItemBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,6 +31,7 @@ export interface MenuListItemProps {
|
|
|
31
31
|
children?: ReactNode;
|
|
32
32
|
style?: React.CSSProperties;
|
|
33
33
|
dataIndex?: number;
|
|
34
|
+
disabled?: boolean;
|
|
34
35
|
onMouseEnter?: MouseEventHandler;
|
|
35
36
|
onMouseLeave?: MouseEventHandler;
|
|
36
37
|
ref?: HTMLUListElement;
|
|
@@ -38,4 +39,4 @@ export interface MenuListItemProps {
|
|
|
38
39
|
}
|
|
39
40
|
export declare const MenuBase: ({ as, color, variant, className, children, ref }: MenuBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
41
|
export declare const MenuList: ({ as, role, className, children, ref, onMouseEnter, onMouseLeave, onBlurCapture, }: MenuListProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export declare const MenuListItem: ({ as, role, className, children, style, dataIndex, onMouseEnter, onMouseLeave, "aria-checked": ariaChecked, }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare const MenuListItem: ({ as, role, className, children, style, dataIndex, disabled, onMouseEnter, onMouseLeave, "aria-checked": ariaChecked, }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { InputProps, SettingsItemBaseProps } from '..';
|
|
1
|
+
import { InputProps, SettingsItemBaseProps, SettingsModalProps } from '..';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export type SettingsItemVariant = 'default' | 'modal' | 'switch';
|
|
4
4
|
export interface SettingsItemModalProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
icon?: SettingsModalProps['icon'];
|
|
6
|
+
title?: SettingsModalProps['title'];
|
|
7
|
+
description?: SettingsModalProps['description'];
|
|
8
|
+
buttons?: SettingsModalProps['buttons'];
|
|
7
9
|
}
|
|
8
10
|
export interface SettingsItemProps extends SettingsItemBaseProps {
|
|
9
11
|
variant?: SettingsItemVariant;
|
|
@@ -26,6 +26,7 @@ declare const meta: {
|
|
|
26
26
|
expanded?: boolean | undefined;
|
|
27
27
|
icon?: import('..').SvgElement | import('..').IconProps | React.ReactNode | import('..').AvatarProps | import('..').AvatarGroupProps;
|
|
28
28
|
label?: React.ReactNode;
|
|
29
|
+
ref?: React.Ref<HTMLElement> | undefined;
|
|
29
30
|
interactive?: boolean | undefined;
|
|
30
31
|
as?: React.ElementType | undefined;
|
|
31
32
|
tabIndex?: number | undefined;
|
|
@@ -58,6 +59,7 @@ export declare const Value: Story;
|
|
|
58
59
|
export declare const Loading: Story;
|
|
59
60
|
export declare const Switch: Story;
|
|
60
61
|
export declare const Modal: Story;
|
|
62
|
+
export declare const ModalProps: Story;
|
|
61
63
|
export declare const Company: Story;
|
|
62
64
|
export declare const Person: Story;
|
|
63
65
|
export declare const Bookmark: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,4 +10,4 @@ export interface SettingsItemBaseProps extends ListItemBaseProps, ListItemHeader
|
|
|
10
10
|
value?: ListItemLabelProps['value'];
|
|
11
11
|
description?: ListItemLabelProps['description'];
|
|
12
12
|
}
|
|
13
|
-
export declare const SettingsItemBase: ({ loading, color, size, expanded, icon, label, title, value, description, children, highlightWords, ...props }: SettingsItemBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const SettingsItemBase: ({ ref, loading, color, size, expanded, icon, label, title, value, description, children, highlightWords, ...props }: SettingsItemBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ModalBaseProps, ModalHeaderProps } from '..';
|
|
1
|
+
import { ButtonProps, ModalBaseProps, ModalHeaderProps } from '..';
|
|
2
|
+
export interface SettingsModalButtonProps extends ButtonProps {
|
|
3
|
+
close?: boolean;
|
|
4
|
+
}
|
|
2
5
|
export interface SettingsModalProps extends ModalBaseProps {
|
|
3
6
|
icon?: ModalHeaderProps['icon'];
|
|
4
7
|
title?: ModalHeaderProps['title'];
|
|
5
8
|
description?: ModalHeaderProps['description'];
|
|
9
|
+
buttons?: SettingsModalButtonProps[];
|
|
6
10
|
}
|
|
7
|
-
export declare const SettingsModal: ({ icon, title, description, open, onClose, children, ...args }: SettingsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const SettingsModal: ({ icon, title, description, open, onClose, buttons, children, ...args }: SettingsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { ChangeEvent } from 'react';
|
|
|
2
2
|
import { AccountListItemProps, SettingsModalProps, UsedByLogProps } from '..';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ icon, title, description, open, onClose, children, ...args }: SettingsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
component: ({ icon, title, description, open, onClose, buttons, children, ...args }: SettingsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {};
|
|
8
8
|
args: {
|
|
@@ -24,6 +24,7 @@ declare const meta: {
|
|
|
24
24
|
size?: import('..').ListItemSize | undefined;
|
|
25
25
|
color?: import('..').ListItemColor | undefined;
|
|
26
26
|
className?: string | undefined;
|
|
27
|
+
ref?: React.Ref<HTMLElement> | undefined;
|
|
27
28
|
icon?: import('..').SvgElement | import('..').IconProps | React.ReactNode | import('..').AvatarProps | import('..').AvatarGroupProps;
|
|
28
29
|
as?: React.ElementType | undefined;
|
|
29
30
|
label?: React.ReactNode | (() => React.ReactElement);
|