@brightspace-ui/core 2.145.2 → 2.146.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.
@@ -2,10 +2,10 @@ import '../button/button-icon.js';
2
2
  import '../colors/colors.js';
3
3
  import { bodySmallStyles, heading4Styles } from '../typography/styles.js';
4
4
  import { css, html, LitElement } from 'lit';
5
- import { formatDateInISO, getClosestValidDate, getDateFromDateObj, getDateFromISODate, getDateTimeDescriptorShared, getToday, isDateInRange } from '../../helpers/dateTime.js';
5
+ import { formatDate, getDateTimeDescriptor } from '@brightspace-ui/intl/lib/dateTime.js';
6
+ import { formatDateInISO, getClosestValidDate, getDateFromDateObj, getDateFromISODate, getToday, isDateInRange } from '../../helpers/dateTime.js';
6
7
  import { classMap } from 'lit/directives/class-map.js';
7
8
  import { findComposedAncestor } from '../../helpers/dom.js';
8
- import { formatDate } from '@brightspace-ui/intl/lib/dateTime.js';
9
9
  import { getUniqueId } from '../../helpers/uniqueId.js';
10
10
  import { ifDefined } from 'lit/directives/if-defined.js';
11
11
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
@@ -29,15 +29,13 @@ const keyCodes = {
29
29
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
30
30
 
31
31
  let calendarData;
32
- function getCalendarData(refresh) {
33
- if (!calendarData) {
34
- calendarData = {};
35
- calendarData.descriptor = getDateTimeDescriptorShared(refresh);
36
- calendarData.firstDayOfWeek = calendarData.descriptor.calendar.firstDayOfWeek;
37
- calendarData.daysOfWeekIndex = [];
38
- for (let i = calendarData.firstDayOfWeek; i < calendarData.firstDayOfWeek + daysInWeek; i++) {
39
- calendarData.daysOfWeekIndex.push(i % daysInWeek);
40
- }
32
+ function getCalendarData() {
33
+ calendarData = {};
34
+ calendarData.descriptor = getDateTimeDescriptor();
35
+ calendarData.firstDayOfWeek = calendarData.descriptor.calendar.firstDayOfWeek;
36
+ calendarData.daysOfWeekIndex = [];
37
+ for (let i = calendarData.firstDayOfWeek; i < calendarData.firstDayOfWeek + daysInWeek; i++) {
38
+ calendarData.daysOfWeekIndex.push(i % daysInWeek);
41
39
  }
42
40
  return calendarData;
43
41
  }
@@ -339,8 +337,8 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
339
337
  background-color: var(--d2l-color-gypsum);
340
338
  }
341
339
 
342
- td:focus button:not(.d2l-calendar-date-selected):hover,
343
- td:focus button:not(.d2l-calendar-date-selected).d2l-calendar-date-hover {
340
+ td:focus button:not(.d2l-calendar-date-selected):not(:disabled):hover,
341
+ td:focus button:not(.d2l-calendar-date-selected):not(:disabled).d2l-calendar-date-hover {
344
342
  box-shadow: 0 0 0 2px var(--d2l-color-gypsum), 0 0 0 4px var(--d2l-color-celestine);
345
343
  transition: none;
346
344
  }
@@ -351,8 +349,11 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
351
349
 
352
350
  td:focus .d2l-calendar-date {
353
351
  border-radius: 0.16rem;
354
- box-shadow: 0 0 0 2px white, 0 0 0 4px var(--d2l-color-celestine);
355
352
  padding: 0;
353
+ }
354
+
355
+ td:focus .d2l-calendar-date:not(:disabled) {
356
+ box-shadow: 0 0 0 2px white, 0 0 0 4px var(--d2l-color-celestine);
356
357
  transition: none;
357
358
  }
358
359
 
@@ -423,8 +424,7 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
423
424
  this.addEventListener('blur', () => this._isInitialFocusDate = true);
424
425
 
425
426
  this.addEventListener('d2l-localize-resources-change', () => {
426
- calendarData = null;
427
- getCalendarData(true);
427
+ getCalendarData();
428
428
  this.requestUpdate();
429
429
  });
430
430
 
@@ -6,8 +6,8 @@ import '../icons/icon.js';
6
6
  import '../tooltip/tooltip.js';
7
7
  import './input-text.js';
8
8
  import { css, html, LitElement } from 'lit';
9
- import { formatDate, parseDate } from '@brightspace-ui/intl/lib/dateTime.js';
10
- import { formatDateInISO, getDateFromISODate, getDateTimeDescriptorShared, getToday } from '../../helpers/dateTime.js';
9
+ import { formatDate, getDateTimeDescriptor, parseDate } from '@brightspace-ui/intl/lib/dateTime.js';
10
+ import { formatDateInISO, getDateFromISODate, getToday } from '../../helpers/dateTime.js';
11
11
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
12
12
  import { FormElementMixin } from '../form/form-element-mixin.js';
13
13
  import { getUniqueId } from '../../helpers/uniqueId.js';
@@ -165,7 +165,7 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
165
165
  this._showInfoTooltip = true;
166
166
  this._shownValue = '';
167
167
 
168
- this._dateTimeDescriptor = getDateTimeDescriptorShared();
168
+ this._dateTimeDescriptor = getDateTimeDescriptor();
169
169
  }
170
170
 
171
171
  static get focusElementSelector() {
@@ -208,7 +208,7 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
208
208
 
209
209
  this.addEventListener('blur', this._handleBlur);
210
210
  this.addEventListener('d2l-localize-resources-change', () => {
211
- this._dateTimeDescriptor = getDateTimeDescriptorShared(true);
211
+ this._dateTimeDescriptor = getDateTimeDescriptor();
212
212
  this.requestUpdate();
213
213
  this.updateComplete.then(() => tryUpdateHiddenContentWidth());
214
214
  });
@@ -1,4 +1,4 @@
1
- import { convertLocalToUTCDateTime, convertUTCToLocalDateTime, getDateTimeDescriptor } from '@brightspace-ui/intl/lib/dateTime.js';
1
+ import { convertLocalToUTCDateTime, convertUTCToLocalDateTime } from '@brightspace-ui/intl/lib/dateTime.js';
2
2
 
3
3
  // val is an object containing year, month, date
4
4
  export function formatDateInISO(val) {
@@ -139,12 +139,6 @@ export function getDateNoConversion(value) {
139
139
  return new Date(parsed.year, parsed.month - 1, parsed.date, parsed.hours, parsed.minutes, parsed.seconds);
140
140
  }
141
141
 
142
- let dateTimeDescriptor = null;
143
- export function getDateTimeDescriptorShared(refresh) {
144
- if (!dateTimeDescriptor || refresh) dateTimeDescriptor = getDateTimeDescriptor();
145
- return dateTimeDescriptor;
146
- }
147
-
148
142
  export function getLocalDateTimeFromUTCDateTime(dateTime) {
149
143
  const dateObj = parseISODateTime(dateTime);
150
144
  const localDateTime = convertUTCToLocalDateTime(dateObj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.145.2",
3
+ "version": "2.146.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",