Skip to content

Commit

Permalink
fix: merge duplicate @/internals/utils imports
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Jan 13, 2025
1 parent 14695e7 commit b0dcaf8
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 62 deletions.
3 changes: 1 addition & 2 deletions src/Breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useState, useMemo } from 'react';
import BreadcrumbItem from './BreadcrumbItem';
import { useClassNames, useEventCallback } from '@/internals/hooks';
import { ReactChildren, createComponent } from '@/internals/utils';
import { forwardRef } from '@/internals/utils';
import { forwardRef, ReactChildren, createComponent } from '@/internals/utils';
import { useCustom } from '../CustomProvider';
import type { BreadcrumbLocale } from '../locales';
import type { WithAsProps } from '@/internals/types';
Expand Down
3 changes: 1 addition & 2 deletions src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import React, { useContext, useMemo } from 'react';
import Ripple from '@/internals/Ripple';
import SafeAnchor from '../SafeAnchor';
import { ButtonGroupContext } from '../ButtonGroup';
import { isOneOf } from '@/internals/utils';
import { forwardRef, isOneOf } from '@/internals/utils';
import { useClassNames, useControlled, useEventCallback } from '@/internals/hooks';
import { useCustom } from '../CustomProvider';
import { forwardRef } from '@/internals/utils';
import { ColorType, SizeType, AppearanceType, WithAsProps } from '@/internals/types';

export interface ButtonProps
Expand Down
3 changes: 1 addition & 2 deletions src/Calendar/MonthDropdown/MonthDropdownItem.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useMemo } from 'react';
import { forwardRef } from '@/internals/utils';
import { forwardRef, composeFunctions } from '@/internals/utils';
import { setMonth, setYear } from '@/internals/utils/date';
import { useClassNames, useEventCallback } from '@/internals/hooks';
import { composeFunctions } from '@/internals/utils';
import { useCustom } from '../../CustomProvider';
import { useCalendar } from '../hooks';
import { getAriaLabel } from '../utils';
Expand Down
3 changes: 1 addition & 2 deletions src/CardGroup/CardGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { forwardRef } from '@/internals/utils';
import { getCssValue } from '@/internals/utils';
import { forwardRef, getCssValue } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { useCustom } from '../CustomProvider';
import type { WithAsProps } from '@/internals/types';
Expand Down
3 changes: 1 addition & 2 deletions src/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useState, useMemo, useCallback, useRef } from 'react';
import classNames from 'classnames';
import { forwardRef } from '@/internals/utils';
import { useClassNames, useControlled, useUpdateEffect, useTimeout } from '@/internals/hooks';
import { guid, ReactChildren, mergeRefs } from '@/internals/utils';
import { forwardRef, guid, ReactChildren, mergeRefs } from '@/internals/utils';
import { WithAsProps } from '@/internals/types';
import { useCustom } from '../CustomProvider';

