@brightspace-ui/core 1.197.3 → 1.199.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.
@@ -117,6 +117,7 @@ If the dropdown is initially empty when it's opened, the dropdown pointer will n
117
117
  | `disabled` | Boolean, default: `false` | Disables the dropdown opener |
118
118
  | `no-auto-open` | Boolean, default: `false` | Prevents the dropdown from opening automatically on click or on key press |
119
119
  | `primary` | Boolean, default: `false` | Optionally render button as primary button |
120
+ | `open-on-hover` | Boolean, default: `false` | Optionally open dropdown on click or hover action |
120
121
  <!-- docs: end hidden content -->
121
122
 
122
123
  ## Opener: Button Subtle [d2l-dropdown-button-subtle]
@@ -160,6 +161,7 @@ If the dropdown is initially empty when it's opened, the dropdown pointer will n
160
161
  | `description` | String | A description to be added to the inner `button` opener for accessibility |
161
162
  | `disabled` | Boolean, default: `false` | Disables the dropdown opener |
162
163
  | `no-auto-open` | Boolean, default: `false` | Prevents the dropdown from automatically on click or on key press |
164
+ | `open-on-hover` | Boolean, default: `false` | Optionally open dropdown on click or hover action |
163
165
  <!-- docs: end hidden content -->
164
166
 
165
167
  ### Accessibility Properties
@@ -209,6 +211,7 @@ To make your `d2l-dropdown-button-subtle` accessible, use the following properti
209
211
  |---|---|---|
210
212
  | `disabled` | Boolean, default: `false` | Disables the dropdown opener |
211
213
  | `no-auto-open` | Boolean, default: `false` | Prevents the dropdown from opening automatically on click or on key press |
214
+ | `open-on-hover` | Boolean, default: `false` | Optionally open dropdown on click or hover action |
212
215
  | `text` | String | Used as `aria-label` for the button |
213
216
  | `translucent` | Boolean, default: `false` | Attribute for busy/rich backgrounds |
214
217
  | `visible-on-ancestor` | Boolean, default: `false` | See [visible-on-ancestor-mixin](../../mixins/visible-on-ancestor-mixin.md) for more details on configuring that behavior |
@@ -261,6 +264,7 @@ To make your usage of `d2l-dropdown-context-menu` accessible, use the following
261
264
  |---|---|---|
262
265
  | `disabled` | Boolean, default: `false` | Disables the dropdown opener |
263
266
  | `no-auto-open` | Boolean, default: `false` | Prevents the dropdown from opening automatically on click or key press |
267
+ | `open-on-hover` | Boolean, default: `false` | Optionally open dropdown on click or hover action |
264
268
  | `text` | String | Used as `aria-label` for the button |
265
269
  | `translucent` | Boolean, default: `false` | Attribute for busy/rich backgrounds |
266
270
  | `visible-on-ancestor` | Boolean, default: `false` | See [visible-on-ancestor-mixin](../../mixins/visible-on-ancestor-mixin.md) for more details on configuring that behavior |
@@ -65,6 +65,36 @@
65
65
  </template>
66
66
  </d2l-demo-snippet>
67
67
 
68
+ <h2>Dropdown Button Opener (open-on-hover Option)</h2>
69
+ <d2l-demo-snippet>
70
+ <template>
71
+ <d2l-dropdown-button text="Open!" open-on-hover>
72
+ <d2l-dropdown-content mobile-tray="right">
73
+ <div slot="header">
74
+ <h3>Scrolling is Fun</h3>
75
+ </div>
76
+ <a href="https://youtu.be/9ze87zQFSak">Google</a>
77
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
78
+ magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
79
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
80
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
81
+ anim id est laborum.Vestibulum vel sem non orci pretium fringilla sed eget augue. Vestibulum malesuada tortor
82
+ vitae odio elementum eleifend. Quisque ligula quam, ornare id malesuada ut, malesuada eleifend sem. Nulla porta
83
+ in arcu quis gravida. Duis ac sagittis felis, in condimentum libero. In dolor risus, semper vel iaculis vitae,
84
+ pellentesque efficitur lorem. Nunc a lacus malesuada, rhoncus risus aliquam, sodales nulla. Sed in varius elit.
85
+ Duis sagittis, turpis ut vehicula elementum, velit mi tincidunt turpis, sit amet sagittis quam urna ut justo.
86
+ Nunc interdum urna augue, ac pretium dui pulvinar eu. Proin vehicula placerat est, sed venenatis purus viverra
87
+ eget. Suspendisse imperdiet nulla eget velit sodales, sit amet tempus metus dignissim. Sed ac luctus leo, a
88
+ ornare nisl. Proin non sapien eu orci gravida aliquam. Praesent placerat auctor lacus sit amet faucibus.
89
+ Suspendisse sit amet dui sed turpis vestibulum dignissim.</p>
90
+ <div slot="footer">
91
+ <a href="http://www.desire2learn.com">D2L</a>
92
+ </div>
93
+ </d2l-dropdown-content>
94
+ </d2l-dropdown-button>
95
+ </template>
96
+ </d2l-demo-snippet>
97
+
68
98
  </d2l-demo-page>
69
99
 
70
100
  </body>
