@brightspace-ui/core 1.180.2 → 1.182.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.
Files changed (122) hide show
  1. package/components/alert/demo/alert-toast.html +0 -2
  2. package/components/alert/demo/alert.html +0 -2
  3. package/components/backdrop/demo/backdrop.html +0 -2
  4. package/components/breadcrumbs/demo/breadcrumbs.html +0 -2
  5. package/components/button/demo/button-icon.html +0 -2
  6. package/components/button/demo/button-subtle.html +0 -2
  7. package/components/button/demo/button.html +0 -2
  8. package/components/button/demo/floating-buttons-in-frame.html +0 -2
  9. package/components/button/demo/floating-buttons-in-tabs.html +0 -2
  10. package/components/button/demo/floating-buttons-page.html +0 -2
  11. package/components/button/demo/floating-buttons.html +0 -2
  12. package/components/calendar/demo/calendar.html +0 -2
  13. package/components/card/demo/card.html +0 -2
  14. package/components/colors/demo/colors.html +0 -2
  15. package/components/count-badge/count-badge.js +4 -2
  16. package/components/count-badge/demo/count-badge.html +0 -2
  17. package/components/demo/demo/demo-snippet.html +0 -2
  18. package/components/dialog/demo/dialog-confirm.html +0 -2
  19. package/components/dialog/demo/dialog-fullscreen.html +0 -2
  20. package/components/dialog/demo/dialog-nested.html +0 -2
  21. package/components/dialog/demo/dialog.html +0 -2
  22. package/components/dropdown/demo/dropdown-button.html +0 -2
  23. package/components/dropdown/demo/dropdown-context-menu.html +0 -2
  24. package/components/dropdown/demo/dropdown-menu.html +0 -2
  25. package/components/dropdown/demo/dropdown-more.html +0 -2
  26. package/components/dropdown/demo/dropdown-tabs.html +0 -2
  27. package/components/dropdown/demo/dropdown.html +0 -2
  28. package/components/expand-collapse/demo/expand-collapse-content.html +0 -2
  29. package/components/filter/README.md +6 -3
  30. package/components/filter/demo/filter-search-demo.js +13 -10
  31. package/components/filter/demo/filter.html +17 -13
  32. package/components/filter/filter.js +57 -9
  33. package/components/focus-trap/demo/focus-trap.html +0 -2
  34. package/components/form/demo/form-native.html +0 -2
  35. package/components/form/demo/form.html +0 -2
  36. package/components/hierarchical-view/demo/hierarchical-view.html +0 -2
  37. package/components/html-block/README.md +116 -21
  38. package/components/html-block/demo/html-block.html +0 -2
  39. package/components/html-block/html-block.js +1 -0
  40. package/components/icons/demo/icon-custom.html +0 -2
  41. package/components/icons/demo/icon.html +0 -2
  42. package/components/inputs/demo/input-checkbox.html +0 -2
  43. package/components/inputs/demo/input-date-range.html +0 -2
  44. package/components/inputs/demo/input-date-time-range.html +0 -2
  45. package/components/inputs/demo/input-date-time.html +0 -2
  46. package/components/inputs/demo/input-date.html +0 -2
  47. package/components/inputs/demo/input-number.html +0 -2
  48. package/components/inputs/demo/input-percent.html +0 -2
  49. package/components/inputs/demo/input-radio.html +0 -2
  50. package/components/inputs/demo/input-search.html +0 -2
  51. package/components/inputs/demo/input-select.html +0 -2
  52. package/components/inputs/demo/input-text.html +0 -2
  53. package/components/inputs/demo/input-textarea.html +0 -2
  54. package/components/inputs/demo/input-time-range.html +0 -2
  55. package/components/inputs/demo/input-time.html +0 -2
  56. package/components/link/demo/link.html +0 -2
  57. package/components/list/README.md +359 -177
  58. package/components/list/demo/list-drag-and-drop.html +0 -2
  59. package/components/list/demo/list-item-actions.html +0 -2
  60. package/components/list/demo/list-item-layouts.html +0 -2
  61. package/components/list/demo/list.html +0 -2
  62. package/components/list/list-header.js +2 -1
  63. package/components/list/list-item-button.js +2 -1
  64. package/components/list/list-item-checkbox-mixin.js +12 -4
  65. package/components/list/list-item-drag-drop-mixin.js +17 -1
  66. package/components/list/list-item-drag-handle.js +18 -1
  67. package/components/list/list-item-generic-layout.js +1 -0
  68. package/components/list/list-item-link-mixin.js +1 -0
  69. package/components/list/list-item-mixin.js +2 -0
  70. package/components/list/list-item.js +3 -0
  71. package/components/list/list.js +2 -2
  72. package/components/loading-spinner/demo/loading-spinner.html +0 -2
  73. package/components/menu/demo/checkbox-menu.html +0 -2
  74. package/components/menu/demo/menu.html +0 -2
  75. package/components/menu/demo/radio-menu.html +0 -2
  76. package/components/meter/demo/meter.html +0 -2
  77. package/components/more-less/demo/more-less.html +0 -2
  78. package/components/offscreen/demo/offscreen.html +0 -2
  79. package/components/overflow-group/demo/overflow-group.html +0 -2
  80. package/components/scroll-wrapper/README.md +27 -9
  81. package/components/scroll-wrapper/demo/scroll-wrapper.html +0 -2
  82. package/components/scroll-wrapper/scroll-wrapper.js +2 -1
  83. package/components/selection/demo/selection.html +0 -2
  84. package/components/skeleton/demo/skeleton-mixin.html +0 -2
  85. package/components/status-indicator/demo/status-indicator.html +0 -2
  86. package/components/switch/demo/switch.html +0 -2
  87. package/components/table/demo/table.html +0 -2
  88. package/components/tabs/demo/tabs.html +0 -2
  89. package/components/tooltip/demo/tooltip.html +0 -2
  90. package/components/typography/demo/typography.html +0 -2
  91. package/custom-elements.json +70 -60
  92. package/directives/animate/demo/index.html +0 -2
  93. package/helpers/demo/announce.html +0 -2
  94. package/helpers/demo/dismissible.html +0 -2
  95. package/helpers/demo/gestures.html +0 -2
  96. package/helpers/framed.js +41 -0
  97. package/lang/ar.js +6 -0
  98. package/lang/cy.js +6 -0
  99. package/lang/da.js +6 -0
  100. package/lang/de.js +6 -0
  101. package/lang/en.js +6 -0
  102. package/lang/es-es.js +6 -0
  103. package/lang/es.js +6 -0
  104. package/lang/fr-fr.js +6 -0
  105. package/lang/fr.js +6 -0
  106. package/lang/ja.js +6 -0
  107. package/lang/ko.js +6 -0
  108. package/lang/nl.js +6 -0
  109. package/lang/pt.js +6 -0
  110. package/lang/sv.js +6 -0
  111. package/lang/tr.js +6 -0
  112. package/lang/zh-tw.js +6 -0
  113. package/lang/zh.js +6 -0
  114. package/mixins/async-container/demo/async-container.html +0 -2
  115. package/mixins/demo/arrow-keys-mixin.html +0 -2
  116. package/mixins/demo/labelled-mixin.html +0 -2
  117. package/mixins/demo/localize-mixin.html +0 -2
  118. package/mixins/labelled-mixin.js +8 -0
  119. package/package.json +1 -2
  120. package/templates/primary-secondary/demo/index.html +0 -2
  121. package/templates/primary-secondary/demo/overflow-hidden.html +0 -2
  122. package/templates/primary-secondary/demo/width-type-normal.html +0 -2
