bits-ui 2.11.6 → 2.11.8

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.
Files changed (30) hide show
  1. package/dist/bits/accordion/components/accordion.svelte.d.ts +1 -1
  2. package/dist/bits/calendar/components/calendar.svelte.d.ts +1 -1
  3. package/dist/bits/checkbox/components/checkbox-group.svelte.d.ts +1 -1
  4. package/dist/bits/checkbox/components/checkbox.svelte.d.ts +1 -1
  5. package/dist/bits/command/command.svelte.js +5 -2
  6. package/dist/bits/command/components/command-input.svelte.d.ts +1 -1
  7. package/dist/bits/command/components/command.svelte.d.ts +1 -1
  8. package/dist/bits/date-range-field/components/date-range-field.svelte.d.ts +1 -1
  9. package/dist/bits/date-range-picker/components/date-range-picker.svelte.d.ts +1 -1
  10. package/dist/bits/menu/components/menu-checkbox-group.svelte.d.ts +1 -1
  11. package/dist/bits/menu/components/menu-checkbox-item.svelte.d.ts +1 -1
  12. package/dist/bits/menu/components/menu-radio-group.svelte.d.ts +1 -1
  13. package/dist/bits/menu/menu.svelte.d.ts +1 -0
  14. package/dist/bits/menu/menu.svelte.js +1 -10
  15. package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte.d.ts +1 -1
  16. package/dist/bits/navigation-menu/components/navigation-menu.svelte.d.ts +1 -1
  17. package/dist/bits/pin-input/components/pin-input.svelte.d.ts +1 -1
  18. package/dist/bits/radio-group/components/radio-group.svelte.d.ts +1 -1
  19. package/dist/bits/range-calendar/components/range-calendar.svelte.d.ts +1 -1
  20. package/dist/bits/rating-group/components/rating-group.svelte.d.ts +1 -1
  21. package/dist/bits/select/select.svelte.d.ts +2 -2
  22. package/dist/bits/select/select.svelte.js +43 -34
  23. package/dist/bits/slider/components/slider.svelte.d.ts +1 -1
  24. package/dist/bits/switch/components/switch.svelte.d.ts +1 -1
  25. package/dist/bits/tabs/components/tabs.svelte.d.ts +1 -1
  26. package/dist/bits/time-range-field/components/time-range-field.svelte.d.ts +1 -1
  27. package/dist/bits/toggle-group/components/toggle-group.svelte.d.ts +1 -1
  28. package/dist/bits/toolbar/components/toolbar-group.svelte.d.ts +1 -1
  29. package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +9 -4
  30. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
1
  import type { AccordionRootProps } from "../types.js";
2
- declare const Accordion: import("svelte").Component<AccordionRootProps, {}, "ref" | "value">;
2
+ declare const Accordion: import("svelte").Component<AccordionRootProps, {}, "value" | "ref">;
3
3
  type Accordion = ReturnType<typeof Accordion>;
4
4
  export default Accordion;
@@ -1,4 +1,4 @@
1
1
  import type { CalendarRootProps } from "../types.js";
2
- declare const Calendar: import("svelte").Component<CalendarRootProps, {}, "ref" | "value" | "placeholder">;
2
+ declare const Calendar: import("svelte").Component<CalendarRootProps, {}, "value" | "placeholder" | "ref">;
3
3
  type Calendar = ReturnType<typeof Calendar>;
4
4
  export default Calendar;
@@ -1,4 +1,4 @@
1
1
  import type { CheckboxGroupProps } from "../types.js";
2
- declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "ref" | "value">;
2
+ declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "value" | "ref">;
3
3
  type CheckboxGroup = ReturnType<typeof CheckboxGroup>;
4
4
  export default CheckboxGroup;
@@ -1,4 +1,4 @@
1
1
  import type { CheckboxRootProps } from "../types.js";
2
- declare const Checkbox: import("svelte").Component<CheckboxRootProps, {}, "ref" | "checked" | "indeterminate">;
2
+ declare const Checkbox: import("svelte").Component<CheckboxRootProps, {}, "checked" | "indeterminate" | "ref">;
3
3
  type Checkbox = ReturnType<typeof Checkbox>;
