mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 20:27:43 +02:00
A tooltip with a new approach (#2172)
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
import Button from './Button.svelte'
|
||||
import DropdownLabelsPopupIntl from './DropdownLabelsPopupIntl.svelte'
|
||||
import Label from './Label.svelte'
|
||||
import Tooltip from './Tooltip.svelte'
|
||||
|
||||
export let icon: Asset | AnySvelteComponent | undefined = undefined
|
||||
export let label: IntlString
|
||||
@@ -48,33 +47,32 @@
|
||||
</script>
|
||||
|
||||
<div bind:this={container} class="min-w-0">
|
||||
<Tooltip {label} fill={width === '100%'} direction={labelDirection}>
|
||||
<Button
|
||||
{icon}
|
||||
width={width ?? 'min-content'}
|
||||
{size}
|
||||
{kind}
|
||||
{justify}
|
||||
on:click={() => {
|
||||
if (!opened) {
|
||||
opened = true
|
||||
showPopup(DropdownLabelsPopupIntl, { placeholder, items, selected }, container, (result) => {
|
||||
if (result) {
|
||||
selected = result
|
||||
dispatch('selected', result)
|
||||
}
|
||||
opened = false
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span slot="content" class="overflow-label disabled">
|
||||
{#if selectedItem}
|
||||
<Label label={selectedItem.label} />
|
||||
{:else}
|
||||
<Label label={label ?? ui.string.NotSelected} />
|
||||
{/if}
|
||||
</span>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Button
|
||||
{icon}
|
||||
width={width ?? 'min-content'}
|
||||
{size}
|
||||
{kind}
|
||||
{justify}
|
||||
showTooltip={{ label, direction: labelDirection }}
|
||||
on:click={() => {
|
||||
if (!opened) {
|
||||
opened = true
|
||||
showPopup(DropdownLabelsPopupIntl, { placeholder, items, selected }, container, (result) => {
|
||||
if (result) {
|
||||
selected = result
|
||||
dispatch('selected', result)
|
||||
}
|
||||
opened = false
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span slot="content" class="overflow-label disabled">
|
||||
{#if selectedItem}
|
||||
<Label label={selectedItem.label} />
|
||||
{:else}
|
||||
<Label label={label ?? ui.string.NotSelected} />
|
||||
{/if}
|
||||
</span>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user