Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM-14051-storybook-implementation #12840

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"prettier",
"prettier-plugin-tailwindcss",
"rimraf",
"@storybook/web-components-webpack5",
"tabbable",
"tldts",
"wait-on"
Expand Down
62 changes: 62 additions & 0 deletions apps/browser/src/autofill/content/components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { dirname, join } from "path";

Check warning on line 1 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L1

Added line #L1 was not covered by tests
import type { StorybookConfig } from "@storybook/web-components-webpack5";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import remarkGfm from "remark-gfm";

Check warning on line 4 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L3-L4

Added lines #L3 - L4 were not covered by tests

const getAbsolutePath = (value: string): string =>
dirname(require.resolve(join(value, "package.json")));

Check warning on line 7 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L6-L7

Added lines #L6 - L7 were not covered by tests

const config: StorybookConfig = {

Check warning on line 9 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L9

Added line #L9 was not covered by tests
stories: ["../stories/**/*.lit-stories.@(js|jsx|ts|tsx)"],
addons: [
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-designs"),
getAbsolutePath("@storybook/addon-interactions"),
{
name: "@storybook/addon-docs",
options: {
mdxPluginOptions: {
mdxCompileOptions: {
remarkPlugins: [remarkGfm],
},
},
},
},
],
framework: {
name: getAbsolutePath("@storybook/web-components-webpack5"),
options: {
legacyRootApi: true,
},
},
core: {
disableTelemetry: true,
},
env: (existingConfig) => ({

Check warning on line 37 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L37

Added line #L37 was not covered by tests
...existingConfig,
FLAGS: JSON.stringify({}),
}),
webpackFinal: async (config) => {

Check warning on line 41 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L41

Added line #L41 was not covered by tests
if (config.resolve) {
config.resolve.plugins = [new TsconfigPathsPlugin()] as any;

Check warning on line 43 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L43

Added line #L43 was not covered by tests
}

if (config.module && config.module.rules) {
config.module.rules.push({

Check warning on line 47 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L47

Added line #L47 was not covered by tests
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve("ts-loader"),
},
],
});
}
return config;

Check warning on line 57 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L57

Added line #L57 was not covered by tests
},
docs: {},
};

export default config;

Check warning on line 62 in apps/browser/src/autofill/content/components/.storybook/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/.storybook/main.ts#L62

Added line #L62 was not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 3 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L3

Added line #L3 was not covered by tests

import { ActionButton } from "../../../buttons/action-button";

Check warning on line 5 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L5

Added line #L5 was not covered by tests

type Args = {
buttonText: string;
disabled: boolean;
theme: Theme;
buttonAction: (e: Event) => void;
};