4
4
  export default Checkbox;
@@ -129,8 +129,11 @@ export class CommandRootState {
129
129
  */
130
130
  #sort() {
131
131
  if (!this._commandState.search || this.opts.shouldFilter.current === false) {
132
- // If no search and no selection yet, select first item
133
- this.#selectFirstItem();
132
+ // if no search and no initial value set or when clearing search,
133
+ // we select the first item.
134
+ if (!this._commandState.value || !this.#isInitialMount) {
135
+ this.#selectFirstItem();
136
+ }
134
137
  return;
135
138
  }
136
139
  const scores = this._commandState.filtered.items;
@@ -1,4 +1,4 @@
1
1
  import type { CommandInputProps } from "../types.js";
2
- declare const CommandInput: import("svelte").Component<CommandInputProps, {}, "ref" | "value">;
2
+ declare const CommandInput: import("svelte").Component<CommandInputProps, {}, "value" | "ref">;
3
3
  type CommandInput = ReturnType<typeof CommandInput>;
4
4
  export default CommandInput;
@@ -54,6 +54,6 @@ declare const Command: import("svelte").Component<CommandRootProps, {
54
54
  * @returns Array of valid item elements
55
55
  * @remarks Exposed for direct item access and bound checking
56
56
  */ getValidItems: () => HTMLElement[];
57
- }, "ref" | "value">;
57
+ }, "value" | "ref">;
58
58
  type Command = ReturnType<typeof Command>;
59
59
  export default Command;
@@ -1,4 +1,4 @@
1
1
  import type { DateRangeFieldRootProps } from "../types.js";
2
- declare const DateRangeField: import("svelte").Component<DateRangeFieldRootProps, {}, "ref" | "value" | "placeholder">;
2
+ declare const DateRangeField: import("svelte").Component<DateRangeFieldRootProps, {}, "value" | "placeholder" | "ref">;
3
3
  type DateRangeField = ReturnType<typeof DateRangeField>;
4
4
  export default DateRangeField;
@@ -1,4 +1,4 @@
1
1
  import type { DateRangePickerRootProps } from "../types.js";
2
- declare const DateRangePicker: import("svelte").Component<DateRangePickerRootProps, {}, "ref" | "value" | "placeholder" | "open">;
2
+ declare const DateRangePicker: import("svelte").Component<DateRangePickerRootProps, {}, "value" | "placeholder" | "ref" | "open">;
3
3
  type DateRangePicker = ReturnType<typeof DateRangePicker>;
4
4
  export default DateRangePicker;
@@ -1,4 +1,4 @@
1
1
  import type { MenuCheckboxGroupProps } from "../types.js";
2
- declare const MenuCheckboxGroup: import("svelte").Component<MenuCheckboxGroupProps, {}, "ref" | "value">;
2
+ declare const MenuCheckboxGroup: import("svelte").Component<MenuCheckboxGroupProps, {}, "value" | "ref">;
3
3
  type MenuCheckboxGroup = ReturnType<typeof MenuCheckboxGroup>;
4
4
  export default MenuCheckboxGroup;
@@ -1,4 +1,4 @@
1
1
  import type { MenuCheckboxItemProps } from "../types.js";
2
- declare const MenuCheckboxItem: import("svelte").Component<MenuCheckboxItemProps, {}, "ref" | "checked" | "indeterminate">;
2
+ declare const MenuCheckboxItem: import("svelte").Component<MenuCheckboxItemProps, {}, "checked" | "indeterminate" | "ref">;
3
3
  type MenuCheckboxItem = ReturnType<typeof MenuCheckboxItem>;
4
4
  export default MenuCheckboxItem;
@@ -1,4 +1,4 @@
1
1
  import type { MenuRadioGroupProps } from "../types.js";
2
- declare const MenuRadioGroup: import("svelte").Component<MenuRadioGroupProps, {}, "ref" | "value">;
2
+ declare const MenuRadioGroup: import("svelte").Component<MenuRadioGroupProps, {}, "value" | "ref">;
3
3
  type MenuRadioGroup = ReturnType<typeof MenuRadioGroup>;
4
4
  export default MenuRadioGroup;
@@ -7,6 +7,7 @@ import { IsUsingKeyboard } from "../../index.js";
7
7
  import type { KeyboardEventHandler, PointerEventHandler, MouseEventHandler } from "svelte/elements";
8
8
  import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
9
9
  export declare const CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
10
+ export declare const CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
10
11
  export declare const MenuCheckboxGroupContext: Context<MenuCheckboxGroupState>;
11
12
  type MenuVariant = "context-menu" | "dropdown-menu" | "menubar";
12
13
  export interface MenuRootStateOpts extends ReadableBoxedValues<{
@@ -13,8 +13,8 @@ import { DOMTypeahead } from "../../internal/dom-typeahead.svelte.js";
13
13
  import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
14
14
  import { GraceArea } from "../../internal/grace-area.svelte.js";
15
15
  import { OpenChangeComplete } from "../../internal/open-change-complete.js";
16
- import { getTopMostDismissableLayer } from "../utilities/dismissible-layer/use-dismissable-layer.svelte.js";
17
16
  export const CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
17
+ export const CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
18
18
  const MenuRootContext = new Context("Menu.Root");
19
19
  const MenuMenuContext = new Context("Menu.Root | Menu.Sub");
20
20
  const MenuContentContext = new Context("Menu.Content");
@@ -875,15 +875,6 @@ export class ContextMenuTriggerState {
875
875
  oncontextmenu(e) {
876
876
  if (e.defaultPrevented || this.opts.disabled.current)
877
877
  return;
878
- const topMostLayer = getTopMostDismissableLayer();
879
- if (topMostLayer) {
880
- const topLayerRef = topMostLayer[0].opts.ref.current;
881
- const topLayerRefContainsTrigger = topLayerRef?.contains(this.opts.ref.current);
882
- if (!topLayerRefContainsTrigger &&
883
- !topLayerRef?.hasAttribute?.("data-context-menu-content")) {
884
- return;
885
- }
886
- }
887
878
  this.#clearLongPressTimer();
888
879
  this.#handleOpen(e);
889
880
  e.preventDefault();
@@ -1,4 +1,4 @@
1
1
  import type { NavigationMenuSubProps } from "../types.js";
2
- declare const NavigationMenuSub: import("svelte").Component<NavigationMenuSubProps, {}, "ref" | "value">;
2
+ declare const NavigationMenuSub: import("svelte").Component<NavigationMenuSubProps, {}, "value" | "ref">;
3
3
  type NavigationMenuSub = ReturnType<typeof NavigationMenuSub>;
4
4
  export default NavigationMenuSub;
@@ -1,4 +1,4 @@
1
1
  import type { NavigationMenuRootProps } from "../types.js";
2
- declare const NavigationMenu: import("svelte").Component<NavigationMenuRootProps, {}, "ref" | "value">;
2
+ declare const NavigationMenu: import("svelte").Component<NavigationMenuRootProps, {}, "value" | "ref">;
3
3
  type NavigationMenu = ReturnType<typeof NavigationMenu>;
4
4
  export default NavigationMenu;
@@ -1,4 +1,4 @@
1
1
  import type { PinInputRootProps } from "../types.js";
2
- declare const PinInput: import("svelte").Component<PinInputRootProps, {}, "ref" | "value">;
2
+ declare const PinInput: import("svelte").Component<PinInputRootProps, {}, "value" | "ref">;
3
3
  type PinInput = ReturnType<typeof PinInput>;
4
4
  export default PinInput;
@@ -1,4 +1,4 @@
1
1
  import type { RadioGroupRootProps } from "../types.js";
2
- declare const RadioGroup: import("svelte").Component<RadioGroupRootProps, {}, "ref" | "value">;
2
+ declare const RadioGroup: import("svelte").Component<RadioGroupRootProps, {}, "value" | "ref">;
3
3
  type RadioGroup = ReturnType<typeof RadioGroup>;
4
4
  export default RadioGroup;
@@ -1,4 +1,4 @@
1
1
  import type { RangeCalendarRootProps } from "../types.js";
2
- declare const RangeCalendar: import("svelte").Component<RangeCalendarRootProps, {}, "ref" | "value" | "placeholder">;
2
+ declare const RangeCalendar: import("svelte").Component<RangeCalendarRootProps, {}, "value" | "placeholder" | "ref">;
3
3
  type RangeCalendar = ReturnType<typeof RangeCalendar>;
4
4
  export default RangeCalendar;
@@ -1,4 +1,4 @@
1
1
  import type { RatingGroupRootProps } from "../types.js";
2
- declare const RatingGroup: import("svelte").Component<RatingGroupRootProps, {}, "ref" | "value">;
2
+ declare const RatingGroup: import("svelte").Component<RatingGroupRootProps, {}, "value" | "ref">;
3
3
  type RatingGroup = ReturnType<typeof RatingGroup>;
4
4
  export default RatingGroup;
@@ -32,6 +32,7 @@ declare abstract class SelectBaseRootState {
32
32
  touchedInput: boolean;
33
33
  inputNode: HTMLElement | null;
34
34
  contentNode: HTMLElement | null;
35
+ viewportNode: HTMLElement | null;
35
36
  triggerNode: HTMLElement | null;
36
37
  valueId: string;
37
38
  highlightedNode: HTMLElement | null;
@@ -44,7 +45,7 @@ declare abstract class SelectBaseRootState {
44
45
  constructor(opts: SelectBaseRootStateOpts);
45
46
  setHighlightedNode(node: HTMLElement | null, initial?: boolean): void;
46
47
  getCandidateNodes(): HTMLElement[];
47
- setHighlightedToFirstCandidate(): void;
48
+ setHighlightedToFirstCandidate(initial?: boolean): void;
48
49
  getNodeByValue(value: string): HTMLElement | null;
49
50
  setOpen(open: boolean): void;
50
51
  toggleOpen(): void;
@@ -195,7 +196,6 @@ export declare class SelectContentState {
195
196
  readonly opts: SelectContentStateOpts;
196
197
  readonly root: SelectRoot;
197
198
  readonly attachment: RefAttachment;
198
- viewportNode: HTMLElement | null;
199
199
  isPositioned: boolean;
200
200
  domContext: DOMContext;
201
201
  constructor(opts: SelectContentStateOpts, root: SelectRoot);
@@ -45,6 +45,7 @@ class SelectBaseRootState {
45
45
  touchedInput = $state(false);
46
46
  inputNode = $state(null);
47
47
  contentNode = $state(null);
48
+ viewportNode = $state(null);
48
49
  triggerNode = $state(null);
49
50
  valueId = $state("");
50
51
  highlightedNode = $state(null);
@@ -94,12 +95,26 @@ class SelectBaseRootState {
94
95
  return [];
95
96
  return Array.from(node.querySelectorAll(`[${this.getBitsAttr("item")}]:not([data-disabled])`));
96
97
  }
97
- setHighlightedToFirstCandidate() {
98
+ setHighlightedToFirstCandidate(initial = false) {
98
99
  this.setHighlightedNode(null);
99
- const candidateNodes = this.getCandidateNodes();
100
- if (!candidateNodes.length)
100
+ let nodes = this.getCandidateNodes();
101
+ if (!nodes.length)
101
102
  return;
102
- this.setHighlightedNode(candidateNodes[0]);
103
+ // don't consider nodes that aren't visible within the viewport
104
+ if (this.viewportNode) {
105
+ const viewportRect = this.viewportNode.getBoundingClientRect();
106
+ nodes = nodes.filter((node) => {
107
+ if (!this.viewportNode)
108
+ return false;
109
+ const nodeRect = node.getBoundingClientRect();
110
+ const isNodeFullyVisible = nodeRect.right < viewportRect.right &&
111
+ nodeRect.left > viewportRect.left &&
112
+ nodeRect.bottom < viewportRect.bottom &&
113
+ nodeRect.top > viewportRect.top;
114
+ return isNodeFullyVisible;
115
+ });
116
+ }
117
+ this.setHighlightedNode(nodes[0], initial);
103
118
  }
104
119
  getNodeByValue(value) {
105
120
  const candidateNodes = this.getCandidateNodes();
@@ -185,10 +200,7 @@ export class SelectSingleRootState extends SelectBaseRootState {
185
200
  }
186
201
  }
187
202
  // if no value is set, we want to highlight the first item
188
- const firstCandidate = this.getCandidateNodes()[0];
189
- if (!firstCandidate)
190
- return;
191
- this.setHighlightedNode(firstCandidate, true);
203
+ this.setHighlightedToFirstCandidate(true);
192
204
  });
193
205
  }
194
206
  }
@@ -237,10 +249,7 @@ class SelectMultipleRootState extends SelectBaseRootState {
237
249
  }
238
250
  }
239
251
  // if no value is set, we want to highlight the first item
240
- const firstCandidate = this.getCandidateNodes()[0];
241
- if (!firstCandidate)
242
- return;
243
- this.setHighlightedNode(firstCandidate, true);
252
+ this.setHighlightedToFirstCandidate(true);
244
253
  });
245
254
  }
