Skip to content

Commit

Permalink
Fix type imports: pass 7 (#19485)
Browse files Browse the repository at this point in the history
* @fluentui/react-cards: updating type imports/exports for 3 file(s).

* @fluentui/react-card: updating type imports/exports for 3 file(s).

* @fluentui/react-button: updating type imports/exports for 28 file(s).

* @fluentui/react-badge: updating type imports/exports for 14 file(s).

* @fluentui/react-avatar: updating type imports/exports for 7 file(s).

* @fluentui/react-aria: updating type imports/exports for 3 file(s).

* @fluentui/react-accordion: updating type imports/exports for 29 file(s).

* @fluentui/public-docsite-setup: updating type imports/exports for 2 file(s).

* Change files

* Fixing dependency...

* undo public-docsite-setup changes.

* fixing build error.
  • Loading branch information
dzearing authored Aug 27, 2021
1 parent a3478be commit e2ee214
Show file tree
Hide file tree
Showing 104 changed files with 217 additions and 152 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating TypeScript type-only imports/exports to use import/export type syntax.",
"packageName": "@fluentui/react-accordion",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating TypeScript type-only imports/exports to use import/export type syntax.",
"packageName": "@fluentui/react-aria",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating TypeScript type-only imports/exports to use import/export type syntax.",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating TypeScript type-only imports/exports to use import/export type syntax.",
"packageName": "@fluentui/react-badge",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating TypeScript type-only imports/exports to use import/export type syntax.",
"packageName": "@fluentui/react-button",
"email": "[email protected]",
"dependentChangeType": "patch"
}
8 changes: 4 additions & 4 deletions packages/react-accordion/etc/react-accordion.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
```ts

import { ARIAButtonProps } from '@fluentui/react-aria';
import { ComponentProps } from '@fluentui/react-utilities';
import { ComponentState } from '@fluentui/react-utilities';
import { Context } from '@fluentui/react-context-selector';
import type { ARIAButtonProps } from '@fluentui/react-aria';
import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { Context } from '@fluentui/react-context-selector';
import * as React_2 from 'react';

// @public
Expand Down
7 changes: 4 additions & 3 deletions packages/react-accordion/src/Accordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import { RocketIcon } from './icons.stories';
import { AccordionItem, AccordionHeader, AccordionPanel, Accordion, AccordionProps } from './index';
import { ArgType } from '@storybook/addons';
import { AccordionHeaderProps } from './components/AccordionHeader/AccordionHeader.types';
import { AccordionItem, AccordionHeader, AccordionPanel, Accordion } from './index';
import type { AccordionProps } from './index';
import type { ArgType } from '@storybook/addons';
import type { AccordionHeaderProps } from './components/AccordionHeader/AccordionHeader.types';

interface AccordionExampleProps
extends AccordionProps,
Expand Down
12 changes: 3 additions & 9 deletions packages/react-accordion/src/AccordionItem.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import * as React from 'react';
import {
AccordionItem,
AccordionHeader,
AccordionPanel,
Accordion,
AccordionHeaderSize,
AccordionHeaderExpandIconPosition,
} from './index';
import { AccordionItem, AccordionHeader, AccordionPanel, Accordion } from './index';
import { RocketIcon } from './icons.stories';
import { AccordionToggleData, AccordionToggleEvent } from './components/Accordion/Accordion.types';
import type { AccordionHeaderSize, AccordionHeaderExpandIconPosition } from './index';
import type { AccordionToggleData, AccordionToggleEvent } from './components/Accordion/Accordion.types';

interface AccordionItemExampleProps {
icon: boolean;
Expand Down
3 changes: 2 additions & 1 deletion packages/react-accordion/src/common/isConformant.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isConformant as baseIsConformant, IsConformantOptions } from '@fluentui/react-conformance';
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
import type { IsConformantOptions } from '@fluentui/react-conformance';

export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';

import { AccordionProps } from './Accordion.types';
import { renderAccordion } from './renderAccordion';
import { useAccordion } from './useAccordion';
import { useAccordionContextValues } from './useAccordionContextValues';
import type { AccordionProps } from './Accordion.types';

/**
* Define a styled Accordion, using the `useAccordion` and `useAccordionStyles` hooks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import { AccordionItemValue } from '../AccordionItem/AccordionItem.types';
import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';

export type AccordionToggleEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createContext, Context } from '@fluentui/react-context-selector';
import { AccordionContextValue } from './Accordion.types';
import { createContext } from '@fluentui/react-context-selector';
import type { Context } from '@fluentui/react-context-selector';
import type { AccordionContextValue } from './Accordion.types';

export const AccordionContext: Context<AccordionContextValue> = createContext<AccordionContextValue>({
openItems: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { getSlots } from '@fluentui/react-utilities';
import * as React from 'react';

import { AccordionState, AccordionSlots, AccordionContextValues } from './Accordion.types';
import { AccordionContext } from './AccordionContext';
import type { AccordionState, AccordionSlots, AccordionContextValues } from './Accordion.types';

/**
* Function that renders the final JSX of the component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useControllableState, useEventCallback } from '@fluentui/react-utilities';
import { AccordionProps, AccordionState, AccordionToggleData, AccordionToggleEvent } from './Accordion.types';
import { AccordionItemValue } from '../AccordionItem/AccordionItem.types';
import type { AccordionProps, AccordionState, AccordionToggleData, AccordionToggleEvent } from './Accordion.types';
import type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';

export const useAccordion = (
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccordionContextValues, AccordionState } from './Accordion.types';
import type { AccordionContextValues, AccordionState } from './Accordion.types';

export function useAccordionContextValues(state: AccordionState): AccordionContextValues {
const { navigable, openItems, requestToggle } = state;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { useAccordionHeader } from './useAccordionHeader';
import { AccordionHeaderProps } from './AccordionHeader.types';
import { renderAccordionHeader } from './renderAccordionHeader';
import { useAccordionHeaderStyles } from './useAccordionHeaderStyles';
import { useAccordionHeaderContextValues } from './useAccordionHeaderContextValues';
import type { AccordionHeaderProps } from './AccordionHeader.types';

/**
* Define a styled AccordionHeader, using the `useAccordionHeader` and `useAccordionHeaderStyles` hooks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import { AccordionHeaderExpandIconProps } from './AccordionHeaderExpandIcon';
import { ARIAButtonProps } from '@fluentui/react-aria';
import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import type { AccordionHeaderExpandIconProps } from './AccordionHeaderExpandIcon';
import type { ARIAButtonProps } from '@fluentui/react-aria';

export type AccordionHeaderSize = 'small' | 'medium' | 'large' | 'extra-large';
export type AccordionHeaderExpandIconPosition = 'start' | 'end';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { AccordionHeaderContextValue } from './AccordionHeader.types';
import type { AccordionHeaderContextValue } from './AccordionHeader.types';

export const AccordionHeaderContext = React.createContext<AccordionHeaderContextValue>({
open: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useAccordionHeaderContext } from './AccordionHeaderContext';
import { AccordionHeaderContextValue } from './AccordionHeader.types';
import type { AccordionHeaderContextValue } from './AccordionHeader.types';

export type AccordionHeaderExpandIconProps = React.HTMLAttributes<HTMLSpanElement>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';

import { AccordionHeaderState, AccordionHeaderSlots, AccordionHeaderContextValues } from './AccordionHeader.types';
import { accordionHeaderShorthandProps } from './useAccordionHeader';
import { AccordionHeaderContext } from './AccordionHeaderContext';
import type { AccordionHeaderState, AccordionHeaderSlots, AccordionHeaderContextValues } from './AccordionHeader.types';

/**
* Function that renders the final JSX of the component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { useMergedRefs, useId, resolveShorthand, useEventCallback } from '@fluentui/react-utilities';
import { AccordionHeaderProps, AccordionHeaderState, AccordionHeaderSlots } from './AccordionHeader.types';
import { useAccordionItemContext } from '../AccordionItem/index';
import { AccordionHeaderExpandIcon } from './AccordionHeaderExpandIcon';
import { useARIAButton } from '@fluentui/react-aria';
import type { AccordionHeaderProps, AccordionHeaderState, AccordionHeaderSlots } from './AccordionHeader.types';

/**
* Const listing which props are shorthand props.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {
import type {
AccordionHeaderContextValue,
AccordionHeaderState,
AccordionHeaderContextValues,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';
import { AccordionHeaderState } from './AccordionHeader.types';
import { createFocusIndicatorStyleRule } from '@fluentui/react-tabster';
import type { AccordionHeaderState } from './AccordionHeader.types';

const useStyles = makeStyles({
// TODO: this should be extracted to another package
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { useAccordionItem } from './useAccordionItem';
import { useAccordionItemContextValues } from './useAccordionItemContextValues';
import { AccordionItemProps } from './AccordionItem.types';
import { renderAccordionItem } from './renderAccordionItem';
import type { AccordionItemProps } from './AccordionItem.types';

/**
* Define a styled AccordionItem, using the `useAccordionItem` and `useAccordionItemStyles` hooks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';

export interface AccordionItemContextValue {
open: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { AccordionItemContextValue } from './AccordionItem.types';
import type { AccordionItemContextValue } from './AccordionItem.types';

// No default value.
export const AccordionItemContext = React.createContext<AccordionItemContextValue>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
import { AccordionItemState, AccordionItemSlots, AccordionItemContextValues } from './AccordionItem.types';
import { accordionItemShorthandProps } from './useAccordionItem';
import { AccordionItemContext } from './AccordionItemContext';
import type { AccordionItemState, AccordionItemSlots, AccordionItemContextValues } from './AccordionItem.types';

/**
* Function that renders the final JSX of the component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { AccordionItemProps, AccordionItemState, AccordionItemSlots } from './AccordionItem.types';
import { useTabsterAttributes } from '@fluentui/react-tabster';
import { useContextSelector } from '@fluentui/react-context-selector';
import { AccordionContext } from '../Accordion/AccordionContext';
import { AccordionToggleEvent } from '../Accordion/Accordion.types';
import type { AccordionItemProps, AccordionItemState, AccordionItemSlots } from './AccordionItem.types';
import type { AccordionToggleEvent } from '../Accordion/Accordion.types';

/**
* Const listing which props are shorthand props.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { AccordionItemContextValue, AccordionItemContextValues, AccordionItemState } from './AccordionItem.types';
import type { AccordionItemContextValue, AccordionItemContextValues, AccordionItemState } from './AccordionItem.types';

export function useAccordionItemContextValues(state: AccordionItemState): AccordionItemContextValues {
const { disabled, onHeaderClick, open } = state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AccordionPanel } from './AccordionPanel';
import * as renderer from 'react-test-renderer';
import { ReactWrapper } from 'enzyme';
import { isConformant } from '../../common/isConformant';
import { AccordionPanelProps } from './AccordionPanel.types';
import type { AccordionPanelProps } from './AccordionPanel.types';

describe('AccordionPanel', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { useAccordionPanel } from './useAccordionPanel';
import { AccordionPanelProps } from './AccordionPanel.types';
import { renderAccordionPanel } from './renderAccordionPanel';
import { useAccordionPanelStyles } from './useAccordionPanelStyles';
import type { AccordionPanelProps } from './AccordionPanel.types';

/**
* Define a styled AccordionPanel, using the `useAccordionPanel` and `useAccordionPanelStyles` hooks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';

export type AccordionPanelSlots = {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
import { AccordionPanelState, AccordionPanelSlots } from './AccordionPanel.types';
import { accordionPanelShorthandProps } from './useAccordionPanel';
import type { AccordionPanelState, AccordionPanelSlots } from './AccordionPanel.types';

/**
* Function that renders the final JSX of the component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useMergedRefs, useId } from '@fluentui/react-utilities';
import { AccordionPanelProps, AccordionPanelSlots, AccordionPanelState } from './AccordionPanel.types';
import { useAccordionItemContext } from '../AccordionItem/index';
import type { AccordionPanelProps, AccordionPanelSlots, AccordionPanelState } from './AccordionPanel.types';

/**
* Consts listing which props are shorthand props.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';
import { AccordionPanelState } from './AccordionPanel.types';
import type { AccordionPanelState } from './AccordionPanel.types';

/**
* Styles for the root slot
Expand Down
3 changes: 2 additions & 1 deletion packages/react-accordion/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"importHelpers": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"types": ["jest", "custom-global", "inline-style-expand-shorthand"]
"types": ["jest", "custom-global", "inline-style-expand-shorthand"],
"isolatedModules": true
},
"include": ["src"]
}
6 changes: 3 additions & 3 deletions packages/react-aria/etc/react-aria.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
```ts

