@naeil/ui 0.9.0 → 0.10.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 +7 -0
- package/dist/{chunk-XRO3NJAB.js → chunk-F7XM5HJ4.js} +40 -154
- package/dist/{chunk-JDHGKM25.js → chunk-GQO6NMXK.js} +267 -2
- package/dist/components/index.js +12 -3
- package/dist/components/naeil-footer.d.ts +3 -3
- package/dist/components/naeil-footer.js +14 -11
- package/dist/components/naeil-header.d.ts +7 -9
- package/dist/components/naeil-header.js +2 -2
- package/dist/lib/ui-release.d.ts +1 -1
- package/dist/lib/ui-release.js +1 -1
- package/dist/naeil-locale/checker.d.ts +16 -0
- package/dist/naeil-locale/checker.js +91 -0
- package/dist/naeil-locale/chrome.d.ts +150 -0
- package/dist/naeil-locale/chrome.js +2385 -0
- package/dist/naeil-locale/chunk-D37JHNUN.js +56 -0
- package/dist/naeil-locale/chunk-N3ETBM74.js +24 -0
- package/dist/naeil-locale/chunk-QWHIELL2.js +161 -0
- package/dist/naeil-locale/chunk-YQ5OJWBF.js +53 -0
- package/dist/naeil-locale/client.d.ts +70 -0
- package/dist/naeil-locale/client.js +382 -0
- package/dist/naeil-locale/en-ZC66VDHP.js +86 -0
- package/dist/naeil-locale/index.d.ts +40 -0
- package/dist/naeil-locale/index.js +111 -0
- package/dist/naeil-locale/ja-DKIEQUG7.js +86 -0
- package/dist/naeil-locale/ko-CY6663RZ.js +86 -0
- package/dist/naeil-locale/messages-BQ-fnCAJ.d.ts +166 -0
- package/dist/naeil-locale/messages.d.ts +1 -0
- package/dist/naeil-locale/messages.js +14 -0
- package/dist/naeil-locale/server.d.ts +75 -0
- package/dist/naeil-locale/server.js +172 -0
- package/dist/source/components/naeil-footer-core.d.ts +16 -0
- package/dist/source/components/naeil-footer-core.js +93 -0
- package/dist/source/components/naeil-footer.d.ts +6 -11
- package/dist/source/components/naeil-footer.js +4 -75
- package/dist/source/components/naeil-header-account-core.d.ts +26 -0
- package/dist/source/components/naeil-header-account-core.js +98 -0
- package/dist/source/components/naeil-header-account.d.ts +6 -22
- package/dist/source/components/naeil-header-account.js +5 -81
- package/dist/source/components/naeil-header-content.d.ts +102 -109
- package/dist/source/components/naeil-header-content.js +6 -142
- package/dist/source/components/naeil-header-core.d.ts +59 -0
- package/dist/source/components/naeil-header-core.js +231 -0
- package/dist/source/components/naeil-header-data.d.ts +11 -0
- package/dist/source/components/naeil-header-data.js +14 -0
- package/dist/source/components/naeil-header.d.ts +10 -51
- package/dist/source/components/naeil-header.js +9 -200
- package/dist/source/components/naeil-messages-context.d.ts +94 -0
- package/dist/source/components/naeil-messages-context.js +16 -0
- package/dist/source/components/naeil-standalone-messages.d.ts +11 -0
- package/dist/source/components/naeil-standalone-messages.js +13 -0
- package/dist/source/i18n/routing.d.ts +22 -20
- package/dist/source/lib/ui-release.d.ts +1 -1
- package/dist/source/lib/ui-release.js +1 -1
- package/dist/source/naeil-locale/messages/en.json +78 -0
- package/dist/source/naeil-locale/messages/ja.json +78 -0
- package/dist/source/naeil-locale/messages/ko.json +78 -0
- package/docs/components/naeil-locale.md +46 -0
- package/docs/package-release.md +11 -0
- package/package.json +34 -6
- /package/dist/{naeil-header-content-BvISJ4RV.d.ts → naeil-header-data-BvISJ4RV.d.ts} +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
import { jsx } from "react/jsx-runtime";
|
|
34
|
+
import { useNaeilMessages } from "./naeil-messages-context.js";
|
|
35
|
+
import { Logo } from "./logo.js";
|
|
36
|
+
import { SiteFooter } from "./ui/site-footer.js";
|
|
37
|
+
import { uiRelease } from "../lib/ui-release.js";
|
|
38
|
+
const NativeLink = (props) => /* @__PURE__ */ jsx("a", __spreadValues({}, props));
|
|
39
|
+
function NaeilFooter(_a) {
|
|
40
|
+
var _b = _a, {
|
|
41
|
+
locale,
|
|
42
|
+
resolveHref = (path) => `https://naeil.dev/${locale}${path === "/" ? "" : path}`,
|
|
43
|
+
variant = "full",
|
|
44
|
+
Link = NativeLink,
|
|
45
|
+
onNavigate
|
|
46
|
+
} = _b, props = __objRest(_b, [
|
|
47
|
+
"locale",
|
|
48
|
+
"resolveHref",
|
|
49
|
+
"variant",
|
|
50
|
+
"Link",
|
|
51
|
+
"onNavigate"
|
|
52
|
+
]);
|
|
53
|
+
const copy = useNaeilMessages(locale).footer;
|
|
54
|
+
const home = { id: "brand", label: ".naeil", href: resolveHref("/") };
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
SiteFooter,
|
|
57
|
+
__spreadProps(__spreadValues({}, props), {
|
|
58
|
+
variant,
|
|
59
|
+
Link,
|
|
60
|
+
onNavigate,
|
|
61
|
+
"data-naeil-footer": true,
|
|
62
|
+
"data-naeil-chrome": "",
|
|
63
|
+
lang: locale,
|
|
64
|
+
"data-naeil-ui-version": uiRelease.version,
|
|
65
|
+
"data-naeil-ui-contract": uiRelease.contractVersion,
|
|
66
|
+
brand: /* @__PURE__ */ jsx(
|
|
67
|
+
Link,
|
|
68
|
+
{
|
|
69
|
+
href: home.href,
|
|
70
|
+
"aria-label": ".naeil",
|
|
71
|
+
"data-footer-brand": true,
|
|
72
|
+
className: "ui-focus inline-flex min-h-11 items-center",
|
|
73
|
+
onClick: (event) => onNavigate == null ? void 0 : onNavigate(event, home),
|
|
74
|
+
children: /* @__PURE__ */ jsx(Logo, { variant: "footer", size: 20, label: null })
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
description: variant === "full" ? copy.description : void 0,
|
|
78
|
+
groups: [
|
|
79
|
+
{ id: "navigation", label: copy.navigation, links: [
|
|
80
|
+
{ id: "projects", label: copy.projects, href: resolveHref("/projects") },
|
|
81
|
+
{ id: "blog", label: copy.blog, href: resolveHref("/blog") }
|
|
82
|
+
] },
|
|
83
|
+
{ id: "social", label: copy.social, links: [
|
|
84
|
+
// All canonical destinations use the consumer Link, including this absolute URL.
|
|
85
|
+
{ id: "github", label: "GitHub", href: "https://github.com/naeil-dev", target: "_blank" }
|
|
86
|
+
] }
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
NaeilFooter
|
|
93
|
+
};
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { NaeilFooterProps } from './naeil-footer-core.js';
|
|
3
|
+
export { NaeilFooterLocale } from './naeil-footer-core.js';
|
|
4
|
+
import './ui/site-footer.js';
|
|
4
5
|
import 'react';
|
|
5
6
|
import './ui/navigation.js';
|
|
7
|
+
import './naeil-header-data.js';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
interface NaeilFooterProps extends Omit<SiteFooterProps, "brand" | "description" | "groups"> {
|
|
9
|
-
locale: NaeilFooterLocale;
|
|
10
|
-
/** Only localize/route canonical paths; default destinations use the official origin. */
|
|
11
|
-
resolveHref?: (path: string) => string;
|
|
12
|
-
}
|
|
13
|
-
/** Canonical content in full/compact density. Product legal/status copy belongs in meta. */
|
|
14
|
-
declare function NaeilFooter({ locale, resolveHref, variant, Link, onNavigate, ...props }: NaeilFooterProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function NaeilFooter(props: NaeilFooterProps): react_jsx_runtime.JSX.Element;
|
|
15
10
|
|
|
16
|
-
export { NaeilFooter,
|
|
11
|
+
export { NaeilFooter, NaeilFooterProps };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,80 +15,11 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
18
|
import { jsx } from "react/jsx-runtime";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
en: { navigation: "Navigation", projects: "Projects", blog: "Blog", social: "Social" },
|
|
39
|
-
ko: { navigation: "\uB124\uBE44\uAC8C\uC774\uC158", projects: "\uD504\uB85C\uC81D\uD2B8", blog: "\uBE14\uB85C\uADF8", social: "\uC18C\uC15C" },
|
|
40
|
-
ja: { navigation: "\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3", projects: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8", blog: "\u30D6\u30ED\u30B0", social: "\u30BD\u30FC\u30B7\u30E3\u30EB" }
|
|
41
|
-
};
|
|
42
|
-
const NativeLink = (props) => /* @__PURE__ */ jsx("a", __spreadValues({}, props));
|
|
43
|
-
function NaeilFooter(_a) {
|
|
44
|
-
var _b = _a, {
|
|
45
|
-
locale,
|
|
46
|
-
resolveHref = (path) => `https://naeil.dev/${locale}${path === "/" ? "" : path}`,
|
|
47
|
-
variant = "full",
|
|
48
|
-
Link = NativeLink,
|
|
49
|
-
onNavigate
|
|
50
|
-
} = _b, props = __objRest(_b, [
|
|
51
|
-
"locale",
|
|
52
|
-
"resolveHref",
|
|
53
|
-
"variant",
|
|
54
|
-
"Link",
|
|
55
|
-
"onNavigate"
|
|
56
|
-
]);
|
|
57
|
-
const copy = content[locale];
|
|
58
|
-
const home = { id: "brand", label: ".naeil", href: resolveHref("/") };
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
-
SiteFooter,
|
|
61
|
-
__spreadProps(__spreadValues({}, props), {
|
|
62
|
-
variant,
|
|
63
|
-
Link,
|
|
64
|
-
onNavigate,
|
|
65
|
-
"data-naeil-footer": true,
|
|
66
|
-
"data-naeil-chrome": "",
|
|
67
|
-
lang: locale,
|
|
68
|
-
"data-naeil-ui-version": uiRelease.version,
|
|
69
|
-
"data-naeil-ui-contract": uiRelease.contractVersion,
|
|
70
|
-
brand: /* @__PURE__ */ jsx(
|
|
71
|
-
Link,
|
|
72
|
-
{
|
|
73
|
-
href: home.href,
|
|
74
|
-
"aria-label": ".naeil",
|
|
75
|
-
"data-footer-brand": true,
|
|
76
|
-
className: "ui-focus inline-flex min-h-11 items-center",
|
|
77
|
-
onClick: (event) => onNavigate == null ? void 0 : onNavigate(event, home),
|
|
78
|
-
children: /* @__PURE__ */ jsx(Logo, { variant: "footer", size: 20, label: null })
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
description: variant === "full" ? "Tomorrow starts here." : void 0,
|
|
82
|
-
groups: [
|
|
83
|
-
{ id: "navigation", label: copy.navigation, links: [
|
|
84
|
-
{ id: "projects", label: copy.projects, href: resolveHref("/projects") },
|
|
85
|
-
{ id: "blog", label: copy.blog, href: resolveHref("/blog") }
|
|
86
|
-
] },
|
|
87
|
-
{ id: "social", label: copy.social, links: [
|
|
88
|
-
// All canonical destinations use the consumer Link, including this absolute URL.
|
|
89
|
-
{ id: "github", label: "GitHub", href: "https://github.com/naeil-dev", target: "_blank" }
|
|
90
|
-
] }
|
|
91
|
-
]
|
|
92
|
-
})
|
|
93
|
-
);
|
|
19
|
+
import { NaeilFooter as Footer } from "./naeil-footer-core.js";
|
|
20
|
+
import { NaeilStandaloneMessages } from "./naeil-standalone-messages.js";
|
|
21
|
+
function NaeilFooter(props) {
|
|
22
|
+
return /* @__PURE__ */ jsx(NaeilStandaloneMessages, { locale: props.locale, children: /* @__PURE__ */ jsx(Footer, __spreadValues({}, props)) });
|
|
94
23
|
}
|
|
95
24
|
export {
|
|
96
25
|
NaeilFooter
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NavigationLinkComponent } from './ui/navigation.js';
|
|
3
|
+
import { NaeilHeaderLocale } from './naeil-header-data.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
type NaeilHeaderAccount = {
|
|
7
|
+
status: "signed-out";
|
|
8
|
+
loginHref: string;
|
|
9
|
+
} | {
|
|
10
|
+
status: "signed-in";
|
|
11
|
+
/** Consumer starts its guarded session action and owns failures/navigation. */
|
|
12
|
+
onLogout: () => void;
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
displayName?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
};
|
|
17
|
+
interface NaeilHeaderAccountControlProps {
|
|
18
|
+
locale: NaeilHeaderLocale;
|
|
19
|
+
account: NaeilHeaderAccount;
|
|
20
|
+
/** The same route/save adapter used by the rest of the application header. */
|
|
21
|
+
Link?: NavigationLinkComponent;
|
|
22
|
+
}
|
|
23
|
+
/** Shared account presentation only: never reads sessions or calls an auth API. */
|
|
24
|
+
declare function NaeilHeaderAccountControl({ locale, account, Link }: NaeilHeaderAccountControlProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { type NaeilHeaderAccount, NaeilHeaderAccountControl, type NaeilHeaderAccountControlProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { useNaeilMessages } from "./naeil-messages-context.js";
|
|
23
|
+
import { UserRound } from "lucide-react";
|
|
24
|
+
import { useContext, useRef } from "react";
|
|
25
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuItem } from "./ui/dropdown-menu.js";
|
|
26
|
+
import { NavigationSheetAction } from "./ui/navigation.js";
|
|
27
|
+
const NativeLink = (props) => /* @__PURE__ */ jsx("a", __spreadValues({}, props));
|
|
28
|
+
function NaeilHeaderAccountControl({ locale, account, Link = NativeLink }) {
|
|
29
|
+
const text = useNaeilMessages(locale).account;
|
|
30
|
+
const handoff = useContext(NavigationSheetAction);
|
|
31
|
+
const pendingAction = useRef(void 0);
|
|
32
|
+
if (account.status === "signed-out") {
|
|
33
|
+
return /* @__PURE__ */ jsx(Link, { href: account.loginHref, className: "ui-navigation-link ui-focus naeil-header-login", "data-naeil-account-state": "signed-out", children: text.login });
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { onOpenChange: (open) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (open) {
|
|
38
|
+
(_a = pendingAction.current) == null ? void 0 : _a.cancel();
|
|
39
|
+
pendingAction.current = void 0;
|
|
40
|
+
}
|
|
41
|
+
}, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
className: "ui-focus naeil-header-account-trigger",
|
|
47
|
+
"data-naeil-account-trigger": true,
|
|
48
|
+
"data-naeil-account-state": "signed-in",
|
|
49
|
+
"aria-label": text.menu,
|
|
50
|
+
"aria-busy": account.busy || void 0,
|
|
51
|
+
children: /* @__PURE__ */ jsx("span", { className: "naeil-header-account-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx(UserRound, {}) })
|
|
52
|
+
}
|
|
53
|
+
) }),
|
|
54
|
+
/* @__PURE__ */ jsxs(
|
|
55
|
+
DropdownMenuContent,
|
|
56
|
+
{
|
|
57
|
+
align: "end",
|
|
58
|
+
className: "w-56 max-w-[calc(100vw-2rem)]",
|
|
59
|
+
"data-naeil-account-menu": true,
|
|
60
|
+
"data-naeil-chrome": "",
|
|
61
|
+
lang: locale,
|
|
62
|
+
onCloseAutoFocus: (event) => {
|
|
63
|
+
const flow = pendingAction.current;
|
|
64
|
+
if (!flow || event.target !== flow.menu) return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
flow.menu = null;
|
|
67
|
+
flow.menuClosed();
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "flex min-w-0 flex-col font-normal", children: [
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-base font-medium", children: account.displayName || text.account }),
|
|
72
|
+
account.email && /* @__PURE__ */ jsx("span", { className: "truncate text-sm text-muted-foreground", children: account.email })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
DropdownMenuItem,
|
|
77
|
+
{
|
|
78
|
+
className: "min-h-11",
|
|
79
|
+
disabled: account.busy,
|
|
80
|
+
onSelect: (event) => {
|
|
81
|
+
if (account.busy) return;
|
|
82
|
+
if (handoff) {
|
|
83
|
+
const menu = event.target.closest("[data-naeil-account-menu]");
|
|
84
|
+
if (!(menu == null ? void 0 : menu.isConnected)) return;
|
|
85
|
+
pendingAction.current = __spreadProps(__spreadValues({}, handoff(account.onLogout)), { menu });
|
|
86
|
+
} else account.onLogout();
|
|
87
|
+
},
|
|
88
|
+
children: account.busy ? text.busy : text.logout
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
NaeilHeaderAccountControl
|
|
98
|
+
};
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { NaeilHeaderAccountControlProps } from './naeil-header-account-core.js';
|
|
3
|
+
export { NaeilHeaderAccount } from './naeil-header-account-core.js';
|
|
4
|
+
import './ui/navigation.js';
|
|
4
5
|
import 'react';
|
|
6
|
+
import './naeil-header-data.js';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
status: "signed-out";
|
|
8
|
-
loginHref: string;
|
|
9
|
-
} | {
|
|
10
|
-
status: "signed-in";
|
|
11
|
-
/** Consumer starts its guarded session action and owns failures/navigation. */
|
|
12
|
-
onLogout: () => void;
|
|
13
|
-
busy?: boolean;
|
|
14
|
-
displayName?: string;
|
|
15
|
-
email?: string;
|
|
16
|
-
};
|
|
17
|
-
interface NaeilHeaderAccountControlProps {
|
|
18
|
-
locale: NaeilHeaderLocale;
|
|
19
|
-
account: NaeilHeaderAccount;
|
|
20
|
-
/** The same route/save adapter used by the rest of the application header. */
|
|
21
|
-
Link?: NavigationLinkComponent;
|
|
22
|
-
}
|
|
23
|
-
/** Shared account presentation only: never reads sessions or calls an auth API. */
|
|
24
|
-
declare function NaeilHeaderAccountControl({ locale, account, Link }: NaeilHeaderAccountControlProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function NaeilHeaderAccountControl(props: NaeilHeaderAccountControlProps): react_jsx_runtime.JSX.Element;
|
|
25
9
|
|
|
26
|
-
export {
|
|
10
|
+
export { NaeilHeaderAccountControl, NaeilHeaderAccountControlProps };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,85 +15,11 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import { NavigationSheetAction } from "./ui/navigation.js";
|
|
26
|
-
const labels = {
|
|
27
|
-
en: { menu: "Account menu", account: "Account", login: "Log in", logout: "Log out", busy: "Logging out\u2026" },
|
|
28
|
-
ko: { menu: "\uACC4\uC815 \uBA54\uB274", account: "\uACC4\uC815", login: "\uB85C\uADF8\uC778", logout: "\uB85C\uADF8\uC544\uC6C3", busy: "\uB85C\uADF8\uC544\uC6C3 \uC911\u2026" },
|
|
29
|
-
ja: { menu: "\u30A2\u30AB\u30A6\u30F3\u30C8\u30E1\u30CB\u30E5\u30FC", account: "\u30A2\u30AB\u30A6\u30F3\u30C8", login: "\u30ED\u30B0\u30A4\u30F3", logout: "\u30ED\u30B0\u30A2\u30A6\u30C8", busy: "\u30ED\u30B0\u30A2\u30A6\u30C8\u4E2D\u2026" }
|
|
30
|
-
};
|
|
31
|
-
const NativeLink = (props) => /* @__PURE__ */ jsx("a", __spreadValues({}, props));
|
|
32
|
-
function NaeilHeaderAccountControl({ locale, account, Link = NativeLink }) {
|
|
33
|
-
const text = labels[locale];
|
|
34
|
-
const handoff = useContext(NavigationSheetAction);
|
|
35
|
-
const pendingAction = useRef(void 0);
|
|
36
|
-
if (account.status === "signed-out") {
|
|
37
|
-
return /* @__PURE__ */ jsx(Link, { href: account.loginHref, className: "ui-navigation-link ui-focus naeil-header-login", "data-naeil-account-state": "signed-out", children: text.login });
|
|
38
|
-
}
|
|
39
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { onOpenChange: (open) => {
|
|
40
|
-
var _a;
|
|
41
|
-
if (open) {
|
|
42
|
-
(_a = pendingAction.current) == null ? void 0 : _a.cancel();
|
|
43
|
-
pendingAction.current = void 0;
|
|
44
|
-
}
|
|
45
|
-
}, children: [
|
|
46
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
47
|
-
"button",
|
|
48
|
-
{
|
|
49
|
-
type: "button",
|
|
50
|
-
className: "ui-focus naeil-header-account-trigger",
|
|
51
|
-
"data-naeil-account-trigger": true,
|
|
52
|
-
"data-naeil-account-state": "signed-in",
|
|
53
|
-
"aria-label": text.menu,
|
|
54
|
-
"aria-busy": account.busy || void 0,
|
|
55
|
-
children: /* @__PURE__ */ jsx("span", { className: "naeil-header-account-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx(UserRound, {}) })
|
|
56
|
-
}
|
|
57
|
-
) }),
|
|
58
|
-
/* @__PURE__ */ jsxs(
|
|
59
|
-
DropdownMenuContent,
|
|
60
|
-
{
|
|
61
|
-
align: "end",
|
|
62
|
-
className: "w-56 max-w-[calc(100vw-2rem)]",
|
|
63
|
-
"data-naeil-account-menu": true,
|
|
64
|
-
"data-naeil-chrome": "",
|
|
65
|
-
lang: locale,
|
|
66
|
-
onCloseAutoFocus: (event) => {
|
|
67
|
-
const flow = pendingAction.current;
|
|
68
|
-
if (!flow || event.target !== flow.menu) return;
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
flow.menu = null;
|
|
71
|
-
flow.menuClosed();
|
|
72
|
-
},
|
|
73
|
-
children: [
|
|
74
|
-
/* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "flex min-w-0 flex-col font-normal", children: [
|
|
75
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-base font-medium", children: account.displayName || text.account }),
|
|
76
|
-
account.email && /* @__PURE__ */ jsx("span", { className: "truncate text-sm text-muted-foreground", children: account.email })
|
|
77
|
-
] }),
|
|
78
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
79
|
-
/* @__PURE__ */ jsx(
|
|
80
|
-
DropdownMenuItem,
|
|
81
|
-
{
|
|
82
|
-
className: "min-h-11",
|
|
83
|
-
disabled: account.busy,
|
|
84
|
-
onSelect: (event) => {
|
|
85
|
-
if (account.busy) return;
|
|
86
|
-
if (handoff) {
|
|
87
|
-
const menu = event.target.closest("[data-naeil-account-menu]");
|
|
88
|
-
if (!(menu == null ? void 0 : menu.isConnected)) return;
|
|
89
|
-
pendingAction.current = __spreadProps(__spreadValues({}, handoff(account.onLogout)), { menu });
|
|
90
|
-
} else account.onLogout();
|
|
91
|
-
},
|
|
92
|
-
children: account.busy ? text.busy : text.logout
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
] });
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
import { NaeilHeaderAccountControl as AccountControl } from "./naeil-header-account-core.js";
|
|
20
|
+
import { NaeilStandaloneMessages } from "./naeil-standalone-messages.js";
|
|
21
|
+
function NaeilHeaderAccountControl(props) {
|
|
22
|
+
return /* @__PURE__ */ jsx(NaeilStandaloneMessages, { locale: props.locale, children: /* @__PURE__ */ jsx(AccountControl, __spreadValues({}, props)) });
|
|
99
23
|
}
|
|
100
24
|
export {
|
|
101
25
|
NaeilHeaderAccountControl
|