246
255
  }
@@ -691,7 +700,6 @@ export class SelectContentState {
691
700
  opts;
692
701
  root;
693
702
  attachment;
694
- viewportNode = $state(null);
695
703
  isPositioned = $state(false);
696
704
  domContext;
697
705
  constructor(opts, root) {
@@ -976,7 +984,9 @@ export class SelectViewportState {
976
984
  this.opts = opts;
977
985
  this.content = content;
978
986
  this.root = content.root;
979
- this.attachment = attachRef(opts.ref, (v) => (this.content.viewportNode = v));
987
+ this.attachment = attachRef(opts.ref, (v) => {
988
+ this.root.viewportNode = v;
989
+ });
980
990
  }
981
991
  props = $derived.by(() => ({
982
992
  id: this.opts.id.current,
@@ -1079,11 +1089,11 @@ export class SelectScrollDownButtonState {
1079
1089
  this.content = scrollButtonState.content;
1080
1090
  this.root = scrollButtonState.root;
1081
1091
  this.scrollButtonState.onAutoScroll = this.handleAutoScroll;
1082
- watch([() => this.content.viewportNode, () => this.content.isPositioned], () => {
1083
- if (!this.content.viewportNode || !this.content.isPositioned)
1092
+ watch([() => this.root.viewportNode, () => this.content.isPositioned], () => {
1093
+ if (!this.root.viewportNode || !this.content.isPositioned)
1084
1094
  return;
1085
1095
  this.handleScroll(true);
1086
- return on(this.content.viewportNode, "scroll", () => this.handleScroll());
1096
+ return on(this.root.viewportNode, "scroll", () => this.handleScroll());
1087
1097
  });
1088
1098
  /**
1089
1099
  * If the input value changes, this means that the filtered items may have changed,
@@ -1091,10 +1101,10 @@ export class SelectScrollDownButtonState {
1091
1101
  */
1092
1102
  watch([
1093
1103
  () => this.root.opts.inputValue.current,
1094
- () => this.content.viewportNode,
1104
+ () => this.root.viewportNode,
1095
1105
  () => this.content.isPositioned,
1096
1106
  ], () => {
1097
- if (!this.content.viewportNode || !this.content.isPositioned)
1107
+ if (!this.root.viewportNode || !this.content.isPositioned)
1098
1108
  return;
1099
1109
  this.handleScroll(true);
1100
1110
  });
@@ -1118,15 +1128,14 @@ export class SelectScrollDownButtonState {
1118
1128
  if (!manual) {
1119
1129
  this.scrollButtonState.handleUserScroll();
1120
1130
  }
1121
- if (!this.content.viewportNode)
1131
+ if (!this.root.viewportNode)
1122
1132
  return;
1123
- const maxScroll = this.content.viewportNode.scrollHeight - this.content.viewportNode.clientHeight;
1124
- const paddingTop = Number.parseInt(getComputedStyle(this.content.viewportNode).paddingTop, 10);
1125
- this.canScrollDown =
1126
- Math.ceil(this.content.viewportNode.scrollTop) < maxScroll - paddingTop;
1133
+ const maxScroll = this.root.viewportNode.scrollHeight - this.root.viewportNode.clientHeight;
1134
+ const paddingTop = Number.parseInt(getComputedStyle(this.root.viewportNode).paddingTop, 10);
1135
+ this.canScrollDown = Math.ceil(this.root.viewportNode.scrollTop) < maxScroll - paddingTop;
1127
1136
  };
1128
1137
  handleAutoScroll = () => {
1129
- const viewport = this.content.viewportNode;
1138
+ const viewport = this.root.viewportNode;
1130
1139
  const selectedItem = this.root.highlightedNode;
1131
1140
  if (!viewport || !selectedItem)
1132
1141
  return;
@@ -1150,11 +1159,11 @@ export class SelectScrollUpButtonState {
1150
1159
  this.content = scrollButtonState.content;
1151
1160
  this.root = scrollButtonState.root;
1152
1161
  this.scrollButtonState.onAutoScroll = this.handleAutoScroll;
1153
- watch([() => this.content.viewportNode, () => this.content.isPositioned], () => {
1154
- if (!this.content.viewportNode || !this.content.isPositioned)
1162
+ watch([() => this.root.viewportNode, () => this.content.isPositioned], () => {
1163
+ if (!this.root.viewportNode || !this.content.isPositioned)
1155
1164
  return;
1156
1165
  this.handleScroll(true);
1157
- return on(this.content.viewportNode, "scroll", () => this.handleScroll());
1166
+ return on(this.root.viewportNode, "scroll", () => this.handleScroll());
1158
1167
  });
1159
1168
  }
1160
1169
  /**
@@ -1165,16 +1174,16 @@ export class SelectScrollUpButtonState {
1165
1174
  if (!manual) {
1166
1175
  this.scrollButtonState.handleUserScroll();
1167
1176
  }
1168
- if (!this.content.viewportNode)
1177
+ if (!this.root.viewportNode)
1169
1178
  return;
1170
- const paddingTop = Number.parseInt(getComputedStyle(this.content.viewportNode).paddingTop, 10);
1171
- this.canScrollUp = this.content.viewportNode.scrollTop - paddingTop > 0.1;
1179
+ const paddingTop = Number.parseInt(getComputedStyle(this.root.viewportNode).paddingTop, 10);
1180
+ this.canScrollUp = this.root.viewportNode.scrollTop - paddingTop > 0.1;
1172
1181
  };
1173
1182
  handleAutoScroll = () => {
1174
- if (!this.content.viewportNode || !this.root.highlightedNode)
1183
+ if (!this.root.viewportNode || !this.root.highlightedNode)
1175
1184
  return;
1176
- this.content.viewportNode.scrollTop =
1177
- this.content.viewportNode.scrollTop - this.root.highlightedNode.offsetHeight;
1185
+ this.root.viewportNode.scrollTop =
1186
+ this.root.viewportNode.scrollTop - this.root.highlightedNode.offsetHeight;
1178
1187
  };
1179
1188
  props = $derived.by(() => ({
1180
1189
  ...this.scrollButtonState.props,
@@ -1,4 +1,4 @@
1
1
  import type { SliderRootProps } from "../types.js";
2
- declare const Slider: import("svelte").Component<SliderRootProps, {}, "ref" | "value">;
2
+ declare const Slider: import("svelte").Component<SliderRootProps, {}, "value" | "ref">;
3
3
  type Slider = ReturnType<typeof Slider>;
4
4
  export default Slider;
@@ -1,4 +1,4 @@
1
1
  import type { SwitchRootProps } from "../types.js";
2
- declare const Switch: import("svelte").Component<SwitchRootProps, {}, "ref" | "checked">;
2
+ declare const Switch: import("svelte").Component<SwitchRootProps, {}, "checked" | "ref">;
3
3
  type Switch = ReturnType<typeof Switch>;
4
4
  export default Switch;
@@ -1,4 +1,4 @@
1
1
  import type { TabsRootProps } from "../types.js";
2
- declare const Tabs: import("svelte").Component<TabsRootProps, {}, "ref" | "value">;
2
+ declare const Tabs: import("svelte").Component<TabsRootProps, {}, "value" | "ref">;
3
3
  type Tabs = ReturnType<typeof Tabs>;
4
4
  export default Tabs;
@@ -5,7 +5,7 @@ declare class __sveltets_Render<T extends TimeValue = Time> {
5
5
  props(): TimeRangeFieldRootProps<T>;
6
6
  events(): {};
7
7
  slots(): {};
8
- bindings(): "ref" | "value" | "placeholder";
8
+ bindings(): "value" | "placeholder" | "ref";
9
9
  exports(): {};
10
10
  }
11
11
  interface $$IsomorphicComponent {
@@ -1,4 +1,4 @@
1
1
  import type { ToggleGroupRootProps } from "../types.js";
2
- declare const ToggleGroup: import("svelte").Component<ToggleGroupRootProps, {}, "ref" | "value">;
2
+ declare const ToggleGroup: import("svelte").Component<ToggleGroupRootProps, {}, "value" | "ref">;
3
3
  type ToggleGroup = ReturnType<typeof ToggleGroup>;
4
4
  export default ToggleGroup;
@@ -1,4 +1,4 @@
1
1
  import type { ToolbarGroupProps } from "../types.js";
2
- declare const ToolbarGroup: import("svelte").Component<ToolbarGroupProps, {}, "ref" | "value">;
2
+ declare const ToolbarGroup: import("svelte").Component<ToolbarGroupProps, {}, "value" | "ref">;
3
3
  type ToolbarGroup = ReturnType<typeof ToolbarGroup>;
4
4
  export default ToolbarGroup;
@@ -5,8 +5,9 @@ import {} from "../../../internal/events.js";
5
5
  import { debounce } from "../../../internal/debounce.js";
6
6
  import { noop } from "../../../internal/noop.js";
7
7
  import { getOwnerDocument, isOrContainsTarget } from "../../../internal/elements.js";
8
- import { isElement } from "../../../internal/is.js";
8
+ import { isElementOrSVGElement } from "../../../internal/is.js";
9
9
  import { isClickTrulyOutside } from "../../../internal/dom.js";
10
+ import { CONTEXT_MENU_CONTENT_ATTR, CONTEXT_MENU_TRIGGER_ATTR, } from "../../menu/menu.svelte.js";
10
11
  globalThis.bitsDismissableLayers ??= new Map();
11
12
  export class DismissibleLayerState {
12
13
  static create(opts) {
@@ -186,10 +187,14 @@ function isResponsibleLayer(node) {
186
187
  return firstLayerNode.opts.ref.current === node;
187
188
  }
188
189
  function isValidEvent(e, node) {
189
- if ("button" in e && e.button > 0)
190
- return false;
191
190
  const target = e.target;
192
- if (!isElement(target))
191
+ if (!isElementOrSVGElement(target))
192
+ return false;
193
+ const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`));
194
+ if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger)
195
+ return false;
196
+ const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`));
197
+ if (targetIsContextMenuTrigger && nodeIsContextMenu)
193
198
  return false;
194
199
  const ownerDocument = getOwnerDocument(target);
195
200
  const isValid = ownerDocument.documentElement.contains(target) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.11.6",
3
+ "version": "2.11.8",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",
@@ -41,8 +41,8 @@
41
41
  "@floating-ui/core": "^1.7.1",
42
42
  "@floating-ui/dom": "^1.7.1",
43
43
  "esm-env": "^1.1.2",
44
- "runed": "^0.31.1",
45
- "svelte-toolbelt": "^0.10.4",
44
+ "runed": "^0.35.1",
45
+ "svelte-toolbelt": "^0.10.6",
46
46
  "tabbable": "^6.2.0"
47
47
  },
48
48
  "peerDependencies": {