// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */ import * as Platform from '../../../core/platform/platform.js'; import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js'; import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js'; import * as Lit from '../../../ui/lit/lit.js'; import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js'; import * as Dialogs from '../dialogs/dialogs.js'; import { MenuGroup, type MenuItemSelectedEvent, type MenuItemValue, } from './Menu.js'; import selectMenuStyles from './selectMenu.css.js'; import selectMenuButtonStyles from './selectMenuButton.css.js'; const {html} = Lit; export interface SelectMenuData { /** * Determines where the dialog with the menu will show relative to * the show button. * Defaults to Bottom. */ position: Dialogs.Dialog.DialogVerticalPosition; /** * Determines where the dialog with the menu will show horizontally * relative to the show button. * Defaults to Auto */ horizontalAlignment: Dialogs.Dialog.DialogHorizontalAlignment; /** * The title of the menu button. Can be either a string or a function * that returns a Lit template. * If not set, the title of the button will default to the selected * item's text. */ buttonTitle: string|TitleCallback; /** * Determines if an arrow, pointing to the opposite side of * the dialog, is shown at the end of the button. * Defaults to false. */ showArrow: boolean; /** * Determines if the component is formed by two buttons: * one to open the meny and another that triggers a * selectmenusidebuttonclickEvent. The RecordMenu instance of * the component is an example of this use case. * Defaults to false. */ sideButton: boolean; /** * Whether the menu button is disabled. * Defaults to false. */ disabled: boolean; /** * Determines if dividing lines between the menu's options * are shown. */ showDivider: boolean; /** * Determines if the selected item is marked using a checkmark. * Defaults to true. */ showSelectedItem: boolean; /** * Specifies a context for the visual element. */ jslogContext: string; } type TitleCallback = () => Lit.TemplateResult; const deployMenuArrow = new URL('../../../Images/triangle-down.svg', import.meta.url).toString(); /** * @deprecated use `