You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
<script lang="ts">
|
|
import { getPickerShellHandle } from '$soma/components/picker-shell';
|
|
import { ActiveEidos } from '$uix/eidos';
|
|
import { Button } from '$uix/eidos/components/button';
|
|
import type { PickerShellCancelProps } from './types';
|
|
|
|
// Cancel action — reverts to the value snapshot taken on the OPEN edge
|
|
// and closes the popover. Visual: ghost neutral `<Button>` at
|
|
// size='xs' so the safe-escape action stays visually subordinate to
|
|
// the solid primary Close.
|
|
const { children, onclick, ...rest }: PickerShellCancelProps = $props();
|
|
|
|
const eidos = ActiveEidos.require();
|
|
const shell = getPickerShellHandle();
|
|
const label = eidos.langs.ts('#?components.picker-shell.cancel|Cancel');
|
|
|
|
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
shell?.cancel();
|
|
if (typeof onclick === 'function') onclick.call(event.currentTarget, event);
|
|
}
|
|
</script>
|
|
|
|
<Button
|
|
variant="ghost"
|
|
color="neutral"
|
|
size="xs"
|
|
data-picker-cancel=""
|
|
data-action="cancel"
|
|
aria-label={label}
|
|
onclick={handleClick}
|
|
{...(rest as Record<string, unknown>)}
|
|
>
|
|
{#if children}{@render children()}{:else}{label}{/if}
|
|
</Button>
|