Skip to content

Commit

Permalink
Add missing FloatingArrowProps export. (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugos68 authored Jan 1, 2025
1 parent 56a804b commit f32dd0d
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-donkeys-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@skeletonlabs/floating-ui-svelte": patch
---

Add missing `FloatingArrowProps` export.
1 change: 1 addition & 0 deletions packages/floating-ui-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/svelte": "^5.2.6",
"@testing-library/user-event": "^14.5.2",
"csstype": "^3.1.3",
"svelte": "^5.16.0",
"typescript": "^5.7.2",
"vite": "^6.0.6",
Expand Down
54 changes: 53 additions & 1 deletion packages/floating-ui-svelte/src/components/floating-arrow.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,61 @@
<script lang="ts" module>
import type { SVGAttributes } from "svelte/elements";
import type { FloatingContext } from "../../src/index.js";
export interface FloatingArrowProps extends SVGAttributes<SVGElement> {
/** The bound HTML element reference. */
ref: Element | null;
/** The floating context. */
context: FloatingContext;
/**
* Width of the arrow.
* @default 14
*/
width?: number;
/**
* Height of the arrow.
* @default 7
*/
height?: number;
/**
* The corner radius (rounding) of the arrow tip.
* @default 0 (sharp)
*/
tipRadius?: number;
/**
* Forces a static offset over dynamic positioning under a certain condition.
* @default undefined (use dynamic position)
*/
staticOffset?: string | number | null;
/**
* Custom path string.
* @default undefined (use dynamic path)
*/
d?: string;
/**
* Stroke (border) color of the arrow.
* @default "none"
*/
stroke?: string;
/**
* Stroke (border) width of the arrow.
* @default 0
*/
strokeWidth?: number;
// Styling ---
/** Set transform styles. */
transform?: string;
/** Set fill styles. */
fill?: string;
}
</script>

<script lang="ts">
import type { Alignment, Side } from "@floating-ui/dom";
import { platform } from "@floating-ui/dom";
import { useId } from "../hooks/use-id.js";
import { styleObjectToString } from "../internal/style-object-to-string.js";
import type { FloatingArrowProps } from "../internal/types.js";
let {
ref = $bindable(null),
Expand Down
1 change: 1 addition & 0 deletions packages/floating-ui-svelte/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "@floating-ui/dom";
export * from "./components/floating-arrow.svelte";
export { default as FloatingArrow } from "./components/floating-arrow.svelte";
export * from "./hooks/use-click.svelte.js";
export * from "./hooks/use-dismiss.svelte.js";
Expand Down
7 changes: 2 additions & 5 deletions packages/floating-ui-svelte/test/hooks/use-floating.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import {
offset,
} from "@floating-ui/dom";
import { describe, expect, expectTypeOf, it, vi } from "vitest";
import {
type FloatingContext,
useFloating,
} from "../../src/hooks/use-floating.svelte.js";
import { useId } from "../../src/hooks/use-id.js";
import { type FloatingContext, useFloating } from "../../src/index.js";
import { useId } from "../../src/index.js";
import { withRunes } from "../internal/with-runes.svelte.js";

function createElements(): { reference: HTMLElement; floating: HTMLElement } {
Expand Down
2 changes: 1 addition & 1 deletion packages/floating-ui-svelte/test/hooks/use-id.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, expectTypeOf, test } from "vitest";
import { useId } from "../../src/hooks/use-id.js";
import { useId } from "../../src/index.js";

describe("useId", () => {
test("returns an id", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import {
type ElementProps,
useInteractions,
} from "../../src/hooks/use-interactions.svelte.js";
import { type ElementProps, useInteractions } from "../../src/index.js";
import { withRunes } from "../internal/with-runes.svelte";

describe("useInteractions", () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/floating-ui-svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"sourceMap": true,
"strict": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
}
"moduleResolution": "NodeNext",
"types": ["svelte"]
},
"include": ["src", "test"]
}
3 changes: 0 additions & 3 deletions packages/floating-ui-svelte/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ export default defineConfig({
include: ["./test/{hooks, components}/*.ts"],
setupFiles: ["./test/internal/setup.ts"],
environment: "jsdom",
coverage: {
reporter: ["text"],
},
},
});
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f32dd0d

Please sign in to comment.