Merged in feat/SW-3655-input-component (pull request #3296)

feat: (SW-3655) new Input and FormInput components

* First version new Input and FormInput components

* Handle aria-describedby with react-aria instead of manually add it

* Update breaking unit and stories tests

* Merge branch 'master' into feat/SW-3655-input-component

* Update example form

* Merge branch 'master' into feat/SW-3655-input-component

* New lock file


Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2025-12-08 08:51:03 +00:00
parent de4b3c1c3c
commit edca33c49f
33 changed files with 2159 additions and 71 deletions

View File

@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { expect } from 'storybook/test'
import { expect, fn } from 'storybook/test'
import { MaterialIcon } from '../Icons/MaterialIcon'
import { IconButton } from './IconButton'
@@ -60,7 +60,7 @@ type Story = StoryObj<typeof IconButton>
export const Default: Story = {
args: {
onPress: () => alert('Icon button pressed!'),
onPress: fn(),
children: <MaterialIcon icon="search" size={24} color="CurrentColor" />,
},
play: async ({ canvas, userEvent, args }) => {
@@ -73,10 +73,11 @@ export const Primary: Story = {
args: {
...Default.args,
theme: 'Primary',
onPress: fn(), // Fresh spy instance
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
expect(args.onPress).toHaveBeenCalledTimes(0)
expect(args.onPress).toHaveBeenCalledTimes(1)
},
}
@@ -84,6 +85,7 @@ export const PrimaryDisabled: Story = {
args: {
...Primary.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
@@ -109,6 +111,7 @@ export const InvertedDisabled: Story = {
args: {
...Inverted.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
@@ -131,6 +134,7 @@ export const InvertedElevatedDisabled: Story = {
args: {
...InvertedElevated.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
@@ -157,6 +161,7 @@ export const InvertedMutedDisabled: Story = {
args: {
...InvertedMuted.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
@@ -180,6 +185,7 @@ export const InvertedFadedDisabled: Story = {
args: {
...InvertedFaded.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
@@ -204,6 +210,7 @@ export const TertiaryDisabled: Story = {
args: {
...TertiaryElevated.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))
@@ -227,6 +234,7 @@ export const BlackMutedDisabled: Story = {
args: {
...BlackMuted.args,
isDisabled: true,
onPress: fn(), // Fresh spy instance for disabled test
},
play: async ({ canvas, userEvent, args }) => {
await userEvent.click(canvas.getByRole('button'))