Skip to content

Commit e27f270

Browse files
committed
feat(tooltip): update documentation
1 parent 25a43d3 commit e27f270

File tree

14 files changed

+184
-73
lines changed

14 files changed

+184
-73
lines changed

packages/ods/src/components/text/documentation/usage-guidelines/properties/usage.preset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Canvas } from '@storybook/addon-docs';
1+
import { Canvas } from '@storybook/blocks';
22

33
<Canvas sourceState="none">
44
<ods-text preset="caption">Caption</ods-text>

packages/ods/src/components/text/documentation/usage-guidelines/usage.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Canvas } from '@storybook/addon-docs';
1+
import { Canvas } from '@storybook/blocks';
22
import PresetProperty from './properties/usage.preset.mdx';
33

44
## Default

packages/ods/src/components/tooltip/documentation/overview-tooltip.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Tooltip component is used to display contextual information when the user hovers
44

55
<Canvas>
66
<div style={{ height: '300px', display: 'inline-flex'}}>
7-
<div>
8-
Hover me
7+
<div id="trigger">
8+
Overview
99
</div>
1010

11-
<ods-tooltip>
12-
Tooltip content
11+
<ods-tooltip trigger-id="trigger">
12+
Tooltip content overview
1313
</ods-tooltip>
1414
</div>
1515
</Canvas>
Original file line numberDiff line numberDiff line change
@@ -1 +1,61 @@
1-
# Content of this file will be auto-generated
1+
## Properties
2+
### position
3+
4+
**position**: [`left` | `top` | `bottom` | `right` | `bottom-end` | `bottom-start` | `left-end` | `left-start` | `right-end` | `right-start` | `top-end` | `top-start`] = `ODS_TOOLTIP_POSITION.top`
5+
6+
7+
### triggerId
8+
9+
**triggerId**: [_string_]
10+
11+
12+
### withArrow
13+
14+
`Optional` **withArrow**: [_boolean_]
15+
16+
17+
## Methods
18+
### hide
19+
20+
**hide**(): `Promise`<_void_>
21+
22+
23+
24+
#### Returns
25+
`Promise`<_void_>
26+
### show
27+
28+
**show**(): `Promise`<_void_>
29+
30+
31+
32+
#### Returns
33+
`Promise`<_void_>
34+
35+
## Enums
36+
### Enumeration: ODS_TOOLTIP_POSITION
37+
38+
**bottom** = `"bottom"`
39+
40+
**bottomEnd** = `"bottom-end"`
41+
42+
**bottomStart** = `"bottom-start"`
43+
44+
**left** = `"left"`
45+
46+
**leftEnd** = `"left-end"`
47+
48+
**leftStart** = `"left-start"`
49+
50+
**right** = `"right"`
51+
52+
**rightEnd** = `"right-end"`
53+
54+
**rightStart** = `"right-start"`
55+
56+
**top** = `"top"`
57+
58+
**topEnd** = `"top-end"`
59+
60+
**topStart** = `"top-start"`
61+

packages/ods/src/components/tooltip/documentation/specifications/specifications-tooltip.mdx

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
You can update the tooltip content by directly updating the slot element.
2+
3+
Example:
4+
```html
5+
<ods-tooltip position="top-start"
6+
trigger-id="top-start"
7+
with-arrow>
8+
<p class="custom-tooltip">
9+
Top-start tooltip
10+
</p>
11+
</ods-tooltip>
12+
<style>
13+
.custom-tooltip {
14+
font-style: italic;
15+
}
16+
</style>
17+
```

packages/ods/src/components/tooltip/documentation/usage-guidelines/usage.mdx

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,45 @@ import { Canvas } from '@storybook/blocks';
33
## Default
44

55
<Canvas sourceState="none">
6-
<div>
6+
<div id="trigger">
77
Hover me
88
</div>
99

10-
<ods-tooltip>
10+
<ods-tooltip trigger-id="trigger">
1111
Tooltip content
1212
</ods-tooltip>
1313
</Canvas>
1414

1515
```html
16-
<div>
16+
<div id="trigger">
1717
Hover me
1818
</div>
1919

20-
<ods-tooltip>
20+
<ods-tooltip trigger-id="trigger">
2121
Tooltip content
2222
</ods-tooltip>
2323
```
2424

2525
## With an arrow tip
2626

2727
<Canvas sourceState="none">
28-
<div>
28+
<div id="trigger">
2929
Hover me
3030
</div>
3131

32-
<ods-tooltip with-arrow>
32+
<ods-tooltip trigger-id="trigger"
33+
with-arrow>
3334
Tooltip content
3435
</ods-tooltip>
3536
</Canvas>
3637

3738
```html
38-
<div>
39+
<div id="trigger">
3940
Hover me
4041
</div>
4142

42-
<ods-tooltip with-arrow>
43+
<ods-tooltip trigger-id="trigger"
44+
with-arrow>
4345
Tooltip content
4446
</ods-tooltip>
4547
```

