Skip to content

Commit

Permalink
fix: rename ListNext to useList
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaevAlexandr committed Dec 19, 2023
1 parent 0f594bf commit e842302
Show file tree
Hide file tree
Showing 57 changed files with 40 additions and 32 deletions.
12 changes: 6 additions & 6 deletions src/components/TreeSelect/TreeSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import React from 'react';

import {useForkRef, useUniqId} from '../../hooks';
import {SelectControl} from '../Select/components';
import {SelectPopup} from '../Select/components/SelectPopup/SelectPopup';
import {borderRadius} from '../borderRadius';
import {Flex} from '../layout';
import {useMobile} from '../mobile';
import {
type ListItemId,
ListItemView,
Expand All @@ -9,12 +14,7 @@ import {
useList,
useListKeydown,
useListState,
} from '../ListNext';
import {SelectControl} from '../Select/components';
import {SelectPopup} from '../Select/components/SelectPopup/SelectPopup';
import {borderRadius} from '../borderRadius';
import {Flex} from '../layout';
import {useMobile} from '../mobile';
} from '../useList';
import {block} from '../utils/cn';

import {TreeListContainer} from './components/TreeListContainer/TreeListContainer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react';
import type {Meta, StoryFn} from '@storybook/react';
import identity from 'lodash/identity';

import {createRandomizedData} from '../../ListNext/__stories__/utils/makeData';
import {Flex} from '../../layout';
import {createRandomizedData} from '../../useList/__stories__/utils/makeData';
import {TreeSelect} from '../TreeSelect';
import type {TreeSelectProps} from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'react';
import identity from 'lodash/identity';

import {Label} from '../../../Label';
import {ListItemView} from '../../../ListNext';
import {useInfinityFetch} from '../../../ListNext/__stories__/utils/useInfinityFetch';
import {IntersectionContainer} from '../../../ListNext/components/IntersectionContainer/IntersectionContainer';
import {Loader} from '../../../Loader';
import {Flex, spacing} from '../../../layout';
import {ListItemView} from '../../../useList';
import {useInfinityFetch} from '../../../useList/__stories__/utils/useInfinityFetch';
import {IntersectionContainer} from '../../../useList/components/IntersectionContainer/IntersectionContainer';
import {TreeSelect} from '../../TreeSelect';
import type {TreeSelectProps} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {ListContainerView, computeItemSize} from '../../../ListNext';
import {VirtualizedListContainer} from '../../../ListNext/__stories__/components/VirtualizedListContainer';
import {ListContainerView, computeItemSize} from '../../../useList';
import {VirtualizedListContainer} from '../../../useList/__stories__/components/VirtualizedListContainer';
import type {RenderContainerProps} from '../../types';

// custom container renderer example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
} from 'react-beautiful-dnd';

import {Icon} from '../../../Icon';
import {ListContainerView, ListItemView, ListItemViewProps} from '../../../ListNext';
import {createRandomizedData} from '../../../ListNext/__stories__/utils/makeData';
import {reorderArray} from '../../../ListNext/__stories__/utils/reorderArray';
import {Flex} from '../../../layout';
import {ListContainerView, ListItemView, ListItemViewProps} from '../../../useList';
import {createRandomizedData} from '../../../useList/__stories__/utils/makeData';
import {reorderArray} from '../../../useList/__stories__/utils/reorderArray';
import {TreeSelect} from '../../TreeSelect';
import type {TreeSelectProps} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'react';
import identity from 'lodash/identity';

import {Button} from '../../../Button';
import {useListFilter} from '../../../ListNext';
import {createRandomizedData} from '../../../ListNext/__stories__/utils/makeData';
import {Text} from '../../../Text';
import {TextInput} from '../../../controls';
import {Flex, spacing} from '../../../layout';
import {useListFilter} from '../../../useList';
import {createRandomizedData} from '../../../useList/__stories__/utils/makeData';
import {TreeSelect} from '../../TreeSelect';
import type {TreeSelectProps} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import identity from 'lodash/identity';

