@brightspace-ui/core 3.305.0 → 3.307.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.
|
@@ -174,6 +174,36 @@ Use icon buttons for compact, supplementary actions where space is limited and t
|
|
|
174
174
|
</d2l-button-icon>
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
## Button Iterator [d2l-button-iterator]
|
|
178
|
+
|
|
179
|
+
A navigation control for moving sequentially through a set of items.
|
|
180
|
+
|
|
181
|
+
<!-- docs: demo code properties name:d2l-button-iterator sandboxTitle:'Iterator Button' -->
|
|
182
|
+
```html
|
|
183
|
+
<script type="module">
|
|
184
|
+
import '@brightspace-ui/core/components/button/button-iterator.js';
|
|
185
|
+
</script>
|
|
186
|
+
<d2l-button-iterator></d2l-button-iterator>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
<!-- docs: start hidden content -->
|
|
190
|
+
### Properties
|
|
191
|
+
|
|
192
|
+
| Property | Type | Description |
|
|
193
|
+
|--|--|--|
|
|
194
|
+
| `description` | String | An optional description, typically for indicating the current position within the set of items |
|
|
195
|
+
| `previous-disabled` | Boolean | Disables the previous button |
|
|
196
|
+
| `previous-text` | String | Overrides the default text for the previous button |
|
|
197
|
+
| `next-disabled` | Boolean | Disables the next button |
|
|
198
|
+
| `next-only` | Boolean | Renders only the next button |
|
|
199
|
+
| `next-text` | String | Overrides the default text for the next button |
|
|
200
|
+
|
|
201
|
+
### Events
|
|
202
|
+
|
|
203
|
+
- `d2l-button-iterator-previous-click`: dispatched when the previous button is clicked
|
|
204
|
+
- `d2l-button-iterator-next-click`: dispatched when the next button is clicked
|
|
205
|
+
<!-- docs: end hidden content -->
|
|
206
|
+
|
|
177
207
|
## Toggle Button [d2l-button-toggle]
|
|
178
208
|
|
|
179
209
|
Use toggle buttons when users need to easily flip between two opposing states, such as when subscribing or unsubscribing.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import '../colors/colors.js';
|
|
2
|
+
import '../icons/icon.js';
|
|
3
|
+
import '../tooltip/tooltip.js';
|
|
4
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
5
|
+
import { buttonStyles } from './button-styles.js';
|
|
6
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
7
|
+
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
|
+
import { labelStyles } from '../typography/styles.js';
|
|
10
|
+
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
11
|
+
import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A navigation control for moving sequentially through a set of items.
|
|
15
|
+
*/
|
|
16
|
+
class ButtonIterator extends FocusMixin(PropertyRequiredMixin(LocalizeCoreElement(LitElement))) {
|
|
17
|
+
|
|
18
|
+
static properties = {
|
|
19
|
+
/**
|
|
20
|
+
* ACCESSIBILITY: An optional description, typically for indicating the current position within the set of items
|
|
21
|
+
* @type {string}
|
|
22
|
+
*/
|
|
23
|
+
description: { type: String },
|
|
24
|
+
/**
|
|
25
|
+
* Disables the previous button
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
previousDisabled: { attribute: 'previous-disabled', type: Boolean },
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the default text for the previous button
|
|
31
|
+
* @type {string}
|
|
32
|
+
*/
|
|
33
|
+
previousText: { attribute: 'previous-text', type: String },
|
|
34
|
+
/**
|
|
35
|
+
* Disables the next button
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
*/
|
|
38
|
+
nextDisabled: { attribute: 'next-disabled', type: Boolean },
|
|
39
|
+
/**
|
|
40
|
+
* Renders only the next button
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
nextOnly: { attribute: 'next-only', type: Boolean },
|
|
44
|
+
/**
|
|
45
|
+
* Overrides the default text for the next button
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
nextText: { attribute: 'next-text', type: String }
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
static styles = [buttonStyles, labelStyles, css`
|
|
52
|
+
:host {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
line-height: 0;
|
|
55
|
+
}
|
|
56
|
+
:host([hidden]) {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
.container {
|
|
60
|
+
align-items: center;
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 6px;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
}
|
|
65
|
+
.description {
|
|
66
|
+
margin-inline: 6px;
|
|
67
|
+
}
|
|
68
|
+
@media (max-width: 556px) {
|
|
69
|
+
.description {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.next {
|
|
74
|
+
--d2l-button-end-start-radius: 0;
|
|
75
|
+
--d2l-button-start-start-radius: 0;
|
|
76
|
+
}
|
|
77
|
+
.previous {
|
|
78
|
+
--d2l-button-end-end-radius: 0;
|
|
79
|
+
--d2l-button-start-end-radius: 0;
|
|
80
|
+
}
|
|
81
|
+
button {
|
|
82
|
+
background-color: var(--d2l-theme-background-color-interactive-secondary-default);
|
|
83
|
+
min-width: calc(2rem + 2px);
|
|
84
|
+
padding: 0;
|
|
85
|
+
}
|
|
86
|
+
button:not([disabled]):hover,
|
|
87
|
+
button:not([disabled]):focus {
|
|
88
|
+
background-color: var(--d2l-theme-background-color-interactive-secondary-hover);
|
|
89
|
+
}
|
|
90
|
+
button[disabled] {
|
|
91
|
+
cursor: default;
|
|
92
|
+
opacity: var(--d2l-theme-opacity-disabled-control);
|
|
93
|
+
}
|
|
94
|
+
`];
|
|
95
|
+
|
|
96
|
+
constructor() {
|
|
97
|
+
super();
|
|
98
|
+
this.description = undefined;
|
|
99
|
+
this.nextDisabled = false;
|
|
100
|
+
this.nextOnly = false;
|
|
101
|
+
this.nextText = undefined;
|
|
102
|
+
this.previousDisabled = false;
|
|
103
|
+
this.previousText = undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static get focusElementSelector() {
|
|
107
|
+
return 'button:not([disabled])';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
render() {
|
|
111
|
+
const nextText = this.nextText ? this.nextText : this.localizeCommon('navigation:next:title');
|
|
112
|
+
if (this.nextOnly) {
|
|
113
|
+
return this.#renderButton(this.#nextId, 'next-only', 'tier1:chevron-right', nextText, undefined, this.nextDisabled);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const hasDescription = (this.description !== undefined && this.description !== '' && !this.nextOnly);
|
|
117
|
+
const description = hasDescription ? html`<div id="${this.#descriptionId}" class="description d2l-label-text">${this.description}</div>` : nothing;
|
|
118
|
+
const descriptionId = hasDescription ? this.#descriptionId : undefined;
|
|
119
|
+
|
|
120
|
+
const previousText = this.previousText ? this.previousText : this.localizeCommon('navigation:previous:title');
|
|
121
|
+
|
|
122
|
+
return html`
|
|
123
|
+
<div class="container">
|
|
124
|
+
${this.#renderButton(this.#previousId, 'previous', 'tier1:chevron-left', previousText, descriptionId, this.previousDisabled)}
|
|
125
|
+
${description}
|
|
126
|
+
${this.#renderButton(this.#nextId, 'next', 'tier1:chevron-right', nextText, descriptionId, this.nextDisabled)}
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#descriptionId = getUniqueId();
|
|
132
|
+
#previousId = getUniqueId();
|
|
133
|
+
#nextId = getUniqueId();
|
|
134
|
+
|
|
135
|
+
#handleButtonClick(e) {
|
|
136
|
+
const button = e.currentTarget;
|
|
137
|
+
if (button.disabled) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
if (button.id === this.#nextId) {
|
|
142
|
+
/** Dispatched when the next button is clicked. */
|
|
143
|
+
this.dispatchEvent(new CustomEvent('d2l-button-iterator-next-click'));
|
|
144
|
+
} else if (button.id === this.#previousId) {
|
|
145
|
+
/** Dispatched when the previous button is clicked. */
|
|
146
|
+
this.dispatchEvent(new CustomEvent('d2l-button-iterator-previous-click'));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#renderButton(id, className, icon, text, descriptionId, disabled) {
|
|
151
|
+
const ariaLabel = disabled ? text : undefined;
|
|
152
|
+
const tooltip = !disabled ? html`
|
|
153
|
+
<d2l-tooltip
|
|
154
|
+
class="vdiff-target"
|
|
155
|
+
for="${id}"
|
|
156
|
+
for-type="label"
|
|
157
|
+
position="bottom">${text}</d2l-tooltip>` : nothing;
|
|
158
|
+
return html`
|
|
159
|
+
<button
|
|
160
|
+
aria-describedby="${ifDefined(descriptionId)}"
|
|
161
|
+
aria-label="${ifDefined(ariaLabel)}"
|
|
162
|
+
class="${className}"
|
|
163
|
+
@click="${this.#handleButtonClick}"
|
|
164
|
+
?disabled="${disabled}"
|
|
165
|
+
id="${id}"
|
|
166
|
+
type="button">
|
|
167
|
+
<d2l-icon icon="${icon}"></d2l-icon>
|
|
168
|
+
</button>
|
|
169
|
+
${tooltip}
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
window.customElements.define('d2l-button-iterator', ButtonIterator);
|
|
@@ -11,7 +11,12 @@ export const DIVIDER_HANDLE_SIZE = 30;
|
|
|
11
11
|
export const KEYBOARD_STEP = 20; // TO DO: Confirm
|
|
12
12
|
export const KEYBOARD_STEP_LARGE = 80; // TO DO: Confirm
|
|
13
13
|
|
|
14
|
+
const DRAG_THRESHOLD = 3; // Number of pixels to move to count as a drag
|
|
15
|
+
const AUTO_EXPAND_WIDTH_FACTOR = 0.1;
|
|
16
|
+
const AUTO_COLLAPSE_WIDTH_FACTOR = 0.75;
|
|
17
|
+
|
|
14
18
|
const clampedSize = (size, min, max) => Math.max(min, Math.min(size, max));
|
|
19
|
+
const isRtl = () => document.documentElement.getAttribute('dir') === 'rtl';
|
|
15
20
|
|
|
16
21
|
const ICON_ARROW_COLLAPSE_LEFT = html`
|
|
17
22
|
<svg width="18" height="18" mirror-in-rtl xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
|
|
@@ -56,6 +61,11 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
56
61
|
* @type {boolean}
|
|
57
62
|
*/
|
|
58
63
|
collapsed: { type: Boolean, reflect: true },
|
|
64
|
+
/**
|
|
65
|
+
* Size the panel/drawer occupies while collapsed (the drag starts from here)
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
collapsedSize: { type: Number, attribute: 'collapsed-size' },
|
|
59
69
|
/**
|
|
60
70
|
* Current size of the panel/drawer the divider controls
|
|
61
71
|
* @type {number}
|
|
@@ -195,6 +205,7 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
195
205
|
super();
|
|
196
206
|
|
|
197
207
|
this.collapsed = false;
|
|
208
|
+
this.collapsedSize = 0;
|
|
198
209
|
this.currentSize = 0;
|
|
199
210
|
this.label = '';
|
|
200
211
|
this.maxSize = 0;
|
|
@@ -243,6 +254,48 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
243
254
|
|
|
244
255
|
#clickedArrow;
|
|
245
256
|
#clickedHandle = false;
|
|
257
|
+
#draggedDivider = false;
|
|
258
|
+
#dragStats;
|
|
259
|
+
|
|
260
|
+
#handlePointerMove = (e) => {
|
|
261
|
+
if (!this.#dragStats || e.pointerId !== this.#dragStats.pointerId) return;
|
|
262
|
+
const delta = this.panelType === 'panel' ? (e.clientX - this.#dragStats.startX) : (e.clientY - this.#dragStats.startY);
|
|
263
|
+
if (Math.abs(delta) >= DRAG_THRESHOLD) this.#dragStats.moved = true;
|
|
264
|
+
if (!this.#dragStats.moved) return;
|
|
265
|
+
|
|
266
|
+
let growthDirectionIsPositive;
|
|
267
|
+
if (this.panelType === 'panel') {
|
|
268
|
+
growthDirectionIsPositive = (this.panelPosition === 'start') !== isRtl();
|
|
269
|
+
} else if (this.panelType === 'drawer') {
|
|
270
|
+
growthDirectionIsPositive = false;
|
|
271
|
+
}
|
|
272
|
+
const signedDelta = (growthDirectionIsPositive ? 1 : -1) * delta;
|
|
273
|
+
const requestedSize = this.#dragStats.startSize + signedDelta;
|
|
274
|
+
|
|
275
|
+
this.#dragStats.lastSize = requestedSize;
|
|
276
|
+
this.#sendResizeLiveEvent(requestedSize);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
#handlePointerUp = (e) => {
|
|
280
|
+
if (!this.#dragStats || e.pointerId !== this.#dragStats.pointerId) return;
|
|
281
|
+
const target = e.currentTarget;
|
|
282
|
+
target.removeEventListener('pointermove', this.#handlePointerMove);
|
|
283
|
+
target.removeEventListener('pointerup', this.#handlePointerUp);
|
|
284
|
+
target.removeEventListener('pointercancel', this.#handlePointerUp);
|
|
285
|
+
|
|
286
|
+
if (this.collapsed && this.#dragStats.lastSize > this.minSize * AUTO_EXPAND_WIDTH_FACTOR) {
|
|
287
|
+
this.#draggedDivider = true;
|
|
288
|
+
this.#sendToggleEvent();
|
|
289
|
+
this.#sendResizeEvent(this.#dragStats.lastSize);
|
|
290
|
+
} else if (!this.collapsed && this.#dragStats.lastSize < this.minSize * AUTO_COLLAPSE_WIDTH_FACTOR) {
|
|
291
|
+
this.#draggedDivider = true;
|
|
292
|
+
this.#sendToggleEvent();
|
|
293
|
+
} else if (this.#dragStats.moved) {
|
|
294
|
+
this.#draggedDivider = true;
|
|
295
|
+
this.#sendResizeEvent(this.#dragStats.lastSize);
|
|
296
|
+
}
|
|
297
|
+
this.#dragStats = null;
|
|
298
|
+
};
|
|
246
299
|
|
|
247
300
|
#getArrowVisibility() {
|
|
248
301
|
if (this.panelType !== 'panel' || this.collapsed) return { showStartArrow: false, showEndArrow: false };
|
|
@@ -269,6 +322,8 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
269
322
|
// Do not toggle/resize until click event is received,
|
|
270
323
|
// to avoid clicking on elements under the arrows in overlay mode or under the handle in drawer mode
|
|
271
324
|
e.stopPropagation();
|
|
325
|
+
if (this.#draggedDivider) return;
|
|
326
|
+
|
|
272
327
|
if (this.collapsed || this.#clickedHandle) {
|
|
273
328
|
this.#sendToggleEvent();
|
|
274
329
|
} else if (this.#clickedArrow) {
|
|
@@ -303,8 +358,7 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
303
358
|
let positiveStepKey;
|
|
304
359
|
if (this.panelType === 'panel') {
|
|
305
360
|
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
|
|
306
|
-
|
|
307
|
-
positiveStepKey = (this.panelPosition === 'start') !== isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
361
|
+
positiveStepKey = (this.panelPosition === 'start') !== isRtl() ? 'ArrowRight' : 'ArrowLeft';
|
|
308
362
|
} else if (this.panelType === 'drawer') {
|
|
309
363
|
if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;
|
|
310
364
|
positiveStepKey = 'ArrowUp';
|
|
@@ -316,8 +370,11 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
316
370
|
}
|
|
317
371
|
|
|
318
372
|
#handlePointerDown(e) {
|
|
373
|
+
this.#draggedDivider = false;
|
|
374
|
+
|
|
319
375
|
if (e.button !== 0) return; // Don't collapse when right-clicking to debug
|
|
320
376
|
e.preventDefault();
|
|
377
|
+
e.stopPropagation();
|
|
321
378
|
this.focus();
|
|
322
379
|
|
|
323
380
|
const path = e.composedPath();
|
|
@@ -325,7 +382,21 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
325
382
|
this.#clickedArrow = path.find(el => el.classList?.contains('divider-arrow'));
|
|
326
383
|
if (this.#clickedArrow) return; // Arrows don't support dragging
|
|
327
384
|
|
|
328
|
-
|
|
385
|
+
const startSize = this.collapsed ? this.collapsedSize : this.currentSize;
|
|
386
|
+
this.#dragStats = {
|
|
387
|
+
pointerId: e.pointerId,
|
|
388
|
+
startX: e.clientX,
|
|
389
|
+
startY: e.clientY,
|
|
390
|
+
startSize,
|
|
391
|
+
lastSize: startSize,
|
|
392
|
+
moved: false
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const target = e.currentTarget;
|
|
396
|
+
target.setPointerCapture(e.pointerId);
|
|
397
|
+
target.addEventListener('pointermove', this.#handlePointerMove);
|
|
398
|
+
target.addEventListener('pointerup', this.#handlePointerUp);
|
|
399
|
+
target.addEventListener('pointercancel', this.#handlePointerUp);
|
|
329
400
|
}
|
|
330
401
|
|
|
331
402
|
#sendResizeEvent(requestedSize) {
|
|
@@ -336,6 +407,15 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
336
407
|
} }));
|
|
337
408
|
}
|
|
338
409
|
|
|
410
|
+
#sendResizeLiveEvent(requestedSize) {
|
|
411
|
+
const clampedRequestedSize = clampedSize(requestedSize, this.collapsedSize, this.maxSize);
|
|
412
|
+
if (clampedRequestedSize === this.currentSize) return; // Don't bother sending events when dragging past min/max
|
|
413
|
+
/** @ignore */
|
|
414
|
+
this.dispatchEvent(new CustomEvent('d2l-page-divider-resize-live', { detail: {
|
|
415
|
+
requestedSize: clampedRequestedSize
|
|
416
|
+
} }));
|
|
417
|
+
}
|
|
418
|
+
|
|
339
419
|
#sendToggleEvent() {
|
|
340
420
|
/** @ignore */
|
|
341
421
|
this.dispatchEvent(new CustomEvent('d2l-page-divider-toggle'));
|
package/components/page/page.js
CHANGED
|
@@ -37,6 +37,7 @@ class PanelStateController {
|
|
|
37
37
|
collapsed: config.collapsed,
|
|
38
38
|
restoreCollapsed: !config.collapsed,
|
|
39
39
|
size: 0,
|
|
40
|
+
dragSize: null,
|
|
40
41
|
minSize: config.minSize,
|
|
41
42
|
maxSize: config.minSize
|
|
42
43
|
};
|
|
@@ -50,11 +51,14 @@ class PanelStateController {
|
|
|
50
51
|
getMinSize(key) { return this.#panels[key].minSize; }
|
|
51
52
|
getSize(key) {
|
|
52
53
|
const panel = this.#panels[key];
|
|
53
|
-
|
|
54
|
+
if (panel.dragSize !== null) return panel.dragSize;
|
|
54
55
|
return panel.collapsed ? 0 : panel.size;
|
|
55
56
|
}
|
|
56
57
|
getTrueSize(key) {
|
|
57
58
|
const panel = this.#panels[key];
|
|
59
|
+
if (panel.dragSize !== null) {
|
|
60
|
+
return Math.max(panel.minSize, panel.dragSize);
|
|
61
|
+
}
|
|
58
62
|
return panel.size;
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -78,6 +82,7 @@ class PanelStateController {
|
|
|
78
82
|
// Clamp requested size to min and max bounds
|
|
79
83
|
panel.size = Math.max(panel.minSize, Math.min(requestedSize, panel.maxSize));
|
|
80
84
|
panel.animate = animate;
|
|
85
|
+
panel.dragSize = null;
|
|
81
86
|
this.#host.requestUpdate();
|
|
82
87
|
if (storeState) this.#storePanelState(key);
|
|
83
88
|
}
|
|
@@ -85,14 +90,15 @@ class PanelStateController {
|
|
|
85
90
|
setCollapsed(key, collapsed) {
|
|
86
91
|
const panel = this.#panels[key];
|
|
87
92
|
panel.collapsed = collapsed;
|
|
93
|
+
panel.dragSize = null;
|
|
88
94
|
panel.animate = true;
|
|
89
95
|
this.#host.requestUpdate();
|
|
90
96
|
this.#storePanelState(key);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
setDragSize(key) {
|
|
99
|
+
setDragSize(key, dragSize) {
|
|
94
100
|
const panel = this.#panels[key];
|
|
95
|
-
|
|
101
|
+
panel.dragSize = dragSize;
|
|
96
102
|
panel.animate = false;
|
|
97
103
|
this.#host.requestUpdate();
|
|
98
104
|
}
|
|
@@ -539,6 +545,11 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
539
545
|
this._panelState.resize(panelKey, e.detail.requestedSize, { animate: true, storeState: true });
|
|
540
546
|
};
|
|
541
547
|
|
|
548
|
+
#handleDividerResizeLive(e) {
|
|
549
|
+
const panelKey = e.target.dataset.panelKey;
|
|
550
|
+
this._panelState.setDragSize(panelKey, e.detail.requestedSize);
|
|
551
|
+
}
|
|
552
|
+
|
|
542
553
|
#handleDividerToggle(e) {
|
|
543
554
|
const panelKey = e.target.dataset.panelKey;
|
|
544
555
|
const collapsed = !this._panelState.getCollapsed(panelKey);
|
|
@@ -577,11 +588,13 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
577
588
|
data-panel-key="${panelKey}"
|
|
578
589
|
label="${label}"
|
|
579
590
|
?collapsed="${this._panelState.getCollapsed(panelKey)}"
|
|
591
|
+
collapsed-size="${DIVIDER_GUTTER_WIDTH}"
|
|
580
592
|
current-size="${this._panelState.getSize(panelKey)}"
|
|
581
593
|
max-size="${this._panelState.getMaxSize(panelKey)}"
|
|
582
594
|
min-size="${this._panelState.getMinSize(panelKey)}"
|
|
583
595
|
panel-position="${ifDefined(panelPosition)}"
|
|
584
596
|
@d2l-page-divider-resize="${this.#handleDividerResize}"
|
|
597
|
+
@d2l-page-divider-resize-live="${this.#handleDividerResizeLive}"
|
|
585
598
|
@d2l-page-divider-toggle="${this.#handleDividerToggle}"
|
|
586
599
|
></d2l-page-divider-internal>
|
|
587
600
|
`;
|
|
@@ -627,7 +640,7 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
627
640
|
const classes = {
|
|
628
641
|
'side-nav-panel': true,
|
|
629
642
|
'animate': this._panelState.getAnimate(panelKey),
|
|
630
|
-
'collapsed': this._panelState.
|
|
643
|
+
'collapsed': this._panelState.getSize(panelKey) === 0 // Collapsed and not being dragged
|
|
631
644
|
};
|
|
632
645
|
return html`
|
|
633
646
|
<nav class="side-nav" ?hidden="${!this._slotVisibility['side-nav']}" aria-label="${this.localize('components.page.side-nav-label')}">
|
|
@@ -648,7 +661,7 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
648
661
|
const classes = {
|
|
649
662
|
'supporting-panel': true,
|
|
650
663
|
'animate': this._panelState.getAnimate(panelKey),
|
|
651
|
-
'collapsed': this._panelState.
|
|
664
|
+
'collapsed': this._panelState.getSize(panelKey) === 0 // Collapsed and not being dragged
|
|
652
665
|
};
|
|
653
666
|
return html`
|
|
654
667
|
<aside class="supporting" ?hidden="${!this._slotVisibility['supporting']}" aria-label="${this.localize('components.page.supporting-label')}">
|
package/custom-elements.json
CHANGED
|
@@ -702,6 +702,108 @@
|
|
|
702
702
|
}
|
|
703
703
|
]
|
|
704
704
|
},
|
|
705
|
+
{
|
|
706
|
+
"name": "d2l-button-iterator",
|
|
707
|
+
"path": "./components/button/button-iterator.js",
|
|
708
|
+
"description": "A navigation control for moving sequentially through a set of items.",
|
|
709
|
+
"attributes": [
|
|
710
|
+
{
|
|
711
|
+
"name": "description",
|
|
712
|
+
"description": "ACCESSIBILITY: An optional description, typically for indicating the current position within the set of items",
|
|
713
|
+
"type": "string",
|
|
714
|
+
"default": "\"undefined\""
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
"name": "next-disabled",
|
|
718
|
+
"description": "Disables the next button",
|
|
719
|
+
"type": "boolean",
|
|
720
|
+
"default": "false"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
"name": "next-only",
|
|
724
|
+
"description": "Renders only the next button",
|
|
725
|
+
"type": "boolean",
|
|
726
|
+
"default": "false"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "next-text",
|
|
730
|
+
"description": "Overrides the default text for the next button",
|
|
731
|
+
"type": "string",
|
|
732
|
+
"default": "\"undefined\""
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
"name": "previous-disabled",
|
|
736
|
+
"description": "Disables the previous button",
|
|
737
|
+
"type": "boolean",
|
|
738
|
+
"default": "false"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"name": "previous-text",
|
|
742
|
+
"description": "Overrides the default text for the previous button",
|
|
743
|
+
"type": "string",
|
|
744
|
+
"default": "\"undefined\""
|
|
745
|
+
}
|
|
746
|
+
],
|
|
747
|
+
"properties": [
|
|
748
|
+
{
|
|
749
|
+
"name": "styles",
|
|
750
|
+
"type": "array",
|
|
751
|
+
"default": "[\"buttonStyles\",\"labelStyles\",null]"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"name": "description",
|
|
755
|
+
"attribute": "description",
|
|
756
|
+
"description": "ACCESSIBILITY: An optional description, typically for indicating the current position within the set of items",
|
|
757
|
+
"type": "string",
|
|
758
|
+
"default": "\"undefined\""
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"name": "nextDisabled",
|
|
762
|
+
"attribute": "next-disabled",
|
|
763
|
+
"description": "Disables the next button",
|
|
764
|
+
"type": "boolean",
|
|
765
|
+
"default": "false"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"name": "nextOnly",
|
|
769
|
+
"attribute": "next-only",
|
|
770
|
+
"description": "Renders only the next button",
|
|
771
|
+
"type": "boolean",
|
|
772
|
+
"default": "false"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
"name": "nextText",
|
|
776
|
+
"attribute": "next-text",
|
|
777
|
+
"description": "Overrides the default text for the next button",
|
|
778
|
+
"type": "string",
|
|
779
|
+
"default": "\"undefined\""
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"name": "previousDisabled",
|
|
783
|
+
"attribute": "previous-disabled",
|
|
784
|
+
"description": "Disables the previous button",
|
|
785
|
+
"type": "boolean",
|
|
786
|
+
"default": "false"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"name": "previousText",
|
|
790
|
+
"attribute": "previous-text",
|
|
791
|
+
"description": "Overrides the default text for the previous button",
|
|
792
|
+
"type": "string",
|
|
793
|
+
"default": "\"undefined\""
|
|
794
|
+
}
|
|
795
|
+
],
|
|
796
|
+
"events": [
|
|
797
|
+
{
|
|
798
|
+
"name": "d2l-button-iterator-next-click",
|
|
799
|
+
"description": "Dispatched when the next button is clicked."
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
"name": "d2l-button-iterator-previous-click",
|
|
803
|
+
"description": "Dispatched when the previous button is clicked."
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
},
|
|
705
807
|
{
|
|
706
808
|
"name": "d2l-button-move",
|
|
707
809
|
"path": "./components/button/button-move.js",
|
|
@@ -13254,6 +13356,12 @@
|
|
|
13254
13356
|
"type": "boolean",
|
|
13255
13357
|
"default": "false"
|
|
13256
13358
|
},
|
|
13359
|
+
{
|
|
13360
|
+
"name": "collapsed-size",
|
|
13361
|
+
"description": "Size the panel/drawer occupies while collapsed (the drag starts from here)",
|
|
13362
|
+
"type": "number",
|
|
13363
|
+
"default": "0"
|
|
13364
|
+
},
|
|
13257
13365
|
{
|
|
13258
13366
|
"name": "current-size",
|
|
13259
13367
|
"description": "Current size of the panel/drawer the divider controls",
|
|
@@ -13308,6 +13416,13 @@
|
|
|
13308
13416
|
"type": "boolean",
|
|
13309
13417
|
"default": "false"
|
|
13310
13418
|
},
|
|
13419
|
+
{
|
|
13420
|
+
"name": "collapsedSize",
|
|
13421
|
+
"attribute": "collapsed-size",
|
|
13422
|
+
"description": "Size the panel/drawer occupies while collapsed (the drag starts from here)",
|
|
13423
|
+
"type": "number",
|
|
13424
|
+
"default": "0"
|
|
13425
|
+
},
|
|
13311
13426
|
{
|
|
13312
13427
|
"name": "currentSize",
|
|
13313
13428
|
"attribute": "current-size",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.307.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",
|