[wip]feat: add snapping options

This commit is contained in:
Dhruv Ahuja
2023-07-04 22:26:53 +05:30
parent 8fcf5daab4
commit 7a5f00b182
6 changed files with 53 additions and 3 deletions
@@ -141,6 +141,8 @@
<PopoverButton {...exclude(popoverButton, ["header", "text"])}>
<TextLabel bold={true}>{popoverButton.header}</TextLabel>
<TextLabel multiline={true}>{popoverButton.text}</TextLabel>
<!-- ! how will this work? -->
<!-- <DropdownInput entries={popoverButton.options_widget}></DropdownInput> -->
</PopoverButton>
{/if}
{@const radioInput = narrowWidgetProps(component.props, "RadioInput")}
@@ -4,10 +4,12 @@
import FloatingMenu from "@graphite/components/layout/FloatingMenu.svelte";
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
import IconButton from "@graphite/components/widgets/buttons/IconButton.svelte";
import WidgetLayout from "../WidgetLayout.svelte";
export let icon: IconName = "DropdownArrow";
export let tooltip: string | undefined = undefined;
export let disabled = false;
export let options_widget: WidgetLayout | undefined = undefined;
// Callbacks
export let action: (() => void) | undefined = undefined;
@@ -20,7 +22,13 @@
</script>
<LayoutRow class="popover-button">
<IconButton classes={{ open }} {disabled} action={() => onClick()} icon={icon || "DropdownArrow"} size={16} {tooltip} data-floating-menu-spawner />
{#if options_widget === undefined}
<IconButton classes={{ open }} {disabled} action={() => onClick()} icon={icon || "DropdownArrow"} size={16} {tooltip} data-floating-menu-spawner />
{:else}
<IconButton classes={{ open }} {disabled} action={() => onClick()} icon={icon || "DropdownArrow"} size={16} {options_widget} data-floating-menu-spawner />
{/if}
<FloatingMenu {open} on:open={({ detail }) => (open = detail)} type="Popover" direction="Bottom">
<slot />
</FloatingMenu>
@@ -931,6 +931,8 @@ export class PopoverButton extends WidgetProps {
@Transform(({ value }: { value: string }) => value || undefined)
tooltip!: string | undefined;
options_widget: WidgetLayout | undefined;
}
export type RadioEntryData = {