@brightspace-ui/core 1.186.0 → 1.189.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.
@@ -44,6 +44,11 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
44
44
  * Disables the dropdown opener for the filter
45
45
  */
46
46
  disabled: { type: Boolean, reflect: true },
47
+ /**
48
+ * Indicates if the filter is open
49
+ * @type {boolean}
50
+ */
51
+ opened: { type: Boolean, reflect: true },
47
52
  _activeDimensionKey: { type: String, attribute: false },
48
53
  _dimensions: { type: Array, attribute: false },
49
54
  _totalAppliedCount: { type: Number, attribute: false }
@@ -132,6 +137,7 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
132
137
  constructor() {
133
138
  super();
134
139
  this.disabled = false;
140
+ this.opened = false;
135
141
  this._changeEventsToDispatch = new Map();
136
142
  this._dimensions = [];
137
143
  this._openedDimensions = [];
@@ -163,12 +169,25 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
163
169
  description += `. ${this.localize('components.filter.filterCountDescription', { number: this._totalAppliedCount })}`;
164
170
 
165
171
  const dropdownContent = singleDimension ? html`
166
- <d2l-dropdown-content min-width="285" max-width="420" mobile-tray="right" mobile-breakpoint="768" no-padding-header no-padding>
172
+ <d2l-dropdown-content
173
+ min-width="285"
174
+ max-width="420"
175
+ mobile-tray="right"
176
+ mobile-breakpoint="768"
177
+ no-padding-header
178
+ no-padding
179
+ ?opened="${this.opened}">
167
180
  ${header}
168
181
  ${dimensions}
169
182
  </d2l-dropdown-content>`
170
183
  : html`
171
- <d2l-dropdown-menu min-width="285" max-width="420" mobile-tray="right" mobile-breakpoint="768" no-padding-header>
184
+ <d2l-dropdown-menu
185
+ min-width="285"
186
+ max-width="420"
187
+ mobile-tray="right"
188
+ mobile-breakpoint="768"
189
+ no-padding-header
190
+ ?opened="${this.opened}">
172
191
  ${header}
173
192
  <d2l-menu label="${this.localize('components.filter.filters')}">
174
193
  ${dimensions}
@@ -517,11 +536,13 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
517
536
  }
518
537
 
519
538
  _handleDropdownClose(e) {
539
+ this.opened = false;
520
540
  this._activeDimensionKey = null;
521
541
  this._stopPropagation(e);
522
542
  }
523
543
 
524
544
  _handleDropdownOpen(e) {
545
+ this.opened = true;
525
546
  if (this._dimensions.length === 1) {
526
547
  this._dispatchDimensionFirstOpenEvent(this._dimensions[0].key);
527
548
  }
@@ -39,16 +39,7 @@
39
39
  </script>
40
40
  <script>
41
41
  if (window.location.search.indexOf('latex=true') !== -1) {
42
- window.D2L = {};
43
- D2L.LP = {};
44
- D2L.LP.Web = {};
45
- D2L.LP.Web.UI = {};
46
- D2L.LP.Web.UI.Flags = {
47
- Flag: (feature, defaultValue) => {
48
- if (feature === 'us125413-mathjax-render-latex') return true;
49
- else return defaultValue;
50
- }
51
- };
42
+ document.getElementsByTagName('html')[0].dataset.mathjaxContext = JSON.stringify({ renderLaTeX: true });
52
43
  }
53
44
  </script>
54
45
  </head>
@@ -17,6 +17,7 @@ import { FormElementMixin } from '../form/form-element-mixin.js';
17
17
  import { getDefaultTime } from './input-time.js';
18
18
  import { getUniqueId } from '../../helpers/uniqueId.js';
19
19
  import { ifDefined } from 'lit-html/directives/if-defined.js';
20
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
20
21
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
21
22
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
22
23
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -38,7 +39,7 @@ function _getFormattedDefaultTime(defaultValue) {
38
39
  * A component that consists of a "<d2l-input-date>" and a "<d2l-input-time>" component. The time input only appears once a date is selected. This component displays the "value" if one is specified, and reflects the selected value when one is selected or entered.
39
40
  * @fires change - Dispatched when there is a change to selected date or selected time. "value" corresponds to the selected value and is formatted in ISO 8601 combined date and time format ("YYYY-MM-DDTHH:mm:ss.sssZ").
40
41
  */
41
- class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(RtlMixin(LitElement)))) {
42
+ class InputDateTime extends LabelledMixin(SkeletonMixin(FormElementMixin(LocalizeCoreElement(RtlMixin(LitElement))))) {
42
43
 
43
44
  static get properties() {
44
45
  return {
@@ -46,11 +47,6 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
46
47
  * Disables the input
47
48
  */
48
49
  disabled: { type: Boolean },
49
- /**
50
- * REQUIRED: Accessible label for the input fieldset that wraps the date and time inputs
51
- * @type {string}
52
- */
53
- label: { type: String },
54
50
  /**
55
51
  * Hides the fieldset label visually
56
52
  */
@@ -191,10 +187,6 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
191
187
  firstUpdated(changedProperties) {
192
188
  super.firstUpdated(changedProperties);
193
189
 
194
- if (!this.label) {
195
- console.warn('d2l-input-date-time component requires label text');
196
- }
197
-
198
190
  if (this.value) this._preventDefaultValidation = true;
199
191
  }
200
192
 
@@ -229,6 +221,7 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
229
221
  @mouseover="${this._handleInputTimeFocus}"
230
222
  label="${this.localize('components.input-date-time.time')}"
231
223
  label-hidden
224
+ .labelRequired="${false}"
232
225
  max-height="430"
233
226
  ?required="${this.required}"
234
227
  ?skeleton="${this.skeleton}"
@@ -239,7 +232,7 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
239
232
  ${tooltip}
240
233
  <d2l-input-fieldset
241
234
  label="${ifDefined(this.label)}"
242
- ?label-hidden="${this.labelHidden}"
235
+ ?label-hidden="${this.labelHidden || this.labelledBy}"
243
236
  ?required="${this.required}"
244
237
  ?skeleton="${this.skeleton}">
245
238
  <div class="d2l-input-date-time-container">
@@ -253,6 +246,7 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
253
246
  id="${this._inputId}"
254
247
  label="${this.localize('components.input-date-time.date')}"
255
248
  label-hidden
249
+ .labelRequired="${false}"
256
250
  max-value="${ifDefined(this._maxValueLocalized)}"
257
251
  min-value="${ifDefined(this._minValueLocalized)}"
258
252
  ?opened="${dateOpened}"
@@ -11,6 +11,7 @@ import { formatDateInISO, getDateFromISODate, getDateTimeDescriptorShared, getTo
11
11
  import { FormElementMixin } from '../form/form-element-mixin.js';
12
12
  import { getUniqueId } from '../../helpers/uniqueId.js';
13
13
  import { ifDefined } from 'lit-html/directives/if-defined.js';
14
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
14
15
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
15
16
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
16
17
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -26,7 +27,7 @@ export function formatISODateInUserCalDescriptor(val) {
26
27
  * A component that consists of a text input field for typing a date and an attached calendar (d2l-calendar) dropdown. It displays the "value" if one is specified, or a placeholder if not, and reflects the selected value when one is selected in the calendar or entered in the text input.
27
28
  * @fires change - Dispatched when there is a change to selected date. "value" corresponds to the selected value and is formatted in ISO 8601 calendar date format ("YYYY-MM-DD").
28
29
  */
29
- class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitElement))) {
30
+ class InputDate extends LabelledMixin(SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitElement)))) {
30
31
 
31
32
  static get properties() {
32
33
  return {
@@ -38,11 +39,6 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
38
39
  * Text that appears as a placeholder in the input to reassure users that they can choose not to provide a value (usually not necessary)
39
40
  */
40
41
  emptyText: { type: String, attribute: 'empty-text' },
41
- /**
42
- * REQUIRED: Accessible label for the input
43
- * @type {string}
44
- */
45
- label: { type: String },
46
42
  /**
47
43
  * Hides the label visually (moves it to the input's "aria-label" attribute)
48
44
  */
@@ -177,10 +173,6 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
177
173
  async firstUpdated(changedProperties) {
178
174
  super.firstUpdated(changedProperties);
179
175
 
180
- if (!this.label) {
181
- console.warn('d2l-input-date component requires label text');
182
- }
183
-
184
176
  this._textInput = this.shadowRoot.querySelector('d2l-input-text');
185
177
 
186
178
  this.addEventListener('blur', this._handleBlur);
@@ -276,7 +268,8 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
276
268
  hide-invalid-icon
277
269
  id="${this._inputId}"
278
270
  label="${ifDefined(this.label)}"
279
- ?label-hidden="${this.labelHidden}"
271
+ ?label-hidden="${this.labelHidden || this.labelledBy}"
272
+ .labelRequired="${false}"
280
273
  live="assertive"
281
274
  @mouseup="${this._handleMouseup}"
282
275
  placeholder="${shortDateFormat}"
@@ -4,6 +4,7 @@ import { formatNumber, getNumberDescriptor, parseNumber } from '@brightspace-ui/
4
4
  import { FormElementMixin } from '../form/form-element-mixin.js';
5
5
  import { getUniqueId } from '../../helpers/uniqueId.js';
6
6
  import { ifDefined } from 'lit-html/directives/if-defined.js';
7
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
7
8
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
8
9
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
9
10
 
@@ -67,7 +68,7 @@ function roundPrecisely(val, maxFractionDigits) {
67
68
  * @slot right - Slot within the input on the right side. Useful for an "icon" or "button-icon".
68
69
  * @fires change - Dispatched when an alteration to the value is committed (typically after focus is lost) by the user. The `value` attribute reflects a JavaScript Number which is parsed from the formatted input value.
69
70
  */
70
- class InputNumber extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitElement))) {
71
+ class InputNumber extends LabelledMixin(SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitElement)))) {
71
72
 
72
73
  static get properties() {
73
74
  return {
@@ -96,11 +97,6 @@ class InputNumber extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Lit
96
97
  * @type {string}
97
98
  */
98
99
  inputWidth: { attribute: 'input-width', type: String },
99
- /**
100
- * Label for the input
101
- * @type {string}
102
- */
103
- label: { type: String },
104
100
  /**
105
101
  * Hides the label visually (moves it to the input's `aria-label` attribute)
106
102
  * @type {boolean}
@@ -302,9 +298,6 @@ class InputNumber extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Lit
302
298
 
303
299
  firstUpdated(changedProperties) {
304
300
  super.firstUpdated(changedProperties);
305
- if (!this.label) {
306
- console.warn('d2l-input-number component requires label text');
307
- }
308
301
  this.addEventListener('d2l-localize-behavior-language-changed', () => {
309
302
  this._descriptor = getNumberDescriptor();
310
303
  if (this._formattedValue.length > 0) {
@@ -329,7 +322,8 @@ class InputNumber extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Lit
329
322
  id="${this._inputId}"
330
323
  input-width="${this.inputWidth}"
331
324
  label="${ifDefined(this.label)}"
332
- ?label-hidden="${this.labelHidden}"
325
+ ?label-hidden="${this.labelHidden || this.labelledBy}"
326
+ .labelRequired="${false}"
333
327
  name="${ifDefined(this.name)}"
334
328
  placeholder="${ifDefined(this.placeholder)}"
335
329
  ?required="${this.required}"
@@ -2,6 +2,7 @@ import './input-number.js';
2
2
  import { css, html, LitElement } from 'lit-element/lit-element.js';
3
3
  import { FormElementMixin } from '../form/form-element-mixin.js';
4
4
  import { ifDefined } from 'lit-html/directives/if-defined.js';
5
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
5
6
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
6
7
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
7
8
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -11,7 +12,7 @@ import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
11
12
  * @slot after - Slot beside the input on the right side. Useful for an "icon" or "button-icon".
12
13
  * @fires change - Dispatched when an alteration to the value is committed (typically after focus is lost) by the user. The `value` attribute reflects a JavaScript Number which is parsed from the formatted input value.
13
14
  */
14
- class InputPercent extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(RtlMixin(LitElement)))) {
15
+ class InputPercent extends LabelledMixin(SkeletonMixin(FormElementMixin(LocalizeCoreElement(RtlMixin(LitElement))))) {
15
16
 
16
17
  static get properties() {
17
18
  return {
@@ -30,11 +31,6 @@ class InputPercent extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Rt
30
31
  * @type {string}
31
32
  */
32
33
  inputWidth: { attribute: 'input-width', type: String },
33
- /**
34
- * REQUIRED: Label for the input
35
- * @type {string}
36
- */
37
- label: { type: String },
38
34
  /**
39
35
  * Hides the label visually (moves it to the input's "aria-label" attribute)
40
36
  * @type {boolean}
@@ -106,13 +102,6 @@ class InputPercent extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Rt
106
102
  this.requestUpdate('value', oldValue);
107
103
  }
108
104
 
109
- firstUpdated(changedProperties) {
110
- super.firstUpdated(changedProperties);
111
- if (!this.label) {
112
- console.warn('d2l-input-percent component requires label text');
113
- }
114
- }
115
-
116
105
  render() {
117
106
  return html`
118
107
  <d2l-input-number
@@ -123,7 +112,8 @@ class InputPercent extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(Rt
123
112
  .forceInvalid="${this.invalid}"
124
113
  input-width="${ifDefined(this.inputWidth)}"
125
114
  label="${ifDefined(this.label)}"
126
- ?label-hidden="${this.labelHidden}"
115
+ ?label-hidden="${this.labelHidden || this.labelledBy}"
116
+ .labelRequired="${false}"
127
117
  max="100"
128
118
  max-fraction-digits="${ifDefined(this.maxFractionDigits)}"
129
119
  min="0"
@@ -7,6 +7,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
7
7
  import { ifDefined } from 'lit-html/directives/if-defined.js';
8
8
  import { inputLabelStyles } from './input-label-styles.js';
9
9
  import { inputStyles } from './input-styles.js';
10
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
10
11
  import { offscreenStyles } from '../offscreen/offscreen.js';
11
12
  import { PerfMonitor } from '../../helpers/perfMonitor.js';
12
13
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
@@ -21,7 +22,7 @@ import { styleMap } from 'lit-html/directives/style-map.js';
21
22
  * @fires change - Dispatched when an alteration to the value is committed (typically after focus is lost) by the user
22
23
  * @fires input - Dispatched immediately after changes by the user
23
24
  */
24
- class InputText extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
25
+ class InputText extends LabelledMixin(FormElementMixin(SkeletonMixin(RtlMixin(LitElement)))) {
25
26
 
26
27
  static get properties() {
27
28
  return {
@@ -71,11 +72,6 @@ class InputText extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
71
72
  * @type {string}
72
73
  */
73
74
  inputWidth: { attribute: 'input-width', type: String },
74
- /**
75
- * REQUIRED: Label for the input
76
- * @type {string}
77
- */
78
- label: { type: String },
79
75
  /**
80
76
  * Hides the label visually (moves it to the input's "aria-label" attribute)
81
77
  * @type {boolean}
@@ -312,6 +308,13 @@ class InputText extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
312
308
  return super.validity;
313
309
  }
314
310
 
311
+ connectedCallback() {
312
+ super.connectedCallback();
313
+ if (this.hasAttribute('aria-label')) {
314
+ this.labelRequired = false;
315
+ }
316
+ }
317
+
315
318
  disconnectedCallback() {
316
319
  super.disconnectedCallback();
317
320
  if (this._intersectionObserver) this._intersectionObserver.disconnect();
@@ -434,7 +437,7 @@ class InputText extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
434
437
  </div>
435
438
  ${offscreenContainer}
436
439
  `;
437
- if (this.label && !this.labelHidden) {
440
+ if (this.label && !this.labelHidden && !this.labelledBy) {
438
441
  return html`
439
442
  <label class="d2l-input-label d2l-skeletize" for="${this._inputId}">${this.label}${this.unit ? html`<span class="d2l-offscreen"> ${this.unit}</span>` : ''}</label>
440
443
  ${input}`;
@@ -471,7 +474,7 @@ class InputText extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
471
474
  }
472
475
 
473
476
  _getAriaLabel() {
474
- if (this.label && this.labelHidden) {
477
+ if (this.label && (this.labelHidden || this.labelledBy)) {
475
478
  return this.label;
476
479
  }
477
480
  if (this.hasAttribute('aria-label')) {
@@ -6,6 +6,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
6
6
  import { ifDefined } from 'lit-html/directives/if-defined.js';
7
7
  import { inputLabelStyles } from './input-label-styles.js';
8
8
  import { inputStyles } from './input-styles.js';
9
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
9
10
  import { offscreenStyles } from '../offscreen/offscreen.js';
10
11
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
11
12
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -16,7 +17,7 @@ import { styleMap } from 'lit-html/directives/style-map.js';
16
17
  * @fires change - Dispatched when an alteration to the value is committed (typically after focus is lost) by the user
17
18
  * @fires input - Dispatched immediately after changes by the user
18
19
  */
19
- class InputTextArea extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))) {
20
+ class InputTextArea extends LabelledMixin(FormElementMixin(SkeletonMixin(RtlMixin(LitElement)))) {
20
21
 
21
22
  static get properties() {
22
23
  return {
@@ -35,11 +36,6 @@ class InputTextArea extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))
35
36
  * @type {boolean}
36
37
  */
37
38
  disabled: { type: Boolean, reflect: true },
38
- /**
39
- * REQUIRED: Label for the input
40
- * @type {string}
41
- */
42
- label: { type: String },
43
39
  /**
44
40
  * Hides the label visually (moves it to the input's "aria-label" attribute)
45
41
  * @type {boolean}
@@ -232,7 +228,7 @@ class InputTextArea extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))
232
228
  ${offscreenContainer}
233
229
  `;
234
230
 
235
- if (this.label && !this.labelHidden) {
231
+ if (this.label && !this.labelHidden && !this.labelledBy) {
236
232
  return html`
237
233
  <label class="d2l-input-label d2l-skeletize" for="${this._textareaId}">${this.label}</label>
238
234
  ${textarea}`;
@@ -281,7 +277,7 @@ class InputTextArea extends FormElementMixin(SkeletonMixin(RtlMixin(LitElement))
281
277
  }
282
278
 
283
279
  _getAriaLabel() {
284
- if (this.label && this.labelHidden) {
280
+ if (this.label && (this.labelHidden || this.labelledBy)) {
285
281
  return this.label;
286
282
  }
287
283
  // check aria-label for backwards compatibility in order to replace old Polymer impl
@@ -12,6 +12,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
12
12
  import { ifDefined } from 'lit-html/directives/if-defined.js';
13
13
  import { inputLabelStyles } from './input-label-styles.js';
14
14
  import { inputStyles } from './input-styles.js';
15
+ import { LabelledMixin } from '../../mixins/labelled-mixin.js';
15
16
  import { offscreenStyles } from '../offscreen/offscreen.js';
16
17
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
17
18
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -110,7 +111,7 @@ function initIntervals(size, enforceTimeIntervals) {
110
111
  * A component that consists of a text input field for typing a time and an attached dropdown for time selection. It displays the "value" if one is specified, or a placeholder if not, and reflects the selected value when one is selected in the dropdown or entered in the text input.
111
112
  * @fires change - Dispatched when there is a change to selected time. "value" corresponds to the selected value and is formatted in ISO 8601 time format ("hh:mm:ss").
112
113
  */
113
- class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
114
+ class InputTime extends LabelledMixin(SkeletonMixin(FormElementMixin(LitElement))) {
114
115
 
115
116
  static get properties() {
116
117
  return {
@@ -127,11 +128,6 @@ class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
127
128
  * Rounds typed input up to nearest valid interval time (specified with "time-interval")
128
129
  */
129
130
  enforceTimeIntervals: { type: Boolean, attribute: 'enforce-time-intervals' },
130
- /**
131
- * REQUIRED: Accessible label for the input
132
- * @type {string}
133
- */
134
- label: { type: String },
135
131
  /**
136
132
  * Hides the label visually (moves it to the input's "aria-label" attribute)
137
133
  */
@@ -247,9 +243,6 @@ class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
247
243
 
248
244
  async firstUpdated(changedProperties) {
249
245
  super.firstUpdated(changedProperties);
250
- if (!this.label) {
251
- console.warn('d2l-input-time component requires label text');
252
- }
253
246
 
254
247
  if (this.value === undefined) {
255
248
  const time = getDefaultTime(this.defaultValue, this.enforceTimeIntervals, this.timeInterval);
@@ -297,7 +290,7 @@ class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
297
290
  <div>${formattedWideTimePM}</div>
298
291
  </div>
299
292
  <label
300
- class="${this.label && !this.labelHidden ? 'd2l-input-label d2l-skeletize' : 'd2l-offscreen'}"
293
+ class="${this.label && !this.labelHidden && !this.labelledBy ? 'd2l-input-label d2l-skeletize' : 'd2l-offscreen'}"
301
294
  for="${this._dropdownId}-input"
302
295
  id="${this._dropdownId}-label">${this.label}</label>
303
296
  <d2l-dropdown class="d2l-skeletize" ?disabled="${disabled}">
@@ -0,0 +1,83 @@
1
+ import '../list-item-content.js';
2
+ import { html, LitElement } from 'lit-element/lit-element.js';
3
+ import { ListItemMixin } from '../list-item-mixin.js';
4
+
5
+ const demoData = {
6
+ 'L1-1': {
7
+ primaryText: 'Earth Sciences (L1)',
8
+ supportingText: 'Earth science or geoscience includes all fields of natural science related to planet Earth. This is a branch of science dealing with the physical and chemical constitution of Earth and its atmosphere. Earth science can be considered to be a branch of planetary science, but with a much older history.',
9
+ nested: [ 'L2-1', 'L2-2', 'L2-3' ]
10
+ },
11
+ 'L1-2': {
12
+ primaryText: 'Biology (L1)',
13
+ supportingText: ''
14
+ },
15
+ 'L1-3': {
16
+ primaryText: 'Computer Science (L3)',
17
+ supportingText: ''
18
+ },
19
+ 'L2-1': {
20
+ primaryText: 'Introductory Earth Sciences (L2)',
21
+ supportingText: 'This course explores the geological processes of the Earth\'s interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering. Students will gain an appreciation of how these processes have controlled the evolution of our planet and the role of geology in meeting society\'s current and future demand for sustainable energy and mineral resources.',
22
+ nested: [ 'L3-1', 'L3-2', 'L3-3' ]
23
+ },
24
+ 'L2-2': {
25
+ primaryText: 'Flow and Transport Through Fractured Rocks (L2)',
26
+ supportingText: 'Fractures are ubiquitous in geologic media and important in disciplines such as physical and contaminant hydrogeology, geotechnical engineering, civil and environmental engineering, petroleum engineering among other areas. Despite the importance of fractures, its characterization and predictions of groundwater flow and contaminant transport are fraught with significant difficulties. Students are taught to deal with fractures in hydrogeology, to conceptualize them, and to build reliable models for predicting groundwater flow and contaminant transport.'
27
+ },
28
+ 'L2-3': {
29
+ primaryText: 'Applied Wetland Science (L2)',
30
+ supportingText: 'Advanced concepts on wetland ecosystems in the context of regional and global earth systems processes such as carbon and nitrogen cycling and climate change, applications of wetland paleoecology, use of isotopes and other geochemical tools in wetland science, and wetland engineering in landscape rehabilitation and ecotechnology. Current issues in Canada and abroad will be examined.'
31
+ },
32
+ 'L3-1': {
33
+ primaryText: 'Glaciation (L3)',
34
+ supportingText: 'Supporting Info'
35
+ },
36
+ 'L3-2': {
37
+ primaryText: 'Weathering (L3)',
38
+ supportingText: 'Supporting Info'
39
+ },
40
+ 'L3-3': {
41
+ primaryText: 'Volcanism (L3)',
42
+ supportingText: 'Supporting Info'
43
+ }
44
+ };
45
+
46
+ class DemoListItemCustom extends ListItemMixin(LitElement) {
47
+
48
+ constructor() {
49
+ super();
50
+ this.selectable = true;
51
+ }
52
+
53
+ render() {
54
+ const itemTemplates = {
55
+ content: html`
56
+ <d2l-list-item-content>
57
+ <div>${demoData[this.key].primaryText}</div>
58
+ <div slot="supporting-info">${demoData[this.key].supportingText}</div>
59
+ </d2l-list-item-content>
60
+ `
61
+ };
62
+
63
+ if (demoData[this.key].nested && demoData[this.key].nested.length > 0) {
64
+ itemTemplates.nested = html`
65
+ <d2l-list separators="all">
66
+ ${demoData[this.key].nested.map(itemKey => html`<d2l-demo-list-item-custom selectable key="${itemKey}"></d2l-demo-list-item-custom>`)}
67
+ </d2l-list>
68
+ `;
69
+ }
70
+
71
+ return this._renderListItem(itemTemplates);
72
+ }
73
+
74
+ updated(changedProperties) {
75
+ super.updated(changedProperties);
76
+ if (changedProperties.has('key')) {
77
+ this.label = `Label for ${this.key}`;
78
+ }
79
+ }
80
+
81
+ }
82
+
83
+ customElements.define('d2l-demo-list-item-custom', DemoListItemCustom);