@y14e/roving-tabindex 1.1.2 → 1.1.3

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.
package/README.md CHANGED
@@ -41,10 +41,10 @@ const cleanup = createRovingTabIndex(container, options);
41
41
 
42
42
  ```ts
43
43
  interface RovingTabIndexOptions {
44
- direction?: 'horizontal' | 'vertical'; // default: both (undefined)
45
- selector?: string;
46
- typeahead?: boolean; // default: false
47
- wrap?: boolean; // default: false
44
+ direction?: 'horizontal' | 'vertical' | undefined; // default: both (undefined)
45
+ selector?: string | undefined;
46
+ typeahead?: boolean; // default: false
47
+ wrap?: boolean; // default: false
48
48
  }
49
49
  ```
50
50
 
package/dist/index.cjs CHANGED
@@ -245,26 +245,31 @@ function createRovingTabIndex(container, options = {}) {
245
245
  if (!(container instanceof Element)) {
246
246
  throw new Error("Invalid container element");
247
247
  }
248
- const { direction, selector, typeahead = false, wrap = false } = options;
248
+ let { direction, selector, typeahead = false, wrap = false } = options;
249
249
  if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
250
250
  console.warn("Invalid direction. Fallback: both (undefined).");
251
- Object.assign(options, { direction: void 0 });
251
+ direction = void 0;
252
252
  }
253
253
  if (typeof selector !== "undefined" && typeof selector !== "string") {
254
254
  console.warn(
255
255
  "Invalid selector. Fallback: all focusable elements (undefined)."
256
256
  );
257
- Object.assign(options, { selector: void 0 });
257
+ selector = void 0;
258
258
  }
259
259
  if (typeof typeahead !== "boolean") {
260
260
  console.warn("Invalid typeahead. Fallback: false.");
261
- Object.assign(options, { typeahead: false });
261
+ typeahead = false;
262
262
  }
263
263
  if (typeof wrap !== "boolean") {
264
264
  console.warn("Invalid wrap. Fallback: false.");
265
- Object.assign(options, { wrap: false });
265
+ wrap = false;
266
266
  }
267
- const roving = new RovingTabIndex(container, options);
267
+ const roving = new RovingTabIndex(container, {
268
+ direction,
269
+ selector,
270
+ typeahead,
271
+ wrap
272
+ });
268
273
  return () => roving.destroy();
269
274
  }
270
275
  var RovingTabIndex = class {
@@ -458,7 +463,7 @@ function getActiveElement() {
458
463
  * Lightweight roving tabindex utility with fully focus management.
459
464
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
460
465
  *
461
- * @version 1.1.2
466
+ * @version 1.1.3
462
467
  * @author Yusuke Kamiyamane
463
468
  * @license MIT
464
469
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,15 +3,15 @@
3
3
  * Lightweight roving tabindex utility with fully focus management.
4
4
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
5
5
  *
6
- * @version 1.1.2
6
+ * @version 1.1.3
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/roving-tabindex}
11
11
  */
12
12
  interface RovingTabIndexOptions {
13
- readonly direction?: 'horizontal' | 'vertical';
14
- readonly selector?: string;
13
+ readonly direction?: 'horizontal' | 'vertical' | undefined;
14
+ readonly selector?: string | undefined;
15
15
  readonly typeahead?: boolean;
16
16
  readonly wrap?: boolean;
17
17
  }
package/dist/index.d.ts CHANGED
@@ -3,15 +3,15 @@
3
3
  * Lightweight roving tabindex utility with fully focus management.
4
4
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
5
5
  *
6
- * @version 1.1.2
6
+ * @version 1.1.3
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/roving-tabindex}
11
11
  */
12
12
  interface RovingTabIndexOptions {
13
- readonly direction?: 'horizontal' | 'vertical';
14
- readonly selector?: string;
13
+ readonly direction?: 'horizontal' | 'vertical' | undefined;
14
+ readonly selector?: string | undefined;
15
15
  readonly typeahead?: boolean;
16
16
  readonly wrap?: boolean;
17
17
  }
package/dist/index.js CHANGED
@@ -243,26 +243,31 @@ function createRovingTabIndex(container, options = {}) {
243
243
  if (!(container instanceof Element)) {
244
244
  throw new Error("Invalid container element");
245
245
  }
246
- const { direction, selector, typeahead = false, wrap = false } = options;
246
+ let { direction, selector, typeahead = false, wrap = false } = options;
247
247
  if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
248
248
  console.warn("Invalid direction. Fallback: both (undefined).");
249
- Object.assign(options, { direction: void 0 });
249
+ direction = void 0;
250
250
  }
251
251
  if (typeof selector !== "undefined" && typeof selector !== "string") {
252
252
  console.warn(
253
253
  "Invalid selector. Fallback: all focusable elements (undefined)."
254
254
  );
255
- Object.assign(options, { selector: void 0 });
255
+ selector = void 0;
256
256
  }
257
257
  if (typeof typeahead !== "boolean") {
258
258
  console.warn("Invalid typeahead. Fallback: false.");
259
- Object.assign(options, { typeahead: false });
259
+ typeahead = false;
260
260
  }
261
261
  if (typeof wrap !== "boolean") {
262
262
  console.warn("Invalid wrap. Fallback: false.");
263
- Object.assign(options, { wrap: false });
263
+ wrap = false;
264
264
  }
265
- const roving = new RovingTabIndex(container, options);
265
+ const roving = new RovingTabIndex(container, {
266
+ direction,
267
+ selector,
268
+ typeahead,
269
+ wrap
270
+ });
266
271
  return () => roving.destroy();
267
272
  }
268
273
  var RovingTabIndex = class {
@@ -456,7 +461,7 @@ function getActiveElement() {
456
461
  * Lightweight roving tabindex utility with fully focus management.
457
462
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
458
463
  *
459
- * @version 1.1.2
464
+ * @version 1.1.3
460
465
  * @author Yusuke Kamiyamane
461
466
  * @license MIT
462
467
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",