Expand Down
3 changes: 1 addition & 2 deletions src/CascadeTree/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import scrollTop from 'dom-lib/scrollTop';
import SpinnerIcon from '@rsuite/icons/Spinner';
import ArrowLeftLineIcon from '@rsuite/icons/ArrowLeftLine';
import ArrowRightLineIcon from '@rsuite/icons/ArrowRightLine';
import { forwardRef } from '@/internals/utils';
import { shallowEqual, mergeRefs } from '@/internals/utils';
import { forwardRef, shallowEqual, mergeRefs } from '@/internals/utils';
import { useClassNames, useEventCallback } from '@/internals/hooks';
import { ListItem, useCombobox } from '@/internals/Picker';
import { useCustom } from '../CustomProvider';
Expand Down
3 changes: 1 addition & 2 deletions src/Cascader/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import SearchView from '../CascadeTree/SearchView';
import type { SelectNode, CascadeTreeProps } from '../CascadeTree/types';
import { usePaths, useSelect, useSearch } from '../CascadeTree/hooks';
import { flattenTree } from '../Tree/utils';
import { forwardRef } from '@/internals/utils';
import { findNodeOfTree, getParentMap } from '@/internals/Tree/utils';
import { PickerLocale } from '../locales';
import { useControlled, useClassNames, useEventCallback, useMap } from '@/internals/hooks';
import { createChainedFunction, mergeRefs, shallowEqual } from '@/internals/utils';
import { forwardRef, createChainedFunction, mergeRefs, shallowEqual } from '@/internals/utils';
import {
PickerToggle,
PickerPopup,
Expand Down
3 changes: 1 addition & 2 deletions src/CheckTree/CheckTreeNode.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useMemo } from 'react';
import ListCheckItem from '@/internals/Picker/ListCheckItem';
import TreeNodeToggle from '../Tree/TreeNodeToggle';
import { forwardRef } from '@/internals/utils';
import { forwardRef, stringifyReactNode, mergeRefs } from '@/internals/utils';
import { useTreeContextProps } from '@/internals/Tree/TreeProvider';
import { WithAsProps } from '@/internals/types';
import { stringifyReactNode, mergeRefs } from '@/internals/utils';
import { CHECK_STATE, CheckStateType } from '@/internals/constants';
import { indentTreeNode } from '../Tree/utils';
import { useClassNames, useEventCallback, useFocusVirtualListItem } from '@/internals/hooks';
Expand Down
22 changes: 12 additions & 10 deletions src/CheckTreePicker/CheckTreePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import React, { useMemo } from 'react';
import classNames from 'classnames';
import { isNil, pick, isFunction, omit } from 'lodash';
import CheckTreeView, { type CheckTreeViewProps } from '../CheckTree/CheckTreeView';
import useTreeValue from '../CheckTree/hooks/useTreeValue';
import useFlattenTree from '../Tree/hooks/useFlattenTree';
import useTreeWithChildren from '../Tree/hooks/useTreeWithChildren';
import useExpandTree from '../Tree/hooks/useExpandTree';
import useFocusState from './hooks/useFocusState';
import isNil from 'lodash/isNil';
import pick from 'lodash/pick';
import isFunction from 'lodash/isFunction';
import omit from 'lodash/omit';
import { PickerLocale } from '../locales';
import { useClassNames, useEventCallback } from '@/internals/hooks';
import { createChainedFunction, mergeRefs } from '@/internals/utils';
import { forwardRef, createChainedFunction, mergeRefs } from '@/internals/utils';
import {
PickerToggle,
onMenuKeyDown,
PickerPopup,
SelectedElement,
PickerToggleTrigger,
PickerComponent,
PickerToggleProps,
usePickerClassName,
useToggleKeyDownEvent,
Expand All @@ -19,12 +27,6 @@ import {
omitTriggerPropKeys,
PositionChildProps
} from '@/internals/Picker';
import CheckTreeView, { type CheckTreeViewProps } from '../CheckTree/CheckTreeView';
import useTreeValue from '../CheckTree/hooks/useTreeValue';
import useFlattenTree from '../Tree/hooks/useFlattenTree';
import useTreeWithChildren from '../Tree/hooks/useTreeWithChildren';
import useExpandTree from '../Tree/hooks/useExpandTree';
import useFocusState from './hooks/useFocusState';
import { getSelectedItems } from '../CheckTree/utils';
import { TreeProvider, useTreeImperativeHandle } from '@/internals/Tree/TreeProvider';
import { useCustom } from '../CustomProvider';
Expand Down Expand Up @@ -85,7 +87,7 @@ export interface CheckTreePickerProps<V = ValueType>
*
* @see https://rsuitejs.com/components/check-tree-picker
*/
const CheckTreePicker: PickerComponent<CheckTreePickerProps> = React.forwardRef((props, ref) => {
const CheckTreePicker = forwardRef<'div', CheckTreePickerProps>((props, ref) => {
const { propsWithDefaults } = useCustom('CheckTreePicker', props);
const {
as: Component = 'div',
Expand Down
3 changes: 1 addition & 2 deletions src/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useContext, useMemo, useRef } from 'react';
import { forwardRef } from '@/internals/utils';
import { useControlled, useClassNames, useEventCallback, useUniqueId } from '@/internals/hooks';
import { partitionHTMLProps, mergeRefs } from '@/internals/utils';
import { forwardRef, partitionHTMLProps, mergeRefs } from '@/internals/utils';
import { CheckboxGroupContext } from '../CheckboxGroup';
import { WithAsProps, ColorType } from '@/internals/types';
import { useCustom } from '../CustomProvider';
Expand Down
3 changes: 1 addition & 2 deletions src/CheckboxGroup/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React, { useCallback, useMemo } from 'react';
import cloneDeep from 'lodash/cloneDeep';
import remove from 'lodash/remove';
import Plaintext from '@/internals/Plaintext';
import { forwardRef } from '@/internals/utils';
import { forwardRef, shallowEqual } from '@/internals/utils';
import { useClassNames, useControlled } from '@/internals/hooks';
import { shallowEqual } from '@/internals/utils';
import { WithAsProps, FormControlBaseProps } from '@/internals/types';
import { CheckboxGroupContext } from './CheckboxGroupContext';
import { useCustom } from '../CustomProvider';
Expand Down
8 changes: 6 additions & 2 deletions src/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import InputGroup from '../InputGroup';
import useMonthView from './hooks/useMonthView';
import useFocus from './hooks/useFocus';
import useCustomizedInput from './hooks/useCustomizedInput';
import { forwardRef } from '@/internals/utils';
import { useCalendarDate } from '../Calendar/hooks';
import { isEveryDateInMonth } from '../Calendar/utils';
import { mergeRefs, partitionHTMLProps, createChainedFunction } from '@/internals/utils';
import {
forwardRef,
mergeRefs,
partitionHTMLProps,
createChainedFunction
} from '@/internals/utils';
import { useClassNames, useControlled, useUniqueId, useEventCallback } from '@/internals/hooks';
import {
isValid,
Expand Down
3 changes: 1 addition & 2 deletions src/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import DropdownToggle from './DropdownToggle';
import kebabCase from 'lodash/kebabCase';
import NavContext from '../Nav/NavContext';
import Nav from '../Nav';
import { forwardRef } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { mergeRefs, placementPolyfill, warnOnce } from '@/internals/utils';
import { forwardRef, mergeRefs, placementPolyfill, warnOnce } from '@/internals/utils';
import { IconProps } from '@rsuite/icons/Icon';
import { initialState, reducer } from './DropdownState';
import { useCustom } from '../CustomProvider';
Expand Down
3 changes: 1 addition & 2 deletions src/Highlight/Highlight.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { forwardRef } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { highlightText } from './utils/highlightText';
import { stringifyReactNode } from '@/internals/utils';
import { forwardRef, stringifyReactNode } from '@/internals/utils';
import { useCustom } from '../CustomProvider';
import type { WithAsProps } from '@/internals/types';

Expand Down
3 changes: 1 addition & 2 deletions src/InlineEdit/InlineEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import EditableControls from './EditableControls';
import useFocusEvent from './useFocusEvent';
import useEditState from './useEditState';
import { useClassNames } from '@/internals/hooks';
import { mergeRefs } from '@/internals/utils';
import { forwardRef } from '@/internals/utils';
import { forwardRef, mergeRefs } from '@/internals/utils';
import { renderChildren, defaultRenderInput, ChildrenProps } from './renderChildren';
import { useCustom } from '../CustomProvider';
import type { WithAsPropsWithoutChildren } from '@/internals/types';
Expand Down
22 changes: 14 additions & 8 deletions src/InputPicker/InputPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@ import clone from 'lodash/clone';
import isArray from 'lodash/isArray';
import omit from 'lodash/omit';
import pick from 'lodash/pick';
import { shallowEqual, getDataGroupBy } from '@/internals/utils';
import { filterNodesOfTree } from '@/internals/Tree/utils';
import Tag from '../Tag';
import TextBox from './TextBox';
import Stack, { type StackProps } from '../Stack';
import useInput from './hooks/useInput';
import useData, { type InputItemDataType } from './hooks/useData';
import Plaintext, { type PlaintextProps } from '@/internals/Plaintext';
import { filterNodesOfTree } from '@/internals/Tree/utils';
import { useClassNames, useControlled, useEventCallback } from '@/internals/hooks';
import { KEY_VALUES } from '@/internals/constants';
import { createChainedFunction, tplTransform, mergeRefs, isOneOf } from '@/internals/utils';
import {
shallowEqual,
getDataGroupBy,
createChainedFunction,
tplTransform,
mergeRefs,
isOneOf
} from '@/internals/utils';
import {
Listbox,
ListItem,
Expand All @@ -30,11 +41,6 @@ import {
PickerComponent,
PickerToggleProps
} from '@/internals/Picker';
import Tag from '../Tag';
import TextBox from './TextBox';
import Stack, { type StackProps } from '../Stack';
import useInput from './hooks/useInput';
import useData, { type InputItemDataType } from './hooks/useData';
import { useTagContext } from './InputPickerContext';
import { convertSize } from './utils';
import { useCustom } from '../CustomProvider';
Expand Down
3 changes: 1 addition & 2 deletions src/Modal/ModalHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useContext } from 'react';
import CloseButton from '@/internals/CloseButton';
import IconButton from '../IconButton';
import { forwardRef } from '@/internals/utils';
import { forwardRef, createChainedFunction } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { createChainedFunction } from '@/internals/utils';
import { ModalContext } from './ModalContext';
import type { WithAsProps } from '@/internals/types';

Expand Down
3 changes: 1 addition & 2 deletions src/Nav/NavDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import NavContext from './NavContext';
import NavDropdownItem from './NavDropdownItem';
import NavDropdownMenu from './NavDropdownMenu';
import NavDropdownToggle, { NavDropdownToggleProps } from './NavDropdownToggle';
import { forwardRef } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { mergeRefs, placementPolyfill } from '@/internals/utils';
import { forwardRef, mergeRefs, placementPolyfill } from '@/internals/utils';
import { initialState, reducer } from '../Dropdown/DropdownState';
import type { PlacementCorners, WithAsProps } from '@/internals/types';

Expand Down
3 changes: 1 addition & 2 deletions src/Nav/NavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Ripple from '@/internals/Ripple';
import SafeAnchor from '../SafeAnchor';
import NavContext from './NavContext';
import { useClassNames } from '@/internals/hooks';
import { shallowEqual } from '@/internals/utils';
import { forwardRef } from '@/internals/utils';
import { forwardRef, shallowEqual } from '@/internals/utils';
import type { WithAsProps } from '@/internals/types';
import type { IconProps } from '@rsuite/icons/Icon';

Expand Down
3 changes: 1 addition & 2 deletions src/Navbar/NavbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import NavContext, { NavContextProps } from '../Nav/NavContext';
import Ripple from '@/internals/Ripple';
import SafeAnchor from '../SafeAnchor';
import { useClassNames } from '@/internals/hooks';
import { shallowEqual } from '@/internals/utils';
import { forwardRef } from '@/internals/utils';
import { forwardRef, shallowEqual } from '@/internals/utils';
import type { IconProps } from '@rsuite/icons/Icon';
import type { WithAsProps } from '@/internals/types';

Expand Down
3 changes: 1 addition & 2 deletions src/Pagination/LimitPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useRef } from 'react';
import SelectPicker, { type SelectPickerProps } from '../SelectPicker';
import { forwardRef, mergeRefs } from '@/internals/utils';
import { forwardRef, mergeRefs, tplTransform } from '@/internals/utils';
import { PaginationLocale } from '../locales';
import { tplTransform } from '@/internals/utils';
import type { OnChangeCallback, SizeType } from '@/internals/types';

interface LimitPickerProps extends Omit<SelectPickerProps<any>, 'locale' | 'disabled' | 'data'> {
Expand Down
3 changes: 1 addition & 2 deletions src/RadioTile/RadioTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import React, { useCallback, useContext } from 'react';
import CheckIcon from '@rsuite/icons/Check';
import Stack from '../Stack';
import { RadioTileContext } from '../RadioTileGroup/RadioTileGroup';
import { forwardRef } from '@/internals/utils';
import { forwardRef, partitionHTMLProps } from '@/internals/utils';
import { useClassNames, useControlled, useUniqueId } from '@/internals/hooks';
import { useCustom } from '../CustomProvider';
import { partitionHTMLProps } from '@/internals/utils';
import type { WithAsProps } from '@/internals/types';

export interface RadioTileProps<T = string | number>
Expand Down
3 changes: 1 addition & 2 deletions src/Sidenav/ExpandedSidenavDropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import isNil from 'lodash/isNil';
import Ripple from '@/internals/Ripple';
import SafeAnchor from '../SafeAnchor';
import NavContext from '../Nav/NavContext';
import { forwardRef } from '@/internals/utils';
import { forwardRef, createChainedFunction, shallowEqual } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { createChainedFunction, shallowEqual } from '@/internals/utils';
import { SidenavContext } from './Sidenav';
import { useRenderDropdownItem } from '../Dropdown/useRenderDropdownItem';
import type { IconProps } from '@rsuite/icons/Icon';
Expand Down
3 changes: 1 addition & 2 deletions src/Sidenav/ExpandedSidenavDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import Ripple from '@/internals/Ripple';
import Disclosure from '@/internals/Disclosure/Disclosure';
import ArrowLeftLine from '@rsuite/icons/ArrowLeftLine';
import ArrowRightLine from '@rsuite/icons/ArrowRightLine';
import { forwardRef } from '@/internals/utils';
import { forwardRef, createChainedFunction } from '@/internals/utils';
import { useClassNames } from '@/internals/hooks';
import { createChainedFunction } from '@/internals/utils';
import { SidenavContext } from './Sidenav';
import { useCustom } from '../CustomProvider';
import type { WithAsProps } from '@/internals/types';
Expand Down

0 comments on commit b0dcaf8

Please sign in to comment.