import {Button} from '../../../Button';
import {Icon} from '../../../Icon';
import {ListItemId, ListItemType, ListItemView, getListParsedState} from '../../../ListNext';
import {createRandomizedData} from '../../../ListNext/__stories__/utils/makeData';
import {Flex, spacing} from '../../../layout';
import {ListItemId, ListItemType, ListItemView, getListParsedState} from '../../../useList';
import {createRandomizedData} from '../../../useList/__stories__/utils/makeData';
import {TreeSelect} from '../../TreeSelect';
import type {TreeSelectProps} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import identity from 'lodash/identity';
import {Button} from '../../../Button';
import {DropdownMenu} from '../../../DropdownMenu';
import {Icon} from '../../../Icon';
import {ListItemId, ListItemView} from '../../../ListNext';
import {createRandomizedData} from '../../../ListNext/__stories__/utils/makeData';
import {Flex, spacing} from '../../../layout';
import {ListItemId, ListItemView} from '../../../useList';
import {createRandomizedData} from '../../../useList/__stories__/utils/makeData';
import {TreeSelect} from '../../TreeSelect';
import type {TreeSelectProps} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';

import type {RenderContainerProps} from 'src/components/TreeSelect/types';

import {ListContainerView} from '../../../ListNext';
import {ListItemRecursiveRenderer} from '../../../ListNext/components/ListRecursiveRenderer/ListRecursiveRenderer';
import {ListContainerView} from '../../../useList';
import {ListItemRecursiveRenderer} from '../../../useList/components/ListRecursiveRenderer/ListRecursiveRenderer';

export const TreeListContainer = <T,>({
items,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TreeSelect/hooks/useTreeSelectSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import type {UseOpenProps} from '../../../hooks/useSelect/types';
import {useOpenState} from '../../../hooks/useSelect/useOpenState';
import type {ListItemId} from '../../ListNext/types';
import type {ListItemId} from '../../useList/types';

type UseTreeSelectSelectionProps = {
value?: ListItemId[];
Expand Down
4 changes: 2 additions & 2 deletions src/components/TreeSelect/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type React from 'react';

import type {QAProps} from '../types';
import type {
KnownItemStructure,
ListItemId,
Expand All @@ -10,8 +11,7 @@ import type {
OverrideItemContext,
RenderItemContext,
RenderItemState,
} from '../ListNext';
import type {QAProps} from '../types';
} from '../useList';

export type RenderControlProps = {
open: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,21 @@ export const PopupWithTogglerList = ({size, itemsCount}: PopupWithTogglerListPro
expandedById={listState.expandedById}
>
{(id) => {
const [data, state, _context] = getItemRenderState({
const [data, state, listContext] = getItemRenderState({
id,
size,
onItemClick,
...listParsedState,
...listState,
});

return <ListItemView {...state} {...data} />;
return (
<ListItemView
{...state}
{...data}
selectable={!listContext.groupState}
/>
);
}}
</ListItemRecursiveRenderer>
))}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';

import {Check} from '@gravity-ui/icons';
import {Check, ChevronDown, ChevronUp} from '@gravity-ui/icons';

import {ArrowToggle} from '../../../ArrowToggle';
import {Icon} from '../../../Icon';
import {Text, colorText} from '../../../Text';
import {borderRadius} from '../../../borderRadius';
Expand Down Expand Up @@ -159,7 +158,9 @@ export const ListItemView = React.forwardRef(
{renderSafeIndentation(indentation)}

{startSlot ??
(isGroup ? <ArrowToggle direction={expanded ? 'bottom' : 'top'} /> : null)}
(isGroup ? (
<Icon data={expanded ? ChevronDown : ChevronUp} size={16} />
) : null)}

<Flex direction="column" gap="0.5">
{typeof title === 'string' ? (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable valid-jsdoc */
import type {
ItemsParsedState,
ListGroupState,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/unstable.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {useList, useListFilter, useListKeydown} from './components/ListNext';
export {useList, useListFilter, useListKeydown} from './components/useList';
export * from './components/TreeSelect';

0 comments on commit e842302

Please sign in to comment.