packages/storybook/stories/components/text/migration_.from.17.x.mdx renamed to packages/storybook/stories/components/text/migration.from.17.x.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Meta } from '@storybook/blocks';
22
import Migration from '@ovhcloud/ods-components/src/components/text/documentation/migration.from.17.x.mdx';
33
import * as TextStories from './text.stories';
44

5-
<Meta of={TextStories} name='Migration From 17.x' />
5+
<Meta of={ TextStories } name='Migration From 17.x' />
66

77
# Text - migrate from v17 to v18
88
----

packages/storybook/stories/components/tooltip/1_specifications.stories.mdx

-20
This file was deleted.

packages/storybook/stories/components/tooltip/2_usage.stories.mdx

-9
This file was deleted.

packages/storybook/stories/components/tooltip/4_demo.stories.ts

-22
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Meta, Markdown } from '@storybook/blocks';
2+
import OverviewTooltip from '@ovhcloud/ods-components/src/components/tooltip/documentation/overview-tooltip.mdx';
3+
import SpecificationsTooltip from '@ovhcloud/ods-components/src/components/tooltip/documentation/specifications/spec.md?raw';
4+
import StyleCustomizationTooltip from '@ovhcloud/ods-components/src/components/tooltip/documentation/style-customization-tooltip.mdx';
5+
import Usage from '@ovhcloud/ods-components/src/components/tooltip/documentation/usage-guidelines/usage.mdx';
6+
import { Banner } from '../../Banner';
7+
import * as TooltipStories from './tooltip.stories';
8+
9+
<Meta of={ TooltipStories } name='Documentation' />
10+
11+
<Banner of={ TooltipStories } />
12+
13+
# Overview
14+
15+
<OverviewTooltip />
16+
17+
# API
18+
19+
<Markdown> { SpecificationsTooltip } </Markdown>
20+
21+
# Style customization
22+
23+
<StyleCustomizationTooltip />
24+
25+
# Examples
26+
27+
<Usage />

packages/storybook/stories/components/tooltip/3_migration_.from.17.x.stories.mdx renamed to packages/storybook/stories/components/tooltip/migration.from.17.x.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Meta } from '@storybook/addon-docs';
1+
import { Meta } from '@storybook/blocks';
22
import Migration from '@ovhcloud/ods-components/src/components/tooltip/documentation/migration.from.17.x.mdx';
3+
import * as TooltipStories from './tooltip.stories';
34

4-
<Meta title="ODS Components/TODO/Tooltip/Migration From 17.x" />
5+
<Meta of={ TooltipStories } name='Migration From 17.x' />
56

67
# Tooltip - migrate from v17 to v18
78
----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { ODS_TOOLTIP_POSITION, ODS_TOOLTIP_POSITIONS } from '@ovhcloud/ods-components';
2+
import { defineCustomElement } from '@ovhcloud/ods-components/dist/components/ods-tooltip';
3+
import { type Meta, StoryObj } from '@storybook/web-components';
4+
// import { html } from 'lit-html';
5+
// import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
6+
import { CONTROL_CATEGORY, orderControls } from '../../control.ts';
7+
8+
defineCustomElement();
9+
10+
const meta: Meta = {
11+
title: 'ODS Components/User feedback/Tooltip',
12+
component: 'ods-tooltip',
13+
// decorators: [(story) => html`<div style="height: 300px; display: inline-flex">${story()}</div>`],
14+
};
15+
16+
export default meta;
17+
18+
export const Demo: StoryObj = {
19+
// render: (args) => html`
20+
// <button id="trigger">
21+
// Hover me
22+
// </button>
23+
// <ods-tooltip position="${args.position}"
24+
// trigger-id="trigger"
25+
// with-arrow="${args.withArrow}">
26+
// ${unsafeHTML(args.content)}
27+
// </ods-tooltip>
28+
// `,
29+
argTypes: orderControls ({
30+
content: {
31+
table: {
32+
category: CONTROL_CATEGORY.slot,
33+
defaultValue: { summary: 'ø' },
34+
},
35+
control: 'text',
36+
},
37+
position: {
38+
table: {
39+
category: CONTROL_CATEGORY.general,
40+
defaultValue: { summary: ODS_TOOLTIP_POSITION.top },
41+
type: { summary: ODS_TOOLTIP_POSITIONS },
42+
},
43+
control: { type: 'select' },
44+
options: ODS_TOOLTIP_POSITIONS,
45+
},
46+
withArrow: {
47+
table: {
48+
category: CONTROL_CATEGORY.design,
49+
defaultValue: { summary: false },
50+
},
51+
control: { type: 'boolean' },
52+
}
53+
}),
54+
args: {
55+
content: 'Tooltip content',
56+
position: ODS_TOOLTIP_POSITION.top,
57+
withArrow: true,
58+
},
59+
};

0 commit comments

Comments
 (0)