@@ -172,6 +172,19 @@ export const dropdownContentStyles = css`
172
172
  text-align: right;
173
173
  }
174
174
 
175
+ :host(.d2l-dropdown-content-fading) {
176
+ opacity: 0;
177
+ /* matches DropdownOpenerMixin _closeTimerStart function */
178
+ transition: opacity 0.4s ease-out 0.3s;
179
+ }
180
+
181
+ @media (prefers-reduced-motion: reduce) {
182
+ :host(.d2l-dropdown-content-fading) {
183
+ opacity: 1;
184
+ transition: none;
185
+ }
186
+ }
187
+
175
188
  @media (prefers-reduced-motion: reduce) {
176
189
  :host([opened]), :host([opened-above]) {
177
190
  animation: none !important;
@@ -1,3 +1,6 @@
1
+ import { getUniqueId } from '../../helpers/uniqueId.js';
2
+ import { isComposedAncestor } from '../../helpers/dom.js';
3
+
1
4
  export const DropdownOpenerMixin = superclass => class extends superclass {
2
5
 
3
6
  static get properties() {
@@ -27,6 +30,19 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
27
30
  reflect: true,
28
31
  attribute: 'no-auto-open'
29
32
  },
33
+
34
+ /**
35
+ * Optionally open dropdown on click or hover action
36
+ * @type {boolean}
37
+ */
38
+ openOnHover: {
39
+ type: Boolean,
40
+ attribute: 'open-on-hover'
41
+ },
42
+ _isHovering: { type: Boolean },
43
+ _isOpen: { type: Boolean },
44
+ _isOpenedViaClick: { type: Boolean },
45
+ _isFading: { type: Boolean }
30
46
  };
31
47
  }
32
48
 
@@ -34,36 +50,46 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
34
50
  super();
35
51
  this.dropdownOpener = true;
36
52
  this.noAutoOpen = false;
53
+ this.openOnHover = false;
37
54
  this.disabled = false;
38
55
 
39
- this.__onKeyPress = this.__onKeyPress.bind(this);
40
- this.__onMouseUp = this.__onMouseUp.bind(this);
56
+ // hover option
57
+ this._dismissTimerId = getUniqueId();
58
+ this._isOpen = false;
59
+ this._isOpenedViaClick = false;
60
+ this._isHovering = false;
61
+ this._isFading = false;
62
+
63
+ this._onOutsideClick = this._onOutsideClick.bind(this);
64
+ this._contentRendered = null;
65
+ this._openerRendered = null;
41
66
  }
42
67
 
43
68
  connectedCallback() {
44
69
  super.connectedCallback();
45
70
 
46
- requestAnimationFrame(() => {
47
- const opener = this.getOpenerElement();
48
- const content = this.__getContentElement();
49
- if (!opener) {
50
- return;
51
- }
52
- opener.setAttribute('aria-haspopup', 'true');
53
- opener.addEventListener('keypress', this.__onKeyPress);
54
- opener.addEventListener('mouseup', this.__onMouseUp);
55
- opener.setAttribute('aria-expanded', (content && content.opened || false).toString());
56
- });
71
+ // listeners
72
+ this.addEventListener('keypress', this.__onKeypress);
73
+ this.addEventListener('mouseup', this.__onMouseUp);
74
+ this.addEventListener('mouseenter', this.__onMouseEnter);
75
+ this.addEventListener('mouseleave', this.__onMouseLeave);
76
+
77
+ if (this.openOnHover) {
78
+ document.body.addEventListener('mouseup', this._onOutsideClick);
79
+ }
57
80
  }
58
81
 
59
82
  disconnectedCallback() {
60
83
  super.disconnectedCallback();
61
- const opener = this.getOpenerElement();
62
- if (!opener) {
63
- return;
84
+
85
+ this.removeEventListener('keypress', this.__onKeypress);
86
+ this.removeEventListener('mouseup', this.__onMouseUp);
87
+ this.removeEventListener('mouseenter', this.__onMouseEnter);
88
+ this.removeEventListener('mouseleave', this.__onMouseLeave);
89
+
90
+ if (this.openOnHover) {
91
+ document.body.removeEventListener('mouseup', this._onOutsideClick);
64
92
  }
65
- opener.removeEventListener('keypress', this.__onKeyPress);
66
- opener.removeEventListener('mouseup', this.__onMouseUp);
67
93
  }
68
94
 
69
95
  firstUpdated(changedProperties) {
@@ -71,6 +97,38 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
71
97
 
72
98
  this.addEventListener('d2l-dropdown-open', this.__onOpened);
73
99
  this.addEventListener('d2l-dropdown-close', this.__onClosed);
100
+
101
+ const opener = this.getOpenerElement();
102
+ const content = this.__getContentElement();
103
+ if (!opener) {
104
+ return;
105
+ }
106
+ opener.setAttribute('aria-haspopup', 'true');
107
+ opener.setAttribute('aria-expanded', (content && content.opened || false).toString());
108
+ }
109
+
110
+ updated(changedProperties) {
111
+ super.updated(changedProperties);
112
+ if (!this.openOnHover || !changedProperties.has('_isFading')) return;
113
+
114
+ if (this._isFading) {
115
+ this.__getContentElement()?.classList.add('d2l-dropdown-content-fading');
116
+ } else {
117
+ this.__getContentElement()?.classList.remove('d2l-dropdown-content-fading');
118
+ }
119
+ }
120
+
121
+ /* used by open-on-hover option */
122
+ async closeDropdown(fadeOut) {
123
+ this._isOpen = false;
124
+ this._isHovering = false;
125
+ this._isOpenedViaClick = false;
126
+ if (fadeOut) {
127
+ this._closeTimerStart();
128
+ return;
129
+ }
130
+ const dropdownContent = this.__getContentElement();
131
+ await dropdownContent.close();
74
132
  }
75
133
 
76
134
  focus() {
@@ -89,6 +147,15 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
89
147
  return this;
90
148
  }
91
149
 
150
+ /* used by open-on-hover option */
151
+ async openDropdown(applyFocus) {
152
+ this._isOpen = true;
153
+ const dropdownContent = this.__getContentElement();
154
+ if (!dropdownContent) return;
155
+ await dropdownContent.open(applyFocus);
156
+ await dropdownContent.updateComplete;
157
+ }
158
+
92
159
  toggleOpen(applyFocus) {
93
160
  if (this.disabled) {
94
161
  return;
@@ -99,6 +166,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
99
166
  return;
100
167
  }
101
168
  content.toggleOpen(applyFocus);
169
+ this._isOpen = !this._isOpen;
102
170
  }
103
171
 
104
172
  __getContentElement() {
@@ -113,17 +181,62 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
113
181
  }
114
182
  opener.setAttribute('aria-expanded', 'false');
115
183
  opener.removeAttribute('active');
184
+ this._isOpen = false;
185
+ this._isOpenedViaClick = false;
116
186
  }
117
187
 
118
- __onKeyPress(e) {
119
- if (e.keyCode !== 13 && e.keyCode !== 32) return;
120
- if (this.noAutoOpen) return;
121
- this.toggleOpen(true);
188
+ __onDropdownMouseUp() {
189
+ this._isOpen = true;
190
+ this._isFading = false;
191
+ this._isHovering = false;
192
+ this._isOpenedViaClick = true;
193
+ this._closeTimerStop();
122
194
  }
123
195
 
124
- __onMouseUp() {
125
- if (this.noAutoOpen) return;
126
- this.toggleOpen(false);
196
+ __onKeypress(e) {
197
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
198
+ if (e.keyCode !== 13 && e.keyCode !== 32) return;
199
+ if (this.noAutoOpen) return;
200
+ if (!this.openOnHover) {
201
+ this.toggleOpen(true);
202
+ } else {
203
+ this._closeTimerStop();
204
+ e.preventDefault();
205
+ this._isOpenedViaClick = true;
206
+ this.openDropdown(true);
207
+ }
208
+ }
209
+ }
210
+
211
+ async __onMouseEnter() {
212
+ if (!this.openOnHover) return;
213
+ // do not respond to hover events on mobile screens
214
+ const dropdownContent = this.__getContentElement();
215
+ if (dropdownContent._useMobileStyling) return;
216
+ clearTimeout(this._dismissTimerId);
217
+ if (!this._isOpen) await this.openDropdown(false);
218
+ this._closeTimerStop();
219
+ if (!this._isOpenedViaClick) this._isHovering = true;
220
+ }
221
+
222
+ async __onMouseLeave() {
223
+ if (!this.openOnHover) return;
224
+ // do not respond to hover events on mobile screens
225
+ const dropdownContent = this.__getContentElement();
226
+ if (dropdownContent._useMobileStyling) return;
227
+ this._isHovering = false;
228
+ if (this._isOpenedViaClick) return;
229
+ //Wait before closing so we don't lose hover when we jump from opener to card
230
+ clearTimeout(this._dismissTimerId);
231
+ await this.closeDropdown(true);
232
+ }
233
+
234
+ __onMouseUp(e) {
235
+ if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
236
+ this.__onOpenerMouseUp(e);
237
+ } else if (this.openOnHover && isComposedAncestor(this.__getContentElement(), e.srcElement)) {
238
+ this.__onDropdownMouseUp();
239
+ }
127
240
  }
128
241
 
129
242
  __onOpened() {
@@ -133,6 +246,53 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
133
246
  }
134
247
  opener.setAttribute('aria-expanded', 'true');
135
248
  opener.setAttribute('active', 'true');
249
+ this._isFading = false;
250
+ }
251
+
252
+ __onOpenerMouseUp(e) {
253
+ if (this.noAutoOpen) return;
254
+ if (this.openOnHover) {
255
+ // prevent propogation to window and triggering _onOutsideClick
256
+ e?.stopPropagation();
257
+ this._closeTimerStop();
258
+ if (this._isOpen && !this._isHovering) {
259
+ this.closeDropdown();
260
+ } else {
261
+ this._isOpenedViaClick = true;
262
+ this._isHovering = false;
263
+ this.openDropdown(true);
264
+ }
265
+ } else this.toggleOpen(false);
136
266
  }
137
267
 
268
+ /* used by open-on-hover option */
269
+ _closeTimerStart() {
270
+ if (this._isOpen) return;
271
+ clearTimeout(this._setTimeoutId);
272
+ this._isFading = true;
273
+ this._setTimeoutId = setTimeout(() => {
274
+ this.closeDropdown(false);
275
+ this._isFading = false;
276
+ // matches dropdownContentStyles CSS
277
+ }, 700);
278
+ }
279
+
280
+ /* used by open-on-hover option */
281
+ _closeTimerStop() {
282
+ clearTimeout(this._setTimeoutId);
283
+ this._isFading = false;
284
+ }
285
+
286
+ /* used by open-on-hover option */
287
+ _onOutsideClick(e) {
288
+ if (!this._isOpen) return;
289
+ const isWithinDropdown = isComposedAncestor(this.__getContentElement(), e.composedPath()[0]);
290
+ const isWithinOpener = isComposedAncestor(this.getOpenerElement(), e.composedPath()[0]);
291
+ const isBackdropClick = isWithinDropdown
292
+ && this.__getContentElement()._useMobileStyling
293
+ && e.composedPath().find(node => node.nodeName === 'D2L-BACKDROP');
294
+ if (!isWithinOpener && (!isWithinDropdown || isBackdropClick)) {
295
+ this.closeDropdown();
296
+ }
297
+ }
138
298
  };
@@ -14,7 +14,7 @@ size:xlarge
14
14
  </script>
15
15
  <script>
16
16
  window.addEventListener('load', function () {
17
- const demoElem = document.querySelector('#demo-element');
17
+ var demoElem = document.querySelector('#demo-element');
18
18
  if (!demoElem.hasAttribute('data-first-load')) return;
19
19
 
20
20
  setTimeout(function() {
@@ -63,7 +63,7 @@ size:xlarge
63
63
  <!-- docs: start hidden content -->
64
64
  <script>
65
65
  window.addEventListener('load', function () {
66
- const demoElem = document.querySelector('#demo-element');
66
+ var demoElem = document.querySelector('#demo-element');
67
67
  if (!demoElem.hasAttribute('data-first-load')) return;
68
68
 
69
69
  setTimeout(function() {
@@ -131,7 +131,7 @@ size:xlarge
131
131
  <!-- docs: start hidden content -->
132
132
  <script>
133
133
  window.addEventListener('load', function () {
134
- const demoElem = document.querySelector('#demo-element');
134
+ var demoElem = document.querySelector('#demo-element');
135
135
  if (!demoElem.hasAttribute('data-first-load')) return;
136
136
 
137
137
  setTimeout(function() {
@@ -205,7 +205,7 @@ size:large
205
205
  <!-- docs: start hidden content -->
206
206
  <script>
207
207
  window.addEventListener('load', function () {
208
- const demoElem = document.querySelector('#demo-element');
208
+ var demoElem = document.querySelector('#demo-element');
209
209
  if (!demoElem.hasAttribute('data-first-load')) return;
210
210
 
211
211
  setTimeout(function() {
@@ -273,7 +273,7 @@ size:large
273
273
  <!-- docs: start hidden content -->
274
274
  <script>
275
275
  window.addEventListener('load', function () {
276
- const demoElem = document.querySelector('#demo-element');
276
+ var demoElem = document.querySelector('#demo-element');
277
277
  if (!demoElem.hasAttribute('data-first-load')) return;
278
278
 
279
279
  setTimeout(function() {
@@ -343,7 +343,7 @@ size:xlarge
343
343
  <!-- docs: start hidden content -->
344
344
  <script>
345
345
  window.addEventListener('load', function () {
346
- const demoElem = document.querySelector('#demo-element');
346
+ var demoElem = document.querySelector('#demo-element');
347
347
  if (!demoElem.hasAttribute('data-first-load')) return;
348
348
 
349
349
  setTimeout(function() {
@@ -412,7 +412,7 @@ size:xlarge
412
412
  <!-- docs: start hidden content -->
413
413
  <script>
414
414
  window.addEventListener('load', function () {
415
- const demoElem = document.querySelector('#demo-element');
415
+ var demoElem = document.querySelector('#demo-element');
416
416
  if (!demoElem.hasAttribute('data-first-load')) return;
417
417
 
418
418
  setTimeout(function() {
@@ -2,50 +2,84 @@
2
2
 
3
3
  The selection components (`d2l-selection-action`, `d2l-selection-input`, `d2l-selection-select-all`, `d2l-selection-summary`, `d2l-selection-action`) are low-level components that provide the ability to create selection interfaces with select-all and bulk-action behaviours.
4
4
 
5
+ <!-- docs: start hidden content -->
5
6
  ![Selection](./screenshots/selection-multiple.png?raw=true)
6
7
 
7
8
  ![Selection](./screenshots/selection-single.png?raw=true)
9
+ <!-- docs: end hidden content -->
8
10
 
9
11
  ## SelectionMixin
10
12
 
11
- The selection components above work with a component that extends the `SelectionMixin`, which acts like a controller for the checkboxes, radios, actions, etc. The `d2l-selection-input` component must be placed _within_ the component that extends the `SelectionMixin`. The other selection components may also be placed inside the `SelectionMixin` component, or in the same DOM scope with the `selection-for` attribute set to the id of that component.
12
-
13
- The `d2l-list` already extends `SelectionMixin` and should always be used for lists, however a custom selection control can be easily defined to enable the use of these selection controls in different semantic contexts or radically different layouts. The `SelectionMixin` defines the `selection-single` attribute that consumers can specify for single selection behaviour.
14
-
15
- ```javascript
16
- import { html, LitElement } from 'lit-element/lit-element.js';
17
- import { SelectionMixin } from '@brightspace-ui/core/components/selection-mixin.js';
18
-
19
- class CustomSelection extends SelectionMixin(LitElement) {
20
- render() {
21
- return html`
22
- <slot></slot>
23
- `;
24
- }
25
- }
26
- customElements.define('d2l-custom-selection', CustomSelection);
27
- ```
28
-
29
- **Properties:**
30
-
31
- | Property | Type | Description |
32
- |--|--|--|
33
- | `selection-single` | Boolean | Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item. |
34
-
35
- The selection components can then be used within the custom selection component as shown below.
13
+ The selection components below work with a component that extends the `SelectionMixin`, which acts like a controller for the checkboxes, radios, actions, etc. The `d2l-selection-input` component must be placed _within_ the component that extends the `SelectionMixin`. The other selection components may also be placed inside the `SelectionMixin` component, or in the same DOM scope with the `selection-for` attribute set to the id of that component.
36
14
 
15
+ <!-- docs: demo live name:d2l-demo-selection display:block -->
37
16
  ```html
