@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.
Files changed (54) hide show
  1. package/components.json +114 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/swirl-app-layout_5.cjs.entry.js +38 -31
  4. package/dist/cjs/swirl-components.cjs.js +1 -1
  5. package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +4 -1
  6. package/dist/cjs/swirl-resource-list-section.cjs.entry.js +4 -1
  7. package/dist/cjs/swirl-stack.cjs.entry.js +1 -1
  8. package/dist/cjs/swirl-tree-view-item.cjs.entry.js +25 -7
  9. package/dist/cjs/swirl-tree-view.cjs.entry.js +11 -1
  10. package/dist/collection/components/swirl-resource-list/swirl-resource-list.js +61 -30
  11. package/dist/collection/components/swirl-resource-list/swirl-resource-list.stories.js +1 -0
  12. package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +5 -2
  13. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +3 -1
  14. package/dist/collection/components/swirl-resource-list-section/swirl-resource-list-section.js +4 -1
  15. package/dist/collection/components/swirl-stack/swirl-stack.js +20 -1
  16. package/dist/collection/components/swirl-tree-view/swirl-tree-view.js +37 -1
  17. package/dist/collection/components/swirl-tree-view-item/swirl-tree-view-item.js +25 -7
  18. package/dist/components/assets/pdfjs/pdf.worker.min.mjs +1 -4
  19. package/dist/components/swirl-resource-list-file-item.js +4 -1
  20. package/dist/components/swirl-resource-list-item2.js +3 -1
  21. package/dist/components/swirl-resource-list-section.js +4 -1
  22. package/dist/components/swirl-resource-list2.js +36 -30
  23. package/dist/components/swirl-stack2.js +2 -1
  24. package/dist/components/swirl-tree-view-item.js +25 -7
  25. package/dist/components/swirl-tree-view.js +12 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/swirl-app-layout_5.entry.js +38 -31
  28. package/dist/esm/swirl-components.js +1 -1
  29. package/dist/esm/swirl-resource-list-file-item.entry.js +5 -2
  30. package/dist/esm/swirl-resource-list-section.entry.js +5 -2
  31. package/dist/esm/swirl-stack.entry.js +1 -1
  32. package/dist/esm/swirl-tree-view-item.entry.js +25 -7
  33. package/dist/esm/swirl-tree-view.entry.js +11 -1
  34. package/dist/swirl-components/p-0a915f63.entry.js +1 -0
  35. package/dist/swirl-components/p-714c3569.entry.js +1 -0
  36. package/dist/swirl-components/p-7a68df08.entry.js +1 -0
  37. package/dist/swirl-components/p-be976991.entry.js +1 -0
  38. package/dist/swirl-components/p-d8b7dbfc.entry.js +1 -0
  39. package/dist/swirl-components/{p-fd512b87.entry.js → p-f20e52ea.entry.js} +1 -1
  40. package/dist/swirl-components/swirl-components.esm.js +1 -1
  41. package/dist/types/components/swirl-resource-list/swirl-resource-list.d.ts +2 -0
  42. package/dist/types/components/swirl-resource-list-file-item/swirl-resource-list-file-item.d.ts +1 -0
  43. package/dist/types/components/swirl-resource-list-section/swirl-resource-list-section.d.ts +1 -0
  44. package/dist/types/components/swirl-stack/swirl-stack.d.ts +1 -0
  45. package/dist/types/components/swirl-tree-view/swirl-tree-view.d.ts +2 -0
  46. package/dist/types/components/swirl-tree-view-item/swirl-tree-view-item.d.ts +1 -0
  47. package/dist/types/components.d.ts +22 -4
  48. package/package.json +1 -1
  49. package/vscode-data.json +28 -0
  50. package/dist/swirl-components/p-4b88a8a7.entry.js +0 -1
  51. package/dist/swirl-components/p-8444fd5f.entry.js +0 -1
  52. package/dist/swirl-components/p-c72a11ba.entry.js +0 -1
  53. package/dist/swirl-components/p-f2c6b764.entry.js +0 -1
  54. 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: 'e407aad02c536ae6f3bf0adc999f4d6cef4deeb4', id: this.itemId, role: "none" }, h("li", { key: '30cad8635d5770373be5347ccd7b2c00ba99a6ff', class: className, role: "none" }, h("a", { key: 'ec8628de981fbc8246abdd5e7503abd6762f7b43', "aria-current": this.active ? "page" : undefined, "aria-expanded": !hasChildren ? undefined : String(this.expanded), "aria-level": this.level + 1, "aria-owns": hasChildren ? `${this.itemId}-children` : undefined, "aria-selected": String(this.selected), class: "tree-view-item__link", href: this.href, onFocus: this.onFocus, onKeyDown: this.onKeyDown, ref: (el) => (this.link = el), role: "treeitem", tabIndex: this.selected ? 0 : -1 }, !this.disableDrag && this.enableDragDrop && (h("span", { key: '1e556ae354352718c83db374555cffef2906aec2', class: "tree-view-item__drag-handle" }, h("swirl-icon-drag-handle", { key: 'b8083166676ee2bd38b45727c984bdbaabb442cc', size: 20 }))), this.expandable && (h("span", { key: 'e90c1603518c56135cf3e9b1b04323947045d62e', class: "tree-view-item__toggle-icon" }, hasChildren && (h(Fragment, { key: 'ec6c9d66674cc67d40945c2424bb4549629032eb' }, this.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: 'e2399828aa48599248340f33bbf743934bcaaa6d' }, h("span", { key: '571b89b1766fd79ea0041d6d67d8b818c2186c21', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (h("swirl-icon", { glyph: this.icon, size: 24, color: this.iconColor }))))), h("span", { key: '915cfff5478e90ce13dde92cc57383e9ba1e3a82', class: "tree-view-item__label" }, this.label), h("span", { key: 'cafd19fe2bb21141713d946543b17e2a8e3af7c1', class: "tree-view-item__tags" }, h("slot", { key: '59e8d26054053902bdb83ac0f0431392a1822f81', name: "tags" }))), h("ul", { key: '19ba4fd45f7d38c886e69eb7e616d9c43e064163', "aria-label": this.label, class: `tree-view-item__children ${shouldShowChildrenDropZone
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: (!this.expanded || !hasChildren) && !shouldShowChildrenDropZone
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: '2e074013de5942bf92e445581ceb4f9f94e041b7' })))));
342
+ } }, h("slot", { key: '712ac39576c65889812fab90246284afefc79ca0' })))));
325
343
  }
326
344
  static get is() { return "swirl-tree-view-item"; }
327
345
  static get originalStyleUrls() {