@aiquants/menu-bar 1.18.1 → 1.18.3

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,47 +1,20 @@
1
- import { IMenu, MenuNavigationPayload } from './contents/MenuList';
2
- import { Theme } from './types';
3
-
4
- /**
5
- * Props interface for the MenuBar component.
6
- * MenuBar コンポーネントのプロップスインターフェース。
7
- */
1
+ import { IMenu, MenuNavigationPayload } from "./contents/MenuList";
2
+ import { Theme } from "./types";
8
3
  export interface IMenuBarProps {
9
- /** List of menu items. メニュー項目のリスト。 */
10
4
  menuList: IMenu[];
11
- /** Optional header content rendered at top of menu drawer. メニューヘッダー要素。 */
12
5
  menuHeader?: React.ReactNode;
13
- /** Callback handler for sign out button click. サインアウト処理ハンドラー。 */
14
6
  onClickSignout(): void;
15
- /** Whether to hide the menu bar (legacy camelCase). メニュー非表示フラグ(旧表記)。 */
16
7
  isMenuhide?: boolean;
17
- /** Whether to hide the menu bar. メニュー非表示フラグ。 */
18
8
  isMenuHide?: boolean;
19
- /** Current active color theme. 現在のテーマ。 */
20
9
  theme: Theme;
21
- /** Toggle handler for switching color theme. テーマ切り替えハンドラー。 */
22
10
  toggleTheme: () => void;
23
- /** Navigation callback when a menu item is selected. メニュー遷移ハンドラー。 */
24
11
  onMenuNavigate?(payload: MenuNavigationPayload): void;
25
- /** Controlled pinning state (optional). ピン留め状態制御プロップ。 */
26
12
  isPinned?: boolean;
27
- /** Custom width in pixels when menu is pinned (default: 240). ピン留め時の幅(px)。 */
28
13
  pinnedWidth?: number;
29
- /** Callback invoked when menu pin state changes. ピン留め状態変更時のコールバック。 */
30
14
  onPinChange?(pinned: boolean, widthPx: number): void;
31
- /** Controlled list of pinned submenu IDs. ピン留めサブメニューIDリスト(制御)。 */
32
15
  pinnedSubmenuIds?: number[];
33
- /** Initial list of pinned submenu IDs for uncontrolled mode. ピン留めサブメニューID初期リスト。 */
34
16
  initialPinnedSubmenuIds?: number[];
35
- /** Callback invoked when submenu pin state changes. サブメニューピン留め変更時コールバック。 */
36
17
  onSubmenuPinChange?(pinnedIds: number[]): void;
37
- /** Controls whether the Escape key closes the menu drawer. Escape キーによるメニュー閉鎖制御。 */
38
18
  closeOnEscape?: boolean | "auto";
39
19
  }
40
- /**
41
- * Renders the primary collapsible and pinnable menu bar with drawer navigation.
42
- * 折りたたみ・ピン留め対応のプライマリメニューバーコンポーネント。
43
- *
44
- * @param props - MenuBarProps configuration.
45
- * @returns Rendered JSX element or null.
46
- */
47
20
  export declare const MenuBar: (props: IMenuBarProps) => React.JSX.Element | null;
@@ -1,37 +1,12 @@
1
- import { UserProfile } from '../types/user';
2
-
3
- /**
4
- * Link component props interface.
5
- * リンクコンポーネントのプロパティ。
6
- */
1
+ import { UserProfile } from "../types/user";
7
2
  export interface LinkProps {
8
- /** Link destination URL */
9
3
  to: string;
10
- /** CSS class name */
11
4
  className?: string;
12
- /** Link content */
13
5
  children: React.ReactNode;
14
6
  }
15
- /**
16
- * Generic Link component that can be replaced with router-specific implementation.
17
- * ルーター固有の実装で置き換え可能な汎用リンクコンポーネント。
18
- */
19
7
  export declare const DefaultLink: ({ to, className, children }: LinkProps) => React.JSX.Element;
20
- /**
21
- * SessionInfo component props interface.
22
- * ユーザーセッション情報を表示するコンポーネントのプロパティ。
23
- */
24
8
  export interface SessionInfoProps {
25
- /** User profile information from Google OAuth */
26
9
  user: UserProfile | null;
27
- /** Custom Link component (optional, defaults to DefaultLink) */
28
10
  LinkComponent?: React.ComponentType<LinkProps>;
29
11
  }
