@brightspace-ui/core 3.286.2 → 3.287.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.
|
@@ -394,8 +394,11 @@ export const DropdownPopoverMixin = superclass => class extends LocalizeCoreElem
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
#toggleScrollStyles() {
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
// scrollHeight can sometimes not be updated right away
|
|
398
|
+
requestAnimationFrame(() => {
|
|
399
|
+
this._blockEndScroll = this.#contentElement.scrollHeight - (this.#contentElement.scrollTop + this.#contentElement.clientHeight) >= 5;
|
|
400
|
+
this._blockStartScroll = this.#contentElement.scrollTop !== 0;
|
|
401
|
+
});
|
|
399
402
|
}
|
|
400
403
|
|
|
401
404
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import '../icons/icon-custom.js';
|
|
3
|
-
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
4
4
|
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
5
5
|
import { formatPercent } from '@brightspace-ui/intl';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -138,6 +138,41 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
138
138
|
color: white;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
.divider-arrow {
|
|
142
|
+
align-items: center;
|
|
143
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
display: none;
|
|
146
|
+
height: 24px;
|
|
147
|
+
inset-block-start: max(50%, 97px); /* Do not hide behind slider on short screens */
|
|
148
|
+
justify-content: center;
|
|
149
|
+
position: absolute;
|
|
150
|
+
transform: translateY(-50%);
|
|
151
|
+
width: 24px;
|
|
152
|
+
}
|
|
153
|
+
.divider-arrow d2l-icon-custom {
|
|
154
|
+
color: var(--d2l-color-celestine);
|
|
155
|
+
}
|
|
156
|
+
.divider:focus-within .divider-arrow:not([hidden]) {
|
|
157
|
+
display: flex;
|
|
158
|
+
}
|
|
159
|
+
.divider-arrow:hover {
|
|
160
|
+
background-color: var(--d2l-color-gypsum);
|
|
161
|
+
}
|
|
162
|
+
.divider-arrow:hover d2l-icon-custom {
|
|
163
|
+
color: var(--d2l-color-celestine-minus-1);
|
|
164
|
+
}
|
|
165
|
+
.divider-arrow.start {
|
|
166
|
+
border-end-start-radius: 6px;
|
|
167
|
+
border-start-start-radius: 6px;
|
|
168
|
+
inset-inline-end: 100%;
|
|
169
|
+
}
|
|
170
|
+
.divider-arrow.end {
|
|
171
|
+
border-end-end-radius: 6px;
|
|
172
|
+
border-start-end-radius: 6px;
|
|
173
|
+
inset-inline-start: 100%;
|
|
174
|
+
}
|
|
175
|
+
|
|
141
176
|
:host([panel-type="drawer"]) .divider {
|
|
142
177
|
background-color: var(--d2l-color-celestine);
|
|
143
178
|
cursor: ns-resize;
|
|
@@ -150,7 +185,7 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
150
185
|
top: auto;
|
|
151
186
|
}
|
|
152
187
|
|
|
153
|
-
/* TO DO: Lots more
|
|
188
|
+
/* TO DO: Lots more drawer styling to come */
|
|
154
189
|
|
|
155
190
|
`;
|
|
156
191
|
|
|
@@ -169,13 +204,22 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
169
204
|
}
|
|
170
205
|
|
|
171
206
|
render() {
|
|
207
|
+
const { showStartArrow, showEndArrow } = this.#getArrowVisibility();
|
|
172
208
|
let ariaValues = {};
|
|
173
209
|
if (this.maxSize > 0) {
|
|
174
210
|
ariaValues = { max: this.maxSize, min: 0, now: this.currentSize, text: formatPercent(this.currentSize / this.maxSize, { maximumFractionDigits: 0 }) };
|
|
175
211
|
}
|
|
176
212
|
|
|
177
213
|
return html`
|
|
178
|
-
<div class="divider" @pointerdown="${this.#handlePointerDown}">
|
|
214
|
+
<div class="divider" @click="${this.#handleClick}" @pointerdown="${this.#handlePointerDown}">
|
|
215
|
+
${this.panelType === 'panel' ? html`
|
|
216
|
+
<div class="divider-arrow start" data-position="start" ?hidden="${!showStartArrow}">
|
|
217
|
+
<d2l-icon-custom size="tier1">${ICON_ARROW_COLLAPSE_LEFT}</d2l-icon-custom>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="divider-arrow end" data-position="end" ?hidden="${!showEndArrow}">
|
|
220
|
+
<d2l-icon-custom size="tier1">${ICON_ARROW_COLLAPSE_RIGHT}</d2l-icon-custom>
|
|
221
|
+
</div>
|
|
222
|
+
` : nothing}
|
|
179
223
|
<div
|
|
180
224
|
class="slider"
|
|
181
225
|
role="slider"
|
|
@@ -197,6 +241,17 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
197
241
|
`;
|
|
198
242
|
}
|
|
199
243
|
|
|
244
|
+
#clickedHandle = false;
|
|
245
|
+
|
|
246
|
+
#getArrowVisibility() {
|
|
247
|
+
if (this.panelType !== 'panel') return { showStartArrow: false, showEndArrow: false };
|
|
248
|
+
const canShrink = !this.collapsed && this.currentSize > this.minSize;
|
|
249
|
+
const canGrow = this.collapsed || this.currentSize < this.maxSize;
|
|
250
|
+
const showStartArrow = this.panelPosition === 'start' ? canShrink : canGrow;
|
|
251
|
+
const showEndArrow = this.panelPosition === 'start' ? canGrow : canShrink;
|
|
252
|
+
return { showStartArrow, showEndArrow };
|
|
253
|
+
}
|
|
254
|
+
|
|
200
255
|
#getHandleIcon() {
|
|
201
256
|
if (this.panelType === 'panel') {
|
|
202
257
|
if (this.panelPosition === 'start') {
|
|
@@ -209,6 +264,14 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
209
264
|
}
|
|
210
265
|
}
|
|
211
266
|
|
|
267
|
+
#handleClick(e) {
|
|
268
|
+
// Do not toggle until click event is received, to avoid clicking on elements under the handle in drawer mode
|
|
269
|
+
e.stopPropagation();
|
|
270
|
+
if (this.collapsed || this.#clickedHandle) {
|
|
271
|
+
this.#sendToggleEvent();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
212
275
|
#handleKeyDown(e) {
|
|
213
276
|
if (!['Enter', ' ', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.key)) return;
|
|
214
277
|
e.preventDefault();
|
|
@@ -248,12 +311,18 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
248
311
|
e.preventDefault();
|
|
249
312
|
this.focus();
|
|
250
313
|
|
|
251
|
-
const
|
|
252
|
-
|
|
314
|
+
const path = e.composedPath();
|
|
315
|
+
this.#clickedHandle = path.some(el => el.classList?.contains('divider-handle'));
|
|
253
316
|
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
317
|
+
const clickedArrow = path.find(el => el.classList?.contains('divider-arrow'));
|
|
318
|
+
if (clickedArrow) {
|
|
319
|
+
const endArrowClicked = clickedArrow.dataset.position === 'end';
|
|
320
|
+
const shouldGrow = endArrowClicked === (this.panelPosition === 'start');
|
|
321
|
+
|
|
322
|
+
const step = (shouldGrow ? 1 : -1) * KEYBOARD_STEP;
|
|
323
|
+
const requestedSize = this.currentSize + step;
|
|
324
|
+
this.#sendResizeEvent(requestedSize);
|
|
325
|
+
return;
|
|
257
326
|
}
|
|
258
327
|
}
|
|
259
328
|
|
package/custom-elements.json
CHANGED
|
@@ -13202,7 +13202,7 @@
|
|
|
13202
13202
|
"properties": [
|
|
13203
13203
|
{
|
|
13204
13204
|
"name": "styles",
|
|
13205
|
-
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t\\tflex: none;\\n\\t\\t}\\n\\t\\t.divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-mica);\\n\\t\\t\\tcursor: ew-resize;\\n\\t\\t\\theight: 100%;\\n\\t\\t\\tposition: relative;\\n\\t\\t\\twidth: ${DIVIDER_WIDTH}px;\\n\\t\\t}\\n\\t\\t.divider:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-corundum);\\n\\t\\t}\\n\\t\\t.divider:focus-within {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\n\\t\\t.slider {\\n\\t\\t\\tinset-inline-start: -${DIVIDER_HANDLE_SIZE / 2 - DIVIDER_WIDTH / 2}px;\\n\\t\\t\\toutline: none;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttop: 55px;\\n\\t\\t}\\n\\n\\t\\t.divider-handle {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tborder: 1px solid var(--d2l-color-mica);\\n\\t\\t\\tborder-radius: 50%;\\n\\t\\t\\tbox-sizing: border-box;\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\theight: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\twidth: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t}\\n\\t\\t.divider-handle:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle .handle-icon {\\n\\t\\t\\tcolor: white;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t\\tcursor: ns-resize;\\n\\t\\t\\theight: ${DIVIDER_WIDTH}px;\\n\\t\\t\\twidth: 100%;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .slider {\\n\\t\\t\\tinset-inline-end: 18px;\\n\\t\\t\\ttop: auto;\\n\\t\\t}\\n\\n\\t\\t/* TO DO: Lots more
|
|
13205
|
+
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t\\tflex: none;\\n\\t\\t}\\n\\t\\t.divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-mica);\\n\\t\\t\\tcursor: ew-resize;\\n\\t\\t\\theight: 100%;\\n\\t\\t\\tposition: relative;\\n\\t\\t\\twidth: ${DIVIDER_WIDTH}px;\\n\\t\\t}\\n\\t\\t.divider:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-corundum);\\n\\t\\t}\\n\\t\\t.divider:focus-within {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\n\\t\\t.slider {\\n\\t\\t\\tinset-inline-start: -${DIVIDER_HANDLE_SIZE / 2 - DIVIDER_WIDTH / 2}px;\\n\\t\\t\\toutline: none;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttop: 55px;\\n\\t\\t}\\n\\n\\t\\t.divider-handle {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tborder: 1px solid var(--d2l-color-mica);\\n\\t\\t\\tborder-radius: 50%;\\n\\t\\t\\tbox-sizing: border-box;\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\theight: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\twidth: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t}\\n\\t\\t.divider-handle:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle .handle-icon {\\n\\t\\t\\tcolor: white;\\n\\t\\t}\\n\\n\\t\\t.divider-arrow {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: rgba(255, 255, 255, 0.5);\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: none;\\n\\t\\t\\theight: 24px;\\n\\t\\t\\tinset-block-start: max(50%, 97px); /* Do not hide behind slider on short screens */\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttransform: translateY(-50%);\\n\\t\\t\\twidth: 24px;\\n\\t\\t}\\n\\t\\t.divider-arrow d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.divider:focus-within .divider-arrow:not([hidden]) {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t}\\n\\t\\t.divider-arrow:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t}\\n\\t\\t.divider-arrow:hover d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.divider-arrow.start {\\n\\t\\t\\tborder-end-start-radius: 6px;\\n\\t\\t\\tborder-start-start-radius: 6px;\\n\\t\\t\\tinset-inline-end: 100%;\\n\\t\\t}\\n\\t\\t.divider-arrow.end {\\n\\t\\t\\tborder-end-end-radius: 6px;\\n\\t\\t\\tborder-start-end-radius: 6px;\\n\\t\\t\\tinset-inline-start: 100%;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t\\tcursor: ns-resize;\\n\\t\\t\\theight: ${DIVIDER_WIDTH}px;\\n\\t\\t\\twidth: 100%;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .slider {\\n\\t\\t\\tinset-inline-end: 18px;\\n\\t\\t\\ttop: auto;\\n\\t\\t}\\n\\n\\t\\t/* TO DO: Lots more drawer styling to come */\\n\\n\\t`\""
|
|
13206
13206
|
},
|
|
13207
13207
|
{
|
|
13208
13208
|
"name": "focusElementSelector",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.287.1",
|
|
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",
|