@brightspace-ui/core 2.180.6 → 2.180.8

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.
@@ -138,6 +138,10 @@ This `d2l-menu-item-link` is used for navigating. It gives users the ability to
138
138
  | `href` | String, required | The URL the menu item link navigates to |
139
139
  | `text` | String, required | Text displayed by the menu item |
140
140
  | `disabled` | Boolean | Disables the menu item |
141
+
142
+ ### Slots
143
+
144
+ * `supporting`: Allows supporting information to be displayed on the right-most side of the menu item
141
145
  <!-- docs: end hidden content -->
142
146
 
143
147
  ### Accessibility Properties
@@ -181,6 +185,10 @@ The `d2l-menu-item-checkbox` component is used for selection. It can be wired-up
181
185
  | `disabled` | Boolean | Disables the menu item |
182
186
  | `selected` | Boolean | Thie will set the item to be selected by default |
183
187
 
188
+ ### Slots
189
+
190
+ * `supporting`: Allows supporting information to be displayed on the right-most side of the menu item
191
+
184
192
  ### Events
185
193
 
186
194
  * `d2l-menu-item-change`: dispatched when the selected menu item changes
@@ -227,6 +235,10 @@ The `d2l-menu-item-radio` component is used for selection. It can be wired-up to
227
235
  | `disabled` | Boolean | Disables the menu item |
228
236
  | `selected` | Boolean | This will set the item to be seelcted by default |
229
237
 
238
+ ### Slots
239
+
240
+ * `supporting`: Allows supporting information to be displayed on the right-most side of the menu item
241
+
230
242
  ### Events
231
243
 
232
244
  * `d2l-menu-item-change`: dispatched when the selected menu item changes
@@ -6,6 +6,7 @@ import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
6
6
 
7
7
  /**
8
8
  * A menu item component used for selection. Multiple checkboxes can be selected at once.
9
+ * @slot supporting - Allows supporting information to be displayed on the right-most side of the menu item
9
10
  */
