Skip to content

Commit b8f4616

Browse files
authored
refactor(design-system)!: remove deprecated DsDropdownMenuLegacy and DsRadioGroupLegacy [AR-53409] (#340)
1 parent b3752ae commit b8f4616

File tree

13 files changed

+11
-624
lines changed

13 files changed

+11
-624
lines changed

.changeset/fluffy-clubs-greet.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@drivenets/design-system': major
3+
'@drivenets/eslint-plugin-design-system': major
4+
---
5+
6+
Remove deprecated components `DsDropdownMenuLegacy` and `DsRadioGroupLegacy`
7+
Remove deprecation eslint rules for `DsDropdownMenuLegacy` and `DsRadioGroupLegacy`

packages/design-system/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262
"@radix-ui/react-checkbox": "^1.3.3",
6363
"@radix-ui/react-collapsible": "^1.1.12",
6464
"@radix-ui/react-dialog": "^1.1.15",
65-
"@radix-ui/react-dropdown-menu": "^2.1.16",
6665
"@radix-ui/react-popover": "^1.1.15",
67-
"@radix-ui/react-radio-group": "^1.3.8",
6866
"@radix-ui/react-slot": "^1.2.4",
6967
"@radix-ui/react-tooltip": "^1.2.8",
7068
"@radix-ui/react-visually-hidden": "^1.2.4",

packages/design-system/src/components/ds-dropdown-menu/ds-dropdown-menu-legacy.stories.tsx

Lines changed: 0 additions & 99 deletions
This file was deleted.

packages/design-system/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@use '../../styles/typography';
21
@use '../../styles/shared/dropdown';
32

43
.content {
@@ -111,20 +110,3 @@
111110
.triggerItemIcon {
112111
margin-left: auto;
113112
}
114-
115-
/** Legacy classes */
116-
.contentLegacy {
117-
@include dropdown.dropdown-content;
118-
min-width: 200px;
119-
width: var(--radix-select-trigger-width);
120-
}
121-
122-
.viewportLegacy {
123-
@include dropdown.dropdown-viewport;
124-
}
125-
126-
.itemLegacy {
127-
@include dropdown.dropdown-item;
128-
@include typography.p-special;
129-
@include typography.ellipsis;
130-
}

packages/design-system/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import type React from 'react';
22
import { createContext, Fragment, useContext, useState } from 'react';
3-
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
43
import { Menu } from '@ark-ui/react/menu';
54
import { Portal } from '@ark-ui/react/portal';
65
import classNames from 'classnames';
76
import styles from './ds-dropdown-menu.module.scss';
87
import { DsIcon } from '../ds-icon';
98
import { DsTypography } from '../ds-typography';
10-
import { DsTextInput } from '../ds-text-input';
119
import type {
1210
DsDropdownMenuActionsProps,
1311
DsDropdownMenuContentProps,
@@ -17,7 +15,6 @@ import type {
1715
DsDropdownMenuItemGroupProps,
1816
DsDropdownMenuItemIndicatorProps,
1917
DsDropdownMenuItemProps,
20-
DsDropdownMenuLegacyProps,
2118
DsDropdownMenuPositioning,
2219
DsDropdownMenuRootProps,
2320
DsDropdownMenuSeparatorProps,
@@ -279,95 +276,6 @@ const TriggerItem: React.FC<DsDropdownMenuTriggerItemProps> = ({ className, styl
279276
);
280277
};
281278

282-
/**
283-
* DEPRECATED: Legacy DsDropdownMenu component with options array
284-
* Use compound component pattern instead
285-
* @deprecated
286-
*/
287-
/* c8 ignore start */
288-
export const DsDropdownMenuLegacy: React.FC<DsDropdownMenuLegacyProps> = ({
289-
options,
290-
children,
291-
contentGap = 0,
292-
className,
293-
style,
294-
align = 'center',
295-
side = 'bottom',
296-
disablePortal = false,
297-
disableSearch = true,
298-
selected,
299-
onSelect,
300-
}) => {
301-
const [open, setOpen] = useState(false);
302-
const [searchTerm, setSearchTerm] = useState('');
303-
304-
const Wrapper = disablePortal ? Fragment : DropdownMenu.Portal;
305-
306-
const filteredOptions = disableSearch
307-
? options
308-
: options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
309-
310-
return (
311-
<DropdownMenu.Root open={open} onOpenChange={setOpen}>
312-
<DropdownMenu.Trigger asChild>{children}</DropdownMenu.Trigger>
313-
<Wrapper>
314-
<DropdownMenu.Content
315-
className={classNames(styles.contentLegacy, styles.viewportLegacy)}
316-
sideOffset={contentGap}
317-
align={align}
318-
side={side}
319-
>
320-
{!disableSearch && (
321-
<DsTextInput
322-
placeholder="Search"
323-
value={searchTerm}
324-
onValueChange={setSearchTerm}
325-
slots={{
326-
startAdornment: <DsIcon icon="search" size="tiny" />,
327-
}}
328-
onKeyDown={(e) => e.stopPropagation()}
329-
/>
330-
)}
331-
{filteredOptions.map((option, i) => (
332-
<DropdownMenu.Item
333-
key={i}
334-
disabled={option.disabled}
335-
className={classNames(
336-
styles.itemLegacy,
337-
{
338-
[styles.selected]: selected === option.value,
339-
},
340-
className,
341-
)}
342-
style={style}
343-
onClick={(e) => {
344-
e.stopPropagation();
345-
346-
if (!option.disabled) {
347-
if (option.value) {
348-
onSelect?.(option.value);
349-
}
350-
option.onClick?.(e);
351-
setOpen(false);
352-
}
353-
}}
354-
>
355-
{option.icon && <DsIcon icon={option.icon} className={styles.itemIcon} />}
356-
<span className={styles.label}>{option.label}</span>
357-
{option.value && selected === option.value && (
358-
<span className={styles.indicator}>
359-
<DsIcon icon="check" />
360-
</span>
361-
)}
362-
</DropdownMenu.Item>
363-
))}
364-
</DropdownMenu.Content>
365-
</Wrapper>
366-
</DropdownMenu.Root>
367-
);
368-
};
369-
/* c8 ignore stop */
370-
371279
/**
372280
* Design system DsDropdownMenu component
373281
*

packages/design-system/src/components/ds-dropdown-menu/ds-dropdown-menu.types.ts

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
1+
import type { CSSProperties, ReactNode } from 'react';
22
import type { Menu } from '@ark-ui/react/menu';
3-
import type { IconType } from '../ds-icon';
43

54
/**
65
* Base positioning type
@@ -15,92 +14,6 @@ export type DsDropdownMenuPositioning = Pick<
1514
'placement' | 'gutter' | 'sameWidth' | 'getAnchorRect'
1615
>;
1716

18-
/**
19-
* DEPRECATED: Legacy dropdown menu option configuration
20-
* Use compound component pattern instead
21-
* @deprecated
22-
*/
23-
export interface DsDropdownMenuOptionLegacy {
24-
/**
25-
* Display label for the menu option
26-
*/
27-
label: string;
28-
/**
29-
* Optional icon to display
30-
*/
31-
icon?: IconType;
32-
/**
33-
* Whether this option is disabled
34-
*/
35-
disabled?: boolean;
36-
/**
37-
* Click handler for the option
38-
*/
39-
onClick?: (e: MouseEvent<HTMLElement>) => void;
40-
/**
41-
* Optional value for selection tracking
42-
*/
43-
value?: string;
44-
}
45-
46-
/**
47-
* DEPRECATED: Legacy props for DsDropdownMenuLegacy component
48-
* Use compound component pattern instead
49-
* @deprecated
50-
*/
51-
export interface DsDropdownMenuLegacyProps {
52-
/**
53-
* The options to be displayed in the dropdown menu
54-
*/
55-
options: DsDropdownMenuOptionLegacy[];
56-
/**
57-
* Optional children to be rendered inside the component
58-
* Typically used for the trigger element
59-
*/
60-
children?: ReactNode | undefined;
61-
/**
62-
* The gap between the trigger and dropdown content in pixels
63-
* @default 0
64-
*/
65-
contentGap?: number;
66-
/**
67-
* Additional CSS class names
68-
*/
69-
className?: string;
70-
/**
71-
* Optional inline styles to apply to the component
72-
*/
73-
style?: CSSProperties;
74-
/**
75-
* The alignment of the dropdown content
76-
* @default 'center'
77-
*/
78-
align?: 'start' | 'center' | 'end';
79-
/**
80-
* The side of the dropdown content
81-
* @default 'bottom'
82-
*/
83-
side?: 'top' | 'right' | 'bottom' | 'left';
84-
/**
85-
* Whether to render in place instead of using portals
86-
* @default false
87-
*/
88-
disablePortal?: boolean;
89-
/**
90-
* Whether to disable the search functionality
91-
* @default false
92-
*/
93-
disableSearch?: boolean;
94-
/**
95-
* Currently selected value (for selection tracking)
96-
*/
97-
selected?: string;
98-
/**
99-
* Callback when an option with a value is selected
100-
*/
101-
onSelect?: (value: string) => void;
102-
}
103-
10417
/**
10518
* Props for the DsDropdownMenu Root component
10619
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { DsDropdownMenu, DsDropdownMenuLegacy } from './ds-dropdown-menu';
1+
export { DsDropdownMenu } from './ds-dropdown-menu';
22
export * from './ds-dropdown-menu.types';

0 commit comments

Comments
 (0)