/* 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 { html, ifDefined } from "../vendor/lit.all.mjs"; import "./moz-segmented-control.mjs"; let options = ["option1", "option2", "option3"]; let icons = [ "chrome://global/skin/icons/highlights.svg", "chrome://global/skin/icons/delete.svg", "chrome://global/skin/icons/defaultFavicon.svg", ]; export default { title: "UI Widgets/Segmented Control", component: "moz-segmented-control", argTypes: { disabledItems: { options, control: { type: "check" }, }, size: { options: ["default", "small"], control: { type: "radio" }, }, }, parameters: { actions: { handles: ["change", "input"], }, status: "in-development", fluent: ` control-option1 = Option 1 control-option2 = Option 2 control-option3 = Option 3 control-option1-icon-only = .aria-label = Highlights view control-option2-icon-only = .aria-label = Delete view control-option3-icon-only = .aria-label = Favorites view `, }, }; const Template = ({ value = options[0], name = "segmented-control", showIcons = false, disabled = false, disabledItems = [], size = "default", withDeck = false, iconsOnly = false, }) => html` ${withDeck ? html` ` : ""} ${options.map( (option, i) => html` ` )} ${withDeck ? html` ${options.map( (option, i) => html`

Option ${i + 1} Content

This is the content for option ${i + 1}.

` )}
` : ""} `; export const Default = Template.bind({}); Default.args = { value: options[0], name: "segmented-control", showIcons: false, disabled: false, disabledItems: [], size: "default", withDeck: false, iconsOnly: false, }; export const WithIcons = Template.bind({}); WithIcons.args = { ...Default.args, showIcons: true, }; export const IconsOnly = Template.bind({}); IconsOnly.args = { ...Default.args, iconsOnly: true, }; export const SmallSize = Template.bind({}); SmallSize.args = { ...Default.args, size: "small", }; export const Disabled = Template.bind({}); Disabled.args = { ...Default.args, disabled: true, }; export const DisabledItem = Template.bind({}); DisabledItem.args = { ...Default.args, disabledItems: ["option2"], }; export const WithNamedDeck = Template.bind({}); WithNamedDeck.args = { ...Default.args, withDeck: true, showIcons: true, };