Skip to content

Commit a174b71

Browse files
authored
Clean up steplist types (#5390)
1 parent 1a633c4 commit a174b71

File tree

14 files changed

+54
-100
lines changed

14 files changed

+54
-100
lines changed

packages/@react-aria/steplist/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@react-aria/utils": "^3.20.0",
2828
"@react-stately/steplist": "3.0.0-alpha.1",
2929
"@react-types/shared": "^3.21.0",
30-
"@react-types/steplist": "^3.0.0-alpha.1",
3130
"@swc/helpers": "^0.5.0"
3231
},
3332
"peerDependencies": {

packages/@react-aria/steplist/src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License. You may obtain a copy
55
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6-
*
6+
*
77
* Unless required by applicable law or agreed to in writing, software distributed under
88
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
99
* OF ANY KIND, either express or implied. See the License for the specific language
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
export * from './useStepList';
14-
export * from './useStepListItem';
13+
export {useStepList} from './useStepList';
14+
export {useStepListItem} from './useStepListItem';
15+
16+
export type {AriaStepListProps, StepListAria} from './useStepList';
17+
export type {AriaStepListItemProps, StepListItemAria} from './useStepListItem';

packages/@react-aria/steplist/src/useStepList.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
import {AriaLabelingProps, DOMProps} from '@react-types/shared';
1314
import {filterDOMProps, mergeProps} from '@react-aria/utils';
1415
import {HTMLAttributes, RefObject} from 'react';
1516
// @ts-ignore
1617
import intlMessages from '../intl/*.json';
17-
import {SpectrumStepListProps} from '@react-types/steplist';
18-
import {StepListState} from '@react-stately/steplist';
18+
import {StepListProps, StepListState} from '@react-stately/steplist';
1919
import {useLocalizedStringFormatter} from '@react-aria/i18n';
2020
import {useSelectableList} from '@react-aria/selection';
2121

22-
interface StepListAria {
22+
export interface AriaStepListProps<T> extends StepListProps<T>, AriaLabelingProps, DOMProps {}
23+
24+
export interface StepListAria {
2325
listProps: HTMLAttributes<HTMLElement>
2426
}
2527

26-
export function useStepList<T>(props: SpectrumStepListProps<T>, state: StepListState<T>, ref: RefObject<HTMLOListElement>): StepListAria {
28+
export function useStepList<T>(props: AriaStepListProps<T>, state: StepListState<T>, ref: RefObject<HTMLOListElement>): StepListAria {
2729
let {
2830
'aria-label': ariaLabel
2931
} = props;

packages/@react-aria/steplist/src/useStepListItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import {Key} from '@react-types/shared';
1515
import {StepListState} from '@react-stately/steplist';
1616
import {useSelectableItem} from '@react-aria/selection';
1717

18-
interface AriaStepListItemProps {
18+
export interface AriaStepListItemProps {
1919
key: Key
2020
}
2121

22-
interface StepListItemAria {
22+
export interface StepListItemAria {
2323
/** Props for the step link element. */
2424
stepProps: HTMLAttributes<HTMLElement>,
2525
/** Props for the visually hidden element indicating the step state. */

packages/@react-spectrum/steplist/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"@react-stately/collections": "^3.10.2",
4747
"@react-stately/steplist": "^3.0.0-alpha.1",
4848
"@react-types/shared": "^3.20.0",
49-
"@react-types/steplist": "^3.0.0-alpha.1",
5049
"@spectrum-icons/ui": "^3.5.5",
5150
"@swc/helpers": "^0.5.0"
5251
},

packages/@react-spectrum/steplist/src/StepList.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,34 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
import {AriaStepListProps, useStepList} from '@react-aria/steplist';
1314
import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
14-
import {DOMRef} from '@react-types/shared';
15+
import {DOMRef, Orientation, StyleProps} from '@react-types/shared';
1516
import React, {ReactElement} from 'react';
16-
import {SpectrumStepListProps} from '@react-types/steplist';
1717
import {StepListContext} from './StepListContext';
1818
import {StepListItem} from './StepListItem';
1919
import styles from '@adobe/spectrum-css-temp/components/steplist/vars.css';
2020
import {useProviderProps} from '@react-spectrum/provider';
21-
import {useStepList} from '@react-aria/steplist';
2221
import {useStepListState} from '@react-stately/steplist';
2322

23+
export interface SpectrumStepListProps<T> extends AriaStepListProps<T>, StyleProps {
24+
/**
25+
* Whether the step list should be displayed with a emphasized style.
26+
* @default false
27+
*/
28+
isEmphasized?: boolean,
29+
/**
30+
* The orientation of the step list.
31+
* @default 'horizontal'
32+
*/
33+
orientation?: Orientation,
34+
/**
35+
* The size of the step list.
36+
* @default 'M'
37+
*/
38+
size?: 'S' | 'M' | 'L' | 'XL'
39+
}
40+
2441
function StepList<T extends object>(props: SpectrumStepListProps<T>, ref: DOMRef<HTMLOListElement>) {
2542
const {size = 'M', orientation = 'horizontal'} = props;
2643
props = useProviderProps(props);

packages/@react-spectrum/steplist/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
export {StepList} from './StepList';
1616
export {Item} from '@react-stately/collections';
17-
export type {SpectrumStepListProps} from '@react-types/steplist';
17+
export type {SpectrumStepListProps} from './StepList';

packages/@react-spectrum/steplist/stories/StepList.stories.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import {Item} from '@react-stately/collections';
1919
import {Key} from '@react-types/shared';
2020
import {Picker} from '@react-spectrum/picker';
2121
import React, {useCallback, useMemo, useState} from 'react';
22-
import {SpectrumStepListProps} from '@react-types/steplist';
23-
import {StepList} from '../';
22+
import {SpectrumStepListProps, StepList} from '../';
2423
import {View} from '@react-spectrum/view';
2524

2625
const options = [{

packages/@react-stately/steplist/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@react-stately/list": "^3.9.2",
2626
"@react-stately/utils": "^3.7.0",
2727
"@react-types/shared": "^3.20.0",
28-
"@react-types/steplist": "^3.0.0-alpha.1",
2928
"@swc/helpers": "^0.5.0"
3029
},
3130
"peerDependencies": {

packages/@react-stately/steplist/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License. You may obtain a copy
55
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6-
*
6+
*
77
* Unless required by applicable law or agreed to in writing, software distributed under
88
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
99
* OF ANY KIND, either express or implied. See the License for the specific language
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
export * from './useStepListState';
13+
export {useStepListState} from './useStepListState';
14+
export type {StepListProps, StepListState} from './useStepListState';

0 commit comments

Comments
 (0)