@brightspace-ui/core 3.283.0 → 3.285.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.
@@ -13,6 +13,10 @@ const DRAWER_MIN_HEIGHT = 200; // TO DO: Confirm
13
13
  const MAIN_MIN_WIDTH = 600; // TO DO: Confirm
14
14
  const PANEL_MIN_WIDTH = 320;
15
15
 
16
+ export const SIDE_NAV_DEFAULT_WIDTH = 334;
17
+ export const supportingDefaultWidth = contentWidth => Math.floor(contentWidth / 3);
18
+ export const supportingMobileDefaultHeight = fullHeight => Math.floor(fullHeight / 2);
19
+
16
20
  class PanelStateController {
17
21
  constructor(host, panelConfigs) {
18
22
  this.#host = host;
@@ -428,13 +432,10 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
428
432
  }
429
433
 
430
434
  #initializePanelSizes() {
431
- const defaultWidth = Math.floor(this._contentWidth / 3);
432
- const defaultHeight = Math.floor(window.innerHeight / 2);
433
-
434
435
  this._panelState.initialize({
435
- 'side-nav': defaultWidth,
436
- 'supporting': defaultWidth,
437
- 'supporting-mobile': defaultHeight
436
+ 'side-nav': SIDE_NAV_DEFAULT_WIDTH,
437
+ 'supporting': supportingDefaultWidth(this._contentWidth),
438
+ 'supporting-mobile': supportingMobileDefaultHeight(window.innerHeight)
438
439
  });
439
440
  }
440
441
 
package/helpers/README.md CHANGED
@@ -91,11 +91,15 @@ getComposedChildren(element, predicate = () => true);
91
91
 
92
92
  // gets the composed next element sibling considing how children are distributed into slots
93
93
  // includes optional predicate for filtering elements
94
- getComposedNextElementSibling(node, { predicate } = {}) {
94
+ getComposedNextElementSibling(node, { predicate });
95
95
 
96
96
  // gets the composed parent (including shadow host & insertion points)
97
97
  getComposedParent(node);
98
98
 
99
+ // gets the composed previous element sibling considing how children are distributed into slots
100
+ // includes optional predicate for filtering elements
101
+ getComposedPreviousElementSibling(node, { predicate });
102
+
99
103
  // returns the first visible ancestor of the given node
100
104
  getFirstVisibleAncestor(node)
101
105
 
package/helpers/dom.js CHANGED
@@ -116,7 +116,7 @@ export function getComposedChildren(node, predicate) {
116
116
  return getComposedChildNodes(node, { elementsOnly: true, predicate });
117
117
  }
118
118
 
119
- export function getComposedNextElementSibling(node, { predicate } = {}) {
119
+ function getComposedElementSibling(node, { direction = 'next', predicate } = {}) {
120
120
 
121
121
  if (!node || node.nodeType === undefined) return null;
122
122
 
@@ -131,15 +131,27 @@ export function getComposedNextElementSibling(node, { predicate } = {}) {
131
131
  const index = composedChildNodes.indexOf(node);
132
132
  if (index === -1) return null;
133
133
 
134
- for (let i = index + 1; i < composedChildNodes.length; i++) {
135
- if (composedChildNodes[i].nodeType === Node.ELEMENT_NODE && (!predicate || predicate(composedChildNodes[i]))) {
136
- return composedChildNodes[i];
134
+ if (direction === 'previous') {
135
+ for (let i = index - 1; i >= 0; i--) {
136
+ if (composedChildNodes[i].nodeType === Node.ELEMENT_NODE && (!predicate || predicate(composedChildNodes[i]))) {
137
+ return composedChildNodes[i];
138
+ }
139
+ }
140
+ } else {
141
+ for (let i = index + 1; i < composedChildNodes.length; i++) {
142
+ if (composedChildNodes[i].nodeType === Node.ELEMENT_NODE && (!predicate || predicate(composedChildNodes[i]))) {
143
+ return composedChildNodes[i];
144
+ }
137
145
  }
138
146
  }
139
147
 
140
148
  return null;
141
149
  }
142
150
 
151
+ export function getComposedNextElementSibling(node, { predicate } = {}) {
152
+ return getComposedElementSibling(node, { direction: 'next', predicate });
153
+ }
154
+
143
155
  export function getComposedParent(node) {
144
156
 
145
157
  if (node.getDestinationInsertionPoints) {
@@ -163,6 +175,10 @@ export function getComposedParent(node) {
163
175
 
164
176
  }
165
177
 
178
+ export function getComposedPreviousElementSibling(node, { predicate } = {}) {
179
+ return getComposedElementSibling(node, { direction: 'previous', predicate });
180
+ }
181
+
166
182
  export function getNextAncestorSibling(node, predicate = () => true) {
167
183
  let parentNode = getComposedParent(node);
168
184
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.283.0",
3
+ "version": "3.285.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",