Skip to content

Commit ef92987

Browse files
committed
docs(storybook): document the trigger slot
1 parent b8eee52 commit ef92987

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

packages/uui-popover/lib/uui-popover.element.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
22
import { css, html, LitElement } from 'lit';
33
import { property, query } from 'lit/decorators.js';
4+
45
import { UUIPopoverEvent } from './UUIPopoverEvent';
56

67
export type PopoverPlacement =
@@ -32,6 +33,7 @@ function mathClamp(value: number, min: number, max: number) {
3233
* @element uui-popover
3334
* @description Open a modal aligned with the opening element. This does not jet work within two layers of scroll containers.
3435
* @fires close - When popover is closed by user interaction.
36+
* @slot trigger - The element that triggers the popover.
3537
*/
3638
@defineElement('uui-popover')
3739
export class UUIPopoverElement extends LitElement {
@@ -76,11 +78,10 @@ export class UUIPopoverElement extends LitElement {
7678

7779
/**
7880
* Define the placement of the popover-modal.
79-
* @type {string}
8081
* @attr placement
8182
* @default 'bottom-start'
8283
*/
83-
@property({ type: String })
84+
@property({ type: String, reflect: true })
8485
get placement(): PopoverPlacement {
8586
return this._placement;
8687
}

packages/uui-popover/lib/uui-popover.story.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,13 @@ export const Nested: Story = props => {
226226
`;
227227
};
228228

229-
export const Tooltip: Story = () => {
229+
Nested.parameters = {
230+
controls: {
231+
include: ['placement', 'margin'],
232+
},
233+
};
234+
235+
export const Tooltip: Story = props => {
230236
const mouseover = (id: string) => {
231237
const popover = document.querySelector(id) as UUIPopoverElement;
232238
popover.open = true;
@@ -248,7 +254,7 @@ export const Tooltip: Story = () => {
248254
<uui-popover
249255
style="margin: auto"
250256
id="tooltip"
251-
placement="auto"
257+
placement="${props.placement}"
252258
margin="8">
253259
<b
254260
slot="trigger"
@@ -270,7 +276,7 @@ export const Tooltip: Story = () => {
270276
<uui-popover
271277
style="margin: auto"
272278
id="tooltip-2"
273-
placement="auto"
279+
placement="${props.placement}"
274280
margin="8">
275281
<b
276282
slot="trigger"
@@ -300,6 +306,16 @@ export const Tooltip: Story = () => {
300306
`;
301307
};
302308

309+
Tooltip.args = {
310+
placement: 'auto',
311+
};
312+
313+
Tooltip.parameters = {
314+
controls: {
315+
include: ['placement', 'margin'],
316+
},
317+
};
318+
303319
Tooltip.play = () => {
304320
const content = document.getElementById('content');
305321
if (content) {

0 commit comments

Comments
 (0)