@brightspace-ui/labs 1.2.1 → 1.2.3
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
|
@@ -11,7 +11,6 @@ The `<d2l-labs-opt-in-flyout>` and `<d2l-labs-opt-out-flyout>` can be used in ap
|
|
|
11
11
|
| `flyout-title` | String, required | Title to display at the top of the flyout |
|
|
12
12
|
| `short-description` | String |Descriptive text shown beneath the `flyout-title` |
|
|
13
13
|
| `long-description` | String | Additional text shown beneath `short-description` |
|
|
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
14
|
| `tutorial-link` | String | A URL for a tutorial of the new experience or feature |
|
|
16
15
|
| `help-docs-link` | String | A URL for help documentation on the new experience or feature |
|
|
17
16
|
|
|
@@ -8,7 +8,6 @@ import { css, html, LitElement, nothing } from 'lit';
|
|
|
8
8
|
import { classMap } from 'lit/directives/class-map.js';
|
|
9
9
|
import { composeMixins } from '@brightspace-ui/core/helpers/composeMixins.js';
|
|
10
10
|
import { LocalizeLabsElement } from '../localize-labs-element.js';
|
|
11
|
-
import { RtlMixin } from '@brightspace-ui/core/mixins/rtl-mixin.js';
|
|
12
11
|
|
|
13
12
|
const VISIBLE_STATES = Object.freeze({
|
|
14
13
|
opened: 'OPENED',
|
|
@@ -19,8 +18,7 @@ const VISIBLE_STATES = Object.freeze({
|
|
|
19
18
|
|
|
20
19
|
class FlyoutImplementation extends composeMixins(
|
|
21
20
|
LitElement,
|
|
22
|
-
LocalizeLabsElement
|
|
23
|
-
RtlMixin
|
|
21
|
+
LocalizeLabsElement
|
|
24
22
|
) {
|
|
25
23
|
|
|
26
24
|
static get properties() {
|
|
@@ -30,8 +28,6 @@ class FlyoutImplementation extends composeMixins(
|
|
|
30
28
|
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
31
29
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
32
30
|
longDescription: { type: String, attribute: 'long-description' },
|
|
33
|
-
tabPosition: { type: String, attribute: 'tab-position' },
|
|
34
|
-
noTransform: { type: Boolean, attribute: 'no-transform' },
|
|
35
31
|
tutorialLink: { type: String, attribute: 'tutorial-link' },
|
|
36
32
|
helpDocsLink: { type: String, attribute: 'help-docs-link' },
|
|
37
33
|
hideReason: { type: Boolean, attribute: 'hide-reason' },
|
|
@@ -153,12 +149,13 @@ class FlyoutImplementation extends composeMixins(
|
|
|
153
149
|
box-sizing: border-box;
|
|
154
150
|
cursor: pointer;
|
|
155
151
|
height: 1rem;
|
|
152
|
+
inset-block-start: 0;
|
|
153
|
+
inset-inline-end: 15px;
|
|
156
154
|
min-height: 0;
|
|
157
155
|
padding: 1px;
|
|
158
156
|
pointer-events: auto;
|
|
159
157
|
position: absolute;
|
|
160
158
|
text-align: center;
|
|
161
|
-
top: 0;
|
|
162
159
|
width: 5rem;
|
|
163
160
|
}
|
|
164
161
|
|
|
@@ -187,7 +184,6 @@ class FlyoutImplementation extends composeMixins(
|
|
|
187
184
|
|
|
188
185
|
constructor() {
|
|
189
186
|
super();
|
|
190
|
-
this.tabPosition = 'right';
|
|
191
187
|
this._visibleState = VISIBLE_STATES.closed;
|
|
192
188
|
}
|
|
193
189
|
|
|
@@ -203,7 +199,7 @@ class FlyoutImplementation extends composeMixins(
|
|
|
203
199
|
<span tabindex="${this._getTabIndex()}" @focus="${this._shiftToLast}"></span>
|
|
204
200
|
${this._renderFlyoutContent()}
|
|
205
201
|
<div class="flyout-tab-container">
|
|
206
|
-
<button id="flyout-tab" class="flyout-tab"
|
|
202
|
+
<button id="flyout-tab" class="flyout-tab" aria-label="${this._getAriaLabelForTab()}" @click="${this._clickTab}">
|
|
207
203
|
<d2l-icon icon="${this._getTabIcon()}"></d2l-icon>
|
|
208
204
|
</button>
|
|
209
205
|
</div>
|
|
@@ -320,35 +316,6 @@ class FlyoutImplementation extends composeMixins(
|
|
|
320
316
|
return this.opened ? 0 : -1;
|
|
321
317
|
}
|
|
322
318
|
|
|
323
|
-
_getTabStyle() {
|
|
324
|
-
let rtl = this.dir === 'rtl';
|
|
325
|
-
let position = '';
|
|
326
|
-
if (this.tabPosition === 'left') {
|
|
327
|
-
position = 'calc(2.5rem + 15px)';
|
|
328
|
-
} else if (this.tabPosition === 'right' || this.tabPosition === 'default' || !this.tabPosition) {
|
|
329
|
-
position = 'calc(2.5rem + 15px)';
|
|
330
|
-
rtl = !rtl;
|
|
331
|
-
} else if (this.tabPosition === 'center' || this.tabPosition === 'centre') {
|
|
332
|
-
position = '50%';
|
|
333
|
-
} else if (!/^\d+(?:\.\d+)?%$/.test(this.tabPosition)) {
|
|
334
|
-
/* eslint-disable no-console */
|
|
335
|
-
console.warn('Invalid position supplied to opt-in flyout');
|
|
336
|
-
position = 'calc(2.5rem + 15px)';
|
|
337
|
-
rtl = !rtl;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const side = rtl ? 'right' : 'left';
|
|
341
|
-
const shift = rtl ? '50%' : '-50%';
|
|
342
|
-
|
|
343
|
-
const tabStyle = `${side}: ${position};`;
|
|
344
|
-
|
|
345
|
-
if (this.noTransform) {
|
|
346
|
-
return tabStyle;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
return `${tabStyle} transform: translateX(${shift});`;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
319
|
_getTutorialLink(i) {
|
|
353
320
|
if (this.tutorialLink && this.helpDocsLink) {
|
|
354
321
|
const translation = this.localize('components:optInFlyout:tutorialAndHelpMessage');
|
|
@@ -10,7 +10,6 @@ class OptInFlyout extends LitElement {
|
|
|
10
10
|
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
11
11
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
12
12
|
longDescription: { type: String, attribute: 'long-description' },
|
|
13
|
-
tabPosition: { type: String, attribute: 'tab-position' },
|
|
14
13
|
tutorialLink: { type: String, attribute: 'tutorial-link' },
|
|
15
14
|
helpDocsLink: { type: String, attribute: 'help-docs-link' }
|
|
16
15
|
};
|
|
@@ -36,7 +35,6 @@ class OptInFlyout extends LitElement {
|
|
|
36
35
|
flyout-title="${this.flyoutTitle}"
|
|
37
36
|
short-description="${this.shortDescription}"
|
|
38
37
|
long-description="${this.longDescription}"
|
|
39
|
-
tab-position="${this.tabPosition}"
|
|
40
38
|
tutorial-link="${this.tutorialLink}"
|
|
41
39
|
help-docs-link="${this.helpDocsLink}"
|
|
42
40
|
?opened="${this.opened}"
|
|
@@ -10,8 +10,6 @@ class OptOutFlyout extends LitElement {
|
|
|
10
10
|
flyoutTitle: { attribute: 'flyout-title', type: String },
|
|
11
11
|
shortDescription: { type: String, attribute: 'short-description' },
|
|
12
12
|
longDescription: { type: String, attribute: 'long-description' },
|
|
13
|
-
tabPosition: { type: String, attribute: 'tab-position' },
|
|
14
|
-
noTransform: { type: Boolean, attribute: 'no-transform' },
|
|
15
13
|
tutorialLink: { type: String, attribute: 'tutorial-link' },
|
|
16
14
|
helpDocsLink: { type: String, attribute: 'help-docs-link' },
|
|
17
15
|
hideReason: { type: Boolean, attribute: 'hide-reason' },
|
|
@@ -41,12 +39,10 @@ class OptOutFlyout extends LitElement {
|
|
|
41
39
|
flyout-title="${this.flyoutTitle}"
|
|
42
40
|
short-description="${this.shortDescription}"
|
|
43
41
|
long-description="${this.longDescription}"
|
|
44
|
-
tab-position="${this.tabPosition}"
|
|
45
42
|
tutorial-link="${this.tutorialLink}"
|
|
46
43
|
help-docs-link="${this.helpDocsLink}"
|
|
47
44
|
?hide-reason="${this.hideReason}"
|
|
48
45
|
?hide-feedback="${this.hideFeedback}"
|
|
49
|
-
?no-transform="${this.noTransform}"
|
|
50
46
|
?opened="${this.opened}"
|
|
51
47
|
@flyout-opened="${this._handleOpened}"
|
|
52
48
|
@flyout-closed="${this._handleClosed}">
|