Skip to content

Commit

Permalink
Merge branch 'next' into feat/disabled-for-modal
Browse files Browse the repository at this point in the history
  • Loading branch information
phamduylong authored Feb 7, 2025
2 parents 1b0c8df + 4439350 commit 56cea05
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-numbers-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@skeletonlabs/skeleton-svelte': patch
---

feat: Implement `arrow` for Tooltip
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 🐞 Bug
description: Report an issue or bug
labels: [bug]
type: Bug
body:
- type: textarea
attributes:
Expand Down Expand Up @@ -29,6 +30,26 @@ body:
id: reproduction
attributes:
label: Link to Reproduction / Stackblitz
- type: textarea
attributes:
label: Environment Information
description: Relevant information about your environment. Use `npx envinfo --system --npmPackages "@skeletonlabs/*" --binaries --browsers` to get this information.
placeholder: |
System:
OS: Windows 11 10.0.26100
CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400
Memory: 4.72 GB / 15.78 GB
Binaries:
Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.2.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.6.0 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (130.0.2849.46)
Internet Explorer: 11.0.26100.1882
npmPackages:
@skeletonlabs/skeleton: ^3.0.0-next.10 => 3.0.0-next.10
@skeletonlabs/skeleton-react: ^1.0.0-next.13 => 1.0.0-next.13
- type: textarea
attributes:
label: More Information
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/docs_issue.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 📗 Report Docs Issue
description: Use this to report a typo or incorrect information.
labels: [documentation]
type: Task
body:
- type: input
id: link
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 🛠️ Request New Feature
description: Let us know what you would like to see added.
labels: ['feature request']
type: Feature
body:
- type: textarea
id: description
Expand Down
18 changes: 18 additions & 0 deletions packages/skeleton-svelte/src/lib/components/Tooltip/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
let {
open = $bindable(false),
disabled = false,
arrow = false,
// Base
base = '',
classes = '',
Expand All @@ -24,6 +25,10 @@
contentBase = '',
contentBackground = '',
contentClasses = '',
// Arrow
arrowBase = '',
arrowBackground = '!bg-white',
arrowClasses = '',
// Snippets
trigger,
content,
Expand Down Expand Up @@ -65,10 +70,23 @@
<!-- Tooltip Content -->
{#if api.open}
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }} class="{positionerBase} {positionerZIndex} {positionerClasses}">
<!-- Arrow -->
{#if arrow}
<div {...api.getArrowProps()}>
<div {...api.getArrowTipProps()} class="{arrowBase} {arrowBackground} {arrowClasses}"></div>
</div>
{/if}
<!-- Snippet Content -->
<div {...api.getContentProps()} class="{contentBase} {contentBackground} {contentClasses}">
{@render content?.()}
</div>
</div>
{/if}
</span>

<style>
:global([data-part='arrow']) {
--arrow-size: 10px;
--arrow-background: white;
}
</style>
10 changes: 10 additions & 0 deletions packages/skeleton-svelte/src/lib/components/Tooltip/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface TooltipProps extends Omit<tooltip.Context, 'id' | 'open'> {
open?: boolean;
/** Disable the trigger element of the tooltip */
disabled?: boolean;
/** Enable display of the popover arrow. */
arrow?: boolean;

// Base ---
/** Set base classes for the root element. */
Expand Down Expand Up @@ -37,6 +39,14 @@ export interface TooltipProps extends Omit<tooltip.Context, 'id' | 'open'> {
/** Provide arbitrary styles for the content. */
contentClasses?: string;

// Arrow ---
/** Set base classes for the arrow. */
arrowBase?: string;
/** Set background classes for the arrow. */
arrowBackground?: string;
/** Provide arbitrary classes for the arrow. */
arrowClasses?: string;

// Snippets ---
/** Provide the template contents inside the trigger button. */
trigger?: Snippet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
triggerBase="underline"
contentBase="card preset-filled p-4"
openDelay={200}
arrow
>
{#snippet trigger()}Hover Me{/snippet}
{#snippet content()}This is a tooltip.{/snippet}
Expand Down

0 comments on commit 56cea05

Please sign in to comment.