@getflip/swirl-components 0.255.0 → 0.256.0

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 (65) hide show
  1. package/components.json +224 -7
  2. package/dist/cjs/file-manager.cjs.entry.js +1 -1
  3. package/dist/cjs/index-2ab5d772.js +20 -16
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/swirl-components.cjs.js +1 -1
  6. package/dist/cjs/swirl-tree-navigation-item.cjs.entry.js +72 -5
  7. package/dist/cjs/swirl-tree-navigation.cjs.entry.js +21 -0
  8. package/dist/cjs/swirl-tree-view-item.cjs.entry.js +3 -3
  9. package/dist/cjs/swirl-tree-view.cjs.entry.js +1 -1
  10. package/dist/cjs/swirl-video-thumbnail.cjs.entry.js +1 -1
  11. package/dist/cjs/swirl-visually-hidden.cjs.entry.js +1 -1
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.css +12 -0
  14. package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.js +42 -0
  15. package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.spec.js +19 -0
  16. package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.stories.js +32 -0
  17. package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.css +88 -34
  18. package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.js +207 -5
  19. package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.spec.js +15 -10
  20. package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.stories.js +1 -11
  21. package/dist/collection/components/swirl-tree-view/swirl-tree-view.js +1 -1
  22. package/dist/collection/components/swirl-tree-view-item/swirl-tree-view-item.js +3 -3
  23. package/dist/collection/components/swirl-video-thumbnail/swirl-video-thumbnail.js +1 -1
  24. package/dist/collection/components/swirl-visually-hidden/swirl-visually-hidden.js +1 -1
  25. package/dist/collection/prototypes/file-manager/file-manager.js +1 -1
  26. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  27. package/dist/components/file-manager.js +1 -1
  28. package/dist/components/index.js +2 -0
  29. package/dist/components/swirl-icon-open-in-new.js +1 -40
  30. package/dist/components/swirl-icon-open-in-new2.js +42 -0
  31. package/dist/components/swirl-tree-navigation-item.js +109 -8
  32. package/dist/components/swirl-tree-navigation.d.ts +11 -0
  33. package/dist/components/swirl-tree-navigation.js +37 -0
  34. package/dist/components/swirl-tree-view-item.js +3 -3
  35. package/dist/components/swirl-tree-view.js +1 -1
  36. package/dist/components/swirl-video-thumbnail.js +1 -1
  37. package/dist/components/swirl-visually-hidden2.js +1 -1
  38. package/dist/esm/file-manager.entry.js +1 -1
  39. package/dist/esm/index-1878a8d8.js +20 -16
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/swirl-components.js +1 -1
  42. package/dist/esm/swirl-tree-navigation-item.entry.js +73 -6
  43. package/dist/esm/swirl-tree-navigation.entry.js +17 -0
  44. package/dist/esm/swirl-tree-view-item.entry.js +3 -3
  45. package/dist/esm/swirl-tree-view.entry.js +1 -1
  46. package/dist/esm/swirl-video-thumbnail.entry.js +1 -1
  47. package/dist/esm/swirl-visually-hidden.entry.js +1 -1
  48. package/dist/swirl-components/{p-c507b714.entry.js → p-0a3a5d03.entry.js} +1 -1
  49. package/dist/swirl-components/{p-5c68028a.entry.js → p-1dc1b709.entry.js} +1 -1
  50. package/dist/swirl-components/{p-fe5c4b5a.entry.js → p-71b363c3.entry.js} +1 -1
  51. package/dist/swirl-components/p-83134423.entry.js +1 -0
  52. package/dist/swirl-components/{p-bbe68850.entry.js → p-a7229b59.entry.js} +1 -1
  53. package/dist/swirl-components/p-f1a91555.entry.js +1 -0
  54. package/dist/swirl-components/p-f8f788e0.entry.js +1 -0
  55. package/dist/swirl-components/swirl-components.css +1 -1
  56. package/dist/swirl-components/swirl-components.esm.js +1 -1
  57. package/dist/types/components/swirl-tree-navigation/swirl-tree-navigation.d.ts +4 -0
  58. package/dist/types/components/swirl-tree-navigation/swirl-tree-navigation.stories.d.ts +14 -0
  59. package/dist/types/components/swirl-tree-navigation-item/swirl-tree-navigation-item.d.ts +18 -1
  60. package/dist/types/components/swirl-tree-navigation-item/swirl-tree-navigation-item.stories.d.ts +0 -10
  61. package/dist/types/components.d.ts +41 -0
  62. package/package.json +1 -1
  63. package/vscode-data.json +29 -0
  64. package/dist/swirl-components/p-c39457bd.entry.js +0 -1
  65. package/dist/swirl-components/p-cedca96d.entry.js +0 -1
@@ -0,0 +1,12 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ :host * {
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .tree-navigation {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
@@ -0,0 +1,42 @@
1
+ import { h, Host } from "@stencil/core";
2
+ export class SwirlTreeNavigation {
3
+ constructor() {
4
+ this.label = undefined;
5
+ }
6
+ render() {
7
+ return (h(Host, { key: 'f835261b423e4be4734248f87d4d85beb0d1e6b1' }, h("ul", { key: 'c877a5d4ba5ef4038d600ebd997bc6594a6d5672', "aria-label": this.label, class: "tree-navigation", role: "tree" }, h("slot", { key: '3ca7889623881b4b3f7e38050435d0f2c82d8782' }))));
8
+ }
9
+ static get is() { return "swirl-tree-navigation"; }
10
+ static get encapsulation() { return "shadow"; }
11
+ static get originalStyleUrls() {
12
+ return {
13
+ "$": ["swirl-tree-navigation.css"]
14
+ };
15
+ }
16
+ static get styleUrls() {
17
+ return {
18
+ "$": ["swirl-tree-navigation.css"]
19
+ };
20
+ }
21
+ static get properties() {
22
+ return {
23
+ "label": {
24
+ "type": "string",
25
+ "mutable": false,
26
+ "complexType": {
27
+ "original": "string",
28
+ "resolved": "string",
29
+ "references": {}
30
+ },
31
+ "required": true,
32
+ "optional": false,
33
+ "docs": {
34
+ "tags": [],
35
+ "text": ""
36
+ },
37
+ "attribute": "label",
38
+ "reflect": false
39
+ }
40
+ };
41
+ }
42
+ }
@@ -0,0 +1,19 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { SwirlTreeNavigation } from "./swirl-tree-navigation";
3
+ describe("swirl-tree-navigation", () => {
4
+ it("renders", async () => {
5
+ const page = await newSpecPage({
6
+ components: [SwirlTreeNavigation],
7
+ html: `<swirl-tree-navigation label="navigation"></swirl-tree-navigation>`,
8
+ });
9
+ expect(page.root).toEqualHtml(`
10
+ <swirl-tree-navigation label="navigation">
11
+ <mock:shadow-root>
12
+ <ul aria-label="navigation" class="tree-navigation" role="tree">
13
+ <slot></slot>
14
+ </ul>
15
+ </mock:shadow-root>
16
+ </swirl-tree-navigation>
17
+ `);
18
+ });
19
+ });
@@ -0,0 +1,32 @@
1
+ import { generateStoryElement } from "../../utils";
2
+ import Docs from "./swirl-tree-navigation.mdx";
3
+ export default {
4
+ component: "swirl-tree-navigation",
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ docs: {
8
+ page: Docs,
9
+ },
10
+ },
11
+ title: "Admin/SwirlTreeNavigation",
12
+ };
13
+ const Template = (args) => {
14
+ const element = generateStoryElement("swirl-tree-navigation", args);
15
+ element.innerHTML = `
16
+ <swirl-tree-navigation-item label="Home" icon='home' href='#home'></swirl-tree-navigation-item>
17
+ <swirl-tree-navigation-item label="User Management" icon='person'>
18
+ <swirl-tree-navigation-item label="Users" active='true' href='#users'></swirl-tree-navigation-item>
19
+ <swirl-tree-navigation-item label="User groups" href='#user-groups'></swirl-tree-navigation-item>
20
+ </swirl-tree-navigation-item>
21
+ <swirl-tree-navigation-item label="Settings" icon='settings'>
22
+ <swirl-tree-navigation-item label="Languages" href='#users'></swirl-tree-navigation-item>
23
+ <swirl-tree-navigation-item label="General" href='#user-groups'></swirl-tree-navigation-item>
24
+ </swirl-tree-navigation-item>
25
+ <swirl-tree-navigation-item href='https://getflip.com' target='__blank' label="File" icon='file' external='true'></swirl-tree-navigation-item>
26
+ `;
27
+ return element;
28
+ };
29
+ export const SwirlTreeNavigation = Template.bind({});
30
+ SwirlTreeNavigation.args = {
31
+ label: "Label",
32
+ };
@@ -3,74 +3,128 @@
3
3
  width: 100%;
4
4
  }
5
5
 
6
- :host * {
7
- box-sizing: border-box;
8
- }
6
+ :host * {
7
+ box-sizing: border-box;
8
+ }
9
9
 
10
+ /* Base item styles */
10
11
  .tree-navigation-item {
11
- display: inline-flex;
12
12
  width: 100%;
13
- height: 2.5rem;
14
- padding-right: var(--s-space-16);
15
- padding-left: calc(var(--s-space-16) + 1.5rem + var(--s-space-8));
16
- flex-shrink: 0;
17
- justify-content: flex-start;
13
+ list-style: none;
14
+ border-radius: var(--s-border-radius-sm);
15
+ }
16
+
17
+ /* Link styles */
18
+ .tree-navigation-item__link {
19
+ display: inline-flex;
18
20
  align-items: center;
21
+ width: 100%;
22
+ height: 2.25rem;
23
+ padding: 0 var(--s-space-16) 0 var(--tree-nav-item-padding, var(--s-space-8));
24
+ margin-bottom: var(--s-space-2);
25
+ gap: calc(var(--s-space-4) - var(--s-space-2));
26
+ min-width: 0;
27
+
28
+ /* Reset button/link styles */
19
29
  border: none;
20
- color: var(--s-text-default);
21
30
  background-color: transparent;
31
+ color: var(--s-text-default);
32
+ cursor: pointer;
33
+ text-decoration: none;
34
+
35
+ /* Typography */
22
36
  font: inherit;
23
37
  font-size: var(--s-font-size-sm);
38
+ font-weight: var(--tree-nav-item-label-weight, var(--s-font-weight-medium));
24
39
  line-height: var(--s-line-height-sm);
25
- text-decoration: none;
26
- cursor: pointer;
27
- gap: calc(var(--s-space-8) - var(--s-space-2));
40
+
41
+ /* Border radius */
42
+ border-radius: var(--s-border-radius-sm);
28
43
  }
29
44
 
30
- .tree-navigation-item:hover {
31
- background-color: var(--s-surface-hovered);
32
- }
45
+ /* Link states */
46
+ .tree-navigation-item__link:hover {
47
+ background-color: var(--s-background-hovered);
48
+ }
33
49
 
34
- .tree-navigation-item:active {
35
- background-color: var(--s-surface-pressed);
36
- }
50
+ .tree-navigation-item__link:active {
51
+ background-color: var(--s-background-pressed);
52
+ }
37
53
 
38
- .tree-navigation-item:focus {
39
- outline: none;
40
- }
54
+ .tree-navigation-item__link:focus {
55
+ outline: none;
56
+ }
41
57
 
42
- .tree-navigation-item:focus-visible .tree-navigation-item__label {
43
- border-radius: var(--s-border-radius-xs);
44
- box-shadow: 0 0 0 0.125rem var(--s-focus-default);
45
- }
58
+ .tree-navigation-item__link:focus-visible .tree-navigation-item__label {
59
+ border-radius: var(--s-border-radius-xs);
60
+ box-shadow: 0 0 0 0.125rem var(--s-focus-default);
61
+ }
46
62
 
47
- .tree-navigation-item--active {
63
+ /* Active link styles */
64
+ .tree-navigation-item__link--active {
48
65
  background-color: var(--s-surface-raised-default);
49
- box-shadow: inset 0.25rem 0 0 0 var(--s-border-highlight);
66
+ color: var(--tree-nav-item-color--active, var(--s-text-highlight));
67
+ --tree-nav-item-label-weight: var(--s-font-weight-medium);
50
68
  }
51
69
 
52
- .tree-navigation-item--active:hover {
70
+ .tree-navigation-item__link--active:hover {
53
71
  background-color: var(--s-surface-raised-hovered);
54
72
  }
55
73
 
56
- .tree-navigation-item--active:active {
74
+ .tree-navigation-item__link--active:active {
57
75
  background-color: var(--s-surface-raised-pressed);
58
76
  }
59
77
 
60
- .tree-navigation-item--has-icon {
61
- padding-left: var(--s-space-16);
78
+ /* Layout components */
79
+ .tree-navigation-item--expanded {
80
+ height: 100%;
62
81
  }
63
82
 
83
+ .tree-navigation-item__content {
84
+ display: inline-flex;
85
+ align-items: center;
86
+ min-width: 0;
87
+ flex: 1;
88
+ }
89
+
90
+ /* Icon styles */
64
91
  .tree-navigation-item__icon {
65
92
  display: inline-flex;
66
93
  flex-shrink: 0;
94
+ padding-right: var(--s-space-8);
67
95
  }
68
96
 
97
+ .tree-navigation-item__toggle-icon {
98
+ flex-shrink: 0;
99
+ max-height: 1rem;
100
+ color: var(--s-icon-default);
101
+ }
102
+
103
+ .tree-navigation-item__external-icon {
104
+ max-height: 1rem;
105
+ color: var(--s-icon-default);
106
+ }
107
+
108
+ /* Label styles */
69
109
  .tree-navigation-item__label {
70
110
  overflow: hidden;
71
111
  min-width: 0;
72
- padding-right: var(--s-space-2);
73
- padding-left: var(--s-space-2);
112
+ padding: 0 var(--s-space-2);
74
113
  white-space: nowrap;
75
114
  text-overflow: ellipsis;
115
+ color: var(--tree-nav-item-color, inherit);
116
+ }
117
+
118
+ /* Children container */
119
+ .tree-navigation-item__children {
120
+ display: flex;
121
+ flex-direction: column;
122
+ margin: 0;
123
+ padding: 0;
124
+ }
125
+
126
+ /* Nested items */
127
+ .tree-navigation-item__children > ::slotted(swirl-tree-navigation-item) {
128
+ --tree-nav-item-padding: 2.25rem;
129
+ --tree-nav-item-label-weight: var(--s-font-weight-normal);
76
130
  }
@@ -1,21 +1,84 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
3
  export class SwirlTreeNavigationItem {
4
4
  constructor() {
5
+ this.buttonId = `${this.navigationItemId}-button`;
6
+ this.childrenId = `${this.navigationItemId}-children`;
7
+ this.onKeyDown = (event) => {
8
+ switch (event.key) {
9
+ case " ":
10
+ event.preventDefault();
11
+ this.toggleExpanded(event);
12
+ break;
13
+ case "ArrowRight":
14
+ event.preventDefault();
15
+ if (!this.expanded && this.hasChildren) {
16
+ this.expand();
17
+ }
18
+ break;
19
+ case "ArrowLeft":
20
+ event.preventDefault();
21
+ if (this.expanded) {
22
+ this.collapse();
23
+ }
24
+ break;
25
+ }
26
+ };
27
+ this.toggleExpanded = (event) => {
28
+ if (!this.href) {
29
+ event.preventDefault();
30
+ event.stopPropagation();
31
+ if (this.expanded) {
32
+ this.collapse();
33
+ }
34
+ else {
35
+ this.expand();
36
+ }
37
+ }
38
+ };
5
39
  this.active = undefined;
6
40
  this.href = undefined;
7
41
  this.icon = undefined;
8
42
  this.label = undefined;
9
43
  this.target = undefined;
44
+ this.navigationItemId = undefined;
45
+ this.level = 1;
46
+ this.expandable = true;
47
+ this.external = false;
48
+ this.expanded = false;
49
+ this.hasChildren = false;
50
+ }
51
+ componentWillLoad() {
52
+ this.checkForChildren();
53
+ }
54
+ handleExpandedChange() {
55
+ this.expansionChange.emit(this.expanded);
56
+ }
57
+ checkForChildren() {
58
+ this.hasChildren = Boolean(this.el.querySelector("swirl-tree-navigation-item"));
59
+ }
60
+ async expand() {
61
+ if (this.expanded || !this.expandable || !this.hasChildren) {
62
+ return;
63
+ }
64
+ this.expanded = true;
65
+ }
66
+ async collapse() {
67
+ if (!this.expanded || !this.expandable || !this.hasChildren) {
68
+ return;
69
+ }
70
+ this.expanded = false;
10
71
  }
11
72
  render() {
12
73
  const isLink = Boolean(this.href);
13
74
  const Tag = isLink ? "a" : "button";
14
- const className = classnames("tree-navigation-item", {
15
- "tree-navigation-item--active": this.active,
16
- "tree-navigation-item--has-icon": Boolean(this.icon),
75
+ const linkClassName = classnames("tree-navigation-item__link", {
76
+ "tree-navigation-item__link--active": this.active,
77
+ "tree-navigation-item__link--has-icon": Boolean(this.icon),
17
78
  });
18
- return (h(Host, { key: 'f9cadfd076d14950488b114f4efbab0330a70172' }, h(Tag, { key: 'b78001b5376e0c1f0e4d97965f5fa3d6e316414f', class: className, href: this.href, target: this.target, type: isLink ? undefined : "button" }, this.icon && (h("span", { key: '48fceebb6c56be3f2a96a7411f581698bfa4f8b7', class: "tree-navigation-item__icon", innerHTML: this.icon })), h("span", { key: 'b3de5413ab8b45e98f455fbd1873b1d9c25eb6d5', class: "tree-navigation-item__label" }, this.label))));
79
+ return (h(Host, { key: 'e3bfad9988e2f3fd9d7b2d92bed466008bddee46', role: "none" }, h("li", { key: 'eb1da2091f8168ca76b5356b5747139e59c73845', class: "tree-navigation-item", role: "treeitem", "aria-expanded": this.hasChildren ? this.expanded : undefined, "aria-level": this.level }, h(Tag, { key: 'c630c70f43bd45758d929c14026c9c28941d082e', onClick: this.toggleExpanded, onKeyDown: this.onKeyDown, class: linkClassName, href: this.href, target: this.target, type: isLink ? undefined : "button", id: this.buttonId, "aria-current": this.active ? "page" : undefined, "aria-controls": this.hasChildren ? this.childrenId : undefined, "aria-expanded": this.hasChildren ? this.expanded : undefined }, h("span", { key: '0001a3da5777d5ba7d98a862433a3340c523722e', class: "tree-navigation-item__content" }, this.icon && (h("swirl-icon", { key: 'c1671f5761c2a6554309da4a22eeac8be12aa0da', class: "tree-navigation-item__icon", glyph: this.icon, size: 20, "aria-hidden": "true", role: "img", "aria-label": `${this.label} icon` })), h("span", { key: 'c21401058cdcd0b8a695f42adfddf867b7295286', class: "tree-navigation-item__label" }, this.label)), this.expandable && this.hasChildren && !this.external && (h("span", { key: 'b2213d840c108846a0f2ba776ee3ff733a75b95f', class: "tree-navigation-item__toggle-icon", "aria-hidden": "true" }, this.expanded ? (h("swirl-icon-expand-more", { size: 16, role: "img", "aria-label": "Collapse" })) : (h("swirl-icon-chevron-right", { size: 16, role: "img", "aria-label": "Expand" })))), this.external && (h("span", { key: '818cb51c0ea3330392f87cc3aa429974bd363d12', class: "tree-navigation-item__external-icon", "aria-hidden": "true" }, h("swirl-icon-open-in-new", { key: 'ef01b1ca0fd70fd0c85ae80ab914ab89b407a56c', size: 16, role: "img", "aria-label": "External link" })))), this.hasChildren && (h("ul", { key: 'c576a994a7434de80b2945798b46118950cb6b1b', class: "tree-navigation-item__children", id: this.childrenId, role: "group", "aria-label": `${this.label} submenu`, style: {
80
+ display: !this.expanded ? "none" : undefined,
81
+ } }, h("slot", { key: 'cf31e4f6c71cc39028f2aa5d2748fd3798c3c393' }))))));
19
82
  }
20
83
  static get is() { return "swirl-tree-navigation-item"; }
21
84
  static get encapsulation() { return "shadow"; }
@@ -115,8 +178,147 @@ export class SwirlTreeNavigationItem {
115
178
  },
116
179
  "attribute": "target",
117
180
  "reflect": false
181
+ },
182
+ "navigationItemId": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": true,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": ""
195
+ },
196
+ "attribute": "navigation-item-id",
197
+ "reflect": false
198
+ },
199
+ "level": {
200
+ "type": "number",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "number",
204
+ "resolved": "number",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": true,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": ""
212
+ },
213
+ "attribute": "level",
214
+ "reflect": false,
215
+ "defaultValue": "1"
216
+ },
217
+ "expandable": {
218
+ "type": "boolean",
219
+ "mutable": false,
220
+ "complexType": {
221
+ "original": "boolean",
222
+ "resolved": "boolean",
223
+ "references": {}
224
+ },
225
+ "required": false,
226
+ "optional": true,
227
+ "docs": {
228
+ "tags": [],
229
+ "text": ""
230
+ },
231
+ "attribute": "expandable",
232
+ "reflect": false,
233
+ "defaultValue": "true"
234
+ },
235
+ "external": {
236
+ "type": "boolean",
237
+ "mutable": false,
238
+ "complexType": {
239
+ "original": "boolean",
240
+ "resolved": "boolean",
241
+ "references": {}
242
+ },
243
+ "required": false,
244
+ "optional": true,
245
+ "docs": {
246
+ "tags": [],
247
+ "text": ""
248
+ },
249
+ "attribute": "external",
250
+ "reflect": false,
251
+ "defaultValue": "false"
252
+ }
253
+ };
254
+ }
255
+ static get states() {
256
+ return {
257
+ "expanded": {},
258
+ "hasChildren": {}
259
+ };
260
+ }
261
+ static get events() {
262
+ return [{
263
+ "method": "expansionChange",
264
+ "name": "expansionChange",
265
+ "bubbles": true,
266
+ "cancelable": true,
267
+ "composed": true,
268
+ "docs": {
269
+ "tags": [],
270
+ "text": ""
271
+ },
272
+ "complexType": {
273
+ "original": "boolean",
274
+ "resolved": "boolean",
275
+ "references": {}
276
+ }
277
+ }];
278
+ }
279
+ static get methods() {
280
+ return {
281
+ "expand": {
282
+ "complexType": {
283
+ "signature": "() => Promise<void>",
284
+ "parameters": [],
285
+ "references": {
286
+ "Promise": {
287
+ "location": "global",
288
+ "id": "global::Promise"
289
+ }
290
+ },
291
+ "return": "Promise<void>"
292
+ },
293
+ "docs": {
294
+ "text": "",
295
+ "tags": []
296
+ }
297
+ },
298
+ "collapse": {
299
+ "complexType": {
300
+ "signature": "() => Promise<void>",
301
+ "parameters": [],
302
+ "references": {
303
+ "Promise": {
304
+ "location": "global",
305
+ "id": "global::Promise"
306
+ }
307
+ },
308
+ "return": "Promise<void>"
309
+ },
310
+ "docs": {
311
+ "text": "",
312
+ "tags": []
313
+ }
118
314
  }
119
315
  };
120
316
  }
121
317
  static get elementRef() { return "el"; }
318
+ static get watchers() {
319
+ return [{
320
+ "propName": "expanded",
321
+ "methodName": "handleExpandedChange"
322
+ }];
323
+ }
122
324
  }
@@ -7,16 +7,18 @@ describe("swirl-tree-navigation-item", () => {
7
7
  html: `<swirl-tree-navigation-item icon="Icon" label="Label"></swirl-tree-navigation-item>`,
8
8
  });
9
9
  expect(page.root).toMatchInlineSnapshot(`
10
- <swirl-tree-navigation-item icon="Icon" label="Label">
10
+ <swirl-tree-navigation-item icon="Icon" label="Label" role="none">
11
11
  <mock:shadow-root>
12
- <button class="tree-navigation-item tree-navigation-item--has-icon" type="button">
13
- <span class="tree-navigation-item__icon">
14
- Icon
15
- </span>
16
- <span class="tree-navigation-item__label">
17
- Label
18
- </span>
19
- </button>
12
+ <li aria-level="1" class="tree-navigation-item" role="treeitem">
13
+ <button class="tree-navigation-item__link tree-navigation-item__link--has-icon" id="undefined-button" type="button">
14
+ <span class="tree-navigation-item__content">
15
+ <swirl-icon aria-hidden="true" aria-label="Label icon" class="tree-navigation-item__icon" glyph="Icon" role="img" size="20"></swirl-icon>
16
+ <span class="tree-navigation-item__label">
17
+ Label
18
+ </span>
19
+ </span>
20
+ </button>
21
+ </li>
20
22
  </mock:shadow-root>
21
23
  </swirl-tree-navigation-item>
22
24
  `);
@@ -26,6 +28,9 @@ describe("swirl-tree-navigation-item", () => {
26
28
  components: [SwirlTreeNavigationItem],
27
29
  html: `<swirl-tree-navigation-item active="true" label="Label"></swirl-tree-navigation-item>`,
28
30
  });
29
- expect(page.root.shadowRoot.children[0].classList.contains("tree-navigation-item--active")).toBeTruthy();
31
+ // Update to check for the new active class on the link element
32
+ expect(page.root.shadowRoot
33
+ .querySelector(".tree-navigation-item__link")
34
+ .classList.contains("tree-navigation-item__link--active")).toBeTruthy();
30
35
  });
31
36
  });
@@ -1,16 +1,6 @@
1
1
  import { generateStoryElement } from "../../utils";
2
2
  import Docs from "./swirl-tree-navigation-item.mdx";
3
3
  export default {
4
- argTypes: {
5
- icon: {
6
- table: {
7
- type: {
8
- detail: "e.g. <swirl-icon-close></swirl-icon-close>",
9
- summary: "swirl-icon-*",
10
- },
11
- },
12
- },
13
- },
14
4
  component: "swirl-tree-navigation-item",
15
5
  tags: ["autodocs"],
16
6
  parameters: {
@@ -26,6 +16,6 @@ const Template = (args) => {
26
16
  };
27
17
  export const SwirlTreeNavigationItem = Template.bind({});
28
18
  SwirlTreeNavigationItem.args = {
29
- icon: "<swirl-icon-arrow-right-small></swirl-icon-arrow-right-small>",
19
+ icon: "file",
30
20
  label: "Label",
31
21
  };
@@ -192,7 +192,7 @@ export class SwirlTreeView {
192
192
  return nestedSibling ?? undefined;
193
193
  }
194
194
  render() {
195
- return (h(Host, { key: 'f6cd60716528a4bc08ae34b7f7b8bcc468fa87af' }, h("ul", { key: '5353f9e9f359c6b3eeb53107d47cc62ec8820a9e', "aria-label": this.label, class: "tree-view", role: "tree" }, h("slot", { key: '93f6e2df68fb6c837a185c24c8f8afc53faba4f0', onSlotchange: this.onSlotChange }))));
195
+ return (h(Host, { key: 'c4594413feaa68e716f32654673a69145a05458e' }, h("ul", { key: 'c329031d71b7261db724c736feea3a91108cc781', "aria-label": this.label, class: "tree-view", role: "tree" }, h("slot", { key: 'eb0795310248879201115103569038c179deb980', onSlotchange: this.onSlotChange }))));
196
196
  }
197
197
  static get is() { return "swirl-tree-view"; }
198
198
  static get encapsulation() { return "shadow"; }
@@ -74,11 +74,11 @@ export class SwirlTreeViewItem {
74
74
  "tree-view-item--has-tags": hasTags,
75
75
  });
76
76
  const hasChildren = Boolean(this.el.querySelector("swirl-tree-view-item"));
77
- return (h(Host, { key: '0e2af8248203e90bbac24ada811a3227821b215c', id: this.itemId, role: "none" }, h("li", { key: 'ffb0b8a5d984855cea00b7d55c6c5e1a7abae87e', class: className, role: "none" }, h("a", { key: 'c38f8b1c4dfdbdd36c99482901d2a47d976d3586', "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, style: {
77
+ return (h(Host, { key: 'a586d7bdd3d312b4cdcf38399344bda0526953ff', id: this.itemId, role: "none" }, h("li", { key: 'c1753b03121d4a379eb9987dea274f36b4bcf81f', class: className, role: "none" }, h("a", { key: 'a6d93db38529deafc481a23f04492fb022ef808d', "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, style: {
78
78
  paddingLeft: `calc(${this.level} * var(--s-space-12) + var(--s-space-${this.expandable ? "4" : "8"}))`,
79
- }, ref: (el) => (this.link = el), role: "treeitem", tabIndex: this.selected ? 0 : -1 }, this.expandable && (h("span", { key: '8f37cc76cc31d7be558ef88afe7a4b7d53573b54', class: "tree-view-item__toggle-icon" }, hasChildren && (h(Fragment, { key: '13d0b9b334ea8a98788e0b2552506f95977d1910' }, 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: '180aeb1daf320302256c2a810d61c7b11e5cd4d6' }, h("span", { key: '2c210128e558c257376d5d553865795f95a3b762', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (h("swirl-icon", { glyph: this.icon, size: 24, color: this.iconColor }))))), h("span", { key: '0278c88a4d7d87d0bdf9b4af007840822e83aa65', class: "tree-view-item__label" }, this.label), h("span", { key: '8ba4b1e0b5c82a12fbac7ba4333e2b5aa8ada3d2', class: "tree-view-item__tags" }, h("slot", { key: '1e03e13118893e30f699c2c09c616eef7da980c2', name: "tags" }))), h("ul", { key: 'cc47c02c20d6819618caee618d7489436ec41b72', "aria-label": this.label, class: "tree-view-item__children", id: `${this.itemId}-children`, role: "group", style: {
79
+ }, ref: (el) => (this.link = el), role: "treeitem", tabIndex: this.selected ? 0 : -1 }, this.expandable && (h("span", { key: 'd24b8263d4cebdaf9d2624115e5d013cf4889b83', class: "tree-view-item__toggle-icon" }, hasChildren && (h(Fragment, { key: '388c9048b2a89c9e81aef48fa0b57dd6d1c2844c' }, 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: '3f777177322b411d8a85dbda1f4cac21620e9ce3' }, h("span", { key: 'e99d17c654386c5dea9026edacad342d2693b16c', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (h("swirl-icon", { glyph: this.icon, size: 24, color: this.iconColor }))))), h("span", { key: 'f929b088d3698229063fc62e2a0c5740ff22f1ec', class: "tree-view-item__label" }, this.label), h("span", { key: 'e091236fc48506b89af4f984f2a313540576b272', class: "tree-view-item__tags" }, h("slot", { key: 'ba8fabb6e95172aea1a9a7fdb8853452a712055a', name: "tags" }))), h("ul", { key: '9627a321c8d54d72d34b3239fc03d6b0e46eeffc', "aria-label": this.label, class: "tree-view-item__children", id: `${this.itemId}-children`, role: "group", style: {
80
80
  display: !this.expanded || !hasChildren ? "none" : undefined,
81
- } }, h("slot", { key: '24784fcc3a80d13b36e9a2a66e7dc3be5943d347' })))));
81
+ } }, h("slot", { key: '0fb8e1a8190e6c31dd49315e9696da198297af19' })))));
82
82
  }
83
83
  static get is() { return "swirl-tree-view-item"; }
84
84
  static get encapsulation() { return "scoped"; }
@@ -7,7 +7,7 @@ export class SwirlVideoThumbnail {
7
7
  this.src = undefined;
8
8
  }
9
9
  render() {
10
- return (h(Host, { key: '5bece81a92879404b264d43716fc8c4c6221fa1e' }, h("button", { key: '208242ba2a4db8bee97a3459483ef230865021c4', "aria-describedby": this.duration !== undefined ? "duration" : undefined, "aria-label": this.label, class: "video-thumbnail", type: "button" }, h("img", { key: 'bb371fe167c3f4a5a2e6a5951226a098375d89d2', alt: "", class: "video-thumbnail__image", loading: "lazy", src: this.src }), this.duration && (h("span", { key: '9099ba6df115019e0e3e6caf68b18678936d2376', class: "video-thumbnail__duration", id: "duration" }, h("swirl-visually-hidden", { key: '3285eca5bb93ffd981fa66821b7810c22859e0d8' }, this.durationLabel), this.duration)), h("svg", { key: '127b1082041d0dea0f6d6c3015d1b967ad786156', class: "video-thumbnail__play-icon", fill: "none", viewBox: "0 0 40 40", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '1b83f69e25704549ff46c422d31e50ad881fbe1c', d: "M15 14.65V25.35C15 26.1167 15.35 26.7 16.05 27.1C16.75 27.5 17.4333 27.4667 18.1 27L26.4 21.7C27.0333 21.3 27.35 20.7333 27.35 20C27.35 19.2667 27.0333 18.7 26.4 18.3L18.1 13C17.4333 12.5333 16.75 12.5 16.05 12.9C15.35 13.3 15 13.8833 15 14.65ZM20 40C17.2333 40 14.6333 39.4747 12.2 38.424C9.76667 37.3747 7.65 35.95 5.85 34.15C4.05 32.35 2.62533 30.2333 1.576 27.8C0.525334 25.3667 0 22.7667 0 20C0 17.2333 0.525334 14.6333 1.576 12.2C2.62533 9.76667 4.05 7.65 5.85 5.85C7.65 4.05 9.76667 2.62467 12.2 1.574C14.6333 0.524667 17.2333 0 20 0C22.7667 0 25.3667 0.524667 27.8 1.574C30.2333 2.62467 32.35 4.05 34.15 5.85C35.95 7.65 37.3747 9.76667 38.424 12.2C39.4747 14.6333 40 17.2333 40 20C40 22.7667 39.4747 25.3667 38.424 27.8C37.3747 30.2333 35.95 32.35 34.15 34.15C32.35 35.95 30.2333 37.3747 27.8 38.424C25.3667 39.4747 22.7667 40 20 40Z", fill: "white", "fill-opacity": "0.95" })))));
10
+ return (h(Host, { key: 'd794f1583cc40b334a556369be9fd5cad5f7fb70' }, h("button", { key: 'e11c59d0cd5408f6bb3d3b5b9779c61a5ab757e5', "aria-describedby": this.duration !== undefined ? "duration" : undefined, "aria-label": this.label, class: "video-thumbnail", type: "button" }, h("img", { key: 'd384a49dc48f744b317306267567f7c1078feb6c', alt: "", class: "video-thumbnail__image", loading: "lazy", src: this.src }), this.duration && (h("span", { key: 'ebdc431ae39edf02c6f23620305d8d5fb0df9192', class: "video-thumbnail__duration", id: "duration" }, h("swirl-visually-hidden", { key: 'faed768009978536f3773a28d09e854084213a7d' }, this.durationLabel), this.duration)), h("svg", { key: '50561a309689475ac0d5ff1d836d614cd5b46909', class: "video-thumbnail__play-icon", fill: "none", viewBox: "0 0 40 40", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '5fcd54d38b882b33876f45a4d4672ee615692722', d: "M15 14.65V25.35C15 26.1167 15.35 26.7 16.05 27.1C16.75 27.5 17.4333 27.4667 18.1 27L26.4 21.7C27.0333 21.3 27.35 20.7333 27.35 20C27.35 19.2667 27.0333 18.7 26.4 18.3L18.1 13C17.4333 12.5333 16.75 12.5 16.05 12.9C15.35 13.3 15 13.8833 15 14.65ZM20 40C17.2333 40 14.6333 39.4747 12.2 38.424C9.76667 37.3747 7.65 35.95 5.85 34.15C4.05 32.35 2.62533 30.2333 1.576 27.8C0.525334 25.3667 0 22.7667 0 20C0 17.2333 0.525334 14.6333 1.576 12.2C2.62533 9.76667 4.05 7.65 5.85 5.85C7.65 4.05 9.76667 2.62467 12.2 1.574C14.6333 0.524667 17.2333 0 20 0C22.7667 0 25.3667 0.524667 27.8 1.574C30.2333 2.62467 32.35 4.05 34.15 5.85C35.95 7.65 37.3747 9.76667 38.424 12.2C39.4747 14.6333 40 17.2333 40 20C40 22.7667 39.4747 25.3667 38.424 27.8C37.3747 30.2333 35.95 32.35 34.15 34.15C32.35 35.95 30.2333 37.3747 27.8 38.424C25.3667 39.4747 22.7667 40 20 40Z", fill: "white", "fill-opacity": "0.95" })))));
11
11
  }
12
12
  static get is() { return "swirl-video-thumbnail"; }
13
13
  static get encapsulation() { return "shadow"; }
@@ -1,7 +1,7 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  export class SwirlVisuallyHidden {
3
3
  render() {
4
- return (h(Host, { key: '50e93b9287d485366e949a82ce4620d57e75898a' }, h("slot", { key: '8f2682a482b5bf224bd4855d61deaedd66866a45' })));
4
+ return (h(Host, { key: 'bb3e602678ca5fa272b507b6de5d58f3a070c698' }, h("slot", { key: '7438101a2790eb40e97379beed8afafca5324945' })));
5
5
  }
6
6
  static get is() { return "swirl-visually-hidden"; }
7
7
  static get encapsulation() { return "scoped"; }