@brightspace-ui/core 2.63.0 → 2.64.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/demo/demo-snippet.js +49 -11
- package/custom-elements.json +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import './code-view.js';
|
|
2
|
-
import '../button/button-
|
|
2
|
+
import '../button/button-subtle.js';
|
|
3
3
|
import '../switch/switch.js';
|
|
4
|
+
import '../dropdown/dropdown.js';
|
|
5
|
+
import '../dropdown/dropdown-content.js';
|
|
4
6
|
import { css, html, LitElement } from 'lit';
|
|
5
7
|
|
|
6
8
|
class DemoSnippet extends LitElement {
|
|
@@ -8,13 +10,14 @@ class DemoSnippet extends LitElement {
|
|
|
8
10
|
static get properties() {
|
|
9
11
|
return {
|
|
10
12
|
codeViewHidden: { type: Boolean, reflect: true, attribute: 'code-view-hidden' },
|
|
11
|
-
fullWidth: { type: Boolean, reflect: true },
|
|
13
|
+
fullWidth: { type: Boolean, reflect: true, attribute: 'full-width' },
|
|
12
14
|
noPadding: { type: Boolean, reflect: true, attribute: 'no-padding' },
|
|
13
15
|
overflowHidden: { type: Boolean, reflect: true, attribute: 'overflow-hidden' },
|
|
14
16
|
_code: { type: String },
|
|
15
17
|
_dir: { type: String, attribute: false },
|
|
16
18
|
_fullscreen: { state: true },
|
|
17
19
|
_hasSkeleton: { type: Boolean, attribute: false },
|
|
20
|
+
_settingsPeek: { state: true },
|
|
18
21
|
_skeletonOn: { type: Boolean, reflect: false }
|
|
19
22
|
};
|
|
20
23
|
}
|
|
@@ -40,14 +43,18 @@ class DemoSnippet extends LitElement {
|
|
|
40
43
|
}
|
|
41
44
|
.d2l-demo-snippet-demo-wrapper.fullscreen {
|
|
42
45
|
background-color: white;
|
|
46
|
+
height: fit-content;
|
|
43
47
|
inset: 0;
|
|
44
|
-
|
|
45
|
-
position: fixed;
|
|
48
|
+
position: absolute;
|
|
46
49
|
z-index: 2;
|
|
47
50
|
}
|
|
48
51
|
.d2l-demo-snippet-demo {
|
|
49
52
|
flex: 1 1 auto;
|
|
50
53
|
position: relative;
|
|
54
|
+
translate: 0; /* create stacking context to prevent demos from leaking outside their containers */
|
|
55
|
+
}
|
|
56
|
+
:host([full-width]) .d2l-demo-snippet-demo-wrapper.fullscreen .d2l-demo-snippet-demo {
|
|
57
|
+
width: 100vw;
|
|
51
58
|
}
|
|
52
59
|
:host([overflow-hidden]) .d2l-demo-snippet-demo {
|
|
53
60
|
overflow: hidden;
|
|
@@ -68,6 +75,27 @@ class DemoSnippet extends LitElement {
|
|
|
68
75
|
position: sticky;
|
|
69
76
|
top: 0;
|
|
70
77
|
}
|
|
78
|
+
d2l-dropdown.settings-dropdown {
|
|
79
|
+
background-color: white;
|
|
80
|
+
border-radius: 6px;
|
|
81
|
+
box-shadow: 0 0 0 1px var(--d2l-color-celestine-minus-1);
|
|
82
|
+
position: fixed;
|
|
83
|
+
right: 1rem;
|
|
84
|
+
top: -0.25rem;
|
|
85
|
+
translate: 0 -1.5rem;
|
|
86
|
+
}
|
|
87
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
88
|
+
d2l-dropdown.settings-dropdown {
|
|
89
|
+
transition: translate 0.15s, box-shadow 0.15s;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
d2l-dropdown.settings-dropdown.peek,
|
|
93
|
+
d2l-dropdown.settings-dropdown:hover,
|
|
94
|
+
d2l-dropdown.settings-dropdown:focus-within,
|
|
95
|
+
d2l-dropdown.settings-dropdown:has(d2l-button-subtle[active]) {
|
|
96
|
+
box-shadow: 0 -1px 0 1px white;
|
|
97
|
+
translate: 0;
|
|
98
|
+
}
|
|
71
99
|
d2l-code-view {
|
|
72
100
|
border: none;
|
|
73
101
|
border-top-left-radius: 0;
|
|
@@ -78,7 +106,7 @@ class DemoSnippet extends LitElement {
|
|
|
78
106
|
:host([code-view-hidden]) d2l-code-view {
|
|
79
107
|
display: none;
|
|
80
108
|
}
|
|
81
|
-
|
|
109
|
+
`;
|
|
82
110
|
}
|
|
83
111
|
|
|
84
112
|
constructor() {
|
|
@@ -97,6 +125,16 @@ class DemoSnippet extends LitElement {
|
|
|
97
125
|
render() {
|
|
98
126
|
const dirAttr = this._dir === 'rtl' ? 'rtl' : 'ltr';
|
|
99
127
|
const skeleton = this._hasSkeleton ? html`<d2l-switch text="Skeleton" ?on="${this._skeletonOn}" @change="${this._handleSkeletonChange}"></d2l-switch>` : null;
|
|
128
|
+
const switches = html`
|
|
129
|
+
<d2l-switch text="RTL" ?on="${dirAttr === 'rtl'}" @change="${this._handleDirChange}"></d2l-switch><br />
|
|
130
|
+
<d2l-switch text="Fullscreen" ?on="${this._fullscreen}" @change="${this._handleFullscreenChange}"></d2l-switch><br />
|
|
131
|
+
${skeleton}`;
|
|
132
|
+
const settings = this.fullWidth && this._fullscreen ? html`
|
|
133
|
+
<d2l-dropdown class="settings-dropdown ${this._settingsPeek ? 'peek' : ''}">
|
|
134
|
+
<d2l-button-subtle primary icon="tier1:gear" text="Settings" class="d2l-dropdown-opener"></d2l-button-subtle>
|
|
135
|
+
<d2l-dropdown-content>${switches}</d2l-dropdown-content>
|
|
136
|
+
</d2l-dropdown>` : html`<div class="d2l-demo-snippet-settings">${switches}</div>`;
|
|
137
|
+
|
|
100
138
|
return html`
|
|
101
139
|
<div class="d2l-demo-snippet-demo-wrapper ${this._fullscreen ? 'fullscreen' : ''}">
|
|
102
140
|
<div class="d2l-demo-snippet-demo" dir="${dirAttr}">
|
|
@@ -105,11 +143,7 @@ class DemoSnippet extends LitElement {
|
|
|
105
143
|
<slot></slot>
|
|
106
144
|
</div>
|
|
107
145
|
</div>
|
|
108
|
-
|
|
109
|
-
<d2l-switch text="RTL" ?on="${dirAttr === 'rtl'}" @change="${this._handleDirChange}"></d2l-switch><br />
|
|
110
|
-
<d2l-switch text="Fullscreen" ?on="${this._fullscreen}" @change="${this._handleFullscreenChange}"></d2l-switch><br />
|
|
111
|
-
${skeleton}
|
|
112
|
-
</div>
|
|
146
|
+
${settings}
|
|
113
147
|
</div>
|
|
114
148
|
<d2l-code-view language="html" hide-language>${this._code}</d2l-code-view>
|
|
115
149
|
`;
|
|
@@ -201,10 +235,14 @@ class DemoSnippet extends LitElement {
|
|
|
201
235
|
this._applyAttr('dir', this._dir, true);
|
|
202
236
|
}
|
|
203
237
|
|
|
204
|
-
_handleFullscreenChange(e) {
|
|
238
|
+
async _handleFullscreenChange(e) {
|
|
205
239
|
this._fullscreen = e.target.on;
|
|
240
|
+
this._settingsPeek = this._fullscreen;
|
|
206
241
|
const event = new CustomEvent('d2l-demo-snippet-fullscreen-toggle', { bubbles: true, composed: true });
|
|
207
242
|
this.dispatchEvent(event);
|
|
243
|
+
await this.updateComplete;
|
|
244
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
245
|
+
this._settingsPeek = false;
|
|
208
246
|
}
|
|
209
247
|
|
|
210
248
|
_handleSkeletonChange(e) {
|
package/custom-elements.json
CHANGED
|
@@ -1436,7 +1436,7 @@
|
|
|
1436
1436
|
"type": "boolean"
|
|
1437
1437
|
},
|
|
1438
1438
|
{
|
|
1439
|
-
"name": "
|
|
1439
|
+
"name": "full-width",
|
|
1440
1440
|
"type": "boolean",
|
|
1441
1441
|
"default": "false"
|
|
1442
1442
|
}
|
|
@@ -1459,7 +1459,7 @@
|
|
|
1459
1459
|
},
|
|
1460
1460
|
{
|
|
1461
1461
|
"name": "fullWidth",
|
|
1462
|
-
"attribute": "
|
|
1462
|
+
"attribute": "full-width",
|
|
1463
1463
|
"type": "boolean",
|
|
1464
1464
|
"default": "false"
|
|
1465
1465
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.64.0",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|