@brightspace-ui/core 2.19.0 → 2.21.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.
- package/components/calendar/calendar.js +1 -1
- package/components/inputs/input-date.js +1 -1
- package/components/inputs/input-number.js +1 -1
- package/components/inputs/input-time.js +1 -1
- package/components/link/link.js +5 -3
- package/components/switch/README.md +0 -2
- package/components/switch/demo/switch.html +0 -8
- package/components/switch/switch-mixin.js +1 -11
- package/custom-elements.json +0 -22
- package/mixins/focus-visible-polyfill-mixin.md +1 -1
- package/mixins/localize-mixin.js +3 -6
- package/package.json +1 -1
|
@@ -422,7 +422,7 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
422
422
|
|
|
423
423
|
this.addEventListener('blur', () => this._isInitialFocusDate = true);
|
|
424
424
|
|
|
425
|
-
this.addEventListener('d2l-localize-
|
|
425
|
+
this.addEventListener('d2l-localize-resources-change', () => {
|
|
426
426
|
calendarData = null;
|
|
427
427
|
getCalendarData(true);
|
|
428
428
|
this.requestUpdate();
|
|
@@ -200,7 +200,7 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
200
200
|
this._textInput = this.shadowRoot.querySelector('d2l-input-text');
|
|
201
201
|
|
|
202
202
|
this.addEventListener('blur', this._handleBlur);
|
|
203
|
-
this.addEventListener('d2l-localize-
|
|
203
|
+
this.addEventListener('d2l-localize-resources-change', () => {
|
|
204
204
|
this._dateTimeDescriptor = getDateTimeDescriptorShared(true);
|
|
205
205
|
this.requestUpdate();
|
|
206
206
|
this.updateComplete.then(() => {
|
|
@@ -308,7 +308,7 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
308
308
|
|
|
309
309
|
firstUpdated(changedProperties) {
|
|
310
310
|
super.firstUpdated(changedProperties);
|
|
311
|
-
this.addEventListener('d2l-localize-
|
|
311
|
+
this.addEventListener('d2l-localize-resources-change', () => {
|
|
312
312
|
this._descriptor = getNumberDescriptor();
|
|
313
313
|
if (this._formattedValue.length > 0) {
|
|
314
314
|
this._updateFormattedValue();
|
|
@@ -271,7 +271,7 @@ class InputTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
const hiddenContent = this.shadowRoot.querySelector('.d2l-input-time-hidden-content');
|
|
274
|
-
this.addEventListener('d2l-localize-
|
|
274
|
+
this.addEventListener('d2l-localize-resources-change', async() => {
|
|
275
275
|
await this.updateComplete;
|
|
276
276
|
this._formattedValue = formatTime(getDateFromISOTime(this.value));
|
|
277
277
|
INTERVALS.clear();
|
package/components/link/link.js
CHANGED
|
@@ -2,21 +2,23 @@ import '../colors/colors.js';
|
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
5
|
+
import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
|
|
5
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
7
|
|
|
7
8
|
export const linkStyles = css`
|
|
8
9
|
.d2l-link, .d2l-link:visited, .d2l-link:active, .d2l-link:link {
|
|
9
10
|
color: var(--d2l-color-celestine);
|
|
10
11
|
cursor: pointer;
|
|
12
|
+
outline-style: none;
|
|
11
13
|
text-decoration: none;
|
|
12
14
|
}
|
|
13
15
|
:host([skeleton]) .d2l-link.d2l-skeletize::before {
|
|
14
16
|
bottom: 0.2rem;
|
|
15
17
|
top: 0.2rem;
|
|
16
18
|
}
|
|
17
|
-
.d2l-link:hover,
|
|
19
|
+
.d2l-link:hover,
|
|
20
|
+
.d2l-link.focus-visible {
|
|
18
21
|
color: var(--d2l-color-celestine-minus-1);
|
|
19
|
-
outline-width: 0;
|
|
20
22
|
text-decoration: underline;
|
|
21
23
|
}
|
|
22
24
|
.d2l-link.d2l-link-main {
|
|
@@ -42,7 +44,7 @@ export const linkStyles = css`
|
|
|
42
44
|
* This component can be used just like the native anchor tag.
|
|
43
45
|
* @slot - The content (e.g., text) that when selected causes navigation
|
|
44
46
|
*/
|
|
45
|
-
class Link extends FocusMixin(LitElement) {
|
|
47
|
+
class Link extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
46
48
|
|
|
47
49
|
static get properties() {
|
|
48
50
|
return {
|
|
@@ -49,7 +49,6 @@ The `d2l-switch` element is a generic switch with on/off semantics.
|
|
|
49
49
|
| `disabled` | Boolean | Disables the switch |
|
|
50
50
|
| `on` | Boolean | Whether the switch is "on" or "off" |
|
|
51
51
|
| `text-position` | String | Valid values are: `start`, `end` (default), and `hidden` |
|
|
52
|
-
| `tooltip` | String | Text to display in a tooltip for the switch |
|
|
53
52
|
### Events
|
|
54
53
|
|
|
55
54
|
- `change`: dispatched when the `on` property is updated
|
|
@@ -88,7 +87,6 @@ The `d2l-switch-visibility` element is a variant of the generic switch configure
|
|
|
88
87
|
| `disabled` | Boolean | Disabled the switch |
|
|
89
88
|
| `on` | Boolean | Whether the switch is "on" or "off" |
|
|
90
89
|
| `text-position` | String | Valid values are: `start`, `end` (default), and `hidden` |
|
|
91
|
-
| `tooltip` | String | Text to display in a tooltip for the switch |
|
|
92
90
|
|
|
93
91
|
### Events
|
|
94
92
|
|
|
@@ -45,14 +45,6 @@
|
|
|
45
45
|
</template>
|
|
46
46
|
</d2l-demo-snippet>
|
|
47
47
|
|
|
48
|
-
<h2>On/Off (with tooltip)</h2>
|
|
49
|
-
|
|
50
|
-
<d2l-demo-snippet>
|
|
51
|
-
<template>
|
|
52
|
-
<d2l-switch text="Dark Mode" tooltip="Whether dark mode is turned on or off." on></d2l-switch>
|
|
53
|
-
</template>
|
|
54
|
-
</d2l-demo-snippet>
|
|
55
|
-
|
|
56
48
|
<h2>Visibility</h2>
|
|
57
49
|
|
|
58
50
|
<d2l-demo-snippet>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
|
-
import '../tooltip/tooltip.js';
|
|
3
2
|
import { css, html } from 'lit';
|
|
4
3
|
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
5
4
|
import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
|
|
@@ -31,12 +30,7 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
31
30
|
* @type {'start'|'end'|'hidden'}
|
|
32
31
|
* @default end
|
|
33
32
|
*/
|
|
34
|
-
textPosition: { type: String, attribute: 'text-position', reflect: true }
|
|
35
|
-
/**
|
|
36
|
-
* The text that is displayed in a tooltip when the switch is hovered over.
|
|
37
|
-
* @type {string}
|
|
38
|
-
*/
|
|
39
|
-
tooltip: { type: String, reflect: true }
|
|
33
|
+
textPosition: { type: String, attribute: 'text-position', reflect: true }
|
|
40
34
|
};
|
|
41
35
|
}
|
|
42
36
|
|
|
@@ -172,7 +166,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
172
166
|
this.labelHidden = false;
|
|
173
167
|
this.on = false;
|
|
174
168
|
this.textPosition = 'end';
|
|
175
|
-
this._switchId = getUniqueId();
|
|
176
169
|
this._textId = getUniqueId();
|
|
177
170
|
}
|
|
178
171
|
|
|
@@ -192,7 +185,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
192
185
|
const text = html`<span id="${this._textId}" class="d2l-switch-text">${this.text}</span>`;
|
|
193
186
|
const textPosition = (this.textPosition === 'start' || this.textPosition === 'hidden'
|
|
194
187
|
? this.textPosition : 'end');
|
|
195
|
-
const tooltip = (this.tooltip ? html`<d2l-tooltip for="${this._switchId}">${this.tooltip}</d2l-tooltip>` : '');
|
|
196
188
|
return html`
|
|
197
189
|
${textPosition === 'start' ? text : ''}
|
|
198
190
|
<div
|
|
@@ -201,7 +193,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
201
193
|
aria-labelledby="${ifDefined(textPosition !== 'hidden' ? this._textId : undefined)}"
|
|
202
194
|
class="d2l-switch-container"
|
|
203
195
|
@click="${this._handleClick}"
|
|
204
|
-
id="${this._switchId}"
|
|
205
196
|
@keydown="${this._handleKeyDown}"
|
|
206
197
|
@keyup="${this._handleKeyUp}"
|
|
207
198
|
role="switch"
|
|
@@ -212,7 +203,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
212
203
|
<div class="d2l-switch-icon-off">${this.offIcon}</div>
|
|
213
204
|
</div>
|
|
214
205
|
</div>
|
|
215
|
-
${tooltip}
|
|
216
206
|
${textPosition === 'end' ? text : ''}
|
|
217
207
|
`;
|
|
218
208
|
}
|
package/custom-elements.json
CHANGED
|
@@ -9358,11 +9358,6 @@
|
|
|
9358
9358
|
"type": "string",
|
|
9359
9359
|
"default": "\"\\\"Visibility\\\"\""
|
|
9360
9360
|
},
|
|
9361
|
-
{
|
|
9362
|
-
"name": "tooltip",
|
|
9363
|
-
"description": "The text that is displayed in a tooltip when the switch is hovered over.",
|
|
9364
|
-
"type": "string"
|
|
9365
|
-
},
|
|
9366
9361
|
{
|
|
9367
9362
|
"name": "disabled",
|
|
9368
9363
|
"description": "Disables the switch from being toggled.",
|
|
@@ -9398,12 +9393,6 @@
|
|
|
9398
9393
|
"type": "string",
|
|
9399
9394
|
"default": "\"\\\"Visibility\\\"\""
|
|
9400
9395
|
},
|
|
9401
|
-
{
|
|
9402
|
-
"name": "tooltip",
|
|
9403
|
-
"attribute": "tooltip",
|
|
9404
|
-
"description": "The text that is displayed in a tooltip when the switch is hovered over.",
|
|
9405
|
-
"type": "string"
|
|
9406
|
-
},
|
|
9407
9396
|
{
|
|
9408
9397
|
"name": "disabled",
|
|
9409
9398
|
"attribute": "disabled",
|
|
@@ -9448,11 +9437,6 @@
|
|
|
9448
9437
|
"description": "REQUIRED: The text that is displayed for the switch label.",
|
|
9449
9438
|
"type": "string"
|
|
9450
9439
|
},
|
|
9451
|
-
{
|
|
9452
|
-
"name": "tooltip",
|
|
9453
|
-
"description": "The text that is displayed in a tooltip when the switch is hovered over.",
|
|
9454
|
-
"type": "string"
|
|
9455
|
-
},
|
|
9456
9440
|
{
|
|
9457
9441
|
"name": "disabled",
|
|
9458
9442
|
"description": "Disables the switch from being toggled.",
|
|
@@ -9487,12 +9471,6 @@
|
|
|
9487
9471
|
"description": "REQUIRED: The text that is displayed for the switch label.",
|
|
9488
9472
|
"type": "string"
|
|
9489
9473
|
},
|
|
9490
|
-
{
|
|
9491
|
-
"name": "tooltip",
|
|
9492
|
-
"attribute": "tooltip",
|
|
9493
|
-
"description": "The text that is displayed in a tooltip when the switch is hovered over.",
|
|
9494
|
-
"type": "string"
|
|
9495
|
-
},
|
|
9496
9474
|
{
|
|
9497
9475
|
"name": "disabled",
|
|
9498
9476
|
"attribute": "disabled",
|
|
@@ -18,7 +18,7 @@ import { FocusVisiblePolyfillMixin } from '@brightspace-ui/core/mixins/focus-vis
|
|
|
18
18
|
class MyComponent extends FocusVisiblePolyfillMixin(LitElement) {
|
|
19
19
|
static get styles() {
|
|
20
20
|
return css`
|
|
21
|
-
/* styles to apply when clicked or focused with a
|
|
21
|
+
/* styles to apply when clicked or focused with a keyboard */
|
|
22
22
|
button:hover,
|
|
23
23
|
button:focus {
|
|
24
24
|
background-color: #cccccc;
|
package/mixins/localize-mixin.js
CHANGED
|
@@ -35,11 +35,10 @@ export const LocalizeMixin = dedupeMixin(superclass => class extends superclass
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
this.__resources = resources;
|
|
38
|
+
this._onResourcesChange();
|
|
38
39
|
if (first) {
|
|
39
40
|
resolve();
|
|
40
41
|
first = false;
|
|
41
|
-
} else {
|
|
42
|
-
this._languageChange();
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
};
|
|
@@ -183,11 +182,9 @@ export const LocalizeMixin = dedupeMixin(superclass => class extends superclass
|
|
|
183
182
|
return this.constructor['getLocalizeResources'] !== undefined;
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
|
|
185
|
+
_onResourcesChange() {
|
|
187
186
|
/** @ignore */
|
|
188
|
-
this.dispatchEvent(new CustomEvent(
|
|
189
|
-
'd2l-localize-behavior-language-changed', { bubbles: true, composed: true }
|
|
190
|
-
));
|
|
187
|
+
this.dispatchEvent(new CustomEvent('d2l-localize-resources-change'));
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.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",
|