mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
parent
f61e316788
commit
88f4304d5a
2 changed files with 15 additions and 20 deletions
|
@ -31,7 +31,9 @@
|
|||
|
||||
import { getContext, afterUpdate } from "svelte";
|
||||
|
||||
const { focusedId, add, update, change } = getContext("OverflowMenu");
|
||||
const { focusedId, add, update, change, items } = getContext("OverflowMenu");
|
||||
|
||||
$: item = $items.find((_) => _.id === id);
|
||||
|
||||
add({ id, text, primaryFocus, disabled });
|
||||
|
||||
|
@ -68,8 +70,9 @@
|
|||
bind:this={ref}
|
||||
{...buttonProps}
|
||||
on:click
|
||||
on:click={() => {
|
||||
update(id);
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
update(id, item);
|
||||
}}
|
||||
on:keydown
|
||||
on:keydown={({ key }) => {
|
||||
|
@ -91,8 +94,9 @@
|
|||
bind:this={ref}
|
||||
{...buttonProps}
|
||||
on:click
|
||||
on:click={() => {
|
||||
update(id);
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
update(id, item);
|
||||
}}
|
||||
on:keydown
|
||||
on:keydown={({ key }) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue