@getflip/swirl-components 0.165.0 → 0.166.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 (27) hide show
  1. package/components.json +5 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/swirl-components.cjs.js +1 -1
  4. package/dist/cjs/swirl-shell-layout.cjs.entry.js +5 -2
  5. package/dist/cjs/swirl-shell-navigation-item.cjs.entry.js +2 -2
  6. package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
  7. package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.css +1 -1
  8. package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.js +7 -4
  9. package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.stories.js +9 -2
  10. package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.css +8 -6
  11. package/dist/collection/components/swirl-shell-navigation-item/swirl-shell-navigation-item.js +1 -1
  12. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  13. package/dist/components/swirl-shell-layout.js +6 -3
  14. package/dist/components/swirl-shell-navigation-item.js +2 -2
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/swirl-components.js +1 -1
  17. package/dist/esm/swirl-shell-layout.entry.js +5 -2
  18. package/dist/esm/swirl-shell-navigation-item.entry.js +2 -2
  19. package/dist/swirl-components/p-75201a35.entry.js +1 -0
  20. package/dist/swirl-components/p-99b7cf72.entry.js +1 -0
  21. package/dist/swirl-components/swirl-components.esm.js +1 -1
  22. package/dist/types/components/swirl-shell-layout/swirl-shell-layout.d.ts +1 -1
  23. package/dist/types/components/swirl-shell-layout/swirl-shell-layout.stories.d.ts +7 -0
  24. package/dist/types/components.d.ts +2 -2
  25. package/package.json +1 -1
  26. package/dist/swirl-components/p-d27be7e9.entry.js +0 -1
  27. package/dist/swirl-components/p-f737a7a8.entry.js +0 -1
@@ -4,7 +4,7 @@
4
4
 
5
5
  --swirl-shell-header-height: 3.25rem;
6
6
 
7
- --swirl-shell-collapsed-nav-width: 3.75rem;
7
+ --swirl-shell-collapsed-nav-width: 4rem;
8
8
  --swirl-shell-extended-nav-width: 14rem;
9
9
  --swirl-shell-sidebar-width: 21rem;
10
10
 
@@ -102,13 +102,16 @@ export class SwirlShellLayout {
102
102
  this.mobileNavigationActive = false;
103
103
  }
