@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.
- package/components.json +224 -7
- package/dist/cjs/file-manager.cjs.entry.js +1 -1
- package/dist/cjs/index-2ab5d772.js +20 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-tree-navigation-item.cjs.entry.js +72 -5
- package/dist/cjs/swirl-tree-navigation.cjs.entry.js +21 -0
- package/dist/cjs/swirl-tree-view-item.cjs.entry.js +3 -3
- package/dist/cjs/swirl-tree-view.cjs.entry.js +1 -1
- package/dist/cjs/swirl-video-thumbnail.cjs.entry.js +1 -1
- package/dist/cjs/swirl-visually-hidden.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.css +12 -0
- package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.js +42 -0
- package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.spec.js +19 -0
- package/dist/collection/components/swirl-tree-navigation/swirl-tree-navigation.stories.js +32 -0
- package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.css +88 -34
- package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.js +207 -5
- package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.spec.js +15 -10
- package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.stories.js +1 -11
- package/dist/collection/components/swirl-tree-view/swirl-tree-view.js +1 -1
- package/dist/collection/components/swirl-tree-view-item/swirl-tree-view-item.js +3 -3
- package/dist/collection/components/swirl-video-thumbnail/swirl-video-thumbnail.js +1 -1
- package/dist/collection/components/swirl-visually-hidden/swirl-visually-hidden.js +1 -1
- package/dist/collection/prototypes/file-manager/file-manager.js +1 -1
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/file-manager.js +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/swirl-icon-open-in-new.js +1 -40
- package/dist/components/swirl-icon-open-in-new2.js +42 -0
- package/dist/components/swirl-tree-navigation-item.js +109 -8
- package/dist/components/swirl-tree-navigation.d.ts +11 -0
- package/dist/components/swirl-tree-navigation.js +37 -0
- package/dist/components/swirl-tree-view-item.js +3 -3
- package/dist/components/swirl-tree-view.js +1 -1
- package/dist/components/swirl-video-thumbnail.js +1 -1
- package/dist/components/swirl-visually-hidden2.js +1 -1
- package/dist/esm/file-manager.entry.js +1 -1
- package/dist/esm/index-1878a8d8.js +20 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-tree-navigation-item.entry.js +73 -6
- package/dist/esm/swirl-tree-navigation.entry.js +17 -0
- package/dist/esm/swirl-tree-view-item.entry.js +3 -3
- package/dist/esm/swirl-tree-view.entry.js +1 -1
- package/dist/esm/swirl-video-thumbnail.entry.js +1 -1
- package/dist/esm/swirl-visually-hidden.entry.js +1 -1
- package/dist/swirl-components/{p-c507b714.entry.js → p-0a3a5d03.entry.js} +1 -1
- package/dist/swirl-components/{p-5c68028a.entry.js → p-1dc1b709.entry.js} +1 -1
- package/dist/swirl-components/{p-fe5c4b5a.entry.js → p-71b363c3.entry.js} +1 -1
- package/dist/swirl-components/p-83134423.entry.js +1 -0
- package/dist/swirl-components/{p-bbe68850.entry.js → p-a7229b59.entry.js} +1 -1
- package/dist/swirl-components/p-f1a91555.entry.js +1 -0
- package/dist/swirl-components/p-f8f788e0.entry.js +1 -0
- package/dist/swirl-components/swirl-components.css +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-tree-navigation/swirl-tree-navigation.d.ts +4 -0
- package/dist/types/components/swirl-tree-navigation/swirl-tree-navigation.stories.d.ts +14 -0
- package/dist/types/components/swirl-tree-navigation-item/swirl-tree-navigation-item.d.ts +18 -1
- package/dist/types/components/swirl-tree-navigation-item/swirl-tree-navigation-item.stories.d.ts +0 -10
- package/dist/types/components.d.ts +41 -0
- package/package.json +1 -1
- package/vscode-data.json +29 -0
- package/dist/swirl-components/p-c39457bd.entry.js +0 -1
- package/dist/swirl-components/p-cedca96d.entry.js +0 -1
|
@@ -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
|
+
};
|
package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.css
CHANGED
|
@@ -3,74 +3,128 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
|
|
41
|
+
/* Border radius */
|
|
42
|
+
border-radius: var(--s-border-radius-sm);
|
|
28
43
|
}
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
/* Link states */
|
|
46
|
+
.tree-navigation-item__link:hover {
|
|
47
|
+
background-color: var(--s-background-hovered);
|
|
48
|
+
}
|
|
33
49
|
|
|
34
|
-
.tree-navigation-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
.tree-navigation-item__link:active {
|
|
51
|
+
background-color: var(--s-background-pressed);
|
|
52
|
+
}
|
|
37
53
|
|
|
38
|
-
.tree-navigation-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
.tree-navigation-item__link:focus {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
41
57
|
|
|
42
|
-
.tree-navigation-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
63
|
+
/* Active link styles */
|
|
64
|
+
.tree-navigation-item__link--active {
|
|
48
65
|
background-color: var(--s-surface-raised-default);
|
|
49
|
-
|
|
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-
|
|
70
|
+
.tree-navigation-item__link--active:hover {
|
|
53
71
|
background-color: var(--s-surface-raised-hovered);
|
|
54
72
|
}
|
|
55
73
|
|
|
56
|
-
.tree-navigation-
|
|
74
|
+
.tree-navigation-item__link--active:active {
|
|
57
75
|
background-color: var(--s-surface-raised-pressed);
|
|
58
76
|
}
|
|
59
77
|
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
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
|
|
15
|
-
"tree-navigation-
|
|
16
|
-
"tree-navigation-
|
|
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: '
|
|
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
|
}
|
package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.spec.js
CHANGED
|
@@ -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
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
});
|
package/dist/collection/components/swirl-tree-navigation-item/swirl-tree-navigation-item.stories.js
CHANGED
|
@@ -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: "
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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"; }
|