mirror of
https://github.com/bitwarden/clients.git
synced 2025-12-05 19:17:06 -06:00
* add back the aria-label when using the a11y title directive * add comment about why aria-label is being added back * fix storybook a11y tests * pass undefined to util function
59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import { setCompodocJson } from "@storybook/addon-docs/angular";
|
|
import { withThemeByClassName } from "@storybook/addon-themes";
|
|
import { componentWrapperDecorator } from "@storybook/angular";
|
|
import type { Preview } from "@storybook/angular";
|
|
|
|
import docJson from "../documentation.json";
|
|
|
|
setCompodocJson(docJson);
|
|
|
|
const wrapperDecorator = componentWrapperDecorator((story) => {
|
|
return /*html*/ `
|
|
<div class="tw-bg-background tw-px-5 tw-py-10 tw-@container">
|
|
${story}
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
const preview: Preview = {
|
|
decorators: [
|
|
withThemeByClassName({
|
|
themes: {
|
|
light: "theme_light",
|
|
dark: "theme_dark",
|
|
},
|
|
defaultTheme: "light",
|
|
}),
|
|
wrapperDecorator,
|
|
],
|
|
parameters: {
|
|
a11y: {
|
|
context: "#storybook-root",
|
|
},
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/,
|
|
},
|
|
},
|
|
options: {
|
|
storySort: {
|
|
method: "alphabetical",
|
|
order: ["Documentation", ["Introduction", "Colors", "Icons"], "Component Library"],
|
|
},
|
|
},
|
|
docs: {
|
|
source: {
|
|
type: "dynamic",
|
|
excludeDecorators: true,
|
|
},
|
|
},
|
|
backgrounds: {
|
|
disabled: true,
|
|
},
|
|
},
|
|
tags: ["autodocs"],
|
|
};
|
|
|
|
export default preview;
|