104
104
  render() {
105
+ const hasSidebarToggleBadgeWithLabel = this.sidebarToggleBadge !== true && this.sidebarToggleBadge !== "true";
105
106
  const className = classnames("shell-layout", {
106
107
  "shell-layout--branded-header": this.brandedHeader,
107
108
  "shell-layout--mobile-navigation-active": this.mobileNavigationActive,
108
109
  "shell-layout--navigation-collapsed": this.navigationCollapsed,
109
110
  "shell-layout--sidebar-active": this.sidebarActive,
110
111
  });
111
- return (h(Host, null, h("div", { class: className }, h("header", { class: "shell-layout__header", "data-tauri-drag-region": "true" }, h("button", { class: "shell-layout__skip-link", onClick: this.skipLinkClick.emit, type: "button" }, this.skipLinkLabel), h("div", { class: "shell-layout__header-left" }, h("button", { class: "shell-layout__header-tool shell-layout__navigation-toggle", onClick: this.onNavigationToggleClick, type: "button" }, h("swirl-icon-hamburger-menu", { size: 20 }), h("swirl-icon-double-arrow-left", { size: 20 }), h("swirl-icon-double-arrow-right", { size: 20 }), h("swirl-visually-hidden", null, this.navigationToggleLabel)), h("button", { class: "shell-layout__header-tool", onClick: this.onBrowserBackClick, type: "button" }, h("swirl-icon-arrow-back", { size: 20 }), h("swirl-visually-hidden", null, this.browserBackButtonLabel)), h("button", { class: "shell-layout__header-tool", onClick: this.onBrowserForwardClick, type: "button" }, h("swirl-icon-arrow-forward", { size: 20 }), h("swirl-visually-hidden", null, this.browserForwardButtonLabel))), h("div", { class: "shell-layout__logo" }, h("slot", { name: "logo" })), h("div", { class: "shell-layout__header-right" }, h("button", { class: "shell-layout__header-tool shell-layout__sidebar-toggle", onClick: this.sidebarToggleClick.emit, type: "button" }, h("swirl-icon", { glyph: this.sidebarToggleIcon, size: 20 }), h("swirl-visually-hidden", null, this.sidebarToggleLabel), this.sidebarToggleBadge && (h("swirl-badge", { "aria-label": this.sidebarToggleBadgeAriaLabel, label: this.sidebarToggleBadge, size: "xs" }))), h("slot", { name: "header-tools" }))), h("div", { class: "shell-layout__mobile-nav-backdrop", onClick: this.onNavigationClick }), h("nav", { "aria-labelledby": "main-navigation-label", class: "shell-layout__nav", onClick: this.onNavigationClick, ref: (el) => (this.navElement = el) }, h("div", { class: "shell-layout__mobile-header" }, h("slot", { name: "mobile-logo" }), h("div", { class: "shell-layout__mobile-header-tools" }, h("slot", { name: "mobile-header-tools" }), h("button", { class: "shell-layout__header-tool", type: "button" }, h("swirl-icon-double-arrow-left", { size: 20 }), h("swirl-visually-hidden", null, this.hideMobileNavigationButtonLabel)))), h("div", { class: "shell-layout__nav-body" }, h("swirl-visually-hidden", null, h("span", { id: "main-navigation-label" }, this.navigationLabel)), h("slot", { name: "nav" }))), h("main", { class: "shell-layout__main", id: "main-content" }, h("slot", null)), h("aside", { class: "shell-layout__sidebar", ...{ inert: this.sidebarActive ? undefined : true } }, h("div", { class: "shell-layout__sidebar-body" }, h("div", { class: "shell-layout__sidebar-app-bar" }, h("slot", { name: "sidebar-app-bar" })), h("div", { class: "shell-layout__sidebar-content" }, h("slot", { name: "sidebar" })))))));
112
+ return (h(Host, null, h("div", { class: className }, h("header", { class: "shell-layout__header", "data-tauri-drag-region": "true" }, h("button", { class: "shell-layout__skip-link", onClick: this.skipLinkClick.emit, type: "button" }, this.skipLinkLabel), h("div", { class: "shell-layout__header-left" }, h("button", { class: "shell-layout__header-tool shell-layout__navigation-toggle", onClick: this.onNavigationToggleClick, type: "button" }, h("swirl-icon-hamburger-menu", { size: 20 }), h("swirl-icon-double-arrow-left", { size: 20 }), h("swirl-icon-double-arrow-right", { size: 20 }), h("swirl-visually-hidden", null, this.navigationToggleLabel)), h("button", { class: "shell-layout__header-tool", onClick: this.onBrowserBackClick, type: "button" }, h("swirl-icon-arrow-back", { size: 20 }), h("swirl-visually-hidden", null, this.browserBackButtonLabel)), h("button", { class: "shell-layout__header-tool", onClick: this.onBrowserForwardClick, type: "button" }, h("swirl-icon-arrow-forward", { size: 20 }), h("swirl-visually-hidden", null, this.browserForwardButtonLabel))), h("div", { class: "shell-layout__logo" }, h("slot", { name: "logo" })), h("div", { class: "shell-layout__header-right" }, h("button", { class: "shell-layout__header-tool shell-layout__sidebar-toggle", onClick: this.sidebarToggleClick.emit, type: "button" }, h("swirl-icon", { glyph: this.sidebarToggleIcon, size: 20 }), h("swirl-visually-hidden", null, this.sidebarToggleLabel), this.sidebarToggleBadge && (h("swirl-badge", { "aria-label": this.sidebarToggleBadgeAriaLabel, label: !hasSidebarToggleBadgeWithLabel
113
+ ? this.sidebarToggleBadgeAriaLabel
114
+ : String(this.sidebarToggleBadge), size: "xs", variant: !hasSidebarToggleBadgeWithLabel ? "dot" : "default" }))), h("slot", { name: "header-tools" }))), h("div", { class: "shell-layout__mobile-nav-backdrop", onClick: this.onNavigationClick }), h("nav", { "aria-labelledby": "main-navigation-label", class: "shell-layout__nav", onClick: this.onNavigationClick, ref: (el) => (this.navElement = el) }, h("div", { class: "shell-layout__mobile-header" }, h("slot", { name: "mobile-logo" }), h("div", { class: "shell-layout__mobile-header-tools" }, h("slot", { name: "mobile-header-tools" }), h("button", { class: "shell-layout__header-tool", type: "button" }, h("swirl-icon-double-arrow-left", { size: 20 }), h("swirl-visually-hidden", null, this.hideMobileNavigationButtonLabel)))), h("div", { class: "shell-layout__nav-body" }, h("swirl-visually-hidden", null, h("span", { id: "main-navigation-label" }, this.navigationLabel)), h("slot", { name: "nav" }))), h("main", { class: "shell-layout__main", id: "main-content" }, h("slot", null)), h("aside", { class: "shell-layout__sidebar", ...{ inert: this.sidebarActive ? undefined : true } }, h("div", { class: "shell-layout__sidebar-body" }, h("div", { class: "shell-layout__sidebar-app-bar" }, h("slot", { name: "sidebar-app-bar" })), h("div", { class: "shell-layout__sidebar-content" }, h("slot", { name: "sidebar" })))))));
112
115
  }
113
116
  static get is() { return "swirl-shell-layout"; }
114
117
  static get encapsulation() { return "scoped"; }
@@ -249,11 +252,11 @@ export class SwirlShellLayout {
249
252
  "reflect": false
250
253
  },