30
- /**
31
- * SessionInfo component for displaying user session information.
32
- * Displays user profile photo, navigation links, and user name when authenticated.
33
- *
34
- * ユーザーセッション情報を表示するコンポーネント。
35
- * 認証時にプロフィール写真、ナビゲーションリンク、ユーザー名を表示する。
36
- */
37
12
  export declare const SessionInfo: (props: SessionInfoProps) => React.JSX.Element;
@@ -1,11 +1,5 @@
1
- import { Theme } from '../types';
2
- import { IMenu, MenuNavigationPayload } from './MenuList';
3
-
4
- /**
5
- * @interface IMenuContentProps
6
- * @description Props for the MenuContent component.
7
- * @description MenuContent コンポーネントの Props。
8
- */
1
+ import { Theme } from "../types";
2
+ import { IMenu, MenuNavigationPayload } from "./MenuList";
9
3
  interface IMenuContentProps {
10
4
  menuList: IMenu[];
11
5
  menuHeader?: React.ReactNode;
@@ -19,11 +13,5 @@ interface IMenuContentProps {
19
13
  pinnedSubmenuIds: number[];
20
14
  onToggleSubmenuPin(id: number): void;
21
15
  }
22
- /**
23
- * Renders the content of the menu bar.
24
- * メニューバーのコンテンツを描画します。
25
- * @param {IMenuContentProps} props - The properties for the MenuContent component.
26
- * @returns {React.JSX.Element} The rendered menu content.
27
- */
28
16
  export declare const MenuContent: (props: IMenuContentProps) => React.JSX.Element;
29
17
  export {};
@@ -1,18 +1,3 @@
1
- /**
2
- * @module MenuList
3
- * @description This module provides the list of menu items.
4
- * @description このモジュールは、メニュー項目のリストを提供します。
5
- */
6
- /**
7
- * @interface ISubmenu
8
- * @description Interface for a submenu item.
9
- * @description サブメニュー項目のインターフェース。
10
- * @property {number} subid - The unique ID of the submenu item. サブメニュー項目の一意の ID。
11
- * @property {string} [title] - The title of the submenu item. サブメニュー項目のタイトル。
12
- * @property {string} href - The URL for the submenu item. サブメニュー項目の URL。
13
- * @property {string} [mark] - The type of mark to display next to the item. 項目の横に表示するマークの種類。
14
- * @property {boolean} [new] - Whether the item is a new link. 新しいリンクかどうか。
15
- */
16
1
  export interface ISubmenu {
17
2
  subid: number;
18
3
  title?: string;
@@ -20,39 +5,16 @@ export interface ISubmenu {
20
5
  mark?: string;
21
6
  new?: boolean;
22
7
  }
23
- /**
24
- * @interface IMenu
25
- * @description Interface for a menu item.
26
- * @description メニュー項目のインターフェース。
27
- * @property {number} id - The unique ID of the menu item. メニュー項目の一意の ID。
28
- * @property {string} title - The title of the menu item. メニュー項目のタイトル。
29
- * @property {string} [href] - The URL for the menu item. メニュー項目の URL。
30
- * @property {ISubmenu[]} submenu - The list of submenu items. サブメニュー項目のリスト。
31
- */
32
8
  export interface IMenu {
33
9
  id: number;
34
10
  title: string;
35
11
  href?: string;
36
12
  submenu: ISubmenu[];
37
13
  }
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
14
  export type MenuNavigationPayload = {
46
15
  menu: Pick<IMenu, "id" | "title" | "href">;
47
16
  submenu?: Pick<ISubmenu, "subid" | "title" | "href" | "mark" | "new">;
48
17
  };
49
- /**
50
- * @interface IMenuListProps
51
- * @description Props for the MenuList component.
52
- * @description MenuList コンポーネントの Props。
53
- * @property {IMenu[]} menuList - The list of menu items. メニュー項目のリスト。
54
- * @property {(payload: MenuNavigationPayload) => void} [onMenuSelected] - Function to handle menu item selection. メニュー項目選択を処理する関数。
55
- */
56
18
  interface IMenuListProps {
57
19
  menuList: IMenu[];
58
20
  onMenuSelected?(payload: MenuNavigationPayload): void;
@@ -1,25 +1,6 @@
1
- /**
2
- * @module OverlayShadow
3
- * @description This module provides an overlay shadow component.
4
- * @description このモジュールは、オーバーレイシャドウコンポーネントを提供します。
5
- */
6
- /**
7
- * @interface IOverlayProps
8
- * @description Props for the OverlayShadow component.
9
- * @description OverlayShadow コンポーネントの Props。
10
- * @property {boolean} isOverlay - Whether the overlay is visible. オーバーレイが表示されているかどうか。
11
- * @property {() => void} [onOverlayClick] - Function to handle overlay click. オーバーレイのクリックを処理する関数。
12
- */
13
1
  interface IOverlayProps {
14
2
  isOverlay: boolean;
15
3
  onOverlayClick?(): void;
16
4
  }
17
- /**
18
- * @function OverlayShadow
19
- * @description A component that renders an overlay shadow.
20
- * @description オーバーレイシャドウを描画するコンポーネント。
21
- * @param {IOverlayProps} props - The props for the component.
22
- * @returns {React.JSX.Element} The rendered overlay shadow.
23
- */
24
5
  export declare const OverlayShadow: (props: IOverlayProps) => React.JSX.Element;
25
6
  export {};
@@ -1,14 +1,13 @@
1
- import { Theme } from '../types';
2
-
3
- interface IMenuSwitchProps {
4
- open: boolean;
1
+ import { Theme } from "../types";
2
+ export interface IMenuSwitchProps {
3
+ open?: boolean;
4
+ isOpen?: boolean;
5
5
  onMenuOpen?: () => void;
6
6
  onMenuClose?: () => void;
7
- theme: Theme;
7
+ onToggle?: (nextOpen: boolean) => void;
8
+ theme?: Theme;
9
+ pinned?: boolean;
10
+ isPinned?: boolean;
11
+ className?: string;
8
12
  }
9
- /**
10
- * Renders the toggle button that switches the main menu visibility.
11
- * メインメニューの表示状態を切り替えるトグルボタンを描画。
12
- */
13
13
  export declare const MenuSwitch: (props: IMenuSwitchProps) => React.JSX.Element;
14
- export {};
@@ -1,44 +1,9 @@
1
- import { MenuPinChangeDetail } from '../types';
2
-
3
- /**
4
- * Canonical Window CustomEvent name for menu pin state changes.
5
- * メニューのピン留め状態変更を通知する正準 CustomEvent 名。
6
- */
1
+ import { MenuPinChangeDetail } from "../types";
7
2
  export declare const MENU_PIN_CHANGE_EVENT = "aiquants-menu-pin-change";
8
- /**
9
- * Reads initial pin state safely from document CSS variable or localStorage.
10
- * document の CSS 変数または localStorage から初期のピン留め状態を安全に読み取ります。
11
- *
12
- * @param defaultPinnedWidth - Default width in pixels when pinned (default: 240).
13
- * @returns Current MenuPinChangeDetail object.
14
- */
15
3
  export declare const getInitialPinState: (defaultPinnedWidth?: number) => MenuPinChangeDetail;
16
- /**
17
- * Dispatches a CustomEvent on window with menu pin state details.
18
- * window に対してメニューピン留め状態変更カスタムイベントを発行します。
19
- *
20
- * @param pinned - Whether the menu is pinned.
21
- * @param width - The pinned width in pixels.
22
- */
23
- export declare const dispatchMenuPinChange: (pinned: boolean, width: number) => void;
24
- /**
25
- * Options for subscribing to menu pin state changes.
26
- * メニューピン留め状態購読時のオプション。
27
- */
4
+ export declare const dispatchMenuPinChange: (pinned: boolean, width: number, active?: boolean) => void;
28
5
  export interface SubscribeMenuPinOptions {
29
- /** Whether to immediately invoke the listener with the current state upon subscription (default: true). 購読開始時に即座に現在の状態を通知するかどうか。 */
30
6
  immediate?: boolean;
31
- /** Default width when pinned (default: 240). ピン留め時のデフォルト幅。 */
32
7
  defaultPinnedWidth?: number;
33
8
  }
34
- /**
35
- * Subscribes a listener to menu pin state changes on window.
36
- * Returns an unsubscription cleanup function.
37
- * window 上のメニューピン留め状態変更イベントを購読します。
38
- * クリーンアップ関数を返します。
39
- *
40
- * @param listener - Callback invoked on pin state changes.
41
- * @param options - Subscription options (e.g. immediate notification).
42
- * @returns Cleanup function to unsubscribe.
43
- */
44
9
  export declare const subscribeMenuPinChange: (listener: (detail: MenuPinChangeDetail) => void, options?: SubscribeMenuPinOptions) => (() => void);
@@ -1,21 +1,6 @@
1
- import { MenuPinChangeDetail } from '../types';
2
-
3
- /**
4
- * Options for the useMenuPinState hook.
5
- * useMenuPinState フックのオプション。
6
- */
1
+ import { MenuPinChangeDetail } from "../types";
7
2
  export interface UseMenuPinStateOptions {
8
- /** Initial pinned state for server-side rendering (default: false). SSR 時の初期ピン留め状態。 */
9
3
  initialPinned?: boolean;
10
- /** Default width when pinned in pixels (default: 240). デフォルトのピン留め幅。 */
11
4
  defaultPinnedWidth?: number;
12
5
  }
13
- /**
14
- * React hook for consuming components to seamlessly subscribe to menu pin state changes.
15
- * Hydration-safe, re-render optimized via React 18 useSyncExternalStore.
16
- * 利用側 React コンポーネントがメニューのピン留め状態および幅をシームレスに購読するためのカスタムフック。
17
- *
18
- * @param options - Optional initial pin state and width configuration.
19
- * @returns Current MenuPinChangeDetail ({ pinned: boolean, width: number }).
20
- */
21
6
  export declare const useMenuPinState: (options?: UseMenuPinStateOptions) => MenuPinChangeDetail;
package/dist/index.d.ts CHANGED
@@ -1,21 +1,11 @@
1
- /**
2
- * @module index
3
- * @description Entry point for @aiquants/menu-bar package exports.
4
- * @description @aiquants/menu-bar パッケージのエクスポートエントリーポイント。
5
- */
6
- /** @deprecated Use MenuBarLinkProps instead to avoid namespace collisions. */
7
- export type { LinkProps as MenuBarLinkProps, LinkProps, SessionInfoProps as MenuBarSessionInfoProps, SessionInfoProps } from './components/SessionInfo';
8
- export { DefaultLink, SessionInfo } from './components/SessionInfo';
9
- /** @deprecated Use IMenuBarMenu instead to avoid namespace collisions. */
10
- /** @deprecated Use IMenuBarSubmenu instead to avoid namespace collisions. */
11
- export type { IMenu as IMenuBarMenu, IMenu, ISubmenu as IMenuBarSubmenu, ISubmenu, MenuNavigationPayload } from './contents/MenuList';
12
- export type { SubscribeMenuPinOptions } from './events/pinEvent';
13
- export { dispatchMenuPinChange, getInitialPinState, MENU_PIN_CHANGE_EVENT, subscribeMenuPinChange, } from './events/pinEvent';
14
- export type { UseMenuPinStateOptions } from './hooks/useMenuPinState';
15
- export { useMenuPinState } from './hooks/useMenuPinState';
16
- export type { IMenuBarProps } from './MenuBar';
17
- export { MenuBar } from './MenuBar';
18
- /** @deprecated Use MenuBarTheme instead to avoid namespace collisions. */
19
- export type { MenuPinChangeDetail, MenuPinCustomEvent, Theme as MenuBarTheme, Theme } from './types';
20
- /** @deprecated Use MenuBarUserProfile instead to avoid namespace collisions. */
21
- export type { UserProfile as MenuBarUserProfile, UserProfile } from './types/user';
1
+ export type { LinkProps as MenuBarLinkProps, LinkProps, SessionInfoProps as MenuBarSessionInfoProps, SessionInfoProps } from "./components/SessionInfo";
2
+ export { DefaultLink, SessionInfo } from "./components/SessionInfo";
3
+ export type { IMenu as IMenuBarMenu, IMenu, ISubmenu as IMenuBarSubmenu, ISubmenu, MenuNavigationPayload } from "./contents/MenuList";
4
+ export type { SubscribeMenuPinOptions } from "./events/pinEvent";
5
+ export { dispatchMenuPinChange, getInitialPinState, MENU_PIN_CHANGE_EVENT, subscribeMenuPinChange, } from "./events/pinEvent";
6
+ export type { UseMenuPinStateOptions } from "./hooks/useMenuPinState";
7
+ export { useMenuPinState } from "./hooks/useMenuPinState";
8
+ export type { IMenuBarProps } from "./MenuBar";
9
+ export { MenuBar } from "./MenuBar";
10
+ export type { MenuPinChangeDetail, MenuPinCustomEvent, Theme as MenuBarTheme, Theme } from "./types";
11
+ export type { UserProfile as MenuBarUserProfile, UserProfile } from "./types/user";