bits-ui 2.8.11 → 2.8.13

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.
@@ -62,7 +62,7 @@ export declare class CheckboxRootState {
62
62
  readonly attachment: RefAttachment;
63
63
  constructor(opts: CheckboxRootStateOpts, group: CheckboxGroupState | null);
64
64
  onkeydown(e: BitsKeyboardEvent): void;
65
- onclick(_: BitsMouseEvent): void;
65
+ onclick(e: BitsMouseEvent): void;
66
66
  readonly snippetProps: {
67
67
  checked: boolean;
68
68
  indeterminate: boolean;
@@ -76,7 +76,7 @@ export declare class CheckboxRootState {
76
76
  readonly "aria-required": "true" | "false";
77
77
  readonly "data-disabled": "" | undefined;
78
78
  readonly "data-state": "checked" | "indeterminate" | "unchecked";
79
- readonly onclick: (_: BitsMouseEvent) => void;
79
+ readonly onclick: (e: BitsMouseEvent) => void;
80
80
  readonly onkeydown: (e: BitsKeyboardEvent) => void;
81
81
  };
82
82
  }
@@ -143,9 +143,10 @@ export class CheckboxRootState {
143
143
  this.opts.checked.current = !this.opts.checked.current;
144
144
  }
145
145
  }
146
- onclick(_) {
146
+ onclick(e) {
147
147
  if (this.opts.disabled.current)
148
148
  return;
149
+ e.preventDefault();
149
150
  this.#toggle();
150
151
  }
151
152
  snippetProps = $derived.by(() => ({
@@ -177,7 +177,7 @@ export class MenuContentState {
177
177
  return this.parentMenu.root.isPointerInTransit;
178
178
  }
179
179
  onCloseAutoFocus = (e) => {
180
- this.opts.onCloseAutoFocus.current(e);
180
+ this.opts.onCloseAutoFocus.current?.(e);
181
181
  if (e.defaultPrevented || this.#isSub)
182
182
  return;
183
183
  if (this.parentMenu.triggerNode && isTabbable(this.parentMenu.triggerNode)) {
@@ -226,7 +226,7 @@ export class MenubarContentState {
226
226
  this.attachment = attachRef(this.opts.ref, (v) => (this.menu.contentNode = v));
227
227
  }
228
228
  onCloseAutoFocus = (e) => {
229
- this.opts.onCloseAutoFocus.current(e);
229
+ this.opts.onCloseAutoFocus.current?.(e);
230
230
  if (e.defaultPrevented)
231
231
  return;
232
232
  };
@@ -114,7 +114,7 @@ export class PopoverContentState {
114
114
  this.root.handleClose();
115
115
  };
116
116
  onCloseAutoFocus = (e) => {
117
- this.opts.onCloseAutoFocus.current(e);
117
+ this.opts.onCloseAutoFocus.current?.(e);
118
118
  if (e.defaultPrevented)
119
119
  return;
120
120
  e.preventDefault();
@@ -73,7 +73,7 @@ export class FocusScope {
73
73
  bubbles: false,
74
74
  cancelable: true,
75
75
  });
76
- this.#opts.onCloseAutoFocus.current(event);
76
+ this.#opts.onCloseAutoFocus.current?.(event);
77
77
  if (!event.defaultPrevented) {
78
78
  // return focus to previously focused element
79
79
  const prevFocused = document.activeElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.8.11",
3
+ "version": "2.8.13",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",