@studiolxd/brand 46.0.0 → 47.0.0
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/CHANGELOG.md +134 -0
- package/dist/_shared/portal-container.js +9 -0
- package/dist/_types/atoms/AsyncMultiSelect/AsyncMultiSelect.d.ts +8 -7
- package/dist/_types/atoms/AsyncSelect/AsyncSelect.d.ts +8 -6
- package/dist/_types/atoms/InputPhone/InputPhone.d.ts +8 -5
- package/dist/_types/atoms/MenuButton/MenuButton.d.ts +22 -2
- package/dist/_types/atoms/MultiSelect/MultiSelect.d.ts +8 -6
- package/dist/_types/atoms/Popover/Popover.d.ts +8 -1
- package/dist/_types/atoms/Select/Select.d.ts +8 -7
- package/dist/_types/atoms/Tooltip/Tooltip.d.ts +7 -0
- package/dist/_types/constants/portal-container.d.ts +42 -0
- package/dist/_types/messages/BrandMessages.d.ts +29 -1
- package/dist/_types/messages/index.d.ts +1 -1
- package/dist/_types/molecules/Breadcrumb/Breadcrumb.d.ts +10 -2
- package/dist/_types/molecules/Menu/Menu.d.ts +8 -1
- package/dist/_types/molecules/Modal/Modal.d.ts +8 -6
- package/dist/_types/molecules/OrgSwitcher/OrgSwitcher.d.ts +15 -1
- package/dist/_types/molecules/PrevNextNav/PrevNextNav.d.ts +17 -2
- package/dist/_types/molecules/Sheet/Sheet.d.ts +8 -7
- package/dist/_types/molecules/SidebarNav/SidebarNav.d.ts +18 -3
- package/dist/_types/molecules/SiteNav/SiteNav.d.ts +9 -0
- package/dist/_types/molecules/TableOfContents/TableOfContents.d.ts +11 -2
- package/dist/_types/molecules/UserMenu/UserMenu.d.ts +16 -1
- package/dist/_types/sections/AppHeader/AppHeader.d.ts +8 -2
- package/dist/_types/sections/AppRoot/AppRoot.d.ts +12 -1
- package/dist/_types/sections/AppShell/AppShell.d.ts +14 -1
- package/dist/_types/sections/Sidebar/Sidebar.d.ts +27 -3
- package/dist/_types/sections/SiteHeader/SiteHeader.d.ts +22 -3
- package/dist/_types/sections/SiteShell/SiteShell.d.ts +11 -5
- package/dist/_types/templates/OnboardingShell/OnboardingShell.d.ts +19 -2
- package/dist/_types/templates/PublicPageShell/PublicPageShell.d.ts +42 -6
- package/dist/app-header.js +1 -1
- package/dist/app-launcher.js +62 -58
- package/dist/app-root.js +10 -8
- package/dist/app-shell.js +51 -50
- package/dist/async-multi-select.js +65 -64
- package/dist/async-select.js +49 -48
- package/dist/breadcrumb.js +24 -21
- package/dist/input-phone.js +38 -37
- package/dist/menu-button.js +16 -14
- package/dist/menu.js +44 -40
- package/dist/modal.js +32 -31
- package/dist/multi-select.js +106 -105
- package/dist/onboarding-shell.js +36 -35
- package/dist/org-switcher.js +64 -59
- package/dist/popover.js +27 -22
- package/dist/prev-next-nav.js +38 -36
- package/dist/public-page-shell.js +24 -20
- package/dist/select.js +70 -69
- package/dist/sheet.js +30 -29
- package/dist/sidebar-nav.js +91 -90
- package/dist/sidebar.js +72 -71
- package/dist/site-header.js +44 -43
- package/dist/site-nav.js +27 -25
- package/dist/site-shell.js +23 -15
- package/dist/table-of-contents.js +30 -27
- package/dist/toaster.js +57 -53
- package/dist/tooltip.js +45 -41
- package/dist/user-menu.js +58 -52
- package/package.json +1 -1
package/dist/site-nav.js
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import './site-nav.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Heading as t } from "./heading.js";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
6
|
//#region src/stories/molecules/SiteNav/SiteNav.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
+
function i({ href: e, children: t, className: r, "aria-current": i, target: a, rel: o }) {
|
|
8
|
+
return /* @__PURE__ */ n("a", {
|
|
7
9
|
href: e,
|
|
8
10
|
className: r,
|
|
9
11
|
"aria-current": i,
|
|
10
12
|
target: a,
|
|
11
13
|
rel: o,
|
|
12
|
-
children:
|
|
14
|
+
children: t
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function a(e, t) {
|
|
16
18
|
return t || (e === "_blank" ? "noopener noreferrer" : void 0);
|
|
17
19
|
}
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
"aria-label":
|
|
24
|
-
"data-columns":
|
|
25
|
-
children:
|
|
20
|
+
var o = 5;
|
|
21
|
+
function s({ groups: s, label: c, renderLink: l = i, className: u }) {
|
|
22
|
+
let d = e("siteNav"), f = ["site-nav", u].filter(Boolean).join(" "), p = Math.min(s.length, o) || 1;
|
|
23
|
+
return /* @__PURE__ */ n("nav", {
|
|
24
|
+
className: f,
|
|
25
|
+
"aria-label": d("label", c),
|
|
26
|
+
"data-columns": p,
|
|
27
|
+
children: s.map((e) => /* @__PURE__ */ r("div", {
|
|
26
28
|
className: "site-nav__group",
|
|
27
|
-
children: [/* @__PURE__ */ t
|
|
29
|
+
children: [/* @__PURE__ */ n(t, {
|
|
28
30
|
level: 2,
|
|
29
31
|
size: 6,
|
|
30
32
|
className: "site-nav__label",
|
|
31
|
-
children:
|
|
32
|
-
href:
|
|
33
|
+
children: e.href ? l({
|
|
34
|
+
href: e.href,
|
|
33
35
|
className: "site-nav__label-link",
|
|
34
|
-
children:
|
|
35
|
-
}) :
|
|
36
|
-
}), /* @__PURE__ */
|
|
36
|
+
children: e.label
|
|
37
|
+
}) : e.label
|
|
38
|
+
}), /* @__PURE__ */ n("ul", {
|
|
37
39
|
className: "site-nav__list",
|
|
38
|
-
children:
|
|
40
|
+
children: e.items.map((e) => /* @__PURE__ */ n("li", {
|
|
39
41
|
className: "site-nav__item",
|
|
40
|
-
children:
|
|
42
|
+
children: l({
|
|
41
43
|
href: e.href,
|
|
42
44
|
className: ["site-nav__link", e.current ? "site-nav__link--current" : ""].filter(Boolean).join(" "),
|
|
43
45
|
"aria-current": e.current ? "page" : void 0,
|
|
44
46
|
target: e.target,
|
|
45
|
-
rel:
|
|
47
|
+
rel: a(e.target, e.rel),
|
|
46
48
|
children: e.label
|
|
47
49
|
})
|
|
48
50
|
}, e.id))
|
|
49
51
|
})]
|
|
50
|
-
},
|
|
52
|
+
}, e.id))
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
//#endregion
|
|
54
|
-
export {
|
|
56
|
+
export { s as SiteNav };
|
package/dist/site-shell.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import './site-shell.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { t as e } from "./_shared/portal-container.js";
|
|
4
|
+
import { forwardRef as t, useCallback as n, useState as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
6
|
//#region src/stories/sections/SiteShell/SiteShell.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
var o = t(function({ header: t, footer: o, children: s, className: c }, l) {
|
|
8
|
+
let [u, d] = r(null);
|
|
9
|
+
return /* @__PURE__ */ i("div", {
|
|
10
|
+
ref: n((e) => {
|
|
11
|
+
d(e), typeof l == "function" ? l(e) : l && (l.current = e);
|
|
12
|
+
}, [l]),
|
|
13
|
+
className: ["site-shell", c].filter(Boolean).join(" "),
|
|
14
|
+
children: /* @__PURE__ */ a(e.Provider, {
|
|
15
|
+
value: u,
|
|
16
|
+
children: [
|
|
17
|
+
t,
|
|
18
|
+
/* @__PURE__ */ i("div", {
|
|
19
|
+
className: "site-shell__main",
|
|
20
|
+
children: s
|
|
21
|
+
}),
|
|
22
|
+
o
|
|
23
|
+
]
|
|
24
|
+
})
|
|
17
25
|
});
|
|
18
26
|
});
|
|
19
27
|
//#endregion
|
|
20
|
-
export {
|
|
28
|
+
export { o as SiteShell };
|
|
@@ -1,45 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import './table-of-contents.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Link as t } from "./link.js";
|
|
5
|
+
import { List as n } from "./list.js";
|
|
6
|
+
import { forwardRef as r } from "react";
|
|
7
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
8
|
//#region src/stories/molecules/TableOfContents/TableOfContents.tsx
|
|
7
|
-
function
|
|
9
|
+
function o(e, t) {
|
|
8
10
|
return Math.min(Math.max(e - t, 0), 5);
|
|
9
11
|
}
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var s = r(function({ items: r, activeId: s, ariaLabel: c, title: l, sticky: u = !1, onItemClick: d, className: f, ...p }, m) {
|
|
13
|
+
let h = e("tableOfContents");
|
|
14
|
+
if (r.length === 0) return null;
|
|
15
|
+
let g = Math.min(...r.map((e) => e.level));
|
|
16
|
+
return /* @__PURE__ */ a("nav", {
|
|
17
|
+
ref: m,
|
|
15
18
|
className: [
|
|
16
19
|
"table-of-contents",
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
u ? "table-of-contents--sticky" : "",
|
|
21
|
+
f ?? ""
|
|
19
22
|
].filter(Boolean).join(" "),
|
|
20
|
-
"aria-label":
|
|
21
|
-
...
|
|
22
|
-
children: [
|
|
23
|
+
"aria-label": h("label", c),
|
|
24
|
+
...p,
|
|
25
|
+
children: [l && /* @__PURE__ */ i("p", {
|
|
23
26
|
className: "table-of-contents__title",
|
|
24
|
-
children:
|
|
25
|
-
}), /* @__PURE__ */
|
|
27
|
+
children: l
|
|
28
|
+
}), /* @__PURE__ */ i(n, {
|
|
26
29
|
type: "plain",
|
|
27
30
|
className: "table-of-contents__list",
|
|
28
|
-
children:
|
|
29
|
-
let n =
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
className: `table-of-contents__item table-of-contents__item--level-${
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
href: `#${
|
|
31
|
+
children: r.map((e) => {
|
|
32
|
+
let n = e.id === s;
|
|
33
|
+
return /* @__PURE__ */ i("li", {
|
|
34
|
+
className: `table-of-contents__item table-of-contents__item--level-${o(e.level, g)}`,
|
|
35
|
+
children: /* @__PURE__ */ i(t, {
|
|
36
|
+
href: `#${e.id}`,
|
|
34
37
|
className: ["table-of-contents__link", n ? "table-of-contents__link--active" : ""].filter(Boolean).join(" "),
|
|
35
38
|
"aria-current": n ? "location" : void 0,
|
|
36
|
-
onClick:
|
|
37
|
-
children:
|
|
39
|
+
onClick: d ? (t) => d(e, t) : void 0,
|
|
40
|
+
children: e.label
|
|
38
41
|
})
|
|
39
|
-
},
|
|
42
|
+
}, e.id);
|
|
40
43
|
})
|
|
41
44
|
})]
|
|
42
45
|
});
|
|
43
46
|
});
|
|
44
47
|
//#endregion
|
|
45
|
-
export {
|
|
48
|
+
export { s as TableOfContents };
|
package/dist/toaster.js
CHANGED
|
@@ -1,81 +1,85 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './toaster.css';
|
|
3
3
|
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { n as t } from "./_shared/portal-container.js";
|
|
5
|
+
import { Button as n } from "./button.js";
|
|
6
|
+
import { CloseButton as r } from "./close-button.js";
|
|
7
|
+
import { t as i } from "./_shared/css-properties.js";
|
|
8
|
+
import { TOAST_DURATION as a, setToastDefaultDuration as o, syncLiveToasts as s, toastManager as c } from "./toast.js";
|
|
9
|
+
import { useEffect as l } from "react";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
import { Toast as f } from "@base-ui/react/toast";
|
|
11
12
|
//#region src/stories/molecules/Toast/Toaster.tsx
|
|
12
|
-
var
|
|
13
|
+
var p = 8, m = {
|
|
13
14
|
success: "alert--success",
|
|
14
15
|
error: "alert--error",
|
|
15
16
|
warning: "alert--warning"
|
|
16
17
|
};
|
|
17
|
-
function
|
|
18
|
+
function h(e, t) {
|
|
18
19
|
return [
|
|
19
20
|
"alert",
|
|
20
|
-
|
|
21
|
+
m[e ?? ""] ?? "",
|
|
21
22
|
e === "warning" ? "" : "surface-dark",
|
|
22
23
|
t ? "alert--dismissible" : "",
|
|
23
24
|
"toast"
|
|
24
25
|
].filter(Boolean).join(" ");
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
let
|
|
27
|
+
function g({ position: a, containerAriaLabel: o, closeLabel: c, closeButton: p, gap: m, expand: g }) {
|
|
28
|
+
let _ = e("toaster"), { toasts: v } = f.useToastManager(), [y, b] = a.split("-"), x = v.map((e) => e.id).join(",");
|
|
29
|
+
l(() => {
|
|
30
|
+
s(x ? x.split(",") : []);
|
|
31
|
+
}, [x]);
|
|
32
|
+
let S = i({ "--toast-gap": `${m}px` }), C = t(void 0), w = [
|
|
32
33
|
"toaster",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
y === "top" ? "toaster--top" : "",
|
|
35
|
+
b === "right" ? "" : `toaster--${b}`,
|
|
36
|
+
g ? "toaster--expanded" : ""
|
|
36
37
|
].filter(Boolean).join(" ");
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
className:
|
|
46
|
-
children: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className: "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
return /* @__PURE__ */ u(f.Portal, {
|
|
39
|
+
container: C,
|
|
40
|
+
children: /* @__PURE__ */ u(f.Viewport, {
|
|
41
|
+
ref: S,
|
|
42
|
+
className: w,
|
|
43
|
+
"aria-label": _("container", o),
|
|
44
|
+
children: v.map((e) => /* @__PURE__ */ d(f.Root, {
|
|
45
|
+
toast: e,
|
|
46
|
+
className: h(e.type, p),
|
|
47
|
+
children: [/* @__PURE__ */ d("div", {
|
|
48
|
+
className: "alert__content",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ u(f.Title, { className: "alert__title" }),
|
|
51
|
+
/* @__PURE__ */ u(f.Description, { className: "alert__description" }),
|
|
52
|
+
/* @__PURE__ */ u(f.Action, {
|
|
53
|
+
className: "toast__action",
|
|
54
|
+
render: /* @__PURE__ */ u(n, {
|
|
55
|
+
variant: "ghost",
|
|
56
|
+
size: "sm"
|
|
57
|
+
})
|
|
54
58
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
})
|
|
59
|
+
]
|
|
60
|
+
}), p && /* @__PURE__ */ u(f.Close, {
|
|
61
|
+
className: "alert__close",
|
|
62
|
+
render: /* @__PURE__ */ u(r, { label: _("close", c) })
|
|
63
|
+
})]
|
|
64
|
+
}, e.id))
|
|
65
|
+
})
|
|
66
|
+
});
|
|
63
67
|
}
|
|
64
|
-
function
|
|
65
|
-
let
|
|
66
|
-
return
|
|
67
|
-
toastManager:
|
|
68
|
-
timeout:
|
|
69
|
-
limit:
|
|
70
|
-
children: /* @__PURE__ */
|
|
68
|
+
function _({ position: e = "bottom-right", containerAriaLabel: t, closeLabel: n, closeButton: r = !0, duration: i = a, gap: s = p, visibleToasts: d = 3, expand: m = !1 }) {
|
|
69
|
+
let h = Number.isFinite(i) ? i : 0;
|
|
70
|
+
return l(() => o(h), [h]), /* @__PURE__ */ u(f.Provider, {
|
|
71
|
+
toastManager: c,
|
|
72
|
+
timeout: h,
|
|
73
|
+
limit: d,
|
|
74
|
+
children: /* @__PURE__ */ u(g, {
|
|
71
75
|
position: e,
|
|
72
76
|
containerAriaLabel: t,
|
|
73
77
|
closeLabel: n,
|
|
74
78
|
closeButton: r,
|
|
75
|
-
gap:
|
|
79
|
+
gap: s,
|
|
76
80
|
expand: m
|
|
77
81
|
})
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
//#endregion
|
|
81
|
-
export {
|
|
85
|
+
export { _ as Toaster };
|
package/dist/tooltip.js
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './tooltip.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/portal-container.js";
|
|
4
|
+
import { forwardRef as t, useId as n, useState as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { Tooltip as o } from "@base-ui/react/tooltip";
|
|
6
7
|
//#region src/stories/atoms/Tooltip/Tooltip.tsx
|
|
7
|
-
function
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
function s({ children: e, delayDuration: t = 0, skipDelayDuration: n }) {
|
|
9
|
+
return /* @__PURE__ */ i(o.Provider, {
|
|
9
10
|
delay: t,
|
|
10
11
|
...n === void 0 ? {} : { timeout: n },
|
|
11
12
|
children: e
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function c(e, t) {
|
|
15
16
|
let n = parseFloat(e);
|
|
16
17
|
return Number.isNaN(n) ? 0 : e.endsWith("rem") ? n * parseFloat(getComputedStyle(document.documentElement).fontSize) : e.endsWith("em") ? n * parseFloat(getComputedStyle(t).fontSize) : n;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function l() {
|
|
19
20
|
let e = document.documentElement;
|
|
20
|
-
return
|
|
21
|
+
return c(getComputedStyle(e).getPropertyValue("--tooltip-offset").trim(), e);
|
|
21
22
|
}
|
|
22
|
-
var
|
|
23
|
-
let
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
open:
|
|
26
|
-
defaultOpen:
|
|
23
|
+
var u = t(function({ label: t, children: s, side: c = "top", align: u = "center", sideOffset: d, open: f, defaultOpen: p, onOpenChange: m, delayDuration: h, describe: g = !0, container: _, className: v, ...y }, b) {
|
|
24
|
+
let x = e(_), S = n(), [C, w] = r(p ?? !1), T = f ?? C;
|
|
25
|
+
return /* @__PURE__ */ a(o.Root, {
|
|
26
|
+
open: f,
|
|
27
|
+
defaultOpen: p,
|
|
27
28
|
onOpenChange: (e) => {
|
|
28
|
-
|
|
29
|
+
f === void 0 && w(e), m?.(e);
|
|
29
30
|
},
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
ref:
|
|
32
|
-
render:
|
|
33
|
-
"aria-describedby":
|
|
34
|
-
...
|
|
35
|
-
...
|
|
36
|
-
}), /* @__PURE__ */
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
className: "
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
31
|
+
children: [/* @__PURE__ */ i(o.Trigger, {
|
|
32
|
+
ref: b,
|
|
33
|
+
render: s,
|
|
34
|
+
"aria-describedby": T && g ? S : void 0,
|
|
35
|
+
...h === void 0 ? {} : { delay: h },
|
|
36
|
+
...y
|
|
37
|
+
}), /* @__PURE__ */ i(o.Portal, {
|
|
38
|
+
container: x,
|
|
39
|
+
children: /* @__PURE__ */ i(o.Positioner, {
|
|
40
|
+
className: "tooltip__positioner",
|
|
41
|
+
side: c,
|
|
42
|
+
align: u,
|
|
43
|
+
sideOffset: d ?? l,
|
|
44
|
+
children: /* @__PURE__ */ a(o.Popup, {
|
|
45
|
+
id: S,
|
|
46
|
+
role: "tooltip",
|
|
47
|
+
className: ["tooltip", v].filter(Boolean).join(" "),
|
|
48
|
+
children: [t, /* @__PURE__ */ i(o.Arrow, {
|
|
49
|
+
className: "tooltip__arrow",
|
|
50
|
+
children: /* @__PURE__ */ i("svg", {
|
|
51
|
+
width: "10",
|
|
52
|
+
height: "5",
|
|
53
|
+
viewBox: "0 0 30 10",
|
|
54
|
+
preserveAspectRatio: "none",
|
|
55
|
+
children: /* @__PURE__ */ i("polygon", { points: "0,0 30,0 15,10" })
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
55
59
|
})
|
|
56
|
-
})
|
|
60
|
+
})]
|
|
57
61
|
});
|
|
58
62
|
});
|
|
59
63
|
//#endregion
|
|
60
|
-
export {
|
|
64
|
+
export { u as Tooltip, s as TooltipProvider };
|
package/dist/user-menu.js
CHANGED
|
@@ -1,85 +1,91 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './user-menu.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Icon as t } from "./icon.js";
|
|
5
|
+
import { n } from "./_shared/portal-container.js";
|
|
6
|
+
import { Avatar as r } from "./avatar.js";
|
|
7
|
+
import { NumberBadge as i } from "./number-badge.js";
|
|
8
|
+
import { n as a } from "./_shared/dropdownitems.js";
|
|
9
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
import { Menu as l } from "@base-ui/react/menu";
|
|
9
11
|
//#region src/stories/molecules/UserMenu/UserMenu.tsx
|
|
10
|
-
function
|
|
12
|
+
function u(e) {
|
|
11
13
|
let t = parseFloat(e);
|
|
12
14
|
return Number.isNaN(t) ? 0 : e.endsWith("rem") ? t * parseFloat(getComputedStyle(document.documentElement).fontSize) : t;
|
|
13
15
|
}
|
|
14
|
-
function
|
|
16
|
+
function d() {
|
|
15
17
|
let e = document.documentElement;
|
|
16
|
-
return
|
|
18
|
+
return u(getComputedStyle(e).getPropertyValue("--user-menu-offset").trim());
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
function f({ children: e, ...t }) {
|
|
21
|
+
return /* @__PURE__ */ s("a", {
|
|
20
22
|
...t,
|
|
21
23
|
children: e
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
function
|
|
26
|
+
function p(e) {
|
|
25
27
|
return ["user-menu__item", e ? "user-menu__item--destructive" : ""].filter(Boolean).join(" ");
|
|
26
28
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
29
|
+
function m({ name: u, email: m, avatarUrl: h, notificationCount: g, items: _ = [], label: v, compact: y = !1, renderLink: b = f, onOpenChange: x, defaultOpen: S }) {
|
|
30
|
+
let C = e("userMenu"), w = n(void 0);
|
|
31
|
+
return /* @__PURE__ */ c(l.Root, {
|
|
32
|
+
onOpenChange: (e) => x?.(e),
|
|
33
|
+
defaultOpen: S,
|
|
34
|
+
children: [/* @__PURE__ */ c(l.Trigger, {
|
|
35
|
+
className: ["user-menu__trigger", y ? "user-menu__trigger--compact" : ""].filter(Boolean).join(" "),
|
|
36
|
+
"aria-label": v ?? C("trigger")(u),
|
|
34
37
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ c("span", {
|
|
36
39
|
className: "user-menu__avatar-wrap",
|
|
37
|
-
children: [/* @__PURE__ */
|
|
38
|
-
src:
|
|
39
|
-
name:
|
|
40
|
+
children: [/* @__PURE__ */ s(r, {
|
|
41
|
+
src: h,
|
|
42
|
+
name: u,
|
|
40
43
|
alt: "",
|
|
41
44
|
size: "sm"
|
|
42
|
-
}), !!
|
|
43
|
-
count:
|
|
45
|
+
}), !!g && g > 0 && /* @__PURE__ */ s(i, {
|
|
46
|
+
count: g,
|
|
44
47
|
variant: "danger",
|
|
45
|
-
"aria-label":
|
|
48
|
+
"aria-label": C("unread")(g),
|
|
46
49
|
className: "user-menu__notification-badge"
|
|
47
50
|
})]
|
|
48
51
|
}),
|
|
49
|
-
!
|
|
52
|
+
!y && /* @__PURE__ */ s("span", {
|
|
50
53
|
className: "user-menu__name",
|
|
51
|
-
children:
|
|
54
|
+
children: u
|
|
52
55
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ s(t, {
|
|
54
57
|
name: "chevron",
|
|
55
58
|
size: "sm",
|
|
56
59
|
className: "user-menu__chevron"
|
|
57
60
|
})
|
|
58
61
|
]
|
|
59
|
-
}), /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
children:
|
|
66
|
-
className: "user-
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
-
className: "user-menu__header
|
|
69
|
-
children:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
}), /* @__PURE__ */ s(l.Portal, {
|
|
63
|
+
container: w,
|
|
64
|
+
children: /* @__PURE__ */ s(l.Positioner, {
|
|
65
|
+
className: "user-menu__positioner",
|
|
66
|
+
sideOffset: d,
|
|
67
|
+
align: "start",
|
|
68
|
+
children: /* @__PURE__ */ c(l.Popup, {
|
|
69
|
+
className: "user-menu__content",
|
|
70
|
+
children: [/* @__PURE__ */ c("div", {
|
|
71
|
+
className: "user-menu__header",
|
|
72
|
+
children: [/* @__PURE__ */ s("span", {
|
|
73
|
+
className: "user-menu__header-name",
|
|
74
|
+
children: u
|
|
75
|
+
}), /* @__PURE__ */ s("span", {
|
|
76
|
+
className: "user-menu__header-email",
|
|
77
|
+
children: m
|
|
78
|
+
})]
|
|
79
|
+
}), _.length > 0 && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(l.Separator, { className: "user-menu__separator" }), a({
|
|
80
|
+
items: _,
|
|
81
|
+
itemClass: p,
|
|
82
|
+
separatorClass: "user-menu__separator",
|
|
83
|
+
renderLink: b
|
|
84
|
+
})] })]
|
|
85
|
+
})
|
|
80
86
|
})
|
|
81
|
-
})
|
|
87
|
+
})]
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
90
|
//#endregion
|
|
85
|
-
export {
|
|
91
|
+
export { m as UserMenu };
|