@brightspace-ui/core 3.114.1 → 3.115.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.
@@ -1,14 +1,17 @@
1
1
  import '../colors/colors.js';
2
2
  import '../tooltip/tooltip.js';
3
- import { css, html, LitElement, nothing } from 'lit';
3
+ import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
4
4
  import { classMap } from 'lit/directives/class-map.js';
5
5
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
6
+ import { getFlag } from '../../helpers/flags.js';
6
7
  import { getUniqueId } from '../../helpers/uniqueId.js';
7
8
  import { ifDefined } from 'lit/directives/if-defined.js';
8
9
  import { InputInlineHelpMixin } from './input-inline-help.js';
9
10
  import { offscreenStyles } from '../offscreen/offscreen.js';
10
11
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
11
12
 
13
+ const inputStyleTweaksEnabled = getFlag('input-style-tweaks', true);
14
+
12
15
  export const cssSizes = {
13
16
  inputBoxSize: 1.2,
14
17
  checkboxMargin: 0.5,
@@ -133,14 +136,14 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
133
136
  css`
134
137
  :host {
135
138
  display: block;
136
- margin-bottom: 0.9rem;
139
+ margin-block-end: ${unsafeCSS(inputStyleTweaksEnabled ? '0.6rem' : '0.9rem')}; /* stylelint-disable-line */
137
140
  }
138
141
  :host([hidden]) {
139
142
  display: none;
140
143
  }
141
144
  :host([label-hidden]) {
142
145
  display: inline-block;
143
- margin-bottom: 0;
146
+ margin-block-end: 0;
144
147
  }
145
148
  label {
146
149
  display: flex;
@@ -181,7 +184,7 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
181
184
  }
182
185
  .d2l-input-checkbox-supporting {
183
186
  display: none;
184
- margin-block: 0.9rem;
187
+ margin-block-start: ${unsafeCSS(inputStyleTweaksEnabled ? '0.6rem' : '0.9rem')}; /* stylelint-disable-line */
185
188
  }
186
189
  .d2l-input-checkbox-supporting-visible {
187
190
  display: block;
@@ -1,5 +1,5 @@
1
1
  import '../colors/colors.js';
2
- import { css, html } from 'lit';
2
+ import { css, html, nothing } from 'lit';
3
3
  import { isInteractiveInListItemComposedPath, ListItemMixin } from './list-item-mixin.js';
4
4
  import { getUniqueId } from '../../helpers/uniqueId.js';
5
5
 
@@ -26,7 +26,7 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
26
26
  [slot="outside-control-container"] {
27
27
  margin: 0 -12px;
28
28
  }
29
- button {
29
+ :host([_list-item-interactive-enabled]) button {
30
30
  background-color: transparent;
31
31
  border: none;
32
32
  color: unset;
@@ -43,6 +43,22 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
43
43
  text-align: start;
44
44
  width: 100%;
45
45
  }
46
+ /** clean up with flag GAUD-7495-list-interactive-content */
47
+ :host(:not([_list-item-interactive-enabled])) button {
48
+ background-color: transparent;
49
+ border: none;
50
+ cursor: pointer;
51
+ display: block;
52
+ height: 100%;
53
+ outline: none;
54
+ width: 100%;
55
+ }
56
+ /** clean up with flag GAUD-7495-list-interactive-content */
57
+ :host(:not([_list-item-interactive-enabled]):not([button-disabled]):not([no-primary-action])) [slot="content"],
58
+ :host(:not([_list-item-interactive-enabled]):not([no-primary-action])) [slot="control-action"] ~ [slot="content"],
59
+ :host(:not([_list-item-interactive-enabled]):not([no-primary-action])) [slot="outside-control-action"] ~ [slot="content"] {
60
+ pointer-events: none;
61
+ }
46
62
  :host(:not([button-disabled])) [slot="control-action"],
47
63
  :host(:not([button-disabled])) [slot="outside-control-action"] {
48
64
  grid-column-end: control-end;
@@ -73,10 +89,13 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
73
89
  if (this._getDescendantClicked(e)) {
74
90
  e.preventDefault();
75
91
  } else {
76
- e.stopPropagation();
77
92
  /** Dispatched when the item's primary button action is clicked */
78
93
  this.dispatchEvent(new CustomEvent('d2l-list-item-button-click', { bubbles: true }));
79
94
 
95
+ if (!this._listItemInteractiveEnabled) return; // clean up with flag GAUD-7495-list-interactive-content
96
+
97
+ e.stopPropagation();
98
+
80
99
  // Dispatches click event from the list item to maintain existing functionality in consumers that listen for the click event
81
100
  const listItemClickEvent = new e.constructor(e.type, e);
82
101
  listItemClickEvent.preventDefault = () => {
@@ -100,7 +119,7 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
100
119
  @click="${this._onButtonClick}"
101
120
  @focusin="${this._onButtonFocus}"
102
121
  ?disabled="${this.buttonDisabled}">
103
- ${content}
122
+ ${content || nothing}
104
123
  </button>`;
105
124
  }