@@ -1,46 +1,88 @@
1
1
  # Lists
2
2
 
3
- ## d2l-list
4
-
5
- The `d2l-list` is the container to create a styled list of items using `d2l-list-item` or `d2l-list-item-button`. It provides the appropriate `list` semantics as well as options for displaying separators, etc.
6
-
7
- ![List](./screenshots/list.png?raw=true)
3
+ A list displays a collection of objects of the same type. A list is primarily used in order to help users navigate to a full-page representation of a single object, or to select several items and execute an action on them.
8
4
 
5
+ <!-- docs: demo autoSize:false size:large -->
9
6
  ```html
10
7
  <script type="module">
8
+ import '@brightspace-ui/core/components/dropdown/dropdown-more.js';
9
+ import '@brightspace-ui/core/components/dropdown/dropdown-menu.js';
11
10
  import '@brightspace-ui/core/components/list/list.js';
12
11
  import '@brightspace-ui/core/components/list/list-item.js';
12
+ import '@brightspace-ui/core/components/list/list-item-content.js';
13
+ import '@brightspace-ui/core/components/menu/menu.js';
14
+ import '@brightspace-ui/core/components/menu/menu-item.js';
13
15
  </script>
14
16
 
15
- <d2l-list>
16
- <d2l-list-item>...</d2l-list-item>
17
- <d2l-list-item>...</d2l-list-item>
18
- ...
17
+ <d2l-list style="width: 100%">
18
+ <d2l-list-item>
19
+ <d2l-list-item-content>
20
+ <div>Regular list item</div>
21
+ <div slot="secondary">Secondary information</div>
22
+ </d2l-list-item-content>
23
+ </d2l-list-item>
24
+ <d2l-list-item href="http://www.d2l.com" key="1">
25
+ <img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg" />
26
+ <d2l-list-item-content>
27
+ <div>More exciting list item</div>
28
+ <div slot="supporting-info">Supporting information</div>
29
+ </d2l-list-item-content>
30
+ <div slot="actions">
31
+ <d2l-dropdown-more text="Open">
32
+ <d2l-dropdown-menu>
33
+ <d2l-menu label="Menu">
34
+ <d2l-menu-item text="Action 1"></d2l-menu-item>
35
+ <d2l-menu-item text="Action 2"></d2l-menu-item>
36
+ </d2l-menu>
37
+ </d2l-dropdown-menu>
38
+ </d2l-dropdown-more>
39
+ </div>
40
+ </d2l-list-item>
41
+ <d2l-list-item href="http://www.d2l.com" selectable key="2" selected>
42
+ <img slot="illustration" src="https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg">
43
+ <d2l-list-item-content>
44
+ <div>Selectable list item (selected)</div>
45
+ <div slot="supporting-info">Supporting information</div>
46
+ </d2l-list-item-content>
47
+ </d2l-list-item>
19
48
  </d2l-list>
20
49
  ```
