@brightspace-ui/core 2.19.1 → 2.20.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.
|
@@ -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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.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",
|