@aiquants/menu-bar 1.17.9 → 1.18.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 +27 -22
- package/dist/__tests__/pinEvent.test.d.ts +1 -0
- package/dist/contents/MenuContent.d.ts +0 -9
- package/dist/events/pinEvent.d.ts +44 -0
- package/dist/hooks/useMenuPinState.d.ts +21 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.es.js +530 -405
- package/dist/index.umd.js +2 -2
- package/dist/styles/menu-bar.css +1 -1
- package/dist/styles/menu-bar.standalone.css +1 -1
- package/dist/types.d.ts +20 -0
- package/package.json +1 -1
- package/src/MenuBar.tsx +101 -55
- package/src/__tests__/pinEvent.test.tsx +68 -0
- package/src/components/SessionInfo.tsx +39 -23
- package/src/contents/MenuContent.tsx +12 -19
- package/src/contents/MenuList.tsx +6 -6
- package/src/elements/MenuSwitch.tsx +1 -1
- package/src/events/pinEvent.ts +129 -0
- package/src/hooks/useMenuPinState.ts +58 -0
- package/src/index.ts +27 -4
- package/src/styles/menu-bar.css +22 -29
- package/src/types.ts +23 -0
package/dist/MenuBar.d.ts
CHANGED
|
@@ -2,41 +2,46 @@ import { IMenu, MenuNavigationPayload } from './contents/MenuList';
|
|
|
2
2
|
import { Theme } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @description MenuBar コンポーネントの Props。
|
|
8
|
-
* @property {IMenu[]} menuList - The list of menu items. メニュー項目のリスト。
|
|
9
|
-
* @property {React.ReactNode} [menuHeader] - The header content of the menu. メニューのヘッダーコンテンツ。
|
|
10
|
-
* @property {() => void} onClickSignout - Function to handle sign out. サインアウトを処理する関数。
|
|
11
|
-
* @property {boolean} [isMenuhide] - Whether to hide the menu. メニューを非表示にするかどうか。
|
|
12
|
-
* @property {Theme} theme - The current theme.
|
|
13
|
-
* @property {() => void} toggleTheme - Function to toggle the theme.
|
|
14
|
-
* @property {(payload: MenuNavigationPayload) => void} [onMenuNavigate] - Function to receive menu navigation events. メニュー遷移イベントを受け取る関数。
|
|
15
|
-
* @property {boolean | "auto"} [closeOnEscape] - Controls whether the Escape key closes the menu.
|
|
16
|
-
* - "auto" (default): closes when NOT pinned, stays open when pinned. ピン留めなしでは閉じ、ピン留め中は閉じない。
|
|
17
|
-
* - true: always closes on Escape (resets pin if pinned). 常に閉じる。
|
|
18
|
-
* - false: never closes on Escape. 常に閉じない。
|
|
5
|
+
* Props interface for the MenuBar component.
|
|
6
|
+
* MenuBar コンポーネントのプロップスインターフェース。
|
|
19
7
|
*/
|
|
20
|
-
interface IMenuBarProps {
|
|
8
|
+
export interface IMenuBarProps {
|
|
9
|
+
/** List of menu items. メニュー項目のリスト。 */
|
|
21
10
|
menuList: IMenu[];
|
|
11
|
+
/** Optional header content rendered at top of menu drawer. メニューヘッダー要素。 */
|
|
22
12
|
menuHeader?: React.ReactNode;
|
|
13
|
+
/** Callback handler for sign out button click. サインアウト処理ハンドラー。 */
|
|
23
14
|
onClickSignout(): void;
|
|
15
|
+
/** Whether to hide the menu bar (legacy camelCase). メニュー非表示フラグ(旧表記)。 */
|
|
24
16
|
isMenuhide?: boolean;
|
|
17
|
+
/** Whether to hide the menu bar. メニュー非表示フラグ。 */
|
|
18
|
+
isMenuHide?: boolean;
|
|
19
|
+
/** Current active color theme. 現在のテーマ。 */
|
|
25
20
|
theme: Theme;
|
|
21
|
+
/** Toggle handler for switching color theme. テーマ切り替えハンドラー。 */
|
|
26
22
|
toggleTheme: () => void;
|
|
23
|
+
/** Navigation callback when a menu item is selected. メニュー遷移ハンドラー。 */
|
|
27
24
|
onMenuNavigate?(payload: MenuNavigationPayload): void;
|
|
28
|
-
|
|
25
|
+
/** Controlled pinning state (optional). ピン留め状態制御プロップ。 */
|
|
26
|
+
isPinned?: boolean;
|
|
27
|
+
/** Custom width in pixels when menu is pinned (default: 240). ピン留め時の幅(px)。 */
|
|
28
|
+
pinnedWidth?: number;
|
|
29
|
+
/** Callback invoked when menu pin state changes. ピン留め状態変更時のコールバック。 */
|
|
30
|
+
onPinChange?(pinned: boolean, widthPx: number): void;
|
|
31
|
+
/** Controlled list of pinned submenu IDs. ピン留めサブメニューIDリスト(制御)。 */
|
|
29
32
|
pinnedSubmenuIds?: number[];
|
|
33
|
+
/** Initial list of pinned submenu IDs for uncontrolled mode. ピン留めサブメニューID初期リスト。 */
|
|
30
34
|
initialPinnedSubmenuIds?: number[];
|
|
35
|
+
/** Callback invoked when submenu pin state changes. サブメニューピン留め変更時コールバック。 */
|
|
31
36
|
onSubmenuPinChange?(pinnedIds: number[]): void;
|
|
37
|
+
/** Controls whether the Escape key closes the menu drawer. Escape キーによるメニュー閉鎖制御。 */
|
|
32
38
|
closeOnEscape?: boolean | "auto";
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @returns
|
|
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.
|
|
40
46
|
*/
|
|
41
47
|
export declare const MenuBar: (props: IMenuBarProps) => React.JSX.Element | null;
|
|
42
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,15 +5,6 @@ import { IMenu, MenuNavigationPayload } from './MenuList';
|
|
|
5
5
|
* @interface IMenuContentProps
|
|
6
6
|
* @description Props for the MenuContent component.
|
|
7
7
|
* @description MenuContent コンポーネントの Props。
|
|
8
|
-
* @property {IMenu[]} menuList - The list of menu items. メニュー項目のリスト。
|
|
9
|
-
* @property {React.ReactNode} [menuHeader] - The header content of the menu. メニューのヘッダーコンテンツ。
|
|
10
|
-
* @property {boolean} open - Whether the menu is open. メニューが開いているかどうか。
|
|
11
|
-
* @property {(payload: MenuNavigationPayload) => void} onMenuSelected - Function to handle menu item selection. メニュー項目選択を処理する関数。
|
|
12
|
-
* @property {() => void} onClickSignout - Function to handle sign out. サインアウトを処理する関数。
|
|
13
|
-
* @property {Theme} theme - The current theme.
|
|
14
|
-
* @property {() => void} toggleTheme - Function to toggle the theme.
|
|
15
|
-
* @property {boolean} isPinned - Whether the menu is pinned open. メニューがピン留めされているかどうか。
|
|
16
|
-
* @property {() => void} onTogglePin - Function to toggle pin state. ピン留め状態をトグルする関数。
|
|
17
8
|
*/
|
|
18
9
|
interface IMenuContentProps {
|
|
19
10
|
menuList: IMenu[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MenuPinChangeDetail } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Canonical Window CustomEvent name for menu pin state changes.
|
|
5
|
+
* メニューのピン留め状態変更を通知する正準 CustomEvent 名。
|
|
6
|
+
*/
|
|
7
|
+
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
|
+
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
|
+
*/
|
|
28
|
+
export interface SubscribeMenuPinOptions {
|
|
29
|
+
/** Whether to immediately invoke the listener with the current state upon subscription (default: true). 購読開始時に即座に現在の状態を通知するかどうか。 */
|
|
30
|
+
immediate?: boolean;
|
|
31
|
+
/** Default width when pinned (default: 240). ピン留め時のデフォルト幅。 */
|
|
32
|
+
defaultPinnedWidth?: number;
|
|
33
|
+
}
|
|
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
|
+
export declare const subscribeMenuPinChange: (listener: (detail: MenuPinChangeDetail) => void, options?: SubscribeMenuPinOptions) => (() => void);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MenuPinChangeDetail } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for the useMenuPinState hook.
|
|
5
|
+
* useMenuPinState フックのオプション。
|
|
6
|
+
*/
|
|
7
|
+
export interface UseMenuPinStateOptions {
|
|
8
|
+
/** Initial pinned state for server-side rendering (default: false). SSR 時の初期ピン留め状態。 */
|
|
9
|
+
initialPinned?: boolean;
|
|
10
|
+
/** Default width when pinned in pixels (default: 240). デフォルトのピン留め幅。 */
|
|
11
|
+
defaultPinnedWidth?: number;
|
|
12
|
+
}
|
|
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
|
+
export declare const useMenuPinState: (options?: UseMenuPinStateOptions) => MenuPinChangeDetail;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
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';
|
|
2
8
|
export { DefaultLink, SessionInfo } from './components/SessionInfo';
|
|
3
|
-
|
|
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';
|
|
4
17
|
export { MenuBar } from './MenuBar';
|
|
5
|
-
|
|
6
|
-
export type {
|
|
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';
|