@getflip/swirl-components 0.342.1 → 0.343.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.json +114 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-layout_5.cjs.entry.js +38 -31
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +4 -1
- package/dist/cjs/swirl-resource-list-section.cjs.entry.js +4 -1
- package/dist/cjs/swirl-stack.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tree-view-item.cjs.entry.js +25 -7
- package/dist/cjs/swirl-tree-view.cjs.entry.js +11 -1
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.js +61 -30
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.stories.js +1 -0
- package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +5 -2
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +3 -1
- package/dist/collection/components/swirl-resource-list-section/swirl-resource-list-section.js +4 -1
- package/dist/collection/components/swirl-stack/swirl-stack.js +20 -1
- package/dist/collection/components/swirl-tree-view/swirl-tree-view.js +37 -1
- package/dist/collection/components/swirl-tree-view-item/swirl-tree-view-item.js +25 -7
- package/dist/components/assets/pdfjs/pdf.worker.min.mjs +1 -4
- package/dist/components/swirl-resource-list-file-item.js +4 -1
- package/dist/components/swirl-resource-list-item2.js +3 -1
- package/dist/components/swirl-resource-list-section.js +4 -1
- package/dist/components/swirl-resource-list2.js +36 -30
- package/dist/components/swirl-stack2.js +2 -1
- package/dist/components/swirl-tree-view-item.js +25 -7
- package/dist/components/swirl-tree-view.js +12 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-layout_5.entry.js +38 -31
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-resource-list-file-item.entry.js +5 -2
- package/dist/esm/swirl-resource-list-section.entry.js +5 -2
- package/dist/esm/swirl-stack.entry.js +1 -1
- package/dist/esm/swirl-tree-view-item.entry.js +25 -7
- package/dist/esm/swirl-tree-view.entry.js +11 -1
- package/dist/swirl-components/p-0a915f63.entry.js +1 -0
- package/dist/swirl-components/p-714c3569.entry.js +1 -0
- package/dist/swirl-components/p-7a68df08.entry.js +1 -0
- package/dist/swirl-components/p-be976991.entry.js +1 -0
- package/dist/swirl-components/p-d8b7dbfc.entry.js +1 -0
- package/dist/swirl-components/{p-fd512b87.entry.js → p-f20e52ea.entry.js} +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-resource-list/swirl-resource-list.d.ts +2 -0
- package/dist/types/components/swirl-resource-list-file-item/swirl-resource-list-file-item.d.ts +1 -0
- package/dist/types/components/swirl-resource-list-section/swirl-resource-list-section.d.ts +1 -0
- package/dist/types/components/swirl-stack/swirl-stack.d.ts +1 -0
- package/dist/types/components/swirl-tree-view/swirl-tree-view.d.ts +2 -0
- package/dist/types/components/swirl-tree-view-item/swirl-tree-view-item.d.ts +1 -0
- package/dist/types/components.d.ts +22 -4
- package/package.json +1 -1
- package/vscode-data.json +28 -0
- package/dist/swirl-components/p-4b88a8a7.entry.js +0 -1
- package/dist/swirl-components/p-8444fd5f.entry.js +0 -1
- package/dist/swirl-components/p-c72a11ba.entry.js +0 -1
- package/dist/swirl-components/p-f2c6b764.entry.js +0 -1
- package/dist/swirl-components/p-fc26150d.entry.js +0 -1
|
@@ -17,7 +17,7 @@ export class SwirlTreeViewItem {
|
|
|
17
17
|
this.movingViaKeyboard = false;
|
|
18
18
|
this.selected = false;
|
|
19
19
|
this.onFocus = () => {
|
|
20
|
-
if (!this.selected) {
|
|
20
|
+
if (!this.selected && this.getSemantics() === "tree") {
|
|
21
21
|
this.select();
|
|
22
22
|
}
|
|
23
23
|
};
|
|
@@ -63,20 +63,23 @@ export class SwirlTreeViewItem {
|
|
|
63
63
|
this.setUpDragDrop();
|
|
64
64
|
}
|
|
65
65
|
async expand() {
|
|
66
|
-
if (this.expanded || !this.expandable) {
|
|
66
|
+
if (this.expanded || !this.expandable || this.getSemantics() !== "tree") {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
this.expanded = true;
|
|
70
70
|
this.expandedChange.emit(this.expanded);
|
|
71
71
|
}
|
|
72
72
|
async collapse() {
|
|
73
|
-
if (!this.expanded || !this.expandable) {
|
|
73
|
+
if (!this.expanded || !this.expandable || this.getSemantics() !== "tree") {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
this.expanded = false;
|
|
77
77
|
this.expandedChange.emit(this.expanded);
|
|
78
78
|
}
|
|
79
79
|
async select(focus) {
|
|
80
|
+
if (this.getSemantics() !== "tree") {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
80
83
|
this.selected = true;
|
|
81
84
|
if (focus) {
|
|
82
85
|
this.link?.focus();
|
|
@@ -84,6 +87,9 @@ export class SwirlTreeViewItem {
|
|
|
84
87
|
this.itemSelected.emit(this.el);
|
|
85
88
|
}
|
|
86
89
|
async unselect() {
|
|
90
|
+
if (this.getSemantics() !== "tree") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
87
93
|
this.selected = false;
|
|
88
94
|
}
|
|
89
95
|
setUpDragDrop() {
|
|
@@ -303,11 +309,19 @@ export class SwirlTreeViewItem {
|
|
|
303
309
|
}
|
|
304
310
|
this.cannotKeyboardDropInCurrentPosition = false;
|
|
305
311
|
}
|
|
312
|
+
getSemantics() {
|
|
313
|
+
const hasTreeSemantics = this.el.closest('[role="tree"]');
|
|
314
|
+
return hasTreeSemantics ? "tree" : "list";
|
|
315
|
+
}
|
|
306
316
|
render() {
|
|
307
317
|
const hasChildren = Boolean(this.el.querySelector("swirl-tree-view-item"));
|
|
308
318
|
const hasTags = Boolean(this.el.querySelector('[slot="tags"]'));
|
|
309
319
|
const iconIsEmoji = Boolean(this.icon) && /\p{Extended_Pictographic}/u.test(this.icon);
|
|
310
320
|
const shouldShowChildrenDropZone = this.enableDragDrop && !hasChildren;
|
|
321
|
+
const semantics = this.getSemantics();
|
|
322
|
+
const expanded = this.expanded || semantics !== "tree";
|
|
323
|
+
const tabIndex = semantics === "tree" ? (this.selected ? 0 : -1) : undefined;
|
|
324
|
+
const Tag = semantics === "tree" ? "li" : "div";
|
|
311
325
|
const className = classNames("tree-view-item", {
|
|
312
326
|
"tree-view-item--active": this.active,
|
|
313
327
|
"tree-view-item--cannot-keyboard-drop": this.cannotKeyboardDropInCurrentPosition,
|
|
@@ -315,13 +329,17 @@ export class SwirlTreeViewItem {
|
|
|
315
329
|
"tree-view-item--disable-drag": this.disableDrag,
|
|
316
330
|
"tree-view-item--has-tags": hasTags,
|
|
317
331
|
});
|
|
318
|
-
return (h(Host, { key: '
|
|
332
|
+
return (h(Host, { key: 'b69e0f608416e28e933f600068bc9781b8a7e67a', id: this.itemId, role: semantics === "tree" ? "none" : "listitem" }, h(Tag, { key: '59debc40e5914cf0861f77d839b8e1fb5048185f', class: className, role: semantics === "tree" ? "none" : undefined }, h("a", { key: '537cf90ebc08a8a1f852a2ebb44a7f6cd9487b9d', "aria-current": this.active ? "page" : undefined, "aria-expanded": !hasChildren || semantics !== "tree"
|
|
333
|
+
? undefined
|
|
334
|
+
: String(expanded), "aria-level": semantics === "tree" ? this.level + 1 : undefined, "aria-owns": hasChildren && semantics === "tree"
|
|
335
|
+
? `${this.itemId}-children`
|
|
336
|
+
: undefined, "aria-selected": semantics === "tree" ? String(this.selected) : undefined, class: "tree-view-item__link", href: this.href, onFocus: this.onFocus, onKeyDown: this.onKeyDown, ref: (el) => (this.link = el), role: semantics === "tree" ? "treeitem" : undefined, tabIndex: tabIndex }, !this.disableDrag && this.enableDragDrop && (h("span", { key: '8964954fbe3bf1d76f002cad14103a6490e46e41', class: "tree-view-item__drag-handle" }, h("swirl-icon-drag-handle", { key: '543ea8186b5fff51002487f4d1efd2157f579de2', size: 20 }))), this.expandable && semantics === "tree" && (h("span", { key: '16ddb005d1a629694d074823171d84add485c60a', class: "tree-view-item__toggle-icon" }, hasChildren && (h(Fragment, { key: '736eb2a5bd66e82af18a65870f48d8f9bec05ea4' }, expanded ? (h("swirl-icon-expand-more", { onClick: this.onClickCollapse, size: 24 })) : (h("swirl-icon-chevron-right", { onClick: this.onClickExpand, size: 24 })))))), Boolean(this.icon) && (h(Fragment, { key: '1b9889c672bfed46bdfa65ff2d5cab61de2e37cf' }, h("span", { key: 'c2e6b715bc17b468b7656de8750db4ba06cd41db', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (h("swirl-icon", { glyph: this.icon, size: 24, color: this.iconColor }))))), h("span", { key: '300e38e84a87b1f70408d5d710eb0b350a4b3e41', class: "tree-view-item__label" }, this.label), h("span", { key: 'ea9b1b1e29f7a770d123ed9aba08f15d2002f722', class: "tree-view-item__tags" }, h("slot", { key: 'd27ac7d0acb0da444304979cc21d6be4bf73ff68', name: "tags" }))), h("ul", { key: 'cb8ba76c9ceca5e94c9fb85005963b03f58ceb40', "aria-label": this.label, class: `tree-view-item__children ${shouldShowChildrenDropZone
|
|
319
337
|
? "tree-view-item__children--drop-zone"
|
|
320
|
-
: ""}`, id: `${this.itemId}-children`, ref: (el) => (this.childList = el), role: "group", style: {
|
|
321
|
-
display: (!
|
|
338
|
+
: ""}`, id: `${this.itemId}-children`, ref: (el) => (this.childList = el), role: semantics === "tree" ? "group" : undefined, style: {
|
|
339
|
+
display: (!expanded || !hasChildren) && !shouldShowChildrenDropZone
|
|
322
340
|
? "none"
|
|
323
341
|
: undefined,
|
|
324
|
-
} }, h("slot", { key: '
|
|
342
|
+
} }, h("slot", { key: '712ac39576c65889812fab90246284afefc79ca0' })))));
|
|
325
343
|
}
|
|
326
344
|
static get is() { return "swirl-tree-view-item"; }
|
|
327
345
|
static get originalStyleUrls() {
|