@getflip/swirl-components 0.124.1 → 0.125.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 +9 -1
- package/dist/cjs/swirl-app-layout_6.cjs.entry.js +5 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.css +6 -1
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +5 -1
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.spec.js +1 -2
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.stories.js +1 -2
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-app-layout2.js +5 -2
- package/dist/esm/swirl-app-layout_6.entry.js +5 -2
- package/dist/swirl-components/p-4db5b2ae.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-app-layout/swirl-app-layout.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-d771a7e8.entry.js +0 -1
|
@@ -231,6 +231,10 @@
|
|
|
231
231
|
display: block;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
.app-layout--has-floating-action-button .app-layout__floating-action-button {
|
|
235
|
+
display: block;
|
|
236
|
+
}
|
|
237
|
+
|
|
234
238
|
.app-layout--hide-app-bar .app-layout__body {
|
|
235
239
|
grid-template-rows: auto 1fr;
|
|
236
240
|
grid-template-areas:
|
|
@@ -307,11 +311,12 @@
|
|
|
307
311
|
margin-left: calc(-1 * var(--s-space-4));
|
|
308
312
|
}
|
|
309
313
|
|
|
310
|
-
.app-layout__floating-
|
|
314
|
+
.app-layout__floating-action-button {
|
|
311
315
|
position: absolute;
|
|
312
316
|
z-index: 4;
|
|
313
317
|
right: var(--s-space-16);
|
|
314
318
|
bottom: var(--s-space-16);
|
|
319
|
+
display: none;
|
|
315
320
|
}
|
|
316
321
|
|
|
317
322
|
.app-layout__navigation-controls {
|
|
@@ -12,6 +12,7 @@ import { isMobileViewport } from "../../utils";
|
|
|
12
12
|
* @slot banner - Used to show a banner below the app bar
|
|
13
13
|
* @slot sidebar - Content of the right sidebar
|
|
14
14
|
* @slot custom-sidebar-header - Replaces the default sidebar header
|
|
15
|
+
* @slot floating-action-button - Floating button displayed in the bottom right corner
|
|
15
16
|
*/
|
|
16
17
|
export class SwirlAppLayout {
|
|
17
18
|
constructor() {
|
|
@@ -179,11 +180,14 @@ export class SwirlAppLayout {
|
|
|
179
180
|
const hasAppBarControls = Boolean(this.el.querySelector('[slot="app-bar-controls"]'));
|
|
180
181
|
const hasAppBarMobileMenuButton = Boolean(this.el.querySelector('[slot="app-bar-mobile-menu-button"]'));
|
|
181
182
|
const hasCustomSidebarHeader = Boolean(this.el.querySelector('[slot="custom-sidebar-header"]'));
|
|
183
|
+
const hasFloatingActionButton = Boolean(this.el.querySelector('[slot="floating-action-button"]')) ||
|
|
184
|
+
Boolean(this.ctaLabel);
|
|
182
185
|
const className = classnames("app-layout", `app-layout--mobile-view-${this.mobileView}`, `app-layout--transitioning-from-${this.transitioningFrom}`, `app-layout--transitioning-to-${this.transitioningTo}`, `app-layout--transition-style-${this.transitionStyle}`, {
|
|
183
186
|
"app-layout--has-app-bar-mobile-menu-button": hasAppBarMobileMenuButton,
|
|
184
187
|
"app-layout--has-app-bar-controls": hasAppBarControls,
|
|
185
188
|
"app-layout--has-custom-app-bar-back-button": this.hasCustomAppBarBackButton,
|
|
186
189
|
"app-layout--has-custom-sidebar-header": hasCustomSidebarHeader,
|
|
190
|
+
"app-layout--has-floating-action-button": hasFloatingActionButton,
|
|
187
191
|
"app-layout--has-navigation": this.hasNavigation,
|
|
188
192
|
"app-layout--has-sidebar": this.hasSidebar,
|
|
189
193
|
"app-layout--hide-app-bar": this.hideAppBar,
|
|
@@ -192,7 +196,7 @@ export class SwirlAppLayout {
|
|
|
192
196
|
});
|
|
193
197
|
return (h(Host, null, h("section", { "aria-labelledby": "app-name", class: className, role: "document", tabIndex: 0 }, h("div", { class: "app-layout__grid" }, h("header", { class: "app-layout__header" }, h("span", { class: "app-layout__navigation-mobile-menu-button" }, h("slot", { name: "navigation-mobile-menu-button" })), this.showNavigationBackButton && (h("span", { class: "app-layout__navigation-back-button" }, h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.navigationBackButtonLabel, onClick: this.onNavigationBackButtonClick }))), h("swirl-heading", { as: "h1", class: "app-layout__app-name", headingId: "app-name", level: 3, text: this.appName }), this.hasNavigation && (h("span", { class: "app-layout__navigation-controls" }, h("slot", { name: "navigation-controls" })))), h("nav", { "aria-label": this.navigationLabel, class: "app-layout__navigation" }, h("slot", { name: "navigation" })), h("section", { "aria-labelledby": "app-name", class: "app-layout__body" }, !this.hideAppBar && (h("header", { class: "app-layout__app-bar" }, h("span", { class: "app-layout__app-bar-mobile-menu-button" }, h("slot", { name: "app-bar-mobile-menu-button" })), showBackToNavigationButton && (h("span", { class: "app-layout__back-to-navigation-button" }, h("swirl-button", { hideLabel: true, icon: this.transitionStyle === "dialog"
|
|
194
198
|
? "<swirl-icon-close></swirl-icon-close>"
|
|
195
|
-
: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backToNavigationViewButtonLabel, onClick: this.onBackToNavigationViewButtonClick }))), h("span", { class: "app-layout__custom-app-bar-back-button" }, h("slot", { name: "custom-app-bar-back-button" })), h("div", { class: "app-layout__app-bar-content" }, h("slot", { name: "app-bar" })), h("div", { class: "app-layout__app-bar-controls" }, h("slot", { name: "app-bar-controls" })))), h("div", { class: "app-layout__banner" }, h("slot", { name: "banner" })), h("div", { class: "app-layout__content" }, h("slot", { name: "content" }))), h("aside", { class: "app-layout__sidebar" }, h("header", { class: "app-layout__custom-sidebar-header" }, h("slot", { name: "custom-sidebar-header" })), h("header", { class: "app-layout__sidebar-header" }, h("swirl-button", { class: "app-layout__sidebar-close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick }), h("swirl-heading", { as: "h3", class: "app-layout__sidebar-heading", headingId: "sidebar-heading", level: 3, text: this.sidebarHeading })), h("div", { class: "app-layout__sidebar-content" }, h("slot", { name: "sidebar" }))),
|
|
199
|
+
: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backToNavigationViewButtonLabel, onClick: this.onBackToNavigationViewButtonClick }))), h("span", { class: "app-layout__custom-app-bar-back-button" }, h("slot", { name: "custom-app-bar-back-button" })), h("div", { class: "app-layout__app-bar-content" }, h("slot", { name: "app-bar" })), h("div", { class: "app-layout__app-bar-controls" }, h("slot", { name: "app-bar-controls" })))), h("div", { class: "app-layout__banner" }, h("slot", { name: "banner" })), h("div", { class: "app-layout__content" }, h("slot", { name: "content" }))), h("aside", { class: "app-layout__sidebar" }, h("header", { class: "app-layout__custom-sidebar-header" }, h("slot", { name: "custom-sidebar-header" })), h("header", { class: "app-layout__sidebar-header" }, h("swirl-button", { class: "app-layout__sidebar-close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick }), h("swirl-heading", { as: "h3", class: "app-layout__sidebar-heading", headingId: "sidebar-heading", level: 3, text: this.sidebarHeading })), h("div", { class: "app-layout__sidebar-content" }, h("slot", { name: "sidebar" }))), h("span", { class: "app-layout__floating-action-button" }, this.ctaLabel && (h("swirl-button", { hideLabel: Boolean(this.ctaIcon), icon: this.ctaIcon, intent: "primary", label: this.ctaLabel, onClick: this.onCtaClick, variant: "floating" })), h("slot", { name: "floating-action-button" }))))));
|
|
196
200
|
}
|
|
197
201
|
static get is() { return "swirl-app-layout"; }
|
|
198
202
|
static get encapsulation() { return "shadow"; }
|
|
@@ -54,8 +54,7 @@ describe("swirl-app-layout", () => {
|
|
|
54
54
|
`,
|
|
55
55
|
});
|
|
56
56
|
const spy = jest.fn();
|
|
57
|
-
const cta = page.root.shadowRoot.querySelector(".app-layout__floating-
|
|
58
|
-
.children[0];
|
|
57
|
+
const cta = page.root.shadowRoot.querySelector(".app-layout__floating-action-button").children[0];
|
|
59
58
|
page.root.addEventListener("ctaClick", spy);
|
|
60
59
|
expect(cta).not.toBeNull();
|
|
61
60
|
expect(cta.getAttribute("icon")).toBe("<swirl-icon-add></swirl-icon-add>");
|
|
@@ -51,6 +51,7 @@ const Template = (args) => {
|
|
|
51
51
|
</div>
|
|
52
52
|
<div slot="content"></div>
|
|
53
53
|
<div slot="sidebar"></div>
|
|
54
|
+
<swirl-button slot="floating-action-button" icon="<swirl-icon-add></swirl-icon-add>" label="CTA" variant="floating" intent="primary" hide-label="true"></swirl-button>
|
|
54
55
|
`;
|
|
55
56
|
element.querySelector(".info-button").addEventListener("click", () => {
|
|
56
57
|
element.changeMobileView("sidebar");
|
|
@@ -65,8 +66,6 @@ const Template = (args) => {
|
|
|
65
66
|
export const SwirlAppLayout = Template.bind({});
|
|
66
67
|
SwirlAppLayout.args = {
|
|
67
68
|
appName: "App Name",
|
|
68
|
-
ctaIcon: "<swirl-icon-add></swirl-icon-add>",
|
|
69
|
-
ctaLabel: "Call to action",
|
|
70
69
|
navigationLabel: "Items",
|
|
71
70
|
sidebarHeading: "Sidebar Heading",
|
|
72
71
|
};
|