${this.actions.map((action, index) => html`
this._handleActionClick(action, index)}"
>
`)}
`;
}
}
export class SpeedDialAction extends LitElement {
@property({ type: String }) icon = '';
@property({ type: String }) tooltipTitle = '';
@property({ type: Boolean }) disabled = false;
@property({ type: Boolean }) open = false;
@property({ type: Number }) delay = 0;
static styles = css`
:host {
display: block;
margin: 4px;
}
.speed-dial-action {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
border: none;
cursor: pointer;
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
0px 1px 1px 0px rgba(0, 0, 0, 0.14),
0px 1px 3px 0px rgba(0, 0, 0, 0.12);
transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
transform: scale(0);
opacity: 0;
outline: none;
}
.speed-dial-action.open {
transform: scale(1);
opacity: 1;
}
.speed-dial-action:hover {
background-color: #f5f5f5;
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
0px 6px 10px 0px rgba(0, 0, 0, 0.14),
0px 1px 18px 0px rgba(0, 0, 0, 0.12);
}
.speed-dial-action:active {
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
0px 8px 10px 1px rgba(0, 0, 0, 0.14),
0px 3px 14px 2px rgba(0, 0, 0, 0.12);
}
.speed-dial-action.disabled {
background-color: rgba(0, 0, 0, 0.12);
color: rgba(0, 0, 0, 0.26);
cursor: default;
pointer-events: none;
box-shadow: none;
}
.speed-dial-action:focus-visible {
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
0px 1px 1px 0px rgba(0, 0, 0, 0.14),
0px 1px 3px 0px rgba(0, 0, 0, 0.12),
0 0 0 2px rgba(25, 118, 210, 0.2);
}
.action-icon {
width: 20px;
height: 20px;
fill: currentColor;
}
.tooltip {
position: absolute;
background-color: rgba(97, 97, 97, 0.9);
color: #fff;
padding: 4px 8px;
border-radius: 4px;
font-size: 0.75rem;
white-space: nowrap;
pointer-events: none;
opacity: 0;
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1;
}
.speed-dial-action:hover .tooltip {
opacity: 1;
}
/* Tooltip positioning based on parent direction */
:host(.direction-up) .tooltip {
bottom: 100%;
left: 50%;
transform: translateX(-50%);
margin-bottom: 8px;
}
:host(.direction-down) .tooltip {
top: 100%;
left: 50%;
transform: translateX(-50%);
margin-top: 8px;
}
:host(.direction-left) .tooltip {
right: 100%;
top: 50%;
transform: translateY(-50%);
margin-right: 8px;
}
:host(.direction-right) .tooltip {
left: 100%;
top: 50%;
transform: translateY(-50%);
margin-left: 8px;
}
`;
private _renderIcon(iconName: string) {
// Simple icon mapping - same as SpeedDial
const icons: Record