10
11
  class MenuItemCheckbox extends RtlMixin(MenuItemSelectableMixin(LitElement)) {
11
12
 
@@ -27,7 +28,7 @@ class MenuItemCheckbox extends RtlMixin(MenuItemSelectableMixin(LitElement)) {
27
28
  render() {
28
29
  return html`
29
30
  <d2l-icon icon="tier1:check"></d2l-icon>
30
- <div class="d2l-menu-item-text">${this.text}</div>
31
+ <div class="d2l-menu-item-text">${this.text}</div>
31
32
  <div class="d2l-menu-item-supporting"><slot name="supporting"></slot></div>
32
33
  `;
33
34
  }
@@ -6,6 +6,7 @@ import { menuItemStyles } from './menu-item-styles.js';
6
6
  /**
7
7
  * A menu item component used for navigating.
8
8
  * @fires click - Dispatched when the link is clicked
9
+ * @slot supporting - Allows supporting information to be displayed on the right-most side of the menu item
9
10
  */
10
11
  class MenuItemLink extends MenuItemMixin(LitElement) {
11
12
 
@@ -6,6 +6,7 @@ import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
6
6
 
7
7
  /**
8
8
  * A menu item component used for radio selection. Only one radio item in a given d2l-menu may be selected at once (i.e., selecting one option will deselect the other selected "d2l-menu-item-radio" item).
9
+ * @slot supporting - Allows supporting information to be displayed on the right-most side of the menu item
9
10
  */
10
11
  class MenuItemRadio extends RtlMixin(MenuItemRadioMixin(LitElement)) {
11
12
 
@@ -582,18 +582,17 @@ class Tooltip extends RtlMixin(LitElement) {
582
582
  this._openDir = space.dir;
583
583
 
584
584
  // Compute the x and y position of the tooltip relative to its target
585
- let parentTop;
586
- let parentLeft;
585
+ let offsetTop, offsetLeft;
587
586
  if (offsetParent && offsetParent.tagName !== 'BODY') {
588
- const parentRect = offsetParent.getBoundingClientRect();
589
- parentTop = parentRect.top + offsetParent.clientTop;
590
- parentLeft = parentRect.left + offsetParent.clientLeft;
587
+ const offsetRect = offsetParent.getBoundingClientRect();
588
+ offsetTop = offsetRect.top + offsetParent.clientTop - offsetParent.scrollTop;
589
+ offsetLeft = offsetRect.left + offsetParent.clientLeft - offsetParent.scrollLeft;
591
590
  } else {
592
- parentTop = -document.documentElement.scrollTop;
593
- parentLeft = -document.documentElement.scrollLeft;
591
+ offsetTop = -document.documentElement.scrollTop;
592
+ offsetLeft = -document.documentElement.scrollLeft;
594
593
  }
595
- const top = targetRect.top - parentTop;
596
- const left = targetRect.left - parentLeft;
594
+ const top = targetRect.top - offsetTop;
595
+ const left = targetRect.left - offsetLeft;
597
596
 
598
597
  let positionRect;
599
598
  if (this._isAboveOrBelow()) {
@@ -699,18 +698,18 @@ class Tooltip extends RtlMixin(LitElement) {
699
698
  });
700
699
 
701
700
  if (this.boundary && offsetParent) {
702
- const parentRect = offsetParent.getBoundingClientRect();
701
+ const offsetRect = offsetParent.getBoundingClientRect();
703
702
  if (!isNaN(this.boundary.left)) {
704
- spaceAround.left = Math.min(targetRect.left - parentRect.left - this.boundary.left, spaceAround.left);
703
+ spaceAround.left = Math.min(targetRect.left - offsetRect.left - this.boundary.left, spaceAround.left);
705
704
  }
706
705
  if (!isNaN(this.boundary.right)) {
707
- spaceAround.right = Math.min(parentRect.right - targetRect.right - this.boundary.right, spaceAround.right);
706
+ spaceAround.right = Math.min(offsetRect.right - targetRect.right - this.boundary.right, spaceAround.right);
708
707
  }
709
708
  if (!isNaN(this.boundary.top)) {
710
- spaceAround.above = Math.min(targetRect.top - parentRect.top - this.boundary.top, spaceAround.above);
709
+ spaceAround.above = Math.min(targetRect.top - offsetRect.top - this.boundary.top, spaceAround.above);
711
710
  }
712
711
  if (!isNaN(this.boundary.bottom)) {
713
- spaceAround.below = Math.min(parentRect.bottom - targetRect.bottom - this.boundary.bottom, spaceAround.below);
712
+ spaceAround.below = Math.min(offsetRect.bottom - targetRect.bottom - this.boundary.bottom, spaceAround.below);
714
713
  }
715
714
  }
716
715
  const isRTL = this.getAttribute('dir') === 'rtl';
@@ -729,8 +728,9 @@ class Tooltip extends RtlMixin(LitElement) {
729
728
  if (this.for) {
730
729
  const targetSelector = `#${cssEscape(this.for)}`;
731
730
  target = ownerRoot.querySelector(targetSelector);
732
- target = target || (ownerRoot && ownerRoot.host && ownerRoot.host.querySelector(targetSelector));
731
+ target = target || ownerRoot?.host?.querySelector(targetSelector);
733
732
  } else {
733
+ console.warn('<d2l-tooltip>: missing required attribute "for"');
734
734
  const parentNode = this.parentNode;
735
735
  target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.host : parentNode;
736
736
  }
@@ -9487,6 +9487,12 @@
9487
9487
  "name": "d2l-menu-item-visibility-change",
9488
9488
  "description": "Dispatched when the visibility of the menu item changes"
9489
9489
  }
9490
+ ],
9491
+ "slots": [
9492
+ {
9493
+ "name": "supporting",
9494
+ "description": "Allows supporting information to be displayed on the right-most side of the menu item"
9495
+ }
9490
9496
  ]
9491
9497
  },
9492
9498
  {
@@ -9578,6 +9584,12 @@
9578
9584
  "name": "d2l-menu-item-visibility-change",
9579
9585
  "description": "Dispatched when the visibility of the menu item changes"
9580
9586
  }
9587
+ ],
9588
+ "slots": [
9589
+ {
9590
+ "name": "supporting",
9591
+ "description": "Allows supporting information to be displayed on the right-most side of the menu item"
9592
+ }
9581
9593
  ]
9582
9594
  },
9583
9595
  {
@@ -9660,6 +9672,12 @@
9660
9672
  "name": "d2l-menu-item-visibility-change",
9661
9673
  "description": "Dispatched when the visibility of the menu item changes"
9662
9674
  }
9675
+ ],
9676
+ "slots": [
9677
+ {
9678
+ "name": "supporting",
9679
+ "description": "Allows supporting information to be displayed on the right-most side of the menu item"
9680
+ }
9663
9681
  ]
9664
9682
  },
9665
9683
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.180.6",
3
+ "version": "2.180.8",
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",