@karmo-co/drift-kit-public 25.17.3 → 25.18.1
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/components.js +53 -16
- package/drift-kit.min.css +2 -2
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -10817,8 +10817,21 @@
|
|
|
10817
10817
|
function railOnly(el) { return !el.closest('.' + P + '__panel'); }
|
|
10818
10818
|
function decorate() {
|
|
10819
10819
|
qa(root, '.' + P + '__group').forEach(function (li) {
|
|
10820
|
-
var
|
|
10821
|
-
if (
|
|
10820
|
+
var head = q(li, ':scope > .' + P + '__item');
|
|
10821
|
+
if (!head)
|
|
10822
|
+
return;
|
|
10823
|
+
var btn = head;
|
|
10824
|
+
if (head.tagName === 'A') {
|
|
10825
|
+
btn = q(li, ':scope > .' + P + '__disclosure');
|
|
10826
|
+
if (!btn) {
|
|
10827
|
+
btn = document.createElement('button');
|
|
10828
|
+
btn.type = 'button';
|
|
10829
|
+
btn.className = P + '__disclosure';
|
|
10830
|
+
btn.setAttribute('aria-label', labelOf(head) + ' pages');
|
|
10831
|
+
head.insertAdjacentElement('afterend', btn);
|
|
10832
|
+
}
|
|
10833
|
+
}
|
|
10834
|
+
if (!q(btn, '.' + P + '__chevron')) {
|
|
10822
10835
|
var ch = document.createElement('span');
|
|
10823
10836
|
ch.className = P + '__chevron';
|
|
10824
10837
|
ch.setAttribute('aria-hidden', 'true');
|
|
@@ -10893,12 +10906,26 @@
|
|
|
10893
10906
|
b.addEventListener('click', function () {
|
|
10894
10907
|
if (original.getAttribute('aria-disabled') === 'true' || original.disabled)
|
|
10895
10908
|
return;
|
|
10896
|
-
setTimeout(function () {
|
|
10909
|
+
setTimeout(function () {
|
|
10910
|
+
original.__sbPass = true;
|
|
10911
|
+
try {
|
|
10912
|
+
original.click();
|
|
10913
|
+
}
|
|
10914
|
+
finally {
|
|
10915
|
+
original.__sbPass = false;
|
|
10916
|
+
}
|
|
10917
|
+
}, 0);
|
|
10897
10918
|
});
|
|
10898
10919
|
return b;
|
|
10899
10920
|
}
|
|
10900
|
-
function fillMenu(menu, rows, heading) {
|
|
10921
|
+
function fillMenu(menu, rows, heading, parent) {
|
|
10901
10922
|
menu.textContent = '';
|
|
10923
|
+
if (parent) {
|
|
10924
|
+
menu.appendChild(forwarder(parent));
|
|
10925
|
+
if (rows.length)
|
|
10926
|
+
rows = ['separator'].concat(rows);
|
|
10927
|
+
heading = null;
|
|
10928
|
+
}
|
|
10902
10929
|
if (heading) {
|
|
10903
10930
|
var h = document.createElement('span');
|
|
10904
10931
|
h.className = 'dk-component-dropdown__label';
|
|
@@ -10915,10 +10942,15 @@
|
|
|
10915
10942
|
var li = row.closest('li');
|
|
10916
10943
|
var sub = li && li.classList.contains(P + '__group') ? q(li, ':scope > .' + P + '__list[data-level="2"]') : null;
|
|
10917
10944
|
if (sub) {
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10945
|
+
if (row.tagName === 'A') {
|
|
10946
|
+
menu.appendChild(forwarder(row));
|
|
10947
|
+
}
|
|
10948
|
+
else {
|
|
10949
|
+
var gh = document.createElement('span');
|
|
10950
|
+
gh.className = 'dk-component-dropdown__label';
|
|
10951
|
+
gh.textContent = labelOf(row);
|
|
10952
|
+
menu.appendChild(gh);
|
|
10953
|
+
}
|
|
10922
10954
|
qa(sub, ':scope > li > .' + P + '__item').forEach(function (c) { menu.appendChild(forwarder(c)); });
|
|
10923
10955
|
return;
|
|
10924
10956
|
}
|
|
@@ -10935,10 +10967,12 @@
|
|
|
10935
10967
|
}
|
|
10936
10968
|
function setupGroups() {
|
|
10937
10969
|
groups = qa(root, '.' + P + '__group').filter(railOnly).map(function (li) {
|
|
10938
|
-
var
|
|
10970
|
+
var head = q(li, ':scope > .' + P + '__item');
|
|
10939
10971
|
var sub = q(li, ':scope > .' + P + '__list[data-level="2"]');
|
|
10940
|
-
if (!
|
|
10972
|
+
if (!head || !sub)
|
|
10941
10973
|
return null;
|
|
10974
|
+
var link = head.tagName === 'A';
|
|
10975
|
+
var btn = (link && q(li, ':scope > .' + P + '__disclosure')) || head;
|
|
10942
10976
|
if (!sub.id)
|
|
10943
10977
|
sub.id = uid('group');
|
|
10944
10978
|
var g = li.__dcSidebarGroup;
|
|
@@ -10946,10 +10980,11 @@
|
|
|
10946
10980
|
g = li.__dcSidebarGroup = { li: li, menu: makeMenu() };
|
|
10947
10981
|
li.appendChild(g.menu);
|
|
10948
10982
|
if (dk.component.dropdown && dk.component.dropdown.wire) {
|
|
10949
|
-
dk.component.dropdown.wire(li,
|
|
10983
|
+
dk.component.dropdown.wire(li, head, g.menu, { when: function () { return !!li.__sbFlyout && !head.__sbPass; } });
|
|
10950
10984
|
}
|
|
10951
10985
|
}
|
|
10952
10986
|
g.btn = btn;
|
|
10987
|
+
g.head = head;
|
|
10953
10988
|
g.sub = sub;
|
|
10954
10989
|
if (btn.__sbToken !== token) {
|
|
10955
10990
|
btn.__sbToken = token;
|
|
@@ -10969,7 +11004,7 @@
|
|
|
10969
11004
|
li.setAttribute('data-sb-seen', '');
|
|
10970
11005
|
var open = li.__dcDropdown && li.__dcDropdown.isOpen && li.__dcDropdown.isOpen();
|
|
10971
11006
|
if (!open)
|
|
10972
|
-
fillMenu(g.menu, qa(sub, ':scope > li > .' + P + '__item'), labelOf(
|
|
11007
|
+
fillMenu(g.menu, qa(sub, ':scope > li > .' + P + '__item'), labelOf(head), link ? head : null);
|
|
10973
11008
|
return g;
|
|
10974
11009
|
}).filter(Boolean);
|
|
10975
11010
|
}
|
|
@@ -11095,12 +11130,14 @@
|
|
|
11095
11130
|
g.btn.removeAttribute('aria-haspopup');
|
|
11096
11131
|
g.btn.setAttribute('aria-controls', g.sub.id);
|
|
11097
11132
|
g.btn.setAttribute('aria-expanded', groupOpen(g) ? 'true' : 'false');
|
|
11133
|
+
if (g.head !== g.btn)
|
|
11134
|
+
['aria-haspopup', 'aria-controls', 'aria-expanded'].forEach(function (a) { g.head.removeAttribute(a); });
|
|
11098
11135
|
}
|
|
11099
11136
|
else {
|
|
11100
|
-
g.
|
|
11101
|
-
g.
|
|
11137
|
+
g.head.setAttribute('aria-haspopup', 'menu');
|
|
11138
|
+
g.head.setAttribute('aria-controls', g.menu.id);
|
|
11102
11139
|
if (!dropdownOpen)
|
|
11103
|
-
g.
|
|
11140
|
+
g.head.setAttribute('aria-expanded', 'false');
|
|
11104
11141
|
}
|
|
11105
11142
|
g.li.setAttribute('data-placement', presentation === 'bar' ? 'top' : 'right');
|
|
11106
11143
|
g.li.setAttribute('data-align', presentation === 'bar' ? 'center' : 'start');
|
|
@@ -11866,7 +11903,7 @@
|
|
|
11866
11903
|
if (!isOpen())
|
|
11867
11904
|
return;
|
|
11868
11905
|
var item = e.target.closest && e.target.closest('a.' + P + '__item, a.' + P + '__brand, button.' + P + '__item:not([aria-controls])');
|
|
11869
|
-
if (item && root.contains(item) && !item.closest('.' + P + '__group > .' + P + '__item'))
|
|
11906
|
+
if (item && root.contains(item) && !item.closest('.' + P + '__group > button.' + P + '__item'))
|
|
11870
11907
|
close();
|
|
11871
11908
|
}, true);
|
|
11872
11909
|
function sync() {
|