@brightspace-ui/labs 1.2.0 → 1.2.1
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/package.json
CHANGED
|
@@ -7,9 +7,9 @@ The `<d2l-labs-opt-in-flyout>` and `<d2l-labs-opt-out-flyout>` can be used in ap
|
|
|
7
7
|
|
|
8
8
|
| Property | Type | Description |
|
|
9
9
|
|---|---|---|
|
|
10
|
-
| `
|
|
11
|
-
| `title` | String, required | Title to display at the top of the flyout |
|
|
12
|
-
| `short-description` | String |Descriptive text shown beneath the `title` |
|
|
10
|
+
| `opened` | Boolean, default: `false` | Indicates the opened or closed state of the flyout |
|
|
11
|
+
| `flyout-title` | String, required | Title to display at the top of the flyout |
|
|
12
|
+
| `short-description` | String |Descriptive text shown beneath the `flyout-title` |
|
|
13
13
|
| `long-description` | String | Additional text shown beneath `short-description` |
|
|
14
14
|
| `tab-position` | String, default: `'right'` | Position to display the expand/collapse tab. Can either be an integer percentage (including the `%` character) or the string `left`, `right`, or `center`/`centre`. |
|
|
15
15
|
| `tutorial-link` | String | A URL for a tutorial of the new experience or feature |
|
|
@@ -26,8 +26,8 @@ class FlyoutImplementation extends composeMixins(
|
|
|
26
26
|
static get properties() {
|
|
27
27
|
return {
|
|
28
28
|
optOut: { type: Boolean, attribute: 'opt-out' },
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
opened: { type: Boolean, reflect: true },
|
|
30
|
+
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
31
31
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
32
32
|
longDescription: { type: String, attribute: 'long-description' },
|
|
33
33
|
tabPosition: { type: String, attribute: 'tab-position' },
|
|
@@ -193,7 +193,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
193
193
|
|
|
194
194
|
connectedCallback() {
|
|
195
195
|
super.connectedCallback();
|
|
196
|
-
this._visibleState = this.
|
|
196
|
+
this._visibleState = this.opened ? VISIBLE_STATES.opened : VISIBLE_STATES.closed;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
render() {
|
|
@@ -214,8 +214,8 @@ class FlyoutImplementation extends composeMixins(
|
|
|
214
214
|
|
|
215
215
|
updated(changedProperties) {
|
|
216
216
|
super.updated(changedProperties);
|
|
217
|
-
if (changedProperties.has('
|
|
218
|
-
this.
|
|
217
|
+
if (changedProperties.has('opened')) {
|
|
218
|
+
this._openedChanged();
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -243,7 +243,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
243
243
|
|
|
244
244
|
_clickOptIn() {
|
|
245
245
|
this._fireEvent('opt-in');
|
|
246
|
-
this.
|
|
246
|
+
this.opened = false;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
_clickOptOut() {
|
|
@@ -251,20 +251,20 @@ class FlyoutImplementation extends composeMixins(
|
|
|
251
251
|
this._optOutDialogOpen = true;
|
|
252
252
|
} else {
|
|
253
253
|
this._fireEvent('opt-out');
|
|
254
|
-
this.
|
|
254
|
+
this.opened = false;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
_clickTab() {
|
|
259
259
|
if (this._visibleState === VISIBLE_STATES.opened || this._visibleState === VISIBLE_STATES.closed) {
|
|
260
|
-
this.
|
|
260
|
+
this.opened = !this.opened;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
_confirmOptOut(event) {
|
|
265
265
|
this._optOutDialogOpen = false;
|
|
266
266
|
this._fireEvent('opt-out', event.detail);
|
|
267
|
-
this.
|
|
267
|
+
this.opened = false;
|
|
268
268
|
event.stopPropagation();
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -281,7 +281,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
_getAriaLabelForTab() {
|
|
284
|
-
if (this.
|
|
284
|
+
if (this.opened) {
|
|
285
285
|
return this.localize('components:optInFlyout:close');
|
|
286
286
|
}
|
|
287
287
|
return this.localize(this.optOut ? 'components:optInFlyout:openOptOut' : 'components:optInFlyout:openOptIn');
|
|
@@ -317,7 +317,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
_getTabIndex() {
|
|
320
|
-
return this.
|
|
320
|
+
return this.opened ? 0 : -1;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
_getTabStyle() {
|
|
@@ -386,13 +386,13 @@ class FlyoutImplementation extends composeMixins(
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
|
|
390
|
-
if (this.
|
|
389
|
+
_openedChanged() {
|
|
390
|
+
if (this.opened && this._visibleState === VISIBLE_STATES.closed || this._visibleState === VISIBLE_STATES.closing) {
|
|
391
391
|
this._visibleState = VISIBLE_STATES.opening;
|
|
392
|
-
} else if (!this.
|
|
392
|
+
} else if (!this.opened && this._visibleState === VISIBLE_STATES.opened || this._visibleState === VISIBLE_STATES.opening) {
|
|
393
393
|
this._visibleState = VISIBLE_STATES.closing;
|
|
394
394
|
}
|
|
395
|
-
this._fireEvent(this.
|
|
395
|
+
this._fireEvent(this.opened ? 'flyout-opened' : 'flyout-closed');
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
_renderFlyoutContent() {
|
|
@@ -402,7 +402,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
402
402
|
return html`
|
|
403
403
|
<div id="flyout-content" role="dialog" aria-labelledby="title" aria-describedby="${this._getDescription()}" class="flyout-content">
|
|
404
404
|
<div class="flyout-text">
|
|
405
|
-
<h1 class="d2l-heading-1" id="title">${this.
|
|
405
|
+
<h1 class="d2l-heading-1" id="title">${this.flyoutTitle}</h1>
|
|
406
406
|
${this._renderShortDescription()}
|
|
407
407
|
${this._renderLongDescription()}
|
|
408
408
|
${this._renderLinksText()}
|
|
@@ -491,7 +491,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
_shiftToLast() {
|
|
494
|
-
if (this.
|
|
494
|
+
if (this.opened) {
|
|
495
495
|
this.shadowRoot.querySelector('#flyout-tab').focus();
|
|
496
496
|
}
|
|
497
497
|
}
|
|
@@ -6,8 +6,8 @@ class OptInFlyout extends LitElement {
|
|
|
6
6
|
|
|
7
7
|
static get properties() {
|
|
8
8
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
opened: { type: Boolean, reflect: true },
|
|
10
|
+
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
11
11
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
12
12
|
longDescription: { type: String, attribute: 'long-description' },
|
|
13
13
|
tabPosition: { type: String, attribute: 'tab-position' },
|
|
@@ -26,20 +26,20 @@ class OptInFlyout extends LitElement {
|
|
|
26
26
|
|
|
27
27
|
constructor() {
|
|
28
28
|
super();
|
|
29
|
-
this.
|
|
29
|
+
this.opened = false;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
render() {
|
|
33
33
|
return html`
|
|
34
34
|
<d2l-labs-opt-in-flyout-impl
|
|
35
35
|
class="d2l-typography"
|
|
36
|
-
title="${this.
|
|
36
|
+
flyout-title="${this.flyoutTitle}"
|
|
37
37
|
short-description="${this.shortDescription}"
|
|
38
38
|
long-description="${this.longDescription}"
|
|
39
39
|
tab-position="${this.tabPosition}"
|
|
40
40
|
tutorial-link="${this.tutorialLink}"
|
|
41
41
|
help-docs-link="${this.helpDocsLink}"
|
|
42
|
-
?
|
|
42
|
+
?opened="${this.opened}"
|
|
43
43
|
@flyout-opened="${this._handleOpened}"
|
|
44
44
|
@flyout-closed="${this._handleClosed}">
|
|
45
45
|
</d2l-labs-opt-in-flyout-impl>
|
|
@@ -47,11 +47,11 @@ class OptInFlyout extends LitElement {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
_handleClosed() {
|
|
50
|
-
this.
|
|
50
|
+
this.opened = false;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
_handleOpened() {
|
|
54
|
-
this.
|
|
54
|
+
this.opened = true;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
}
|
|
@@ -6,8 +6,8 @@ class OptOutFlyout extends LitElement {
|
|
|
6
6
|
|
|
7
7
|
static get properties() {
|
|
8
8
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
opened: { type: Boolean, reflect: true },
|
|
10
|
+
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
11
11
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
12
12
|
longDescription: { type: String, attribute: 'long-description' },
|
|
13
13
|
tabPosition: { type: String, attribute: 'tab-position' },
|
|
@@ -29,7 +29,7 @@ class OptOutFlyout extends LitElement {
|
|
|
29
29
|
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
|
-
this.
|
|
32
|
+
this.opened = false;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
render() {
|
|
@@ -38,7 +38,7 @@ class OptOutFlyout extends LitElement {
|
|
|
38
38
|
id="flyout-impl"
|
|
39
39
|
class="d2l-typography"
|
|
40
40
|
opt-out
|
|
41
|
-
title="${this.
|
|
41
|
+
flyout-title="${this.flyoutTitle}"
|
|
42
42
|
short-description="${this.shortDescription}"
|
|
43
43
|
long-description="${this.longDescription}"
|
|
44
44
|
tab-position="${this.tabPosition}"
|
|
@@ -47,7 +47,7 @@ class OptOutFlyout extends LitElement {
|
|
|
47
47
|
?hide-reason="${this.hideReason}"
|
|
48
48
|
?hide-feedback="${this.hideFeedback}"
|
|
49
49
|
?no-transform="${this.noTransform}"
|
|
50
|
-
?
|
|
50
|
+
?opened="${this.opened}"
|
|
51
51
|
@flyout-opened="${this._handleOpened}"
|
|
52
52
|
@flyout-closed="${this._handleClosed}">
|
|
53
53
|
<slot></slot>
|
|
@@ -70,11 +70,11 @@ class OptOutFlyout extends LitElement {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
_handleClosed() {
|
|
73
|
-
this.
|
|
73
|
+
this.opened = false;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
_handleOpened() {
|
|
77
|
-
this.
|
|
77
|
+
this.opened = true;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
}
|