Skip to content

Commit c553e74

Browse files
committed
chore: optimize imports * 5
1 parent 9e0c0d3 commit c553e74

File tree

9 files changed

+46
-25
lines changed

9 files changed

+46
-25
lines changed

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/fields/ComboBox/ComboBox.tsx

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,38 @@ import {
1313
useHover,
1414
useOverlayPosition,
1515
AriaComboBoxProps,
16+
AriaTextFieldProps,
1617
} from 'react-aria';
1718
import { Item, useComboBoxState } from 'react-stately';
1819

1920
import { useFieldProps, useFormProps, wrapWithField } from '../../form';
21+
import { DEFAULT_INPUT_STYLES, INPUT_WRAPPER_STYLES } from '../index';
2022
import { useProviderProps } from '../../../provider';
2123
import {
2224
BLOCK_STYLES,
2325
extractStyles,
2426
OUTER_STYLES,
2527
tasty,
26-
} from '../../../tasty/index';
28+
} from '../../../tasty';
2729
import { useFocus } from '../../../utils/react/interactions';
2830
import {
2931
mergeProps,
3032
modAttrs,
3133
useCombinedRefs,
3234
useLayoutEffect,
33-
} from '../../../utils/react/index';
35+
} from '../../../utils/react';
3436
import { CubeSelectBaseProps, ListBoxPopup } from '../Select';
35-
import { DEFAULT_INPUT_STYLES, INPUT_WRAPPER_STYLES } from '../index';
3637
import { OverlayWrapper } from '../../overlays/OverlayWrapper';
37-
import { LoadingIcon } from '../../../icons/index';
38+
import { LoadingIcon } from '../../../icons';
3839
import { InvalidIcon } from '../../shared/InvalidIcon';
3940
import { ValidIcon } from '../../shared/ValidIcon';
4041

4142
import type { KeyboardDelegate, LoadingState } from '@react-types/shared';
4243

43-
export type MenuTriggerAction = 'focus' | 'input' | 'manual';
44-
45-
export type { AriaComboBoxProps };
46-
4744
type FilterFn = (textValue: string, inputValue: string) => boolean;
4845

46+
export type MenuTriggerAction = 'focus' | 'input' | 'manual';
47+
4948
function CaretDownIcon() {
5049
return (
5150
<svg
@@ -105,7 +104,8 @@ export interface CubeComboBoxProps<T>
105104
CubeSelectBaseProps<T>,
106105
'onOpenChange' | 'onBlur' | 'onFocus' | 'validate' | 'onSelectionChange'
107106
>,
108-
AriaComboBoxProps<T> {
107+
AriaComboBoxProps<T>,
108+
AriaTextFieldProps {
109109
icon?: ReactElement;
110110
multiLine?: boolean;
111111
autoComplete?: string;
@@ -189,14 +189,27 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
189189
let isAsync = loadingState != null;
190190
let { contains } = useFilter({ sensitivity: 'base' });
191191

192-
const comboBoxProps = {
192+
const comboboxProps = {
193193
...props,
194+
children: props.children,
195+
items: props.items,
196+
label: props.label,
197+
isDisabled: props.isDisabled,
198+
validationState: props.validationState,
199+
description: props.description,
200+
autoFocus: props.autoFocus,
201+
isRequired: props.isRequired,
202+
allowsCustomValue: props.allowsCustomValue,
203+
menuTrigger,
204+
disabledKeys: props.disabledKeys,
205+
name: props.name,
206+
isReadOnly: props.isReadOnly,
194207
defaultFilter: filter || contains,
195208
allowsEmptyCollection: isAsync,
196-
};
209+
} as const;
197210

198211
let state = useComboBoxState({
199-
comboBoxProps,
212+
...comboboxProps,
200213
defaultFilter: filter || contains,
201214
allowsEmptyCollection: isAsync,
202215
});
@@ -230,7 +243,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
230243
buttonProps: triggerProps,
231244
} = useComboBox(
232245
{
233-
...comboBoxProps,
246+
...comboboxProps,
234247
inputRef,
235248
buttonRef: triggerRef,
236249
listBoxRef,

src/components/fields/RadioGroup/Radio.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useFocusableRef } from '@react-spectrum/utils';
22
import { forwardRef, useMemo, useRef } from 'react';
3-
import { useHover, useRadio, AriaRadioProps } from 'react-aria';
3+
import { useHover, useRadio } from 'react-aria';
44

55
import {
66
BaseProps,
@@ -21,6 +21,8 @@ import { FieldBaseProps } from '../../../shared';
2121
import { RadioGroup } from './RadioGroup';
2222
import { useRadioProvider } from './context';
2323

24+
import type { AriaRadioProps } from 'react-aria';
25+
2426
export { AriaRadioProps };
2527
export { useRadio };
2628

src/components/fields/Slider/Gradation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { SliderState } from 'react-stately';
2-
31
import { SliderGradationElement, SliderGradeElement } from './elements';
42

3+
import type { SliderState } from 'react-stately';
4+
55
export type GradationProps = {
66
state: SliderState;
77
ranges: number[];

src/components/fields/Slider/SliderBase.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { RefObject, forwardRef, useRef, ReactNode } from 'react';
22
import { useFocusableRef } from '@react-spectrum/utils';
33
import { FocusableRef } from '@react-types/shared';
4-
import { SliderState, useSliderState } from 'react-stately';
4+
import { useSliderState } from 'react-stately';
55
import { useSlider, useNumberFormatter } from 'react-aria';
66

77
import { extractStyles, OUTER_STYLES, tasty } from '../../../tasty';
@@ -10,7 +10,9 @@ import { Text } from '../../content/Text';
1010
import { mergeProps } from '../../../utils/react';
1111

1212
import { SliderControlsElement, SliderElement } from './elements';
13-
import { CubeSliderBaseProps } from './types';
13+
14+
import type { SliderState } from 'react-stately';
15+
import type { CubeSliderBaseProps } from './types';
1416

1517
export interface SliderBaseChildArguments {
1618
inputRef: RefObject<HTMLInputElement>;

src/components/fields/Slider/SliderInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useCallback } from 'react';
2-
import { SliderState } from 'react-stately';
32

43
import { CubeNumberInputProps, NumberInput } from '../../../';
54

5+
import type { SliderState } from 'react-stately';
6+
67
export interface RangeInputProps extends CubeNumberInputProps {
78
index: number;
89
state: SliderState;

src/components/fields/Slider/SliderThumb.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import {
55
useSliderThumb,
66
VisuallyHidden,
77
} from 'react-aria';
8-
import { SliderState } from 'react-stately';
98

109
import { mergeProps } from '../../../utils/react';
1110

1211
import { SliderThumbElement } from './elements';
1312

13+
import type { SliderState } from 'react-stately';
14+
1415
export interface SliderThumbProps extends AriaSliderThumbOptions {
1516
state: SliderState;
1617
isDisabled?: boolean;

src/components/fields/Slider/SliderTrack.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { SliderState } from 'react-stately';
21
import { useMemo } from 'react';
32

43
import { SliderTrackContainerElement } from './elements';
54

5+
import type { SliderState } from 'react-stately';
6+
67
export type SliderTrackProps = {
78
state: SliderState;
89
orientation?: 'horizontal' | 'vertical';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from './RangeSlider';
22
export * from './Slider';
33
export * from './types';
4-
export { SliderState, useSliderState } from 'react-stately';
4+
export { useSliderState } from 'react-stately';
5+
export type { SliderState } from 'react-stately';

0 commit comments

Comments
 (0)