Merged in fix/3697-prettier-configs (pull request #3396)

fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2026-01-07 12:45:50 +00:00
parent 932413412b
commit d0546926a9
500 changed files with 18367 additions and 18419 deletions

View File

@@ -1,41 +1,41 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
import { expect, fn } from 'storybook/test'
import { expect, fn } from "storybook/test"
import { Button } from './Button'
import { buttonIconNames } from './types'
import { config as buttonConfig } from './variants'
import { Button } from "./Button"
import { buttonIconNames } from "./types"
import { config as buttonConfig } from "./variants"
const meta: Meta<typeof Button> = {
title: 'Core Components/Button',
title: "Core Components/Button",
component: Button,
argTypes: {
onPress: {
table: {
type: { summary: 'function' },
defaultValue: { summary: 'undefined' },
type: { summary: "function" },
defaultValue: { summary: "undefined" },
},
description: 'Callback function to handle button press events.',
description: "Callback function to handle button press events.",
},
variant: {
control: 'select',
control: "select",
options: Object.keys(buttonConfig.variants.variant),
default: 'Primary',
default: "Primary",
table: {
defaultValue: {
summary: buttonConfig.defaultVariants.variant,
},
type: {
summary: Object.keys(buttonConfig.variants.variant).join(' | '),
summary: Object.keys(buttonConfig.variants.variant).join(" | "),
},
},
},
color: {
control: 'select',
control: "select",
options: Object.keys(buttonConfig.variants.color),
table: {
type: {
summary: Object.keys(buttonConfig.variants.color).join(' | '),
summary: Object.keys(buttonConfig.variants.color).join(" | "),
},
defaultValue: {
summary: buttonConfig.defaultVariants.color,
@@ -43,11 +43,11 @@ const meta: Meta<typeof Button> = {
},
},
size: {
control: 'select',
control: "select",
options: Object.keys(buttonConfig.variants.size),
table: {
type: {
summary: Object.keys(buttonConfig.variants.size).join(' | '),
summary: Object.keys(buttonConfig.variants.size).join(" | "),
},
defaultValue: {
summary: buttonConfig.defaultVariants.size,
@@ -55,63 +55,63 @@ const meta: Meta<typeof Button> = {
},
},
wrapping: {
control: 'boolean',
control: "boolean",
options: Object.keys(buttonConfig.variants.wrapping),
type: 'boolean',
type: "boolean",
table: {
defaultValue: {
summary: buttonConfig.defaultVariants.wrapping.toString(),
},
},
description:
'Only applies to variant `Text`. If `false`, the button will use smaller padding.',
"Only applies to variant `Text`. If `false`, the button will use smaller padding.",
},
leadingIconName: {
control: 'select',
control: "select",
options: buttonIconNames,
table: {
type: { summary: buttonIconNames.join(' | ') },
defaultValue: { summary: 'undefined' },
type: { summary: buttonIconNames.join(" | ") },
defaultValue: { summary: "undefined" },
},
description: 'Name of the Material Icon to use as leading icon.',
description: "Name of the Material Icon to use as leading icon.",
},
trailingIconName: {
control: 'select',
control: "select",
options: buttonIconNames,
table: {
type: { summary: buttonIconNames.join(' | ') },
defaultValue: { summary: 'undefined' },
type: { summary: buttonIconNames.join(" | ") },
defaultValue: { summary: "undefined" },
},
description: 'Name of the Material Icon to use as trailing icon.',
description: "Name of the Material Icon to use as trailing icon.",
},
isDisabled: {
control: 'boolean',
control: "boolean",
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
type: { summary: "boolean" },
defaultValue: { summary: "false" },
},
},
isPending: {
control: 'boolean',
control: "boolean",
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
type: { summary: "boolean" },
defaultValue: { summary: "false" },
},
},
fullWidth: {
control: 'boolean',
control: "boolean",
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
type: { summary: "boolean" },
defaultValue: { summary: "false" },
},
description:
'By default, the button width adjusts to its content. Set to true to make the button take the full width of its container.',
"By default, the button width adjusts to its content. Set to true to make the button take the full width of its container.",
},
},
}
const globalStoryPropsInverted = {
backgrounds: { value: 'scandicPrimaryDark' },
backgrounds: { value: "scandicPrimaryDark" },
}
export default meta
@@ -120,10 +120,10 @@ type Story = StoryObj<typeof Button>
export const Default: Story = {
args: {
onPress: fn(),
children: 'Button',
children: "Button",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -131,11 +131,11 @@ export const Default: Story = {
export const PrimaryLarge: Story = {
args: {
...Default.args,
variant: 'Primary',
size: 'lg',
variant: "Primary",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -143,10 +143,10 @@ export const PrimaryLarge: Story = {
export const PrimaryMedium: Story = {
args: {
...PrimaryLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -154,10 +154,10 @@ export const PrimaryMedium: Story = {
export const PrimarySmall: Story = {
args: {
...PrimaryLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -169,7 +169,7 @@ export const PrimaryDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -181,7 +181,7 @@ export const PrimaryLoading: Story = {
onPress: fn(), // Fresh spy instance for loading test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -192,7 +192,7 @@ export const PrimaryOnDarkBackground: Story = {
...PrimaryLarge.args,
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -201,11 +201,11 @@ export const PrimaryInvertedLarge: Story = {
globals: globalStoryPropsInverted,
args: {
...Default.args,
size: 'lg',
color: 'Inverted',
size: "lg",
color: "Inverted",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -214,10 +214,10 @@ export const PrimaryInvertedMedium: Story = {
globals: globalStoryPropsInverted,
args: {
...PrimaryInvertedLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -226,10 +226,10 @@ export const PrimaryInvertedSmall: Story = {
globals: globalStoryPropsInverted,
args: {
...PrimaryInvertedLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -242,7 +242,7 @@ export const PrimaryInvertedDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -255,7 +255,7 @@ export const PrimaryInvertedLoading: Story = {
onPress: fn(), // Fresh spy instance for loading test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -263,11 +263,11 @@ export const PrimaryInvertedLoading: Story = {
export const SecondaryLarge: Story = {
args: {
...Default.args,
variant: 'Secondary',
size: 'lg',
variant: "Secondary",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -275,10 +275,10 @@ export const SecondaryLarge: Story = {
export const SecondaryMedium: Story = {
args: {
...SecondaryLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -286,10 +286,10 @@ export const SecondaryMedium: Story = {
export const SecondarySmall: Story = {
args: {
...SecondaryLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -301,7 +301,7 @@ export const SecondaryDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -313,7 +313,7 @@ export const SecondaryLoading: Story = {
onPress: fn(), // Fresh spy instance for loading test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -322,12 +322,12 @@ export const SecondaryInvertedLarge: Story = {
globals: globalStoryPropsInverted,
args: {
...Default.args,
variant: 'Secondary',
color: 'Inverted',
size: 'lg',
variant: "Secondary",
color: "Inverted",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -336,10 +336,10 @@ export const SecondaryInvertedMedium: Story = {
globals: globalStoryPropsInverted,
args: {
...SecondaryInvertedLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -348,10 +348,10 @@ export const SecondaryInvertedSmall: Story = {
globals: globalStoryPropsInverted,
args: {
...SecondaryInvertedLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -364,7 +364,7 @@ export const SecondaryInvertedDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -377,7 +377,7 @@ export const SecondaryInvertedLoading: Story = {
onPress: fn(), // Fresh spy instance for loading test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -385,11 +385,11 @@ export const SecondaryInvertedLoading: Story = {
export const TertiaryLarge: Story = {
args: {
...Default.args,
variant: 'Tertiary',
size: 'lg',
variant: "Tertiary",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -397,10 +397,10 @@ export const TertiaryLarge: Story = {
export const TertiaryMedium: Story = {
args: {
...TertiaryLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -408,10 +408,10 @@ export const TertiaryMedium: Story = {
export const TertiarySmall: Story = {
args: {
...TertiaryLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -423,7 +423,7 @@ export const TertiaryDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -435,7 +435,7 @@ export const TertiaryLoading: Story = {
onPress: fn(), // Fresh spy instance for loading test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -443,11 +443,11 @@ export const TertiaryLoading: Story = {
export const TextLarge: Story = {
args: {
...Default.args,
variant: 'Text',
size: 'lg',
variant: "Text",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -455,11 +455,11 @@ export const TextLarge: Story = {
export const TextMedium: Story = {
args: {
...TextLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -467,11 +467,11 @@ export const TextMedium: Story = {
export const TextSmall: Story = {
args: {
...TextLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -483,7 +483,7 @@ export const TextDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -494,7 +494,7 @@ export const TextNoWrapping: Story = {
wrapping: false,
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -503,12 +503,12 @@ export const TextInvertedLarge: Story = {
globals: globalStoryPropsInverted,
args: {
...Default.args,
variant: 'Text',
color: 'Inverted',
size: 'lg',
variant: "Text",
color: "Inverted",
size: "lg",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -517,10 +517,10 @@ export const TextInvertedMedium: Story = {
globals: globalStoryPropsInverted,
args: {
...TextInvertedLarge.args,
size: 'md',
size: "md",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -529,10 +529,10 @@ export const TextInvertedSmall: Story = {
globals: globalStoryPropsInverted,
args: {
...TextInvertedLarge.args,
size: 'sm',
size: "sm",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -545,7 +545,7 @@ export const TextInvertedDisabled: Story = {
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(0)
},
}
@@ -553,15 +553,15 @@ export const TextInvertedDisabled: Story = {
export const TextWithIcon: Story = {
args: {
...TextLarge.args,
children: 'Text with icon',
trailingIconName: 'chevron_right',
children: "Text with icon",
trailingIconName: "chevron_right",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
expect(canvas.getByText('Text with icon')).toBeDefined()
expect(canvas.getByTestId('MaterialIcon')).toBeDefined()
expect(canvas.getByText("Text with icon")).toBeDefined()
expect(canvas.getByTestId("MaterialIcon")).toBeDefined()
},
}
@@ -569,13 +569,13 @@ export const TextWithIconInverted: Story = {
globals: globalStoryPropsInverted,
args: {
...TextWithIcon.args,
color: 'Inverted',
color: "Inverted",
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(await canvas.findByRole('button'))
await userEvent.click(await canvas.findByRole("button"))
expect(args.onPress).toHaveBeenCalledTimes(1)
expect(canvas.getByText('Text with icon')).toBeDefined()
expect(canvas.getByTestId('MaterialIcon')).toBeDefined()
expect(canvas.getByText("Text with icon")).toBeDefined()
expect(canvas.getByTestId("MaterialIcon")).toBeDefined()
},
}