1 import { type FC, useEffect } from 'react';
3 import { c } from 'ttag';
5 import { Button, Kbd } from '@proton/atoms';
6 import { Icon, Tooltip } from '@proton/components';
7 import { useBulkSelect } from '@proton/pass/components/Bulk/BulkSelectProvider';
8 import { metaKey } from '@proton/shared/lib/helpers/browser';
10 type Props = { disabled?: boolean };
12 export const BulkToggle: FC<Props> = ({ disabled }) => {
13 const bulk = useBulkSelect();
16 if (disabled) bulk.disable();
23 isOpen={bulk.enabled ? false : undefined}
24 originalPlacement={'bottom'}
25 title={<Kbd shortcut={metaKey} />}
31 onClick={bulk[bulk.enabled ? 'disable' : 'enable']}
32 title={c('Action').t`Bulk select items`}
34 className="flex flex-nowrap gap-2 grow-0 text-sm text-semibold max-w-1/3"
40 <Icon name="checkmark-triple" className="shrink-0" />
41 <span className="text-ellipsis hidden xl:block">{c('Action').t`Multiple select`}</span>