106
125
 
@@ -1,5 +1,5 @@
1
1
  import '../colors/colors.js';
2
- import { css, html } from 'lit';
2
+ import { css, html, nothing } from 'lit';
3
3
  import { isInteractiveInListItemComposedPath, ListItemMixin } from './list-item-mixin.js';
4
4
  import { getUniqueId } from '../../helpers/uniqueId.js';
5
5
 
@@ -21,7 +21,7 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
21
21
  :host([action-href]:not([action-href=""])) {
22
22
  --d2l-list-item-content-text-color: var(--d2l-color-celestine);
23
23
  }
24
- a[href] {
24
+ :host([_list-item-interactive-enabled]) a[href] {
25
25
  color: unset;
26
26
  display: block;
27
27
  height: 100%;
@@ -29,6 +29,19 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
29
29
  text-decoration: none;
30
30
  width: 100%;
31
31
  }
32
+ /** clean up with flag GAUD-7495-list-interactive-content */
33
+ :host(:not([_list-item-interactive-enabled])) a[href] {
34
+ display: block;
35
+ height: 100%;
36
+ outline: none;
37
+ width: 100%;
38
+ }
39
+ /** clean up with flag GAUD-7495-list-interactive-content */
40
+ :host(:not([_list-item-interactive-enabled])[action-href]:not([action-href=""])) [slot="content"],
41
+ :host(:not([_list-item-interactive-enabled]):not([no-primary-action])) [slot="control-action"] ~ [slot="content"],
42
+ :host(:not([_list-item-interactive-enabled]):not([no-primary-action])) [slot="outside-control-action"] ~ [slot="content"] {
43
+ pointer-events: none;
44
+ }
32
45
  :host([action-href]:not([action-href=""])) [slot="control-action"],
33
46
  :host([action-href]:not([action-href=""])) [slot="outside-control-action"] {
34
47
  grid-column-end: control-end;
@@ -59,10 +72,13 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
59
72
  if (this._getDescendantClicked(e)) {
60
73
  e.preventDefault();
61
74
  } else {
62
- e.stopPropagation();
63
75
  /** Dispatched when the item's primary link action is clicked */
64
76
  this.dispatchEvent(new CustomEvent('d2l-list-item-link-click', { bubbles: true }));
65
77
 
78
+ if (!this._listItemInteractiveEnabled) return; // clean up with flag GAUD-7495-list-interactive-content
79
+
80
+ e.stopPropagation();
81
+
66
82
  // Dispatches click event from the list item to maintain existing functionality in consumers that listen for the click event
67
83
  const listItemClickEvent = new e.constructor(e.type, e);
68
84
  listItemClickEvent.preventDefault = () => {
@@ -94,7 +110,7 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
94
110
  @focusin="${this._handleLinkFocus}"
95
111
  href="${this.actionHref}"
96
112
  id="${this._primaryActionId}"
97
- @keydown="${this._handleLinkKeyDown}">${content}</a>`;
113
+ @keydown="${this._handleLinkKeyDown}">${content || nothing}</a>`;
98
114
  }
99
115
 
100
116
  };
@@ -10,6 +10,7 @@ import { interactiveElements, isInteractiveInComposedPath } from '../../helpers/
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { composeMixins } from '../../helpers/composeMixins.js';
12
12
  import { getFirstFocusableDescendant } from '../../helpers/focus.js';
13
+ import { getFlag } from '../../helpers/flags.js';
13
14
  import { getUniqueId } from '../../helpers/uniqueId.js';
14
15
  import { getValidHexColor } from '../../helpers/color.js';
15
16
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -38,9 +39,12 @@ function addTabListener() {
38
39
  });
39
40
  }
40
41
 
42
+ const listItemInteractiveFlag = getFlag('GAUD-7495-list-interactive-content', true);
43
+
41
44
  let hasDisplayedKeyboardTooltip = false;
42
45
 
