@y14e/accordion 1.4.1 → 1.4.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.
- package/README.md +4 -4
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/accordion
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import Accordion from '@y14e/accordion@1.4.
|
|
13
|
+
import Accordion from '@y14e/accordion@1.4.2';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Accordion from 'https://esm.sh/@y14e/accordion@1.4.
|
|
16
|
+
import Accordion from 'https://esm.sh/@y14e/accordion@1.4.2';
|
|
17
17
|
// or
|
|
18
|
-
import Accordion from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@1.4.
|
|
18
|
+
import Accordion from 'https://cdn.jsdelivr.net/npm/@y14e/accordion@1.4.2/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import Accordion from 'https://esm.unpkg.com/@y14e/accordion@1.4.
|
|
20
|
+
import Accordion from 'https://esm.unpkg.com/@y14e/accordion@1.4.2';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -414,7 +414,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
414
414
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
415
415
|
navigationOnly = false;
|
|
416
416
|
}
|
|
417
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
417
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
418
418
|
console.warn(
|
|
419
419
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
420
420
|
);
|
|
@@ -429,10 +429,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
429
429
|
wrap = false;
|
|
430
430
|
}
|
|
431
431
|
const settings = { navigationOnly, typeahead, wrap };
|
|
432
|
-
if (direction
|
|
432
|
+
if (direction) {
|
|
433
433
|
Object.assign(settings, { direction });
|
|
434
434
|
}
|
|
435
|
-
if (selector
|
|
435
|
+
if (selector) {
|
|
436
436
|
Object.assign(settings, { selector });
|
|
437
437
|
}
|
|
438
438
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -729,8 +729,6 @@ var Accordion = class _Accordion {
|
|
|
729
729
|
this.#rootElement.removeAttribute("data-accordion-initialized");
|
|
730
730
|
}
|
|
731
731
|
#initialize() {
|
|
732
|
-
this.#eventController = new AbortController();
|
|
733
|
-
const { signal } = this.#eventController;
|
|
734
732
|
saveAttributes(this.#triggerElements, [
|
|
735
733
|
"aria-controls",
|
|
736
734
|
"aria-disabled",
|
|
@@ -738,13 +736,15 @@ var Accordion = class _Accordion {
|
|
|
738
736
|
"style",
|
|
739
737
|
"tabindex"
|
|
740
738
|
]);
|
|
739
|
+
saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
|
|
740
|
+
this.#eventController = new AbortController();
|
|
741
|
+
const { signal } = this.#eventController;
|
|
741
742
|
this.#triggerElements.forEach((trigger2, i) => {
|
|
742
743
|
const id = Math.random().toString(36).slice(-8);
|
|
743
744
|
const content2 = this.#contentElements[i];
|
|
744
745
|
if (!content2) {
|
|
745
746
|
return;
|
|
746
747
|
}
|
|
747
|
-
saveAttributes([content2], ["aria-labelledby", "id", "role"]);
|
|
748
748
|
content2.id ||= `accordion-content-${id}`;
|
|
749
749
|
addTokenToAttribute(trigger2, "aria-controls", content2.id);
|
|
750
750
|
trigger2.setAttribute(
|
|
@@ -894,7 +894,7 @@ function waitAnimationFinish(animation) {
|
|
|
894
894
|
* Accordion
|
|
895
895
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
896
896
|
*
|
|
897
|
-
* @version 1.4.
|
|
897
|
+
* @version 1.4.2
|
|
898
898
|
* @author Yusuke Kamiyamane
|
|
899
899
|
* @license MIT
|
|
900
900
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -930,7 +930,7 @@ function waitAnimationFinish(animation) {
|
|
|
930
930
|
* Lightweight roving tabindex utility with fully focus management.
|
|
931
931
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
932
932
|
*
|
|
933
|
-
* @version 2.0.
|
|
933
|
+
* @version 2.0.4
|
|
934
934
|
* @author Yusuke Kamiyamane
|
|
935
935
|
* @license MIT
|
|
936
936
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -412,7 +412,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
412
412
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
413
413
|
navigationOnly = false;
|
|
414
414
|
}
|
|
415
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
415
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
416
416
|
console.warn(
|
|
417
417
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
418
418
|
);
|
|
@@ -427,10 +427,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
427
427
|
wrap = false;
|
|
428
428
|
}
|
|
429
429
|
const settings = { navigationOnly, typeahead, wrap };
|
|
430
|
-
if (direction
|
|
430
|
+
if (direction) {
|
|
431
431
|
Object.assign(settings, { direction });
|
|
432
432
|
}
|
|
433
|
-
if (selector
|
|
433
|
+
if (selector) {
|
|
434
434
|
Object.assign(settings, { selector });
|
|
435
435
|
}
|
|
436
436
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -727,8 +727,6 @@ var Accordion = class _Accordion {
|
|
|
727
727
|
this.#rootElement.removeAttribute("data-accordion-initialized");
|
|
728
728
|
}
|
|
729
729
|
#initialize() {
|
|
730
|
-
this.#eventController = new AbortController();
|
|
731
|
-
const { signal } = this.#eventController;
|
|
732
730
|
saveAttributes(this.#triggerElements, [
|
|
733
731
|
"aria-controls",
|
|
734
732
|
"aria-disabled",
|
|
@@ -736,13 +734,15 @@ var Accordion = class _Accordion {
|
|
|
736
734
|
"style",
|
|
737
735
|
"tabindex"
|
|
738
736
|
]);
|
|
737
|
+
saveAttributes(this.#contentElements, ["aria-labelledby", "id", "role"]);
|
|
738
|
+
this.#eventController = new AbortController();
|
|
739
|
+
const { signal } = this.#eventController;
|
|
739
740
|
this.#triggerElements.forEach((trigger2, i) => {
|
|
740
741
|
const id = Math.random().toString(36).slice(-8);
|
|
741
742
|
const content2 = this.#contentElements[i];
|
|
742
743
|
if (!content2) {
|
|
743
744
|
return;
|
|
744
745
|
}
|
|
745
|
-
saveAttributes([content2], ["aria-labelledby", "id", "role"]);
|
|
746
746
|
content2.id ||= `accordion-content-${id}`;
|
|
747
747
|
addTokenToAttribute(trigger2, "aria-controls", content2.id);
|
|
748
748
|
trigger2.setAttribute(
|
|
@@ -892,7 +892,7 @@ function waitAnimationFinish(animation) {
|
|
|
892
892
|
* Accordion
|
|
893
893
|
* WAI-ARIA compliant accordion pattern implementation in TypeScript.
|
|
894
894
|
*
|
|
895
|
-
* @version 1.4.
|
|
895
|
+
* @version 1.4.2
|
|
896
896
|
* @author Yusuke Kamiyamane
|
|
897
897
|
* @license MIT
|
|
898
898
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -928,7 +928,7 @@ function waitAnimationFinish(animation) {
|
|
|
928
928
|
* Lightweight roving tabindex utility with fully focus management.
|
|
929
929
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
930
930
|
*
|
|
931
|
-
* @version 2.0.
|
|
931
|
+
* @version 2.0.4
|
|
932
932
|
* @author Yusuke Kamiyamane
|
|
933
933
|
* @license MIT
|
|
934
934
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/accordion",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "WAI-ARIA compliant accordion pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@y14e/attributes-utils": "^1.1.0",
|
|
47
47
|
"@y14e/button": "^1.0.0",
|
|
48
|
-
"@y14e/roving-tabindex": "^2.0.
|
|
48
|
+
"@y14e/roving-tabindex": "^2.0.4",
|
|
49
49
|
"bun-types": "latest",
|
|
50
50
|
"tsup": "^8.0.0",
|
|
51
51
|
"typescript": "^5.6.0",
|