ui-fab/dist/components/ActionButton.js
Natalie 37f737adc8 feat(@cocotte/ui-fab): extract UI theme package to @ct/@packages
Re-scoped from @lilith/ui-fab to @cocotte/ui-fab. In-set cross-package deps
re-pointed to @cocotte; out-of-set @lilith deps preserved (same Verdaccio).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 13:04:10 -04:00

24 lines
No EOL
1.3 KiB
JavaScript

import { jsx as _jsx } from "react/jsx-runtime";
import { m } from '@lilith/ui-motion';
import styled from '@lilith/ui-styled-components';
import { useIsInMultiFAB } from '../context/MultiFABContext';
import { useFABContext } from '../hooks/useFABContext';
import { FABMainButton } from '../styles';
const IconWrapper = styled(m.div) `
pointer-events: none;
& * {
pointer-events: none !important;
}
`;
const defaultAriaLabels = {
open: 'Open settings',
close: 'Close settings',
title: 'Settings',
};
export const ActionButton = ({ icon, ariaLabels = defaultAriaLabels, className, }) => {
const { isExpanded, fabRotation, toggleExpanded, position } = useFABContext();
const isInMultiFAB = useIsInMultiFAB();
return (_jsx(FABMainButton, { "$position": position, "$inMultiFAB": isInMultiFAB, className: className, onClick: toggleExpanded, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 }, "aria-expanded": isExpanded, "aria-label": isExpanded ? ariaLabels.close : ariaLabels.open, title: ariaLabels.title, "data-testid": "fab-action-button", children: _jsx(IconWrapper, { animate: { rotate: fabRotation }, whileHover: { rotate: fabRotation + 90 }, transition: { duration: 0.5, ease: [0.4, 0, 0.2, 1] }, children: icon }) }));
};
//# sourceMappingURL=ActionButton.js.map