From 1d9e0fa1db2f137a77e50937a9d429cb633c4e3d Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Tue, 16 Jan 2024 10:43:30 +0100 Subject: [PATCH 1/4] Include children in exported prop types --- packages/react/src/Accordion/AccordionSection.tsx | 4 ++-- packages/react/src/Blockquote/Blockquote.tsx | 7 ++----- packages/react/src/Button/Button.tsx | 7 ++----- packages/react/src/Checkbox/Checkbox.tsx | 4 ++-- packages/react/src/Heading/Heading.tsx | 4 ++-- packages/react/src/Link/Link.tsx | 4 ++-- packages/react/src/OrderedList/OrderedList.tsx | 12 +++--------- packages/react/src/PageHeading/PageHeading.tsx | 7 ++----- packages/react/src/Paragraph/Paragraph.tsx | 4 ++-- packages/react/src/UnorderedList/UnorderedList.tsx | 7 ++----- 10 files changed, 21 insertions(+), 39 deletions(-) diff --git a/packages/react/src/Accordion/AccordionSection.tsx b/packages/react/src/Accordion/AccordionSection.tsx index 0e4a162649..2d164e57a3 100644 --- a/packages/react/src/Accordion/AccordionSection.tsx +++ b/packages/react/src/Accordion/AccordionSection.tsx @@ -10,14 +10,14 @@ import AccordionContext from './AccordionContext' import { getHeadingElement } from '../Heading/Heading' import { Icon } from '../Icon/Icon' -export interface AccordionSectionProps extends HTMLAttributes { +export interface AccordionSectionProps extends PropsWithChildren> { label: string expanded?: boolean } export const AccordionSection = forwardRef( ( - { label, expanded = false, children, className, ...otherProps }: PropsWithChildren, + { label, expanded = false, children, className, ...otherProps }: AccordionSectionProps, ref: ForwardedRef, ) => { const { headingLevel, section } = useContext(AccordionContext) diff --git a/packages/react/src/Blockquote/Blockquote.tsx b/packages/react/src/Blockquote/Blockquote.tsx index 158fdb1322..11c6def062 100644 --- a/packages/react/src/Blockquote/Blockquote.tsx +++ b/packages/react/src/Blockquote/Blockquote.tsx @@ -6,7 +6,7 @@ import clsx from 'clsx' import { BlockquoteHTMLAttributes, ForwardedRef, forwardRef, PropsWithChildren } from 'react' -export interface BlockquoteProps extends BlockquoteHTMLAttributes { +export interface BlockquoteProps extends PropsWithChildren> { /** * De kleur van het citaat. * Gebruik deze property om het citaat in tegenovergestelde kleur te tonen. @@ -15,10 +15,7 @@ export interface BlockquoteProps extends BlockquoteHTMLAttributes, - ref: ForwardedRef, - ) => ( + ({ children, className, inverseColor, ...restProps }: BlockquoteProps, ref: ForwardedRef) => (
{ +export interface ButtonProps extends PropsWithChildren> { variant?: 'primary' | 'secondary' | 'tertiary' } @@ -26,10 +26,7 @@ function getAppearance(variant: ButtonProps['variant']): CommunityButtonAppearan } export const Button = forwardRef( - ( - { children, disabled, variant = 'primary', ...restProps }: PropsWithChildren, - ref: ForwardedRef, - ) => { + ({ children, disabled, variant = 'primary', ...restProps }: ButtonProps, ref: ForwardedRef) => { return ( { +export interface CheckboxProps extends PropsWithChildren> { invalid?: boolean indeterminate?: boolean } export const Checkbox = forwardRef( ( - { children, className, invalid, indeterminate, ...restProps }: PropsWithChildren, + { children, className, invalid, indeterminate, ...restProps }: CheckboxProps, ref: ForwardedRef, ) => { const id = useId() diff --git a/packages/react/src/Heading/Heading.tsx b/packages/react/src/Heading/Heading.tsx index 7caaaf6806..690250bffe 100644 --- a/packages/react/src/Heading/Heading.tsx +++ b/packages/react/src/Heading/Heading.tsx @@ -10,7 +10,7 @@ import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'rea export type HeadingLevel = 1 | 2 | 3 | 4 type HeadingSize = 'level-1' | 'level-2' | 'level-3' | 'level-4' | 'level-5' | 'level-6' -export interface HeadingProps extends HTMLAttributes { +export interface HeadingProps extends PropsWithChildren> { /** * Het hiƫrarchische niveau van de titel. */ @@ -42,7 +42,7 @@ export function getHeadingElement(level: HeadingLevel) { export const Heading = forwardRef( ( - { children, className, inverseColor, level = 1, size, ...restProps }: PropsWithChildren, + { children, className, inverseColor, level = 1, size, ...restProps }: HeadingProps, ref: ForwardedRef, ) => { const HeadingX = getHeadingElement(level) diff --git a/packages/react/src/Link/Link.tsx b/packages/react/src/Link/Link.tsx index 47e6ce1a4c..54e108503e 100644 --- a/packages/react/src/Link/Link.tsx +++ b/packages/react/src/Link/Link.tsx @@ -26,11 +26,11 @@ type ConditionalProps = icon?: Function } -export type LinkProps = CommonProps & ConditionalProps +export type LinkProps = PropsWithChildren export const Link = forwardRef( ( - { children, variant = 'standalone', icon, onBackground, className, ...otherProps }: PropsWithChildren, + { children, variant = 'standalone', icon, onBackground, className, ...otherProps }: LinkProps, ref: ForwardedRef, ) => ( , - ref: ForwardedRef, - ) => { + ({ children, markers = true, className, ...restProps }: OrderedListProps, ref: ForwardedRef) => { return (
    +export type OrderedListItemProps = PropsWithChildren> export const OrderedListItem = forwardRef( - ( - { children, className, ...restProps }: PropsWithChildren, - ref: ForwardedRef, - ) => { + ({ children, className, ...restProps }: OrderedListItemProps, ref: ForwardedRef) => { return (
  1. {children} diff --git a/packages/react/src/PageHeading/PageHeading.tsx b/packages/react/src/PageHeading/PageHeading.tsx index 16446fcf56..b5b647017a 100644 --- a/packages/react/src/PageHeading/PageHeading.tsx +++ b/packages/react/src/PageHeading/PageHeading.tsx @@ -6,7 +6,7 @@ import clsx from 'clsx' import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' -export interface PageHeadingProps extends HTMLAttributes { +export interface PageHeadingProps extends PropsWithChildren> { /** * De kleur van de titel * Gebruik deze property om de titel in tegenovergestelde kleur te tonen. @@ -15,10 +15,7 @@ export interface PageHeadingProps extends HTMLAttributes { } export const PageHeading = forwardRef( - ( - { children, className, inverseColor, ...restProps }: PropsWithChildren, - ref: ForwardedRef, - ) => ( + ({ children, className, inverseColor, ...restProps }: PageHeadingProps, ref: ForwardedRef) => (

    { +export interface ParagraphProps extends PropsWithChildren> { size?: 'small' | 'large' /** * De kleur van de paragraaf @@ -18,7 +18,7 @@ export interface ParagraphProps extends HTMLAttributes { export const Paragraph = forwardRef( ( - { children, className, inverseColor, size, ...otherProps }: PropsWithChildren, + { children, className, inverseColor, size, ...otherProps }: ParagraphProps, ref: ForwardedRef, ) => (

    +export type UnorderedListItemProps = PropsWithChildren> export const UnorderedListItem = forwardRef( - ( - { children, className, ...restProps }: PropsWithChildren, - ref: ForwardedRef, - ) => { + ({ children, className, ...restProps }: UnorderedListItemProps, ref: ForwardedRef) => { return (

  2. {children} From 30d3e5fe5ad2db85084df4eb6b45ce635eb50845 Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Tue, 16 Jan 2024 10:58:26 +0100 Subject: [PATCH 2/4] Import types explicitly --- packages/react/src/Accordion/Accordion.tsx | 12 ++---------- packages/react/src/Accordion/AccordionSection.tsx | 3 ++- packages/react/src/AspectRatio/AspectRatio.tsx | 3 ++- packages/react/src/Blockquote/Blockquote.tsx | 3 ++- packages/react/src/Breadcrumb/Breadcrumb.tsx | 10 ++-------- packages/react/src/Button/Button.tsx | 3 ++- packages/react/src/Card/Card.tsx | 4 ++-- packages/react/src/Checkbox/Checkbox.tsx | 12 ++---------- packages/react/src/Dialog/Dialog.tsx | 3 ++- packages/react/src/Footer/Footer.tsx | 10 ++-------- packages/react/src/FormLabel/FormLabel.tsx | 3 ++- packages/react/src/Grid/Grid.tsx | 10 ++-------- packages/react/src/Grid/GridCell.tsx | 3 ++- packages/react/src/Header/Header.tsx | 3 ++- packages/react/src/Heading/Heading.tsx | 3 ++- packages/react/src/Icon/Icon.tsx | 3 ++- packages/react/src/IconButton/IconButton.tsx | 3 ++- packages/react/src/Image/Image.tsx | 3 ++- packages/react/src/Image/index.ts | 3 ++- packages/react/src/Link/Link.tsx | 3 ++- packages/react/src/Logo/Logo.tsx | 3 ++- packages/react/src/Logo/brand/LogoAmsterdam.tsx | 3 ++- packages/react/src/Logo/brand/LogoGgdAmsterdam.tsx | 3 ++- packages/react/src/Logo/brand/LogoStadsarchief.tsx | 3 ++- .../react/src/Logo/brand/LogoStadsbankVanLening.tsx | 3 ++- .../react/src/Logo/brand/LogoVgaVerzekeringen.tsx | 3 ++- packages/react/src/Mark/Mark.tsx | 3 ++- packages/react/src/MegaMenu/MegaMenu.tsx | 10 ++-------- packages/react/src/OrderedList/OrderedList.tsx | 5 ++--- packages/react/src/Overlap/Overlap.tsx | 3 ++- packages/react/src/PageHeading/PageHeading.tsx | 3 ++- packages/react/src/PageMenu/PageMenu.tsx | 4 ++-- packages/react/src/Pagination/Pagination.tsx | 3 ++- packages/react/src/Paragraph/Paragraph.tsx | 3 ++- packages/react/src/Screen/Screen.tsx | 3 ++- packages/react/src/SearchField/SearchField.tsx | 10 ++-------- packages/react/src/SearchField/SearchFieldButton.tsx | 3 ++- packages/react/src/SearchField/SearchFieldInput.tsx | 3 ++- packages/react/src/Switch/Switch.tsx | 3 ++- packages/react/src/Table/TableCaption.tsx | 3 ++- packages/react/src/TextInput/TextInput.tsx | 3 ++- packages/react/src/TopTaskLink/TopTaskLink.tsx | 3 ++- packages/react/src/UnorderedList/UnorderedList.tsx | 4 ++-- packages/react/src/VisuallyHidden/VisuallyHidden.tsx | 3 ++- 44 files changed, 88 insertions(+), 102 deletions(-) diff --git a/packages/react/src/Accordion/Accordion.tsx b/packages/react/src/Accordion/Accordion.tsx index 2f65c8ec27..61dcffe841 100644 --- a/packages/react/src/Accordion/Accordion.tsx +++ b/packages/react/src/Accordion/Accordion.tsx @@ -4,16 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, - useImperativeHandle, - useRef, -} from 'react' +import { forwardRef, useImperativeHandle, useRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' import AccordionContext from './AccordionContext' import { AccordionSection } from './AccordionSection' import useFocusWithArrows from './useFocusWithArrows' diff --git a/packages/react/src/Accordion/AccordionSection.tsx b/packages/react/src/Accordion/AccordionSection.tsx index 2d164e57a3..6908d14c92 100644 --- a/packages/react/src/Accordion/AccordionSection.tsx +++ b/packages/react/src/Accordion/AccordionSection.tsx @@ -5,7 +5,8 @@ import { ChevronDownIcon } from '@amsterdam/design-system-react-icons' import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren, useContext, useId, useState } from 'react' +import { forwardRef, useContext, useId, useState } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' import AccordionContext from './AccordionContext' import { getHeadingElement } from '../Heading/Heading' import { Icon } from '../Icon/Icon' diff --git a/packages/react/src/AspectRatio/AspectRatio.tsx b/packages/react/src/AspectRatio/AspectRatio.tsx index e3cf5de642..7dadac092b 100644 --- a/packages/react/src/AspectRatio/AspectRatio.tsx +++ b/packages/react/src/AspectRatio/AspectRatio.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export type Ratio = 'x-tall' | 'tall' | 'square' | 'wide' | 'x-wide' | '2x-wide' diff --git a/packages/react/src/Blockquote/Blockquote.tsx b/packages/react/src/Blockquote/Blockquote.tsx index 11c6def062..4d5fac6081 100644 --- a/packages/react/src/Blockquote/Blockquote.tsx +++ b/packages/react/src/Blockquote/Blockquote.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { BlockquoteHTMLAttributes, ForwardedRef, forwardRef, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { BlockquoteHTMLAttributes, ForwardedRef, PropsWithChildren } from 'react' export interface BlockquoteProps extends PropsWithChildren> { /** diff --git a/packages/react/src/Breadcrumb/Breadcrumb.tsx b/packages/react/src/Breadcrumb/Breadcrumb.tsx index 4f91b8aedc..963f6115cb 100644 --- a/packages/react/src/Breadcrumb/Breadcrumb.tsx +++ b/packages/react/src/Breadcrumb/Breadcrumb.tsx @@ -1,11 +1,5 @@ -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, -} from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' type BreadcrumbProps = PropsWithChildren> diff --git a/packages/react/src/Button/Button.tsx b/packages/react/src/Button/Button.tsx index 8c865d2386..63ae34338f 100644 --- a/packages/react/src/Button/Button.tsx +++ b/packages/react/src/Button/Button.tsx @@ -6,7 +6,8 @@ import { Button as CommunityButton } from '@utrecht/component-library-react' import clsx from 'clsx' -import { ButtonHTMLAttributes, ForwardedRef, forwardRef, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ButtonHTMLAttributes, ForwardedRef, PropsWithChildren } from 'react' export interface ButtonProps extends PropsWithChildren> { variant?: 'primary' | 'secondary' | 'tertiary' diff --git a/packages/react/src/Card/Card.tsx b/packages/react/src/Card/Card.tsx index 1edfe6e855..226feaee76 100644 --- a/packages/react/src/Card/Card.tsx +++ b/packages/react/src/Card/Card.tsx @@ -4,10 +4,10 @@ */ import clsx from 'clsx' -import { +import { forwardRef } from 'react' +import type { AnchorHTMLAttributes, ForwardedRef, - forwardRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, diff --git a/packages/react/src/Checkbox/Checkbox.tsx b/packages/react/src/Checkbox/Checkbox.tsx index 5483d5c98f..2763bcf4a3 100644 --- a/packages/react/src/Checkbox/Checkbox.tsx +++ b/packages/react/src/Checkbox/Checkbox.tsx @@ -4,16 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - InputHTMLAttributes, - PropsWithChildren, - useEffect, - useId, - useImperativeHandle, - useRef, -} from 'react' +import { forwardRef, useEffect, useId, useImperativeHandle, useRef } from 'react' +import type { ForwardedRef, InputHTMLAttributes, PropsWithChildren } from 'react' export interface CheckboxProps extends PropsWithChildren> { invalid?: boolean diff --git a/packages/react/src/Dialog/Dialog.tsx b/packages/react/src/Dialog/Dialog.tsx index 13d5ad62b1..7d6ce96a2f 100644 --- a/packages/react/src/Dialog/Dialog.tsx +++ b/packages/react/src/Dialog/Dialog.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { DialogHTMLAttributes, ForwardedRef, forwardRef, PropsWithChildren, ReactNode } from 'react' +import { forwardRef } from 'react' +import type { DialogHTMLAttributes, ForwardedRef, PropsWithChildren, ReactNode } from 'react' import { IconButton } from '../IconButton' export interface DialogProps extends PropsWithChildren> { diff --git a/packages/react/src/Footer/Footer.tsx b/packages/react/src/Footer/Footer.tsx index 57f444cdbb..ce6937c0da 100644 --- a/packages/react/src/Footer/Footer.tsx +++ b/packages/react/src/Footer/Footer.tsx @@ -4,14 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, -} from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' import { Spotlight } from '../Spotlight/Spotlight' export const FooterTop = forwardRef( diff --git a/packages/react/src/FormLabel/FormLabel.tsx b/packages/react/src/FormLabel/FormLabel.tsx index cac1163f45..6b3b738a24 100644 --- a/packages/react/src/FormLabel/FormLabel.tsx +++ b/packages/react/src/FormLabel/FormLabel.tsx @@ -5,7 +5,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, LabelHTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, LabelHTMLAttributes, PropsWithChildren } from 'react' export const FormLabel = forwardRef( ( diff --git a/packages/react/src/Grid/Grid.tsx b/packages/react/src/Grid/Grid.tsx index 3074605e68..f010c3e984 100644 --- a/packages/react/src/Grid/Grid.tsx +++ b/packages/react/src/Grid/Grid.tsx @@ -4,14 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, -} from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' import { GridCell } from './GridCell' export type GridColumnNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 diff --git a/packages/react/src/Grid/GridCell.tsx b/packages/react/src/Grid/GridCell.tsx index 1455757195..0f6ad322ca 100644 --- a/packages/react/src/Grid/GridCell.tsx +++ b/packages/react/src/Grid/GridCell.tsx @@ -3,7 +3,8 @@ * Copyright (c) 2023 Gemeente Amsterdam */ import clsx from 'clsx' -import { type ForwardedRef, forwardRef, type HTMLAttributes, type PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' import { GridColumnNumber, GridColumnNumbers } from './Grid' import { gridCellClasses } from './gridCellClasses' diff --git a/packages/react/src/Header/Header.tsx b/packages/react/src/Header/Header.tsx index 58431439d8..198007896b 100644 --- a/packages/react/src/Header/Header.tsx +++ b/packages/react/src/Header/Header.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, ReactNode } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, ReactNode } from 'react' import { Heading } from '../Heading' import { Logo } from '../Logo' import type { LogoBrand } from '../Logo' diff --git a/packages/react/src/Heading/Heading.tsx b/packages/react/src/Heading/Heading.tsx index 690250bffe..0068eeafc7 100644 --- a/packages/react/src/Heading/Heading.tsx +++ b/packages/react/src/Heading/Heading.tsx @@ -5,7 +5,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export type HeadingLevel = 1 | 2 | 3 | 4 type HeadingSize = 'level-1' | 'level-2' | 'level-3' | 'level-4' | 'level-5' | 'level-6' diff --git a/packages/react/src/Icon/Icon.tsx b/packages/react/src/Icon/Icon.tsx index 722f0855d0..64f56f09a5 100644 --- a/packages/react/src/Icon/Icon.tsx +++ b/packages/react/src/Icon/Icon.tsx @@ -6,7 +6,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes } from 'react' export interface IconProps extends HTMLAttributes { size?: 'level-3' | 'level-4' | 'level-5' | 'level-6' diff --git a/packages/react/src/IconButton/IconButton.tsx b/packages/react/src/IconButton/IconButton.tsx index ec866f55a0..7c0dbf5067 100644 --- a/packages/react/src/IconButton/IconButton.tsx +++ b/packages/react/src/IconButton/IconButton.tsx @@ -5,7 +5,8 @@ import { CloseIcon } from '@amsterdam/design-system-react-icons' import clsx from 'clsx' -import { ButtonHTMLAttributes, ForwardedRef, forwardRef } from 'react' +import { forwardRef } from 'react' +import type { ButtonHTMLAttributes, ForwardedRef } from 'react' import { Icon } from '../Icon' import { VisuallyHidden } from '../VisuallyHidden' diff --git a/packages/react/src/Image/Image.tsx b/packages/react/src/Image/Image.tsx index 2fb6f726ba..817a098c38 100644 --- a/packages/react/src/Image/Image.tsx +++ b/packages/react/src/Image/Image.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { type ForwardedRef, forwardRef, type ImgHTMLAttributes } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ImgHTMLAttributes } from 'react' export interface ImageProps extends ImgHTMLAttributes { cover?: Boolean diff --git a/packages/react/src/Image/index.ts b/packages/react/src/Image/index.ts index d28c8bd778..f9de85a6b9 100644 --- a/packages/react/src/Image/index.ts +++ b/packages/react/src/Image/index.ts @@ -1 +1,2 @@ -export { Image, type ImageProps } from './Image' +export { Image } from './Image' +export type { ImageProps } from './Image' diff --git a/packages/react/src/Link/Link.tsx b/packages/react/src/Link/Link.tsx index 54e108503e..178ccafd08 100644 --- a/packages/react/src/Link/Link.tsx +++ b/packages/react/src/Link/Link.tsx @@ -5,7 +5,8 @@ import { ChevronRightIcon } from '@amsterdam/design-system-react-icons' import clsx from 'clsx' -import { AnchorHTMLAttributes, ForwardedRef, forwardRef, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { AnchorHTMLAttributes, ForwardedRef, PropsWithChildren } from 'react' import { Icon } from '../Icon/Icon' type LinkOnBackground = 'default' | 'light' | 'dark' diff --git a/packages/react/src/Logo/Logo.tsx b/packages/react/src/Logo/Logo.tsx index a50322fb10..f5761471b1 100644 --- a/packages/react/src/Logo/Logo.tsx +++ b/packages/react/src/Logo/Logo.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, ForwardRefExoticComponent, RefAttributes, SVGProps } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, RefAttributes, SVGProps } from 'react' import { LogoAmsterdam, LogoGgdAmsterdam, diff --git a/packages/react/src/Logo/brand/LogoAmsterdam.tsx b/packages/react/src/Logo/brand/LogoAmsterdam.tsx index ff77c4d1da..9be9da5ed2 100644 --- a/packages/react/src/Logo/brand/LogoAmsterdam.tsx +++ b/packages/react/src/Logo/brand/LogoAmsterdam.tsx @@ -1,4 +1,5 @@ -import { ForwardedRef, forwardRef, type SVGProps } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, SVGProps } from 'react' const LogoAmsterdam = forwardRef((props: SVGProps, ref: ForwardedRef) => ( , ref: ForwardedRef) => ( , ref: ForwardedRef) => ( , ref: ForwardedRef) => ( , ref: ForwardedRef) => ( > {} diff --git a/packages/react/src/MegaMenu/MegaMenu.tsx b/packages/react/src/MegaMenu/MegaMenu.tsx index bdac9d85a7..6ba66901a4 100644 --- a/packages/react/src/MegaMenu/MegaMenu.tsx +++ b/packages/react/src/MegaMenu/MegaMenu.tsx @@ -4,14 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, -} from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' type MegaMenuProps = {} & PropsWithChildren> diff --git a/packages/react/src/OrderedList/OrderedList.tsx b/packages/react/src/OrderedList/OrderedList.tsx index b4f9a70ea3..55d135b029 100644 --- a/packages/react/src/OrderedList/OrderedList.tsx +++ b/packages/react/src/OrderedList/OrderedList.tsx @@ -4,16 +4,15 @@ */ import clsx from 'clsx' -import { +import { forwardRef } from 'react' +import type { ForwardedRef, - forwardRef, ForwardRefExoticComponent, LiHTMLAttributes, OlHTMLAttributes, PropsWithChildren, RefAttributes, } from 'react' - export interface OrderedListProps extends PropsWithChildren> { markers?: boolean } diff --git a/packages/react/src/Overlap/Overlap.tsx b/packages/react/src/Overlap/Overlap.tsx index 15909896b8..04ac0bccd9 100644 --- a/packages/react/src/Overlap/Overlap.tsx +++ b/packages/react/src/Overlap/Overlap.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { type ForwardedRef, forwardRef, type HTMLAttributes, type PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export const Overlap = forwardRef( ( diff --git a/packages/react/src/PageHeading/PageHeading.tsx b/packages/react/src/PageHeading/PageHeading.tsx index b5b647017a..c9a2207ebe 100644 --- a/packages/react/src/PageHeading/PageHeading.tsx +++ b/packages/react/src/PageHeading/PageHeading.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export interface PageHeadingProps extends PropsWithChildren> { /** diff --git a/packages/react/src/PageMenu/PageMenu.tsx b/packages/react/src/PageMenu/PageMenu.tsx index bc2ccfadd6..92d9657587 100644 --- a/packages/react/src/PageMenu/PageMenu.tsx +++ b/packages/react/src/PageMenu/PageMenu.tsx @@ -4,11 +4,11 @@ */ import clsx from 'clsx' -import { +import { forwardRef } from 'react' +import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ForwardedRef, - forwardRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, diff --git a/packages/react/src/Pagination/Pagination.tsx b/packages/react/src/Pagination/Pagination.tsx index 6d9c4c7ca4..fd5c2f9de9 100644 --- a/packages/react/src/Pagination/Pagination.tsx +++ b/packages/react/src/Pagination/Pagination.tsx @@ -5,7 +5,8 @@ import { ChevronLeftIcon, ChevronRightIcon } from '@amsterdam/design-system-react-icons' import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, useMemo, useState } from 'react' +import { forwardRef, useMemo, useState } from 'react' +import type { ForwardedRef, HTMLAttributes } from 'react' import { Icon } from '../Icon/Icon' export interface PaginationProps extends HTMLAttributes { diff --git a/packages/react/src/Paragraph/Paragraph.tsx b/packages/react/src/Paragraph/Paragraph.tsx index c850905e25..4a1a10ffed 100644 --- a/packages/react/src/Paragraph/Paragraph.tsx +++ b/packages/react/src/Paragraph/Paragraph.tsx @@ -5,7 +5,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export interface ParagraphProps extends PropsWithChildren> { size?: 'small' | 'large' diff --git a/packages/react/src/Screen/Screen.tsx b/packages/react/src/Screen/Screen.tsx index cc0e727cc6..52e9669ab4 100644 --- a/packages/react/src/Screen/Screen.tsx +++ b/packages/react/src/Screen/Screen.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' type ScreenMaxWidth = 'wide' | 'x-wide' diff --git a/packages/react/src/SearchField/SearchField.tsx b/packages/react/src/SearchField/SearchField.tsx index efaf37723f..009d4952d8 100644 --- a/packages/react/src/SearchField/SearchField.tsx +++ b/packages/react/src/SearchField/SearchField.tsx @@ -4,14 +4,8 @@ */ import clsx from 'clsx' -import { - ForwardedRef, - forwardRef, - ForwardRefExoticComponent, - HTMLAttributes, - PropsWithChildren, - RefAttributes, -} from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' import { SearchFieldButton } from './SearchFieldButton' import { SearchFieldInput } from './SearchFieldInput' diff --git a/packages/react/src/SearchField/SearchFieldButton.tsx b/packages/react/src/SearchField/SearchFieldButton.tsx index 721825788c..4557a5559d 100644 --- a/packages/react/src/SearchField/SearchFieldButton.tsx +++ b/packages/react/src/SearchField/SearchFieldButton.tsx @@ -5,7 +5,8 @@ import { SearchIcon } from '@amsterdam/design-system-react-icons' import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes } from 'react' import { Icon } from '../Icon' import { VisuallyHidden } from '../VisuallyHidden' diff --git a/packages/react/src/SearchField/SearchFieldInput.tsx b/packages/react/src/SearchField/SearchFieldInput.tsx index 4557cb2cb5..0d639a83b8 100644 --- a/packages/react/src/SearchField/SearchFieldInput.tsx +++ b/packages/react/src/SearchField/SearchFieldInput.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, InputHTMLAttributes, useId } from 'react' +import { forwardRef, useId } from 'react' +import type { ForwardedRef, InputHTMLAttributes } from 'react' import { VisuallyHidden } from '../VisuallyHidden' interface SearchFieldInputProps extends InputHTMLAttributes { diff --git a/packages/react/src/Switch/Switch.tsx b/packages/react/src/Switch/Switch.tsx index 15c0f242d9..36b13f0877 100644 --- a/packages/react/src/Switch/Switch.tsx +++ b/packages/react/src/Switch/Switch.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx' -import { ForwardedRef, forwardRef, InputHTMLAttributes, PropsWithChildren, useId } from 'react' +import { forwardRef, useId } from 'react' +import type { ForwardedRef, InputHTMLAttributes, PropsWithChildren } from 'react' export const Switch = forwardRef( ( diff --git a/packages/react/src/Table/TableCaption.tsx b/packages/react/src/Table/TableCaption.tsx index 71255bdc12..66726c2933 100644 --- a/packages/react/src/Table/TableCaption.tsx +++ b/packages/react/src/Table/TableCaption.tsx @@ -5,7 +5,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export interface TableCaptionProps extends PropsWithChildren> {} diff --git a/packages/react/src/TextInput/TextInput.tsx b/packages/react/src/TextInput/TextInput.tsx index 3df8ce16e2..091bf83aca 100644 --- a/packages/react/src/TextInput/TextInput.tsx +++ b/packages/react/src/TextInput/TextInput.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, InputHTMLAttributes } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, InputHTMLAttributes } from 'react' export interface TextInputProps extends InputHTMLAttributes {} diff --git a/packages/react/src/TopTaskLink/TopTaskLink.tsx b/packages/react/src/TopTaskLink/TopTaskLink.tsx index e4e9d10951..083284f3e6 100644 --- a/packages/react/src/TopTaskLink/TopTaskLink.tsx +++ b/packages/react/src/TopTaskLink/TopTaskLink.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { AnchorHTMLAttributes, ForwardedRef, forwardRef } from 'react' +import { forwardRef } from 'react' +import type { AnchorHTMLAttributes, ForwardedRef } from 'react' export interface TopTaskLinkProps extends AnchorHTMLAttributes { label: string diff --git a/packages/react/src/UnorderedList/UnorderedList.tsx b/packages/react/src/UnorderedList/UnorderedList.tsx index 6f7974266e..e82e77e31c 100644 --- a/packages/react/src/UnorderedList/UnorderedList.tsx +++ b/packages/react/src/UnorderedList/UnorderedList.tsx @@ -4,9 +4,9 @@ */ import clsx from 'clsx' -import { +import { forwardRef } from 'react' +import type { ForwardedRef, - forwardRef, ForwardRefExoticComponent, HTMLAttributes, LiHTMLAttributes, diff --git a/packages/react/src/VisuallyHidden/VisuallyHidden.tsx b/packages/react/src/VisuallyHidden/VisuallyHidden.tsx index 82edf3da45..64b53c0ac4 100644 --- a/packages/react/src/VisuallyHidden/VisuallyHidden.tsx +++ b/packages/react/src/VisuallyHidden/VisuallyHidden.tsx @@ -4,7 +4,8 @@ */ import clsx from 'clsx' -import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' +import { forwardRef } from 'react' +import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' export const VisuallyHidden = forwardRef( ( From 73b1f3743fb4233fc6757765309a3e549e77ecf5 Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Tue, 16 Jan 2024 10:58:51 +0100 Subject: [PATCH 3/4] Include missing license headers --- packages/react/src/Breadcrumb/Breadcrumb.tsx | 5 +++++ packages/react/src/Switch/Switch.tsx | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/react/src/Breadcrumb/Breadcrumb.tsx b/packages/react/src/Breadcrumb/Breadcrumb.tsx index 963f6115cb..9730a542d1 100644 --- a/packages/react/src/Breadcrumb/Breadcrumb.tsx +++ b/packages/react/src/Breadcrumb/Breadcrumb.tsx @@ -1,3 +1,8 @@ +/** + * @license EUPL-1.2+ + * Copyright (c) 2023 Gemeente Amsterdam + */ + import { forwardRef } from 'react' import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' diff --git a/packages/react/src/Switch/Switch.tsx b/packages/react/src/Switch/Switch.tsx index 36b13f0877..fd4c589369 100644 --- a/packages/react/src/Switch/Switch.tsx +++ b/packages/react/src/Switch/Switch.tsx @@ -1,3 +1,8 @@ +/** + * @license EUPL-1.2+ + * Copyright (c) 2023 Gemeente Amsterdam + */ + import clsx from 'clsx' import { forwardRef, useId } from 'react' import type { ForwardedRef, InputHTMLAttributes, PropsWithChildren } from 'react' From 3c5205d861375be69ccbfe84c500143a9f377af2 Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Tue, 16 Jan 2024 16:36:50 +0100 Subject: [PATCH 4/4] Export breadcrumb props --- packages/react/src/Breadcrumb/Breadcrumb.tsx | 2 +- packages/react/src/Breadcrumb/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/Breadcrumb/Breadcrumb.tsx b/packages/react/src/Breadcrumb/Breadcrumb.tsx index 9730a542d1..814b4470bc 100644 --- a/packages/react/src/Breadcrumb/Breadcrumb.tsx +++ b/packages/react/src/Breadcrumb/Breadcrumb.tsx @@ -6,7 +6,7 @@ import { forwardRef } from 'react' import type { ForwardedRef, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react' -type BreadcrumbProps = PropsWithChildren> +export type BreadcrumbProps = PropsWithChildren> interface BreadcrumbComponent extends ForwardRefExoticComponent> { Item: typeof BreadcrumbItem diff --git a/packages/react/src/Breadcrumb/index.ts b/packages/react/src/Breadcrumb/index.ts index ad77f3e696..ea5d50941e 100644 --- a/packages/react/src/Breadcrumb/index.ts +++ b/packages/react/src/Breadcrumb/index.ts @@ -1,2 +1,2 @@ export { Breadcrumb } from './Breadcrumb' -export type { BreadcrumbItemProps } from './Breadcrumb' +export type { BreadcrumbProps, BreadcrumbItemProps } from './Breadcrumb'