17
+ <script type="module">
18
+ import { css, html, LitElement } from 'lit-element/lit-element.js';
19
+ import { SelectionMixin } from '@brightspace-ui/core/components/selection/selection-mixin.js';
20
+
21
+ class CustomSelection extends SelectionMixin(LitElement) {
22
+ static get styles() {
23
+ return css`
24
+ :host {
25
+ display: block;
26
+ }
27
+ `;
28
+ }
29
+ render() {
30
+ return html`
31
+ <slot></slot>
32
+ `;
33
+ }
34
+ }
35
+ customElements.define('d2l-demo-selection', CustomSelection);
36
+ </script>
38
37
  <script type="module">
39
38
  import '@brightspace-ui/core/components/selection/selection-action.js';
40
39
  import '@brightspace-ui/core/components/selection/selection-input.js';
41
40
  import '@brightspace-ui/core/components/selection/selection-select-all.js';
42
41
  import '@brightspace-ui/core/components/selection/selection-summary.js';
43
42
  </script>
44
- <d2l-custom-selection>
45
- <div>
46
- <d2l-selection-select-all></d2l-selection-select-all>
47
- <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
48
- <d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
43
+ <!-- docs: start hidden content -->
44
+ <script type="module">
45
+ import '@brightspace-ui/core/components/selection/demo/demo-selection.js';
46
+ </script>
47
+ <style>
48
+ ul {
49
+ padding: 0;
50
+ }
51
+ li {
52
+ list-style-type: none;
53
+ }
54
+ li, .d2l-selection-header, .d2l-selection-header-wrapper {
55
+ align-items: center;
56
+ display: flex;
57
+ }
58
+ d2l-selection-input {
59
+ margin-right: 10px;
60
+ }
61
+ [dir="rtl"] d2l-selection-input {
62
+ margin-left: 10px;
63
+ margin-right: 0;
64
+ }
65
+ .d2l-selection-header-wrapper {
66
+ flex-wrap: wrap;
67
+ }
68
+ .d2l-selection-header {
69
+ flex: auto;
70
+ }
71
+ d2l-selection-summary {
72
+ flex: none;
73
+ }
74
+ </style>
75
+ <!-- docs: end hidden content -->
76
+ <d2l-demo-selection>
77
+ <div class="d2l-selection-header-wrapper">
78
+ <div class="d2l-selection-header">
79
+ <d2l-selection-select-all></d2l-selection-select-all>
80
+ <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
81
+ <d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
82
+ </div>
49
83
  <d2l-selection-summary></d2l-selection-summary>
