mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
* chore(deps-dev): upgrade carbon-components to v10.38.0 * feat(text-input): support read-only variant * docs: use consistent lingo for inline variant examples * docs(popover): add Popover alignment example * fix(file-uploader): adjust markup to avoid accessibility errors Ref:0dfde60e3
* fix(inline-loading): use error filled icon * fix(inline-loading): render iconDescription as title in error/warning icons Ref:51c53c923
* fix(structured-list): update accessibility attributes * fix(tooltip-definition): use span instead of div Ref:cb6de3025
* fix(multi-select): close menu when blurring the last filterable option * fix(multi-select): open/focus field for filterable multiselect #635 * fix(multi-select): unblock focus when blurring input #635 * fix(combo-box): select correct item with keys, allow input after clearing #195 * fix(combo-box): update input text if item is selected * feat(combo-box): render checkmark icon for selected item * fix(ui-shell): toggle SideNav rail when clicking the hamburger menu #699 * fix(context-menu): update context menu classes #684 * docs(context-menu): improve demo instructions #684 * fix(context-menu): close menu when clicking anywhere
63 lines
1.7 KiB
Svelte
63 lines
1.7 KiB
Svelte
<script>
|
|
import {
|
|
ContextMenu,
|
|
ContextMenuDivider,
|
|
ContextMenuGroup,
|
|
ContextMenuOption,
|
|
} from "carbon-components-svelte";
|
|
import CopyFile16 from "carbon-icons-svelte/lib/CopyFile16";
|
|
import Cut16 from "carbon-icons-svelte/lib/Cut16";
|
|
|
|
let selectedIds = [];
|
|
|
|
$: console.log("selectedIds", selectedIds);
|
|
</script>
|
|
|
|
<ContextMenu>
|
|
<ContextMenuOption
|
|
indented
|
|
labelText="Copy"
|
|
shortcutText="⌘C"
|
|
icon="{CopyFile16}"
|
|
/>
|
|
<ContextMenuOption
|
|
indented
|
|
labelText="Cut"
|
|
shortcutText="⌘X"
|
|
icon="{Cut16}"
|
|
/>
|
|
<ContextMenuDivider />
|
|
<ContextMenuOption indented labelText="Export as">
|
|
<ContextMenuGroup labelText="Export options" bind:selectedIds>
|
|
<ContextMenuOption id="pdf" labelText="PDF" />
|
|
<ContextMenuOption id="txt" labelText="TXT" />
|
|
<ContextMenuOption id="mp3" labelText="MP3" />
|
|
</ContextMenuGroup>
|
|
</ContextMenuOption>
|
|
<ContextMenuDivider />
|
|
<ContextMenuOption selectable labelText="Remove metadata" />
|
|
<ContextMenuDivider />
|
|
<ContextMenuGroup labelText="Style options">
|
|
<ContextMenuOption id="0" labelText="Font smoothing" selected />
|
|
<ContextMenuOption id="1" labelText="Reduce noise" />
|
|
<ContextMenuOption id="2" labelText="Auto-sharpen" />
|
|
</ContextMenuGroup>
|
|
<ContextMenuDivider />
|
|
<ContextMenuOption indented kind="danger" labelText="Delete" />
|
|
</ContextMenu>
|
|
|
|
<div>
|
|
<p>Right click anywhere on this page</p>
|
|
</div>
|
|
|
|
<style>
|
|
div {
|
|
position: absolute;
|
|
width: calc(100% - var(--cds-spacing-05));
|
|
height: calc(100% - var(--cds-spacing-06));
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--cds-text-02);
|
|
}
|
|
</style>
|