bits-ui 2.15.0 → 2.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { on } from "svelte/events";
4
4
  import { createBitsAttrs, boolToStr, getDataOpenClosed } from "../../internal/attrs.js";
5
5
  import { isElement, isFocusVisible, isTouch } from "../../internal/is.js";
6
6
  import { getTabbableCandidates } from "../../internal/focus.js";
7
- import { GraceArea } from "../../internal/grace-area.svelte.js";
7
+ import { SafePolygon } from "../../internal/safe-polygon.svelte.js";
8
8
  import { PresenceManager } from "../../internal/presence-manager.svelte.js";
9
9
  const linkPreviewAttrs = createBitsAttrs({
10
10
  component: "link-preview",
@@ -169,7 +169,7 @@ export class LinkPreviewContentState {
169
169
  this.onpointerdown = this.onpointerdown.bind(this);
170
170
  this.onpointerenter = this.onpointerenter.bind(this);
171
171
  this.onfocusout = this.onfocusout.bind(this);
172
- new GraceArea({
172
+ new SafePolygon({
173
173
  triggerNode: () => this.root.triggerNode,
174
174
  contentNode: () => this.opts.ref.current,
175
175
  enabled: () => this.root.opts.open.current,
@@ -68,6 +68,7 @@
68
68
  ref={contentState.opts.ref}
69
69
  tooltip={true}
70
70
  shouldRender={contentState.shouldRender}
71
+ contentPointerEvents={contentState.root.disableHoverableContent ? "none" : "auto"}
71
72
  >
72
73
  {#snippet popper({ props, wrapperProps })}
73
74
  {@const mergedProps = mergeProps(props, {
@@ -97,6 +98,7 @@
97
98
  ref={contentState.opts.ref}
98
99
  tooltip={true}
99
100
  shouldRender={contentState.shouldRender}
101
+ contentPointerEvents={contentState.root.disableHoverableContent ? "none" : "auto"}
100
102
  >
101
103
  {#snippet popper({ props, wrapperProps })}
102
104
  {@const mergedProps = mergeProps(props, {
@@ -109,7 +109,6 @@ export declare class TooltipContentState {
109
109
  readonly "data-state": "closed" | "delayed-open" | "instant-open";
110
110
  readonly "data-disabled": "" | undefined;
111
111
  readonly style: {
112
- readonly pointerEvents: "auto";
113
112
  readonly outline: "none";
114
113
  };
115
114
  };
@@ -4,7 +4,7 @@ import { Context, watch } from "runed";
4
4
  import { isElement, isFocusVisible } from "../../internal/is.js";
5
5
  import { createBitsAttrs, boolToEmptyStrOrUndef } from "../../internal/attrs.js";
6
6
  import { TimeoutFn } from "../../internal/timeout-fn.js";
7
- import { GraceArea } from "../../internal/grace-area.svelte.js";
7
+ import { SafePolygon } from "../../internal/safe-polygon.svelte.js";
8
8
  import { PresenceManager } from "../../internal/presence-manager.svelte.js";
9
9
  export const tooltipAttrs = createBitsAttrs({
10
10
  component: "tooltip",
@@ -279,7 +279,7 @@ export class TooltipContentState {
279
279
  this.opts = opts;
280
280
  this.root = root;
281
281
  this.attachment = attachRef(this.opts.ref, (v) => (this.root.contentNode = v));
282
- new GraceArea({
282
+ new SafePolygon({
283
283
  triggerNode: () => this.root.triggerNode,
284
284
  contentNode: () => this.root.contentNode,
285
285
  enabled: () => this.root.opts.open.current && !this.root.disableHoverableContent,
@@ -288,10 +288,6 @@ export class TooltipContentState {
288
288
  this.root.handleClose();
289
289
  }
290
290
  },
291
- setIsPointerInTransit: (value) => {
292
- this.root.provider.isPointerInTransit.current = value;
293
- },
294
- transitTimeout: this.root.provider.opts.skipDelayDuration.current,
295
291
  });
296
292
  onMountEffect(() => on(window, "scroll", (e) => {
297
293
  const target = e.target;
@@ -335,7 +331,6 @@ export class TooltipContentState {
335
331
  "data-state": this.root.stateAttr,
336
332
  "data-disabled": boolToEmptyStrOrUndef(this.root.disabled),
337
333
  style: {
338
- pointerEvents: "auto",
339
334
  outline: "none",
340
335
  },
341
336
  [tooltipAttrs.content]: "",
@@ -46,9 +46,11 @@
46
46
  enabled,
47
47
  ref,
48
48
  tooltip = false,
49
+ contentPointerEvents = "auto",
49
50
  ...restProps
50
51
  }: Omit<PopperLayerImplProps, "open" | "children" | "shouldRender"> & {
51
52
  enabled: boolean;
53
+ contentPointerEvents?: "auto" | "none";
52
54
  } = $props();
53
55
  </script>
54
56
 
@@ -118,7 +120,7 @@
118
120
  focusScopeProps,
119
121
  {
120
122
  style: {
121
- pointerEvents: "auto",
123
+ pointerEvents: contentPointerEvents,
122
124
  },
123
125
  }
124
126
  ),
@@ -1,6 +1,7 @@
1
1
  import type { PopperLayerImplProps } from "./types.js";
2
2
  type $$ComponentProps = Omit<PopperLayerImplProps, "open" | "children" | "shouldRender"> & {
3
3
  enabled: boolean;
4
+ contentPointerEvents?: "auto" | "none";
4
5
  };
5
6
  declare const PopperLayerInner: import("svelte").Component<$$ComponentProps, {}, "">;
6
7
  type PopperLayerInner = ReturnType<typeof PopperLayerInner>;
@@ -35,4 +35,9 @@ export type PopperLayerImplProps = Omit<EscapeLayerImplProps & DismissibleLayerI
35
35
  * Whether the popper layer should be rendered.
36
36
  */
37
37
  shouldRender: boolean;
38
+ /**
39
+ * Override for the content's pointer-events style.
40
+ * @default "auto"
41
+ */
42
+ contentPointerEvents?: "auto" | "none";
38
43
  }, "enabled">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",