@getflip/swirl-components 0.25.0 → 0.26.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 +101 -11
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-icon.cjs.entry.js +38 -0
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-search.cjs.entry.js +1 -0
- package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
- package/dist/cjs/swirl-shell-navigation-item.cjs.entry.js +3 -14
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/swirl-app-icon/swirl-app-icon.css +46 -0
- package/dist/collection/components/swirl-app-icon/swirl-app-icon.js +100 -0
- package/dist/collection/components/swirl-app-icon/swirl-app-icon.stories.js +19 -0
- package/dist/collection/components/swirl-search/swirl-search.js +1 -0
- package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.css +10 -19
- package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.stories.js +24 -13
- package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.css +57 -19
- package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.js +9 -17
- package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.stories.js +4 -11
- package/dist/components/swirl-app-icon.d.ts +11 -0
- package/dist/components/swirl-app-icon.js +58 -0
- package/dist/components/swirl-badge.js +1 -44
- package/dist/components/swirl-badge2.js +46 -0
- package/dist/components/swirl-search.js +1 -0
- package/dist/components/swirl-shell-layout.js +1 -1
- package/dist/components/swirl-shell-navigation-item.js +11 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-icon.entry.js +34 -0
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-search.entry.js +1 -0
- package/dist/esm/swirl-shell-layout.entry.js +1 -1
- package/dist/esm/swirl-shell-navigation-item.entry.js +3 -14
- package/dist/swirl-components/p-774483bc.entry.js +1 -0
- package/dist/swirl-components/p-8660e5dc.entry.js +1 -0
- package/dist/swirl-components/p-93632f1e.entry.js +1 -0
- package/dist/swirl-components/p-d20d4033.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-app-icon/swirl-app-icon.d.ts +9 -0
- package/dist/types/components/swirl-app-icon/swirl-app-icon.stories.d.ts +13 -0
- package/dist/types/components/swirl-shell-navigation-item/swirl-shell-navigation-item.d.ts +4 -4
- package/dist/types/components/swirl-shell-navigation-item/swirl-shell-navigation-item.stories.d.ts +0 -10
- package/dist/types/components.d.ts +21 -2
- package/package.json +1 -1
- package/vscode-data.json +22 -1
- package/dist/swirl-components/p-46fbe505.entry.js +0 -1
- package/dist/swirl-components/p-55a955aa.entry.js +0 -1
- package/dist/swirl-components/p-ea644e10.entry.js +0 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-83363034.js');
|
|
6
6
|
const index$1 = require('./index-2ddd0598.js');
|
|
7
7
|
|
|
8
|
-
const swirlShellNavigationItemCss = ":host{display:inline-flex
|
|
8
|
+
const swirlShellNavigationItemCss = "/**\n* seems the container query does not work as expected\n*/\n\n:host {\n container-type: inline-size;\n position: relative;\n display: inline-flex;\n width: 100%;\n height: 3.5rem;\n padding-right: var(--s-space-12);\n padding-left: var(--s-space-12);\n flex-shrink: 0;\n justify-content: flex-start;\n align-items: center;\n color: var(--s-text-default);\n background-color: var(--s-surface-default);\n font-size: var(--s-font-size-sm);\n font-weight: var(--s-font-weight-medium);\n line-height: var(--s-line-height-sm);\n cursor: pointer;\n gap: var(--s-space-12);\n}\n\n:host(:hover) {\n background-color: var(--s-surface-hovered);\n }\n\n:host(:active) {\n background-color: var(--s-surface-pressed);\n color: var(--s-text-highlight);\n }\n\n:host(:focus) {\n outline: none;\n }\n\n:host(:focus-visible) .shell-navigation-item__label {\n border-radius: var(--s-border-radius-xs);\n box-shadow: 0 0 0 0.125rem var(--s-focus-default);\n }\n\n:host(.shell-navigation-item--active) {\n color: var(--s-text-highlight);\n background-color: var(--s-surface-raised-default);\n }\n\n:host(.shell-navigation-item--active:hover) {\n background-color: var(--s-surface-raised-hovered);\n }\n\n:host(.shell-navigation-item--active:active) {\n background-color: var(--s-surface-raised-pressed);\n color: var(--s-text-highlight);\n }\n\n:host * {\n box-sizing: border-box;\n }\n\n:host:before {\n content: \"\";\n display: none;\n position: absolute;\n left: 0;\n height: 2.5rem;\n width: 4px;\n background-color: var(--s-icon-highlight);\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n\n:host(.shell-navigation-item--active):before {\n display: block;\n}\n\n.shell-navigation-item__icon {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n min-width: 2.5rem;\n min-height: 2.5rem;\n}\n\n.shell-navigation-item__label {\n overflow: hidden;\n min-width: 0;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n@container (max-width: 4rem) {\n .shell-navigation-item__label {\n display: none;\n }\n\n .shell-navigation-item__badge {\n position: absolute;\n bottom: 0;\n right: var(--s-space-4);\n }\n}\n\n@container (min-width: 14rem) {\n .shell-navigation-item__badge {\n margin-left: auto;\n padding-right: var(--s-space-4);\n }\n}\n";
|
|
9
9
|
|
|
10
10
|
const SwirlShellNavigationItem = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -17,25 +17,14 @@ const SwirlShellNavigationItem = class {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
this.active = undefined;
|
|
20
|
-
this.
|
|
20
|
+
this.badgeLabel = undefined;
|
|
21
21
|
this.label = undefined;
|
|
22
22
|
}
|
|
23
|
-
componentDidLoad() {
|
|
24
|
-
this.forceIconProps();
|
|
25
|
-
}
|
|
26
|
-
forceIconProps() {
|
|
27
|
-
if (!Boolean(this.iconEl)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const icon = this.iconEl.children[0];
|
|
31
|
-
icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", "20");
|
|
32
|
-
}
|
|
33
23
|
render() {
|
|
34
24
|
const className = index$1.classnames("shell-navigation-item", {
|
|
35
25
|
"shell-navigation-item--active": this.active,
|
|
36
|
-
"shell-navigation-item--has-icon": Boolean(this.icon),
|
|
37
26
|
});
|
|
38
|
-
return (index.h(index.Host, { class: className, onKeyDown: this.onKeyDown, role: "link", tabIndex: 0 }, index.h("span", { class: "shell-navigation-item__icon",
|
|
27
|
+
return (index.h(index.Host, { class: className, onKeyDown: this.onKeyDown, role: "link", tabIndex: 0 }, index.h("span", { class: "shell-navigation-item__icon" }, index.h("slot", { name: "icon" })), index.h("span", { class: "shell-navigation-item__label" }, this.label), this.badgeLabel && (index.h("swirl-badge", { class: "shell-navigation-item__badge", size: "s", "aria-label": this.badgeLabel, label: this.badgeLabel }))));
|
|
39
28
|
}
|
|
40
29
|
get el() { return index.getElement(this); }
|
|
41
30
|
};
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"./components/swirl-action-list/swirl-action-list.js",
|
|
42
42
|
"./components/swirl-action-list-section/swirl-action-list-section.js",
|
|
43
43
|
"./components/swirl-app-bar/swirl-app-bar.js",
|
|
44
|
+
"./components/swirl-app-icon/swirl-app-icon.js",
|
|
44
45
|
"./components/swirl-avatar-group/swirl-avatar-group.js",
|
|
45
46
|
"./components/swirl-card/swirl-card.js",
|
|
46
47
|
"./components/swirl-console-layout/swirl-console-layout.js",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host * {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.app-icon {
|
|
10
|
+
position: relative;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
width: 2.5rem;
|
|
13
|
+
height: 2.5rem;
|
|
14
|
+
border-radius: 0.625rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.app-icon > img {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.app-icon::after {
|
|
23
|
+
content: "";
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
display: block;
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
border-radius: 0.625rem;
|
|
30
|
+
box-shadow: 0 0 var(--s-border-width-default) rgba(0, 0, 0, 0.1) inset,
|
|
31
|
+
0 0 var(--s-border-width-default) rgba(0, 0, 0, 0.1) inset;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.app-icon--hide-border::after {
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.app-icon__icon {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
|
|
45
|
+
color: var(--s-icon-default);
|
|
46
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
export class SwirlAppIcon {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.setImageAvailable = () => {
|
|
6
|
+
this.imageAvailable = true;
|
|
7
|
+
};
|
|
8
|
+
this.setImageUnavailable = () => {
|
|
9
|
+
this.imageAvailable = false;
|
|
10
|
+
};
|
|
11
|
+
this.icon = undefined;
|
|
12
|
+
this.src = undefined;
|
|
13
|
+
this.hideBorder = false;
|
|
14
|
+
this.imageAvailable = undefined;
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
const showImage = Boolean(this.src) &&
|
|
18
|
+
(this.imageAvailable || this.imageAvailable === undefined);
|
|
19
|
+
const showIcon = !showImage && Boolean(this.icon);
|
|
20
|
+
const showFallbackIcon = !showImage && !showIcon;
|
|
21
|
+
const className = classnames("app-icon", {
|
|
22
|
+
"app-icon--has-icon": showIcon || showFallbackIcon,
|
|
23
|
+
"app-icon--hide-border": this.hideBorder,
|
|
24
|
+
});
|
|
25
|
+
return (h(Host, null, h("span", { class: className }, showImage && (h("img", { alt: "", height: "40", onError: this.setImageUnavailable, onLoad: this.setImageAvailable, src: this.src, width: "40" })), showIcon && (h("span", { class: "app-icon__icon", innerHTML: this.icon })))));
|
|
26
|
+
}
|
|
27
|
+
static get is() { return "swirl-app-icon"; }
|
|
28
|
+
static get encapsulation() { return "shadow"; }
|
|
29
|
+
static get originalStyleUrls() {
|
|
30
|
+
return {
|
|
31
|
+
"$": ["swirl-app-icon.css"]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static get styleUrls() {
|
|
35
|
+
return {
|
|
36
|
+
"$": ["swirl-app-icon.css"]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
static get properties() {
|
|
40
|
+
return {
|
|
41
|
+
"icon": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"mutable": false,
|
|
44
|
+
"complexType": {
|
|
45
|
+
"original": "string",
|
|
46
|
+
"resolved": "string",
|
|
47
|
+
"references": {}
|
|
48
|
+
},
|
|
49
|
+
"required": false,
|
|
50
|
+
"optional": true,
|
|
51
|
+
"docs": {
|
|
52
|
+
"tags": [],
|
|
53
|
+
"text": ""
|
|
54
|
+
},
|
|
55
|
+
"attribute": "icon",
|
|
56
|
+
"reflect": false
|
|
57
|
+
},
|
|
58
|
+
"src": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"mutable": false,
|
|
61
|
+
"complexType": {
|
|
62
|
+
"original": "string",
|
|
63
|
+
"resolved": "string",
|
|
64
|
+
"references": {}
|
|
65
|
+
},
|
|
66
|
+
"required": false,
|
|
67
|
+
"optional": true,
|
|
68
|
+
"docs": {
|
|
69
|
+
"tags": [],
|
|
70
|
+
"text": ""
|
|
71
|
+
},
|
|
72
|
+
"attribute": "src",
|
|
73
|
+
"reflect": false
|
|
74
|
+
},
|
|
75
|
+
"hideBorder": {
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "boolean",
|
|
80
|
+
"resolved": "boolean",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": true,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": ""
|
|
88
|
+
},
|
|
89
|
+
"attribute": "hide-border",
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"defaultValue": "false"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static get states() {
|
|
96
|
+
return {
|
|
97
|
+
"imageAvailable": {}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { generateStoryElement } from "../../utils";
|
|
2
|
+
import Docs from "./swirl-app-icon.mdx";
|
|
3
|
+
export default {
|
|
4
|
+
component: "swirl-app-icon",
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
page: Docs,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
title: "Components/SwirlAppIcon",
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const element = generateStoryElement("swirl-app-icon", args);
|
|
14
|
+
return element;
|
|
15
|
+
};
|
|
16
|
+
export const SwirlAppIcon = Template.bind({});
|
|
17
|
+
SwirlAppIcon.args = {
|
|
18
|
+
src: "https://picsum.photos/id/433/144/144",
|
|
19
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
--extended-sidebar-width:
|
|
2
|
+
--extended-sidebar-width: 17rem;
|
|
3
3
|
--collapsed-sidebar-width: 4rem;
|
|
4
4
|
display: flex;
|
|
5
5
|
width: 100%;
|
|
@@ -62,7 +62,9 @@
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.shell-layout--collapsed-sidebar .shell-layout__sidebar-wrapper:not(.shell-layout__sidebar-wrapper--hovered):not(:focus-within) .shell-layout__collapsed-logo {
|
|
65
|
-
display:
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
align-items: center;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
.shell-layout--collapsed-sidebar .shell-layout__sidebar-wrapper:not(.shell-layout__sidebar-wrapper--hovered):not(:focus-within) .shell-layout__expanded-logo {
|
|
@@ -127,7 +129,6 @@
|
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
.shell-layout__header {
|
|
130
|
-
padding: var(--s-space-8);
|
|
131
132
|
flex-shrink: 0;
|
|
132
133
|
border-bottom: var(--s-border-width-default) solid var(--s-border-default);
|
|
133
134
|
background-color: var(--s-background-default);
|
|
@@ -137,27 +138,24 @@
|
|
|
137
138
|
display: flex;
|
|
138
139
|
overflow: hidden;
|
|
139
140
|
align-items: center;
|
|
141
|
+
height: 4.5rem;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
.shell-layout__expanded-logo {
|
|
143
|
-
padding-
|
|
144
|
-
padding-
|
|
145
|
-
padding-bottom: var(--s-space-8);
|
|
146
|
-
padding-left: calc(var(--s-space-12) + var(--s-space-2));
|
|
145
|
+
padding-right: var(--s-space-12);
|
|
146
|
+
padding-left: var(--s-space-12);
|
|
147
147
|
flex-grow: 1;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
.shell-layout__collapsed-logo {
|
|
151
151
|
display: none;
|
|
152
|
-
padding-
|
|
153
|
-
padding-
|
|
154
|
-
padding-bottom: var(--s-space-8);
|
|
155
|
-
padding-left: calc(var(--s-space-12) + var(--s-space-2));
|
|
152
|
+
padding-right: var(--s-space-12);
|
|
153
|
+
padding-left: var(--s-space-12);
|
|
156
154
|
flex-grow: 1;
|
|
157
155
|
}
|
|
158
156
|
|
|
159
157
|
.shell-layout__toggle {
|
|
160
|
-
padding-right: var(--s-space-
|
|
158
|
+
padding-right: var(--s-space-16);
|
|
161
159
|
padding-left: var(--s-space-12);
|
|
162
160
|
flex-grow: 0;
|
|
163
161
|
flex-shrink: 0;
|
|
@@ -177,15 +175,8 @@
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
|
|
180
|
-
.shell-layout__tools {
|
|
181
|
-
margin-top: var(--s-space-4);
|
|
182
|
-
flex-basis: 100%;
|
|
183
|
-
flex-shrink: 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
178
|
.shell-layout__main-navigation {
|
|
187
179
|
overflow: auto;
|
|
188
|
-
padding: var(--s-space-8);
|
|
189
180
|
flex-grow: 1;
|
|
190
181
|
background-color: var(--s-background-default);
|
|
191
182
|
}
|
|
@@ -28,24 +28,35 @@ const Template = (args) => {
|
|
|
28
28
|
</svg>
|
|
29
29
|
</div>
|
|
30
30
|
<div slot="logo-collapsed">
|
|
31
|
-
<
|
|
32
|
-
<path fill="#145AF5" d="M.754767 16.6882c-.36-.6516-.612-1.3756-.7200002-2.1358-.072-.7964-.03599996-1.5566.1440002-2.2806.18-.724.54-1.448.972003-2.0272.468-.6154 1.008-1.1222 1.692-1.4842L17.6748 0c.36.6516.612 1.3756.72 2.1358.108.7602.036 1.5204-.144 2.2806-.18.724-.54 1.448-.972 2.0272-.468.6154-1.008 1.1222-1.692 1.4842L.754767 16.6882ZM4.46264 25.702c-.36-.6516-.612-1.3756-.72-2.1358-.108-.7602-.036-1.5204.144-2.2806.18-.724.54-1.448.972-2.0272.468-.6154 1.008-1.1222 1.692-1.4842l8.20796-4.8508c.36.6516.612 1.3756.72 2.1358.108.7602.036 1.5204-.144 2.2806-.18.724-.54 1.448-.972 2.0272-.468.6154-1.008 1.1222-1.692 1.4842L4.46264 25.702Z"/>
|
|
33
|
-
<path fill="#80A8F4" d="m4.4624 25.702 4.932-2.896c.756 1.3394.936 2.9322.576 4.4164-.396 1.4842-1.332 2.7512-2.664 3.5476l-2.844-5.068ZM14.7584 12.9233l-5.90401-1.0136-8.099995 4.7784 5.759995 1.086 8.24401-4.8508Z"/>
|
|
34
|
-
</svg>
|
|
31
|
+
<swirl-app-icon slot="icon" border-hidden="true" label="link" src="/flip-logo.png"></swirl-app-icon>
|
|
35
32
|
</div>
|
|
36
33
|
<div slot="tools">
|
|
37
|
-
<swirl-stack
|
|
38
|
-
<swirl-shell-navigation-item
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<swirl-shell-navigation-item
|
|
34
|
+
<swirl-stack>
|
|
35
|
+
<swirl-shell-navigation-item label="Search">
|
|
36
|
+
<swirl-app-icon slot="icon" label="link" icon="<swirl-icon-search></swirl-icon-search>"></swirl-app-icon>
|
|
37
|
+
</swirl-shell-navigation-item>
|
|
38
|
+
<swirl-shell-navigation-item label="Notifications" badge-label="1">
|
|
39
|
+
<swirl-app-icon slot="icon" label="link" icon="<swirl-icon-notifications></swirl-icon-notifications>"></swirl-app-icon>
|
|
40
|
+
</swirl-shell-navigation-item>
|
|
41
|
+
<swirl-shell-navigation-item label="Profile & Settings">
|
|
42
|
+
<swirl-avatar slot="icon" label="John Doe" src="https://picsum.photos/id/433/144/144" size="xs"></swirl-avatar>
|
|
43
|
+
</swirl-shell-navigation-item>
|
|
44
|
+
<swirl-shell-navigation-item label="Create">
|
|
45
|
+
<swirl-app-icon slot="icon" label="link" icon="<swirl-icon-add></swirl-icon-add>"></swirl-app-icon>
|
|
46
|
+
</swirl-shell-navigation-item>
|
|
42
47
|
</swirl-stack>
|
|
43
48
|
</div>
|
|
44
49
|
<div slot="main-navigation">
|
|
45
|
-
<swirl-stack
|
|
46
|
-
<swirl-shell-navigation-item active
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
<swirl-stack>
|
|
51
|
+
<swirl-shell-navigation-item active label="Home" badge-label="2">
|
|
52
|
+
<swirl-app-icon slot="icon" label="link" src="https://picsum.photos/id/437/144/144"></swirl-app-icon>
|
|
53
|
+
</swirl-shell-navigation-item>
|
|
54
|
+
<swirl-shell-navigation-item label="Chats">
|
|
55
|
+
<swirl-app-icon slot="icon" label="link" src="https://picsum.photos/id/437/144/144"></swirl-app-icon>
|
|
56
|
+
</swirl-shell-navigation-item>
|
|
57
|
+
<swirl-shell-navigation-item label="News">
|
|
58
|
+
<swirl-app-icon slot="icon" label="link" src="https://picsum.photos/id/437/144/144"></swirl-app-icon>
|
|
59
|
+
</swirl-shell-navigation-item>
|
|
49
60
|
</swirl-stack>
|
|
50
61
|
</div>
|
|
51
62
|
<swirl-banner slot="banner" action-label="Update" content="New version available." dismissable="false" intent="info" size="s"></swirl-banner>
|
package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.css
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seems the container query does not work as expected
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
:host {
|
|
6
|
+
container-type: inline-size;
|
|
7
|
+
position: relative;
|
|
2
8
|
display: inline-flex;
|
|
3
9
|
width: 100%;
|
|
4
|
-
height:
|
|
10
|
+
height: 3.5rem;
|
|
5
11
|
padding-right: var(--s-space-12);
|
|
6
|
-
padding-left:
|
|
12
|
+
padding-left: var(--s-space-12);
|
|
7
13
|
flex-shrink: 0;
|
|
8
14
|
justify-content: flex-start;
|
|
9
15
|
align-items: center;
|
|
10
|
-
border-radius: var(--s-border-radius-sm);
|
|
11
16
|
color: var(--s-text-default);
|
|
12
17
|
background-color: var(--s-surface-default);
|
|
13
18
|
font-size: var(--s-font-size-sm);
|
|
@@ -17,55 +22,88 @@
|
|
|
17
22
|
gap: var(--s-space-12);
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
:host(:hover) {
|
|
21
26
|
background-color: var(--s-surface-hovered);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
:host(:active) {
|
|
25
30
|
background-color: var(--s-surface-pressed);
|
|
31
|
+
color: var(--s-text-highlight);
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
:host(:focus) {
|
|
29
35
|
outline: none;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
:host(:focus-visible) .shell-navigation-item__label {
|
|
33
39
|
border-radius: var(--s-border-radius-xs);
|
|
34
40
|
box-shadow: 0 0 0 0.125rem var(--s-focus-default);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
:host(.shell-navigation-item--active) {
|
|
38
44
|
color: var(--s-text-highlight);
|
|
39
45
|
background-color: var(--s-surface-raised-default);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
color: var(--s-icon-highlight);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
:host(.shell-navigation-item--active:hover) {
|
|
48
|
+
:host(.shell-navigation-item--active:hover) {
|
|
47
49
|
background-color: var(--s-surface-raised-hovered);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
:host(.shell-navigation-item--active:active) {
|
|
51
53
|
background-color: var(--s-surface-raised-pressed);
|
|
54
|
+
color: var(--s-text-highlight);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
:host * {
|
|
55
58
|
box-sizing: border-box;
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
:host:before {
|
|
62
|
+
content: "";
|
|
63
|
+
display: none;
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: 0;
|
|
66
|
+
height: 2.5rem;
|
|
67
|
+
width: 4px;
|
|
68
|
+
background-color: var(--s-icon-highlight);
|
|
69
|
+
border-top-right-radius: 4px;
|
|
70
|
+
border-bottom-right-radius: 4px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host(.shell-navigation-item--active):before {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
58
77
|
.shell-navigation-item__icon {
|
|
59
78
|
display: inline-flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
min-width: 2.5rem;
|
|
82
|
+
min-height: 2.5rem;
|
|
60
83
|
}
|
|
61
84
|
|
|
62
|
-
.shell-navigation-item__icon ::part(icon) {
|
|
63
|
-
color: var(--s-icon-default);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
85
|
.shell-navigation-item__label {
|
|
67
86
|
overflow: hidden;
|
|
68
87
|
min-width: 0;
|
|
69
88
|
white-space: nowrap;
|
|
70
89
|
text-overflow: ellipsis;
|
|
71
90
|
}
|
|
91
|
+
|
|
92
|
+
@container (max-width: 4rem) {
|
|
93
|
+
.shell-navigation-item__label {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.shell-navigation-item__badge {
|
|
98
|
+
position: absolute;
|
|
99
|
+
bottom: 0;
|
|
100
|
+
right: var(--s-space-4);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@container (min-width: 14rem) {
|
|
105
|
+
.shell-navigation-item__badge {
|
|
106
|
+
margin-left: auto;
|
|
107
|
+
padding-right: var(--s-space-4);
|
|
108
|
+
}
|
|
109
|
+
}
|
package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
+
/**
|
|
4
|
+
* @slot slot - image or icon to display
|
|
5
|
+
*/
|
|
3
6
|
export class SwirlShellNavigationItem {
|
|
4
7
|
constructor() {
|
|
5
8
|
this.onKeyDown = (event) => {
|
|
@@ -9,25 +12,14 @@ export class SwirlShellNavigationItem {
|
|
|
9
12
|
}
|
|
10
13
|
};
|
|
11
14
|
this.active = undefined;
|
|
12
|
-
this.
|
|
15
|
+
this.badgeLabel = undefined;
|
|
13
16
|
this.label = undefined;
|
|
14
17
|
}
|
|
15
|
-
componentDidLoad() {
|
|
16
|
-
this.forceIconProps();
|
|
17
|
-
}
|
|
18
|
-
forceIconProps() {
|
|
19
|
-
if (!Boolean(this.iconEl)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const icon = this.iconEl.children[0];
|
|
23
|
-
icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", "20");
|
|
24
|
-
}
|
|
25
18
|
render() {
|
|
26
19
|
const className = classnames("shell-navigation-item", {
|
|
27
20
|
"shell-navigation-item--active": this.active,
|
|
28
|
-
"shell-navigation-item--has-icon": Boolean(this.icon),
|
|
29
21
|
});
|
|
30
|
-
return (h(Host, { class: className, onKeyDown: this.onKeyDown, role: "link", tabIndex: 0 }, h("span", { class: "shell-navigation-item__icon",
|
|
22
|
+
return (h(Host, { class: className, onKeyDown: this.onKeyDown, role: "link", tabIndex: 0 }, h("span", { class: "shell-navigation-item__icon" }, h("slot", { name: "icon" })), h("span", { class: "shell-navigation-item__label" }, this.label), this.badgeLabel && (h("swirl-badge", { class: "shell-navigation-item__badge", size: "s", "aria-label": this.badgeLabel, label: this.badgeLabel }))));
|
|
31
23
|
}
|
|
32
24
|
static get is() { return "swirl-shell-navigation-item"; }
|
|
33
25
|
static get encapsulation() { return "shadow"; }
|
|
@@ -60,7 +52,7 @@ export class SwirlShellNavigationItem {
|
|
|
60
52
|
"attribute": "active",
|
|
61
53
|
"reflect": false
|
|
62
54
|
},
|
|
63
|
-
"
|
|
55
|
+
"badgeLabel": {
|
|
64
56
|
"type": "string",
|
|
65
57
|
"mutable": false,
|
|
66
58
|
"complexType": {
|
|
@@ -68,13 +60,13 @@ export class SwirlShellNavigationItem {
|
|
|
68
60
|
"resolved": "string",
|
|
69
61
|
"references": {}
|
|
70
62
|
},
|
|
71
|
-
"required":
|
|
72
|
-
"optional":
|
|
63
|
+
"required": false,
|
|
64
|
+
"optional": true,
|
|
73
65
|
"docs": {
|
|
74
66
|
"tags": [],
|
|
75
67
|
"text": ""
|
|
76
68
|
},
|
|
77
|
-
"attribute": "
|
|
69
|
+
"attribute": "badge-label",
|
|
78
70
|
"reflect": false
|
|
79
71
|
},
|
|
80
72
|
"label": {
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { generateStoryElement } from "../../utils";
|
|
2
2
|
import Docs from "./swirl-shell-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-shell-navigation-item",
|
|
15
5
|
parameters: {
|
|
16
6
|
docs: {
|
|
@@ -21,10 +11,13 @@ export default {
|
|
|
21
11
|
};
|
|
22
12
|
const Template = (args) => {
|
|
23
13
|
const element = generateStoryElement("swirl-shell-navigation-item", args);
|
|
14
|
+
element.innerHTML = `
|
|
15
|
+
<swirl-app-icon slot="icon" label="link" src="https://picsum.photos/id/433/144/144"></swirl-app-icon>
|
|
16
|
+
`;
|
|
24
17
|
return element;
|
|
25
18
|
};
|
|
26
19
|
export const SwirlShellNavigationItem = Template.bind({});
|
|
27
20
|
SwirlShellNavigationItem.args = {
|
|
28
|
-
icon: "<swirl-icon-chat-bubble></swirl-icon-chat-bubble>",
|
|
29
21
|
label: "Label",
|
|
22
|
+
badgeLabel: "1",
|
|
30
23
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SwirlAppIcon extends Components.SwirlAppIcon, HTMLElement {}
|
|
4
|
+
export const SwirlAppIcon: {
|
|
5
|
+
prototype: SwirlAppIcon;
|
|
6
|
+
new (): SwirlAppIcon;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const swirlAppIconCss = ":host{display:inline-flex}:host *{box-sizing:border-box}.app-icon{position:relative;overflow:hidden;width:2.5rem;height:2.5rem;border-radius:0.625rem}.app-icon>img{width:100%;height:100%}.app-icon::after{content:\"\";position:absolute;top:0;display:block;height:100%;width:100%;border-radius:0.625rem;box-shadow:0 0 var(--s-border-width-default) rgba(0, 0, 0, 0.1) inset,\n 0 0 var(--s-border-width-default) rgba(0, 0, 0, 0.1) inset}.app-icon--hide-border::after{box-shadow:none}.app-icon__icon{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%;color:var(--s-icon-default)}";
|
|
5
|
+
|
|
6
|
+
const SwirlAppIcon$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.setImageAvailable = () => {
|
|
12
|
+
this.imageAvailable = true;
|
|
13
|
+
};
|
|
14
|
+
this.setImageUnavailable = () => {
|
|
15
|
+
this.imageAvailable = false;
|
|
16
|
+
};
|
|
17
|
+
this.icon = undefined;
|
|
18
|
+
this.src = undefined;
|
|
19
|
+
this.hideBorder = false;
|
|
20
|
+
this.imageAvailable = undefined;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const showImage = Boolean(this.src) &&
|
|
24
|
+
(this.imageAvailable || this.imageAvailable === undefined);
|
|
25
|
+
const showIcon = !showImage && Boolean(this.icon);
|
|
26
|
+
const showFallbackIcon = !showImage && !showIcon;
|
|
27
|
+
const className = classnames("app-icon", {
|
|
28
|
+
"app-icon--has-icon": showIcon || showFallbackIcon,
|
|
29
|
+
"app-icon--hide-border": this.hideBorder,
|
|
30
|
+
});
|
|
31
|
+
return (h(Host, null, h("span", { class: className }, showImage && (h("img", { alt: "", height: "40", onError: this.setImageUnavailable, onLoad: this.setImageAvailable, src: this.src, width: "40" })), showIcon && (h("span", { class: "app-icon__icon", innerHTML: this.icon })))));
|
|
32
|
+
}
|
|
33
|
+
static get style() { return swirlAppIconCss; }
|
|
34
|
+
}, [1, "swirl-app-icon", {
|
|
35
|
+
"icon": [1],
|
|
36
|
+
"src": [1],
|
|
37
|
+
"hideBorder": [4, "hide-border"],
|
|
38
|
+
"imageAvailable": [32]
|
|
39
|
+
}]);
|
|
40
|
+
function defineCustomElement$1() {
|
|
41
|
+
if (typeof customElements === "undefined") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const components = ["swirl-app-icon"];
|
|
45
|
+
components.forEach(tagName => { switch (tagName) {
|
|
46
|
+
case "swirl-app-icon":
|
|
47
|
+
if (!customElements.get(tagName)) {
|
|
48
|
+
customElements.define(tagName, SwirlAppIcon$1);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
} });
|
|
52
|
+
}
|
|
53
|
+
defineCustomElement$1();
|
|
54
|
+
|
|
55
|
+
const SwirlAppIcon = SwirlAppIcon$1;
|
|
56
|
+
const defineCustomElement = defineCustomElement$1;
|
|
57
|
+
|
|
58
|
+
export { SwirlAppIcon, defineCustomElement };
|