@getflip/swirl-components 0.117.0 → 0.118.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 +25 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-layout_6.cjs.entry.js +4 -2
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +7 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.css +16 -0
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +4 -1
- package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.css +26 -4
- package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +23 -1
- package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.spec.js +6 -3
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-app-layout2.js +4 -2
- package/dist/components/swirl-option-list-item2.js +8 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-layout_6.entry.js +4 -2
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-icon-check-small_3.entry.js +7 -2
- package/dist/swirl-components/p-488d2a7d.entry.js +1 -0
- package/dist/swirl-components/p-68936168.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/dist/types/components/swirl-option-list-item/swirl-option-list-item.d.ts +2 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-0ac2eb84.entry.js +0 -1
- package/dist/swirl-components/p-178d041a.entry.js +0 -1
|
@@ -223,6 +223,14 @@
|
|
|
223
223
|
display: block;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
.app-layout--has-custom-sidebar-header .app-layout__sidebar-header {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.app-layout--has-custom-sidebar-header .app-layout__custom-sidebar-header {
|
|
231
|
+
display: block;
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
.app-layout--hide-app-bar .app-layout__body {
|
|
227
235
|
grid-template-rows: auto 1fr;
|
|
228
236
|
grid-template-areas:
|
|
@@ -417,6 +425,14 @@
|
|
|
417
425
|
}
|
|
418
426
|
}
|
|
419
427
|
|
|
428
|
+
.app-layout__custom-sidebar-header {
|
|
429
|
+
display: none;
|
|
430
|
+
min-width: 0;
|
|
431
|
+
border-bottom: var(--s-border-width-default) solid var(--s-border-default);
|
|
432
|
+
background-color: var(--s-background-default);
|
|
433
|
+
grid-area: sidebar-header;
|
|
434
|
+
}
|
|
435
|
+
|
|
420
436
|
.app-layout__sidebar-header {
|
|
421
437
|
display: flex;
|
|
422
438
|
min-width: 0;
|
|
@@ -11,6 +11,7 @@ import { isMobileViewport } from "../../utils";
|
|
|
11
11
|
* @slot app-bar-mobile-menu-button - Used to add a mobile shell layout menu button to the app bar
|
|
12
12
|
* @slot banner - Used to show a banner below the app bar
|
|
13
13
|
* @slot sidebar - Content of the right sidebar
|
|
14
|
+
* @slot custom-sidebar-header - Replaces the default sidebar header
|
|
14
15
|
*/
|
|
15
16
|
export class SwirlAppLayout {
|
|
16
17
|
constructor() {
|
|
@@ -177,10 +178,12 @@ export class SwirlAppLayout {
|
|
|
177
178
|
!this.hasCustomAppBarBackButton;
|
|
178
179
|
const hasAppBarControls = Boolean(this.el.querySelector('[slot="app-bar-controls"]'));
|
|
179
180
|
const hasAppBarMobileMenuButton = Boolean(this.el.querySelector('[slot="app-bar-mobile-menu-button"]'));
|
|
181
|
+
const hasCustomSidebarHeader = Boolean(this.el.querySelector('[slot="custom-sidebar-header"]'));
|
|
180
182
|
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}`, {
|
|
181
183
|
"app-layout--has-app-bar-mobile-menu-button": hasAppBarMobileMenuButton,
|
|
182
184
|
"app-layout--has-app-bar-controls": hasAppBarControls,
|
|
183
185
|
"app-layout--has-custom-app-bar-back-button": this.hasCustomAppBarBackButton,
|
|
186
|
+
"app-layout--has-custom-sidebar-header": hasCustomSidebarHeader,
|
|
184
187
|
"app-layout--has-navigation": this.hasNavigation,
|
|
185
188
|
"app-layout--has-sidebar": this.hasSidebar,
|
|
186
189
|
"app-layout--hide-app-bar": this.hideAppBar,
|
|
@@ -189,7 +192,7 @@ export class SwirlAppLayout {
|
|
|
189
192
|
});
|
|
190
193
|
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"
|
|
191
194
|
? "<swirl-icon-close></swirl-icon-close>"
|
|
192
|
-
: "<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__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" }))), this.ctaLabel && (h("span", { class: "app-layout__floating-cta" }, h("swirl-button", { hideLabel: Boolean(this.ctaIcon), icon: this.ctaIcon, intent: "primary", label: this.ctaLabel, onClick: this.onCtaClick, variant: "floating" })))))));
|
|
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" }))), this.ctaLabel && (h("span", { class: "app-layout__floating-cta" }, h("swirl-button", { hideLabel: Boolean(this.ctaIcon), icon: this.ctaIcon, intent: "primary", label: this.ctaLabel, onClick: this.onCtaClick, variant: "floating" })))))));
|
|
193
196
|
}
|
|
194
197
|
static get is() { return "swirl-app-layout"; }
|
|
195
198
|
static get encapsulation() { return "shadow"; }
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.option-list-item--draggable .option-list-item__label {
|
|
48
|
+
.option-list-item--draggable .option-list-item__label-container {
|
|
49
49
|
padding-right: calc(var(--s-space-16) + 1.5rem);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
53
53
|
|
|
54
|
-
.option-list-item--draggable .option-list-item__label {
|
|
54
|
+
.option-list-item--draggable .option-list-item__label-container {
|
|
55
55
|
padding-right: calc(var(--s-space-16) + 1rem)
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
color: var(--s-text-on-status);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.option-list-item--disabled .option-list-item__label
|
|
97
|
+
.option-list-item--disabled .option-list-item__label,
|
|
98
|
+
.option-list-item--disabled .option-list-item__description {
|
|
98
99
|
color: var(--s-text-disabled);
|
|
99
100
|
}
|
|
100
101
|
|
|
@@ -109,8 +110,13 @@
|
|
|
109
110
|
background-color: var(--s-surface-overlay-default);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
.option-list-item__label {
|
|
113
|
+
.option-list-item__label-container {
|
|
114
|
+
display: flex;
|
|
113
115
|
flex-grow: 1;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.option-list-item__label {
|
|
114
120
|
color: var(--s-text-default);
|
|
115
121
|
font-size: var(--s-font-size-base);
|
|
116
122
|
font-weight: var(--s-font-weight-medium);
|
|
@@ -126,6 +132,22 @@
|
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
|
|
135
|
+
.option-list-item__description {
|
|
136
|
+
color: var(--s-text-subdued);
|
|
137
|
+
font-size: var(--s-font-size-base);
|
|
138
|
+
font-weight: var(--s-font-weight-medium);
|
|
139
|
+
line-height: var(--s-line-height-base);
|
|
140
|
+
text-align: left;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
144
|
+
|
|
145
|
+
.option-list-item__description {
|
|
146
|
+
font-size: var(--s-font-size-sm);
|
|
147
|
+
line-height: var(--s-line-height-sm)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
129
151
|
.option-list-item__icon {
|
|
130
152
|
display: inline-flex;
|
|
131
153
|
flex-shrink: 0;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { getDesktopMediaQuery } from "../../utils";
|
|
4
|
+
import { v4 as uuid } from "uuid";
|
|
4
5
|
export class SwirlOptionListItem {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.desktopMediaQuery = getDesktopMediaQuery();
|
|
8
|
+
this.id = uuid();
|
|
7
9
|
this.desktopMediaQueryHandler = (event) => {
|
|
8
10
|
this.forceIconProps(event.matches);
|
|
9
11
|
this.updateIconSize(event.matches);
|
|
@@ -22,6 +24,7 @@ export class SwirlOptionListItem {
|
|
|
22
24
|
};
|
|
23
25
|
this.allowDrag = undefined;
|
|
24
26
|
this.context = "single-select";
|
|
27
|
+
this.description = undefined;
|
|
25
28
|
this.disabled = undefined;
|
|
26
29
|
this.dragging = undefined;
|
|
27
30
|
this.dragHandleDescription = "Press spacebar to toggle grab";
|
|
@@ -61,7 +64,9 @@ export class SwirlOptionListItem {
|
|
|
61
64
|
"option-list-item--dragging": this.dragging,
|
|
62
65
|
"option-list-item--selected": this.selected,
|
|
63
66
|
});
|
|
64
|
-
return (h(Host, null, h("div", { "aria-checked": this.swirlAriaRole === "menuitemradio" ? ariaSelected : undefined, "aria-
|
|
67
|
+
return (h(Host, null, h("div", { "aria-checked": this.swirlAriaRole === "menuitemradio" ? ariaSelected : undefined, "aria-describedby": Boolean(this.description)
|
|
68
|
+
? `option-list-item-${this.id}-description`
|
|
69
|
+
: undefined, "aria-disabled": ariaDisabled, "aria-labelledby": `option-list-item-${this.id}-label`, "aria-selected": this.swirlAriaRole === "option" ? ariaSelected : undefined, class: className, id: `option-list-item-${this.id}`, onBlur: this.onBlur, onFocus: this.onFocus, part: "option-list-item", role: this.swirlAriaRole }, showIcon && (h("span", { class: "option-list-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), showCheckbox && (h("span", { class: "option-list-item__checkbox" }, h("span", { class: "option-list-item__checkbox-box" }, this.selected && (h("swirl-icon-check-strong", { class: "option-list-item__checkbox-icon", size: 16 }))))), h("span", { class: "option-list-item__label-container" }, h("span", { class: "option-list-item__label", id: `option-list-item-${this.id}-label`, part: "option-list-item__label" }, this.label), this.description && (h("span", { class: "option-list-item__description", id: `option-list-item-${this.id}-description` }, this.description))), showSelectionIcon && (h("span", { class: "option-list-item__selection-icon" }, h("swirl-icon-check-small", { size: this.iconSize })))), this.allowDrag && (h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "option-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, tabIndex: this.focused ? 0 : -1, type: "button" }, h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
65
70
|
}
|
|
66
71
|
static get is() { return "swirl-option-list-item"; }
|
|
67
72
|
static get encapsulation() { return "scoped"; }
|
|
@@ -117,6 +122,23 @@ export class SwirlOptionListItem {
|
|
|
117
122
|
"reflect": false,
|
|
118
123
|
"defaultValue": "\"single-select\""
|
|
119
124
|
},
|
|
125
|
+
"description": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "string",
|
|
130
|
+
"resolved": "string",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": true,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"attribute": "description",
|
|
140
|
+
"reflect": false
|
|
141
|
+
},
|
|
120
142
|
"disabled": {
|
|
121
143
|
"type": "boolean",
|
|
122
144
|
"mutable": false,
|
|
@@ -13,14 +13,17 @@ describe("swirl-option-list-item", () => {
|
|
|
13
13
|
value="Value">
|
|
14
14
|
</swirl-option-list-item>`,
|
|
15
15
|
});
|
|
16
|
+
const id = page.root.children[0].id;
|
|
16
17
|
expect(page.root).toEqualHtml(`
|
|
17
18
|
<swirl-option-list-item context="single-select" disabled="false" icon="<swirl-icon-mention></swirl-icon-mention>" label="Option List Item" selected="true" value="Value">
|
|
18
|
-
<div aria-selected="true" class="option-list-item option-list-item--context-single-select option-list-item--selected" part="option-list-item" role="option">
|
|
19
|
+
<div aria-labelledby="${id}-label" aria-selected="true" class="option-list-item option-list-item--context-single-select option-list-item--selected" id="${id}" part="option-list-item" role="option">
|
|
19
20
|
<span class="option-list-item__icon">
|
|
20
21
|
<swirl-icon-mention size="24"></swirl-icon-mention>
|
|
21
22
|
</span>
|
|
22
|
-
<span class="option-list-item__label
|
|
23
|
-
|
|
23
|
+
<span class="option-list-item__label-container">
|
|
24
|
+
<span class="option-list-item__label" id="${id}-label" part="option-list-item__label">
|
|
25
|
+
Option List Item
|
|
26
|
+
</span>
|
|
24
27
|
</span>
|
|
25
28
|
<span class="option-list-item__selection-icon">
|
|
26
29
|
<swirl-icon-check-small size="24"></swirl-icon-check-small>
|