43
46
  export function isInteractiveInListItemComposedPath(e, isPrimaryAction) {
47
+ if (!listItemInteractiveFlag) return false;
44
48
  const listInteractiveElems = {
45
49
  ...interactiveElements,
46
50
  'd2l-button': true,
@@ -101,6 +105,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
101
105
  _focusingPrimaryAction: { type: Boolean, attribute: '_focusing-primary-action', reflect: true },
102
106
  _highlight: { type: Boolean, reflect: true },
103
107
  _highlighting: { type: Boolean, reflect: true },
108
+ _listItemInteractiveEnabled: { type: Boolean, reflect: true, attribute: '_list-item-interactive-enabled' },
104
109
  _showAddButton: { type: Boolean, attribute: '_show-add-button', reflect: true },
105
110
  _siblingHasColor: { state: true },
106
111
  };
@@ -454,6 +459,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
454
459
  this._displayKeyboardTooltip = false;
455
460
  this._hasColorSlot = false;
456
461
  this._hasNestedList = false;
462
+ this._listItemInteractiveEnabled = listItemInteractiveFlag;
457
463
  this._siblingHasColor = false;
458
464
  }
459
465
 
@@ -689,7 +695,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
689
695
  'hide-bottom-border': this._showAddButton && (!this._hasNestedList || this._hasNestedListAddButton)
690
696
  };
691
697
 
692
- const alignNested = ((this.draggable && this.selectable) || (this.expandable && this.selectable && this.color) || (this.expandable && !this.selectable)) ? 'control' : undefined;
698
+ const alignNested = ((this.draggable && this.selectable) || (this.expandable && this.selectable && this.color) || (this._listItemInteractiveEnabled && this.expandable && !this.selectable)) ? 'control' : undefined;
693
699
  const contentAreaContent = html`
694
700
  <div slot="content"
695
701
  class="d2l-list-item-content"
@@ -701,9 +707,9 @@ export const ListItemMixin = superclass => class extends composeMixins(
701
707
  </div>
702
708
  `;
703
709
 
704
- const primaryAction = ((!this.noPrimaryAction && this._renderPrimaryAction) ? this._renderPrimaryAction(this._contentId, contentAreaContent) : null);
705
- const renderExpandableAction = !primaryAction && !this.selectable && this.expandable && !this.noPrimaryAction;
706
- const renderCheckboxAction = !primaryAction && this.selectable && !this.noPrimaryAction;
710
+ const primaryAction = ((!this.noPrimaryAction && this._renderPrimaryAction) ? this._renderPrimaryAction(this._contentId, this._listItemInteractiveEnabled ? contentAreaContent : nothing) : null);
711
+ const renderExpandableActionContent = this._listItemInteractiveEnabled && !primaryAction && !this.selectable && this.expandable && !this.noPrimaryAction;
712
+ const renderCheckboxActionContent = this._listItemInteractiveEnabled && !primaryAction && this.selectable && !this.noPrimaryAction;
707
713
 
708
714
  let tooltipForId = null;
709
715
  if (this._showAddButton) {
@@ -756,8 +762,8 @@ export const ListItemMixin = superclass => class extends composeMixins(
756
762
  <div slot="control-action"
757
763
  @mouseenter="${this._onMouseEnter}"
758
764
  @mouseleave="${this._onMouseLeave}">
759
- ${this._renderCheckboxAction(renderCheckboxAction ? contentAreaContent : '')}
760
- ${this._renderExpandCollapseAction(renderExpandableAction ? contentAreaContent : null)}
765
+ ${this._renderCheckboxAction(renderCheckboxActionContent ? contentAreaContent : '')}
766
+ ${this._renderExpandCollapseAction(renderExpandableActionContent ? contentAreaContent : null)}
761
767
  </div>` : nothing }
762
768
  ${primaryAction ? html`
763
769
  <div slot="content-action"
@@ -767,7 +773,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
767
773
  @mouseleave="${this._onMouseLeavePrimaryAction}">
768
774
  ${primaryAction}
769
775
  </div>` : nothing}
770
- ${!primaryAction && !renderExpandableAction && !renderCheckboxAction ? contentAreaContent : nothing}
776
+ ${!this._listItemInteractiveEnabled || (!primaryAction && !renderExpandableActionContent && !renderCheckboxActionContent) ? contentAreaContent : nothing}
771
777
  <div slot="actions"
772
778
  @mouseenter="${this._onMouseEnter}"
773
779
  @mouseleave="${this._onMouseLeave}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.114.1",
3
+ "version": "3.115.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",