/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ import React, { useEffect, useRef } from "react"; import { useDispatch } from "react-redux"; import { actionCreators as ac, actionTypes as at } from "common/Actions.mjs"; // eslint-disable-next-line no-shadow import { CSSTransition } from "react-transition-group"; // Full browser theme selection sub-panel. The compact `theme-picker` lives in // the customize panel row; the "See more themes" box-button opens this sliding // panel, which shows the full `theme-picker` (appearance chooser + all themes) // and a link out to the about:addons themes list. function ThemesManagementPanel({ onSubpanelToggle, togglePanel, showPanel }) { const arrowButtonRef = useRef(null); const panelRef = useRef(null); const dispatch = useDispatch(); // Notify parent menu when subpanel opens/closes useEffect(() => { if (onSubpanelToggle) { onSubpanelToggle(showPanel); } }, [showPanel, onSubpanelToggle]); const handlePanelEntered = () => { arrowButtonRef.current?.focus(); }; const openAboutAddonsThemes = () => { dispatch(ac.OnlyToMain({ type: at.OPEN_ABOUT_ADDONS_THEMES })); }; const isRTL = typeof document !== "undefined" && document.dir === "rtl"; const arrowIconSrc = `chrome://global/skin/icons/shaft-arrow-${isRTL ? "right" : "left"}.svg`; return (