@brightspace-ui/core 3.141.1 → 3.142.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.
@@ -45,6 +45,8 @@ class ButtonAdd extends RtlMixin(PropertyRequiredMixin(FocusMixin(LocalizeCoreEl
45
45
  --d2l-button-add-animation-duration: 200ms;
46
46
  --d2l-button-add-hover-focus-color: var(--d2l-color-celestine-minus-1);
47
47
  --d2l-button-add-line-color: var(--d2l-color-mica);
48
+ --d2l-button-add-line-height: 1px;
49
+ --d2l-button-add-hover-focus-line-height: 2px;
48
50
  }
49
51
  :host([mode="icon-when-interacted"]) {
50
52
  --d2l-button-add-animation-delay: 50ms;
@@ -74,7 +76,7 @@ class ButtonAdd extends RtlMixin(PropertyRequiredMixin(FocusMixin(LocalizeCoreEl
74
76
 
75
77
  .line {
76
78
  background: var(--d2l-button-add-line-color);
77
- height: 1px;
79
+ height: var(--d2l-button-add-line-height);
78
80
  margin: 5px 0;
79
81
  width: 100%;
80
82
  }
@@ -82,7 +84,7 @@ class ButtonAdd extends RtlMixin(PropertyRequiredMixin(FocusMixin(LocalizeCoreEl
82
84
  button:hover .line,
83
85
  button:focus .line {
84
86
  background: var(--d2l-button-add-hover-focus-color);
85
- height: 2px;
87
+ height: var(--d2l-button-add-hover-focus-line-height);
86
88
  }
87
89
  button:hover d2l-button-add-icon-text,
88
90
  button:focus d2l-button-add-icon-text {
@@ -139,21 +141,21 @@ class ButtonAdd extends RtlMixin(PropertyRequiredMixin(FocusMixin(LocalizeCoreEl
139
141
 
140
142
  @keyframes line-start-animation {
141
143
  0% {
142
- background: linear-gradient(to right, var(--d2l-color-mica) 0%, var(--d2l-color-mica) 11%, var(--d2l-button-add-hover-focus-color) 11%) left center / 113%;
144
+ background: linear-gradient(to right, var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) left center / 113%;
143
145
  opacity: 10%;
144
146
  }
145
147
  100% {
146
- background: linear-gradient(to right, var(--d2l-color-mica) 0%, var(--d2l-color-mica) 11%, var(--d2l-button-add-hover-focus-color) 11%) left center / 113%; /* safari */
148
+ background: linear-gradient(to right, var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) left center / 113%; /* safari */
147
149
  background-position: right;
148
150
  }
149
151
  }
150
152
  @keyframes line-end-animation {
151
153
  0% {
152
- background: linear-gradient(to left, var(--d2l-color-mica) 0%, var(--d2l-color-mica) 11%, var(--d2l-button-add-hover-focus-color) 11%) right center / 113%;
154
+ background: linear-gradient(to left, var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) right center / 113%;
153
155
  opacity: 10%;
154
156
  }
155
157
  100% {
156
- background: linear-gradient(to left, var(--d2l-color-mica) 0%, var(--d2l-color-mica) 11%, var(--d2l-button-add-hover-focus-color) 11%) right center / 113%; /* safari */
158
+ background: linear-gradient(to left, var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) right center / 113%; /* safari */
157
159
  background-position: left;
158
160
  }
159
161
  }
@@ -30,7 +30,7 @@
30
30
  <div>Welcome!</div>
31
31
  </d2l-list-item-content>
32
32
  <d2l-list slot="nested" grid>
33
- <d2l-list-item-nav key="L2-1" label="Syallabus Confirmation">
33
+ <d2l-list-item-nav key="L2-1" label="Syallabus Confirmation" action-href="https://d2l.com" prevent-navigation>
34
34
  <d2l-list-item-content>
35
35
  <div><d2l-icon style="margin-right: 0.7rem;" icon="tier2:file-document"></d2l-icon>Syallabus Confirmation</div>
36
36
  <div slot="secondary"><d2l-tooltip-help text="Due: May 2, 2023 at 2 pm" style="padding: 5px;">Start: May 1, 2023 at 12:01 AM</d2l-tooltip-help></div>
@@ -38,18 +38,18 @@
38
38
  </d2l-list-item-nav>
39
39
  </d2l-list>
40
40
  </d2l-list-item-nav>
41
- <d2l-list-item-nav key="L2-2" label="Unit 1: Poetry" color="#29a6ff" expandable expanded>
41
+ <d2l-list-item-nav key="L2-2" label="Unit 1: Poetry" color="#29a6ff" expandable expanded action-href="https://d2l.com" prevent-navigation>
42
42
  <d2l-list-item-content>
43
43
  <div>Unit 1: Fiction</div>
44
44
  <div slot="secondary"><d2l-tooltip-help text="Due: May 2, 2023 at 5 pm" style="padding: 5px;">Starts: May 1, 2023 at 12:01 AM</d2l-tooltip-help></div>
45
45
  </d2l-list-item-content>
46
46
  <d2l-list slot="nested" grid>
47
- <d2l-list-item-nav key="L3-2" label="Fiction">
47
+ <d2l-list-item-nav key="L3-2" label="Fiction" action-href="https://d2l.com" prevent-navigation>
48
48
  <d2l-list-item-content>
49
49
  <div><d2l-icon style="margin-right: 0.7rem;" icon="tier2:file-document"></d2l-icon>Fiction</div>
50
50
  </d2l-list-item-content>
51
51
  </d2l-list-item-nav>
52
- <d2l-list-item-nav key="L3-2" label="Ten rules for writing fiction">
52
+ <d2l-list-item-nav key="L3-2" label="Ten rules for writing fiction" action-href="https://d2l.com" prevent-navigation>
53
53
  <d2l-list-item-content>
54
54
  <div><d2l-icon style="margin-right: 0.7rem;" icon="tier2:file-document"></d2l-icon>Ten rules for writing fiction</div>
55
55
  </d2l-list-item-content>
@@ -84,6 +84,10 @@ export const ListItemMixin = superclass => class extends composeMixins(
84
84
  * @type {boolean}
85
85
  */
86
86
  dragTargetHandleOnly: { type: Boolean, attribute: 'drag-target-handle-only' },
87
+ /**
88
+ * @ignore
89
+ */
90
+ last: { type: Boolean, reflect: true },
87
91
  /**
88
92
  * Whether to disable rendering the entire item as the primary action. Required if slotted content is interactive.
89
93
  * @type {boolean}
@@ -208,6 +212,18 @@ export const ListItemMixin = superclass => class extends composeMixins(
208
212
  --d2l-list-item-content-text-outline: 2px solid var(--d2l-color-celestine);
209
213
  --d2l-list-item-content-text-outline-offset: 1px;
210
214
  }
215
+ @supports selector(:has(a, b)) {
216
+ :host([_list-item-new-styles][_focusing-primary-action]) .d2l-list-item-content {
217
+ --d2l-list-item-content-text-border-radius: initial;
218
+ --d2l-list-item-content-text-outline: initial;
219
+ --d2l-list-item-content-text-outline-offset: initial;
220
+ }
221
+ :host([_list-item-new-styles][_focusing-primary-action]):has(:focus-visible) .d2l-list-item-content {
222
+ --d2l-list-item-content-text-border-radius: 3px;
223
+ --d2l-list-item-content-text-outline: 2px solid var(--d2l-color-celestine);
224
+ --d2l-list-item-content-text-outline-offset: 1px;
225
+ }
226
+ }
211
227
  [slot="content-action"] {
212
228
  height: 100%;
213
229
  }
@@ -18,6 +18,8 @@ export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(su
18
18
  preventNavigation: { type: Boolean, attribute: 'prevent-navigation' },
19
19
  _childCurrent: { type: Boolean, reflect: true, attribute: '_child-current' },
20
20
  _focusingElem: { type: Boolean, reflect: true, attribute: '_focusing-elem' },
21
+ _hasCurrentParent: { type: Boolean, reflect: true, attribute: '_has-current-parent' },
22
+ _nextSiblingCurrent: { type: Boolean, reflect: true, attribute: '_next-sibling-current' },
21
23
  };
22
24
  }
23
25
 
@@ -44,6 +46,40 @@ export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(su
44
46
  --d2l-list-item-content-text-color: var(--d2l-color-ferrite);
45
47
  --d2l-list-item-content-text-decoration: none;
46
48
  }
49
+ :host([current]) d2l-button-add,
50
+ :host([_has-current-parent]) [slot="add-top"] d2l-button-add,
51
+ :host([_next-sibling-current]) [slot="add"] d2l-button-add {
52
+ --d2l-button-add-hover-focus-line-height: 3px;
53
+ --d2l-button-add-line-color: var(--d2l-color-celestine);
54
+ --d2l-button-add-line-height: 3px;
55
+ }
56
+ :host([current]) [slot="add"],
57
+ :host([_has-current-parent]) [slot="add-top"] {
58
+ margin-bottom: -14.5px;
59
+ margin-top: -13.5px;
60
+ }
61
+ :host([current]) [slot="add-top"],
62
+ :host([_next-sibling-current]) [slot="add"] {
63
+ margin-bottom: -13.5px;
64
+ margin-top: -10.5px;
65
+ }
66
+ :host([current]) .d2l-list-item-color-outer {
67
+ padding-block: 3px;
68
+ }
69
+
70
+ /* clean up with GAUD-7495-list-item-new-styles flag */
71
+ @supports selector(:has(a, b)) {
72
+ :host([_focusing-primary-action]) .d2l-list-item-content {
73
+ --d2l-list-item-content-text-border-radius: initial;
74
+ --d2l-list-item-content-text-outline: initial;
75
+ --d2l-list-item-content-text-outline-offset: initial;
76
+ }
77
+ :host([_focusing-primary-action]):has(:focus-visible) .d2l-list-item-content {
78
+ --d2l-list-item-content-text-border-radius: 3px;
79
+ --d2l-list-item-content-text-outline: 2px solid var(--d2l-color-celestine);
80
+ --d2l-list-item-content-text-outline-offset: 1px;
81
+ }
82
+ }
47
83
 
48
84
  ` ];
49
85
 
@@ -56,6 +92,8 @@ export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(su
56
92
  this.current = false;
57
93
  this._childCurrent = false;
58
94
  this._focusingElem = false;
95
+ this._hasCurrentParent = false;
96
+ this._nextSiblingCurrent = false;
59
97
  }
60
98
 
61
99
  connectedCallback() {
@@ -106,6 +144,24 @@ export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(su
106
144
  dispatchSetChildCurrentEvent(val) {
107
145
  /** @ignore */
108
146
  this.dispatchEvent(new CustomEvent('d2l-list-item-nav-set-child-current', { bubbles: true, composed: true, detail: { value: val } }));
147
+
148
+ if (!val) return;
149
+ requestAnimationFrame(() => {
150
+ if (this._hasNestedListAddButton) {
151
+ const firstChild = this.querySelector('[first]');
152
+ if (firstChild) firstChild._hasCurrentParent = true;
153
+ }
154
+
155
+ const prevSibling = this._getPreviousListItemSibling();
156
+ if (prevSibling) {
157
+ if (prevSibling._showAddButton) prevSibling._nextSiblingCurrent = true;
158
+
159
+ if (prevSibling._hasNestedListAddButton) {
160
+ const lastChild = prevSibling.querySelector('[last]');
161
+ if (lastChild) lastChild._nextSiblingCurrent = true;
162
+ }
163
+ }
164
+ });
109
165
  }
110
166
 
111
167
  _handleLinkClick(e) {
@@ -416,6 +416,15 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
416
416
  target.dispatchSetChildCurrentEvent(true);
417
417
  }, { once: true });
418
418
  prevCurrent.current = false;
419
+ const firstChild = this.querySelector('[_has-current-parent]');
420
+ if (firstChild) firstChild._hasCurrentParent = false;
421
+
422
+ const prevSiblings = this.querySelectorAll('[_next-sibling-current]');
423
+ if (prevSiblings.length > 0) {
424
+ prevSiblings.forEach(sibling => {
425
+ sibling._nextSiblingCurrent = false;
426
+ });
427
+ }
419
428
  } else {
420
429
  target.dispatchSetChildCurrentEvent(true);
421
430
  }
@@ -437,9 +446,21 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
437
446
 
438
447
  _handleSlotChange() {
439
448
  this._updateItemShowingCount();
440
- this.getItems().forEach((item, i) => {
441
- if (i === 0) item.first = true;
442
- else item.first = false;
449
+ const items = this.getItems();
450
+ items.forEach((item, i) => {
451
+ if (items.length === 1) {
452
+ item.first = true;
453
+ item.last = true;
454
+ } else if (i === 0) {
455
+ item.first = true;
456
+ item.last = false;
457
+ } else if (i === items.length - 1) {
458
+ item.first = false;
459
+ item.last = true;
460
+ } else {
461
+ item.first = false;
462
+ item.last = false;
463
+ }
443
464
  });
444
465
 
445
466
  /** @ignore */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.141.1",
3
+ "version": "3.142.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",