/* 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 "./panel-list.js";
import { html, ifDefined } from "../vendor/lit.all.mjs";
let accesskeyOptions = ["n", "w", "e", "c", "b"];
export default {
title: "UI Widgets/Panel List",
component: "panel-list",
argTypes: {
accesskeys: {
if: { arg: "showAccesskeys", truthy: true },
},
},
parameters: {
status: "stable",
actions: {
handles: ["showing", "shown", "hidden", "click"],
},
fluent: `
panel-list-item-one = Item One
panel-list-item-two = Item Two
panel-list-item-three = Item Three
panel-list-disabled = Disabled
panel-list-checked = Checked
panel-list-badged = Badged, look at me
panel-list-passwords = Passwords
panel-list-settings = Settings
submenu-item-one = Submenu Item One
submenu-item-two = Submenu Item Two
submenu-item-three = Submenu Item Three
`,
},
};
function openMenu(event) {
if (
event.type == "mousedown" ||
event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
!event.detail
) {
event.target.getRootNode().querySelector("panel-list").toggle(event);
}
}
const Template = ({
isOpen,
items,
wideAnchor,
hasSubMenu,
showAccesskeys,
accesskeys,
}) => html`
${isOpen
? ""
: html`
"
? html`
`
: html`