enable-backup-encryption.stories.mjs (1709B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // eslint-disable-next-line import/no-unresolved 6 import { html } from "lit.all.mjs"; 7 import "chrome://global/content/elements/moz-card.mjs"; 8 import { ERRORS } from "chrome://browser/content/backup/backup-constants.mjs"; 9 import "./enable-backup-encryption.mjs"; 10 11 window.MozXULElement.insertFTLIfNeeded("browser/backupSettings.ftl"); 12 window.MozXULElement.insertFTLIfNeeded("branding/brand.ftl"); 13 14 const SELECTABLE_ERRORS = { 15 "(none)": 0, 16 ...ERRORS, 17 }; 18 19 export default { 20 title: "Domain-specific UI Widgets/Backup/Enable Encryption", 21 component: "enable-backup-encryption", 22 argTypes: { 23 type: { 24 control: { type: "select" }, 25 options: ["set-password", "change-password"], 26 }, 27 enableEncryptionErrorCode: { 28 options: Object.keys(SELECTABLE_ERRORS), 29 mapping: SELECTABLE_ERRORS, 30 control: { type: "select" }, 31 }, 32 }, 33 }; 34 35 const Template = ({ type, enableEncryptionErrorCode }) => html` 36 <moz-card style="width: 23.94rem; position: relative;"> 37 <enable-backup-encryption 38 type=${type} 39 .enableEncryptionErrorCode=${enableEncryptionErrorCode} 40 ></enable-backup-encryption> 41 </moz-card> 42 `; 43 44 export const SetPassword = Template.bind({}); 45 SetPassword.args = { 46 type: "set-password", 47 }; 48 49 export const ChangePassword = Template.bind({}); 50 ChangePassword.args = { 51 type: "change-password", 52 }; 53 54 export const SetPasswordError = Template.bind({}); 55 SetPasswordError.args = { 56 type: "set-password", 57 enableEncryptionErrorCode: ERRORS.INVALID_PASSWORD, 58 };