From ba1cd3424a7ee08da954bb633963a8b6e3a66f5c Mon Sep 17 00:00:00 2001 From: Aram Limpens Date: Fri, 24 May 2024 11:38:51 +0200 Subject: [PATCH] Case sensitive rename fix pt 1 --- packages/react/src/Fieldset/Fieldset.test.tsx | 49 ------- packages/react/src/Fieldset/Fieldset.tsx | 30 ---- packages/react/src/Fieldset/README.md | 5 - packages/react/src/Fieldset/index.ts | 2 - .../src/{ => temp}/FieldSet/FieldSet.test.tsx | 0 .../src/{ => temp}/FieldSet/FieldSet.tsx | 0 .../react/src/{ => temp}/FieldSet/README.md | 0 .../react/src/{ => temp}/FieldSet/index.ts | 0 .../src/components/FieldSet/FieldSet.docs.mdx | 49 ------- .../components/FieldSet/FieldSet.stories.tsx | 130 ------------------ .../FieldSet}/Fieldset.docs.mdx | 0 .../FieldSet}/Fieldset.stories.tsx | 0 12 files changed, 265 deletions(-) delete mode 100644 packages/react/src/Fieldset/Fieldset.test.tsx delete mode 100644 packages/react/src/Fieldset/Fieldset.tsx delete mode 100644 packages/react/src/Fieldset/README.md delete mode 100644 packages/react/src/Fieldset/index.ts rename packages/react/src/{ => temp}/FieldSet/FieldSet.test.tsx (100%) rename packages/react/src/{ => temp}/FieldSet/FieldSet.tsx (100%) rename packages/react/src/{ => temp}/FieldSet/README.md (100%) rename packages/react/src/{ => temp}/FieldSet/index.ts (100%) delete mode 100644 storybook/src/components/FieldSet/FieldSet.docs.mdx delete mode 100644 storybook/src/components/FieldSet/FieldSet.stories.tsx rename storybook/src/components/{Fieldset => temp/FieldSet}/Fieldset.docs.mdx (100%) rename storybook/src/components/{Fieldset => temp/FieldSet}/Fieldset.stories.tsx (100%) diff --git a/packages/react/src/Fieldset/Fieldset.test.tsx b/packages/react/src/Fieldset/Fieldset.test.tsx deleted file mode 100644 index 3d59b50c52..0000000000 --- a/packages/react/src/Fieldset/Fieldset.test.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { render, screen } from '@testing-library/react' -import { createRef } from 'react' -import { FieldSet } from './FieldSet' -import '@testing-library/jest-dom' - -describe('FieldSet', () => { - it('renders', () => { - render(
) - - const component = screen.getByRole('group', { name: 'Test' }) - - expect(component).toBeInTheDocument() - expect(component).toBeVisible() - }) - - it('renders a design system BEM class name', () => { - render(
) - - const component = screen.getByRole('group', { name: 'Test' }) - - expect(component).toHaveClass('ams-field-set') - }) - - it('renders an additional class name', () => { - render(
) - - const component = screen.getByRole('group', { name: 'Test' }) - - expect(component).toHaveClass('ams-field-set extra') - }) - - it('renders the correct legend class name', () => { - const { container } = render(
) - - const component = container.querySelector('legend') - - expect(component).toHaveClass('ams-field-set__legend') - }) - - it('supports ForwardRef in React', () => { - const ref = createRef() - - render(
) - - const component = screen.getByRole('group', { name: 'Test' }) - - expect(ref.current).toBe(component) - }) -}) diff --git a/packages/react/src/Fieldset/Fieldset.tsx b/packages/react/src/Fieldset/Fieldset.tsx deleted file mode 100644 index cb424ad202..0000000000 --- a/packages/react/src/Fieldset/Fieldset.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license EUPL-1.2+ - * Copyright Gemeente Amsterdam - */ - -import clsx from 'clsx' -import { forwardRef } from 'react' -import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' - -export type FieldSetProps = PropsWithChildren> & { - /** Whether the field set has an input with a validation error */ - invalid?: boolean - /** The text for the caption. */ - legend: string -} - -export const FieldSet = forwardRef( - ({ children, className, invalid, legend, ...restProps }: FieldSetProps, ref: ForwardedRef) => ( -
- {legend} - {children} -
- ), -) - -FieldSet.displayName = 'FieldSet' diff --git a/packages/react/src/Fieldset/README.md b/packages/react/src/Fieldset/README.md deleted file mode 100644 index e43373132f..0000000000 --- a/packages/react/src/Fieldset/README.md +++ /dev/null @@ -1,5 +0,0 @@ - - -# React Field Set component - -[Field Set documentation](../../../css/src/components/field-set/README.md) diff --git a/packages/react/src/Fieldset/index.ts b/packages/react/src/Fieldset/index.ts deleted file mode 100644 index 7460a8bcd1..0000000000 --- a/packages/react/src/Fieldset/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { FieldSet } from './FieldSet' -export type { FieldSetProps } from './FieldSet' diff --git a/packages/react/src/FieldSet/FieldSet.test.tsx b/packages/react/src/temp/FieldSet/FieldSet.test.tsx similarity index 100% rename from packages/react/src/FieldSet/FieldSet.test.tsx rename to packages/react/src/temp/FieldSet/FieldSet.test.tsx diff --git a/packages/react/src/FieldSet/FieldSet.tsx b/packages/react/src/temp/FieldSet/FieldSet.tsx similarity index 100% rename from packages/react/src/FieldSet/FieldSet.tsx rename to packages/react/src/temp/FieldSet/FieldSet.tsx diff --git a/packages/react/src/FieldSet/README.md b/packages/react/src/temp/FieldSet/README.md similarity index 100% rename from packages/react/src/FieldSet/README.md rename to packages/react/src/temp/FieldSet/README.md diff --git a/packages/react/src/FieldSet/index.ts b/packages/react/src/temp/FieldSet/index.ts similarity index 100% rename from packages/react/src/FieldSet/index.ts rename to packages/react/src/temp/FieldSet/index.ts diff --git a/storybook/src/components/FieldSet/FieldSet.docs.mdx b/storybook/src/components/FieldSet/FieldSet.docs.mdx deleted file mode 100644 index bc52df23a7..0000000000 --- a/storybook/src/components/FieldSet/FieldSet.docs.mdx +++ /dev/null @@ -1,49 +0,0 @@ -import { Canvas, Controls, Markdown, Meta, Primary } from "@storybook/blocks"; -import * as FieldSetStories from "./FieldSet.stories.tsx"; -import README from "../../../../packages/css/src/components/field-set/README.md?raw"; - - - -{README} - - - - - -## Examples - -## With Description - -A Field Set can have a description. -Make sure to connect this description to the Field Set or a specific input, -otherwise this won’t be read by a screen reader. - - - -## With Error - -A Field Set can indicate whether any of the inputs it contains has a validation error. - - - -### Radio group - -Use a Field Set to group radio buttons. -When grouping radio inputs, use `role="radiogroup"` on Field Set to have this grouping explicitly announced as a radio group. -Field Set has a default role of `group`. - -Using `role="radiogroup"` also allows you to use `aria-required` on Field Set, which isn’t allowed for role `group`. -Always also set `aria-required` on the individual radio buttons though, to make sure it’s read by screen readers. - - - -### Checkbox group - -Use a Field Set to group checkboxes. - -Please note: [NVDA has bug](https://github.com/nvaccess/nvda/issues/12718) which causes it to -not report a description connected to a Field Set when the Field Set contains checkboxes. - -Try to avoid using descriptions for Field Sets containing checkboxes for this reason. - - diff --git a/storybook/src/components/FieldSet/FieldSet.stories.tsx b/storybook/src/components/FieldSet/FieldSet.stories.tsx deleted file mode 100644 index 18e470fa76..0000000000 --- a/storybook/src/components/FieldSet/FieldSet.stories.tsx +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @license EUPL-1.2+ - * Copyright Gemeente Amsterdam - */ - -import { Checkbox, Column, FieldSet, Label, Paragraph, Radio, TextInput } from '@amsterdam/design-system-react/src' -import { Meta, StoryObj } from '@storybook/react' - -const meta = { - title: 'Components/Forms/Field Set', - component: FieldSet, - args: { - invalid: false, - legend: 'Wat is uw naam?', - }, - decorators: [ - (Story) => ( -
- - - ), - ], -} satisfies Meta - -export default meta - -type Story = StoryObj - -export const Default: Story = { - render: (args) => ( -
- - - - - - -
- ), -} - -export const WithDescription: Story = { - render: (args) => ( -
- - Vul uw naam in zoals in uw paspoort staat. - - - - - - - -
- ), -} - -export const WithError: Story = { - args: { invalid: true }, - render: (args) => ( -
- - Vul uw naam in zoals in uw paspoort staat. - - - - - - - -
- ), -} - -export const RadioGroup: Story = { - args: { - legend: 'Waar gaat uw melding over?', - }, - render: (args) => ( -
- - De laatstgenoemde melding. - - - - Horecabedrijf - - - Ander soort bedrijf - - - Evenement - - - Iets anders - - -
- ), -} - -export const CheckboxGroup: Story = { - args: { - legend: 'Waar gaat uw melding over?', - }, - render: (args) => ( -
- - - Horecabedrijf - - - Ander soort bedrijf - - - Evenement - - - Iets anders - - -
- ), -} diff --git a/storybook/src/components/Fieldset/Fieldset.docs.mdx b/storybook/src/components/temp/FieldSet/Fieldset.docs.mdx similarity index 100% rename from storybook/src/components/Fieldset/Fieldset.docs.mdx rename to storybook/src/components/temp/FieldSet/Fieldset.docs.mdx diff --git a/storybook/src/components/Fieldset/Fieldset.stories.tsx b/storybook/src/components/temp/FieldSet/Fieldset.stories.tsx similarity index 100% rename from storybook/src/components/Fieldset/Fieldset.stories.tsx rename to storybook/src/components/temp/FieldSet/Fieldset.stories.tsx