50
84
  </div>
51
85
  <ul>
@@ -53,21 +87,26 @@ The selection components can then be used within the custom selection component
53
87
  <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>Science</li>
54
88
  <li><d2l-selection-input key="mth" label="Math"></d2l-selection-input>Math</li>
55
89
  </ul>
56
- </d2l-custom-selection>
90
+ </d2l-demo-selection>
57
91
  ```
58
92
 
59
- Or, the non-`d2l-selection-input` components can be used outside the custom selection component as long as they are in the same DOM scope:
93
+ The `d2l-list` already extends `SelectionMixin` and should always be used for lists, however a custom selection control can be easily defined to enable the use of these selection controls in different semantic contexts or radically different layouts. The `SelectionMixin` defines the `selection-single` attribute that consumers can specify for single selection behaviour.
94
+
95
+ <!-- docs: start hidden content -->
96
+ ### Properties
97
+
98
+ | Property | Type | Description |
99
+ |---|---|---|
100
+ | `selection-single` | Boolean | Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item. |
101
+ <!-- docs: end hidden content -->
102
+
103
+ ### Usage
104
+
105
+ The selection components can then be used within the custom selection component as shown above, or the non-`d2l-selection-input` components can be used outside the custom selection component as long as they are in the same DOM scope:
60
106
 
61
107
  ```html
62
- <script type="module">
63
- import '@brightspace-ui/core/components/selection/selection-action.js';
64
- import '@brightspace-ui/core/components/selection/selection-input.js';
65
- import '@brightspace-ui/core/components/selection/selection-select-all.js';
66
- import '@brightspace-ui/core/components/selection/selection-summary.js';
67
- </script>
68
108
  <div>
69
109
  <d2l-selection-select-all selection-for="custom"></d2l-selection-select-all>
70
- <d2l-selection-action selection-for="custom" text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
71
110
  <d2l-selection-action selection-for="custom" text="Settings" icon="tier1:gear"></d2l-selection-action>
