/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {Resizable} from 're-resizable'; import React, { useId, unstable_ViewTransition as ViewTransition, unstable_addTransitionType as addTransitionType, startTransition, } from 'react'; import {EXPAND_ACCORDION_TRANSITION} from '../lib/transitionTypes'; type TabsRecord = Map; export default function AccordionWindow(props: { defaultTab: string | null; tabs: TabsRecord; tabsOpen: Set; setTabsOpen: (newTab: Set) => void; changedPasses: Set; }): React.ReactElement { return (
{Array.from(props.tabs.keys()).map(name => { return ( ); })}
); } function AccordionWindowItem({ name, tabs, tabsOpen, setTabsOpen, hasChanged, }: { name: string; tabs: TabsRecord; tabsOpen: Set; setTabsOpen: (newTab: Set) => void; hasChanged: boolean; isFailure: boolean; }): React.ReactElement { const id = useId(); const isShow = tabsOpen.has(name); const transitionName = `accordion-window-item-${id}`; const toggleTabs = (): void => { startTransition(() => { addTransitionType(EXPAND_ACCORDION_TRANSITION); const nextState = new Set(tabsOpen); if (nextState.has(name)) { nextState.delete(name); } else { nextState.add(name); } setTabsOpen(nextState); }); }; // Replace spaces with non-breaking spaces const displayName = name.replace(/ /g, '\u00A0'); return (
{isShow ? (

- {displayName}

{tabs.get(name) ??
No output for {name}
}
) : (
)}
); }