diff --git a/packages/react/package.json b/packages/react/package.json index ad931ab92f83..9a3e58988945 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -4,6 +4,7 @@ "version": "1.74.0", "license": "Apache-2.0", "main": "lib/index.js", + "types": "lib/index.d.ts", "module": "es/index.js", "repository": { "type": "git", diff --git a/packages/react/src/components/AILabel/index.tsx b/packages/react/src/components/AILabel/index.tsx index 7ce2a9af4c2a..34636f93525f 100644 --- a/packages/react/src/components/AILabel/index.tsx +++ b/packages/react/src/components/AILabel/index.tsx @@ -127,7 +127,7 @@ const propMappingFunction = (deprecatedValue) => { return mapPopoverAlignProp(deprecatedValue); }; -interface AILabelProps { +export interface AILabelProps { AILabelContent?: React.ReactNode; aiText?: string; aiTextLabel?: string; diff --git a/packages/react/src/components/AISkeleton/AISkeletonIcon.tsx b/packages/react/src/components/AISkeleton/AISkeletonIcon.tsx index 7fc8a43cdba3..a97c2e41b85a 100644 --- a/packages/react/src/components/AISkeleton/AISkeletonIcon.tsx +++ b/packages/react/src/components/AISkeleton/AISkeletonIcon.tsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import { usePrefix } from '../../internal/usePrefix'; import { SkeletonIcon } from '../SkeletonIcon'; -interface AISkeletonIconProps { +export interface AISkeletonIconProps { /** * Specify an optional className to add. */ diff --git a/packages/react/src/components/AISkeleton/AISkeletonText.tsx b/packages/react/src/components/AISkeleton/AISkeletonText.tsx index c17fb6030b48..a42f59609551 100644 --- a/packages/react/src/components/AISkeleton/AISkeletonText.tsx +++ b/packages/react/src/components/AISkeleton/AISkeletonText.tsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import { usePrefix } from '../../internal/usePrefix'; import { SkeletonText } from '../SkeletonText'; -interface AISkeletonTextProps { +export interface AISkeletonTextProps { /** * Specify an optional className to be applied to the container node. */ diff --git a/packages/react/src/components/Accordion/Accordion.Skeleton.tsx b/packages/react/src/components/Accordion/Accordion.Skeleton.tsx index 5d370bd1bb41..4446b8a878c0 100644 --- a/packages/react/src/components/Accordion/Accordion.Skeleton.tsx +++ b/packages/react/src/components/Accordion/Accordion.Skeleton.tsx @@ -12,7 +12,7 @@ import { ChevronRight } from '@carbon/icons-react'; import SkeletonText from '../SkeletonText'; import { usePrefix } from '../../internal/usePrefix'; -interface AccordionSkeletonProps { +export interface AccordionSkeletonProps { /** * Specify the alignment of the accordion heading * title and chevron. diff --git a/packages/react/src/components/Accordion/AccordionItem.tsx b/packages/react/src/components/Accordion/AccordionItem.tsx index d2b8af3bdb10..5e53ff629c96 100644 --- a/packages/react/src/components/Accordion/AccordionItem.tsx +++ b/packages/react/src/components/Accordion/AccordionItem.tsx @@ -25,7 +25,7 @@ import deprecate from '../../prop-types/deprecate'; import { usePrefix } from '../../internal/usePrefix'; import { AccordionContext } from './AccordionProvider'; -interface AccordionItemProps { +export interface AccordionItemProps { /** * Specify an optional className to be * applied to the container node. @@ -90,7 +90,7 @@ interface AccordionItemProps { handleAnimationEnd?: AnimationEventHandler; } -interface AccordionToggleProps { +export interface AccordionToggleProps { 'aria-controls'?: AriaAttributes['aria-controls']; 'aria-expanded'?: AriaAttributes['aria-expanded']; className?: string; diff --git a/packages/react/src/components/AspectRatio/AspectRatio.tsx b/packages/react/src/components/AspectRatio/AspectRatio.tsx index 201f57a6d94d..84459f29ccda 100644 --- a/packages/react/src/components/AspectRatio/AspectRatio.tsx +++ b/packages/react/src/components/AspectRatio/AspectRatio.tsx @@ -10,7 +10,7 @@ import PropTypes from 'prop-types'; import React, { PropsWithChildren, ReactHTML } from 'react'; import { usePrefix } from '../../internal/usePrefix'; -interface AspectRatioProps { +export interface AspectRatioProps { /** * Provide a custom component or string to be rendered as * the outermost node of the component. This is useful if you want diff --git a/packages/react/src/components/ClassPrefix/index.tsx b/packages/react/src/components/ClassPrefix/index.tsx index 89d859eceb27..41e70b6d160e 100644 --- a/packages/react/src/components/ClassPrefix/index.tsx +++ b/packages/react/src/components/ClassPrefix/index.tsx @@ -9,7 +9,7 @@ import PropTypes from 'prop-types'; import React, { PropsWithChildren } from 'react'; import { PrefixContext } from '../../internal/usePrefix'; -interface ClassPrefixProps { +export interface ClassPrefixProps { /** * The value used to prefix the CSS selectors * used by Carbon components. diff --git a/packages/react/src/components/ComboBox/ComboBox.tsx b/packages/react/src/components/ComboBox/ComboBox.tsx index df48532e770e..36bce9c02116 100644 --- a/packages/react/src/components/ComboBox/ComboBox.tsx +++ b/packages/react/src/components/ComboBox/ComboBox.tsx @@ -152,7 +152,7 @@ const findHighlightedIndex = ( type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size'; -interface OnChangeData { +export interface OnChangeData { selectedItem: ItemType | null | undefined; inputValue?: string | null; } @@ -164,13 +164,14 @@ interface OnChangeData { * because those components aren't Typescript. (If you try, TranslationKey * ends up just being defined as "string".) */ -type TranslationKey = +export type TranslationKey = | 'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection'; -type ItemToStringHandler = (item: ItemType | null) => string; +export type ItemToStringHandler = (item: ItemType | null) => string; + export interface ComboBoxProps extends Omit, ExcludedAttributes>, TranslateWithId { @@ -1349,7 +1350,7 @@ type ComboboxComponentProps = PropsWithRef< PropsWithChildren> & RefAttributes >; -interface ComboBoxComponent { +export interface ComboBoxComponent { (props: ComboboxComponentProps): ReactElement | null; } diff --git a/packages/react/src/components/ComboButton/index.tsx b/packages/react/src/components/ComboButton/index.tsx index 2972cc99d9b0..c813170867ea 100644 --- a/packages/react/src/components/ComboButton/index.tsx +++ b/packages/react/src/components/ComboButton/index.tsx @@ -35,7 +35,7 @@ const defaultTranslations = { /** * Message ids that will be passed to translateWithId(). */ -type TranslationKey = keyof typeof defaultTranslations; +export type TranslationKey = keyof typeof defaultTranslations; const propMappingFunction = (deprecatedValue) => { const mapping = { diff --git a/packages/react/src/components/ComposedModal/ModalFooter.tsx b/packages/react/src/components/ComposedModal/ModalFooter.tsx index 1d8100532c2c..c0bae929851f 100644 --- a/packages/react/src/components/ComposedModal/ModalFooter.tsx +++ b/packages/react/src/components/ComposedModal/ModalFooter.tsx @@ -8,7 +8,7 @@ import { noopFn } from '../../internal/noopFn'; import InlineLoading from '../InlineLoading'; import { InlineLoadingStatus } from '../InlineLoading/InlineLoading'; -interface SecondaryButtonProps { +export interface SecondaryButtonProps { buttonText: ReactNode; onClick(evt: MouseEvent): void; } @@ -35,15 +35,19 @@ function SecondaryButtonSet({ } if (Array.isArray(secondaryButtons) && secondaryButtons.length <= 2) { - return secondaryButtons.map(({ buttonText, onClick: onButtonClick }, i) => ( - - )); + return ( + <> + {secondaryButtons.map(({ buttonText, onClick: onButtonClick }, i) => ( + + ))} + + ); } if (secondaryButtonText) { return ( @@ -242,7 +246,6 @@ export const ModalFooter = React.forwardRef( // @ts-expect-error: Invalid derived types, will be fine once explicit types are added ref={ref} aria-busy={loadingActive}> - {/* @ts-expect-error: Invalid derived types, will be fine once explicit types are added */} {primaryButtonText && (