21
50
 
22
- **Properties:**
51
+ ## Best Practices
52
+ <!-- docs: start best practices -->
53
+ <!-- docs: start dos -->
54
+ * Lists are good when items may have different attributes, and if presented in a table would have many empty cells in the columns
55
+ * Tables take up a lot of horizontal space, and don’t really have responsive behaviour other than offscreen scroll
56
+ * Tables have fixed width columns – every column’s size is driven by the largest element. If the contents of a certain “column” are highly variable, consider a list
57
+ * Generally, the larger touch target of the list is easier to use than needing to target a link in the first column of a table, if the primary use case is navigation & selection rather than analysis, consider a list
58
+ <!-- docs: end dos -->
23
59
 
24
- | Property | Type | Description |
25
- |--|--|--|
26
- | `grid` | Boolean | Enables keyboard grid for supported list items |
27
- | `selection-single` | Boolean | Whether to render with single selection behaviour. If selection-single is specified, the list-items will render with radios instead of checkboxes, and the list component will maintain a single selected item. |
28
- | `separators` | String | Display separators (`all` (default), `between`, `none`) |
29
- | `extend-separators` | Boolean | Whether to extend the separators beyond the content's edge |
60
+ <!-- docs: start donts -->
61
+ * If your data is highly numerical, or a complex dataset, and making comparisons across column is essential to the user’s workflow, consider a table
62
+ * If the user is expected to frequently change the sorting order, the sortable column headers of tables speed up this process
63
+ * Lists don’t have headings, so for views where additional information would otherwise be repeated in every individual item, consider a table
64
+ <!-- docs: end donts -->
65
+ <!-- docs: end best practices -->
30
66
 
31
- **Methods:**
67
+ ## Accessibility
32
68
 
33
- - `getListItemCount`: returns the length of the items within the list
34
- - `getListItemIndex` (Object): returns the index of the given element within the list
35
- - `getSelectionInfo` (Object): returns a `SelectionInfo` object containing the `state` (`none`, `some`, `all`), and the `keys` (Array) for the selected items
69
+ If your list items are selectable or have secondary action buttons, use the ARIA layout grid on `d2l-list` to make it easy to navigate between items. This makes the entire list a single tab stop, and then the user can use the arrow keys to navigate between various list rows and actions in the list item.
36
70
 
37
- **Events:**
71
+ **Benefits of the ARIA layout grid:**
38
72
 
39
- - `d2l-list-selection-change`: dispatched when the selection state changes
73
+ * Specifying the list as a single tab stop using the ARIA layout grid allows the user to navigate from selecting items to applying actions on their selection with a single tab
74
+ * The layout grid allows the user to arrow “down” the column of checkboxes (or action buttons) without all the extra tab stops in-between
75
+
76
+ **Guidelines of specifying the ARIA layout Grid:**
77
+
78
+ * The item selection manipulators should be in a single pseudo-column
79
+ * All list item content for a list item should reside in a single pseudo-column
80
+ * Each Secondary Action Button should reside in it’s own pseudo-column
81
+ * Do not use the ARIA layout grid if there are multiple links or navigation actions in the list item content
40
82
 
41
- ### Accessibility Grid
83
+ **Implementation Details:**
42
84
 
43
- The `grid` attribute will enable a table-like keyboard grid that allows a user to traverse list items with their keyboard. Left and right will switch if using an RTL language.
85
+ When using `d2l-list`, the `grid` attribute will enable the table-like keyboard grid that allows a user to traverse list items with their keyboard. Left and right will switch if using an RTL language.
44
86
 
45
87
  * **ArrowLeft** moves to the next left item in a row
46
88
  * **ArrowRight** moves to the next right item in a row
@@ -56,100 +98,285 @@ The `grid` attribute will enable a table-like keyboard grid that allows a user t
56
98
 
57
99
  **Note about actions:** Actions must be placed in the `actions` slot. The grid does not support actions/focusable items that are placed in the content area. The list item currently only supports navigation with `href` as the content action.
58
100
 
