import { type ReactNode } from "react"; import type { Middleware, Placement } from "@floating-ui/react"; export type Item = { id: string; groupName?: string; label: string; parentNode?: string; childNode?: string; selectedContent?: ReactNode; }; export type DualListBox2Props = { /** * 選択済みの「追加」項目の配列 */ included: Item[]; /** * 選択済みの「除外」項目の配列 */ excluded: Item[]; /** * 追加ボタンを非活性にし、「除外のみモード」にするかどうか */ disableInclude?: boolean; /** * 除外ボタンを非活性にし、「追加のみモード」にするかどうか */ disableExclude?: boolean; /** * メニューに表示するカスタムボタン要素 */ menuButtons?: ReactNode; /** * データ読み込み中かどうかを示すフラグ */ loading?: boolean; /** * 項目リスト(DualListBox2Item, DualListBox2Accordion, DualListBox2Section のいずれかのコンポーネントのみ許可) */ children: ReactNode; /** * 「追加」状態の変更イベントハンドラ **/ onIncludedChange: (includedIds: string[]) => void; /** * 「除外」状態の変更イベントハンドラ **/ onExcludedChange: (excludedIds: string[]) => void; /** * セクション切り替え時のハンドラ **/ onActiveSectionChange?: (activeSection: string | null) => void; /** * スクロールによって追加データの読み込みが必要になったときに呼び出されるハンドラ **/ onLoadMore?: () => void; /** * 1ページあたりの表示件数 **/ pageSize?: number; /** * 1ページあたりの表示件数の選択肢 **/ pageSizeOptions?: number[]; /** * 1ページあたりの表示件数が変更されたときのハンドラ **/ onPageSizeChange?: (pageSize: number) => void; /** * 検索フィルターの文字列 **/ filter?: string; /** * 検索フィルターが変更されたときのハンドラ **/ onFilterChange?: (filter: string) => void; /** * デフォルトの検索UIを置き換えるカスタムフィルターヘッダー。 * 指定時は内蔵のシンプル検索が非表示になり、フィルタリングはアプリ側の責務となる。 * * セクション型と組み合わせる場合は、セクション未選択時のフィルター無効化や、 * セクション一覧へ戻ったときのフィルターリセットもアプリ側で制御する。 **/ renderFilterHeader?: () => ReactNode; /** * Floating UIのplacement(メニューの表示位置) * 詳細は https://floating-ui.com/docs/tutorial#placements を参照 */ placement?: Placement; /** * Floating UIのmiddleware配列(高度なメニュー位置制御用) * 詳細は https://floating-ui.com/docs/middleware を参照 */ middleware?: Middleware[]; };