Skip to content

Commit

Permalink
feat: exporting typescript props for various components - 1 (#16447)
Browse files Browse the repository at this point in the history
* feat: exporting typescript props

* feat: designated label as FC cos of tests

---------

Co-authored-by: Guilherme Datilio Ribeiro <[email protected]>
  • Loading branch information
Gururajj77 and guidari authored May 21, 2024
1 parent 36bd564 commit 111db86
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/components/InlineLoading/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import InlineLoading from './InlineLoading';
import InlineLoading, { type InlineLoadingProps } from './InlineLoading';
export default InlineLoading;
export { InlineLoading };
export { InlineLoading, type InlineLoadingProps };
4 changes: 2 additions & 2 deletions packages/react/src/components/Loading/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import Loading from './Loading';
import Loading, { type LoadingProps } from './Loading';

export default Loading;
export { Loading };
export { Loading, type LoadingProps };
4 changes: 2 additions & 2 deletions packages/react/src/components/Modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import Modal from './Modal';
import Modal, { type ModalProps } from './Modal';

export default Modal;
export { Modal };
export { Modal, type ModalProps };
9 changes: 5 additions & 4 deletions packages/react/src/components/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import React, {
useRef,
useState,
useEffect,
FC,
} from 'react';
import { useMergedRefs } from '../../internal/useMergedRefs';
import { useNormalizedInputProps as normalize } from '../../internal/useNormalizedInputProps';
Expand Down Expand Up @@ -629,13 +630,13 @@ NumberInput.propTypes = {
warnText: PropTypes.node,
};

interface Label {
export interface Label {
disabled?: boolean;
hideLabel?: boolean;
id?: string;
label?: ReactNode;
}
function Label({ disabled, id, hideLabel, label }: Label) {
const Label: FC<Label> = ({ disabled, id, hideLabel, label }) => {
const prefix = usePrefix();
const className = cx({
[`${prefix}--label`]: true,
Expand All @@ -651,7 +652,7 @@ function Label({ disabled, id, hideLabel, label }: Label) {
);
}
return null;
}
};

Label.propTypes = {
disabled: PropTypes.bool,
Expand All @@ -660,7 +661,7 @@ Label.propTypes = {
label: PropTypes.node,
};

interface HelperTextProps {
export interface HelperTextProps {
id?: string;
description?: ReactNode;
disabled?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/NumberInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*/

export { default as NumberInputSkeleton } from './NumberInput.Skeleton';
export { NumberInput } from './NumberInput';
export { NumberInput, type NumberInputProps } from './NumberInput';
2 changes: 1 addition & 1 deletion packages/react/src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useId } from '../../internal/useId';
import { usePrefix } from '../../internal/usePrefix';
import useIsomorphicEffect from '../../internal/useIsomorphicEffect';

interface ProgressBarProps {
export interface ProgressBarProps {
/**
* Additional CSS class names.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/ProgressBar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import ProgressBar from './ProgressBar';
import ProgressBar, { type ProgressBarProps } from './ProgressBar';

export default ProgressBar;
export { ProgressBar };
export { ProgressBar, type ProgressBarProps };
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function translateWithId(messageId) {
return defaultTranslations[messageId];
}

interface ProgressIndicatorProps
export interface ProgressIndicatorProps
extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
/**
* Provide `<ProgressStep>` components to be rendered in the
Expand Down Expand Up @@ -156,7 +156,7 @@ ProgressIndicator.propTypes = {
vertical: PropTypes.bool,
};

interface ProgressStepProps {
export interface ProgressStepProps {
/**
* Provide an optional className to be applied to the containing `<li>` node
*/
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/components/ProgressIndicator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
type ProgressIndicatorProps,
type ProgressStepProps,
} from './ProgressIndicator';

export { default as ProgressIndicatorSkeleton } from './ProgressIndicator.Skeleton';
export * from './ProgressIndicator';
export { type ProgressIndicatorProps, type ProgressStepProps };
2 changes: 1 addition & 1 deletion packages/react/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import classNames from 'classnames';
import { usePrefix } from '../../internal/usePrefix';
import { noopFn } from '../../internal/noopFn';

interface SwitchEventHandlersParams {
export interface SwitchEventHandlersParams {
index?: number;
name?: string | number;
text?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Switch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import Switch from './Switch';
import Switch, { type SwitchProps } from './Switch';
import IconSwitch from './IconSwitch';

export default Switch;
export { Switch, IconSwitch };
export { Switch, IconSwitch, type SwitchProps };

0 comments on commit 111db86

Please sign in to comment.