Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
15 changes: 3 additions & 12 deletions packages/plasma-b2c/src/components/Combobox/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,20 @@ import type { ComboboxItemOption, ComboboxProps, DistributiveOmit, DistributiveP
import React from 'react';

import { config } from './Combobox.config';
import { Combobox as ComboboxOld } from './Legacy';

const mergedConfig = mergeConfig(comboboxNewConfig, config);
const ComboboxNew = component(mergedConfig);

type PropsFromConfig = keyof typeof config['variations'];

type PropsOld = ComponentProps<typeof ComboboxOld> & { items?: never };

type PropsNew<T extends ComboboxItemOption> = DistributiveOmit<ComboboxProps<T>, PropsFromConfig> &
type Props<T extends ComboboxItemOption> = DistributiveOmit<ComboboxProps<T>, PropsFromConfig> &
DistributivePick<ComponentProps<typeof ComboboxNew>, PropsFromConfig>;

type CommonProps<T extends ComboboxItemOption> = PropsOld | PropsNew<T>;

const ComboboxComponent = <T extends ComboboxItemOption>(
props: CommonProps<T>,
props: Props<T>,
ref: React.ForwardedRef<HTMLInputElement>,
) => {
if (props.items) {
return <ComboboxNew ref={ref} {...(props as any)} />;
}

return <ComboboxOld ref={ref} {...props} />;
return <ComboboxNew ref={ref} {...(props as any)} />;
};

const Combobox = fixedForwardRef(ComboboxComponent);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions packages/plasma-b2c/src/components/Combobox/Legacy/Combobox.ts

This file was deleted.

This file was deleted.

5 changes: 1 addition & 4 deletions packages/plasma-b2c/src/components/Combobox/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
export { ComboboxDivider, ComboboxFooter, ComboboxGroup, ComboboxHeader, ComboboxItem } from './Legacy';

export type { ComboboxOldProps as ComboboxProps, ComboboxItemOption } from '@salutejs/plasma-new-hope';

export type { ComboboxItemOption } from '@salutejs/plasma-new-hope';
export { Combobox } from './Combobox';
Original file line number Diff line number Diff line change
Expand Up @@ -556,24 +556,6 @@ describe('plasma-b2c: Dropdown', () => {
cy.matchImageSnapshot();
});

it('prop: hasArrow', () => {
cy.viewport(1000, 500);

mount(
<CypressTestDecoratorWithTypo>
<Dropdown items={items} hasArrow={false}>
<Button text="Список стран" />
</Dropdown>
</CypressTestDecoratorWithTypo>,
);

cy.get('button').click();
cy.get('[id$="south_america"]').click();
cy.get('[id$="argentina"]').click();

cy.matchImageSnapshot();
});

it('prop: closeOnSelect', () => {
mount(
<CypressTestDecoratorWithTypo>
Expand Down Expand Up @@ -642,20 +624,6 @@ describe('plasma-b2c: Dropdown', () => {
cy.get('[id$="north_america"]').click();
});

it('prop: listHeight, listOverflow', () => {
mount(
<CypressTestDecoratorWithTypo>
<Dropdown items={items} listOverflow="scroll" listHeight={6}>
<Button text="Список стран" />
</Dropdown>
</CypressTestDecoratorWithTypo>,
);

cy.get('button').click();

cy.matchImageSnapshot();
});

it('prop: item data-attrs', () => {
cy.viewport(400, 100);

Expand Down
Loading
Loading