-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tooltip): implement tooltip to beta phase
- Loading branch information
Showing
30 changed files
with
1,184 additions
and
60 deletions.
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
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
13 changes: 13 additions & 0 deletions
13
apps/website/src/routes/docs/headless/tooltip/examples/animation.tsx
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,13 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-animation"> | ||
Animated tooltip content here | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
58 changes: 58 additions & 0 deletions
58
apps/website/src/routes/docs/headless/tooltip/examples/arrow-styling.tsx
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,58 @@ | ||
import { component$, useStyles$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
useStyles$(` | ||
.tooltip-panel { | ||
background-color: #222; | ||
color: #fff; | ||
padding: 15px; | ||
border-radius: 8px; | ||
position: relative; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
transition: opacity 0.3s ease; | ||
opacity: 0; | ||
} | ||
.tooltip-panel[data-state="open"] { | ||
opacity: 1; | ||
} | ||
.tooltip-arrow { | ||
position: absolute; | ||
width: 20px; | ||
height: 10px; | ||
overflow: hidden; | ||
} | ||
.tooltip-arrow::before { | ||
content: ''; | ||
position: absolute; | ||
width: 10px; | ||
height: 10px; | ||
background-color: #222; | ||
top: -5px; | ||
left: calc(50% - 5px); | ||
transform: rotate(45deg); | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); | ||
transition: top 0.3s ease; | ||
} | ||
.tooltip-panel[data-state="open"] .tooltip-arrow::before { | ||
top: -8px; | ||
} | ||
`); | ||
|
||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel aria-label="Tooltip content" class="tooltip-panel"> | ||
<Tooltip.Arrow class="tooltip-arrow" width={20} height={10} /> | ||
<div> | ||
<h3 style="margin: 0 0 10px;">Tooltip Title</h3> | ||
<p style="margin: 0;">This tooltip has a snazzy styled arrow!</p> | ||
</div> | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/website/src/routes/docs/headless/tooltip/examples/auto.tsx
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,11 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-panel">Tooltip content here</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
14 changes: 14 additions & 0 deletions
14
apps/website/src/routes/docs/headless/tooltip/examples/basic.tsx
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,14 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel aria-label="Tooltip content"> | ||
<Tooltip.Arrow width={10} height={5} /> | ||
Tooltip content here | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
22 changes: 22 additions & 0 deletions
22
apps/website/src/routes/docs/headless/tooltip/examples/complex.tsx
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,22 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip placement="bottom"> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel aria-label="Complex Tooltip content"> | ||
<Tooltip.Arrow width={10} height={5} /> | ||
<div> | ||
<h3>Tooltip Title</h3> | ||
<p>This is a tooltip with complex HTML content, including:</p> | ||
<ul> | ||
<li>List item 1</li> | ||
<li>List item 2</li> | ||
<li>List item 3</li> | ||
</ul> | ||
</div> | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
13 changes: 13 additions & 0 deletions
13
apps/website/src/routes/docs/headless/tooltip/examples/flip.tsx
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,13 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-panel"> | ||
Tooltip content with flip enabled | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/website/src/routes/docs/headless/tooltip/examples/floating.tsx
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,11 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-panel">Floating Tooltip content here</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/website/src/routes/docs/headless/tooltip/examples/gutter.tsx
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,11 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={20} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-panel">Tooltip content with gutter</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
13 changes: 4 additions & 9 deletions
13
apps/website/src/routes/docs/headless/tooltip/examples/hero.tsx
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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import { component$, useStyles$ } from '@builder.io/qwik'; | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
useStyles$(styles); | ||
|
||
return ( | ||
<Tooltip.Root> | ||
<Tooltip.Trigger class="tooltip-trigger">Hover over me</Tooltip.Trigger> | ||
<Tooltip.Content class="tooltip-content">I'm a tooltip!</Tooltip.Content> | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-panel">Tooltip content here</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); | ||
|
||
// internal | ||
import styles from '../snippets/tooltip.css?inline'; |
38 changes: 38 additions & 0 deletions
38
apps/website/src/routes/docs/headless/tooltip/examples/placement.tsx
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,38 @@ | ||
import { component$, useSignal } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
const placement = useSignal<'top' | 'right' | 'bottom' | 'left'>('top'); | ||
|
||
return ( | ||
<div> | ||
<label for="placement">Select Tooltip Placement: </label> | ||
<select | ||
id="placement" | ||
value={placement.value} | ||
onChange$={(e) => | ||
(placement.value = (e.target as HTMLSelectElement).value as | ||
| 'top' | ||
| 'right' | ||
| 'bottom' | ||
| 'left') | ||
} | ||
> | ||
<option value="top">Top</option> | ||
<option value="right">Right</option> | ||
<option value="bottom">Bottom</option> | ||
<option value="left">Left</option> | ||
</select> | ||
|
||
<Tooltip.Root gutter={4} flip placement={placement.value}> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel | ||
aria-label={`Tooltip content on the ${placement.value}`} | ||
class="tooltip-panel" | ||
> | ||
Tooltip content on the {placement.value} | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
</div> | ||
); | ||
}); |
12 changes: 12 additions & 0 deletions
12
apps/website/src/routes/docs/headless/tooltip/examples/styling.tsx
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,12 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
import '../snippets/styling.css'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root delayDuration={800} gutter={4} flip> | ||
<Tooltip.Trigger class="custom-trigger">Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="custom-tooltip-panel">Tooltip content here</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
13 changes: 13 additions & 0 deletions
13
apps/website/src/routes/docs/headless/tooltip/examples/transition.tsx
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,13 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Tooltip } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
return ( | ||
<Tooltip.Root gutter={4} flip> | ||
<Tooltip.Trigger>Hover or Focus me</Tooltip.Trigger> | ||
<Tooltip.Panel class="tooltip-transition"> | ||
Tooltip content with transition | ||
</Tooltip.Panel> | ||
</Tooltip.Root> | ||
); | ||
}); |
Oops, something went wrong.