72
111
  <d2l-selection-summary selection-for="custom"></d2l-selection-summary>
73
112
  </div>
@@ -75,73 +114,216 @@ Or, the non-`d2l-selection-input` components can be used outside the custom sele
75
114
  <ul>
76
115
  <li><d2l-selection-input key="geo" label="Geography" selected></d2l-selection-input>Geography</li>
77
116
  <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>Science</li>
78
- <li><d2l-selection-input key="mth" label="Math"></d2l-selection-input>Math</li>
79
117
  </ul>
80
118
  </d2l-custom-selection>
81
119
  ```
82
120
 
83
- ## d2l-selection-action
121
+ ## Selection Action [d2l-selection-action]
84
122
 
85
123
  The `d2l-selection-action` is an optional component that provides a button for actions associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the button should be non-interactive if nothing is selected.
86
124
 
87
- **Properties:**
125
+ <!-- docs: demo live name:d2l-selection-action -->
126
+ ```html
127
+ <script type="module">
128
+ import '@brightspace-ui/core/components/selection/selection-action.js';
129
+ </script>
130
+ <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow"></d2l-selection-action>
131
+ ```
132
+
133
+ <!-- docs: start hidden content -->
134
+ ### Properties
88
135
 
89
136
  | Property | Type | Description |
90
- |--|--|--|
137
+ |---|---|---|
91
138
  | `icon` | String | Preset icon key (e.g. "tier1:gear"). |
92
139
  | `requires-selection` | Boolean | Whether the action requires one or more selected items. If no items are selected, the action button will be focusable and a hint displayed in a tooltip. |
93
140
  | `selection-for` | String | Id of the corresponding `SelectionMixin` component, if not placed within it. |
94
141
  | `text` | String, required | Text to be shown for the action. |
95
142
 
96
- **Events:**
143
+ ### Events
97
144
 
98
145
  | Event | Description |
99
- |--|--|
146
+ |---|---|
100
147
  | `d2l-selection-action-click` | Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected. |
148
+ <!-- docs: end hidden content -->
101
149
 
102
- ## d2l-selection-input
150
+ ## Selection Input [d2l-selection-input]
103
151
 
104
152
  The `d2l-selection-input` is a required component in selection controls - without it, there wouldn't be anything for the user to select! Note: `d2l-list-item` already provides a selection input for selectable list items. If `d2l-selection-input` is placed within a selection control that specifies `selection-single`, then radios will be rendered instead of checkboxes.
105
153
 
106
- **Properties:**
154
+ <!-- docs: demo live name:d2l-selection-input display:block -->
155
+ ```html
156
+ <script type="module">
157
+ import '@brightspace-ui/core/components/selection/selection-input.js';
158
+ import '@brightspace-ui/core/components/selection/demo/demo-selection.js';
159
+ </script>
160
+ <!-- docs: start hidden content -->
161
+ <style>
162
+ ul {
163
+ padding: 0;
164
+ }
165
+ li {
166
+ list-style-type: none;
167
+ align-items: center;
168
+ display: flex;
169
+ }
170
+ d2l-selection-input {
171
+ margin-right: 10px;
172
+ }
173
+ </style>
174
+ <!-- docs: end hidden content -->
175
+ <d2l-demo-selection>
176
+ <ul>
177
+ <li><d2l-selection-input key="geo" label="Geography" selected></d2l-selection-input>Geography</li>
178
+ <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>Science</li>
179
+ </ul>
180
+ </d2l-demo-selection>
181
+ ```
182
+
183
+ <!-- docs: start hidden content -->
184
+ ### Properties
107
185
 
108
186
  | Property | Type | Description |
109
- |--|--|--|
110
- | `key` | String, required | Key to identify the the selectable. |
187
+ |---|---|---|
188
+ | `key` | String, required | Key to identify the selectable. |
111
189
  | `label` | String | Accessible hidden label for the input. |
112
190
  | `labelled-by` | String | Id reference to the accessible label for the input. **Note:** if specified, it must reference an element in the same DOM context. |
113
191
  | `selected` | Boolean | State of the input. |
114
192
 
115
- **Accessibility:** either `label` or `labelled-by` is required.
116
-
117
- **Events:**
193
+ ### Events
118
194
 
119
195
  | Event | Description |
120
- |--|--|
196
+ |---|---|
121
197
  | `d2l-selection-change` | Dispatched when the state of the input changes. |
198
+ <!-- docs: end hidden content -->
122
199
 
123
- ## d2l-selection-select-all
200
+ ### Accessibility Properties
201
+
202
+ Either `label` or `labelled-by` is **required**.
203
+
204
+ ## Select All [d2l-selection-select-all]
124
205
 
125
206
  The `d2l-selection-select-all` is an optional component that provides a checkbox for bulk selecting the selectable elements within the selection control. Its state will also be automatically updated when the state of the selectable elements change.
126
207
 
127
- **Properties:**
208
+ In the example below, setting `selection-for` to `other-list` demonstrates the ability to use `d2l-selection-select-all` for `d2l-select-input` outside of the custom selection element.
209
+
210
+ <!-- docs: demo live name:d2l-selection-select-all display:block -->
211
+ ```html
212
+ <script type="module">
213
+ import '@brightspace-ui/core/components/selection/selection-action.js';
214
+ import '@brightspace-ui/core/components/selection/selection-input.js';
215
+ import '@brightspace-ui/core/components/selection/selection-select-all.js';
216
+ import '@brightspace-ui/core/components/selection/demo/demo-selection.js';
217
+ </script>
218
+ <!-- docs: start hidden content -->
219
+ <style>
220
+ ul {
221
+ margin: 0;
222
+ padding: 0;
223
+ }
224
+ li {
225
+ align-items: center;
226
+ display: flex;
227
+ list-style-type: none;
228
+ }
229
+ div {
230
+ align-items: center;
231
+ display: flex;
232
+ }
233
+ d2l-selection-input {
234
+ margin-right: 10px;
235
+ }
236
+ #other-list {
237
+ padding-top: 1rem;
238
+ }
239
+ </style>
240
+ <!-- docs: end hidden content -->
241
+ <d2l-demo-selection>
242
+ <div>
243
+ <d2l-selection-select-all></d2l-selection-select-all>
244
+ <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
245
+ </div>
246
+ <ul>
247
+ <li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>List 1 item 1</li>
248
+ <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>List 1 item 2</li>
249
+ </ul>
250
+ </d2l-demo-selection>
251
+ <d2l-demo-selection id="other-list">
252
+ <ul>
253
+ <li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>List 2 item 1</li>
254
+ <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>List 2 item 2</li>
255
+ </ul>
256
+ </d2l-demo-selection>
257
+ ```
258
+
259
+ <!-- docs: start hidden content -->
260
+ ### Properties
128
261
 
129
262
  | Property | Type | Description |
130
- |--|--|--|
263
+ |---|---|---|
131
264
  | `disabled` | Boolean | Disables the select all checkbox |
132
265
  | `selection-for` | String | Id of the corresponding `SelectionMixin` component, if not placed within it. |
266
+ <!-- docs: end hidden content -->
133
267
 
134
- ## d2l-selection-summary
268
+ ## Selection Summary [d2l-selection-summary]
135
269
 
136
270
  The `d2l-selection-summary` is an optional component that shows a simple count of the selected items within the selection control.
137
271
 
138
- **Properties:**
272
+ In the example below, setting `selection-for` to `other-list` demonstrates the ability to use `d2l-selection-summary` for `d2l-select-input` outside of the custom selection element.
273
+
274
+ <!-- docs: demo live name:d2l-selection-summary display:block -->
275
+ ```html
276
+ <script type="module">
277
+ import '@brightspace-ui/core/components/selection/selection-input.js';
278
+ import '@brightspace-ui/core/components/selection/selection-summary.js';
279
+ import '@brightspace-ui/core/components/selection/demo/demo-selection.js';
280
+ </script>
281
+ <!-- docs: start hidden content -->
282
+ <style>
283
+ ul {
284
+ margin: 0;
285
+ padding: 0;
286
+ }
287
+ li {
288
+ align-items: center;
289
+ display: flex;
290
+ list-style-type: none;
291
+ }
292
+ div {
293
+ align-items: center;
294
+ display: flex;
295
+ }
296
+ d2l-selection-input {
297
+ margin-right: 10px;
298
+ }
299
+ #other-list {
300
+ padding-top: 1rem;
301
+ }
302
+ </style>
303
+ <!-- docs: end hidden content -->
304
+ <d2l-demo-selection>
305
+ <div>
306
+ <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
307
+ <d2l-selection-summary></d2l-selection-summary>
308
+ </div>
309
+ <ul>
310
+ <li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>List 1 item 1</li>
311
+ <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>List 1 item 2</li>
312
+ </ul>
313
+ </d2l-demo-selection>
314
+ <d2l-demo-selection id="other-list">
315
+ <ul>
316
+ <li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>List 2 item 1</li>
317
+ <li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>List 2 item 2</li>
318
+ </ul>
319
+ </d2l-demo-selection>
320
+ ```
321
+
322
+ <!-- docs: start hidden content -->
323
+ ### Properties
139
324
 
140
325
  | Property | Type | Description |
141
- |--|--|--|
326
+ |---|---|---|
142
327
  | `no-selection-text` | String | Text to display if no items are selected. By default, the "0 selected" message is displayed. |
143
328
  | `selection-for` | String | Id of the corresponding `SelectionMixin` component, if not placed within it. |
144
-
145
- ## Future Enhancements
146
-
147
- Looking for an enhancement not listed here? Create a GitHub issue!
329
+ <!-- docs: end hidden content -->
@@ -0,0 +1,18 @@
1
+ import { css, html, LitElement } from 'lit-element/lit-element.js';
2
+ import { SelectionMixin } from '../selection-mixin.js';
3
+
4
+ class DemoSelection extends SelectionMixin(LitElement) {
5
+ static get styles() {
6
+ return css`
7
+ :host {
8
+ display: block;
9
+ }
10
+ `;
11
+ }
12
+ render() {
13
+ return html`
14
+ <slot></slot>
15
+ `;
16
+ }
17
+ }
18
+ customElements.define('d2l-demo-selection', DemoSelection);
@@ -10,25 +10,7 @@
10
10
  import '../selection-input.js';
11
11
  import '../selection-select-all.js';
12
12
  import '../selection-summary.js';
13
- import { css, html, LitElement } from 'lit-element/lit-element.js';
14
- import { SelectionMixin } from '../selection-mixin.js';
15
-
16
- class DemoSelection extends SelectionMixin(LitElement) {
17
- static get styles() {
18
- return css`
19
- :host {
20
- display: block;
21
- }
22
- `;
23
- }
24
- render() {
25
- return html`
26
- <slot></slot>
27
- `;
28
- }
29
- }
30
- customElements.define('d2l-demo-selection', DemoSelection);
31
-
13
+ import './demo-selection.js';
32
14
  </script>
33
15
  <style>
34
16
  ul {
@@ -131,7 +113,7 @@
131
113
  </div>
132
114
 
133
115
  <div class="d2l-selection-collection">
134
- Pick Your Bread
116
+ Pick Your Bread
135
117
  <div class="d2l-selection-header">
136
118
  <d2l-selection-select-all selection-for="collection-2"></d2l-selection-select-all>
137
119
  <d2l-selection-action selection-for="collection-2" text="Add Note" icon="tier1:add-message"></d2l-selection-action>
@@ -11,7 +11,7 @@ import { SelectionObserverMixin } from './selection-observer-mixin.js';
11
11
 
12
12
  /**
13
13
  * An action associated with a selection component.
14
- * @fires d2l-selection-action-click - Dispatched when the user clicks the action; provides the selection info
14
+ * @fires d2l-selection-action-click - Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected.
15
15
  * @fires d2l-selection-observer-subscribe - Internal event
16
16
  */
17
17
  class Action extends LocalizeCoreElement(SelectionObserverMixin(ButtonMixin(RtlMixin(LitElement)))) {
@@ -19,7 +19,7 @@ class Action extends LocalizeCoreElement(SelectionObserverMixin(ButtonMixin(RtlM
19
19
  static get properties() {
20
20
  return {
21
21
  /**
22
- * Preset icon key (e.g. "tier1:gear")
22
+ * Preset icon key (e.g. `tier1:gear`)
23
23
  * @type {string}
24
24
  */
25
25
  icon: { type: String, reflect: true },
@@ -31,11 +31,12 @@ class Input extends SkeletonMixin(LabelledMixin(LitElement)) {
31
31
  disabled: { type: Boolean },
32
32
  /**
33
33
  * Private. Force hovering state of input
34
+ * @ignore
34
35
  * @type {boolean}
35
36
  */
36
37
  hovering: { type: Boolean },
37
38
  /**
38
- * Key for the selectable
39
+ * REQUIRED: Key for the selectable
39
40
  * @type {string}
40
41
  */
41
42
  key: { type: String },
@@ -39,7 +39,7 @@ export const SelectionMixin = superclass => class extends RtlMixin(superclass) {
39
39
  static get properties() {
40
40
  return {
41
41
  /**
42
- * Whether the selection control is limited to single selection
42
+ * Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.
43
43
  * @type {boolean}
44
44
  */
45
45
  selectionSingle: { type: Boolean, attribute: 'selection-single' }
@@ -6,12 +6,13 @@ export const SelectionObserverMixin = superclass => class extends superclass {
6
6
  static get properties() {
7
7
  return {
8
8
  /**
9
- * Id of the SelectionMixin component this component wants to observe (if not located within that component)
9
+ * Id of the `SelectionMixin` component this component wants to observe (if not located within that component)
10
10
  * @type {string}
11
11
  */
12
12
  selectionFor: { type: String, reflect: true, attribute: 'selection-for' },
13
13
  /**
14
14
  * The selection info (set by the selection component)
15
+ * @ignore
15
16
  * @type {object}
16
17
  */
17
18
  selectionInfo: { type: Object },
@@ -1686,6 +1686,12 @@
1686
1686
  "type": "boolean",
1687
1687
  "default": "false"
1688
1688
  },
1689
+ {
1690
+ "name": "open-on-hover",
1691
+ "description": "Optionally open dropdown on click or hover action",
1692
+ "type": "boolean",
1693
+ "default": "false"
1694
+ },
1689
1695
  {
1690
1696
  "name": "disabled",
1691
1697
  "description": "Disables the dropdown opener",
@@ -1718,6 +1724,13 @@
1718
1724
  "type": "boolean",
1719
1725
  "default": "false"
1720
1726
  },
1727
+ {
1728
+ "name": "openOnHover",
1729
+ "attribute": "open-on-hover",
1730
+ "description": "Optionally open dropdown on click or hover action",
1731
+ "type": "boolean",
1732
+ "default": "false"
1733
+ },
1721
1734
  {
1722
1735
  "name": "disabled",
1723
1736
  "attribute": "disabled",
@@ -1755,6 +1768,12 @@
1755
1768
  "type": "boolean",
1756
1769
  "default": "false"
1757
1770
  },
1771
+ {
1772
+ "name": "open-on-hover",
1773
+ "description": "Optionally open dropdown on click or hover action",
1774
+ "type": "boolean",
1775
+ "default": "false"
1776
+ },
1758
1777
  {
1759
1778
  "name": "disabled",
1760
1779
  "description": "Disables the dropdown opener",
@@ -1788,6 +1807,13 @@
1788
1807
  "type": "boolean",
1789
1808
  "default": "false"
1790
1809
  },
1810
+ {
1811
+ "name": "openOnHover",
1812
+ "attribute": "open-on-hover",
1813
+ "description": "Optionally open dropdown on click or hover action",
1814
+ "type": "boolean",
1815
+ "default": "false"
1816
+ },
1791
1817
  {
1792
1818
  "name": "disabled",
1793
1819
  "attribute": "disabled",
@@ -2087,6 +2113,12 @@
2087
2113
  "type": "boolean",
2088
2114
  "default": "false"
2089
2115
  },
2116
+ {
2117
+ "name": "open-on-hover",
2118
+ "description": "Optionally open dropdown on click or hover action",
2119
+ "type": "boolean",
2120
+ "default": "false"
2121
+ },
2090
2122
  {
2091
2123
  "name": "disabled",
2092
2124
  "description": "Disables the dropdown opener",
@@ -2120,6 +2152,13 @@
2120
2152
  "type": "boolean",
2121
2153
  "default": "false"
2122
2154
  },
2155
+ {
2156
+ "name": "openOnHover",
2157
+ "attribute": "open-on-hover",
2158
+ "description": "Optionally open dropdown on click or hover action",
2159
+ "type": "boolean",
2160
+ "default": "false"
2161
+ },
2123
2162
  {
2124
2163
  "name": "disabled",
2125
2164
  "attribute": "disabled",
@@ -2424,6 +2463,12 @@
2424
2463
  "type": "boolean",
2425
2464
  "default": "false"
2426
2465
  },
2466
+ {
2467
+ "name": "open-on-hover",
2468
+ "description": "Optionally open dropdown on click or hover action",
2469
+ "type": "boolean",
2470
+ "default": "false"
2471
+ },
2427
2472
  {
2428
2473
  "name": "disabled",
2429
2474
  "description": "Disables the dropdown opener",
@@ -2457,6 +2502,13 @@
2457
2502
  "type": "boolean",
2458
2503
  "default": "false"
2459
2504
  },
2505
+ {
2506
+ "name": "openOnHover",
2507
+ "attribute": "open-on-hover",
2508
+ "description": "Optionally open dropdown on click or hover action",
2509
+ "type": "boolean",
2510
+ "default": "false"
2511
+ },
2460
2512
  {
2461
2513
  "name": "disabled",
2462
2514
  "attribute": "disabled",
@@ -2750,6 +2802,12 @@
2750
2802
  "type": "boolean",
2751
2803
  "default": "false"
2752
2804
  },
2805
+ {
2806
+ "name": "open-on-hover",
2807
+ "description": "Optionally open dropdown on click or hover action",
2808
+ "type": "boolean",
2809
+ "default": "false"
2810
+ },
2753
2811
  {
2754
2812
  "name": "disabled",
2755
2813
  "description": "Disables the dropdown opener",
@@ -2770,6 +2828,13 @@
2770
2828
  "type": "boolean",
2771
2829
  "default": "false"
2772
2830
  },
2831
+ {
2832
+ "name": "openOnHover",
2833
+ "attribute": "open-on-hover",
2834
+ "description": "Optionally open dropdown on click or hover action",
2835
+ "type": "boolean",
2836
+ "default": "false"
2837
+ },
2773
2838
  {
2774
2839
  "name": "disabled",
2775
2840
  "attribute": "disabled",
@@ -6889,7 +6954,7 @@
6889
6954
  },
6890
6955
  {
6891
6956
  "name": "selection-single",
6892
- "description": "Whether the selection control is limited to single selection",
6957
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
6893
6958
  "type": "boolean",
6894
6959
  "default": "false"
6895
6960
  }
@@ -6919,7 +6984,7 @@
6919
6984
  {
6920
6985
  "name": "selectionSingle",
6921
6986
  "attribute": "selection-single",
6922
- "description": "Whether the selection control is limited to single selection",
6987
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
6923
6988
  "type": "boolean",
6924
6989
  "default": "false"
6925
6990
  }
@@ -7901,6 +7966,27 @@
7901
7966
  }
7902
7967
  ]
7903
7968
  },
7969
+ {
7970
+ "name": "d2l-demo-selection",
7971
+ "path": "./components/selection/demo/demo-selection.js",
7972
+ "attributes": [
7973
+ {
7974
+ "name": "selection-single",
7975
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
7976
+ "type": "boolean",
7977
+ "default": "false"
7978
+ }
7979
+ ],
7980
+ "properties": [
7981
+ {
7982
+ "name": "selectionSingle",
7983
+ "attribute": "selection-single",
7984
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
7985
+ "type": "boolean",
7986
+ "default": "false"
7987
+ }
7988
+ ]
7989
+ },
7904
7990
  {
7905
7991
  "name": "d2l-selection-action",
7906
7992
  "path": "./components/selection/selection-action.js",
@@ -7908,7 +7994,7 @@
7908
7994
  "attributes": [
7909
7995
  {
7910
7996
  "name": "icon",
7911
- "description": "Preset icon key (e.g. \"tier1:gear\")",
7997
+ "description": "Preset icon key (e.g. `tier1:gear`)",
7912
7998
  "type": "string"
7913
7999
  },
7914
8000
  {
@@ -7923,14 +8009,9 @@
7923
8009
  },
7924
8010
  {
7925
8011
  "name": "selection-for",
7926
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8012
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
7927
8013
  "type": "string"
7928
8014
  },
7929
- {
7930
- "name": "selectionInfo",
7931
- "description": "The selection info (set by the selection component)",
7932
- "type": "object"
7933
- },
7934
8015
  {
7935
8016
  "name": "disabled-tooltip",
7936
8017
  "description": "Tooltip text when disabled",
@@ -7947,7 +8028,7 @@
7947
8028
  {
7948
8029
  "name": "icon",
7949
8030
  "attribute": "icon",
7950
- "description": "Preset icon key (e.g. \"tier1:gear\")",
8031
+ "description": "Preset icon key (e.g. `tier1:gear`)",
7951
8032
  "type": "string"
7952
8033
  },
7953
8034
  {
@@ -7965,14 +8046,11 @@
7965
8046
  {
7966
8047
  "name": "selectionFor",
7967
8048
  "attribute": "selection-for",
7968
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8049
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
7969
8050
  "type": "string"
7970
8051
  },
7971
8052
  {
7972
- "name": "selectionInfo",
7973
- "attribute": "selectionInfo",
7974
- "description": "The selection info (set by the selection component)",
7975
- "type": "object"
8053
+ "name": "selectionInfo"
7976
8054
  },
7977
8055
  {
7978
8056
  "name": "disabledTooltip",
@@ -7991,7 +8069,7 @@
7991
8069
  "events": [
7992
8070
  {
7993
8071
  "name": "d2l-selection-action-click",
7994
- "description": "Dispatched when the user clicks the action; provides the selection info"
8072
+ "description": "Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected."
7995
8073
  },
7996
8074
  {
7997
8075
  "name": "d2l-selection-observer-subscribe",
@@ -8009,14 +8087,9 @@
8009
8087
  "description": "Disables the input",
8010
8088
  "type": "boolean"
8011
8089
  },
8012
- {
8013
- "name": "hovering",
8014
- "description": "Private. Force hovering state of input",
8015
- "type": "boolean"
8016
- },
8017
8090
  {
8018
8091
  "name": "key",
8019
- "description": "Key for the selectable",
8092
+ "description": "REQUIRED: Key for the selectable",
8020
8093
  "type": "string"
8021
8094
  },
8022
8095
  {
@@ -8049,16 +8122,10 @@
8049
8122
  "description": "Disables the input",
8050
8123
  "type": "boolean"
8051
8124
  },
8052
- {
8053
- "name": "hovering",
8054
- "attribute": "hovering",
8055
- "description": "Private. Force hovering state of input",
8056
- "type": "boolean"
8057
- },
8058
8125
  {
8059
8126
  "name": "key",
8060
8127
  "attribute": "key",
8061
- "description": "Key for the selectable",
8128
+ "description": "REQUIRED: Key for the selectable",
8062
8129
  "type": "string"
8063
8130
  },
8064
8131
  {
@@ -8117,13 +8184,8 @@
8117
8184
  },
8118
8185
  {
8119
8186
  "name": "selection-for",
8120
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8187
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8121
8188
  "type": "string"
8122
- },
8123
- {
8124
- "name": "selectionInfo",
8125
- "description": "The selection info (set by the selection component)",
8126
- "type": "object"
8127
8189
  }
8128
8190
  ],
8129
8191
  "properties": [
@@ -8137,14 +8199,11 @@
8137
8199
  {
8138
8200
  "name": "selectionFor",
8139
8201
  "attribute": "selection-for",
8140
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8202
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8141
8203
  "type": "string"
8142
8204
  },
8143
8205
  {
8144
- "name": "selectionInfo",
8145
- "attribute": "selectionInfo",
8146
- "description": "The selection info (set by the selection component)",
8147
- "type": "object"
8206
+ "name": "selectionInfo"
8148
8207
  }
8149
8208
  ],
8150
8209
  "events": [
@@ -8166,13 +8225,8 @@
8166
8225
  },
8167
8226
  {
8168
8227
  "name": "selection-for",
8169
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8228
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8170
8229
  "type": "string"
8171
- },
8172
- {
8173
- "name": "selectionInfo",
8174
- "description": "The selection info (set by the selection component)",
8175
- "type": "object"
8176
8230
  }
8177
8231
  ],
8178
8232
  "properties": [
@@ -8185,14 +8239,11 @@
8185
8239
  {
8186
8240
  "name": "selectionFor",
8187
8241
  "attribute": "selection-for",
8188
- "description": "Id of the SelectionMixin component this component wants to observe (if not located within that component)",
8242
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8189
8243
  "type": "string"
8190
8244
  },
8191
8245
  {
8192
- "name": "selectionInfo",
8193
- "attribute": "selectionInfo",
8194
- "description": "The selection info (set by the selection component)",
8195
- "type": "object"
8246
+ "name": "selectionInfo"
8196
8247
  }
8197
8248
  ],
8198
8249
  "events": [
@@ -8208,7 +8259,7 @@
8208
8259
  "attributes": [
8209
8260
  {
8210
8261
  "name": "selection-single",
8211
- "description": "Whether the selection control is limited to single selection",
8262
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
8212
8263
  "type": "boolean",
8213
8264
  "default": "false"
8214
8265
  }
@@ -8217,7 +8268,7 @@
8217
8268
  {
8218
8269
  "name": "selectionSingle",
8219
8270
  "attribute": "selection-single",
8220
- "description": "Whether the selection control is limited to single selection",
8271
+ "description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
8221
8272
  "type": "boolean",
8222
8273
  "default": "false"
8223
8274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.197.3",
3
+ "version": "1.199.1",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "repository": "https://github.com/BrightspaceUI/core.git",
6
6
  "publishConfig": {