@primer/behaviors 0.0.0-20251201144839 → 0.0.0-20251201223248

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.
@@ -27,7 +27,6 @@ export type FocusZoneSettings = IterateFocusableElements & {
27
27
  onActiveDescendantChanged?: (newActiveDescendant: HTMLElement | undefined, previousActiveDescendant: HTMLElement | undefined, directlyActivated: boolean) => void;
28
28
  focusInStrategy?: 'first' | 'closest' | 'previous' | ((previousFocusedElement: Element) => HTMLElement | undefined);
29
29
  preventScroll?: boolean;
30
- ignoreHoverEvents?: boolean;
31
30
  };
32
31
  export declare const isActiveDescendantAttribute = "data-is-active-descendant";
33
32
  export declare const activeDescendantActivatedDirectly = "activated-directly";
@@ -129,7 +129,7 @@ const activeDescendantActivatedDirectly = 'activated-directly';
129
129
  const activeDescendantActivatedIndirectly = 'activated-indirectly';
130
130
  const hasActiveDescendantAttribute = 'data-has-active-descendant';
131
131
  function focusZone(container, settings) {
132
- var _a, _b, _c, _d, _e, _f;
132
+ var _a, _b, _c, _d, _e;
133
133
  const focusableElements = [];
134
134
  const savedTabIndex = new WeakMap();
135
135
  const bindKeys = (_a = settings === null || settings === void 0 ? void 0 : settings.bindKeys) !== null && _a !== void 0 ? _a : ((settings === null || settings === void 0 ? void 0 : settings.getNextFocusable) ? exports.FocusKeys.ArrowAll : exports.FocusKeys.ArrowVertical) | exports.FocusKeys.HomeAndEnd;
@@ -137,9 +137,8 @@ function focusZone(container, settings) {
137
137
  const focusInStrategy = (_c = settings === null || settings === void 0 ? void 0 : settings.focusInStrategy) !== null && _c !== void 0 ? _c : 'previous';
138
138
  const activeDescendantControl = settings === null || settings === void 0 ? void 0 : settings.activeDescendantControl;
139
139
  const activeDescendantCallback = settings === null || settings === void 0 ? void 0 : settings.onActiveDescendantChanged;
140
- const ignoreHoverEvents = (_d = settings === null || settings === void 0 ? void 0 : settings.ignoreHoverEvents) !== null && _d !== void 0 ? _d : true;
141
140
  let currentFocusedElement;
142
- const preventScroll = (_e = settings === null || settings === void 0 ? void 0 : settings.preventScroll) !== null && _e !== void 0 ? _e : false;
141
+ const preventScroll = (_d = settings === null || settings === void 0 ? void 0 : settings.preventScroll) !== null && _d !== void 0 ? _d : false;
143
142
  function getFirstFocusableElement() {
144
143
  return focusableElements[0];
145
144
  }
@@ -291,7 +290,7 @@ function focusZone(container, settings) {
291
290
  attributeOldValue: true,
292
291
  });
293
292
  const controller = new AbortController();
294
- const signal = (_f = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _f !== void 0 ? _f : controller.signal;
293
+ const signal = (_e = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _e !== void 0 ? _e : controller.signal;
295
294
  signal.addEventListener('abort', () => {
296
295
  endFocusManagement(...focusableElements);
297
296
  });
@@ -308,17 +307,15 @@ function focusZone(container, settings) {
308
307
  updateFocusedElement(event.target);
309
308
  }
310
309
  }, { signal });
311
- if (ignoreHoverEvents) {
312
- container.addEventListener('mousemove', ({ target }) => {
313
- if (!(target instanceof Node)) {
314
- return;
315
- }
316
- const focusableElement = focusableElements.find(element => element.contains(target));
317
- if (focusableElement) {
318
- updateFocusedElement(focusableElement);
319
- }
320
- }, { signal, capture: true });
321
- }
310
+ container.addEventListener('mousemove', ({ target }) => {
311
+ if (!(target instanceof Node)) {
312
+ return;
313
+ }
314
+ const focusableElement = focusableElements.find(element => element.contains(target));
315
+ if (focusableElement) {
316
+ updateFocusedElement(focusableElement);
317
+ }
318
+ }, { signal, capture: true });
322
319
  activeDescendantControl.addEventListener('focusin', () => {
323
320
  if (!currentFocusedElement) {
324
321
  updateFocusedElement(getFirstFocusableElement());
@@ -27,7 +27,6 @@ export type FocusZoneSettings = IterateFocusableElements & {
27
27
  onActiveDescendantChanged?: (newActiveDescendant: HTMLElement | undefined, previousActiveDescendant: HTMLElement | undefined, directlyActivated: boolean) => void;
28
28
  focusInStrategy?: 'first' | 'closest' | 'previous' | ((previousFocusedElement: Element) => HTMLElement | undefined);
29
29
  preventScroll?: boolean;
30
- ignoreHoverEvents?: boolean;
31
30
  };
32
31
  export declare const isActiveDescendantAttribute = "data-is-active-descendant";
33
32
  export declare const activeDescendantActivatedDirectly = "activated-directly";
@@ -127,7 +127,7 @@ const activeDescendantActivatedDirectly = 'activated-directly';
127
127
  const activeDescendantActivatedIndirectly = 'activated-indirectly';
128
128
  const hasActiveDescendantAttribute = 'data-has-active-descendant';
129
129
  function focusZone(container, settings) {
130
- var _a, _b, _c, _d, _e, _f;
130
+ var _a, _b, _c, _d, _e;
131
131
  const focusableElements = [];
132
132
  const savedTabIndex = new WeakMap();
133
133
  const bindKeys = (_a = settings === null || settings === void 0 ? void 0 : settings.bindKeys) !== null && _a !== void 0 ? _a : ((settings === null || settings === void 0 ? void 0 : settings.getNextFocusable) ? FocusKeys.ArrowAll : FocusKeys.ArrowVertical) | FocusKeys.HomeAndEnd;
@@ -135,9 +135,8 @@ function focusZone(container, settings) {
135
135
  const focusInStrategy = (_c = settings === null || settings === void 0 ? void 0 : settings.focusInStrategy) !== null && _c !== void 0 ? _c : 'previous';
136
136
  const activeDescendantControl = settings === null || settings === void 0 ? void 0 : settings.activeDescendantControl;
137
137
  const activeDescendantCallback = settings === null || settings === void 0 ? void 0 : settings.onActiveDescendantChanged;
138
- const ignoreHoverEvents = (_d = settings === null || settings === void 0 ? void 0 : settings.ignoreHoverEvents) !== null && _d !== void 0 ? _d : true;
139
138
  let currentFocusedElement;
140
- const preventScroll = (_e = settings === null || settings === void 0 ? void 0 : settings.preventScroll) !== null && _e !== void 0 ? _e : false;
139
+ const preventScroll = (_d = settings === null || settings === void 0 ? void 0 : settings.preventScroll) !== null && _d !== void 0 ? _d : false;
141
140
  function getFirstFocusableElement() {
142
141
  return focusableElements[0];
143
142
  }
@@ -289,7 +288,7 @@ function focusZone(container, settings) {
289
288
  attributeOldValue: true,
290
289
  });
291
290
  const controller = new AbortController();
292
- const signal = (_f = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _f !== void 0 ? _f : controller.signal;
291
+ const signal = (_e = settings === null || settings === void 0 ? void 0 : settings.abortSignal) !== null && _e !== void 0 ? _e : controller.signal;
293
292
  signal.addEventListener('abort', () => {
294
293
  endFocusManagement(...focusableElements);
295
294
  });
@@ -306,17 +305,15 @@ function focusZone(container, settings) {
306
305
  updateFocusedElement(event.target);
307
306
  }
308
307
  }, { signal });
309
- if (ignoreHoverEvents) {
310
- container.addEventListener('mousemove', ({ target }) => {
311
- if (!(target instanceof Node)) {
312
- return;
313
- }
314
- const focusableElement = focusableElements.find(element => element.contains(target));
315
- if (focusableElement) {
316
- updateFocusedElement(focusableElement);
317
- }
318
- }, { signal, capture: true });
319
- }
308
+ container.addEventListener('mousemove', ({ target }) => {
309
+ if (!(target instanceof Node)) {
310
+ return;
311
+ }
312
+ const focusableElement = focusableElements.find(element => element.contains(target));
313
+ if (focusableElement) {
314
+ updateFocusedElement(focusableElement);
315
+ }
316
+ }, { signal, capture: true });
320
317
  activeDescendantControl.addEventListener('focusin', () => {
321
318
  if (!currentFocusedElement) {
322
319
  updateFocusedElement(getFirstFocusableElement());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/behaviors",
3
- "version": "0.0.0-20251201144839",
3
+ "version": "0.0.0-20251201223248",
4
4
  "description": "Shared behaviors for JavaScript components",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cjs/index.js",
@@ -75,7 +75,7 @@
75
75
  "@github/prettier-config": "^0.0.6",
76
76
  "@rollup/plugin-typescript": "^12.1.0",
77
77
  "@rollup/wasm-node": "^4.19.1",
78
- "@size-limit/preset-small-lib": "^11.1.4",
78
+ "@size-limit/preset-small-lib": "^12.0.0",
79
79
  "@testing-library/react": "^16.0.0",
80
80
  "@testing-library/user-event": "^14.5.1",
81
81
  "@types/jest": "^30.0.0",
@@ -93,7 +93,7 @@
93
93
  "react-dom": "^19.0.0",
94
94
  "rimraf": "^6.0.1",
95
95
  "rollup": "^4.18.0",
96
- "size-limit": "^11.1.4",
96
+ "size-limit": "^12.0.0",
97
97
  "tslib": "^2.8.1",
98
98
  "typescript": "^5.2.2"
99
99
  }