59
- ## d2l-list-header
101
+ ## List [d2l-list]
102
+
103
+ The `d2l-list` is the container to create a styled list of items using `d2l-list-item` or `d2l-list-item-button`. It provides the appropriate `list` semantics as well as options for displaying separators, etc.
104
+
105
+ <!-- docs: start hidden content -->
106
+ ![List](./screenshots/list.png?raw=true)
107
+ <!-- docs: end hidden content -->
108
+
109
+ <!-- docs: demo live name:d2l-list autoSize:false size:medium -->
110
+ ```html
111
+ <script type="module">
112
+ import '@brightspace-ui/core/components/list/list.js';
113
+ import '@brightspace-ui/core/components/list/list-item.js';
114
+ import '@brightspace-ui/core/components/list/list-item-content.js';
115
+ </script>
116
+
117
+ <d2l-list style="width: 100%">
118
+ <d2l-list-item selectable>
119
+ <d2l-list-item-content>
120
+ <div>Regular list item</div>
121
+ <div slot="secondary">Secondary information</div>
122
+ <div slot="supporting-info">Supporting information</div>
123
+ </d2l-list-item-content>
124
+ </d2l-list-item>
125
+ <d2l-list-item selectable>
126
+ <d2l-list-item-content>
127
+ <div>Regular list item 2</div>
128
+ <div slot="secondary">Secondary information</div>
129
+ <div slot="supporting-info">Supporting information</div>
130
+ </d2l-list-item-content>
131
+ </d2l-list-item>
132
+ </d2l-list>
133
+ ```
134
+
135
+ <!-- docs: start hidden content -->
136
+ ### Properties
137
+
138
+ | Property | Type | Description |
139
+ |---|---|---|
140
+ | `grid` | Boolean | Enables keyboard grid for supported list items. See [Accessibility](#accessibility). |
141
+ | `selection-single` | Boolean | Whether to render with single selection behaviour. If `selection-single` is specified, the list-items will render with radios instead of checkboxes, and the list component will maintain a single selected item. |
142
+ | `separators` | String | Display separators (`all` (default), `between`, `none`) |
143
+ | `extend-separators` | Boolean | Whether to extend the separators beyond the content's edge |
144
+
145
+ ### Events
146
+
147
+ - `d2l-list-selection-change`: dispatched when the selection state changes
148
+ <!-- docs: end hidden content -->
149
+
150
+ ### Methods
151
+
152
+ - `getListItemCount`: returns the length of the items within the list
153
+ - `getListItemIndex` (Object): returns the index of the given element within the list
154
+ - `getSelectionInfo` (Object): returns a `SelectionInfo` object containing the `state` (`none`, `some`, `all`), and the `keys` (Array) for the selected items
155
+
156
+ ## Selection Lists
157
+
158
+ The `d2l-list` supports selectable items within a list, including both single and multi. Selection is enabled when a `d2l-list-item` has the `selectable` attribute set on it, and is by default multi-select which is indicated by a checkbox. Setting `selection-single` on the `d2l-list` wrapper enables single selection, which renders the selectable items with radio buttons. A `d2l-list-header` component can be added before the `d2l-list-item` component in order to have an easy multi-select header with actions.
159
+
160
+ ### Accessibility Properties
161
+
162
+ If a `d2l-list-item` is selectable then it should have a `label` attribute set on it which corresponds to the hidden label for the checkbox.
163
+
164
+ ### Example
165
+
166
+ <!-- docs: demo code autoSize:false size:medium -->
167
+ ```html
168
+ <script type="module">
169
+ import '@brightspace-ui/core/components/list/list.js';
170
+ import '@brightspace-ui/core/components/list/list-header.js';
171
+ import '@brightspace-ui/core/components/list/list-item.js';
172
+ import '@brightspace-ui/core/components/list/list-item-content.js';
173
+ import '@brightspace-ui/core/components/selection/selection-action.js';
174
+ </script>
175
+
176
+ <d2l-list style="width: 100%">
177
+ <d2l-list-header slot="header">
178
+ <d2l-selection-action icon="tier1:delete" text="Delete" requires-selection></d2l-selection-action>
179
+ </d2l-list-header>
180
+ <d2l-list-item selectable key="eth" label="Earth Sciences">
181
+ <d2l-list-item-content>
182
+ <div>Earth Sciences</div>
183
+ <div slot="supporting-info">Supporting information</div>
184
+ </d2l-list-item-content>
185
+ </d2l-list-item>
186
+ <d2l-list-item selectable key="ast" label="Astronomy">
187
+ <d2l-list-item-content>
188
+ <div>Astronomy</div>
189
+ <div slot="supporting-info">Supporting information</div>
190
+ </d2l-list-item-content>
191
+ </d2l-list-item>
192
+ </d2l-list>
193
+ ```
194
+
195
+ ## Drag & Drop Lists
196
+
197
+ The `d2l-list` supports drag & drop.
198
+
199
+ <!-- docs: start hidden content -->
200
+ ![List](./screenshots/drag-and-drop.gif?raw=true)
201
+ <!-- docs: end hidden content -->
202
+
203
+ Because the list itself is a rendering component, there is some light work involved in hooking up this behaviour.
204
+
205
+ - `d2l-list-item` components within the list must be `draggable` and have `key` set to something unique
206
+ - Reordering and re-rendering is the controlling component's responsibility
207
+
208
+ Here is a simple component example that adds drag 'n' drop to a list:
209
+
210
+ <!-- docs: demo code autoSize:false size:medium -->
211
+ ```html
212
+ <script type="module">
213
+ import '@brightspace-ui/core/components/list/list.js';
214
+ import '@brightspace-ui/core/components/list/list-item.js';
215
+ import '@brightspace-ui/core/components/list/list-item-content.js';
216
+ import { css, html, LitElement } from 'lit-element/lit-element.js';
217
+
218
+ class ListDemoDragAndDropUsage extends LitElement {
219
+ static get properties() {
220
+ return {
221
+ list: { type: Array }
222
+ };
223
+ }
224
+
225
+ constructor() {
226
+ super();
227
+ this.list = [
228
+ {
229
+ key: '1',
230
+ content: 'Initially first list item'
231
+ },
232
+ {
233
+ key: '2',
234
+ content: 'Initially second list item'
235
+ },
236
+ {
237
+ key: '3',
238
+ content: 'Initially third list item'
239
+ }
240
+ ];
241
+ }
242
+
243
+ render() {
244
+ const listItems = this.list.map((item) => {
245
+ return html`
246
+ <d2l-list-item draggable key="${item.key}">
247
+ <d2l-list-item-content>
248
+ ${item.content}
249
+ <div slot="secondary">Secondary information</div>
250
+ </d2l-list-item-content>
251
+ </d2l-list-item>
252
+ `;
253
+ });
254
+
255
+ return html`
256
+ <d2l-list @d2l-list-item-position-change="${this._moveItems}">
257
+ ${listItems}
258
+ </d2l-list>
259
+ `;
260
+ }
261
+
262
+ _moveItems(e) {
263
+ e.detail.reorder(this.list, { keyFn: (item) => item.key });
264
+ this.requestUpdate('list', []);
265
+ }
266
+ }
267
+ customElements.define('d2l-my-drag-drop-elem', ListDemoDragAndDropUsage);
268
+ </script>
269
+ <d2l-my-drag-drop-elem style="width: 100%;"></d2l-my-drag-drop-elem>
270
+ ```
271
+
272
+ ## List Header [d2l-list-header]
60
273
 
61
274
  The `d2l-list-header` component can be placed in the `d2l-list`'s `header` slot to provide a select-all checkbox, summary, a slot for `d2l-selection-action`s, and overflow-group behaviour.
62
275
 
276
+ <!-- docs: start hidden content -->
63
277
  ![List](./screenshots/list-selection.png?raw=true)
278
+ <!-- docs: end hidden content -->
64
279
 
280
+ <!-- docs: demo live name:d2l-list-header autoSize:false size:medium -->
65
281
  ```html
66
282
  <script type="module">
67
283
  import '@brightspace-ui/core/components/list/list.js';
68
284
  import '@brightspace-ui/core/components/list/list-header.js';
69
285
  import '@brightspace-ui/core/components/list/list-item.js';
286
+ import '@brightspace-ui/core/components/list/list-item-content.js';
70
287
  import '@brightspace-ui/core/components/selection/selection-action.js';
71
288
  </script>
72
289
 
73
- <d2l-list>
290
+ <d2l-list style="width: 100%">
74
291
  <d2l-list-header slot="header">
75
- <d2l-selection-action requires-selection ...></d2l-selection-action>
76
- <d2l-selection-action ...></d2l-selection-action>
292
+ <d2l-selection-action icon="tier1:delete" text="Delete" requires-selection></d2l-selection-action>
293
+ <d2l-selection-action icon="tier1:gear" text="Settings"></d2l-selection-action>
77
294
  </d2l-list-header>
78
- <d2l-list-item selectable key="eth" label="Earth Sciences">...</d2l-list-item>
79
- <d2l-list-item selectable key="tch" label="Teaching Practicum">...</d2l-list-item>
80
- ...
295
+ <d2l-list-item selectable key="eth" label="Earth Sciences">
296
+ <d2l-list-item-content>
297
+ <div>Earth Sciences</div>
298
+ <div slot="supporting-info">Supporting information</div>
299
+ </d2l-list-item-content>
300
+ </d2l-list-item>
301
+ <d2l-list-item selectable key="ast" label="Atronomy">
302
+ <d2l-list-item-content>
303
+ <div>Astronomy</div>
304
+ <div slot="supporting-info">Supporting information</div>
305
+ </d2l-list-item-content>
306
+ </d2l-list-item>
81
307
  </d2l-list>
82
308
  ```
83
309
 
84
- **Properties:**
310
+ <!-- docs: start hidden content -->
311
+ ### Properties
85
312
 
86
313
  | Property | Type | Description |
87
- |--|--|--|
314
+ |---|---|---|
88
315
  | `slim` | Boolean | Whether to render a header with reduced whitespace |
316
+ <!-- docs: end hidden content -->
89
317
 
90
- ## d2l-list-item
318
+ ## List Item [d2l-list-item]
91
319
 
92
320
  The `d2l-list-item` provides the appropriate `listitem` semantics for children within a list. It also provides some basic layout, breakpoints for responsiveness, a navigation link for the primary action, and selection. It extends `ListItemLinkMixin` and `ListItemMixin` and has all the same use cases as the mixin.
93
321
 
322
+ <!-- docs: start hidden content -->
94
323
  ![List](./screenshots/list-item.png?raw=true)
324
+ <!-- docs: end hidden content -->
95
325
 
326
+ <!-- docs: demo live name:d2l-list-item autoSize:false size:small -->
96
327
  ```html
97
- <d2l-list-item breakpoints="array"
98
- href="http://www.d2l.com"
99
- key="item1"
100
- label="some label"
101
- selectable
102
- selected
103
- disabled>
104
- <img src="..." slot="illustration">
105
- <div>...</div>
106
- <div slot="actions">
107
- <d2l-button-icon ...></d2l-button-icon>
108
- <d2l-button-icon ...></d2l-button-icon>
109
- </div>
110
- </d2l-list-item>
328
+ <script type="module">
329
+ import '@brightspace-ui/core/components/button/button-icon.js';
330
+ import '@brightspace-ui/core/components/list/list.js';
331
+ import '@brightspace-ui/core/components/list/list-item.js';
332
+ import '@brightspace-ui/core/components/list/list-item-content.js';
333
+ </script>
334
+
335
+ <d2l-list>
336
+ <d2l-list-item href="http://www.d2l.com" selectable key="3">
337
+ <img slot="illustration" src="https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg" />
338
+ <d2l-list-item-content>
339
+ <div>Geomorphology and GIS </div>
340
+ <div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
341
+ </d2l-list-item-content>
342
+ <div slot="actions">
343
+ <d2l-button-icon text="My Button" icon="tier1:preview"></d2l-button-icon>
344
+ </div>
345
+ </d2l-list-item>
346
+ </d2l-list>
111
347
  ```
112
348
 
113
- **Properties:**
349
+ <!-- docs: start hidden content -->
350
+ ### Properties
114
351
 
115
352
  | Property | Type | Description |
116
- |--|--|--|
353
+ |---|---|---|
117
354
  | `href` | String | Address of item link if navigable |
118
355
 
119
- **Events**
356
+ ### Events
120
357
 
121
358
  - `d2l-list-item-link-click`: dispatched when the item's primary link action is clicked
359
+ <!-- docs: end hidden content -->
122
360
 
123
- ## d2l-list-item-button
361
+ ### Breakpoints Property
124
362
 
125
- The `d2l-list-item-button` provides the same functionality as `d2l-list-item` except with button semantics for its primary action. It extends `ListItemButtonMixin` and `ListItemMixin` and has all the same use cases as the mixin.
126
-
127
- ![List](./screenshots/list-item.png?raw=true)
128
-
129
- ```html
130
- <d2l-list-item-button breakpoints="array"
131
- @d2l-list-item-button-click="..."
132
- key="item1"
133
- label="some label"
134
- selectable
135
- selected
136
- disabled>
137
- <img src="..." slot="illustration">
138
- <div>...</div>
139
- <div slot="actions">
140
- <d2l-button-icon ...></d2l-button-icon>
141
- <d2l-button-icon ...></d2l-button-icon>
142
- </div>
143
- </d2l-list-item-button>
144
- ```
145
-
146
- **Events**
147
-
148
- - `d2l-list-item-button-click`: dispatched when the item's primary button action is clicked
363
+ - `breakpoints` (Array): Breakpoints for responsiveness (`[842, 636, 580, 0]`), in pixels. There are four different breakpoints and only the four largest breakpoints will be used. If less breakpoints are used, then skip a middle breakpoint so that the first and last breakpoints will map to the largest and smallest layouts.
364
+ - Breakpoint 0
365
+ - Image: max dimensions: `width: 90px` and `height: 52px` and has `18px margin` from the main content;
366
+ - default break: `x < 580px` where `x` is the width of the component.
367
+ - Breakpoint 1
368
+ - Image: max dimensions: `width: 120px` and `height: 71px` and has `20px margin` from the main content;
369
+ - default break: `581px < x < 636px` where `x` is the width of the component.
370
+ - Breakpoint 2
371
+ - Image: max dimensions: `width: 180px` and `height: 102px` and has `20px margin` from the main content;
372
+ - default break: `637px < x < 842px` where `x` is the width of the component.
373
+ - Breakpoint 3
374
+ - Image: max dimensions: `width: 216px` and `height: 120px` and has `20px margin` from the main content;
375
+ - default break: `843px < x` where `x` is the width of the component.
149
376
 
150
377
  ## ListItemMixin
151
378
 
152
- Want to maintain consistency with `d2l-list-item` but need more modularity? This mixin is for you! This mixin allows you to make a component into a list item without requiring custom styling. All of the properties and functionality from `d2l-list-item` will be added to your new component.
379
+ Want to maintain consistency with `d2l-list-item` but need more modularity? This mixin is for you! This mixin allows you to make a component into a list item without requiring custom styling. All of the properties and functionality from `d2l-list-item` (listed above) will be added to your new component.
153
380
 
154
381
  ### How to use
155
382
 
@@ -164,18 +391,18 @@ class ListItem extends ListItemMixin(LitElement) {
164
391
  How add the styles:
165
392
  ```javascript
166
393
  static get styles() {
167
- return [ super.styles ];
394
+ return [ super.styles ];
168
395
  }
169
396
  ```
170
397
 
171
398
  How to render the list item:
172
399
  ```javascript
173
400
  render() {
174
- return this._renderListItem({
175
- illustration: html`[Image HTML here]`,
176
- content: html`[Content here such as d2l-list-item-content]`,
177
- actions: html`actions here`
178
- });
401
+ return this._renderListItem({
402
+ illustration: html`[Image HTML here]`,
403
+ content: html`[Content here such as d2l-list-item-content]`,
404
+ actions: html`actions here`
405
+ });
179
406
  }
180
407
  ```
181
408
  Where the parameters correspond to the slots of `d2l-list-item`:
@@ -183,117 +410,70 @@ Where the parameters correspond to the slots of `d2l-list-item`:
183
410
  - content (TemplateResult): Core content of the list item, such as a d2l-list-item-content element.
184
411
  - actions (TemplateResult): Secondary actions for the list item.
185
412
 
186
- **Properties:**
187
-
188
- - `breakpoints` (Array): Breakpoints for responsiveness (`[842, 636, 580, 0]`), in pixels. There are four different breakpoints and only the four largest breakpoints will be used. If less breakpoints are used, then skip a middle breakpoint so that the first and last breakpoints will map to the largest and smallest layouts.
189
- - Breakpoint 0
190
- - Image: max dimensions: `width: 90px` and `height: 52px` and has `18px margin` from the main content;
191
- - default break: `x < 580px` where `x` is the width of the component.
192
- - Breakpoint 1
193
- - Image: max dimensions: `width: 120px` and `height: 71px` and has `20px margin` from the main content;
194
- - default break: `581px < x < 636px` where `x` is the width of the component.
195
- - Breakpoint 2
196
- - Image: max dimensions: `width: 180px` and `height: 102px` and has `20px margin` from the main content;
197
- - default break: `637px < x < 842px` where `x` is the width of the component.
198
- - Breakpoint 3
199
- - Image: max dimensions: `width: 216px` and `height: 120px` and has `20px margin` from the main content;
200
- - default break: `843px < x` where `x` is the width of the component.
201
- - `disabled` (Boolean): Whether or not the checkbox is disabled
202
- - `draggable` (Boolean): Whether or not the item is draggable
203
- - `key` (String): Value to identify item if selectable
204
- - `label` (String): The hidden label for the checkbox if selectable
205
- - `selectable` (Boolean): Indicates a checkbox should be rendered for selecting the item
206
- - `selected` (Boolean): Whether the item is selected
207
- - `slim` (Boolean): Whether to render the item with reduced whitespace
208
-
209
- **Events**
210
-
211
- - `d2l-list-item-position-change`: dispatched when a draggable list item's position changes in the list
212
-
213
- **Accessibility**
413
+ ### Accessibility Properties
214
414
 
215
415
  - `drag-handle-text`: The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode.
216
416
 
217
- ## d2l-list-item-content
417
+ ## Button List Item [d2l-list-item-button]
218
418
 
219
- The `d2l-list-item-content` provides additional consistent layout for primary and secondary text in item content. It may be used with or without the `illustration` and `action` slots mentioned above.
419
+ The `d2l-list-item-button` provides the same functionality as `d2l-list-item` except with button semantics for its primary action. It extends `ListItemButtonMixin` and `ListItemMixin` and has all the same use cases as the mixin.
220
420
 
221
- ![List](./screenshots/list-item-content.png?raw=true)
421
+ <!-- docs: start hidden content -->
422
+ ![List](./screenshots/list-item.png?raw=true)
423
+ <!-- docs: end hidden content -->
222
424
 
425
+ <!-- docs: demo live name:d2l-list-item-button -->
223
426
  ```html
224
- <d2l-list-item>
225
- <d2l-list-item-content>
226
- <div>Item 1</div>
227
- <div slot="secondary">Secondary Info for item 1</div>
228
- <div slot="supporting-info">Supporting info for item 1</div>
229
- </d2l-list-item-content>
230
- </d2l-list-item>
231
- ```
232
-
233
- ## Drag & Drop Lists
427
+ <script type="module">
428
+ import '@brightspace-ui/core/components/list/list.js';
429
+ import '@brightspace-ui/core/components/list/list-item-button.js';
430
+ import '@brightspace-ui/core/components/list/list-item-content.js';
431
+ </script>
234
432
 
235
- The `d2l-list` supports drag & drop.
433
+ <d2l-list style="width: 100%">
434
+ <d2l-list-item-button href="http://www.d2l.com" selectable key="1">
435
+ <d2l-list-item-content>
436
+ <div>Geomorphology and GIS </div>
437
+ <div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
438
+ </d2l-list-item-content>
439
+ </d2l-list-item-button>
440
+ </d2l-list>
441
+ ```
236
442
 
237
- ![List](./screenshots/drag-and-drop.gif?raw=true)
443
+ <!-- docs: start hidden content -->
444
+ ### Events
238
445
 
239
- Because the list itself is a rendering component, there is some light work involved in hooking up this behaviour.
240
-
241
- - `d2l-list-item` components within the list must be `draggable` and have `key` set to something unique
242
- - Reordering and re-rendering is the controlling component's responsibility
446
+ - `d2l-list-item-button-click`: dispatched when the item's primary button action is clicked
447
+ <!-- docs: end hidden content -->
243
448
 
244
- Here is a simple component example that adds drag 'n' drop to a list:
449
+ ## List Item Content
245
450
 
246
- ```js
247
- import '../list-item.js';
248
- import '../list.js';
249
- import { html, LitElement } from 'lit-element/lit-element.js';
250
- import { repeat } from 'lit-html/directives/repeat';
251
-
252
- class ListDemoDragAndDropUsage extends LitElement {
253
- static get properties() {
254
- return {
255
- list: { type: Array }
256
- };
257
- }
451
+ The `d2l-list-item-content` provides additional consistent layout for primary and secondary text in item content. It may be used with or without the `illustration` and `action` slots mentioned above.
258
452
 
259
- constructor() {
260
- super();
261
- this.list = [
262
- {
263
- key: '1',
264
- content: 'I am another cool list item'
265
- },
266
- {
267
- key: '2',
268
- content: 'I am an extra cool list item'
269
- },
270
- {
271
- key: '3',
272
- content: 'I am a very cool list item'
273
- }
274
- ];
275
- }
453
+ <!-- docs: start hidden content -->
454
+ ![List](./screenshots/list-item-content.png?raw=true)
455
+ <!-- docs: end hidden content -->
276
456
 
277
- render() {
278
- return html`
279
- <d2l-list @d2l-list-item-position-change="${this._moveItems}">
280
- ${repeat(this.list, (item) => item.key, (item) => html`
281
- <d2l-list-item draggable key="${item.key}">
282
- ${item.content}
283
- </d2l-list-item>
284
- `)}
285
- </d2l-list>
286
- `;
287
- }
457
+ <!-- docs: demo live name:d2l-list-item-content -->
458
+ ```html
459
+ <script type="module">
460
+ import '@brightspace-ui/core/components/list/list.js';
461
+ import '@brightspace-ui/core/components/list/list-item.js';
462
+ import '@brightspace-ui/core/components/list/list-item-content.js';
463
+ </script>
288
464
 
289
- _moveItems(e) {
290
- e.detail.reorder(this.list, { keyFn: (item) => item.key });
291
- this.requestUpdate('list', []);
292
- }
293
- }
465
+ <d2l-list style="width: 100%">
466
+ <d2l-list-item>
467
+ <d2l-list-item-content>
468
+ <div>Item 1</div>
469
+ <div slot="secondary">Secondary Info for item 1</div>
470
+ <div slot="supporting-info">Supporting info for item 1</div>
471
+ </d2l-list-item-content>
472
+ </d2l-list-item>
473
+ </d2l-list>
294
474
  ```
295
475
 
296
- ### d2l-list-item-position-change Event Details
476
+ ## Event Details: @d2l-list-item-position-change
297
477
 
298
478
  This event includes a detail object with helper methods attached to it.
299
479
 
@@ -313,8 +493,10 @@ This event includes a detail object with helper methods attached to it.
313
493
  - `keyFn(any)`: A callback function that takes a given item in the array and returns its key
314
494
 
315
495
 
496
+ <!-- docs: start hidden content -->
316
497
  ## Future Enhancements
317
498
 
318
499
  - Paging: integration with "load more", "scroll" and "numeric" paging mechanisms
319
500
 
320
501
  Looking for an enhancement not listed here? Create a GitHub issue!
502
+ <!-- docs: end hidden content -->