@aiquants/menu-bar 1.9.0 → 1.11.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/dist/index.es.js +91 -91
- package/dist/index.umd.js +2 -2
- package/package.json +3 -6
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import ie, { useState as
|
|
2
|
-
import { Link as ue, Lock as de, Download as fe, BarChart as me, Table as xe, FileText as
|
|
3
|
-
import { Link as
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
import ie, { useState as G, useCallback as g, useMemo as ce, useRef as E, useEffect as J } from "react";
|
|
2
|
+
import { Link as ue, Lock as de, Download as fe, BarChart as me, Table as xe, FileText as W } from "lucide-react";
|
|
3
|
+
import { Link as B } from "react-router-dom";
|
|
4
|
+
var C = { exports: {} }, _ = {};
|
|
5
|
+
var H;
|
|
6
6
|
function he() {
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
var t = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
|
|
7
|
+
if (H) return _;
|
|
8
|
+
H = 1;
|
|
9
|
+
var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10
10
|
function a(f, i, c) {
|
|
11
11
|
var u = null;
|
|
12
12
|
if (c !== void 0 && (u = "" + c), i.key !== void 0 && (u = "" + i.key), "key" in i) {
|
|
@@ -22,9 +22,9 @@ function he() {
|
|
|
22
22
|
props: c
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return _.Fragment = o, _.jsx = a, _.jsxs = a, _;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
27
|
+
var T = {};
|
|
28
28
|
var V;
|
|
29
29
|
function pe() {
|
|
30
30
|
return V || (V = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
@@ -34,11 +34,11 @@ function pe() {
|
|
|
34
34
|
return e.$$typeof === oe ? null : e.displayName || e.name || null;
|
|
35
35
|
if (typeof e == "string") return e;
|
|
36
36
|
switch (e) {
|
|
37
|
-
case
|
|
37
|
+
case N:
|
|
38
38
|
return "Fragment";
|
|
39
|
-
case
|
|
39
|
+
case y:
|
|
40
40
|
return "Profiler";
|
|
41
|
-
case
|
|
41
|
+
case O:
|
|
42
42
|
return "StrictMode";
|
|
43
43
|
case re:
|
|
44
44
|
return "Suspense";
|
|
@@ -55,7 +55,7 @@ function pe() {
|
|
|
55
55
|
return "Portal";
|
|
56
56
|
case K:
|
|
57
57
|
return e.displayName || "Context";
|
|
58
|
-
case
|
|
58
|
+
case X:
|
|
59
59
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
60
60
|
case ee:
|
|
61
61
|
var n = e.render;
|
|
@@ -92,7 +92,7 @@ function pe() {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
function f(e) {
|
|
95
|
-
if (e ===
|
|
95
|
+
if (e === N) return "<>";
|
|
96
96
|
if (typeof e == "object" && e !== null && e.$$typeof === A)
|
|
97
97
|
return "<...>";
|
|
98
98
|
try {
|
|
@@ -103,14 +103,14 @@ function pe() {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function i() {
|
|
106
|
-
var e =
|
|
106
|
+
var e = M.A;
|
|
107
107
|
return e === null ? null : e.getOwner();
|
|
108
108
|
}
|
|
109
109
|
function c() {
|
|
110
110
|
return Error("react-stack-top-frame");
|
|
111
111
|
}
|
|
112
112
|
function u(e) {
|
|
113
|
-
if (
|
|
113
|
+
if (q.call(e, "key")) {
|
|
114
114
|
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
115
115
|
if (n && n.isReactWarning) return !1;
|
|
116
116
|
}
|
|
@@ -134,10 +134,10 @@ function pe() {
|
|
|
134
134
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
135
135
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
136
136
|
}
|
|
137
|
-
function p(e, n, d, m,
|
|
137
|
+
function p(e, n, d, m, R, P) {
|
|
138
138
|
var x = d.ref;
|
|
139
139
|
return e = {
|
|
140
|
-
$$typeof:
|
|
140
|
+
$$typeof: j,
|
|
141
141
|
type: e,
|
|
142
142
|
key: n,
|
|
143
143
|
props: d,
|
|
@@ -159,15 +159,15 @@ function pe() {
|
|
|
159
159
|
configurable: !1,
|
|
160
160
|
enumerable: !1,
|
|
161
161
|
writable: !0,
|
|
162
|
-
value:
|
|
162
|
+
value: R
|
|
163
163
|
}), Object.defineProperty(e, "_debugTask", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
writable: !0,
|
|
167
|
-
value:
|
|
167
|
+
value: P
|
|
168
168
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
169
169
|
}
|
|
170
|
-
function h(e, n, d, m,
|
|
170
|
+
function h(e, n, d, m, R, P) {
|
|
171
171
|
var x = n.children;
|
|
172
172
|
if (x !== void 0)
|
|
173
173
|
if (m)
|
|
@@ -180,12 +180,12 @@ function pe() {
|
|
|
180
180
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
181
181
|
);
|
|
182
182
|
else b(x);
|
|
183
|
-
if (
|
|
183
|
+
if (q.call(n, "key")) {
|
|
184
184
|
x = t(e);
|
|
185
|
-
var
|
|
185
|
+
var w = Object.keys(n).filter(function(le) {
|
|
186
186
|
return le !== "key";
|
|
187
187
|
});
|
|
188
|
-
m = 0 <
|
|
188
|
+
m = 0 < w.length ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}", U[x + m] || (w = 0 < w.length ? "{" + w.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
189
189
|
`A props object containing a "key" prop is being spread into JSX:
|
|
190
190
|
let props = %s;
|
|
191
191
|
<%s {...props} />
|
|
@@ -194,14 +194,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
194
194
|
<%s key={someKey} {...props} />`,
|
|
195
195
|
m,
|
|
196
196
|
x,
|
|
197
|
-
|
|
197
|
+
w,
|
|
198
198
|
x
|
|
199
|
-
),
|
|
199
|
+
), U[x + m] = !0);
|
|
200
200
|
}
|
|
201
201
|
if (x = null, d !== void 0 && (a(d), x = "" + d), u(n) && (a(n.key), x = "" + n.key), "key" in n) {
|
|
202
202
|
d = {};
|
|
203
|
-
for (var
|
|
204
|
-
|
|
203
|
+
for (var I in n)
|
|
204
|
+
I !== "key" && (d[I] = n[I]);
|
|
205
205
|
} else d = n;
|
|
206
206
|
return x && s(
|
|
207
207
|
d,
|
|
@@ -211,17 +211,17 @@ React keys must be passed directly to JSX without using spread:
|
|
|
211
211
|
x,
|
|
212
212
|
d,
|
|
213
213
|
i(),
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
R,
|
|
215
|
+
P
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
function b(e) {
|
|
219
|
-
|
|
219
|
+
k(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? k(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
221
|
+
function k(e) {
|
|
222
|
+
return typeof e == "object" && e !== null && e.$$typeof === j;
|
|
223
223
|
}
|
|
224
|
-
var v = ie,
|
|
224
|
+
var v = ie, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), N = /* @__PURE__ */ Symbol.for("react.fragment"), O = /* @__PURE__ */ Symbol.for("react.strict_mode"), y = /* @__PURE__ */ Symbol.for("react.profiler"), X = /* @__PURE__ */ Symbol.for("react.consumer"), K = /* @__PURE__ */ Symbol.for("react.context"), ee = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), te = /* @__PURE__ */ Symbol.for("react.suspense_list"), ne = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), se = /* @__PURE__ */ Symbol.for("react.activity"), oe = /* @__PURE__ */ Symbol.for("react.client.reference"), M = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, ae = Array.isArray, L = console.createTask ? console.createTask : function() {
|
|
225
225
|
return null;
|
|
226
226
|
};
|
|
227
227
|
v = {
|
|
@@ -232,40 +232,40 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
var Y, $ = {}, F = v.react_stack_bottom_frame.bind(
|
|
233
233
|
v,
|
|
234
234
|
c
|
|
235
|
-
)(),
|
|
236
|
-
|
|
237
|
-
var m = 1e4 >
|
|
235
|
+
)(), z = L(f(c)), U = {};
|
|
236
|
+
T.Fragment = N, T.jsx = function(e, n, d) {
|
|
237
|
+
var m = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
238
238
|
return h(
|
|
239
239
|
e,
|
|
240
240
|
n,
|
|
241
241
|
d,
|
|
242
242
|
!1,
|
|
243
243
|
m ? Error("react-stack-top-frame") : F,
|
|
244
|
-
m ?
|
|
244
|
+
m ? L(f(e)) : z
|
|
245
245
|
);
|
|
246
|
-
},
|
|
247
|
-
var m = 1e4 >
|
|
246
|
+
}, T.jsxs = function(e, n, d) {
|
|
247
|
+
var m = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
248
248
|
return h(
|
|
249
249
|
e,
|
|
250
250
|
n,
|
|
251
251
|
d,
|
|
252
252
|
!0,
|
|
253
253
|
m ? Error("react-stack-top-frame") : F,
|
|
254
|
-
m ?
|
|
254
|
+
m ? L(f(e)) : z
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
})()),
|
|
257
|
+
})()), T;
|
|
258
258
|
}
|
|
259
|
-
var
|
|
259
|
+
var Z;
|
|
260
260
|
function be() {
|
|
261
|
-
return
|
|
261
|
+
return Z || (Z = 1, process.env.NODE_ENV === "production" ? C.exports = he() : C.exports = pe()), C.exports;
|
|
262
262
|
}
|
|
263
263
|
var r = be();
|
|
264
|
-
const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a", { href: t, className: o, children: a }),
|
|
265
|
-
const { user: o, LinkComponent: a =
|
|
264
|
+
const ve = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iI2NiZDVlMSI+PHBhdGggZD0iTTEyIDEyYzIuMjEgMCA0LTEuNzkgNC00cy0xLjc5LTQtNC00LTQgMS43OS00IDQgMS43OSA0IDQgNHptMCAyYy0yLjY3IDAtOCAxLjM0LTggNHYyaDE2di0yYzAtMi42Ni01LjMzLTQtOC00eiIvPjwvc3ZnPg==", ge = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a", { href: t, className: o, children: a }), Se = (t) => {
|
|
265
|
+
const { user: o, LinkComponent: a = ge } = t;
|
|
266
266
|
return /* @__PURE__ */ r.jsx("div", { className: "max-h-20 max-w-52", children: /* @__PURE__ */ r.jsx("div", { className: "flex grow flex-col", children: o ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
267
267
|
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-row", children: [
|
|
268
|
-
/* @__PURE__ */ r.jsx("div", { className: "aiquants-session-photo m-1 h-14 w-14 p-0.5", children: /* @__PURE__ */ r.jsx("img", { className: "object-contain", src: o.photo, "aria-label": "profile photo" }) }),
|
|
268
|
+
/* @__PURE__ */ r.jsx("div", { className: "aiquants-session-photo m-1 h-14 w-14 p-0.5", children: /* @__PURE__ */ r.jsx("img", { className: "object-contain", src: o.photo || ve, "aria-label": "profile photo" }) }),
|
|
269
269
|
/* @__PURE__ */ r.jsxs("div", { className: "mx-1 flex flex-col", children: [
|
|
270
270
|
/* @__PURE__ */ r.jsx(a, { className: "aiquants-session-link my-1 rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィールを編集" }),
|
|
271
271
|
/* @__PURE__ */ r.jsx(a, { className: "aiquants-session-link rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィール" }),
|
|
@@ -274,21 +274,21 @@ const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a",
|
|
|
274
274
|
] }),
|
|
275
275
|
/* @__PURE__ */ r.jsx("div", { className: "aiquants-session-info mb-1 min-h-[1em] w-full rounded-r-lg px-2 py-0.5 text-xs", children: o.displayName })
|
|
276
276
|
] }) : /* @__PURE__ */ r.jsx("div", { className: "aiquants-session-info mb-1 min-h-[1em] w-9/12 rounded-r-lg py-0.5 pl-1 text-xs", children: "ログインはこちら" }) }) });
|
|
277
|
-
},
|
|
278
|
-
report:
|
|
279
|
-
slip:
|
|
277
|
+
}, Q = new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/), ye = {
|
|
278
|
+
report: W,
|
|
279
|
+
slip: W,
|
|
280
280
|
table: xe,
|
|
281
281
|
chart: me,
|
|
282
282
|
download: fe,
|
|
283
283
|
lock: de,
|
|
284
284
|
href: ue
|
|
285
285
|
}, ke = ({ mark: t, children: o }) => {
|
|
286
|
-
const a = t ?
|
|
286
|
+
const a = t ? ye[t] : void 0;
|
|
287
287
|
return a ? /* @__PURE__ */ r.jsxs("div", { className: "flex flex-nowrap items-center", children: [
|
|
288
288
|
/* @__PURE__ */ r.jsx(a, { className: "h-4 w-4" }),
|
|
289
289
|
/* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-link mx-1 hover:underline", children: o })
|
|
290
290
|
] }) : /* @__PURE__ */ r.jsx("span", { className: "mx-1 text-sky-600 hover:underline dark:text-sky-400", children: o });
|
|
291
|
-
},
|
|
291
|
+
}, D = (t, o) => o ? {
|
|
292
292
|
menu: {
|
|
293
293
|
id: t.id,
|
|
294
294
|
title: t.title,
|
|
@@ -307,33 +307,33 @@ const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a",
|
|
|
307
307
|
title: t.title,
|
|
308
308
|
href: t.href
|
|
309
309
|
}
|
|
310
|
-
},
|
|
310
|
+
}, je = ({ item: t, parentMenu: o, onMenuSelected: a }) => {
|
|
311
311
|
if (t.href === "separator")
|
|
312
312
|
return /* @__PURE__ */ r.jsx("hr", { className: "aiquants-menu-separator mx-2 my-1 h-px" });
|
|
313
313
|
const f = /* @__PURE__ */ r.jsx(ke, { mark: t.mark, children: t.title }), i = {
|
|
314
314
|
onClick: () => {
|
|
315
|
-
a && a(
|
|
315
|
+
a && a(D(o, t));
|
|
316
316
|
}
|
|
317
317
|
};
|
|
318
|
-
return t.new ? /* @__PURE__ */ r.jsx("a", { href: t.href, rel: "noopener noreferrer", target: "_blank", ...i, children: f }) :
|
|
318
|
+
return t.new ? /* @__PURE__ */ r.jsx("a", { href: t.href, rel: "noopener noreferrer", target: "_blank", ...i, children: f }) : Q.test(t.href) ? /* @__PURE__ */ r.jsx("a", { href: t.href, ...i, children: f }) : /* @__PURE__ */ r.jsx(B, { to: t.href, ...i, children: f });
|
|
319
319
|
}, we = (t) => {
|
|
320
|
-
const { menuList: o, onMenuSelected: a } = t, [f, i] =
|
|
320
|
+
const { menuList: o, onMenuSelected: a } = t, [f, i] = G(null), c = g((s) => {
|
|
321
321
|
i((l) => l === s ? null : s);
|
|
322
|
-
}, []), u = ce(() => /* @__PURE__ */ r.jsx(r.Fragment, { children: o.map((s) => /* @__PURE__ */ r.jsx("div", { children: s.href ? /* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-list-item before:-mt-1 relative mb-1 ml-1 h-full rounded-l-2xl p-2 align-middle text-sm before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']", children:
|
|
322
|
+
}, []), u = ce(() => /* @__PURE__ */ r.jsx(r.Fragment, { children: o.map((s) => /* @__PURE__ */ r.jsx("div", { children: s.href ? /* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-list-item before:-mt-1 relative mb-1 ml-1 h-full rounded-l-2xl p-2 align-middle text-sm before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']", children: Q.test(s.href) ? /* @__PURE__ */ r.jsx(
|
|
323
323
|
"a",
|
|
324
324
|
{
|
|
325
325
|
href: s.href,
|
|
326
326
|
onClick: () => {
|
|
327
|
-
a && a(
|
|
327
|
+
a && a(D(s));
|
|
328
328
|
},
|
|
329
329
|
children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: s.title })
|
|
330
330
|
}
|
|
331
331
|
) : /* @__PURE__ */ r.jsx(
|
|
332
|
-
|
|
332
|
+
B,
|
|
333
333
|
{
|
|
334
334
|
to: s.href,
|
|
335
335
|
onClick: () => {
|
|
336
|
-
a && a(
|
|
336
|
+
a && a(D(s));
|
|
337
337
|
},
|
|
338
338
|
children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: s.title })
|
|
339
339
|
}
|
|
@@ -351,10 +351,10 @@ const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a",
|
|
|
351
351
|
children: /* @__PURE__ */ r.jsx("span", { children: s.title })
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
/* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md", children: s.submenu.map((l) => /* @__PURE__ */ r.jsx("div", { className: "menu-accordion-container block w-full whitespace-nowrap text-sm", children: /* @__PURE__ */ r.jsx(
|
|
354
|
+
/* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md", children: s.submenu.map((l) => /* @__PURE__ */ r.jsx("div", { className: "menu-accordion-container block w-full whitespace-nowrap text-sm", children: /* @__PURE__ */ r.jsx(je, { item: l, parentMenu: s, onMenuSelected: a }) }, l.subid)) })
|
|
355
355
|
] }) }, s.id)) }), [o, a, f, c]);
|
|
356
356
|
return /* @__PURE__ */ r.jsx("div", { className: "hidden-scrollbar h-0 grow overflow-y-scroll", children: u });
|
|
357
|
-
},
|
|
357
|
+
}, Ee = (t) => {
|
|
358
358
|
const { menuList: o, menuHeader: a, open: f, onMenuSelected: i, onClickSignout: c, theme: u, toggleTheme: s } = t;
|
|
359
359
|
return /* @__PURE__ */ r.jsxs("div", { className: `aiquants-menu-content fixed top-0 right-0 z-2147483642 flex min-h-dvh w-[250px] select-none flex-col transition-transform duration-500 ${f ? "aiquants-menu-translate-x-0" : "aiquants-menu-translate-x-250"}`, children: [
|
|
360
360
|
/* @__PURE__ */ r.jsx("div", { className: "flex h-[100px] flex-col", children: a }),
|
|
@@ -384,64 +384,64 @@ const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a",
|
|
|
384
384
|
)
|
|
385
385
|
] }) })
|
|
386
386
|
] });
|
|
387
|
-
},
|
|
387
|
+
}, Ne = (t) => {
|
|
388
388
|
const { isOverlay: o, onOverlayClick: a } = t;
|
|
389
389
|
return /* @__PURE__ */ r.jsx("button", { type: "button", className: `fixed inset-0 z-2147483640 cursor-default bg-black/50 transition-opacity duration-500 ${o ? "opacity-100" : "pointer-events-none opacity-0"}`, onClick: a });
|
|
390
390
|
}, _e = (t) => {
|
|
391
391
|
const { open: o, onMenuOpen: a, onMenuClose: f, theme: i } = t, c = E(o), u = E(null), s = E(null), l = E(null), p = E(null), h = E(null), b = g(() => {
|
|
392
392
|
if (u.current && s.current && l.current && p.current && h.current) {
|
|
393
|
-
const
|
|
394
|
-
u.current.style.backgroundColor =
|
|
393
|
+
const y = i === "dark" ? "#fff" : "#000";
|
|
394
|
+
u.current.style.backgroundColor = y, u.current.style.width = "100%", u.current.style.height = "3px", u.current.style.transform = "", s.current.style.opacity = "1", s.current.style.backgroundColor = y, l.current.style.opacity = "1", l.current.style.backgroundColor = y, p.current.style.backgroundColor = y, p.current.style.width = "100%", p.current.style.height = "3px", p.current.style.transform = "", h.current.style.color = y, h.current.classList.remove("after:content-['close']"), h.current.classList.remove("after:ml-0.5"), h.current.classList.add("after:content-['menu']"), h.current.classList.add("after:-ml-0.5"), c.current = !0;
|
|
395
395
|
}
|
|
396
|
-
}, [i]),
|
|
396
|
+
}, [i]), k = g(() => {
|
|
397
397
|
u.current && s.current && l.current && p.current && h.current && (u.current.style.backgroundColor = "#fff", u.current.style.width = "32px", u.current.style.height = "4px", u.current.style.transform = "translateY(9px) rotate(-45deg)", s.current.style.opacity = "0", l.current.style.opacity = "0", p.current.style.backgroundColor = "#fff", p.current.style.width = "32px", p.current.style.height = "4px", p.current.style.transform = "translateY(-9px) rotate(45deg)", h.current.style.color = "#fff", h.current.classList.remove("after:content-['menu']"), h.current.classList.remove("after:-ml-0.5"), h.current.classList.add("after:content-['close']"), h.current.classList.add("after:ml-0.5"), c.current = !1);
|
|
398
398
|
}, []), v = g(() => {
|
|
399
399
|
b(), f && f();
|
|
400
|
-
}, [b, f]),
|
|
401
|
-
|
|
402
|
-
}, [
|
|
403
|
-
c.current ?
|
|
404
|
-
}, [v,
|
|
405
|
-
|
|
406
|
-
}, []),
|
|
407
|
-
|
|
400
|
+
}, [b, f]), j = g(() => {
|
|
401
|
+
k(), a && a();
|
|
402
|
+
}, [k, a]), S = g(() => {
|
|
403
|
+
c.current ? j() : v();
|
|
404
|
+
}, [v, j]), N = g((y) => {
|
|
405
|
+
y.currentTarget.blur();
|
|
406
|
+
}, []), O = g((y) => {
|
|
407
|
+
y.preventDefault();
|
|
408
408
|
}, []);
|
|
409
|
-
return
|
|
410
|
-
o ? b() :
|
|
411
|
-
}, [o, b,
|
|
409
|
+
return J(() => {
|
|
410
|
+
o ? b() : k();
|
|
411
|
+
}, [o, b, k]), /* @__PURE__ */ r.jsxs("button", { type: "button", className: "aiquants-menu-switch fixed z-2147483647 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden", onClick: S, onFocus: N, onMouseDown: O, tabIndex: -1, children: [
|
|
412
412
|
/* @__PURE__ */ r.jsx("span", { className: "absolute top-0 left-0 box-border inline-block h-[3px] w-full select-none", ref: u }),
|
|
413
413
|
/* @__PURE__ */ r.jsx("span", { className: "absolute top-1.5 left-0 box-border inline-block h-[3px] w-full select-none", ref: s }),
|
|
414
414
|
/* @__PURE__ */ r.jsx("span", { className: "absolute top-3 left-0 box-border inline-block h-[3px] w-full select-none", ref: l }),
|
|
415
415
|
/* @__PURE__ */ r.jsx("span", { className: "absolute top-[18px] left-0 box-border inline-block h-[3px] w-full select-none", ref: p }),
|
|
416
416
|
/* @__PURE__ */ r.jsx("div", { className: "absolute w-full text-xs after:mt-2 after:block", ref: h })
|
|
417
417
|
] });
|
|
418
|
-
},
|
|
419
|
-
const { menuList: o, menuHeader: a, onClickSignout: f, isMenuhide: i, theme: c, toggleTheme: u, onMenuNavigate: s } = t, [l, p] =
|
|
418
|
+
}, Oe = (t) => {
|
|
419
|
+
const { menuList: o, menuHeader: a, onClickSignout: f, isMenuhide: i, theme: c, toggleTheme: u, onMenuNavigate: s } = t, [l, p] = G(!1), h = g(() => {
|
|
420
420
|
p(!0);
|
|
421
421
|
}, []), b = g(() => {
|
|
422
422
|
p(!1);
|
|
423
|
-
}, []),
|
|
424
|
-
(
|
|
425
|
-
s && s(
|
|
423
|
+
}, []), k = g(
|
|
424
|
+
(j) => {
|
|
425
|
+
s && s(j), p(!1);
|
|
426
426
|
},
|
|
427
427
|
[s]
|
|
428
428
|
), v = g(
|
|
429
|
-
(
|
|
430
|
-
if (
|
|
429
|
+
(j) => {
|
|
430
|
+
if (j.key === "Escape")
|
|
431
431
|
return b(), !1;
|
|
432
432
|
},
|
|
433
433
|
[b]
|
|
434
434
|
);
|
|
435
|
-
return
|
|
435
|
+
return J(() => (l ? window.addEventListener("keydown", v, { passive: !0 }) : window.removeEventListener("keydown", v), () => {
|
|
436
436
|
window.removeEventListener("keydown", v);
|
|
437
437
|
}), [l, v]), i ? /* @__PURE__ */ r.jsx(r.Fragment, {}) : /* @__PURE__ */ r.jsxs("div", { className: `aiquants-menu-bar ${c}`, children: [
|
|
438
438
|
/* @__PURE__ */ r.jsx(_e, { onMenuClose: b, onMenuOpen: h, open: !l, theme: c }),
|
|
439
|
-
/* @__PURE__ */ r.jsx(
|
|
440
|
-
/* @__PURE__ */ r.jsx(
|
|
439
|
+
/* @__PURE__ */ r.jsx(Ee, { menuList: o, menuHeader: a, onClickSignout: f, onMenuSelected: k, open: l, theme: c, toggleTheme: u }),
|
|
440
|
+
/* @__PURE__ */ r.jsx(Ne, { isOverlay: l, onOverlayClick: b })
|
|
441
441
|
] });
|
|
442
442
|
};
|
|
443
443
|
export {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
ge as DefaultLink,
|
|
445
|
+
Oe as MenuBar,
|
|
446
|
+
Se as SessionInfo
|
|
447
447
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("lucide-react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react","react-router-dom"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@aiquants/menu-bar"]={},y.React,y["lucide-react"],y.ReactRouterDOM))})(this,(function(y,l,E,F){"use strict";var R={exports:{}},_={};var z;function X(){if(z)return _;z=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function o(m,i,u){var d=null;if(u!==void 0&&(d=""+u),i.key!==void 0&&(d=""+i.key),"key"in i){u={};for(var s in i)s!=="key"&&(u[s]=i[s])}else u=i;return i=u.ref,{$$typeof:t,type:m,key:d,ref:i!==void 0?i:null,props:u}}return _.Fragment=a,_.jsx=o,_.jsxs=o,_}var T={};var U;function K(){return U||(U=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case k:return"Profiler";case A:return"StrictMode";case me:return"Suspense";case xe:return"SuspenseList";case pe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case M:return"Portal";case de:return e.displayName||"Context";case ue:return(e._context.displayName||"Context")+".Consumer";case fe:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case he:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case L:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function a(e){return""+e}function o(e){try{a(e);var n=!1}catch{n=!0}if(n){n=console;var f=n.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),a(e)}}function m(e){if(e===C)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function i(){var e=P.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function d(e){if(Z.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function s(e,n){function f(){G||(G=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function c(){var e=t(this.type);return J[e]||(J[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function b(e,n,f,x,S,D){var h=f.ref;return e={$$typeof:w,type:e,key:n,props:f,_owner:x},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:c}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function p(e,n,f,x,S,D){var h=n.children;if(h!==void 0)if(x)if(ve(h)){for(x=0;x<h.length;x++)v(h[x]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(h);if(Z.call(n,"key")){h=t(e);var N=Object.keys(n).filter(function(ge){return ge!=="key"});x=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",Q[h+x]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,h,x,_,x),Z[x+h]=!0)}if(x=null,f!==void 0&&(a(f),x=""+f),d(n)&&(a(n.key),x=""+n.key),"key"in n){f={};for(var Y in n)Y!=="key"&&(f[Y]=n[Y])}else f=n;return x&&s(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,x,f,i(),S,D)}function v(e){w(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===P&&(e._payload.status==="fulfilled"?w(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function w(e){return typeof e=="object"&&e!==null&&e.$$typeof===j}var k=l,j=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),ue=Symbol.for("react.context"),de=Symbol.for("react.forward_ref"),fe=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),pe=Symbol.for("react.client.reference"),L=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,be=Array.isArray,I=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(e){return e()}};var G,B={},X=k.react_stack_bottom_frame.bind(k,u)(),H=I(m(u)),Z={};R.Fragment=T,R.jsx=function(e,n,f){var h=1e4>L.recentlyCreatedOwnerStacks++;return p(e,n,f,!1,h?Error("react-stack-top-frame"):X,h?I(m(e)):H)},R.jsxs=function(e,n,f){var h=1e4>L.recentlyCreatedOwnerStacks++;return p(e,n,f,!0,h?Error("react-stack-top-frame"):X,h?I(m(e)):H)}})()),R}var U;function $(){return U||(U=1,process.env.NODE_ENV==="production"?C.exports=Q():C.exports=K()),C.exports}var r=$();const J=({to:t,className:o,children:a})=>r.jsx("a",{href:t,className:o,children:a}),ee=t=>{const{user:o,LinkComponent:a=J}=t;return r.jsx("div",{className:"max-h-20 max-w-52",children:r.jsx("div",{className:"flex grow flex-col",children:o?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-row",children:[r.jsx("div",{className:"aiquants-session-photo m-1 h-14 w-14 p-0.5",children:r.jsx("img",{className:"object-contain",src:o.photo,"aria-label":"profile photo"})}),r.jsxs("div",{className:"mx-1 flex flex-col",children:[r.jsx(a,{className:"aiquants-session-link my-1 rounded-lg px-2 text-center text-xs",to:"/",children:"プロフィールを編集"}),r.jsx(a,{className:"aiquants-session-link rounded-lg px-2 text-center text-xs",to:"/",children:"プロフィール"}),r.jsx(a,{className:"aiquants-session-link my-1 rounded-lg px-2 text-center text-xs",to:"https://myaccount.google.com/",children:"Google Account"})]})]}),r.jsx("div",{className:"aiquants-session-info mb-1 min-h-[1em] w-full rounded-r-lg px-2 py-0.5 text-xs",children:o.displayName})]}):r.jsx("div",{className:"aiquants-session-info mb-1 min-h-[1em] w-9/12 rounded-r-lg py-0.5 pl-1 text-xs",children:"ログインはこちら"})})})},V=new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/),re={report:E.FileText,slip:E.FileText,table:E.Table,chart:E.BarChart,download:E.Download,lock:E.Lock,href:E.Link},te=({mark:t,children:o})=>{const a=t?re[t]:void 0;return a?r.jsxs("div",{className:"flex flex-nowrap items-center",children:[r.jsx(a,{className:"h-4 w-4"}),r.jsx("div",{className:"aiquants-menu-link mx-1 hover:underline",children:o})]}):r.jsx("span",{className:"mx-1 text-sky-600 hover:underline dark:text-sky-400",children:o})},O=(t,o)=>o?{menu:{id:t.id,title:t.title,href:t.href},submenu:{subid:o.subid,title:o.title,href:o.href,mark:o.mark,new:o.new}}:{menu:{id:t.id,title:t.title,href:t.href}},ne=({item:t,parentMenu:o,onMenuSelected:a})=>{if(t.href==="separator")return r.jsx("hr",{className:"aiquants-menu-separator mx-2 my-1 h-px"});const m=r.jsx(te,{mark:t.mark,children:t.title}),i={onClick:()=>{a&&a(O(o,t))}};return t.new?r.jsx("a",{href:t.href,rel:"noopener noreferrer",target:"_blank",...i,children:m}):V.test(t.href)?r.jsx("a",{href:t.href,...i,children:m}):r.jsx(F.Link,{to:t.href,...i,children:m})},se=t=>{const{menuList:o,onMenuSelected:a}=t,[m,i]=l.useState(null),u=l.useCallback(s=>{i(c=>c===s?null:s)},[]),d=l.useMemo(()=>r.jsx(r.Fragment,{children:o.map(s=>r.jsx("div",{children:s.href?r.jsx("div",{className:"aiquants-menu-list-item before:-mt-1 relative mb-1 ml-1 h-full rounded-l-2xl p-2 align-middle text-sm before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']",children:V.test(s.href)?r.jsx("a",{href:s.href,onClick:()=>{a&&a(O(s))},children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:s.title})}):r.jsx(F.Link,{to:s.href,onClick:()=>{a&&a(O(s))},children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:s.title})})}):r.jsxs("details",{className:"menu-accordion-details",open:s.id===m,children:[r.jsx("summary",{className:"aiquants-menu-list-item menu-accordion-summary before:-mt-1 relative mb-1 ml-1 h-full list-none rounded-l-2xl p-2 align-middle text-sm outline-none before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']",onClick:c=>{c.preventDefault(),u(s.id)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),u(s.id))},children:r.jsx("span",{children:s.title})}),r.jsx("div",{className:"aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md",children:s.submenu.map(c=>r.jsx("div",{className:"menu-accordion-container block w-full whitespace-nowrap text-sm",children:r.jsx(ne,{item:c,parentMenu:s,onMenuSelected:a})},c.subid))})]})},s.id))}),[o,a,m,u]);return r.jsx("div",{className:"hidden-scrollbar h-0 grow overflow-y-scroll",children:d})},oe=t=>{const{menuList:o,menuHeader:a,open:m,onMenuSelected:i,onClickSignout:u,theme:d,toggleTheme:s}=t;return r.jsxs("div",{className:`aiquants-menu-content fixed top-0 right-0 z-2147483642 flex min-h-dvh w-[250px] select-none flex-col transition-transform duration-500 ${m?"aiquants-menu-translate-x-0":"aiquants-menu-translate-x-250"}`,children:[r.jsx("div",{className:"flex h-[100px] flex-col",children:a}),r.jsx("div",{className:"flex grow flex-col",children:r.jsx(se,{menuList:o,onMenuSelected:i})}),r.jsx("div",{className:"px-4 pt-2 pb-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:s,className:"group relative flex flex-1 items-center gap-2 rounded-lg border border-white/15 bg-white/10 px-3 py-2 font-medium text-white text-xs shadow-sm backdrop-blur-sm transition-all duration-300 hover:border-white/25 hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 focus-visible:ring-offset-0 dark:border-gray-600/40 dark:bg-gray-800/80 dark:hover:border-gray-500/60 dark:hover:bg-gray-700",children:[r.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-white/20 backdrop-blur-sm transition-all duration-300 group-hover:scale-110 group-hover:bg-white/30 dark:bg-gray-600/60 dark:group-hover:bg-gray-500/70",children:r.jsx("span",{className:"text-sm transition-transform duration-300 group-hover:scale-110",children:d==="dark"?"🌞":"🌙"})}),r.jsx("span",{className:"text-white transition-colors duration-300 group-hover:text-white/90 dark:text-gray-200 dark:group-hover:text-white",children:d==="dark"?"Light":"Dark"}),r.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-r from-transparent via-white/5 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:via-gray-400/10"})]}),r.jsx("button",{type:"button",className:"aiquants-signout-button flex items-center justify-center rounded-md bg-red-500/90 px-3 py-2 font-medium text-white text-xs shadow-sm transition-colors duration-300 hover:bg-red-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-300/60",onClick:u,children:"サインアウト"})]})})]})},ae=t=>{const{isOverlay:o,onOverlayClick:a}=t;return r.jsx("button",{type:"button",className:`fixed inset-0 z-2147483640 cursor-default bg-black/50 transition-opacity duration-500 ${o?"opacity-100":"pointer-events-none opacity-0"}`,onClick:a})},le=t=>{const{open:o,onMenuOpen:a,onMenuClose:m,theme:i}=t,u=l.useRef(o),d=l.useRef(null),s=l.useRef(null),c=l.useRef(null),b=l.useRef(null),p=l.useRef(null),v=l.useCallback(()=>{if(d.current&&s.current&&c.current&&b.current&&p.current){const y=i==="dark"?"#fff":"#000";d.current.style.backgroundColor=y,d.current.style.width="100%",d.current.style.height="3px",d.current.style.transform="",s.current.style.opacity="1",s.current.style.backgroundColor=y,c.current.style.opacity="1",c.current.style.backgroundColor=y,b.current.style.backgroundColor=y,b.current.style.width="100%",b.current.style.height="3px",b.current.style.transform="",p.current.style.color=y,p.current.classList.remove("after:content-['close']"),p.current.classList.remove("after:ml-0.5"),p.current.classList.add("after:content-['menu']"),p.current.classList.add("after:-ml-0.5"),u.current=!0}},[i]),w=l.useCallback(()=>{d.current&&s.current&&c.current&&b.current&&p.current&&(d.current.style.backgroundColor="#fff",d.current.style.width="32px",d.current.style.height="4px",d.current.style.transform="translateY(9px) rotate(-45deg)",s.current.style.opacity="0",c.current.style.opacity="0",b.current.style.backgroundColor="#fff",b.current.style.width="32px",b.current.style.height="4px",b.current.style.transform="translateY(-9px) rotate(45deg)",p.current.style.color="#fff",p.current.classList.remove("after:content-['menu']"),p.current.classList.remove("after:-ml-0.5"),p.current.classList.add("after:content-['close']"),p.current.classList.add("after:ml-0.5"),u.current=!1)},[]),k=l.useCallback(()=>{v(),m&&m()},[v,m]),j=l.useCallback(()=>{w(),a&&a()},[w,a]),A=l.useCallback(()=>{u.current?j():k()},[k,j]),T=l.useCallback(y=>{y.currentTarget.blur()},[]),M=l.useCallback(y=>{y.preventDefault()},[]);return l.useEffect(()=>{o?v():w()},[o,v,w]),r.jsxs("button",{type:"button",className:"aiquants-menu-switch fixed z-2147483647 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden",onClick:A,onFocus:T,onMouseDown:M,tabIndex:-1,children:[r.jsx("span",{className:"absolute top-0 left-0 box-border inline-block h-[3px] w-full select-none",ref:d}),r.jsx("span",{className:"absolute top-1.5 left-0 box-border inline-block h-[3px] w-full select-none",ref:s}),r.jsx("span",{className:"absolute top-3 left-0 box-border inline-block h-[3px] w-full select-none",ref:c}),r.jsx("span",{className:"absolute top-[18px] left-0 box-border inline-block h-[3px] w-full select-none",ref:b}),r.jsx("div",{className:"absolute w-full text-xs after:mt-2 after:block",ref:p})]})},ce=t=>{const{menuList:o,menuHeader:a,onClickSignout:m,isMenuhide:i,theme:u,toggleTheme:d,onMenuNavigate:s}=t,[c,b]=l.useState(!1),p=l.useCallback(()=>{b(!0)},[]),v=l.useCallback(()=>{b(!1)},[]),w=l.useCallback(j=>{s&&s(j),b(!1)},[s]),k=l.useCallback(j=>{if(j.key==="Escape")return v(),!1},[v]);return l.useEffect(()=>(c?window.addEventListener("keydown",k,{passive:!0}):window.removeEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[c,k]),i?r.jsx(r.Fragment,{}):r.jsxs("div",{className:`aiquants-menu-bar ${u}`,children:[r.jsx(le,{onMenuClose:v,onMenuOpen:p,open:!c,theme:u}),r.jsx(oe,{menuList:o,menuHeader:a,onClickSignout:m,onMenuSelected:w,open:c,theme:u,toggleTheme:d}),r.jsx(ae,{isOverlay:c,onOverlayClick:v})]})};g.DefaultLink=J,g.MenuBar=ce,g.SessionInfo=ee,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,x,h,N,h),Q[h+x]=!0)}if(h=null,f!==void 0&&(o(f),h=""+f),d(n)&&(o(n.key),h=""+n.key),"key"in n){f={};for(var Y in n)Y!=="key"&&(f[Y]=n[Y])}else f=n;return h&&s(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,h,f,i(),S,D)}function v(e){j(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?j(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function j(e){return typeof e=="object"&&e!==null&&e.$$typeof===w}var g=l,w=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),ue=Symbol.for("react.consumer"),de=Symbol.for("react.context"),fe=Symbol.for("react.forward_ref"),me=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),be=Symbol.for("react.client.reference"),P=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,ve=Array.isArray,I=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(e){return e()}};var G,J={},q=g.react_stack_bottom_frame.bind(g,u)(),B=I(m(u)),Q={};T.Fragment=C,T.jsx=function(e,n,f){var x=1e4>P.recentlyCreatedOwnerStacks++;return p(e,n,f,!1,x?Error("react-stack-top-frame"):q,x?I(m(e)):B)},T.jsxs=function(e,n,f){var x=1e4>P.recentlyCreatedOwnerStacks++;return p(e,n,f,!0,x?Error("react-stack-top-frame"):q,x?I(m(e)):B)}})()),T}var W;function $(){return W||(W=1,process.env.NODE_ENV==="production"?R.exports=X():R.exports=K()),R.exports}var r=$();const ee="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iI2NiZDVlMSI+PHBhdGggZD0iTTEyIDEyYzIuMjEgMCA0LTEuNzkgNC00cy0xLjc5LTQtNC00LTQgMS43OS00IDQgMS43OSA0IDQgNHptMCAyYy0yLjY3IDAtOCAxLjM0LTggNHYyaDE2di0yYzAtMi42Ni01LjMzLTQtOC00eiIvPjwvc3ZnPg==",H=({to:t,className:a,children:o})=>r.jsx("a",{href:t,className:a,children:o}),re=t=>{const{user:a,LinkComponent:o=H}=t;return r.jsx("div",{className:"max-h-20 max-w-52",children:r.jsx("div",{className:"flex grow flex-col",children:a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-row",children:[r.jsx("div",{className:"aiquants-session-photo m-1 h-14 w-14 p-0.5",children:r.jsx("img",{className:"object-contain",src:a.photo||ee,"aria-label":"profile photo"})}),r.jsxs("div",{className:"mx-1 flex flex-col",children:[r.jsx(o,{className:"aiquants-session-link my-1 rounded-lg px-2 text-center text-xs",to:"/",children:"プロフィールを編集"}),r.jsx(o,{className:"aiquants-session-link rounded-lg px-2 text-center text-xs",to:"/",children:"プロフィール"}),r.jsx(o,{className:"aiquants-session-link my-1 rounded-lg px-2 text-center text-xs",to:"https://myaccount.google.com/",children:"Google Account"})]})]}),r.jsx("div",{className:"aiquants-session-info mb-1 min-h-[1em] w-full rounded-r-lg px-2 py-0.5 text-xs",children:a.displayName})]}):r.jsx("div",{className:"aiquants-session-info mb-1 min-h-[1em] w-9/12 rounded-r-lg py-0.5 pl-1 text-xs",children:"ログインはこちら"})})})},V=new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/),te={report:E.FileText,slip:E.FileText,table:E.Table,chart:E.BarChart,download:E.Download,lock:E.Lock,href:E.Link},ne=({mark:t,children:a})=>{const o=t?te[t]:void 0;return o?r.jsxs("div",{className:"flex flex-nowrap items-center",children:[r.jsx(o,{className:"h-4 w-4"}),r.jsx("div",{className:"aiquants-menu-link mx-1 hover:underline",children:a})]}):r.jsx("span",{className:"mx-1 text-sky-600 hover:underline dark:text-sky-400",children:a})},O=(t,a)=>a?{menu:{id:t.id,title:t.title,href:t.href},submenu:{subid:a.subid,title:a.title,href:a.href,mark:a.mark,new:a.new}}:{menu:{id:t.id,title:t.title,href:t.href}},se=({item:t,parentMenu:a,onMenuSelected:o})=>{if(t.href==="separator")return r.jsx("hr",{className:"aiquants-menu-separator mx-2 my-1 h-px"});const m=r.jsx(ne,{mark:t.mark,children:t.title}),i={onClick:()=>{o&&o(O(a,t))}};return t.new?r.jsx("a",{href:t.href,rel:"noopener noreferrer",target:"_blank",...i,children:m}):V.test(t.href)?r.jsx("a",{href:t.href,...i,children:m}):r.jsx(F.Link,{to:t.href,...i,children:m})},ae=t=>{const{menuList:a,onMenuSelected:o}=t,[m,i]=l.useState(null),u=l.useCallback(s=>{i(c=>c===s?null:s)},[]),d=l.useMemo(()=>r.jsx(r.Fragment,{children:a.map(s=>r.jsx("div",{children:s.href?r.jsx("div",{className:"aiquants-menu-list-item before:-mt-1 relative mb-1 ml-1 h-full rounded-l-2xl p-2 align-middle text-sm before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']",children:V.test(s.href)?r.jsx("a",{href:s.href,onClick:()=>{o&&o(O(s))},children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:s.title})}):r.jsx(F.Link,{to:s.href,onClick:()=>{o&&o(O(s))},children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:s.title})})}):r.jsxs("details",{className:"menu-accordion-details",open:s.id===m,children:[r.jsx("summary",{className:"aiquants-menu-list-item menu-accordion-summary before:-mt-1 relative mb-1 ml-1 h-full list-none rounded-l-2xl p-2 align-middle text-sm outline-none before:mr-2 before:inline-block before:h-4 before:w-4 before:rounded-full before:align-middle before:content-['']",onClick:c=>{c.preventDefault(),u(s.id)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),u(s.id))},children:r.jsx("span",{children:s.title})}),r.jsx("div",{className:"aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md",children:s.submenu.map(c=>r.jsx("div",{className:"menu-accordion-container block w-full whitespace-nowrap text-sm",children:r.jsx(se,{item:c,parentMenu:s,onMenuSelected:o})},c.subid))})]})},s.id))}),[a,o,m,u]);return r.jsx("div",{className:"hidden-scrollbar h-0 grow overflow-y-scroll",children:d})},oe=t=>{const{menuList:a,menuHeader:o,open:m,onMenuSelected:i,onClickSignout:u,theme:d,toggleTheme:s}=t;return r.jsxs("div",{className:`aiquants-menu-content fixed top-0 right-0 z-2147483642 flex min-h-dvh w-[250px] select-none flex-col transition-transform duration-500 ${m?"aiquants-menu-translate-x-0":"aiquants-menu-translate-x-250"}`,children:[r.jsx("div",{className:"flex h-[100px] flex-col",children:o}),r.jsx("div",{className:"flex grow flex-col",children:r.jsx(ae,{menuList:a,onMenuSelected:i})}),r.jsx("div",{className:"px-4 pt-2 pb-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:s,className:"group relative flex flex-1 items-center gap-2 rounded-lg border border-white/15 bg-white/10 px-3 py-2 font-medium text-white text-xs shadow-sm backdrop-blur-sm transition-all duration-300 hover:border-white/25 hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 focus-visible:ring-offset-0 dark:border-gray-600/40 dark:bg-gray-800/80 dark:hover:border-gray-500/60 dark:hover:bg-gray-700",children:[r.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-white/20 backdrop-blur-sm transition-all duration-300 group-hover:scale-110 group-hover:bg-white/30 dark:bg-gray-600/60 dark:group-hover:bg-gray-500/70",children:r.jsx("span",{className:"text-sm transition-transform duration-300 group-hover:scale-110",children:d==="dark"?"🌞":"🌙"})}),r.jsx("span",{className:"text-white transition-colors duration-300 group-hover:text-white/90 dark:text-gray-200 dark:group-hover:text-white",children:d==="dark"?"Light":"Dark"}),r.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-r from-transparent via-white/5 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:via-gray-400/10"})]}),r.jsx("button",{type:"button",className:"aiquants-signout-button flex items-center justify-center rounded-md bg-red-500/90 px-3 py-2 font-medium text-white text-xs shadow-sm transition-colors duration-300 hover:bg-red-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-300/60",onClick:u,children:"サインアウト"})]})})]})},le=t=>{const{isOverlay:a,onOverlayClick:o}=t;return r.jsx("button",{type:"button",className:`fixed inset-0 z-2147483640 cursor-default bg-black/50 transition-opacity duration-500 ${a?"opacity-100":"pointer-events-none opacity-0"}`,onClick:o})},ce=t=>{const{open:a,onMenuOpen:o,onMenuClose:m,theme:i}=t,u=l.useRef(a),d=l.useRef(null),s=l.useRef(null),c=l.useRef(null),b=l.useRef(null),p=l.useRef(null),v=l.useCallback(()=>{if(d.current&&s.current&&c.current&&b.current&&p.current){const k=i==="dark"?"#fff":"#000";d.current.style.backgroundColor=k,d.current.style.width="100%",d.current.style.height="3px",d.current.style.transform="",s.current.style.opacity="1",s.current.style.backgroundColor=k,c.current.style.opacity="1",c.current.style.backgroundColor=k,b.current.style.backgroundColor=k,b.current.style.width="100%",b.current.style.height="3px",b.current.style.transform="",p.current.style.color=k,p.current.classList.remove("after:content-['close']"),p.current.classList.remove("after:ml-0.5"),p.current.classList.add("after:content-['menu']"),p.current.classList.add("after:-ml-0.5"),u.current=!0}},[i]),j=l.useCallback(()=>{d.current&&s.current&&c.current&&b.current&&p.current&&(d.current.style.backgroundColor="#fff",d.current.style.width="32px",d.current.style.height="4px",d.current.style.transform="translateY(9px) rotate(-45deg)",s.current.style.opacity="0",c.current.style.opacity="0",b.current.style.backgroundColor="#fff",b.current.style.width="32px",b.current.style.height="4px",b.current.style.transform="translateY(-9px) rotate(45deg)",p.current.style.color="#fff",p.current.classList.remove("after:content-['menu']"),p.current.classList.remove("after:-ml-0.5"),p.current.classList.add("after:content-['close']"),p.current.classList.add("after:ml-0.5"),u.current=!1)},[]),g=l.useCallback(()=>{v(),m&&m()},[v,m]),w=l.useCallback(()=>{j(),o&&o()},[j,o]),M=l.useCallback(()=>{u.current?w():g()},[g,w]),C=l.useCallback(k=>{k.currentTarget.blur()},[]),A=l.useCallback(k=>{k.preventDefault()},[]);return l.useEffect(()=>{a?v():j()},[a,v,j]),r.jsxs("button",{type:"button",className:"aiquants-menu-switch fixed z-2147483647 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden",onClick:M,onFocus:C,onMouseDown:A,tabIndex:-1,children:[r.jsx("span",{className:"absolute top-0 left-0 box-border inline-block h-[3px] w-full select-none",ref:d}),r.jsx("span",{className:"absolute top-1.5 left-0 box-border inline-block h-[3px] w-full select-none",ref:s}),r.jsx("span",{className:"absolute top-3 left-0 box-border inline-block h-[3px] w-full select-none",ref:c}),r.jsx("span",{className:"absolute top-[18px] left-0 box-border inline-block h-[3px] w-full select-none",ref:b}),r.jsx("div",{className:"absolute w-full text-xs after:mt-2 after:block",ref:p})]})},ie=t=>{const{menuList:a,menuHeader:o,onClickSignout:m,isMenuhide:i,theme:u,toggleTheme:d,onMenuNavigate:s}=t,[c,b]=l.useState(!1),p=l.useCallback(()=>{b(!0)},[]),v=l.useCallback(()=>{b(!1)},[]),j=l.useCallback(w=>{s&&s(w),b(!1)},[s]),g=l.useCallback(w=>{if(w.key==="Escape")return v(),!1},[v]);return l.useEffect(()=>(c?window.addEventListener("keydown",g,{passive:!0}):window.removeEventListener("keydown",g),()=>{window.removeEventListener("keydown",g)}),[c,g]),i?r.jsx(r.Fragment,{}):r.jsxs("div",{className:`aiquants-menu-bar ${u}`,children:[r.jsx(ce,{onMenuClose:v,onMenuOpen:p,open:!c,theme:u}),r.jsx(oe,{menuList:a,menuHeader:o,onClickSignout:m,onMenuSelected:j,open:c,theme:u,toggleTheme:d}),r.jsx(le,{isOverlay:c,onOverlayClick:v})]})};y.DefaultLink=H,y.MenuBar=ie,y.SessionInfo=re,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/menu-bar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A React menu bar component with authentication support and theming",
|
|
6
6
|
"keywords": [
|
|
@@ -58,9 +58,6 @@
|
|
|
58
58
|
"react-dom": "^19.1.0",
|
|
59
59
|
"react-router-dom": "^7.7.1"
|
|
60
60
|
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"lucide-react": "^0.561.0"
|
|
63
|
-
},
|
|
64
61
|
"devDependencies": {
|
|
65
62
|
"@tailwindcss/cli": "^4.1.18",
|
|
66
63
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -71,11 +68,11 @@
|
|
|
71
68
|
"postcss": "^8.5.6",
|
|
72
69
|
"react": "^19.2.3",
|
|
73
70
|
"react-dom": "^19.2.3",
|
|
74
|
-
"react-router-dom": "^7.
|
|
71
|
+
"react-router-dom": "^7.11.0",
|
|
75
72
|
"rimraf": "^6.1.2",
|
|
76
73
|
"tailwindcss": "^4.1.18",
|
|
77
74
|
"typescript": "^5.9.3",
|
|
78
|
-
"vite": "^7.
|
|
75
|
+
"vite": "^7.3.0",
|
|
79
76
|
"vite-plugin-dts": "^3.9.1",
|
|
80
77
|
"vite-tsconfig-paths": "^5.1.4"
|
|
81
78
|
},
|