251
254
  "sidebarToggleBadge": {
252
- "type": "string",
255
+ "type": "any",
253
256
  "mutable": false,
254
257
  "complexType": {
255
- "original": "string",
256
- "resolved": "string",
258
+ "original": "string | boolean",
259
+ "resolved": "boolean | string",
257
260
  "references": {}
258
261
  },
259
262
  "required": false,
@@ -1,6 +1,13 @@
1
1
  import { fullscreenStoryDecorator, generateStoryElement } from "../../utils";
2
2
  import Docs from "./swirl-shell-layout.mdx";
3
3
  export default {
4
+ argTypes: {
5
+ sidebarToggleBadge: {
6
+ control: {
7
+ type: "text",
8
+ },
9
+ },
10
+ },
4
11
  component: "swirl-shell-layout",
5
12
  tags: ["autodocs"],
6
13
  decorators: [fullscreenStoryDecorator(false)],
@@ -31,12 +38,12 @@ const Template = (args) => {
31
38
  </swirl-shell-navigation-item>
32
39
  </li>
33
40
  <li>
34
- <swirl-shell-navigation-item active label="News">
41
+ <swirl-shell-navigation-item active label="News" badge-label="">
35
42
  <swirl-app-icon icon="<swirl-icon-news-filled size=&quot;20&quot;></swirl-icon-news-filled>" slot="icon"></swirl-app-icon>
36
43
  </swirl-shell-navigation-item>
37
44
  </li>
38
45
  <li>
39
- <swirl-shell-navigation-item label="Chat">
46
+ <swirl-shell-navigation-item label="Chat" badge-label="3">
40
47
  <swirl-app-icon icon="<swirl-icon-chat-bubble size=&quot;20&quot;></swirl-icon-chat-bubble>" slot="icon"></swirl-app-icon>
41
48
  </swirl-shell-navigation-item>
42
49
  </li>
@@ -15,20 +15,20 @@
15
15
  position: relative;
16
16
  display: flex;
17
17
  width: 100%;
18
- height: 2.75rem;
18
+ height: 3rem;
19
19
  padding: var(--s-space-12);
20
20
  flex-shrink: 0;
21
21
  justify-content: flex-start;
22
22
  align-items: center;
23
23
  border: none;
24
24
  border-radius: var(--s-border-radius-sm);
25
- background-color: var(--s-surface-overlay-default);
26
25
  color: var(--s-text-default);
27
- text-decoration: none;
26
+ background-color: var(--s-surface-overlay-default);
28
27
  font: inherit;
29
28
  font-size: var(--s-font-size-sm);
30
29
  font-weight: var(--s-font-weight-medium);
31
30
  line-height: var(--s-line-height-sm);
31
+ text-decoration: none;
32
32
  cursor: pointer;
33
33
  container-type: inline-size;
34
34
  gap: var(--s-space-16);
@@ -92,8 +92,8 @@
92
92
 
93
93
  .shell-navigation-item__icon {
94
94
  display: inline-flex;
95
- min-width: 1.25rem;
96
- min-height: 1.25rem;
95
+ min-width: 1.5rem;
96
+ min-height: 1.5rem;
97
97
  justify-content: center;
98
98
  align-items: center;
99
99
  }
@@ -101,6 +101,8 @@
101
101
  .shell-navigation-item__label {
102
102
  overflow: hidden;
103
103
  min-width: 0;
104
+ flex-grow: 1;
105
+ text-align: start;
104
106
  white-space: nowrap;
105
107
  text-overflow: ellipsis;
106
108
  }
@@ -117,7 +119,7 @@
117
119
  .shell-navigation-item__badge {
118
120
  position: absolute;
119
121
  right: var(--s-space-4);
120
- bottom: 0;
122
+ bottom: var(--s-space-4);
121
123
  }
122
124
  }
123
125
 
@@ -17,7 +17,7 @@ export class SwirlShellNavigationItem {
17
17
  });
18
18
  const isLink = Boolean(this.href);
19
19
  const Tag = isLink ? "a" : "button";
20
- return (h(Host, null, h(Tag, { class: className, href: this.href, target: this.target, type: isLink ? undefined : "button" }, 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 })))));
20
+ return (h(Host, null, h(Tag, { class: className, href: this.href, target: this.target, type: isLink ? undefined : "button" }, h("span", { class: "shell-navigation-item__icon" }, h("slot", { name: "icon" })), h("span", { class: "shell-navigation-item__label" }, this.label), this.badgeLabel !== undefined && this.badgeLabel !== null && (h("swirl-badge", { "aria-label": this.badgeLabel, class: "shell-navigation-item__badge", label: this.badgeLabel, size: "xs", variant: this.badgeLabel === "" ? "dot" : "default" })))));
21
21
  }
22
22
  static get is() { return "swirl-shell-navigation-item"; }
23
23
  static get encapsulation() { return "shadow"; }