Alignment with Carbon version 10.32 (#588)

* feat(code-snippet): add copy functionality

- docs: add custom feedback copy text example

* feat(tile): support disabled state for SelectableTile, RadioTile

Closes #539

* build(rollup): add clipboard-copy to globals

* feat(copy-button): add copy functionality

* feat(content-switcher): deprecate the light prop

- docs: remove the light variant example

* fix(toolbar-search): remove outer div

* feat(search): add searchClass prop

* fix(composed-modal): set hasScrollingContent class on ModalBody

* docs(data-table): add expandable size examples

* feat(tooltip): add TooltipFooter component

* fix(time-picker): correctly display invalidText

* feat(breadcrumb): support overflow menu

* feat(multi-select): export inputRef prop

* chore(deps-dev): upgrade carbon-components to v10.32.0

* feat(form): add noMargin prop to FormGroup

* docs(tooltip): document TooltipFooter

* feat(context-menu): support danger kind for ContextMenuOption

* feat(data-table): support rendering empty table header in skeleton

* refactor(types): use shorter import path in DataTableSkeleton

* feat(data-table): allow sorting to be disabled for a specific header

* docs(data-table): update example to desort the Protocol header

As an example, it makes more sense because all the values ("http") are the same.

* fix(context-menu): set initial y offset of context menu based on window height #577

* fix(context-menu): render submenu based on viewport constraints #577
This commit is contained in:
Eric Liu 2021-04-02 13:31:53 -07:00 committed by GitHub
commit fa9b90cd79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 825 additions and 233 deletions

View file

@ -54,11 +54,19 @@
/** Obtain a reference to the overflow menu element */
export let menuRef = null;
import { createEventDispatcher, setContext, afterUpdate } from "svelte";
import {
createEventDispatcher,
getContext,
setContext,
afterUpdate,
} from "svelte";
import { writable } from "svelte/store";
import OverflowMenuVertical16 from "carbon-icons-svelte/lib/OverflowMenuVertical16/OverflowMenuVertical16.svelte";
import OverflowMenuHorizontal16 from "carbon-icons-svelte/lib/OverflowMenuHorizontal16/OverflowMenuHorizontal16.svelte";
import { formatStyle } from "./formatStyle";
const ctxBreadcrumbItem = getContext("BreadcrumbItem");
const dispatch = createEventDispatcher();
const items = writable([]);
const currentId = writable(undefined);
@ -68,6 +76,10 @@
let buttonWidth = undefined;
let onMountAfterUpdate = true;
$: if (ctxBreadcrumbItem) {
icon = OverflowMenuHorizontal16;
}
setContext("OverflowMenu", {
focusedId,
add: ({ id, text, primaryFocus }) => {
@ -123,6 +135,11 @@
} else if (direction === "bottom") {
menuRef.style.top = height + "px";
}
if (ctxBreadcrumbItem) {
menuRef.style.top = height + 10 + "px";
menuRef.style.left = -11 + "px";
}
}
if (!open) {
@ -218,6 +235,7 @@
class:bx--overflow-menu-options--light="{light}"
class:bx--overflow-menu-options--sm="{size === 'sm'}"
class:bx--overflow-menu-options--xl="{size === 'xl'}"
class:bx--breadcrumb-menu-options="{!!ctxBreadcrumbItem}"
class:menuOptionsClass
>
<slot />