@aiquants/menu-bar 1.2.0 → 1.5.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/MenuBar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IMenu } from './contents/MenuList';
1
+ import { IMenu, MenuNavigationPayload } from './contents/MenuList';
2
2
  import { Theme } from './types';
3
3
 
4
4
  /**
@@ -11,6 +11,7 @@ import { Theme } from './types';
11
11
  * @property {boolean} [isMenuhide] - Whether to hide the menu. メニューを非表示にするかどうか。
12
12
  * @property {Theme} theme - The current theme.
13
13
  * @property {() => void} toggleTheme - Function to toggle the theme.
14
+ * @property {(payload: MenuNavigationPayload) => void} [onMenuNavigate] - Function to receive menu navigation events. メニュー遷移イベントを受け取る関数。
14
15
  */
15
16
  interface IMenuBarProps {
16
17
  menuList: IMenu[];
@@ -19,6 +20,7 @@ interface IMenuBarProps {
19
20
  isMenuhide?: boolean;
20
21
  theme: Theme;
21
22
  toggleTheme: () => void;
23
+ onMenuNavigate?(payload: MenuNavigationPayload): void;
22
24
  }
23
25
  /**
24
26
  * @function MenuBar
@@ -1,5 +1,5 @@
1
1
  import { Theme } from '../types';
2
- import { IMenu } from './MenuList';
2
+ import { IMenu, MenuNavigationPayload } from './MenuList';
3
3
 
4
4
  /**
5
5
  * @interface IMenuContentProps
@@ -8,7 +8,7 @@ import { IMenu } from './MenuList';
8
8
  * @property {IMenu[]} menuList - The list of menu items. メニュー項目のリスト。
9
9
  * @property {React.ReactNode} [menuHeader] - The header content of the menu. メニューのヘッダーコンテンツ。
10
10
  * @property {boolean} open - Whether the menu is open. メニューが開いているかどうか。
11
- * @property {() => void} onMenuSelected - Function to handle menu item selection. メニュー項目選択を処理する関数。
11
+ * @property {(payload: MenuNavigationPayload) => void} onMenuSelected - Function to handle menu item selection. メニュー項目選択を処理する関数。
12
12
  * @property {() => void} onClickSignout - Function to handle sign out. サインアウトを処理する関数。
13
13
  * @property {Theme} theme - The current theme.
14
14
  * @property {() => void} toggleTheme - Function to toggle the theme.
@@ -17,7 +17,7 @@ interface IMenuContentProps {
17
17
  menuList: IMenu[];
18
18
  menuHeader?: React.ReactNode;
19
19
  open: boolean;
20
- onMenuSelected(): void;
20
+ onMenuSelected(payload: MenuNavigationPayload): void;
21
21
  onClickSignout(): void;
22
22
  theme: Theme;
23
23
  toggleTheme: () => void;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module MenuList
3
+ * @description This module provides the list of menu items.
4
+ * @description このモジュールは、メニュー項目のリストを提供します。
5
+ */
1
6
  /**
2
7
  * @interface ISubmenu
3
8
  * @description Interface for a submenu item.
@@ -30,16 +35,27 @@ export interface IMenu {
30
35
  href?: string;
31
36
  submenu: ISubmenu[];
32
37
  }
38
+ /**
39
+ * @typedef MenuNavigationPayload
40
+ * @description Payload emitted when a menu or submenu item is selected.
41
+ * @description メニューまたはサブメニューが選択された際に発火するペイロード。
42
+ * @property {{ id: number; title: string; href?: string }} menu - Selected menu metadata.
43
+ * @property {{ subid: number; title?: string; href: string; mark?: string; new?: boolean }} [submenu] - Selected submenu metadata.
44
+ */
45
+ export type MenuNavigationPayload = {
46
+ menu: Pick<IMenu, "id" | "title" | "href">;
47
+ submenu?: Pick<ISubmenu, "subid" | "title" | "href" | "mark" | "new">;
48
+ };
33
49
  /**
34
50
  * @interface IMenuListProps
35
51
  * @description Props for the MenuList component.
36
52
  * @description MenuList コンポーネントの Props。
37
53
  * @property {IMenu[]} menuList - The list of menu items. メニュー項目のリスト。
38
- * @property {() => void} [onMenuSelected] - Function to handle menu item selection. メニュー項目選択を処理する関数。
54
+ * @property {(payload: MenuNavigationPayload) => void} [onMenuSelected] - Function to handle menu item selection. メニュー項目選択を処理する関数。
39
55
  */
40
56
  interface IMenuListProps {
41
57
  menuList: IMenu[];
42
- onMenuSelected?(): void;
58
+ onMenuSelected?(payload: MenuNavigationPayload): void;
43
59
  }
44
60
  /**
45
61
  * @function MenuList
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { LinkProps, SessionInfoProps } from './components/SessionInfo';
2
2
  export { DefaultLink, SessionInfo } from './components/SessionInfo';
3
- export type { IMenu, ISubmenu } from './contents/MenuList';
3
+ export type { IMenu, ISubmenu, MenuNavigationPayload } from './contents/MenuList';
4
4
  export { MenuBar } from './MenuBar';
5
5
  export type { Theme } from './types';
6
6
  export type { UserProfile } from './types/user';
package/dist/index.es.js CHANGED
@@ -1,112 +1,94 @@
1
- import le, { useState as G, useCallback as v, useMemo as ce, useRef as j, useEffect as X } from "react";
2
- import { Link as B } from "react-router-dom";
3
- import { Link as ie, Lock as ue, Download as de, BarChart as fe, Table as me, FileText as z } from "lucide-react";
4
- var S = { exports: {} }, N = {};
5
- /**
6
- * @license React
7
- * react-jsx-runtime.production.js
8
- *
9
- * Copyright (c) Meta Platforms, Inc. and affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */
14
- var U;
15
- function xe() {
16
- if (U) return N;
17
- U = 1;
18
- var s = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
19
- function o(f, m, l) {
20
- var c = null;
21
- if (l !== void 0 && (c = "" + l), m.key !== void 0 && (c = "" + m.key), "key" in m) {
22
- l = {};
23
- for (var n in m)
24
- n !== "key" && (l[n] = m[n]);
25
- } else l = m;
26
- return m = l.ref, {
27
- $$typeof: s,
1
+ import ie, { useState as X, useCallback as g, useMemo as ce, useRef as E, useEffect as B } from "react";
2
+ import { Link as ue, Lock as de, Download as fe, BarChart as me, Table as xe, FileText as U } from "lucide-react";
3
+ import { Link as H } from "react-router-dom";
4
+ var O = { exports: {} }, N = {};
5
+ var J;
6
+ function pe() {
7
+ if (J) return N;
8
+ J = 1;
9
+ var t = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
10
+ function a(f, i, c) {
11
+ var u = null;
12
+ if (c !== void 0 && (u = "" + c), i.key !== void 0 && (u = "" + i.key), "key" in i) {
13
+ c = {};
14
+ for (var s in i)
15
+ s !== "key" && (c[s] = i[s]);
16
+ } else c = i;
17
+ return i = c.ref, {
18
+ $$typeof: t,
28
19
  type: f,
29
- key: c,
30
- ref: m !== void 0 ? m : null,
31
- props: l
20
+ key: u,
21
+ ref: i !== void 0 ? i : null,
22
+ props: c
32
23
  };
33
24
  }
34
- return N.Fragment = a, N.jsx = o, N.jsxs = o, N;
25
+ return N.Fragment = o, N.jsx = a, N.jsxs = a, N;
35
26
  }
36
27
  var R = {};
37
- /**
38
- * @license React
39
- * react-jsx-runtime.development.js
40
- *
41
- * Copyright (c) Meta Platforms, Inc. and affiliates.
42
- *
43
- * This source code is licensed under the MIT license found in the
44
- * LICENSE file in the root directory of this source tree.
45
- */
46
- var J;
47
- function pe() {
48
- return J || (J = 1, process.env.NODE_ENV !== "production" && (function() {
49
- function s(e) {
28
+ var V;
29
+ function he() {
30
+ return V || (V = 1, process.env.NODE_ENV !== "production" && (function() {
31
+ function t(e) {
50
32
  if (e == null) return null;
51
33
  if (typeof e == "function")
52
- return e.$$typeof === se ? null : e.displayName || e.name || null;
34
+ return e.$$typeof === oe ? null : e.displayName || e.name || null;
53
35
  if (typeof e == "string") return e;
54
36
  switch (e) {
55
37
  case _:
56
38
  return "Fragment";
57
- case g:
39
+ case k:
58
40
  return "Profiler";
59
41
  case C:
60
42
  return "StrictMode";
61
- case ee:
62
- return "Suspense";
63
43
  case re:
44
+ return "Suspense";
45
+ case te:
64
46
  return "SuspenseList";
65
- case ne:
47
+ case se:
66
48
  return "Activity";
67
49
  }
68
50
  if (typeof e == "object")
69
51
  switch (typeof e.tag == "number" && console.error(
70
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
53
  ), e.$$typeof) {
72
- case O:
54
+ case S:
73
55
  return "Portal";
74
- case Q:
56
+ case K:
75
57
  return e.displayName || "Context";
76
- case Z:
58
+ case Q:
77
59
  return (e._context.displayName || "Context") + ".Consumer";
78
- case K:
79
- var t = e.render;
80
- return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
81
- case te:
82
- return t = e.displayName || null, t !== null ? t : s(e.type) || "Memo";
60
+ case ee:
61
+ var n = e.render;
62
+ return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
63
+ case ne:
64
+ return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
83
65
  case A:
84
- t = e._payload, e = e._init;
66
+ n = e._payload, e = e._init;
85
67
  try {
86
- return s(e(t));
68
+ return t(e(n));
87
69
  } catch {
88
70
  }
89
71
  }
90
72
  return null;
91
73
  }
92
- function a(e) {
74
+ function o(e) {
93
75
  return "" + e;
94
76
  }
95
- function o(e) {
77
+ function a(e) {
96
78
  try {
97
- a(e);
98
- var t = !1;
79
+ o(e);
80
+ var n = !1;
99
81
  } catch {
100
- t = !0;
82
+ n = !0;
101
83
  }
102
- if (t) {
103
- t = console;
104
- var u = t.error, x = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
105
- return u.call(
106
- t,
84
+ if (n) {
85
+ n = console;
86
+ var d = n.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
87
+ return d.call(
88
+ n,
107
89
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
- x
109
- ), a(e);
90
+ m
91
+ ), o(e);
110
92
  }
111
93
  }
112
94
  function f(e) {
@@ -114,55 +96,55 @@ function pe() {
114
96
  if (typeof e == "object" && e !== null && e.$$typeof === A)
115
97
  return "<...>";
116
98
  try {
117
- var t = s(e);
118
- return t ? "<" + t + ">" : "<...>";
99
+ var n = t(e);
100
+ return n ? "<" + n + ">" : "<...>";
119
101
  } catch {
120
102
  return "<...>";
121
103
  }
122
104
  }
123
- function m() {
105
+ function i() {
124
106
  var e = P.A;
125
107
  return e === null ? null : e.getOwner();
126
108
  }
127
- function l() {
109
+ function c() {
128
110
  return Error("react-stack-top-frame");
129
111
  }
130
- function c(e) {
131
- if (I.call(e, "key")) {
132
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
133
- if (t && t.isReactWarning) return !1;
112
+ function u(e) {
113
+ if (D.call(e, "key")) {
114
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
115
+ if (n && n.isReactWarning) return !1;
134
116
  }
135
117
  return e.key !== void 0;
136
118
  }
137
- function n(e, t) {
138
- function u() {
139
- D || (D = !0, console.error(
119
+ function s(e, n) {
120
+ function d() {
121
+ Y || (Y = !0, console.error(
140
122
  "%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)",
141
- t
123
+ n
142
124
  ));
143
125
  }
144
- u.isReactWarning = !0, Object.defineProperty(e, "key", {
145
- get: u,
126
+ d.isReactWarning = !0, Object.defineProperty(e, "key", {
127
+ get: d,
146
128
  configurable: !0
147
129
  });
148
130
  }
149
- function i() {
150
- var e = s(this.type);
151
- return Y[e] || (Y[e] = !0, console.error(
131
+ function l() {
132
+ var e = t(this.type);
133
+ return $[e] || ($[e] = !0, console.error(
152
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."
153
135
  )), e = this.props.ref, e !== void 0 ? e : null;
154
136
  }
155
- function h(e, t, u, x, T, L) {
156
- var p = u.ref;
137
+ function h(e, n, d, m, T, L) {
138
+ var x = d.ref;
157
139
  return e = {
158
- $$typeof: E,
140
+ $$typeof: w,
159
141
  type: e,
160
- key: t,
161
- props: u,
162
- _owner: x
163
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(e, "ref", {
142
+ key: n,
143
+ props: d,
144
+ _owner: m
145
+ }, (x !== void 0 ? x : null) !== null ? Object.defineProperty(e, "ref", {
164
146
  enumerable: !1,
165
- get: i
147
+ get: l
166
148
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
167
149
  configurable: !1,
168
150
  enumerable: !1,
@@ -185,169 +167,208 @@ function pe() {
185
167
  value: L
186
168
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
187
169
  }
188
- function d(e, t, u, x, T, L) {
189
- var p = t.children;
190
- if (p !== void 0)
191
- if (x)
192
- if (oe(p)) {
193
- for (x = 0; x < p.length; x++)
194
- k(p[x]);
195
- Object.freeze && Object.freeze(p);
170
+ function p(e, n, d, m, T, L) {
171
+ var x = n.children;
172
+ if (x !== void 0)
173
+ if (m)
174
+ if (ae(x)) {
175
+ for (m = 0; m < x.length; m++)
176
+ b(x[m]);
177
+ Object.freeze && Object.freeze(x);
196
178
  } else
197
179
  console.error(
198
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."
199
181
  );
200
- else k(p);
201
- if (I.call(t, "key")) {
202
- p = s(e);
203
- var w = Object.keys(t).filter(function(ae) {
204
- return ae !== "key";
182
+ else b(x);
183
+ if (D.call(n, "key")) {
184
+ x = t(e);
185
+ var j = Object.keys(n).filter(function(le) {
186
+ return le !== "key";
205
187
  });
206
- x = 0 < w.length ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}", W[p + x] || (w = 0 < w.length ? "{" + w.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ m = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", z[x + m] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
207
189
  `A props object containing a "key" prop is being spread into JSX:
208
190
  let props = %s;
209
191
  <%s {...props} />
210
192
  React keys must be passed directly to JSX without using spread:
211
193
  let props = %s;
212
194
  <%s key={someKey} {...props} />`,
195
+ m,
213
196
  x,
214
- p,
215
- w,
216
- p
217
- ), W[p + x] = !0);
197
+ j,
198
+ x
199
+ ), z[x + m] = !0);
218
200
  }
219
- if (p = null, u !== void 0 && (o(u), p = "" + u), c(t) && (o(t.key), p = "" + t.key), "key" in t) {
220
- u = {};
221
- for (var q in t)
222
- q !== "key" && (u[q] = t[q]);
223
- } else u = t;
224
- return p && n(
225
- u,
201
+ if (x = null, d !== void 0 && (a(d), x = "" + d), u(n) && (a(n.key), x = "" + n.key), "key" in n) {
202
+ d = {};
203
+ for (var q in n)
204
+ q !== "key" && (d[q] = n[q]);
205
+ } else d = n;
206
+ return x && s(
207
+ d,
226
208
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
227
209
  ), h(
228
210
  e,
229
- p,
230
- u,
231
- m(),
211
+ x,
212
+ d,
213
+ i(),
232
214
  T,
233
215
  L
234
216
  );
235
217
  }
236
- function k(e) {
237
- b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
238
- }
239
218
  function b(e) {
240
- return typeof e == "object" && e !== null && e.$$typeof === E;
219
+ y(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? y(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
220
+ }
221
+ function y(e) {
222
+ return typeof e == "object" && e !== null && e.$$typeof === w;
241
223
  }
242
- var y = le, E = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), Q = Symbol.for("react.context"), K = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), re = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), se = Symbol.for("react.client.reference"), P = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, oe = Array.isArray, M = console.createTask ? console.createTask : function() {
224
+ var v = ie, w = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), Q = Symbol.for("react.consumer"), K = Symbol.for("react.context"), ee = Symbol.for("react.forward_ref"), re = Symbol.for("react.suspense"), te = Symbol.for("react.suspense_list"), ne = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), se = Symbol.for("react.activity"), oe = Symbol.for("react.client.reference"), P = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, ae = Array.isArray, M = console.createTask ? console.createTask : function() {
243
225
  return null;
244
226
  };
245
- y = {
227
+ v = {
246
228
  react_stack_bottom_frame: function(e) {
247
229
  return e();
248
230
  }
249
231
  };
250
- var D, Y = {}, $ = y.react_stack_bottom_frame.bind(
251
- y,
252
- l
253
- )(), F = M(f(l)), W = {};
254
- R.Fragment = _, R.jsx = function(e, t, u) {
255
- var x = 1e4 > P.recentlyCreatedOwnerStacks++;
256
- return d(
232
+ var Y, $ = {}, F = v.react_stack_bottom_frame.bind(
233
+ v,
234
+ c
235
+ )(), W = M(f(c)), z = {};
236
+ R.Fragment = _, R.jsx = function(e, n, d) {
237
+ var m = 1e4 > P.recentlyCreatedOwnerStacks++;
238
+ return p(
257
239
  e,
258
- t,
259
- u,
240
+ n,
241
+ d,
260
242
  !1,
261
- x ? Error("react-stack-top-frame") : $,
262
- x ? M(f(e)) : F
243
+ m ? Error("react-stack-top-frame") : F,
244
+ m ? M(f(e)) : W
263
245
  );
264
- }, R.jsxs = function(e, t, u) {
265
- var x = 1e4 > P.recentlyCreatedOwnerStacks++;
266
- return d(
246
+ }, R.jsxs = function(e, n, d) {
247
+ var m = 1e4 > P.recentlyCreatedOwnerStacks++;
248
+ return p(
267
249
  e,
268
- t,
269
- u,
250
+ n,
251
+ d,
270
252
  !0,
271
- x ? Error("react-stack-top-frame") : $,
272
- x ? M(f(e)) : F
253
+ m ? Error("react-stack-top-frame") : F,
254
+ m ? M(f(e)) : W
273
255
  );
274
256
  };
275
257
  })()), R;
276
258
  }
277
- var V;
278
- function he() {
279
- return V || (V = 1, process.env.NODE_ENV === "production" ? S.exports = xe() : S.exports = pe()), S.exports;
259
+ var G;
260
+ function be() {
261
+ return G || (G = 1, process.env.NODE_ENV === "production" ? O.exports = pe() : O.exports = he()), O.exports;
280
262
  }
281
- var r = he();
282
- const be = ({ to: s, className: a, children: o }) => /* @__PURE__ */ r.jsx("a", { href: s, className: a, children: o }), Te = (s) => {
283
- const { user: a, LinkComponent: o = be } = s;
284
- return /* @__PURE__ */ r.jsx("div", { className: "max-h-20 max-w-52", children: /* @__PURE__ */ r.jsx("div", { className: "flex grow flex-col", children: a ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
263
+ var r = be();
264
+ const ve = ({ to: t, className: o, children: a }) => /* @__PURE__ */ r.jsx("a", { href: t, className: o, children: a }), Oe = (t) => {
265
+ const { user: o, LinkComponent: a = ve } = t;
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: [
285
267
  /* @__PURE__ */ r.jsxs("div", { className: "flex flex-row", children: [
286
- /* @__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: a.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, "aria-label": "profile photo" }) }),
287
269
  /* @__PURE__ */ r.jsxs("div", { className: "mx-1 flex flex-col", children: [
288
- /* @__PURE__ */ r.jsx(o, { className: "aiquants-session-link my-1 rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィールを編集" }),
289
- /* @__PURE__ */ r.jsx(o, { className: "aiquants-session-link rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィール" }),
290
- /* @__PURE__ */ 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" })
270
+ /* @__PURE__ */ r.jsx(a, { className: "aiquants-session-link my-1 rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィールを編集" }),
271
+ /* @__PURE__ */ r.jsx(a, { className: "aiquants-session-link rounded-lg px-2 text-center text-xs", to: "/", children: "プロフィール" }),
272
+ /* @__PURE__ */ 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" })
291
273
  ] })
292
274
  ] }),
293
- /* @__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: a.displayName })
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 })
294
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: "ログインはこちら" }) }) });
295
- }, H = new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/), ve = {
296
- report: z,
297
- slip: z,
298
- table: me,
299
- chart: fe,
300
- download: de,
301
- lock: ue,
302
- href: ie
303
- }, ge = ({ mark: s, children: a }) => {
304
- const o = s ? ve[s] : void 0;
305
- return o ? /* @__PURE__ */ r.jsxs("div", { className: "flex flex-nowrap items-center", children: [
306
- /* @__PURE__ */ r.jsx(o, { className: "h-4 w-4" }),
307
- /* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-link mx-1 hover:underline", children: a })
308
- ] }) : /* @__PURE__ */ r.jsx("span", { className: "mx-1 text-sky-600 hover:underline dark:text-sky-400", children: a });
309
- }, ke = ({ item: s, onMenuSelected: a }) => {
310
- if (s.href === "separator")
277
+ }, Z = new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/), ge = {
278
+ report: U,
279
+ slip: U,
280
+ table: xe,
281
+ chart: me,
282
+ download: fe,
283
+ lock: de,
284
+ href: ue
285
+ }, ke = ({ mark: t, children: o }) => {
286
+ const a = t ? ge[t] : void 0;
287
+ return a ? /* @__PURE__ */ r.jsxs("div", { className: "flex flex-nowrap items-center", children: [
288
+ /* @__PURE__ */ r.jsx(a, { className: "h-4 w-4" }),
289
+ /* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-link mx-1 hover:underline", children: o })
290
+ ] }) : /* @__PURE__ */ r.jsx("span", { className: "mx-1 text-sky-600 hover:underline dark:text-sky-400", children: o });
291
+ }, I = (t, o) => o ? {
292
+ menu: {
293
+ id: t.id,
294
+ title: t.title,
295
+ href: t.href
296
+ },
297
+ submenu: {
298
+ subid: o.subid,
299
+ title: o.title,
300
+ href: o.href,
301
+ mark: o.mark,
302
+ new: o.new
303
+ }
304
+ } : {
305
+ menu: {
306
+ id: t.id,
307
+ title: t.title,
308
+ href: t.href
309
+ }
310
+ }, ye = ({ item: t, parentMenu: o, onMenuSelected: a }) => {
311
+ if (t.href === "separator")
311
312
  return /* @__PURE__ */ r.jsx("hr", { className: "aiquants-menu-separator mx-2 my-1 h-px" });
312
- const o = /* @__PURE__ */ r.jsx(ge, { mark: s.mark, children: s.title }), f = {
313
- onClick: a
313
+ const f = /* @__PURE__ */ r.jsx(ke, { mark: t.mark, children: t.title }), i = {
314
+ onClick: () => {
315
+ a && a(I(o, t));
316
+ }
314
317
  };
315
- return s.new ? /* @__PURE__ */ r.jsx("a", { href: s.href, rel: "noopener noreferrer", target: "_blank", ...f, children: o }) : H.test(s.href) ? /* @__PURE__ */ r.jsx("a", { href: s.href, ...f, children: o }) : /* @__PURE__ */ r.jsx(B, { to: s.href, ...f, children: o });
316
- }, ye = (s) => {
317
- const { menuList: a, onMenuSelected: o } = s, [f, m] = G(null), l = v((n) => {
318
- m((i) => i === n ? null : n);
319
- }, []), c = ce(() => /* @__PURE__ */ r.jsx(r.Fragment, { children: a.map((n) => /* @__PURE__ */ r.jsx("div", { children: n.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: H.test(n.href) ? /* @__PURE__ */ r.jsx("a", { href: n.href, onClick: o, children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: n.title }) }) : /* @__PURE__ */ r.jsx(B, { to: n.href, onClick: o, children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: n.title }) }) }) : /* @__PURE__ */ r.jsxs("details", { className: "menu-accordion-details", open: n.id === f, children: [
318
+ return t.new ? /* @__PURE__ */ r.jsx("a", { href: t.href, rel: "noopener noreferrer", target: "_blank", ...i, children: f }) : Z.test(t.href) ? /* @__PURE__ */ r.jsx("a", { href: t.href, ...i, children: f }) : /* @__PURE__ */ r.jsx(H, { to: t.href, ...i, children: f });
319
+ }, we = (t) => {
320
+ const { menuList: o, onMenuSelected: a } = t, [f, i] = X(null), c = g((s) => {
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: Z.test(s.href) ? /* @__PURE__ */ r.jsx(
323
+ "a",
324
+ {
325
+ href: s.href,
326
+ onClick: () => {
327
+ a && a(I(s));
328
+ },
329
+ children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: s.title })
330
+ }
331
+ ) : /* @__PURE__ */ r.jsx(
332
+ H,
333
+ {
334
+ to: s.href,
335
+ onClick: () => {
336
+ a && a(I(s));
337
+ },
338
+ children: /* @__PURE__ */ r.jsx("span", { className: "aiquants-menu-link hover:underline", children: s.title })
339
+ }
340
+ ) }) : /* @__PURE__ */ r.jsxs("details", { className: "menu-accordion-details", open: s.id === f, children: [
320
341
  /* @__PURE__ */ r.jsx(
321
342
  "summary",
322
343
  {
323
344
  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-['']",
324
- onClick: (i) => {
325
- i.preventDefault(), l(n.id);
345
+ onClick: (l) => {
346
+ l.preventDefault(), c(s.id);
326
347
  },
327
- onKeyDown: (i) => {
328
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), l(n.id));
348
+ onKeyDown: (l) => {
349
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), c(s.id));
329
350
  },
330
- children: /* @__PURE__ */ r.jsx("span", { children: n.title })
351
+ children: /* @__PURE__ */ r.jsx("span", { children: s.title })
331
352
  }
332
353
  ),
333
- /* @__PURE__ */ r.jsx("div", { className: "aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md", children: n.submenu.map((i) => /* @__PURE__ */ r.jsx("div", { className: "menu-accordion-container block w-full whitespace-nowrap text-sm", children: /* @__PURE__ */ r.jsx(ke, { item: i, onMenuSelected: o }) }, i.subid)) })
334
- ] }) }, n.id)) }), [a, o, f, l]);
335
- return /* @__PURE__ */ r.jsx("div", { className: "hidden-scrollbar h-0 grow overflow-y-scroll", children: c });
336
- }, we = (s) => {
337
- const { menuList: a, menuHeader: o, open: f, onMenuSelected: m, onClickSignout: l, theme: c, toggleTheme: n } = s;
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(ye, { item: l, parentMenu: s, onMenuSelected: a }) }, l.subid)) })
355
+ ] }) }, s.id)) }), [o, a, f, c]);
356
+ return /* @__PURE__ */ r.jsx("div", { className: "hidden-scrollbar h-0 grow overflow-y-scroll", children: u });
357
+ }, je = (t) => {
358
+ const { menuList: o, menuHeader: a, open: f, onMenuSelected: i, onClickSignout: c, theme: u, toggleTheme: s } = t;
338
359
  return /* @__PURE__ */ r.jsxs("div", { className: `aiquants-menu-content fixed top-0 right-0 z-2147483642 flex min-h-screen w-[250px] select-none flex-col transition-transform duration-500 ${f ? "aiquants-menu-translate-x-0" : "aiquants-menu-translate-x-250"}`, children: [
339
- /* @__PURE__ */ r.jsx("div", { className: "flex h-[100px] flex-col", children: o }),
340
- /* @__PURE__ */ r.jsx("div", { className: "flex grow flex-col", children: /* @__PURE__ */ r.jsx(ye, { menuList: a, onMenuSelected: m }) }),
360
+ /* @__PURE__ */ r.jsx("div", { className: "flex h-[100px] flex-col", children: a }),
361
+ /* @__PURE__ */ r.jsx("div", { className: "flex grow flex-col", children: /* @__PURE__ */ r.jsx(we, { menuList: o, onMenuSelected: i }) }),
341
362
  /* @__PURE__ */ r.jsx("div", { className: "px-4 pt-2 pb-4", children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
342
363
  /* @__PURE__ */ r.jsxs(
343
364
  "button",
344
365
  {
345
366
  type: "button",
346
- onClick: n,
367
+ onClick: s,
347
368
  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",
348
369
  children: [
349
- /* @__PURE__ */ 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: /* @__PURE__ */ r.jsx("span", { className: "text-sm transition-transform duration-300 group-hover:scale-110", children: c === "dark" ? "🌞" : "🌙" }) }),
350
- /* @__PURE__ */ 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: c === "dark" ? "Light" : "Dark" }),
370
+ /* @__PURE__ */ 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: /* @__PURE__ */ r.jsx("span", { className: "text-sm transition-transform duration-300 group-hover:scale-110", children: u === "dark" ? "🌞" : "🌙" }) }),
371
+ /* @__PURE__ */ 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: u === "dark" ? "Light" : "Dark" }),
351
372
  /* @__PURE__ */ 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" })
352
373
  ]
353
374
  }
@@ -357,67 +378,67 @@ const be = ({ to: s, className: a, children: o }) => /* @__PURE__ */ r.jsx("a",
357
378
  {
358
379
  type: "button",
359
380
  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",
360
- onClick: l,
381
+ onClick: c,
361
382
  children: "サインアウト"
362
383
  }
363
384
  )
364
385
  ] }) })
365
386
  ] });
366
- }, je = (s) => {
367
- const { isOverlay: a, onOverlayClick: o } = s;
368
- return /* @__PURE__ */ 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 });
369
- }, Ee = (s) => {
370
- const { open: a, onMenuOpen: o, onMenuClose: f, theme: m } = s, l = j(a), c = j(null), n = j(null), i = j(null), h = j(null), d = j(null), k = v(() => {
371
- if (c.current && n.current && i.current && h.current && d.current) {
372
- const g = m === "dark" ? "#fff" : "#000";
373
- c.current.style.backgroundColor = g, c.current.style.width = "100%", c.current.style.height = "3px", c.current.style.transform = "", n.current.style.opacity = "1", n.current.style.backgroundColor = g, i.current.style.opacity = "1", i.current.style.backgroundColor = g, h.current.style.backgroundColor = g, h.current.style.width = "100%", h.current.style.height = "3px", h.current.style.transform = "", d.current.style.color = g, d.current.classList.remove("after:content-['close']"), d.current.classList.remove("after:ml-0.5"), d.current.classList.add("after:content-['menu']"), d.current.classList.add("after:-ml-0.5"), l.current = !0;
387
+ }, Ee = (t) => {
388
+ const { isOverlay: o, onOverlayClick: a } = t;
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
+ }, _e = (t) => {
391
+ const { open: o, onMenuOpen: a, onMenuClose: f, theme: i } = t, c = E(o), u = E(null), s = E(null), l = E(null), h = E(null), p = E(null), b = g(() => {
392
+ if (u.current && s.current && l.current && h.current && p.current) {
393
+ const k = i === "dark" ? "#fff" : "#000";
394
+ u.current.style.backgroundColor = k, u.current.style.width = "100%", u.current.style.height = "3px", u.current.style.transform = "", s.current.style.opacity = "1", s.current.style.backgroundColor = k, l.current.style.opacity = "1", l.current.style.backgroundColor = k, h.current.style.backgroundColor = k, h.current.style.width = "100%", h.current.style.height = "3px", h.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"), c.current = !0;
374
395
  }
375
- }, [m]), b = v(() => {
376
- c.current && n.current && i.current && h.current && d.current && (c.current.style.backgroundColor = "#fff", c.current.style.width = "32px", c.current.style.height = "4px", c.current.style.transform = "translateY(9px) rotate(-45deg)", n.current.style.opacity = "0", i.current.style.opacity = "0", h.current.style.backgroundColor = "#fff", h.current.style.width = "32px", h.current.style.height = "4px", h.current.style.transform = "translateY(-9px) rotate(45deg)", d.current.style.color = "#fff", d.current.classList.remove("after:content-['menu']"), d.current.classList.remove("after:-ml-0.5"), d.current.classList.add("after:content-['close']"), d.current.classList.add("after:ml-0.5"), l.current = !1);
377
- }, []), y = v(() => {
378
- k(), f && f();
379
- }, [k, f]), E = v(() => {
380
- b(), o && o();
381
- }, [b, o]), O = v(() => {
382
- l.current ? E() : y();
383
- }, [y, E]), _ = v((g) => {
384
- g.currentTarget.blur();
385
- }, []), C = v((g) => {
386
- g.preventDefault();
396
+ }, [i]), y = g(() => {
397
+ u.current && s.current && l.current && h.current && p.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", h.current.style.backgroundColor = "#fff", h.current.style.width = "32px", h.current.style.height = "4px", h.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"), c.current = !1);
398
+ }, []), v = g(() => {
399
+ b(), f && f();
400
+ }, [b, f]), w = g(() => {
401
+ y(), a && a();
402
+ }, [y, a]), S = g(() => {
403
+ c.current ? w() : v();
404
+ }, [v, w]), _ = g((k) => {
405
+ k.currentTarget.blur();
406
+ }, []), C = g((k) => {
407
+ k.preventDefault();
387
408
  }, []);
388
- return X(() => {
389
- a ? k() : b();
390
- }, [a, k, b]), /* @__PURE__ */ r.jsxs("button", { type: "button", className: "fixed top-5 right-5 z-2147483648 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden", onClick: O, onFocus: _, onMouseDown: C, tabIndex: -1, children: [
391
- /* @__PURE__ */ r.jsx("span", { className: "absolute top-0 left-0 box-border inline-block h-[3px] w-full select-none", ref: c }),
392
- /* @__PURE__ */ r.jsx("span", { className: "absolute top-[6px] left-0 box-border inline-block h-[3px] w-full select-none", ref: n }),
393
- /* @__PURE__ */ r.jsx("span", { className: "absolute top-[12px] left-0 box-border inline-block h-[3px] w-full select-none", ref: i }),
409
+ return B(() => {
410
+ o ? b() : y();
411
+ }, [o, b, y]), /* @__PURE__ */ r.jsxs("button", { type: "button", className: "fixed top-5 right-5 z-2147483648 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden", onClick: S, onFocus: _, onMouseDown: C, tabIndex: -1, children: [
412
+ /* @__PURE__ */ r.jsx("span", { className: "absolute top-0 left-0 box-border inline-block h-[3px] w-full select-none", ref: u }),
413
+ /* @__PURE__ */ r.jsx("span", { className: "absolute top-[6px] left-0 box-border inline-block h-[3px] w-full select-none", ref: s }),
414
+ /* @__PURE__ */ r.jsx("span", { className: "absolute top-[12px] left-0 box-border inline-block h-[3px] w-full select-none", ref: l }),
394
415
  /* @__PURE__ */ r.jsx("span", { className: "absolute top-[18px] left-0 box-border inline-block h-[3px] w-full select-none", ref: h }),
395
- /* @__PURE__ */ r.jsx("div", { className: "absolute w-full text-xs after:mt-2 after:block", ref: d })
416
+ /* @__PURE__ */ r.jsx("div", { className: "absolute w-full text-xs after:mt-2 after:block", ref: p })
396
417
  ] });
397
- }, Se = (s) => {
398
- const { menuList: a, menuHeader: o, onClickSignout: f, isMenuhide: m, theme: l, toggleTheme: c } = s, [n, i] = G(!1), h = v(() => {
399
- i(!0);
400
- }, []), d = v(() => {
401
- i(!1);
402
- }, []), k = v(() => {
403
- i(!1);
404
- }, []), b = v(
405
- (y) => {
406
- if (y.key === "Escape")
407
- return d(), !1;
418
+ }, Se = (t) => {
419
+ const { menuList: o, menuHeader: a, onClickSignout: f, isMenuhide: i, theme: c, toggleTheme: u, onMenuNavigate: s } = t, [l, h] = X(!1), p = g(() => {
420
+ h(!0);
421
+ }, []), b = g(() => {
422
+ h(!1);
423
+ }, []), y = g((w) => {
424
+ s && s(w), h(!1);
425
+ }, [s]), v = g(
426
+ (w) => {
427
+ if (w.key === "Escape")
428
+ return b(), !1;
408
429
  },
409
- [d]
430
+ [b]
410
431
  );
411
- return X(() => (n ? window.addEventListener("keydown", b, { passive: !0 }) : window.removeEventListener("keydown", b), () => {
412
- window.removeEventListener("keydown", b);
413
- }), [n, b]), m ? /* @__PURE__ */ r.jsx(r.Fragment, {}) : /* @__PURE__ */ r.jsxs("div", { className: `aiquants-menu-bar ${l}`, children: [
414
- /* @__PURE__ */ r.jsx(Ee, { onMenuClose: d, onMenuOpen: h, open: !n, theme: l }),
415
- /* @__PURE__ */ r.jsx(we, { menuList: a, menuHeader: o, onClickSignout: f, onMenuSelected: k, open: n, theme: l, toggleTheme: c }),
416
- /* @__PURE__ */ r.jsx(je, { isOverlay: n, onOverlayClick: d })
432
+ return B(() => (l ? window.addEventListener("keydown", v, { passive: !0 }) : window.removeEventListener("keydown", v), () => {
433
+ window.removeEventListener("keydown", v);
434
+ }), [l, v]), i ? /* @__PURE__ */ r.jsx(r.Fragment, {}) : /* @__PURE__ */ r.jsxs("div", { className: `aiquants-menu-bar ${c}`, children: [
435
+ /* @__PURE__ */ r.jsx(_e, { onMenuClose: b, onMenuOpen: p, open: !l, theme: c }),
436
+ /* @__PURE__ */ r.jsx(je, { menuList: o, menuHeader: a, onClickSignout: f, onMenuSelected: y, open: l, theme: c, toggleTheme: u }),
437
+ /* @__PURE__ */ r.jsx(Ee, { isOverlay: l, onOverlayClick: b })
417
438
  ] });
418
439
  };
419
440
  export {
420
- be as DefaultLink,
441
+ ve as DefaultLink,
421
442
  Se as MenuBar,
422
- Te as SessionInfo
443
+ Oe as SessionInfo
423
444
  };
package/dist/index.umd.js CHANGED
@@ -1,22 +1,6 @@
1
- (function(k,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("react-router-dom"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","lucide-react"],a):(k=typeof globalThis<"u"?globalThis:k||self,a(k["@aiquants/menu-bar"]={},k.React,k.ReactRouterDOM,k["lucide-react"]))})(this,(function(k,a,Y,w){"use strict";var C={exports:{}},_={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var F;function Z(){if(F)return _;F=1;var s=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function o(m,x,c){var i=null;if(c!==void 0&&(i=""+c),x.key!==void 0&&(i=""+x.key),"key"in x){c={};for(var n in x)n!=="key"&&(c[n]=x[n])}else c=x;return x=c.ref,{$$typeof:s,type:m,key:i,ref:x!==void 0?x:null,props:c}}return _.Fragment=l,_.jsx=o,_.jsxs=o,_}var N={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var W;function Q(){return W||(W=1,process.env.NODE_ENV!=="production"&&(function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case g:return"Profiler";case A:return"StrictMode";case de:return"Suspense";case fe:return"SuspenseList";case xe: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 O:return"Portal";case ie:return e.displayName||"Context";case ce:return(e._context.displayName||"Context")+".Consumer";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return t=e.displayName||null,t!==null?t:s(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return s(e(t))}catch{}}return null}function l(e){return""+e}function o(e){try{l(e);var t=!1}catch{t=!0}if(t){t=console;var d=t.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return d.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),l(e)}}function m(e){if(e===T)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===P)return"<...>";try{var t=s(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function x(){var e=M.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function i(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function n(e,t){function d(){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)",t))}d.isReactWarning=!0,Object.defineProperty(e,"key",{get:d,configurable:!0})}function u(){var e=s(this.type);return q[e]||(q[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,t,d,p,S,I){var h=d.ref;return e={$$typeof:R,type:e,key:t,props:d,_owner:p},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:u}):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:I}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,t,d,p,S,I){var h=t.children;if(h!==void 0)if(p)if(he(h)){for(p=0;p<h.length;p++)y(h[p]);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 y(h);if(V.call(t,"key")){h=s(e);var E=Object.keys(t).filter(function(be){return be!=="key"});p=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",H[h+p]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(g,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):(g=typeof globalThis<"u"?globalThis:g||self,l(g["@aiquants/menu-bar"]={},g.React,g["lucide-react"],g.ReactRouterDOM))})(this,(function(g,l,E,F){"use strict";var C={exports:{}},N={};var W;function Q(){if(W)return N;W=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function a(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 N.Fragment=o,N.jsx=a,N.jsxs=a,N}var R={};var z;function K(){return z||(z=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case y:return"Profiler";case M:return"StrictMode";case fe:return"Suspense";case me: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 A:return"Portal";case ue:return e.displayName||"Context";case ie:return(e._context.displayName||"Context")+".Consumer";case de:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xe:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case P:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function o(e){return""+e}function a(e){try{o(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),o(e)}}function m(e){if(e===T)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===P)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function i(){var e=L.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function d(e){if(G.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(){q||(q=!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 B[e]||(B[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 p=f.ref;return e={$$typeof:j,type:e,key:n,props:f,_owner:x},(p!==void 0?p: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 h(e,n,f,x,S,D){var p=n.children;if(p!==void 0)if(x)if(be(p)){for(x=0;x<p.length;x++)v(p[x]);Object.freeze&&Object.freeze(p)}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(p);if(G.call(n,"key")){p=t(e);var _=Object.keys(n).filter(function(ve){return ve!=="key"});x=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",Z[p+x]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
2
  let props = %s;
19
3
  <%s {...props} />
20
4
  React keys must be passed directly to JSX without using spread:
21
5
  let props = %s;
22
- <%s key={someKey} {...props} />`,p,h,E,h),H[h+p]=!0)}if(h=null,d!==void 0&&(o(d),h=""+d),i(t)&&(o(t.key),h=""+t.key),"key"in t){d={};for(var D in t)D!=="key"&&(d[D]=t[D])}else d=t;return h&&n(d,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,h,d,x(),S,I)}function y(e){v(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===P&&(e._payload.status==="fulfilled"?v(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function v(e){return typeof e=="object"&&e!==null&&e.$$typeof===R}var j=a,R=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),ce=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),de=Symbol.for("react.suspense"),fe=Symbol.for("react.suspense_list"),me=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),pe=Symbol.for("react.client.reference"),M=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,he=Array.isArray,L=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(e){return e()}};var G,q={},B=j.react_stack_bottom_frame.bind(j,c)(),X=L(m(c)),H={};N.Fragment=T,N.jsx=function(e,t,d){var p=1e4>M.recentlyCreatedOwnerStacks++;return f(e,t,d,!1,p?Error("react-stack-top-frame"):B,p?L(m(e)):X)},N.jsxs=function(e,t,d){var p=1e4>M.recentlyCreatedOwnerStacks++;return f(e,t,d,!0,p?Error("react-stack-top-frame"):B,p?L(m(e)):X)}})()),N}var z;function K(){return z||(z=1,process.env.NODE_ENV==="production"?C.exports=Z():C.exports=Q()),C.exports}var r=K();const U=({to:s,className:l,children:o})=>r.jsx("a",{href:s,className:l,children:o}),$=s=>{const{user:l,LinkComponent:o=U}=s;return r.jsx("div",{className:"max-h-20 max-w-52",children:r.jsx("div",{className:"flex grow flex-col",children:l?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:l.photo,"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:l.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:"ログインはこちら"})})})},J=new RegExp(/(^https?:\/\/)|(\.(html|htm)?$)/),ee={report:w.FileText,slip:w.FileText,table:w.Table,chart:w.BarChart,download:w.Download,lock:w.Lock,href:w.Link},re=({mark:s,children:l})=>{const o=s?ee[s]: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:l})]}):r.jsx("span",{className:"mx-1 text-sky-600 hover:underline dark:text-sky-400",children:l})},te=({item:s,onMenuSelected:l})=>{if(s.href==="separator")return r.jsx("hr",{className:"aiquants-menu-separator mx-2 my-1 h-px"});const o=r.jsx(re,{mark:s.mark,children:s.title}),m={onClick:l};return s.new?r.jsx("a",{href:s.href,rel:"noopener noreferrer",target:"_blank",...m,children:o}):J.test(s.href)?r.jsx("a",{href:s.href,...m,children:o}):r.jsx(Y.Link,{to:s.href,...m,children:o})},ne=s=>{const{menuList:l,onMenuSelected:o}=s,[m,x]=a.useState(null),c=a.useCallback(n=>{x(u=>u===n?null:n)},[]),i=a.useMemo(()=>r.jsx(r.Fragment,{children:l.map(n=>r.jsx("div",{children:n.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:J.test(n.href)?r.jsx("a",{href:n.href,onClick:o,children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:n.title})}):r.jsx(Y.Link,{to:n.href,onClick:o,children:r.jsx("span",{className:"aiquants-menu-link hover:underline",children:n.title})})}):r.jsxs("details",{className:"menu-accordion-details",open:n.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:u=>{u.preventDefault(),c(n.id)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),c(n.id))},children:r.jsx("span",{children:n.title})}),r.jsx("div",{className:"aiquants-menu-submenu pointer-events-auto my-1 mr-1 ml-4 rounded p-2 shadow-md",children:n.submenu.map(u=>r.jsx("div",{className:"menu-accordion-container block w-full whitespace-nowrap text-sm",children:r.jsx(te,{item:u,onMenuSelected:o})},u.subid))})]})},n.id))}),[l,o,m,c]);return r.jsx("div",{className:"hidden-scrollbar h-0 grow overflow-y-scroll",children:i})},se=s=>{const{menuList:l,menuHeader:o,open:m,onMenuSelected:x,onClickSignout:c,theme:i,toggleTheme:n}=s;return r.jsxs("div",{className:`aiquants-menu-content fixed top-0 right-0 z-2147483642 flex min-h-screen 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(ne,{menuList:l,onMenuSelected:x})}),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:n,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:i==="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:i==="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:c,children:"サインアウト"})]})})]})},oe=s=>{const{isOverlay:l,onOverlayClick:o}=s;return r.jsx("button",{type:"button",className:`fixed inset-0 z-2147483640 cursor-default bg-black/50 transition-opacity duration-500 ${l?"opacity-100":"pointer-events-none opacity-0"}`,onClick:o})},ae=s=>{const{open:l,onMenuOpen:o,onMenuClose:m,theme:x}=s,c=a.useRef(l),i=a.useRef(null),n=a.useRef(null),u=a.useRef(null),b=a.useRef(null),f=a.useRef(null),y=a.useCallback(()=>{if(i.current&&n.current&&u.current&&b.current&&f.current){const g=x==="dark"?"#fff":"#000";i.current.style.backgroundColor=g,i.current.style.width="100%",i.current.style.height="3px",i.current.style.transform="",n.current.style.opacity="1",n.current.style.backgroundColor=g,u.current.style.opacity="1",u.current.style.backgroundColor=g,b.current.style.backgroundColor=g,b.current.style.width="100%",b.current.style.height="3px",b.current.style.transform="",f.current.style.color=g,f.current.classList.remove("after:content-['close']"),f.current.classList.remove("after:ml-0.5"),f.current.classList.add("after:content-['menu']"),f.current.classList.add("after:-ml-0.5"),c.current=!0}},[x]),v=a.useCallback(()=>{i.current&&n.current&&u.current&&b.current&&f.current&&(i.current.style.backgroundColor="#fff",i.current.style.width="32px",i.current.style.height="4px",i.current.style.transform="translateY(9px) rotate(-45deg)",n.current.style.opacity="0",u.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)",f.current.style.color="#fff",f.current.classList.remove("after:content-['menu']"),f.current.classList.remove("after:-ml-0.5"),f.current.classList.add("after:content-['close']"),f.current.classList.add("after:ml-0.5"),c.current=!1)},[]),j=a.useCallback(()=>{y(),m&&m()},[y,m]),R=a.useCallback(()=>{v(),o&&o()},[v,o]),O=a.useCallback(()=>{c.current?R():j()},[j,R]),T=a.useCallback(g=>{g.currentTarget.blur()},[]),A=a.useCallback(g=>{g.preventDefault()},[]);return a.useEffect(()=>{l?y():v()},[l,y,v]),r.jsxs("button",{type:"button",className:"fixed top-5 right-5 z-2147483648 inline-block h-[27px] w-[27px] cursor-pointer align-middle outline-hidden",onClick:O,onFocus:T,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:i}),r.jsx("span",{className:"absolute top-[6px] left-0 box-border inline-block h-[3px] w-full select-none",ref:n}),r.jsx("span",{className:"absolute top-[12px] left-0 box-border inline-block h-[3px] w-full select-none",ref:u}),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:f})]})},le=s=>{const{menuList:l,menuHeader:o,onClickSignout:m,isMenuhide:x,theme:c,toggleTheme:i}=s,[n,u]=a.useState(!1),b=a.useCallback(()=>{u(!0)},[]),f=a.useCallback(()=>{u(!1)},[]),y=a.useCallback(()=>{u(!1)},[]),v=a.useCallback(j=>{if(j.key==="Escape")return f(),!1},[f]);return a.useEffect(()=>(n?window.addEventListener("keydown",v,{passive:!0}):window.removeEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}),[n,v]),x?r.jsx(r.Fragment,{}):r.jsxs("div",{className:`aiquants-menu-bar ${c}`,children:[r.jsx(ae,{onMenuClose:f,onMenuOpen:b,open:!n,theme:c}),r.jsx(se,{menuList:l,menuHeader:o,onClickSignout:m,onMenuSelected:y,open:n,theme:c,toggleTheme:i}),r.jsx(oe,{isOverlay:n,onOverlayClick:f})]})};k.DefaultLink=U,k.MenuBar=le,k.SessionInfo=$,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,x,p,_,p),Z[p+x]=!0)}if(p=null,f!==void 0&&(a(f),p=""+f),d(n)&&(a(n.key),p=""+n.key),"key"in n){f={};for(var Y in n)Y!=="key"&&(f[Y]=n[Y])}else f=n;return p&&s(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,p,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"),xe=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),he=Symbol.for("react.client.reference"),L=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,be=Array.isArray,I=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(e){return e()}};var q,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 x=1e4>L.recentlyCreatedOwnerStacks++;return h(e,n,f,!1,x?Error("react-stack-top-frame"):X,x?I(m(e)):H)},R.jsxs=function(e,n,f){var x=1e4>L.recentlyCreatedOwnerStacks++;return h(e,n,f,!0,x?Error("react-stack-top-frame"):X,x?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-screen 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),h=l.useRef(null),v=l.useCallback(()=>{if(d.current&&s.current&&c.current&&b.current&&h.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="",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"),u.current=!0}},[i]),w=l.useCallback(()=>{d.current&&s.current&&c.current&&b.current&&h.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)",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"),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:"fixed top-5 right-5 z-2147483648 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-[6px] left-0 box-border inline-block h-[3px] w-full select-none",ref:s}),r.jsx("span",{className:"absolute top-[12px] 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:h})]})},ce=t=>{const{menuList:o,menuHeader:a,onClickSignout:m,isMenuhide:i,theme:u,toggleTheme:d,onMenuNavigate:s}=t,[c,b]=l.useState(!1),h=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:h,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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiquants/menu-bar",
3
- "version": "1.2.0",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "description": "A React menu bar component with authentication support and theming",
6
6
  "keywords": [
@@ -37,6 +37,7 @@
37
37
  "scripts": {
38
38
  "build": "vite build",
39
39
  "dev": "vite build --watch",
40
+ "watch": "vite build --watch",
40
41
  "typecheck": "tsc --noEmit",
41
42
  "license-check": "pnpm dlx license-checker --production --onlyAllow \"MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;Unlicense\"",
42
43
  "license-check:json": "pnpm dlx license-checker --production --onlyAllow \"MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;Unlicense\" --json",
@@ -57,19 +58,19 @@
57
58
  "react-router-dom": "^7.7.1"
58
59
  },
59
60
  "devDependencies": {
60
- "@types/react": "^19.2.2",
61
- "@types/react-dom": "^19.2.2",
61
+ "@types/react": "^19.2.4",
62
+ "@types/react-dom": "^19.2.3",
62
63
  "@vitejs/plugin-react": "^4.7.0",
63
- "autoprefixer": "^10.4.21",
64
+ "autoprefixer": "^10.4.22",
64
65
  "lucide-react": "^0.473.0",
65
66
  "postcss": "^8.5.6",
66
67
  "react": "^19.2.0",
67
68
  "react-dom": "^19.2.0",
68
- "react-router-dom": "^7.9.5",
69
+ "react-router-dom": "^7.9.6",
69
70
  "rimraf": "^6.1.0",
70
71
  "tailwindcss": "^3.4.18",
71
72
  "typescript": "^5.9.3",
72
- "vite": "^7.1.12",
73
+ "vite": "^7.2.2",
73
74
  "vite-plugin-dts": "^3.9.1",
74
75
  "vite-tsconfig-paths": "^5.1.4"
75
76
  },