{
const stepMs = state.transitionDelay ?? 30;
const pointStyle = calculatePointStyle(
state.type ?? 'linear',
state.direction ?? 'up',
index,
total,
state.radius ?? 0,
);
const isRadial = state.type !== 'linear';
return {
transitionDelay: calculateTransitionDelay(index, total, state.open, stepMs),
...pointStyle,
...(isRadial
? {
transform: state.open
? 'translate(-50%, -50%) scale(1)'
: 'translate(-50%, -50%) scale(0.4)',
}
: {}),
};
}
function renderActionIcon(icon: string): TemplateResult {
return html`
`;
}
export function renderSpeedDial(
state: NuiSpeedDialViewState,
handlers: NuiSpeedDialHandlers,
): TemplateResult {
const visibleItems = state.model.filter(isItemVisible);
const direction = state.direction ?? 'up';
const type = state.type ?? 'linear';
const rotateAnimation = state.rotateAnimation !== false;
const showRotate = rotateAnimation && !state.hideIcon;
const containerClass = [
'nui-speed-dial',
`nui-speed-dial-direction-${direction}`,
`nui-speed-dial-type-${type}`,
state.open ? 'nui-speed-dial-open' : '',
state.speedDialClass,
]
.filter(Boolean)
.join(' ');
const buttonClass = [
'nui-speed-dial-button',
state.buttonClass,
state.open ? 'nui-speed-dial-open' : '',
showRotate ? 'nui-speed-dial-button-rotate' : '',
]
.filter(Boolean)
.join(' ');
const currentIcon =
state.open && state.hideIcon
? state.hideIcon
: state.showIcon || 'mdi:plus';
return html`
${
state.mask
? html` {
e.stopPropagation();
if (state.open) {
handlers.onToggle(e);
}
}}
>
`
: nothing
}
${visibleItems.map((item, index) => {
const itemStyle = calculateItemStyle(
state,
index,
visibleItems.length,
);
return html`
-
`;
})}
`;
}