-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix wrong assumption on external hover
- Loading branch information
1 parent
c418f6f
commit ca3f936
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { ref } from 'vue'; | ||
import type { Meta, StoryObj } from '@storybook/vue3'; | ||
|
||
import { withSizeArgs, withSizeArgTypes } from '@/docs/storybook-helpers'; | ||
import DATASETS from '@/docs/storybook-data/base-data'; | ||
|
||
import LumeBarChart from '../components/charts/lume-bar-chart'; | ||
|
||
const meta: Meta<typeof LumeBarChart> = { | ||
title: 'Playground/Synced tooltips', | ||
component: LumeBarChart, | ||
argTypes: { | ||
...withSizeArgTypes(), | ||
data: { | ||
control: 'object', | ||
description: 'Chart data.', | ||
}, | ||
labels: { | ||
control: 'object', | ||
description: 'Chart labels.', | ||
}, | ||
hoveredIndex: { | ||
control: 'number', | ||
description: 'Chart hovered index', | ||
}, | ||
}, | ||
args: { | ||
...withSizeArgs(), | ||
options: { | ||
margins: 'auto', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof LumeBarChart>; | ||
|
||
export const Basic: Story = { | ||
render: ({ args }) => ({ | ||
components: { LumeBarChart }, | ||
setup() { | ||
const containerStyle = { | ||
width: '480px', | ||
height: '320px', | ||
padding: '8px', | ||
border: '1px solid var(--lume-color--grey-50)', | ||
borderRadius: '4px', | ||
overflow: 'hidden', | ||
}; | ||
const hoveredIndex = ref(-1); | ||
return { args, containerStyle, hoveredIndex }; | ||
}, | ||
template: ` | ||
<div :style="containerStyle" style="margin-bottom: 16px"> | ||
<lume-bar-chart | ||
v-bind="args" | ||
type="stacked" | ||
:hovered-index="hoveredIndex" | ||
@tooltip-opened="hoveredIndex = $event.index" | ||
@tooltip-moved="hoveredIndex = $event.index" | ||
@tooltip-closed="hoveredIndex = -1" | ||
/> | ||
</div> | ||
<div :style="containerStyle"> | ||
<lume-bar-chart | ||
v-bind="args" | ||
type="stacked" | ||
:hovered-index="hoveredIndex" | ||
@tooltip-opened="hoveredIndex = $event.index" | ||
@tooltip-moved="hoveredIndex = $event.index" | ||
@tooltip-closed="hoveredIndex = -1" | ||
/> | ||
</div> | ||
`, | ||
}), | ||
args: { | ||
...DATASETS.AnimalsMetIn2023, | ||
title: 'Synced tooltips', | ||
}, | ||
}; |