@y14e/disclosure-css 2.2.1 → 2.2.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/dist/index.bundle.cjs +17 -12
- package/dist/index.bundle.js +17 -12
- package/dist/index.cjs +5 -9
- package/dist/index.js +5 -9
- package/package.json +3 -3
package/dist/index.bundle.cjs
CHANGED
|
@@ -344,6 +344,7 @@ function isFocusable(element, options = {}) {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
347
|
+
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
347
348
|
function getCellCoords(cell) {
|
|
348
349
|
const { left, top, width, height } = cell.getBoundingClientRect();
|
|
349
350
|
return { x: left + width / 2, y: top + height / 2 };
|
|
@@ -402,7 +403,6 @@ function getNextCell(cells, key, wrap) {
|
|
|
402
403
|
}
|
|
403
404
|
return result;
|
|
404
405
|
}
|
|
405
|
-
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
406
406
|
function resolveOptions3(options) {
|
|
407
407
|
let {
|
|
408
408
|
direction = "both",
|
|
@@ -416,7 +416,7 @@ function resolveOptions3(options) {
|
|
|
416
416
|
if (typeof direction === "string") {
|
|
417
417
|
direction = direction.toLowerCase();
|
|
418
418
|
}
|
|
419
|
-
if (!DIRECTIONS.includes(direction)) {
|
|
419
|
+
if (typeof direction === "string" && !DIRECTIONS.includes(direction) || typeof direction === "function" && !DIRECTIONS.includes(direction())) {
|
|
420
420
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
421
421
|
direction = "both";
|
|
422
422
|
}
|
|
@@ -516,7 +516,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
516
516
|
(!(target instanceof Element) || !this.#focusables.has(target)) && this.#update();
|
|
517
517
|
};
|
|
518
518
|
#onKeyDown = (event) => {
|
|
519
|
-
const
|
|
519
|
+
const direction = this.#getDirection();
|
|
520
520
|
const isGrid = direction === "grid";
|
|
521
521
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
522
522
|
if (!(isGrid && ["End", "Home"].includes(key)) && ctrlKey || altKey || metaKey || shiftKey) {
|
|
@@ -524,6 +524,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
524
524
|
}
|
|
525
525
|
const isBoth = direction === "both";
|
|
526
526
|
const isHorizontal = direction === "horizontal";
|
|
527
|
+
const { typeahead, wrap = false } = this.#settings;
|
|
527
528
|
if (![
|
|
528
529
|
"End",
|
|
529
530
|
"Home",
|
|
@@ -662,6 +663,14 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
662
663
|
#getCellsOfActiveRow() {
|
|
663
664
|
return getCellsOfActiveRow(this.#getFocusables());
|
|
664
665
|
}
|
|
666
|
+
#getDirection() {
|
|
667
|
+
const { direction } = this.#settings;
|
|
668
|
+
if (typeof direction === "string") {
|
|
669
|
+
return direction;
|
|
670
|
+
}
|
|
671
|
+
const d = direction();
|
|
672
|
+
return DIRECTIONS.includes(d) ? d : "both";
|
|
673
|
+
}
|
|
665
674
|
#getFocusables() {
|
|
666
675
|
return getFocusables(this.#container, {
|
|
667
676
|
composed: true,
|
|
@@ -749,9 +758,9 @@ var Disclosure = class _Disclosure {
|
|
|
749
758
|
return;
|
|
750
759
|
}
|
|
751
760
|
const binding = this.#createBinding(details, summary, content);
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
761
|
+
[details, summary, content].forEach((element) => {
|
|
762
|
+
this.#bindings.set(element, binding);
|
|
763
|
+
});
|
|
755
764
|
});
|
|
756
765
|
this.#initialize();
|
|
757
766
|
}
|
|
@@ -820,12 +829,8 @@ var Disclosure = class _Disclosure {
|
|
|
820
829
|
if (!(summary instanceof HTMLElement)) {
|
|
821
830
|
return;
|
|
822
831
|
}
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
const { details } = binding;
|
|
828
|
-
this.#toggle(details, !details.open);
|
|
832
|
+
const details = this.#bindings.get(summary)?.details;
|
|
833
|
+
details && this.#toggle(details, !details.open);
|
|
829
834
|
};
|
|
830
835
|
#toggle(details, isExpand) {
|
|
831
836
|
if (details.open === isExpand) {
|
package/dist/index.bundle.js
CHANGED
|
@@ -342,6 +342,7 @@ function isFocusable(element, options = {}) {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
345
|
+
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
345
346
|
function getCellCoords(cell) {
|
|
346
347
|
const { left, top, width, height } = cell.getBoundingClientRect();
|
|
347
348
|
return { x: left + width / 2, y: top + height / 2 };
|
|
@@ -400,7 +401,6 @@ function getNextCell(cells, key, wrap) {
|
|
|
400
401
|
}
|
|
401
402
|
return result;
|
|
402
403
|
}
|
|
403
|
-
var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
|
|
404
404
|
function resolveOptions3(options) {
|
|
405
405
|
let {
|
|
406
406
|
direction = "both",
|
|
@@ -414,7 +414,7 @@ function resolveOptions3(options) {
|
|
|
414
414
|
if (typeof direction === "string") {
|
|
415
415
|
direction = direction.toLowerCase();
|
|
416
416
|
}
|
|
417
|
-
if (!DIRECTIONS.includes(direction)) {
|
|
417
|
+
if (typeof direction === "string" && !DIRECTIONS.includes(direction) || typeof direction === "function" && !DIRECTIONS.includes(direction())) {
|
|
418
418
|
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
419
419
|
direction = "both";
|
|
420
420
|
}
|
|
@@ -514,7 +514,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
514
514
|
(!(target instanceof Element) || !this.#focusables.has(target)) && this.#update();
|
|
515
515
|
};
|
|
516
516
|
#onKeyDown = (event) => {
|
|
517
|
-
const
|
|
517
|
+
const direction = this.#getDirection();
|
|
518
518
|
const isGrid = direction === "grid";
|
|
519
519
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
520
520
|
if (!(isGrid && ["End", "Home"].includes(key)) && ctrlKey || altKey || metaKey || shiftKey) {
|
|
@@ -522,6 +522,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
522
522
|
}
|
|
523
523
|
const isBoth = direction === "both";
|
|
524
524
|
const isHorizontal = direction === "horizontal";
|
|
525
|
+
const { typeahead, wrap = false } = this.#settings;
|
|
525
526
|
if (![
|
|
526
527
|
"End",
|
|
527
528
|
"Home",
|
|
@@ -660,6 +661,14 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
660
661
|
#getCellsOfActiveRow() {
|
|
661
662
|
return getCellsOfActiveRow(this.#getFocusables());
|
|
662
663
|
}
|
|
664
|
+
#getDirection() {
|
|
665
|
+
const { direction } = this.#settings;
|
|
666
|
+
if (typeof direction === "string") {
|
|
667
|
+
return direction;
|
|
668
|
+
}
|
|
669
|
+
const d = direction();
|
|
670
|
+
return DIRECTIONS.includes(d) ? d : "both";
|
|
671
|
+
}
|
|
663
672
|
#getFocusables() {
|
|
664
673
|
return getFocusables(this.#container, {
|
|
665
674
|
composed: true,
|
|
@@ -747,9 +756,9 @@ var Disclosure = class _Disclosure {
|
|
|
747
756
|
return;
|
|
748
757
|
}
|
|
749
758
|
const binding = this.#createBinding(details, summary, content);
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
759
|
+
[details, summary, content].forEach((element) => {
|
|
760
|
+
this.#bindings.set(element, binding);
|
|
761
|
+
});
|
|
753
762
|
});
|
|
754
763
|
this.#initialize();
|
|
755
764
|
}
|
|
@@ -818,12 +827,8 @@ var Disclosure = class _Disclosure {
|
|
|
818
827
|
if (!(summary instanceof HTMLElement)) {
|
|
819
828
|
return;
|
|
820
829
|
}
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
const { details } = binding;
|
|
826
|
-
this.#toggle(details, !details.open);
|
|
830
|
+
const details = this.#bindings.get(summary)?.details;
|
|
831
|
+
details && this.#toggle(details, !details.open);
|
|
827
832
|
};
|
|
828
833
|
#toggle(details, isExpand) {
|
|
829
834
|
if (details.open === isExpand) {
|
package/dist/index.cjs
CHANGED
|
@@ -79,9 +79,9 @@ var Disclosure = class _Disclosure {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
const binding = this.#createBinding(details, summary, content);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
[details, summary, content].forEach((element) => {
|
|
83
|
+
this.#bindings.set(element, binding);
|
|
84
|
+
});
|
|
85
85
|
});
|
|
86
86
|
this.#initialize();
|
|
87
87
|
}
|
|
@@ -150,12 +150,8 @@ var Disclosure = class _Disclosure {
|
|
|
150
150
|
if (!(summary instanceof HTMLElement)) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const { details } = binding;
|
|
158
|
-
this.#toggle(details, !details.open);
|
|
153
|
+
const details = this.#bindings.get(summary)?.details;
|
|
154
|
+
details && this.#toggle(details, !details.open);
|
|
159
155
|
};
|
|
160
156
|
#toggle(details, isExpand) {
|
|
161
157
|
if (details.open === isExpand) {
|
package/dist/index.js
CHANGED
|
@@ -77,9 +77,9 @@ var Disclosure = class _Disclosure {
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const binding = this.#createBinding(details, summary, content);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
[details, summary, content].forEach((element) => {
|
|
81
|
+
this.#bindings.set(element, binding);
|
|
82
|
+
});
|
|
83
83
|
});
|
|
84
84
|
this.#initialize();
|
|
85
85
|
}
|
|
@@ -148,12 +148,8 @@ var Disclosure = class _Disclosure {
|
|
|
148
148
|
if (!(summary instanceof HTMLElement)) {
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const { details } = binding;
|
|
156
|
-
this.#toggle(details, !details.open);
|
|
151
|
+
const details = this.#bindings.get(summary)?.details;
|
|
152
|
+
details && this.#toggle(details, !details.open);
|
|
157
153
|
};
|
|
158
154
|
#toggle(details, isExpand) {
|
|
159
155
|
if (details.open === isExpand) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure-css",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"esbuild": true
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@y14e/attribute-utils": "^2.0.
|
|
58
|
-
"@y14e/roving-tabindex": "^3.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.18",
|
|
58
|
+
"@y14e/roving-tabindex": "^3.5.1"
|
|
59
59
|
}
|
|
60
60
|
}
|