import { ObjectShorthandProps } from '@fluentui/react-utilities';
import type { ObjectShorthandProps } from '@fluentui/react-utilities';
import * as React_2 from 'react';
import { ResolveShorthandOptions } from '@fluentui/react-utilities';
import { ShorthandProps } from '@fluentui/react-utilities';
import type { ResolveShorthandOptions } from '@fluentui/react-utilities';
import type { ShorthandProps } from '@fluentui/react-utilities';

// @public (undocumented)
export type ARIAButtonAsAnchorProps = React_2.AnchorHTMLAttributes<HTMLAnchorElement> & {
Expand Down
6 changes: 4 additions & 2 deletions packages/react-aria/src/hooks/useARIAButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ComponentState, getSlots } from '@fluentui/react-utilities';
import { getSlots } from '@fluentui/react-utilities';
import * as React from 'react';
import { ARIAButtonAsElementProps, ARIAButtonProps, useARIAButton } from './useARIAButton';
import { useARIAButton } from './useARIAButton';
import type { ComponentState } from '@fluentui/react-utilities';
import type { ARIAButtonAsElementProps, ARIAButtonProps } from './useARIAButton';

type Slots = {
button: ARIAButtonProps;
Expand Down
6 changes: 4 additions & 2 deletions packages/react-aria/src/hooks/useARIAButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as React from 'react';
import { ARIAButtonProps, useARIAButton } from './useARIAButton';
import { useARIAButton } from './useARIAButton';
import { Enter, Space } from '@fluentui/keyboard-keys';
import { renderHook } from '@testing-library/react-hooks';
import { fireEvent, screen, render } from '@testing-library/react';
import { getSlots, ObjectShorthandProps } from '@fluentui/react-utilities';
import { getSlots } from '@fluentui/react-utilities';
import type { ARIAButtonProps } from './useARIAButton';
import type { ObjectShorthandProps } from '@fluentui/react-utilities';

describe('useARIAButton', () => {
it('should return by default shorthand props for a button', () => {
Expand Down
9 changes: 2 additions & 7 deletions packages/react-aria/src/hooks/useARIAButton.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import * as React from 'react';
import { Enter, Space } from '@fluentui/keyboard-keys';
import {
ObjectShorthandProps,
resolveShorthand,
ResolveShorthandOptions,
ShorthandProps,
useEventCallback,
} from '@fluentui/react-utilities';
import { resolveShorthand, useEventCallback } from '@fluentui/react-utilities';
import type { ObjectShorthandProps, ResolveShorthandOptions, ShorthandProps } from '@fluentui/react-utilities';

function mergeARIADisabled(disabled?: boolean | 'false' | 'true'): boolean {
if (typeof disabled === 'string') {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-aria/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"importHelpers": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"types": ["jest", "custom-global", "inline-style-expand-shorthand"]
"types": ["jest", "custom-global", "inline-style-expand-shorthand"],
"isolatedModules": true
},
"include": ["src"]
}
Loading

0 comments on commit e2ee214

Please sign in to comment.