export default {

Check warning on line 14 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L14

Added line #L14 was not covered by tests
title: "Components/Buttons/Action Button",
argTypes: {
buttonText: { control: "text" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
buttonAction: { control: false },
},
args: {
buttonText: "Click Me",
disabled: false,
theme: ThemeTypes.Light,
buttonAction: () => alert("Clicked"),

Check warning on line 26 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L26

Added line #L26 was not covered by tests
},
} as Meta<Args>;

const Template = (args: Args) => ActionButton({ ...args });

Check warning on line 30 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L30

Added line #L30 was not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 32 in apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/action-button-stories/action-button.lit-stories.ts#L32

Added line #L32 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 3 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L3

Added line #L3 was not covered by tests

import { BadgeButton } from "../../../buttons/badge-button";

Check warning on line 5 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L5

Added line #L5 was not covered by tests

type Args = {
buttonAction: (e: Event) => void;
buttonText: string;
disabled?: boolean;
theme: Theme;
};

export default {

Check warning on line 14 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L14

Added line #L14 was not covered by tests
title: "Components/Buttons/Badge Button",
argTypes: {
buttonText: { control: "text" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
buttonAction: { control: false },
},
args: {
buttonText: "Click Me",
disabled: false,
theme: ThemeTypes.Light,
buttonAction: () => alert("Clicked"),

Check warning on line 26 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L26

Added line #L26 was not covered by tests
},
} as Meta<Args>;

const Template = (args: Args) => BadgeButton({ ...args });

Check warning on line 30 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L30

Added line #L30 was not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 32 in apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/badge-button-stories/badge-button.lit-stories.ts#L32

Added line #L32 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 3 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L3

Added line #L3 was not covered by tests

import { CloseButton } from "../../../buttons/close-button";

Check warning on line 5 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L5

Added line #L5 was not covered by tests

type Args = {
handleCloseNotification: (e: Event) => void;
theme: Theme;
};
export default {

Check warning on line 11 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L11

Added line #L11 was not covered by tests
title: "Components/Buttons/Close Button",
argTypes: {
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
handleCloseNotification: { control: false },
},
args: {
theme: ThemeTypes.Light,
handleCloseNotification: () => {
alert("Close button clicked!");

Check warning on line 20 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L20

Added line #L20 was not covered by tests
},
},
} as Meta<Args>;

const Template = (args: Args) => CloseButton({ ...args });

Check warning on line 25 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L25

Added line #L25 was not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 27 in apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/close-button-stories/close-button.lit-stories.ts#L27

Added line #L27 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 3 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L3

Added line #L3 was not covered by tests

import { EditButton } from "../../../buttons/edit-button";

Check warning on line 5 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L5

Added line #L5 was not covered by tests

type Args = {
buttonAction: (e: Event) => void;
buttonText: string;
disabled?: boolean;
theme: Theme;
};
export default {

Check warning on line 13 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L13

Added line #L13 was not covered by tests
title: "Components/Buttons/Edit Button",
argTypes: {
buttonText: { control: "text" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
buttonAction: { control: false },
},
args: {
buttonText: "Click Me",
disabled: false,
theme: ThemeTypes.Light,
buttonAction: () => alert("Clicked"),

Check warning on line 25 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L25

Added line #L25 was not covered by tests
},
} as Meta<Args>;

const Template = (args: Args) => EditButton({ ...args });

Check warning on line 29 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L29

Added line #L29 was not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 31 in apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/buttons/edit-button-stories/edit-button.lit-stories.ts#L31

Added line #L31 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 3 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L3

Added line #L3 was not covered by tests

import { NotificationTypes } from "../../../../../notification/abstractions/notification-bar";
import { CipherAction } from "../../../cipher/cipher-action";

Check warning on line 6 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L5-L6

Added lines #L5 - L6 were not covered by tests

type Args = {
handleAction?: (e: Event) => void;
notificationType: typeof NotificationTypes.Change | typeof NotificationTypes.Add;
theme: Theme;
};
export default {

Check warning on line 13 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L13

Added line #L13 was not covered by tests
title: "Components/Cipher/Cipher Action",
argTypes: {
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
notificationType: {
control: "select",
options: [NotificationTypes.Change, NotificationTypes.Add],
},
handleAction: { control: false },
},
args: {
theme: ThemeTypes.Light,
notificationType: NotificationTypes.Change,
handleAction: () => {
alert("Action triggered!");

Check warning on line 27 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L27

Added line #L27 was not covered by tests
},
},
} as Meta<Args>;

const Template = (args: Args) => CipherAction({ ...args });

Check warning on line 32 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L32

Added line #L32 was not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 34 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-action-stories/cipher-action.lit-stories.ts#L34

Added line #L34 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Meta, StoryObj } from "@storybook/web-components";
import { html } from "lit";

Check warning on line 2 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L2

Added line #L2 was not covered by tests

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 4 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L4

Added line #L4 was not covered by tests

import { CipherIcon } from "../../../cipher/cipher-icon";

Check warning on line 6 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L6

Added line #L6 was not covered by tests

type Args = {
color: string;
size: string;
theme: Theme;
uri?: string;
};

export default {

Check warning on line 15 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L15

Added line #L15 was not covered by tests
title: "Components/Cipher/Cipher Icon",
argTypes: {
color: { control: "color" },
size: { control: "text" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
uri: { control: "text" },
},
args: {
size: "50px",
theme: ThemeTypes.Light,
uri: "",
},
} as Meta<Args>;

const Template = (args: Args) => {
return html`

Check warning on line 31 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L30-L31

Added lines #L30 - L31 were not covered by tests
<div style="width: ${args.size}; height: ${args.size}; overflow: hidden;">
${CipherIcon({ ...args })}
</div>
`;
};

export const Default: StoryObj<Args> = {

Check warning on line 38 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-icon-stories/cipher-icon.lit-stories.ts#L38

Added line #L38 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Meta, StoryObj } from "@storybook/web-components";
import { html } from "lit";

Check warning on line 2 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L2

Added line #L2 was not covered by tests

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 4 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L4

Added line #L4 was not covered by tests

import { CipherInfoIndicatorIcons } from "../../../cipher/cipher-indicator-icons";

Check warning on line 6 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L6

Added line #L6 was not covered by tests

type Args = {
isBusinessOrg?: boolean;
isFamilyOrg?: boolean;
theme: Theme;
};

export default {

Check warning on line 14 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L14

Added line #L14 was not covered by tests
title: "Components/Cipher/Cipher Indicator Icon",
argTypes: {
isBusinessOrg: { control: "boolean" },
isFamilyOrg: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
},
args: {
theme: ThemeTypes.Light,
isBusinessOrg: true,
isFamilyOrg: false,
},
} as Meta<Args>;

const Template: StoryObj<Args>["render"] = (args) =>
html`<div>${CipherInfoIndicatorIcons({ ...args })}</div>`;

Check warning on line 29 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L28-L29

Added lines #L28 - L29 were not covered by tests

export const Default: StoryObj<Args> = {

Check warning on line 31 in apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/ciphers/cipher-inidcator-icon-stories/cipher-indicator-icon.lit-stories.ts#L31

Added line #L31 was not covered by tests
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Meta, StoryObj } from "@storybook/web-components";
import { html } from "lit";

Check warning on line 2 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L2

Added line #L2 was not covered by tests

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

Check warning on line 4 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L4

Added line #L4 was not covered by tests

import * as Icons from "../../icons";

Check warning on line 6 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L6

Added line #L6 was not covered by tests

type Args = {
color?: string;
disabled?: boolean;
theme: Theme;
size: number;
iconLink: URL;
};

export default {

Check warning on line 16 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L16

Added line #L16 was not covered by tests
title: "Components/Icons/Icons",
argTypes: {
iconLink: { control: "text" },
color: { control: "color" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
size: { control: "number", min: 10, max: 100, step: 1 },
},
args: {
iconLink: new URL("https://bitwarden.com"),
disabled: false,
theme: ThemeTypes.Light,
size: 50,
},
} as Meta<Args>;

const Template = (args: Args, IconComponent: (props: Args) => ReturnType<typeof html>) => html`

Check warning on line 33 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L33

Added line #L33 was not covered by tests
<div
style="width: ${args.size}px; height: ${args.size}px; display: flex; align-items: center; justify-content: center;"
>
${IconComponent({ ...args })}
</div>
`;

const createIconStory = (iconName: keyof typeof Icons): StoryObj<Args> => {
const story = {
render: (args) => Template(args, Icons[iconName]),

Check warning on line 43 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L41-L43

Added lines #L41 - L43 were not covered by tests
} as StoryObj<Args>;

if (iconName !== "BrandIconContainer") {
story.argTypes = {

Check warning on line 47 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L47

Added line #L47 was not covered by tests
iconLink: { table: { disable: true } },
};
}

return story;

Check warning on line 52 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L52

Added line #L52 was not covered by tests
};

export const AngleDownIcon = createIconStory("AngleDown");
export const BusinessIcon = createIconStory("Business");
export const BrandIcon = createIconStory("BrandIconContainer");
export const CloseIcon = createIconStory("Close");
export const ExclamationTriangleIcon = createIconStory("ExclamationTriangle");
export const FamilyIcon = createIconStory("Family");
export const FolderIcon = createIconStory("Folder");
export const GlobeIcon = createIconStory("Globe");
export const PartyHornIcon = createIconStory("PartyHorn");
export const PencilSquareIcon = createIconStory("PencilSquare");
export const ShieldIcon = createIconStory("Shield");
export const UserIcon = createIconStory("User");

Check warning on line 66 in apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/content/components/stories/icons/icons.lit-stories.ts#L55-L66

Added lines #L55 - L66 were not covered by tests
Loading
Loading