'use client'; import * as React from 'react'; import { Icon24Cancel } from '@vkontakte/icons'; import { classNames } from '@vkontakte/vkjs'; import { usePlatform } from '../../hooks/usePlatform'; import { getTextFromChildren } from '../../lib/children'; import type { HTMLAttributesWithRootRef } from '../../types'; import { IconButton } from '../IconButton/IconButton'; import { RootComponent } from '../RootComponent/RootComponent'; import { RemovableIos } from './RemovableIos'; import styles from './Removable.module.css'; export interface RemovableProps { /** * Текст кнопки удаления ячейки. Визуально скрыт везде, кроме iOS. На iOS появляется в выезжающей кнопке для удаления ячейки. */ removePlaceholder?: React.ReactNode; /** * Обработчик, срабатывающий при нажатии на контрол удаления. */ onRemove?: (e: React.MouseEvent, rootEl?: HTMLElement | null) => void; /** * Передает атрибут `data-testid` для кнопки, которая активирует кнопку удаления (iOS only). */ toggleButtonTestId?: string; /** * Передает атрибут `data-testid` для кнопки удаления. */ removeButtonTestId?: string; /** * Блокировка взаимодействия с компонентом. */ disabled?: boolean; } /* eslint-disable jsdoc/require-jsdoc */ interface RemovableCommonOwnProps extends Pick< RemovableOwnProps, 'noPadding' | 'children' | 'removeButtonTestId' | 'disabled' | 'indent' > { removePlaceholderString?: string; onRemoveClick: (e: React.MouseEvent) => void; } /* eslint-enable jsdoc/require-jsdoc */ const RemovableCommon = ({ noPadding, children, removePlaceholderString, onRemoveClick, removeButtonTestId, disabled, indent, }: RemovableCommonOwnProps) => { return (